Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964889AbbDIJ1v (ORCPT ); Thu, 9 Apr 2015 05:27:51 -0400 Received: from mail-bn1bn0102.outbound.protection.outlook.com ([157.56.110.102]:48544 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933884AbbDIJ1p convert rfc822-to-8bit (ORCPT ); Thu, 9 Apr 2015 05:27:45 -0400 Authentication-Results: spf=pass (sender IP is 206.191.229.116) smtp.mailfrom=microsoft.com; vger.kernel.org; dkim=none (message not signed) header.d=none; From: Dexuan Cui To: Greg KH CC: "linux-kernel@vger.kernel.org" , "driverdev-devel@linuxdriverproject.org" , "olaf@aepfle.de" , "apw@canonical.com" , "jasowang@redhat.com" , KY Srinivasan , "vkuznets@redhat.com" , "dan.carpenter@oracle.com" , Haiyang Zhang Subject: RE: [PATCH] hv: vmbus_free_channels(): remove the redundant free_channel() Thread-Topic: [PATCH] hv: vmbus_free_channels(): remove the redundant free_channel() Thread-Index: AQHQcqSVJYh0lJJXgEet3gp89y9E151EZTXAgAACrICAAAFOoA== Date: Thu, 9 Apr 2015 09:27:35 +0000 Message-ID: <1ac796db26a44634886552ff253b39b6@SIXPR30MB031.064d.mgd.msft.net> References: <1428560027-31918-1-git-send-email-decui@microsoft.com> <20150409090706.GA28274@kroah.com> <7d15e4581f744e62b0c0218f2e209f8e@SIXPR30MB031.064d.mgd.msft.net> <20150409092139.GA359@kroah.com> In-Reply-To: <20150409092139.GA359@kroah.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [141.251.58.5] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:206.191.229.116;CTRY:US;IPV:NLI;EFV:NLI;BMV:1;SFV:NSPM;SFS:(10019020)(6009001)(438002)(189002)(51704005)(164054003)(24454002)(199003)(13464003)(19580395003)(2900100001)(6806004)(19580405001)(54356999)(23726002)(16796002)(46406003)(2950100001)(92566002)(106116001)(33646002)(86146001)(76176999)(97756001)(50986999)(106466001)(46102003)(110136001)(66066001)(102836002)(87936001)(77156002)(86362001)(86612001)(2656002)(47776003)(62966003)(93886004)(24736003)(108616004)(50466002);DIR:OUT;SFP:1102;SCL:1;SRVR:BN1PR03MB072;H:064-smtp-out.microsoft.com;FPR:;SPF:Pass;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN1PR03MB072; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5002010)(5005006);SRVR:BN1PR03MB072;BCL:0;PCL:0;RULEID:;SRVR:BN1PR03MB072; X-Forefront-PRVS: 0541031FF6 X-OriginatorOrg: microsoft.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2015 09:27:41.3882 (UTC) X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=72f988bf-86f1-41af-91ab-2d7cd011db47;Ip=[206.191.229.116];Helo=[064-smtp-out.microsoft.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR03MB072 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3525 Lines: 95 Thanks, -- Dexuan > -----Original Message----- > From: Greg KH [mailto:gregkh@linuxfoundation.org] > Sent: Thursday, April 9, 2015 17:22 > To: Dexuan Cui > Cc: linux-kernel@vger.kernel.org; driverdev-devel@linuxdriverproject.org; > olaf@aepfle.de; apw@canonical.com; jasowang@redhat.com; KY Srinivasan; > vkuznets@redhat.com; dan.carpenter@oracle.com; Haiyang Zhang > Subject: Re: [PATCH] hv: vmbus_free_channels(): remove the redundant > free_channel() > > On Thu, Apr 09, 2015 at 09:15:30AM +0000, Dexuan Cui wrote: > > > -----Original Message----- > > > From: Greg KH [mailto:gregkh@linuxfoundation.org] > > > Sent: Thursday, April 9, 2015 17:07 > > > To: Dexuan Cui > > > Cc: linux-kernel@vger.kernel.org; driverdev-devel@linuxdriverproject.org; > > > olaf@aepfle.de; apw@canonical.com; jasowang@redhat.com; KY Srinivasan; > > > vkuznets@redhat.com; dan.carpenter@oracle.com; Haiyang Zhang > > > Subject: Re: [PATCH] hv: vmbus_free_channels(): remove the redundant > > > free_channel() > > > > > > On Wed, Apr 08, 2015 at 11:13:47PM -0700, Dexuan Cui wrote: > > > > free_channel() has been invoked in > > > > vmbus_remove() -> hv_process_channel_removal(), or vmbus_remove() -> > > > > ... -> vmbus_close_internal() -> hv_process_channel_removal(). > > > > > > > > We also change to use list_for_each_entry_safe(), because the entry > > > > is removed in hv_process_channel_removal(). > > > > > > > > Thank Dan Carpenter for finding the issue! > > > > > > > > Signed-off-by: Dexuan Cui > > > > Reported-by: Dan Carpenter > > > > Cc: K. Y. Srinivasan > > > > Cc: Vitaly Kuznetsov > > > > --- > > > > drivers/hv/channel_mgmt.c | 11 ++++++++--- > > > > 1 file changed, 8 insertions(+), 3 deletions(-) > > > > > > > > diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c > > > > index 0eeb1b3..865a3af 100644 > > > > --- a/drivers/hv/channel_mgmt.c > > > > +++ b/drivers/hv/channel_mgmt.c > > > > @@ -212,11 +212,16 @@ void hv_process_channel_removal(struct > > > vmbus_channel *channel, u32 relid) > > > > > > > > void vmbus_free_channels(void) > > > > { > > > > - struct vmbus_channel *channel; > > > > + struct vmbus_channel *channel, *tmp; > > > > + > > > > + list_for_each_entry_safe(channel, tmp, &vmbus_connection.chn_list, > > > > + listentry) { > > > > > > Horrid indentation, never put continuations on a 1 tab stop location, > > > you can't read this properly, right? > > > > > > > + /* if we don't set rescind to true, vmbus_close_internal() > > > > + * won't invoke hv_process_channel_removal(). > > > > + */ > > > > + channel->rescind = true; > > > > > > You are changing the logic here, right? Why do you now need the _safe() > > > call if you aren't freeing anything? > > > > > > confused, > > > > > > greg k-h > > > > Hi Greg, > > vmbus_device_unregister() invokes device_unregister() -> vmbus_remove() -> > > hv_process_channel_removal() -- in this function, we remove the entry from > > the list: > > list_del(&channel->listentry) > > and we run free_channel(channel). > > What is "this function" referring to here? vmbus_free_channels()? > > still confused. > > greg k-h "this function" means hv_process_channel_removal(). -- 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/