From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932083AbdK1P6X (ORCPT ); Tue, 28 Nov 2017 10:58:23 -0500 Received: from mail-bl2nam02on0095.outbound.protection.outlook.com ([104.47.38.95]:45712 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753120AbdK1P6T (ORCPT ); Tue, 28 Nov 2017 10:58:19 -0500 From: KY Srinivasan To: Greg KH CC: "linux-kernel@vger.kernel.org" , "devel@linuxdriverproject.org" , "olaf@aepfle.de" , "apw@canonical.com" , "vkuznets@redhat.com" , "jasowang@redhat.com" , "leann.ogasawara@canonical.com" , "marcelo.cerri@canonical.com" , Stephen Hemminger , Stephen Hemminger Subject: RE: [PATCH 2/2] vmbus: make hv_get_ringbuffer_availbytes local Thread-Topic: [PATCH 2/2] vmbus: make hv_get_ringbuffer_availbytes local Thread-Index: AQHTXXFynKOWrpX1Y0WpntS1iNFgJKMqAe2AgAADH3A= Date: Tue, 28 Nov 2017 15:58:16 +0000 Message-ID: References: <1510681887-13846-1-git-send-email-kys@exchange.microsoft.com> <1510681928-13951-2-git-send-email-kys@exchange.microsoft.com> <20171128153441.GA24659@kroah.com> In-Reply-To: <20171128153441.GA24659@kroah.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Owner=kys@microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2017-11-28T15:58:08.9860783Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic; Sensitivity=General x-originating-ip: [103.194.13.187] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR21MB0843;6:NI6sFRf7CeqeAwLKI6R/luzrwk9PpriVrii/4RrCYBjrS72qe9hmGUAJbd2F+s5+5u7FKYy1PFUECr6Nq9Du3lYaJh8VMwNTYTsvF6MtxdEagRall47+Pwp16qXEnSr0FEikXSKlGyD9AOsODLwKqFO30wLmlG2dKOq10PI0KxtpzjGG+GUzFsRE8jQquZwMsVvG3eX/FCuxV6aBKu0Ugv9YWV3rMHhAEbmxlaEIFOJS48xS+OjMYHOAr8wvyz7dfkAw+G9JhmYgRShQY9X2bF4gLRWmqdt7xePKtS0+Y1Ps5pBLU/U2wGgAP5PlLdY1LqpWpnu+zwcCXBzTu2brZJjs8Q/hXpdVN/D7KxmAvwk=;5:eyHfZZIiTN7uCET9/H4QQPgoVAD/ZGq7UTbwaD3Y1IKAsNb15IXVgovPf2CIgkF6W6JLmyMzx81Qk0pdP4hdjeJQq+FRp0n7QdUtlpJjzaVVVBPyF++dmwcsOUhDQZxmLv+FKnW/e+cyt9t2WCDydJzQj3pHwumlqe4LPnOMxyw=;24:Gw/zldrCgl6SR83jzcEvim0wagVFNOZ8+3l804/omZ244bFPazuMzUyDRgWuVmYHtSYFR75cOmJ+KGml2sBilV4xwDG+/66oXRYW98uE8bU=;7:VACDl96dQm7GlIWR/ibXOAOB8wWtp+S9CR6i2GwL7SVjQYtx1nPi4PCRndE1rNv+LpMJEAP79x+ZpHi29Y/bUGnrm90HkQvFTL19Yf5s+UcVeiORZan+SjTgQsCWM9fRVVelKHEL4RTCVQZnLg1ZcWHYvlmuAdBgKZdt2rLGSaI7iSzfp5Ft1IuBmHFiMqatO1/uLIPQquKh2s6IGCZYD6L+keoGLEJmvuwJLeDcMBY1zJd8gg5X2ybqigXXCR+k x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI;SCL:-1;SFV:NSPM;SFS:(10019020)(6009001)(7966004)(366004)(39860400002)(376002)(346002)(47760400005)(24454002)(13464003)(199003)(189002)(316002)(8676002)(106356001)(7416002)(101416001)(74316002)(68736007)(3280700002)(6916009)(53546010)(3660700001)(14454004)(2900100001)(86362001)(55016002)(2906002)(189998001)(86612001)(81166006)(81156014)(25786009)(33656002)(2950100002)(10090500001)(97736004)(7736002)(22452003)(102836003)(305945005)(105586002)(6116002)(3846002)(229853002)(7696005)(77096006)(6246003)(6506006)(10290500003)(54906003)(9686003)(4326008)(8990500004)(6436002)(5660300001)(99286004)(66066001)(8936002)(53936002)(54356999)(50986999)(508600001)(76176999);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR21MB0843;H:DM5PR21MB0476.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; x-ms-office365-filtering-correlation-id: 1ac7bb43-11da-4c72-4456-08d53678d67e x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603258);SRVR:DM5PR21MB0843; x-ms-traffictypediagnostic: DM5PR21MB0843: authentication-results: spf=none (sender IP is ) smtp.mailfrom=kys@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(89211679590171)(9452136761055)(140211028294663)(198206253151910); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040450)(2401047)(5005006)(8121501046)(10201501046)(3231022)(93006095)(93001095)(3002001)(6055026)(61426038)(61427038)(6041248)(20161123560025)(20161123555025)(20161123564025)(20161123562025)(20161123558100)(201703131423075)(201703011903075)(201702281528075)(201703061421075)(6072148)(201708071742011);SRVR:DM5PR21MB0843;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:DM5PR21MB0843; x-forefront-prvs: 0505147DDB spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ac7bb43-11da-4c72-4456-08d53678d67e X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Nov 2017 15:58:16.4274 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR21MB0843 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id vASFwU4u011704 > -----Original Message----- > From: Greg KH [mailto:gregkh@linuxfoundation.org] > Sent: Tuesday, November 28, 2017 7:35 AM > To: KY Srinivasan > Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org; > olaf@aepfle.de; apw@canonical.com; vkuznets@redhat.com; > jasowang@redhat.com; leann.ogasawara@canonical.com; > marcelo.cerri@canonical.com; Stephen Hemminger > ; Stephen Hemminger > > Subject: Re: [PATCH 2/2] vmbus: make hv_get_ringbuffer_availbytes local > > On Tue, Nov 14, 2017 at 10:52:08AM -0700, kys@exchange.microsoft.com > wrote: > > From: Stephen Hemminger > > > > hv_get_ringbuffer_availbytes is only used by the debug info > > routine so make it static. Also, add READ_ONCE() to avoid any > > possible issues with potentially volatile index values. > > > > Signed-off-by: Stephen Hemminger > > Signed-off-by: K. Y. Srinivasan > > --- > > drivers/hv/ring_buffer.c | 23 +++++++++++++++++++++++ > > include/linux/hyperv.h | 22 ---------------------- > > 2 files changed, 23 insertions(+), 22 deletions(-) > > > > diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c > > index 12eb8ca..50e0714 100644 > > --- a/drivers/hv/ring_buffer.c > > +++ b/drivers/hv/ring_buffer.c > > @@ -140,6 +140,29 @@ static u32 hv_copyto_ringbuffer( > > return start_write_offset; > > } > > > > +/* > > + * > > + * hv_get_ringbuffer_availbytes() > > + * > > + * Get number of bytes available to read and to write to > > + * for the specified ring buffer > > + */ > > +static void > > +hv_get_ringbuffer_availbytes(const struct hv_ring_buffer_info *rbi, > > + u32 *read, u32 *write) > > +{ > > + u32 read_loc, write_loc, dsize; > > + > > + /* Capture the read/write indices before they changed */ > > + read_loc = READ_ONCE(rbi->ring_buffer->read_index); > > + write_loc = READ_ONCE(rbi->ring_buffer->write_index); > > + dsize = rbi->ring_datasize; > > + > > + *write = write_loc >= read_loc ? dsize - (write_loc - read_loc) : > > + read_loc - write_loc; > > + *read = dsize - *write; > > +} > > + > > /* Get various debug metrics for the specified ring buffer. */ > > void hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info > *ring_info, > > struct hv_ring_buffer_debug_info > *debug_info) > > diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h > > index 6c93366..93bd6fc 100644 > > --- a/include/linux/hyperv.h > > +++ b/include/linux/hyperv.h > > @@ -127,28 +127,6 @@ struct hv_ring_buffer_info { > > u32 priv_read_index; > > }; > > > > -/* > > - * > > - * hv_get_ringbuffer_availbytes() > > - * > > - * Get number of bytes available to read and to write to > > - * for the specified ring buffer > > - */ > > -static inline void > > -hv_get_ringbuffer_availbytes(const struct hv_ring_buffer_info *rbi, > > - u32 *read, u32 *write) > > -{ > > - u32 read_loc, write_loc, dsize; > > - > > - /* Capture the read/write indices before they changed */ > > - read_loc = rbi->ring_buffer->read_index; > > - write_loc = rbi->ring_buffer->write_index; > > - dsize = rbi->ring_datasize; > > - > > - *write = write_loc >= read_loc ? dsize - (write_loc - read_loc) : > > - read_loc - write_loc; > > - *read = dsize - *write; > > -} > > > > static inline u32 hv_get_bytes_to_read(const struct hv_ring_buffer_info > *rbi) > > { > > -- > > 1.7.1 > > This breaks the build. > > Please be more careful... Sorry about that. I did not have a build issue on the tree I tested. I will rebase and send. K. Y > > greg k-h