linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Drivers: hv: Miscellaneous fixes
@ 2018-09-17  4:13 kys
  2018-09-17  4:14 ` [PATCH 1/2] Drivers: hv: vmbus: Use get/put_cpu() in vmbus_connect() kys
  0 siblings, 1 reply; 7+ messages in thread
From: kys @ 2018-09-17  4:13 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, jasowang, sthemmin,
	Michael.H.Kelley, vkuznets
  Cc: K. Y. Srinivasan

From: "K. Y. Srinivasan" <kys@microsoft.com>

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] Drivers: hv: vmbus: Use get/put_cpu() in vmbus_connect()
  2018-09-17  4:13 [PATCH 0/2] Drivers: hv: Miscellaneous fixes kys
@ 2018-09-17  4:14 ` kys
  2018-09-17  4:14   ` [PATCH 2/2] tools: hv: fcopy: set 'error' in case an unknown operation was requested kys
  0 siblings, 1 reply; 7+ messages in thread
From: kys @ 2018-09-17  4:14 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, jasowang, sthemmin,
	Michael.H.Kelley, vkuznets
  Cc: Dexuan Cui, stable, K . Y . Srinivasan, Haiyang Zhang

From: Dexuan Cui <decui@microsoft.com>

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 <decui@microsoft.com>
Cc: stable@vger.kernel.org
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] tools: hv: fcopy: set 'error' in case an unknown operation was requested
  2018-09-17  4:14 ` [PATCH 1/2] Drivers: hv: vmbus: Use get/put_cpu() in vmbus_connect() kys
@ 2018-09-17  4:14   ` kys
  2018-09-17  4:56     ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: kys @ 2018-09-17  4:14 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, jasowang, sthemmin,
	Michael.H.Kelley, vkuznets
  Cc: K . Y . Srinivasan

From: Vitaly Kuznetsov <vkuznets@redhat.com>

'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 <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] tools: hv: fcopy: set 'error' in case an unknown operation was requested
  2018-09-17  4:14   ` [PATCH 2/2] tools: hv: fcopy: set 'error' in case an unknown operation was requested kys
@ 2018-09-17  4:56     ` Greg KH
  2018-09-17 14:16       ` KY Srinivasan
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2018-09-17  4:56 UTC (permalink / raw)
  To: kys
  Cc: linux-kernel, devel, olaf, apw, jasowang, sthemmin,
	Michael.H.Kelley, vkuznets

On Mon, Sep 17, 2018 at 04:14:55AM +0000, kys@linuxonhyperv.com wrote:
> From: Vitaly Kuznetsov <vkuznets@redhat.com>
> 
> '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 <vkuznets@redhat.com>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> ---
>  tools/hv/hv_fcopy_daemon.c | 1 +
>  1 file changed, 1 insertion(+)

No need to backport for stable?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH 2/2] tools: hv: fcopy: set 'error' in case an unknown operation was requested
  2018-09-17  4:56     ` Greg KH
@ 2018-09-17 14:16       ` KY Srinivasan
  2018-09-17 14:28         ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: KY Srinivasan @ 2018-09-17 14:16 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-kernel, devel, olaf, apw, jasowang, Stephen Hemminger,
	Michael Kelley (EOSG),
	vkuznets



> -----Original Message-----
> From: Greg KH <gregkh@linuxfoundation.org>
> Sent: Sunday, September 16, 2018 9:56 PM
> To: KY Srinivasan <kys@microsoft.com>
> Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> olaf@aepfle.de; apw@canonical.com; jasowang@redhat.com; Stephen
> Hemminger <sthemmin@microsoft.com>; Michael Kelley (EOSG)
> <Michael.H.Kelley@microsoft.com>; vkuznets <vkuznets@redhat.com>
> 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, kys@linuxonhyperv.com wrote:
> > From: Vitaly Kuznetsov <vkuznets@redhat.com>
> >
> > '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 <vkuznets@redhat.com>
> > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> > ---
> >  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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] tools: hv: fcopy: set 'error' in case an unknown operation was requested
  2018-09-17 14:16       ` KY Srinivasan
@ 2018-09-17 14:28         ` Greg KH
  2018-09-17 15:25           ` KY Srinivasan
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2018-09-17 14:28 UTC (permalink / raw)
  To: KY Srinivasan
  Cc: olaf, Stephen Hemminger, jasowang, linux-kernel,
	Michael Kelley (EOSG),
	apw, devel, vkuznets

On Mon, Sep 17, 2018 at 02:16:48PM +0000, KY Srinivasan wrote:
> 
> 
> > -----Original Message-----
> > From: Greg KH <gregkh@linuxfoundation.org>
> > Sent: Sunday, September 16, 2018 9:56 PM
> > To: KY Srinivasan <kys@microsoft.com>
> > Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> > olaf@aepfle.de; apw@canonical.com; jasowang@redhat.com; Stephen
> > Hemminger <sthemmin@microsoft.com>; Michael Kelley (EOSG)
> > <Michael.H.Kelley@microsoft.com>; vkuznets <vkuznets@redhat.com>
> > 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, kys@linuxonhyperv.com wrote:
> > > From: Vitaly Kuznetsov <vkuznets@redhat.com>
> > >
> > > '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 <vkuznets@redhat.com>
> > > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> > > ---
> > >  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... :)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH 2/2] tools: hv: fcopy: set 'error' in case an unknown operation was requested
  2018-09-17 14:28         ` Greg KH
@ 2018-09-17 15:25           ` KY Srinivasan
  0 siblings, 0 replies; 7+ messages in thread
From: KY Srinivasan @ 2018-09-17 15:25 UTC (permalink / raw)
  To: Greg KH
  Cc: olaf, Stephen Hemminger, jasowang, linux-kernel,
	Michael Kelley (EOSG),
	apw, devel, vkuznets



> -----Original Message-----
> From: Greg KH <gregkh@linuxfoundation.org>
> Sent: Monday, September 17, 2018 7:28 AM
> To: KY Srinivasan <kys@microsoft.com>
> Cc: olaf@aepfle.de; Stephen Hemminger <sthemmin@microsoft.com>;
> jasowang@redhat.com; linux-kernel@vger.kernel.org; Michael Kelley
> (EOSG) <Michael.H.Kelley@microsoft.com>; apw@canonical.com;
> devel@linuxdriverproject.org; vkuznets <vkuznets@redhat.com>
> 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 <gregkh@linuxfoundation.org>
> > > Sent: Sunday, September 16, 2018 9:56 PM
> > > To: KY Srinivasan <kys@microsoft.com>
> > > Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> > > olaf@aepfle.de; apw@canonical.com; jasowang@redhat.com; Stephen
> > > Hemminger <sthemmin@microsoft.com>; Michael Kelley (EOSG)
> > > <Michael.H.Kelley@microsoft.com>; vkuznets <vkuznets@redhat.com>
> > > 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, kys@linuxonhyperv.com
> wrote:
> > > > From: Vitaly Kuznetsov <vkuznets@redhat.com>
> > > >
> > > > '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 <vkuznets@redhat.com>
> > > > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> > > > ---
> > > >  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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-09-17 15:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-17  4:13 [PATCH 0/2] Drivers: hv: Miscellaneous fixes kys
2018-09-17  4:14 ` [PATCH 1/2] Drivers: hv: vmbus: Use get/put_cpu() in vmbus_connect() kys
2018-09-17  4:14   ` [PATCH 2/2] tools: hv: fcopy: set 'error' in case an unknown operation was requested kys
2018-09-17  4:56     ` Greg KH
2018-09-17 14:16       ` KY Srinivasan
2018-09-17 14:28         ` Greg KH
2018-09-17 15:25           ` KY Srinivasan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).