Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2067207imm; Thu, 18 Oct 2018 08:33:27 -0700 (PDT) X-Google-Smtp-Source: ACcGV63ej3GeAf4pojUJwLokFYoSKD0qqHsV0lZPU1fwniMhJdgLSBEltI0VnNovx8CLsZySgYIC X-Received: by 2002:a63:5816:: with SMTP id m22-v6mr28519737pgb.332.1539876807762; Thu, 18 Oct 2018 08:33:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539876807; cv=none; d=google.com; s=arc-20160816; b=zOY4Klipla7Wp59ZkRtAL2Cm8PrZ50NsgdmRKbuVdxvHxRBxbzOAbKqzBQHWhdylL/ I9YWL3cjTHBs98TiGZsMMXVwGSeM0swt8P2VUJgTx6DSqe3CtM358ejYrVz0r9BtNCeZ nGnZajL4Q+k/FCUv1rhCUub1Zy5ZZd+SBNYq7TBJQcNNINUW6cnDZVP4GYKVK3iO9GIg vS1zK6HbTtski3Q3xMXkYU7W7bdacZwhE1C/a+YpKTjnXbBj6D9vHpg6l2LOguKcEiDM pw9nSIUTZv0dckcu3SPRYj254KgrUHRh3J7tMtv1wAglGFCShRjsEHqJtOL473fqJIYo mu0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:msip_labels :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=pu7PuAm4iLDixk9M/ZnBF7z1c5OYIrCWhN2EnqAi5vg=; b=nbhLRX3O+QCoin5EiWqIHPhfH1PqOI/efMeQOKtgqhZcsbVpIFpuiRWohn1gIHgXgu 7bO7D8WbDz8RoF3W8R8OpL+BpMlqgTdaYkPxzZDr6tCj9pD082GMMiQZXRQu6ThGd2LO Vaf9Y/XSmFGcfrHyLqyJ51KFzttMUvRsu+GF2XwWaY72xAXWAMJaUHwKK2nH5dSEDRoj jFXlfj6TufH4SNlPudl0znY8HqZUzsP8eC+s55boskH2rTAkZaZqEYAUalBoGTh4lIKh 5TVoBQHnZ3LJGNt0zAhFN1X4VdraWq3GHz2RwfgLML6mUeg6pQJCcKxcJ/zKTAJZWKG/ QcIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=jlvVPHZQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y40-v6si2455883pla.389.2018.10.18.08.33.12; Thu, 18 Oct 2018 08:33:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=jlvVPHZQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728327AbeJRXeK (ORCPT + 99 others); Thu, 18 Oct 2018 19:34:10 -0400 Received: from mail-eopbgr690135.outbound.protection.outlook.com ([40.107.69.135]:4682 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727757AbeJRXeK (ORCPT ); Thu, 18 Oct 2018 19:34:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pu7PuAm4iLDixk9M/ZnBF7z1c5OYIrCWhN2EnqAi5vg=; b=jlvVPHZQvzOWwKtJp5XuihUbpjL2NDlDc/MF29Gm5eGXdAGCJLwhIvrn4+pVEFcctrg6QRd6jBLkYAhb/C/WFGTCcTSTUNBL59rrfoZxUgyGB4n/Xx8GZ2uMDclnbKK34sjtEk0YnWy60he/t3y6ThB5f+MqhUDS7sFqcOCVVa8= Received: from CY4PR21MB0773.namprd21.prod.outlook.com (10.173.192.19) by CY4PR21MB0151.namprd21.prod.outlook.com (10.173.189.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1273.1; Thu, 18 Oct 2018 15:32:36 +0000 Received: from CY4PR21MB0773.namprd21.prod.outlook.com ([fe80::6d0b:b90f:7a73:99fb]) by CY4PR21MB0773.namprd21.prod.outlook.com ([fe80::6d0b:b90f:7a73:99fb%8]) with mapi id 15.20.1273.012; Thu, 18 Oct 2018 15:32:35 +0000 From: Michael Kelley To: Olaf Hering , Stephen Hemminger CC: KY Srinivasan , "linux-kernel@vger.kernel.org" , "devel@linuxdriverproject.org" Subject: RE: [PATCH V2 3/4] vmbus: add per-channel sysfs info Thread-Topic: [PATCH V2 3/4] vmbus: add per-channel sysfs info Thread-Index: AQHTMDILCEMEoT8qkE2pk3xiw1YEpaUni6WAgAAC2cA= Date: Thu, 18 Oct 2018 15:32:35 +0000 Message-ID: References: <20170918034955.10913-1-kys@exchange.microsoft.com> <20170918035419.11062-1-kys@exchange.microsoft.com> <20170918035419.11062-3-kys@exchange.microsoft.com> <20181018171953.079f6fb6.olaf@aepfle.de> In-Reply-To: <20181018171953.079f6fb6.olaf@aepfle.de> 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=mikelley@ntdev.microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2018-10-18T15:32:33.7662112Z; 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: [2001:4898:80e8:1:65b1:97ff:dbed:8927] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;CY4PR21MB0151;6:RSGc+AO886VuD25eBbUraA5yAqjkG2cvrOMRnsUFr82nfgEuxVo90U9sguRGcScmgOO0Y8eD9bUP/9foedDvQHSv1HG6OqoCFAvYSfmGb38jwXwkcctHkmkV+2EAKYO9fLqwt/1J3eRej1/Bd0YgUDLwbDeG6zRJ6wTWt+XABq85OmjHsaG2/zoQpDaHJP1jFBmYyvbsdljoeSpVlwYXMNEiRVR7ogSCtXVzxfxAX0Gxtm/3aSyKztiTK/g8d+U+RBtCIzSinVzcW+bh2c6rM5x+oGgBOthwnQxPUBPRMp9b4XpG9S7TyALx+gdUWFvLAwphgnBdKulqjCsXdhe93izjNECikGmv24kiGOreqvvoxF9dBMyNgZ2LKzDZ1SEupRskBBuCrK8rCeESHcLmhlm1kgvGcIlN9VD2kPxIA4NTPOSZfCcYsnvSVHidzG5jPrYS5Szkh3QNv5dDDXnyOw==;5:BwWKSGEsBVlAiYf3iPfPGqbMwxLQzhYgZTWlK4zr4yisryM6mKUy4GJo+vvsED5otAywQLqqrKyjAwKrW2+FNDdk2ecAKWf7prr/l38hZ2qCRT5mffP+hIlR/Eyy/OUVtQc6KHczDYPRVW1X7Tvcevi0gMnwzj/2r7pYZBIO8X8=;7:txHVTyHr7d481tLQkCWkCMFG1xJT7NW/ybPfZ+R4Me1Xtaq7s6NdsYBlfOTwwMclDgelnyp6kHM3zKFgZzX7SXGZld82Mm2/1yso5b53QRGYEem9WrPouYn/pg7mt1yn3+g5CSFttXWUNxfPZaEbMg== x-ms-office365-filtering-correlation-id: 700ac1d0-cca2-4f7e-a410-08d6350eee12 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020);SRVR:CY4PR21MB0151; x-ms-traffictypediagnostic: CY4PR21MB0151: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(8220008)(2401047)(8121501046)(5005006)(3231355)(944501410)(52105095)(2018427008)(93006095)(93001095)(3002001)(10201501046)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:CY4PR21MB0151;BCL:0;PCL:0;RULEID:;SRVR:CY4PR21MB0151; x-forefront-prvs: 08296C9B35 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(396003)(366004)(376002)(136003)(39860400002)(189003)(199004)(102836004)(86612001)(6246003)(5250100002)(86362001)(6116002)(4326008)(8990500004)(316002)(7696005)(256004)(110136005)(99286004)(22452003)(7736002)(305945005)(93886005)(71200400001)(14444005)(97736004)(54906003)(74316002)(71190400001)(68736007)(11346002)(76176011)(9686003)(105586002)(10290500003)(6506007)(55016002)(46003)(106356001)(53936002)(2906002)(14454004)(33656002)(81166006)(229853002)(10090500001)(2900100001)(476003)(446003)(486006)(5660300001)(8936002)(81156014)(8676002)(6436002)(25786009)(186003)(478600001)(6346003);DIR:OUT;SFP:1102;SCL:1;SRVR:CY4PR21MB0151;H:CY4PR21MB0773.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=mikelley@microsoft.com; x-microsoft-antispam-message-info: rXSlLM9936kfiroqyWzN7fyn+CCfUiNIsm73ySgx12bAtzMInJbqBAu2Tg6WjWspiL7JLFmD2SRpxXb6er4rysfZxjvkNe0yXJuTeDK2Li4vMqkZ6d6T7yJ4puRB8Mo4zaD2gtBooT0I8C7a261ntkYzlOtG6rYyJvLnM/LXyUh4ZSPu6yM5+rCk/l9BtrW4Aq361hpqIJHFOuH5TYuiYmG0iMLjpUQvkE+XJrdwv0MctYk2dJtu6owR4RdkzTsrmf/a07iAU1p4duMyguWgtdx7UZQDvrVIKCVmKaM7xtxexQWlkEGYtTrFU1cMTAw+SXA5eRPBAu28NEXbY1yewYRxcpEkrjUxuiXlApxKLKs= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 700ac1d0-cca2-4f7e-a410-08d6350eee12 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Oct 2018 15:32:35.7845 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0151 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From Olaf Hering Sent: Thursday, October 18, 2018 8:20 AM > > > This extends existing vmbus related sysfs structure to provide per-chan= nel > > state information. This is useful when diagnosing issues with multiple > > queues in networking and storage. >=20 > > +++ b/drivers/hv/vmbus_drv.c > > +static ssize_t write_avail_show(const struct vmbus_channel *channel, c= har *buf) > > +{ > > + const struct hv_ring_buffer_info *rbi =3D &channel->outbound; > > + > > + return sprintf(buf, "%u\n", hv_get_bytes_to_write(rbi)); > > +} > > +VMBUS_CHAN_ATTR_RO(write_avail); >=20 > This is upstream since a year. >=20 > But I wonder how this can work if vmbus_device_register is called, > and then something reads the populated sysfs files before vmbus_open retu= rns. > Nothing protects rbi->ring_buffer in this case, which remains NULL > until vmbus_open populates it. >=20 > A simple reproduce, with a modular kernel, is to boot with init=3D/bin/ba= sh > head /sys/bus/vmbus/devices/*/channels/*/* >=20 There are multiple race conditions with this and other VMbus sysfs informat= ion. There's a race on the close path as well. I've got an action on my list to= get it cleaned up. Michael