2018-09-17 04:15:30

by kys

[permalink] [raw]
Subject: [PATCH 0/2] Drivers: hv: Miscellaneous fixes

From: "K. Y. Srinivasan" <[email protected]>

Some miscellaneous fixes.

Dexuan Cui (1):
Drivers: hv: vmbus: Use get/put_cpu() in vmbus_connect()

Vitaly Kuznetsov (1):
tools: hv: fcopy: set 'error' in case an unknown operation was
requested

drivers/hv/connection.c | 8 +++++---
tools/hv/hv_fcopy_daemon.c | 1 +
2 files changed, 6 insertions(+), 3 deletions(-)

--
2.18.0



2018-09-17 04:16:22

by kys

[permalink] [raw]
Subject: [PATCH 1/2] Drivers: hv: vmbus: Use get/put_cpu() in vmbus_connect()

From: Dexuan Cui <[email protected]>

With CONFIG_DEBUG_PREEMPT=y, I always see this warning:
BUG: using smp_processor_id() in preemptible [00000000]

Fix the false warning by using get/put_cpu().

Here vmbus_connect() sends a message to the host and waits for the
host's response. The host will deliver the response message and an
interrupt on CPU msg->target_vcpu, and later the interrupt handler
will wake up vmbus_connect(). vmbus_connect() doesn't really have
to run on the same cpu as CPU msg->target_vcpu, so it's safe to
call put_cpu() just here.

Signed-off-by: Dexuan Cui <[email protected]>
Cc: [email protected]
Cc: K. Y. Srinivasan <[email protected]>
Cc: Haiyang Zhang <[email protected]>
Cc: Stephen Hemminger <[email protected]>
Signed-off-by: K. Y. Srinivasan <[email protected]>
---
drivers/hv/connection.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index ced041899456..f4d08c8ac7f8 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -76,6 +76,7 @@ static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo,
__u32 version)
{
int ret = 0;
+ unsigned int cur_cpu;
struct vmbus_channel_initiate_contact *msg;
unsigned long flags;

@@ -118,9 +119,10 @@ static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo,
* the CPU attempting to connect may not be CPU 0.
*/
if (version >= VERSION_WIN8_1) {
- msg->target_vcpu =
- hv_cpu_number_to_vp_number(smp_processor_id());
- vmbus_connection.connect_cpu = smp_processor_id();
+ cur_cpu = get_cpu();
+ msg->target_vcpu = hv_cpu_number_to_vp_number(cur_cpu);
+ vmbus_connection.connect_cpu = cur_cpu;
+ put_cpu();
} else {
msg->target_vcpu = 0;
vmbus_connection.connect_cpu = 0;
--
2.18.0


2018-09-17 04:17:52

by kys

[permalink] [raw]
Subject: [PATCH 2/2] tools: hv: fcopy: set 'error' in case an unknown operation was requested

From: Vitaly Kuznetsov <[email protected]>

'error' variable is left uninitialized in case we see an unknown operation.
As we don't immediately return and proceed to pwrite() we need to set it
to something, HV_E_FAIL sounds good enough.

Signed-off-by: Vitaly Kuznetsov <[email protected]>
Signed-off-by: K. Y. Srinivasan <[email protected]>
---
tools/hv/hv_fcopy_daemon.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/hv/hv_fcopy_daemon.c b/tools/hv/hv_fcopy_daemon.c
index d78aed86af09..8ff8cb1a11f4 100644
--- a/tools/hv/hv_fcopy_daemon.c
+++ b/tools/hv/hv_fcopy_daemon.c
@@ -234,6 +234,7 @@ int main(int argc, char *argv[])
break;

default:
+ error = HV_E_FAIL;
syslog(LOG_ERR, "Unknown operation: %d",
buffer.hdr.operation);

--
2.18.0


2018-09-17 04:56:55

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH 2/2] tools: hv: fcopy: set 'error' in case an unknown operation was requested

On Mon, Sep 17, 2018 at 04:14:55AM +0000, [email protected] wrote:
> From: Vitaly Kuznetsov <[email protected]>
>
> 'error' variable is left uninitialized in case we see an unknown operation.
> As we don't immediately return and proceed to pwrite() we need to set it
> to something, HV_E_FAIL sounds good enough.
>
> Signed-off-by: Vitaly Kuznetsov <[email protected]>
> Signed-off-by: K. Y. Srinivasan <[email protected]>
> ---
> tools/hv/hv_fcopy_daemon.c | 1 +
> 1 file changed, 1 insertion(+)

No need to backport for stable?


2018-09-17 14:20:03

by KY Srinivasan

[permalink] [raw]
Subject: RE: [PATCH 2/2] tools: hv: fcopy: set 'error' in case an unknown operation was requested



> -----Original Message-----
> From: Greg KH <[email protected]>
> Sent: Sunday, September 16, 2018 9:56 PM
> To: KY Srinivasan <[email protected]>
> Cc: [email protected]; [email protected];
> [email protected]; [email protected]; [email protected]; Stephen
> Hemminger <[email protected]>; Michael Kelley (EOSG)
> <[email protected]>; vkuznets <[email protected]>
> Subject: Re: [PATCH 2/2] tools: hv: fcopy: set 'error' in case an unknown
> operation was requested
>
> On Mon, Sep 17, 2018 at 04:14:55AM +0000, [email protected] wrote:
> > From: Vitaly Kuznetsov <[email protected]>
> >
> > 'error' variable is left uninitialized in case we see an unknown operation.
> > As we don't immediately return and proceed to pwrite() we need to set it
> > to something, HV_E_FAIL sounds good enough.
> >
> > Signed-off-by: Vitaly Kuznetsov <[email protected]>
> > Signed-off-by: K. Y. Srinivasan <[email protected]>
> > ---
> > tools/hv/hv_fcopy_daemon.c | 1 +
> > 1 file changed, 1 insertion(+)
>
> No need to backport for stable?
Thanks for pointing this out. Should I resubmit with the stable tag?

Thanks,

K. Y


2018-09-17 14:29:06

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH 2/2] tools: hv: fcopy: set 'error' in case an unknown operation was requested

On Mon, Sep 17, 2018 at 02:16:48PM +0000, KY Srinivasan wrote:
>
>
> > -----Original Message-----
> > From: Greg KH <[email protected]>
> > Sent: Sunday, September 16, 2018 9:56 PM
> > To: KY Srinivasan <[email protected]>
> > Cc: [email protected]; [email protected];
> > [email protected]; [email protected]; [email protected]; Stephen
> > Hemminger <[email protected]>; Michael Kelley (EOSG)
> > <[email protected]>; vkuznets <[email protected]>
> > Subject: Re: [PATCH 2/2] tools: hv: fcopy: set 'error' in case an unknown
> > operation was requested
> >
> > On Mon, Sep 17, 2018 at 04:14:55AM +0000, [email protected] wrote:
> > > From: Vitaly Kuznetsov <[email protected]>
> > >
> > > 'error' variable is left uninitialized in case we see an unknown operation.
> > > As we don't immediately return and proceed to pwrite() we need to set it
> > > to something, HV_E_FAIL sounds good enough.
> > >
> > > Signed-off-by: Vitaly Kuznetsov <[email protected]>
> > > Signed-off-by: K. Y. Srinivasan <[email protected]>
> > > ---
> > > tools/hv/hv_fcopy_daemon.c | 1 +
> > > 1 file changed, 1 insertion(+)
> >
> > No need to backport for stable?
> Thanks for pointing this out. Should I resubmit with the stable tag?

I can do it... :)


2018-09-17 15:27:07

by KY Srinivasan

[permalink] [raw]
Subject: RE: [PATCH 2/2] tools: hv: fcopy: set 'error' in case an unknown operation was requested



> -----Original Message-----
> From: Greg KH <[email protected]>
> Sent: Monday, September 17, 2018 7:28 AM
> To: KY Srinivasan <[email protected]>
> Cc: [email protected]; Stephen Hemminger <[email protected]>;
> [email protected]; [email protected]; Michael Kelley
> (EOSG) <[email protected]>; [email protected];
> [email protected]; vkuznets <[email protected]>
> Subject: Re: [PATCH 2/2] tools: hv: fcopy: set 'error' in case an unknown
> operation was requested
>
> On Mon, Sep 17, 2018 at 02:16:48PM +0000, KY Srinivasan wrote:
> >
> >
> > > -----Original Message-----
> > > From: Greg KH <[email protected]>
> > > Sent: Sunday, September 16, 2018 9:56 PM
> > > To: KY Srinivasan <[email protected]>
> > > Cc: [email protected]; [email protected];
> > > [email protected]; [email protected]; [email protected]; Stephen
> > > Hemminger <[email protected]>; Michael Kelley (EOSG)
> > > <[email protected]>; vkuznets <[email protected]>
> > > Subject: Re: [PATCH 2/2] tools: hv: fcopy: set 'error' in case an unknown
> > > operation was requested
> > >
> > > On Mon, Sep 17, 2018 at 04:14:55AM +0000, [email protected]
> wrote:
> > > > From: Vitaly Kuznetsov <[email protected]>
> > > >
> > > > 'error' variable is left uninitialized in case we see an unknown operation.
> > > > As we don't immediately return and proceed to pwrite() we need to set
> it
> > > > to something, HV_E_FAIL sounds good enough.
> > > >
> > > > Signed-off-by: Vitaly Kuznetsov <[email protected]>
> > > > Signed-off-by: K. Y. Srinivasan <[email protected]>
> > > > ---
> > > > tools/hv/hv_fcopy_daemon.c | 1 +
> > > > 1 file changed, 1 insertion(+)
> > >
> > > No need to backport for stable?
> > Thanks for pointing this out. Should I resubmit with the stable tag?
>
> I can do it... :)
Thank you!

K. Y