Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2513483rdb; Mon, 12 Feb 2024 07:18:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXgQRZ/yTml5DDApUCCZSLcP9V9TbZsvgvVJmyqS6CeF0VXNrMofiKYOakmUxf4wLKgCJbHdG8xQZhrnL8hoRXsYpLMH0zlTdZrsd0GkQ== X-Google-Smtp-Source: AGHT+IHpLkVgdBYLoGsaFZpac3/OgYLAFG8kw1zyIrTp8adQn/V7QUqKMmtHLpiqo87qnyF7b2S/ X-Received: by 2002:a17:902:7ed0:b0:1d9:8832:f800 with SMTP id p16-20020a1709027ed000b001d98832f800mr5145955plb.8.1707751091035; Mon, 12 Feb 2024 07:18:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707751091; cv=pass; d=google.com; s=arc-20160816; b=L7BOiGYt9FVBUDB+fLG0ECSK+oIs4PKWAdrA8p9ukrtoodlxwKzjsQPU4S1g+Wid3I 6denRsku6BOSbap3SeciMV9U+D3qeW75NMV5un0apLr4bgaA2rT+zxFgpEWeMBhxmOoH L9UVmuX99CZo8aup+B9TdZDy4uugw9+2lsRDb/KZ9HxjF12ocPZJN/c+Ecp2eHljt1Ye xbB2o0hd2LulEioRMd5IPmDC0f47x3msi8MYdUYAhRsUKUF50P46LBWWJTLm2QmO7v9y c4hVoVfQG2TlLl2VSqg3xLiFoK0MmtdII7zOxwVlylhmHTC1wnIOUZUxTbb/8SEh09kH rQ4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=IQlKr9l+61G447zi0F2dTY9uMvRCDn1szmaAOIa3wjQ=; fh=4f1SfKbirExCzUGJydrrFpGc7quRHdbvXBH8uUlpS5U=; b=DHjqRvMfk7W9piJ6p2+Mi1OhpNu7a25sMgt8MU4o8bhN7fLeC/5s0w6YmaCX4tjD35 mndnPpygkXTqud/kfo8Wkm82acQ5KiQdM9yl2c05q1S8VNNGG0/2a0nTj+lGfRjZDJdX d+pWaV9RCUL461oKMGVh3l89UoDBONLAJfQYToJScTFYz0qnP4GBsTb+hRZHUcTCTPf7 LtTUIwVv2285X1XZ4PUBym02YHuCbtGCogS1WPt8MoVsqIE1DavjrTEo1GnxtOpUwXOj OrTXNz2TAQxpI1d9FAXMjlNyeA0INo7omfdMpcytZ58TBLmpJT9wdLg/Vd8IcPa9900i 7GbQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oPlz6UWx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-61881-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61881-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCV0KorhpPo5ynOvapGn3S2Syl+/nyNH098gyr0709PETmHv7zRYeFn9lP8PLkL7yaONrYNtC1zybigvYlma/MCUrYlvakTZJ+B1QvnvjA== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l6-20020a170902ec0600b001d885fa768asi388632pld.195.2024.02.12.07.18.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 07:18:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61881-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oPlz6UWx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-61881-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61881-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 51302283C4B for ; Mon, 12 Feb 2024 15:18:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B5883C486; Mon, 12 Feb 2024 15:18:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oPlz6UWx" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 338E63BB55; Mon, 12 Feb 2024 15:18:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707751082; cv=none; b=sybPjuQUhTJKiaW36NWtvxHsb56N0xjqe/AcAZwa05Zyl2FDQjyPFO0tf9Ew/6VVPoTFbbLdcRpks7vr59GctATc2qEOPKQW4kXuUOKLJ2vLS/pAtpsaCYCJuSkTf64VfxBDD0aSWZ0hMcwUOEhdV7617ZibCdn+c2tPy4q3Hl0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707751082; c=relaxed/simple; bh=BnrZ9C/Bz7X3B9Yi4bgBJOnu5VZLUMUOMzuMSBtlbnM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OTpq+jvMBY2ju5raMrxoAVfwtvYMSzRQXC5Vi8oWj2AUq0iPcVaLgw1ZpJAmFUYQzmC0rn+ZBFDFHxoI4wp1HGJuAJv105jo7Dx+/TaN8v9JHT0R8sQywAogV9y4qC1TodsnaBc+jtRRwpBBn+gL2qULRbxFdQ512+3hzNA83yc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oPlz6UWx; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D59BC433C7; Mon, 12 Feb 2024 15:18:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707751081; bh=BnrZ9C/Bz7X3B9Yi4bgBJOnu5VZLUMUOMzuMSBtlbnM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oPlz6UWxUe1nOoduQZ4F4RiW8KQVZHi78f31ao3a+oiglfPu4nC8xR7kSwoqi7uMr xIkdeZPFwiiUdEFbh1i9uwmKyEJXKk1gt++c3OGowESDC6OXEiYhSDM1W/sL0nX2Ia RW3xmNp1+GPx/7+VAhW4I3VjT4z8g0719N105OmJf1tPJVJOOeh5QEAgWTUB6Ayu0m DeOb5buNIe6M8gf1EzdukQS79FJAj7TcIUdCYbBeHUWTnthAxWyL599ynaBE2sauUW wgjfDIvhnw8hEnRTv1ouppO2PfAFbIrE0n8cDnL70REuxS4qT6deV5GwTnlZ6gClW0 q06nXa8K/l0TQ== Date: Mon, 12 Feb 2024 08:17:58 -0700 From: Keith Busch To: Kuppuswamy Sathyanarayanan Cc: Jim Harris , Bjorn Helgaas , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Leon Romanovsky , Jason Gunthorpe , Alex Williamson , "pierre.cregut@orange.com" Subject: Re: [PATCH v2 2/2] pci/iov: fix kobject_uevent() ordering in sriov_enable() Message-ID: References: <170752254154.1693615.9176696143128338408.stgit@bgt-140510-bm01.eng.stellus.in> <170752273749.1693615.1293677023514112939.stgit@bgt-140510-bm01.eng.stellus.in> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Feb 09, 2024 at 07:22:17PM -0800, Kuppuswamy Sathyanarayanan wrote: > On 2/9/24 3:52 PM, Jim Harris wrote: > > @@ -677,8 +677,8 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) > > if (rc) > > goto err_pcibios; > > > > - kobject_uevent(&dev->dev.kobj, KOBJ_CHANGE); > > iov->num_VFs = nr_virtfn; > > + kobject_uevent(&dev->dev.kobj, KOBJ_CHANGE); Since it's accessed unlocked now, I *think* this wants appropriate barriers to ensure the order is observed the same on all CPUs. Something like 'smp_store_release(&iov->num_VFs, nr_virtfn)' for writing it, and use 'smp_load_acquire()' on the read-side.