Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2060160imm; Thu, 18 Oct 2018 08:27:04 -0700 (PDT) X-Google-Smtp-Source: ACcGV61HKN27caDBNpndvQEv+7QXTJxxgFES86Q4ET9HNPxLnYwM3xtbakNukt0eKk+jhM0c/xKn X-Received: by 2002:a62:c68e:: with SMTP id x14-v6mr23133615pfk.151.1539876424045; Thu, 18 Oct 2018 08:27:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539876424; cv=none; d=google.com; s=arc-20160816; b=juKsQOcl5GZ/rbLh6PMH1hJeCKBtAsn/4lnCxseJ/kinKLCyHKT+bIVVmDpHguKR9S op8Yr6yqQa3rCzvKcP6Ax3vBtznT5nChp3YD5PuwkB9DMsWYYasy+8+FRjDWGrVonA0N 9LLUuq+zTvuGFgEX9vY1BHziBIVmZs6dN7h50BSH+jwtkEWPokS3TGlO09rJv6WUErSM hvlVBHwVI+p3KQlVScsKk8j74et6TATsxwJzxVOXXKIMT09GMjAsPyuqD/MFUhA2N8WT +6Pw9g84POlkI/eLgJ/zaPKcphx/WPR3PlQbuZy7Nc6tnRKJc/Q2ln1jl/7Sh8F/zo++ JGzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:dkim-signature; bh=U/JBf+k4mCBinm4SMGOBr4By7MprRU+aldN+eCDR+YE=; b=Rl1ULS+sA8bqEPQPOhXFAetrx05/Yfj9peKGieowpVzLDbR1wYLj8bLSWy5KGFxKms a1vlV0+RdEFN4L+hjqi7/zkf/++/8qRHxvCoGAEafqgvzruHDVHkUpAnRZv1X6KwG4kb V/nTjfviXtikpVBjqAEYw6g9/szzcGzbU4EYdle7qNYU4cRxXVyBe1/+bxLCmf/H1bps XZe+2zIvoO5b5lYT842TB2NnVuo2Im+FLlujH6b+SHYcmDfJ1xF6aMLDPqCW8OLn/3nj z6UnWEROaWnbpKZm+x5uslVW6hDvoeDO9X3/Mp4IU0qcnbfLf/NtYi6GjjFhle4oPKka 2vPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@aepfle.de header.s=strato-dkim-0002 header.b=lb94FaLD; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2-v6si21381238plh.63.2018.10.18.08.26.47; Thu, 18 Oct 2018 08:27:04 -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=fail header.i=@aepfle.de header.s=strato-dkim-0002 header.b=lb94FaLD; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728072AbeJRX15 (ORCPT + 99 others); Thu, 18 Oct 2018 19:27:57 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([85.215.255.24]:12224 "EHLO mo4-p00-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727105AbeJRX14 (ORCPT ); Thu, 18 Oct 2018 19:27:56 -0400 X-Greylist: delayed 379 seconds by postgrey-1.27 at vger.kernel.org; Thu, 18 Oct 2018 19:27:55 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1539876384; s=strato-dkim-0002; d=aepfle.de; h=References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=U/JBf+k4mCBinm4SMGOBr4By7MprRU+aldN+eCDR+YE=; b=lb94FaLDzSZ0Uvz+n4170D2t0IHUR9+BqtXxKSQUru7BqLZ8neIOc+DuTLvyeRYCHp FdYTGz3bjOp7zaLXAn+ovICOPSHhd4uOy2xWWZHbtil80VMw3LBJpTRXueoqPx1s2X3u rOmOzJpEiNGzBJ3MMA0X96X/krMvwBiLWKI6DELy0thld8LGKhXEFS3h2qf6NjflnrKe FoguH+nA7iV78haHOnYJOKMwnr6qzPbZkiDSgxGy9leHg7oGJxGSJXblN7C/CjgfH+Op lD+Sy6KkDDzdwZjbuhwP2oRX3WYGRRyzxoBohjnwKLxrij01gqQcEmKfuL1A6W04TMde hdGA== X-RZG-AUTH: ":P2EQZWCpfu+qG7CngxMFH1J+3q8wa/QED/SSGq+wjGiUC4oc0Nr2ihluivsAQtyRsdRVZ54BGpAypu4eYvjwzPAqxRcXNDW+" X-RZG-CLASS-ID: mo00 Received: from sender by smtp.strato.de (RZmta 44.3 AUTH) with ESMTPSA id 906dd1u9IFK2EHq (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Thu, 18 Oct 2018 17:20:02 +0200 (CEST) Date: Thu, 18 Oct 2018 17:19:53 +0200 From: Olaf Hering To: Stephen Hemminger Cc: kys@microsoft.com, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org Subject: Re: [PATCH V2 3/4] vmbus: add per-channel sysfs info Message-ID: <20181018171953.079f6fb6.olaf@aepfle.de> In-Reply-To: <20170918035419.11062-3-kys@exchange.microsoft.com> References: <20170918034955.10913-1-kys@exchange.microsoft.com> <20170918035419.11062-1-kys@exchange.microsoft.com> <20170918035419.11062-3-kys@exchange.microsoft.com> X-Mailer: Claws Mail 3.16.1 (GTK+ 2.24.32; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/XM3s3d1I7SWbaUwNiYVsnLE"; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Sig_/XM3s3d1I7SWbaUwNiYVsnLE Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Am Sun, 17 Sep 2017 20:54:18 -0700 schrieb kys@exchange.microsoft.com: > This extends existing vmbus related sysfs structure to provide per-channel > state information. This is useful when diagnosing issues with multiple > queues in networking and storage. > +++ b/drivers/hv/vmbus_drv.c > +static ssize_t write_avail_show(const struct vmbus_channel *channel, cha= r *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); This is upstream since a year. But I wonder how this can work if vmbus_device_register is called, and then something reads the populated sysfs files before vmbus_open return= s. Nothing protects rbi->ring_buffer in this case, which remains NULL until vmbus_open populates it. A simple reproduce, with a modular kernel, is to boot with init=3D/bin/bash head /sys/bus/vmbus/devices/*/channels/*/* Olaf --Sig_/XM3s3d1I7SWbaUwNiYVsnLE Content-Type: application/pgp-signature Content-Description: Digitale Signatur von OpenPGP -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQSkRyP6Rn//f03pRUBdQqD6ppg2fgUCW8ikmQAKCRBdQqD6ppg2 fs/+AJ96XIzUhnDlu6M7bWwTIgZ/evTZXwCfXbXPxjVEp5/d/MYiNKPXtiNrN/o= =Ip93 -----END PGP SIGNATURE----- --Sig_/XM3s3d1I7SWbaUwNiYVsnLE--