Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755302AbbHFRua (ORCPT ); Thu, 6 Aug 2015 13:50:30 -0400 Received: from mail-bn1bon0131.outbound.protection.outlook.com ([157.56.111.131]:55754 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753701AbbHFRu2 convert rfc822-to-8bit (ORCPT ); Thu, 6 Aug 2015 13:50:28 -0400 From: KY Srinivasan To: Dexuan Cui , David Miller CC: "olaf@aepfle.de" , "gregkh@linuxfoundation.org" , "jasowang@redhat.com" , "driverdev-devel@linuxdriverproject.org" , "linux-kernel@vger.kernel.org" , "stephen@networkplumber.org" , "stefanha@redhat.com" , "netdev@vger.kernel.org" , "apw@canonical.com" , "pebolle@tiscali.nl" , "dan.carpenter@oracle.com" Subject: RE: [PATCH V4 7/7] Drivers: hv: vmbus: disable local interrupt when hvsock's callback is running Thread-Topic: [PATCH V4 7/7] Drivers: hv: vmbus: disable local interrupt when hvsock's callback is running Thread-Index: AQHQySYM+NtmNi98EEG2i/XmaPHAV53zCWWAgADGWQCACqMYAIAA2yvw Date: Thu, 6 Aug 2015 17:50:24 +0000 Message-ID: References: <1438086930-19483-1-git-send-email-decui@microsoft.com> <20150729.152809.1531386671239230150.davem@davemloft.net> <77fb17eab5474ee7bf34bb1c148b84ea@SIXPR30MB031.064d.mgd.msft.net> <1e6203fcf0c645c98944f25425db9406@SIXPR30MB031.064d.mgd.msft.net> In-Reply-To: <1e6203fcf0c645c98944f25425db9406@SIXPR30MB031.064d.mgd.msft.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=kys@microsoft.com; x-originating-ip: [2001:4898:80e8::163] x-microsoft-exchange-diagnostics: 1;SN1PR0301MB1663;5:vFz4DOy3HvENkHf+dMcKp25l3p4DHSWvBgMM1lLl/gd7aA7/3Ap05OuabCu4Pud2iWFaJ6EjncGN7QsWSPyKCemT7mbLA708JGMIMgNe7jUT+z4xJwVhNbtFHZikjpWHfOneD28CQS01q5ELp77APg==;24:GDrxJAL6lCm2FFVWPuXO+Alz7q5KJRcyJYq9lYpikZSaNc1JGsva0iE+u8Kb0F1fZOgobWU2HA96pfJduiFZ8KXZlhhnGDOCT9YPjClL8b0=;20:emLYMWe3Fx8dH9RZSILB+kCL/r0TrJImrAfnMyaCMt7EOm9y4MCG0JXPMc2kVuxYm1WYL+X8FAaeFLbOnU//JA== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR0301MB1663; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(108003899814671); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(2401001)(5005006)(3002001);SRVR:SN1PR0301MB1663;BCL:0;PCL:0;RULEID:;SRVR:SN1PR0301MB1663; x-forefront-prvs: 06607E485E x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(51914003)(164054003)(13464003)(189002)(199003)(377454003)(87936001)(5005710100001)(93886004)(4001540100001)(76576001)(10400500002)(19580405001)(10290500002)(10090500001)(5001770100001)(97736004)(74316001)(2421001)(102836002)(64706001)(19580395003)(106356001)(86362001)(5003600100002)(77096005)(99286002)(2900100001)(46102003)(105586002)(92566002)(5002640100001)(106116001)(86612001)(2561002)(2950100001)(5001830100001)(62966003)(5001860100001)(77156002)(101416001)(2656002)(50986999)(81156007)(189998001)(40100003)(122556002)(76176999)(33656002)(1511001)(5001960100002)(68736005)(54356999)(3826002);DIR:OUT;SFP:1102;SCL:1;SRVR:SN1PR0301MB1663;H:SN1PR0301MB1662.namprd03.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Aug 2015 17:50:24.5135 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0301MB1663 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3835 Lines: 100 > -----Original Message----- > From: Dexuan Cui > Sent: Wednesday, August 5, 2015 9:44 PM > To: David Miller ; KY Srinivasan > > Cc: olaf@aepfle.de; gregkh@linuxfoundation.org; jasowang@redhat.com; > driverdev-devel@linuxdriverproject.org; linux-kernel@vger.kernel.org; > stephen@networkplumber.org; stefanha@redhat.com; > netdev@vger.kernel.org; apw@canonical.com; pebolle@tiscali.nl; > dan.carpenter@oracle.com > Subject: RE: [PATCH V4 7/7] Drivers: hv: vmbus: disable local interrupt when > hvsock's callback is running > > > -----Original Message----- > > From: devel [mailto:driverdev-devel-bounces@linuxdriverproject.org] On > Behalf > > Of Dexuan Cui > > Sent: Thursday, July 30, 2015 18:18 > > To: David Miller ; KY Srinivasan > > > Cc: olaf@aepfle.de; gregkh@linuxfoundation.org; jasowang@redhat.com; > > driverdev-devel@linuxdriverproject.org; linux-kernel@vger.kernel.org; > > stephen@networkplumber.org; stefanha@redhat.com; > netdev@vger.kernel.org; > > apw@canonical.com; pebolle@tiscali.nl; dan.carpenter@oracle.com > > Subject: RE: [PATCH V4 7/7] Drivers: hv: vmbus: disable local interrupt > when > > hvsock's callback is running > > > > > From: David Miller > > > Sent: Thursday, July 30, 2015 6:28 > > > > From: Dexuan Cui > > > > 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. > > > > -- Dexuan > > Hi David, KY and all, > > May I know your opinion about my idea of adding tasklet_disable/enbable() > in vmbus_close_internal() and dropping this patch? Sorry for the delayed response; I think this is a reasonable solution. Send me the patch. Regards, K. Y > > Thanks, > -- Dexuan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/