hv: hv_util: move vmbus_open() to a later place
Dexuan Cui
maintainerPATCH v2 1/3 hv: hv_util: move vmbus_open() to a later place
Before the line vmbus_open() returns, srv->util_cb can be already running and the variables, like util_fw_version, are needed by the srv->util_cb.
So we have to make sure the variables are initialized before the vmbus_open().
---
v2:
This is a RESEND.
I just added Vitaly's Reviewed-by.
drivers/hv/hv_util.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/hv/hv_util.c +6 -5
@@ -340,12 +340,8 @@ static int util_probe(struct hv_device *dev,set_channel_read_state (dev->channel, false); - ret =vmbus_open (dev->channel,4 *PAGE_SIZE ,4 *PAGE_SIZE ,NULL ,0 , - srv->util_cb, dev->channel); -if (ret) - goto error; -hv_set_drvdata (dev, srv); +/* * Based on the host; initialize the framework and * service version numbers we will negotiate.
@@ -365,6 +361,11 @@ static int util_probe(struct hv_device *dev, hb_srv_version =HB_VERSION ; } + ret =vmbus_open (dev->channel,4 *PAGE_SIZE ,4 *PAGE_SIZE ,NULL ,0 , + srv->util_cb, dev->channel); +if (ret) + goto error; +return 0 ; error:
Signature · 1 line
1.9.1
Quoted 2 lines · Dexuan Cui
Before the line
vmbus_open()returns,srv->util_cbcan be already running and the variables, likeutil_fw_version, are needed by thesrv->util_cb.
A questions is why we do this for util only? Can callbacks of other devices be called before vmbus_open() returns?
Quoted 21 lines
So we have to make sure the variables are initialized before the
vmbus_open().CC "K. Y. Srinivasan" <[email protected]>Reviewed-by Vitaly Kuznetsov <[email protected]>Signed-off-by Dexuan Cui <[email protected]>---
v2:
This is a RESEND.
I just added Vitaly's Reviewed-by.drivers/hv/hv_util.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)drivers/hv/hv_util.c +0
-0@@ -340,12 +340,8 @@ static int util_probe(struct hv_device *dev,
drivers/hv/hv_util.c static int util_probe(struct hv_device *dev, · line 345
Quoted 10 lines
drivers/hv/hv_util.c +1
-5set_channel_read_state (dev->channel, false); - ret =vmbus_open (dev->channel,4 *PAGE_SIZE ,4 *PAGE_SIZE ,NULL ,0 , - srv->util_cb, dev->channel); -if (ret) - goto error; -hv_set_drvdata (dev, srv); +
This seems unnecessary.
Quoted 20 lines
drivers/hv/hv_util.c +0
-0/* * Based on the host; initialize the framework and drivers/hv/hv_util.c +5
-0* service version numbers we will negotiate. @@ -365,6 +361,11 @@ static int util_probe(struct hv_device *dev, hb_srv_version =HB_VERSION ; } + ret =vmbus_open (dev->channel,4 *PAGE_SIZE ,4 *PAGE_SIZE ,NULL ,0 , + srv->util_cb, dev->channel); +if (ret) + goto error; +return 0 ;error:
Signature · 1 line
1.9.1
Dexuan Cui
maintainerQuoted 11 lines
-----Original Message-----
From: Jason Wang [mailto:[email protected]]
Sent: Monday, February 2, 2015 17:36 PM
To: Dexuan Cui
Cc: [email protected]; [email protected]; driverdev- [email protected]; [email protected]; [email protected]; KY Srinivasan; [email protected]; Haiyang Zhang
Subject: Re: [PATCH v2 1/3] hv:hv_util: movevmbus_open()to a later place
Quoted 8 lines
Quoted 4 lines · Dexuan Cui
Before the line
vmbus_open()returns,srv->util_cbcan be already running
and the variables, likeutil_fw_version, are needed by thesrv->util_cb.A questions is why we do this for util only? Can callbacks of other devices be called before
vmbus_open()returns?
The variables are used in vmbus_prep_negotiate_resp(), which is only for the util devices.
I think the other devices should already handle the similar issue properly. If this is not the case, we need to fix them too.
Quoted 25 lines
Quoted 25 lines
So we have to make sure the variables are initialized before the
vmbus_open().CC "K. Y. Srinivasan" <[email protected]>Reviewed-by Vitaly Kuznetsov <[email protected]>Signed-off-by Dexuan Cui <[email protected]>---
v2:
This is a RESEND.
I just added Vitaly's Reviewed-by.drivers/hv/hv_util.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)drivers/hv/hv_util.c +0
-0@@ -340,12 +340,8 @@ static int util_probe(struct hv_device *dev,set_channel_read_state (dev->channel, false);
Quoted 10 lines
drivers/hv/hv_util.c static int util_probe(struct hv_device *dev, · line 344
Quoted 8 lines
drivers/hv/hv_util.c +1
-5- ret =vmbus_open (dev->channel,4 *PAGE_SIZE ,4 *PAGE_SIZE ,NULL ,0 , - srv->util_cb, dev->channel); -if (ret) - goto error; -hv_set_drvdata (dev, srv); +This seems unnecessary.
Yeah, it's an empty line, splitting the line and the below comment. I'm Ok to not have it.
Quoted 15 lines
Quoted 15 lines
drivers/hv/hv_util.c +0
-0/* * Based on the host; initialize the framework and drivers/hv/hv_util.c +5
-0* service version numbers we will negotiate. @@ -365,6 +361,11 @@ static int util_probe(struct hv_device *dev, hb_srv_version =HB_VERSION ; } + ret =vmbus_open (dev->channel,4 *PAGE_SIZE ,4 *PAGE_SIZE ,NULL ,0 , + srv->util_cb, dev->channel); +if (ret) + goto error; +return 0 ;
Quoted 4 lines
Quoted 4 lines
error:
--
1.9.1
-- Dexuan ���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Quoted 20 lines · Dexuan Cui
Quoted 20 lines
-----Original Message-----
From: Jason Wang [mailto:[email protected]]
Sent: Monday, February 2, 2015 17:36 PM
To: Dexuan Cui
Cc: [email protected]; [email protected];
driverdev-
[email protected]; [email protected]; [email protected]; KY Srinivasan; [email protected]; Haiyang Zhang
Subject: Re: [PATCH v2 1/3] hv:hv_util: movevmbus_open()to a
later placeQuoted 4 lines · Dexuan Cui
Before the line
vmbus_open()returns,srv->util_cbcan be already running
and the variables, likeutil_fw_version, are needed by thesrv->util_cb.
Quoted 7 lines
Quoted 2 lines
A questions is why we do this for util only? Can callbacks of other devices be called before
vmbus_open()returns?The variables are used in
vmbus_prep_negotiate_resp(), which is only for the util devices.I think the other devices should already handle the similar issue properly. If this is not the case, we need to fix them too.
Better to check all the others, e.g in balloon_probe(), it call hv_set_drvdata() after vmbus_open() and dose several datas setups in the middle. If balloon_onchannelcallback() could be called before hv_set_drvdata(), the code looks wrong.
Thanks
Quoted 59 lines · KY Srinivasan
Quoted 51 lines
-----Original Message-----
From: Jason Wang [mailto:[email protected]]
Sent: Monday, February 2, 2015 7:09 PM
To: Dexuan Cui
Cc: [email protected]; [email protected];
driverdev-
[email protected]; [email protected]; [email protected]; KY Srinivasan; [email protected]; Haiyang Zhang
Subject: RE: [PATCH v2 1/3] hv:hv_util: movevmbus_open()to a
later placeQuoted 7 lines · Dexuan Cui
Quoted 7 lines
-----Original Message-----
From: Jason Wang [mailto:[email protected]]
Sent: Monday, February 2, 2015 17:36 PM
To: Dexuan Cui
Cc: [email protected]; [email protected];
driverdev-
[email protected]; [email protected];Quoted 7 lines
Quoted 7 lines
Srinivasan; [email protected]; Haiyang Zhang
Subject: Re: [PATCH v2 1/3] hv:hv_util: movevmbus_open()to a
later placeOn Mon, Feb 2, 2015 at 12:35 PM, Dexuan Cui
Quoted 2 lines
Quoted 2 lines
Quoted 1 line · wrote:
Before the line
vmbus_open()returns,srv->util_cbcan bealready
Quoted 1 line
Quoted 1 line
Quoted 1 line
running > and the variables, like
util_fw_version, are neededby
Quoted 3 lines
Quoted 3 lines
the >
srv->util_cb.A questions is why we do this for util only? Can callbacks of
other
Quoted 2 lines
Quoted 1 line
devices be called before
vmbus_open()returns?The variables are used in
vmbus_prep_negotiate_resp(), which isonly
Quoted 5 lines
for the util devices.
I think the other devices should already handle the similar issue properly.
If this is not the case, we need to fix them too.Quoted 5 lines
Better to check all the others, e.g in
balloon_probe(), it callhv_set_drvdata()aftervmbus_open()and dose several datas setups
in the
middle. Ifballoon_onchannelcallback()could be called beforehv_set_drvdata(), the code looks wrong.Jason,
Quoted 8 lines
For all other device types, the guest initiates the communication with the host and potentially negotiates appropriate (supported) version with the host. For the services packaged in the util driver, the flow is a little different - the host pushes the version information into the guest. So, the fix Dexuan made is only needed in the util driver.
Regards,
K. Y
Thanks, so you mean for other device, it won't get any interrupt before guest negotiate the version with host?
Quoted 6 lines
Quoted 5 lines
Thanks
Quoted 67 lines
-----Original Message-----
From: Jason Wang [mailto:[email protected]]
Sent: Monday, February 2, 2015 7:38 PM
To: KY Srinivasan
Cc: Dexuan Cui; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang
Subject: RE: [PATCH v2 1/3] hv:hv_util: movevmbus_open()to a later placeQuoted 52 lines · KY Srinivasan
Quoted 35 lines
-----Original Message-----
From: Jason Wang [mailto:[email protected]]
Sent: Monday, February 2, 2015 7:09 PM
To: Dexuan Cui
Cc: [email protected]; [email protected];
driverdev-
[email protected]; [email protected]; [email protected]; KY
Srinivasan; [email protected]; Haiyang Zhang
Subject: RE: [PATCH v2 1/3] hv:hv_util: movevmbus_open()to a
later placeQuoted 2 lines · Dexuan Cui
Quoted 2 lines
-----Original Message-----
From: Jason Wang [mailto:[email protected]] >> Sent: Monday,February 2, 2015 17:36 PM >> To: Dexuan Cui >> Cc:
[email protected]; [email protected]; >> driverdev- >> [email protected]; [email protected]; [email protected]; KY >> Srinivasan; [email protected]; Haiyang Zhang >> Subject: Re: [PATCH v2 1/3] hv:hv_util: movevmbus_open()to a >> later place >> >> >> >> On Mon, Feb 2, 2015 at 12:35Quoted 1 line · Dexuan Cui
Quoted 1 line
Quoted 1 line
Before the line
vmbus_open()returns,srv->util_cbcan bealready >> > running > and the variables, like
util_fw_version, are needed by >> the >srv->util_cb.Quoted 2 lines
Quoted 2 lines
A questions is why we do this for util only? Can callbacks of
other >> devices be called before
vmbus_open()returns?Quoted 1 line
The variables are used in
vmbus_prep_negotiate_resp(), which isonly > for the util devices.
Quoted 1 line
Quoted 8 lines
Quoted 3 lines
I think the other devices should already handle the similar issue properly.
If this is not the case, we need to fix them too.Better to check all the others, e.g in
balloon_probe(), it callhv_set_drvdata()aftervmbus_open()and dose several datas setups in
the middle. Ifballoon_onchannelcallback()could be called beforehv_set_drvdata(), the code looks wrong.Jason,
For all other device types, the guest initiates the communication with the host and potentially negotiates appropriate (supported) version with the host. For the services packaged in the util driver, the flow is a little different - the host pushes the version information into the guest. So, the fix Dexuan made is only needed in the util driver.
Quoted 6 lines
Quoted 3 lines
Regards,
K. Y
Thanks, so you mean for other device, it won't get any interrupt before guest negotiate the version with host?
Yes, the guest initiates the version negotiation. Are you seeing something different?
K. Y
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Thanks
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Quoted 38 lines
-----Original Message-----
From: Jason Wang [mailto:[email protected]]
Sent: Monday, February 2, 2015 7:09 PM
To: Dexuan Cui
Cc: [email protected]; [email protected]; driverdev- [email protected]; [email protected]; [email protected]; KY Srinivasan; [email protected]; Haiyang Zhang
Subject: RE: [PATCH v2 1/3] hv:hv_util: movevmbus_open()to a later placeQuoted 24 lines · Dexuan Cui
Quoted 13 lines
-----Original Message-----
From: Jason Wang [mailto:[email protected]]
Sent: Monday, February 2, 2015 17:36 PM
To: Dexuan Cui
Cc: [email protected]; [email protected];
driverdev-
[email protected]; [email protected]; [email protected]; KY
Srinivasan; [email protected]; Haiyang Zhang
Subject: Re: [PATCH v2 1/3] hv:hv_util: movevmbus_open()to a
later placeQuoted 8 lines
Quoted 2 lines · Dexuan Cui
Before the line
vmbus_open()returns,srv->util_cbcan be already running > and the variables, likeutil_fw_version, are needed bythe >
srv->util_cb.A questions is why we do this for util only? Can callbacks of other
devices be called beforevmbus_open()returns?The variables are used in
vmbus_prep_negotiate_resp(), which is only for the util devices.
Quoted 8 lines
Quoted 3 lines
I think the other devices should already handle the similar issue properly.
If this is not the case, we need to fix them too.Better to check all the others, e.g in
balloon_probe(), it callhv_set_drvdata()aftervmbus_open()and dose several datas setups in the middle. Ifballoon_onchannelcallback()could be called beforehv_set_drvdata(), the code looks wrong.
Jason,
For all other device types, the guest initiates the communication with the host and potentially negotiates appropriate (supported) version with the host. For the services packaged in the util driver, the flow is a little different - the host pushes the version information into the guest. So, the fix Dexuan made is only needed in the util driver.
Regards,
K. Y
Quoted 4 lines
Thanks
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Quoted 89 lines · KY Srinivasan
Quoted 89 lines
-----Original Message-----
From: Jason Wang [mailto:[email protected]]
Sent: Monday, February 2, 2015 7:38 PM
To: KY Srinivasan
Cc: Dexuan Cui; [email protected];
[email protected];
[email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang
Subject: RE: [PATCH v2 1/3] hv:hv_util: movevmbus_open()to a
later placeQuoted 9 lines · KY Srinivasan
Quoted 9 lines
-----Original Message-----
From: Jason Wang [mailto:[email protected]]
Sent: Monday, February 2, 2015 7:09 PM
To: Dexuan Cui
Cc: [email protected]; [email protected];
driverdev-
[email protected]; [email protected];Quoted 10 lines
Quoted 10 lines
Srinivasan; [email protected]; Haiyang Zhang
Subject: RE: [PATCH v2 1/3] hv:hv_util: movevmbus_open()to a
later placeQuoted 2 lines · Dexuan Cui
Quoted 2 lines
-----Original Message-----
From: Jason Wang [mailto:[email protected]] >> Sent:Monday,
Quoted 4 lines
Quoted 4 lines
February 2, 2015 17:36 PM >> To: Dexuan Cui >> Cc:
[email protected]; [email protected]; >> driverdev- >> [email protected]; [email protected]; [email protected]; KY >> Srinivasan; [email protected];Haiyang
Quoted 1 line
Quoted 1 line
Zhang >> Subject: Re: [PATCH v2 1/3] hv:
hv_util: move
vmbus_open()Quoted 1 line
Quoted 1 line
to a >> later place >> >> >> >> On Mon, Feb 2, 2015 at
12:35
Quoted 3 lines
Quoted 3 lines
Quoted 1 line · Dexuan Cui
Quoted 1 line
Quoted 1 line
Before the line
vmbus_open()returns,srv->util_cbcan bealready >> > running > and the variables, like
util_fw_version, areQuoted 3 lines
Quoted 3 lines
needed by >> the >
srv->util_cb.Quoted 2 lines
Quoted 2 lines
A questions is why we do this for util only? Can callbacks
of
Quoted 2 lines
Quoted 2 lines
other >> devices be called before
vmbus_open()returns?Quoted 1 line
The variables are used in
vmbus_prep_negotiate_resp(), whichis
Quoted 3 lines
Quoted 3 lines
only > for the util devices.
Quoted 2 lines
I think the other devices should already handle the similar
issue
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
properly.
If this is not the case, we need to fix them too.Better to check all the others, e.g in
balloon_probe(), it callhv_set_drvdata()aftervmbus_open()and dose several datassetups in
Quoted 1 line
Quoted 1 line
the middle. If
balloon_onchannelcallback()could be calledbefore
Quoted 5 lines
Quoted 1 line
hv_set_drvdata(), the code looks wrong.Jason,
For all other device types, the guest initiates the communication
with
Quoted 1 line
the host and potentially negotiates appropriate (supported)
version
Quoted 1 line
with the host. For the services packaged in the util driver, the
flow
Quoted 1 line
is a little different - the host pushes the version information
into
Quoted 1 line
the guest. So, the fix Dexuan made is only needed in the util
driver.
Quoted 4 lines
Regards,
K. Y
Quoted 7 lines
Quoted 3 lines
Thanks, so you mean for other device, it won't get any interrupt
before guest
negotiate the version with host?Yes, the guest initiates the version negotiation. Are you seeing something different?
K. Y
No, thanks.
Quoted 48 lines · Dexuan Cui
Before the line
vmbus_open()returns,srv->util_cbcan be already running and the variables, likeutil_fw_version, are needed by thesrv->util_cb.So we have to make sure the variables are initialized before the
vmbus_open().CC "K. Y. Srinivasan" <[email protected]>Reviewed-by Vitaly Kuznetsov <[email protected]>Signed-off-by Dexuan Cui <[email protected]>---
v2:
This is a RESEND.
I just added Vitaly's Reviewed-by.drivers/hv/hv_util.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)drivers/hv/hv_util.c +1
-5@@ -340,12 +340,8 @@ static int util_probe(struct hv_device *dev,set_channel_read_state (dev->channel, false); - ret =vmbus_open (dev->channel,4 *PAGE_SIZE ,4 *PAGE_SIZE ,NULL ,0 , - srv->util_cb, dev->channel); -if (ret) - goto error; -hv_set_drvdata (dev, srv); +/* * Based on the host; initialize the framework and drivers/hv/hv_util.c +5
-0* service version numbers we will negotiate. @@ -365,6 +361,11 @@ static int util_probe(struct hv_device *dev, hb_srv_version =HB_VERSION ; } + ret =vmbus_open (dev->channel,4 *PAGE_SIZE ,4 *PAGE_SIZE ,NULL ,0 , + srv->util_cb, dev->channel); +if (ret) + goto error; +return 0 ;
Quoted 3 lines
error:
Signature · 1 line
1.9.1