mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dexuan Cui <decui@microsoft.com>
To: David Miller <davem@davemloft.net>, KY Srinivasan <kys@microsoft.com>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"stephen@networkplumber.org" <stephen@networkplumber.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"driverdev-devel@linuxdriverproject.org" 
	<driverdev-devel@linuxdriverproject.org>,
	"olaf@aepfle.de" <olaf@aepfle.de>,
	"apw@canonical.com" <apw@canonical.com>,
	"jasowang@redhat.com" <jasowang@redhat.com>,
	"pebolle@tiscali.nl" <pebolle@tiscali.nl>,
	"stefanha@redhat.com" <stefanha@redhat.com>,
	"vkuznets@redhat.com" <vkuznets@redhat.com>,
	"dan.carpenter@oracle.com" <dan.carpenter@oracle.com>
Subject: RE: [PATCH V4 7/7] Drivers: hv: vmbus: disable local interrupt when hvsock's callback is running
Date: Thu, 30 Jul 2015 10:18:04 +0000	[thread overview]
Message-ID: <77fb17eab5474ee7bf34bb1c148b84ea@SIXPR30MB031.064d.mgd.msft.net> (raw)
In-Reply-To: <20150729.152809.1531386671239230150.davem@davemloft.net>

> From: David Miller
> Sent: Thursday, July 30, 2015 6:28
> > From: Dexuan Cui <decui@microsoft.com>
> > Date: Tue, 28 Jul 2015 05:35:30 -0700
> >
> > In the SMP guest case, when the per-channel callback hvsock_events() is
> > running on virtual CPU A, if the guest tries to close the connection on
> > virtual CPU B: we invoke vmbus_close() -> vmbus_close_internal(),
> > then we can have trouble: on B, vmbus_close_internal() will send IPI
> > reset_channel_cb() to A, trying to set channel->onchannel_callbackto NULL;
> > on A, if the IPI handler happens between
> > "if (channel->onchannel_callback != NULL)" and invoking
> > channel->onchannel_callback, we'll invoke a function pointer of NULL.
> >
> > This is why the patch is necessary.
> >
> Sorry, I do not accept that you must use conditional locking and/or
> IRQ disabling.
>
> Boil it down to what is necessary for the least common denominator,
> and use that unconditionally.

Hi David,
Thanks for the comment!

I agree with you it's not clean to use conditional IRQ disabling.

Here I didn't use unconditionally IRQ disabling because the Hyper-V netvsc
and storvsc driver's vmbus event callbacks (i.e. netvsc_channel_cb() and
storvsc_on_channel_callback()) may take relatively long time (e.g., netvsc can
operate at a speed of 10Gb) and I think it's bad to disable IRQ for long time
when the callbacks are running in a tasklet context, e.g., the Hyper-V timer
can be affected: see vmbus_isr() -> hv_process_timer_expiration().

To resolve the race condition between vmbus_close_internal() and
process_chn_event() in SMP case, now I propose a new method:

we can serialize the 2 paths by adding
tasklet_disable(hv_context.event_dpc[channel->target_cpu]) and
tasklet_enable(...) in vmbus_close_internal().

In this way, we need the least change and we can drop this patch.

Please let me know your opinion.

Thanks,
-- Dexuan

  reply	other threads:[~2015-07-30 10:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-28 12:35 Dexuan Cui
2015-07-29 22:28 ` David Miller
2015-07-30 10:18   ` Dexuan Cui [this message]
2015-08-06  4:44     ` Dexuan Cui
2015-08-06 17:50       ` KY Srinivasan
2015-08-07 10:24         ` Dexuan Cui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=77fb17eab5474ee7bf34bb1c148b84ea@SIXPR30MB031.064d.mgd.msft.net \
    --to=decui@microsoft.com \
    --cc=apw@canonical.com \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=driverdev-devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jasowang@redhat.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olaf@aepfle.de \
    --cc=pebolle@tiscali.nl \
    --cc=stefanha@redhat.com \
    --cc=stephen@networkplumber.org \
    --cc=vkuznets@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®