From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a8-smtp.messagingengine.com (fout-a8-smtp.messagingengine.com [103.168.172.151]) (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 34B08255F2C; Fri, 22 May 2026 22:39:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.151 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779489598; cv=none; b=stESaEaXMyCtDCIhHBJA34d1H80MCLRNzjT/EfT/YajGPhc/n7wAz4JKGGWT6OnaIIHrmaWrli9x9sDphB5xqzB5MLcrVKbNc26Frt5WHA+Y69vqLaFCMxnqVVSXYItbcOo9zxN69nGfdxSjhLnJ9erc//8FMq7GQFOEDsf9Nv0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779489598; c=relaxed/simple; bh=CttPn8E2TPMMdk0hwN60pM8Lr768iCL+Qf9AMXjLblo=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RUuKKGbWzLJVyOGECl2YY26cglhDVAl8drpi2eDhR5GuOoJtBZWtQqP/WnbBjrwjl2iPDoiAWsViERqIz68YGxuJyzy/Q6EyykWjQKWCO+91R01vHV8XkcZbhf61uGzgQj9v7fMK+aOXHAqoevEwwgc4nGisP5GfgKnwBfAGS9g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=shazbot.org; spf=pass smtp.mailfrom=shazbot.org; dkim=pass (2048-bit key) header.d=shazbot.org header.i=@shazbot.org header.b=kFtaUk7t; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=pCv5SiD8; arc=none smtp.client-ip=103.168.172.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=shazbot.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=shazbot.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=shazbot.org header.i=@shazbot.org header.b="kFtaUk7t"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="pCv5SiD8" Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id 0A28CEC0193; Fri, 22 May 2026 18:39:54 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Fri, 22 May 2026 18:39:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shazbot.org; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1779489594; x=1779575994; bh=gfFIxlG9HHja3KQEtD3lr59SmZJPYsTMMcRRfd3BiJ0=; b= kFtaUk7tLVW8vScS3M5vjrPdhMe+YlCQNieFZxrt6TCseVgzi5fuvVmx4VmA+AnJ uc8zQYMiXhY8eujfreBcndJU0XtuOJe7ecBRtslqROfS3JWOHObpJDWaPFhBjhMB qGa6Gx9vnUiduQV442immP6rXEo9iOU/FAEHKE3wqAPPUg3A5r58Ublw6soUaN3H 2Iqb1d2WMr51l5BCspA8URvkzcBs1k1yU+5qTa8/K/tpvQKvRG6BnG35FSkumSnm bRzxUGy/ufuJlG8uYnZ8dZsnGUzkcTJzqhDi/xGPe419v7Yh0j0ih2+WZJZ2/Z83 P6W1nOuelrLBgCxuFKBRCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1779489594; x= 1779575994; bh=gfFIxlG9HHja3KQEtD3lr59SmZJPYsTMMcRRfd3BiJ0=; b=p Cv5SiD8V6VHiYRV8JFV5q5LQ/zg8a+9+eltRu2tAiVV9wlxxPhFoqqfADsVjGZ3v BmyfGZPEyV8uG86x2lSNKD5l7U6Wpc/5vxGeyvrUQz0KaalXpLkv5VGV/Rxrk7of Cqs4XThAOzNg4BY/puLpz4FE+b/3kfFaB2D0/c20vtTPTT1c9CF6hg1fZHvfL1ed OxQzDYeVfTofAvwUY7LMfgNw2OWSwE5PpD4J2Ff4TIktrqjIAvnlZst1G7wbC2nr xwJJs0MU/1P+dC/8Sn+n2bmFDXzfVRBq+z/MbQXwAaLPshIvoFP9bYMHAd+wDbIJ n8M7KeIYO4ANSdz5OjLOQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdduhedugedtucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkjghfofggtgfgsehtjeertdertddvnecuhfhrohhmpeetlhgvgicu hghilhhlihgrmhhsohhnuceorghlvgigsehshhgriigsohhtrdhorhhgqeenucggtffrrg htthgvrhhnpedvkeefjeekvdduhfduhfetkedugfduieettedvueekvdehtedvkefgudeg veeuueenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grlhgvgiesshhhrgiisghothdrohhrghdpnhgspghrtghpthhtohepledpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtoheprhgrnhgrnhhtrgesghhoohhglhgvrdgtohhmpdhrtg hpthhtohepughmrghtlhgrtghksehgohhoghhlvgdrtghomhdprhgtphhtthhopehvihhp ihhnshhhsehgohhoghhlvgdrtghomhdprhgtphhtthhopehjrhhhihhlkhgvsehgohhogh hlvgdrtghomhdprhgtphhtthhopehkvhhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhr tghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpd hrtghpthhtohepshhtrggslhgvsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthht ohepjhhgghesiihivghpvgdrtggrpdhrtghpthhtoheprghlvgigsehshhgriigsohhtrd horhhg X-ME-Proxy: Feedback-ID: i03f14258:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 22 May 2026 18:39:52 -0400 (EDT) Date: Fri, 22 May 2026 16:39:51 -0600 From: Alex Williamson To: Raghavendra Rao Ananta Cc: David Matlack , Vipin Sharma , Josh Hilke , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Jason Gunthorpe , alex@shazbot.org Subject: Re: [PATCH v2] vfio/pci: Use a private flag to prevent power state change with VFs Message-ID: <20260522163951.4ba46ec6@shazbot.org> In-Reply-To: <20260514173449.3282188-1-rananta@google.com> References: <20260514173449.3282188-1-rananta@google.com> X-Mailer: Claws Mail 4.3.1 (GTK 3.24.51; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Thu, 14 May 2026 17:34:49 +0000 Raghavendra Rao Ananta wrote: > The current implementation uses pci_num_vf() while holding the > memory_lock to prevent changing the power state of a PF when > VFs are enabled. This creates a lockdep circular dependency > warning because memory_lock is held during device probing. > ... > > Introduce a private flag 'sriov_active' in the vfio_pci_core_device > struct. This allows the driver to track the SR-IOV power state requirement > without relying on pci_num_vf() while holding the memory_lock. The lock is > now only held to set the flag and ensure the device is in D0, after which > pci_enable_sriov() can be called without the lock. > > Fixes: f4162eb1e2fc ("vfio/pci: Change the PF power state to D0 before enabling VFs") > Cc: stable@vger.kernel.org > Suggested-by: Jason Gunthorpe > Suggested-by: Alex Williamson > Signed-off-by: Raghavendra Rao Ananta > --- > drivers/vfio/pci/vfio_pci_core.c | 17 ++++++++++++++--- > include/linux/vfio_pci_core.h | 1 + > 2 files changed, 15 insertions(+), 3 deletions(-) Applied to vfio next branch for v7.2, with the noted bitfield conversion. Thanks, Alex