From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB0B72DAFD7 for ; Fri, 1 May 2026 18:17:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777659437; cv=none; b=k99ObKynmrCdxsTURt7+ZJxh59iWuhKWAvceBQaAEiL56fAewc3msgi94HHor2LNsdT/9NPfpI7z2jPuLMfTVwNdMdoqsP5UdSVCZfagX++wJKxDaHfiD2KWR7uGBHjCoDPdjVsiA8zqpCZfQPSu1dRDeBfFb+xr1Oli3+mDOXw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777659437; c=relaxed/simple; bh=FuyGme0uC1dQYmMPiHV3ukU8NV7ufPunP8OPpbJlgHc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oRWu/sfyruGOLCeaUR94MxtbbYIRKrPRfQYhqUVZVxPubnbTf31n5blJNEr4yAIbKeW+L0ndaKf3hdvtO251W6IxcIKy54QwaLSPuaypv2kAXZX1iO5n744RJIIyeB2vmNoJFMXc+WR39flNEcEG6D6xgYiNwqubyDIXKacVyVQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=D46tWoVn; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="D46tWoVn" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2b243198058so8885ad.1 for ; Fri, 01 May 2026 11:17:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1777659435; x=1778264235; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=hH8WjvIFvfB7lCVYfIBULvtLO+n9YZWTzS7cJlqaCmA=; b=D46tWoVnQVDINwGSZrLtg3E/F6Loq9eKjxE/OBj778kiTAR9Shj5k6HYMJGK3cJ9Zt 2FCk8EmL1snP6G51sQY+WTpET8kFtvqd/u7zIcRJlQ44QhBb+rNmeuQnFsjyVP5AGm6V e2zZHCLj2RdttaoSGXwLtzdxTRoSfwmMQAXUA5Nux2h2wVwyu60GWGZVpDZwY6JqWwfe xwcdfNdR+/tI1IJqS4TnF00X0eh3xUdqlOF8/RPbIHLyejIW+J0fz8Xif55XDXYTkUXu 1Hwdq6ZH03gmCYyBAl50q0UQ0SOa0YVs1fUUABnpeyvZSIUlFOerD1lL4U3P2zDuTcuS VH1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777659435; x=1778264235; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hH8WjvIFvfB7lCVYfIBULvtLO+n9YZWTzS7cJlqaCmA=; b=a6F1q2IyWSTTqzq9KSgbocOUpVR/fTHZsGWK+IXXFWmUDcbFEiDBtFnYECdw3l4iUa CqxEFq0+o+dj82LwRxPAOFgPrf92SFSy0NRbz66kn5wmSBvRQnPEbftXPXF6l90qrTRX /oVtIM578TWIck34I14+9cmBDdwqib90RD0fshqn5I4hR6Qg0JiUhzFR/lGkqUiivekf jiTVxTWFS9nHdwRHrSS8iGo4Hi8k9h4vI/7sJt9Ed2SwdP4p4Lw0bGXCIbqcL4ywUFde SJdtebocSC/JMcYs5n07CkCPHPW69++H/RwCs380TbPrNr8bP0Li0+NpbOwF9Hq6ISu2 JL6w== X-Forwarded-Encrypted: i=1; AFNElJ+bxzZKjyq4vYjQA9UIkP5SEJl5cfR8tEq7Qa/fBzC6ekw818RW2ekvS7VWQQLTp8OmqHUAPgu9qXK7P1w=@vger.kernel.org X-Gm-Message-State: AOJu0YyWaLpYEsIO+nI8mMPq+meTP8ItBrHHPKqExf4N1nkGGOPsLVC/ WUlXNctoT+x1tzbGKsWHDcXAygC+ueo4zv9y5jt2mOzMdI/9V8hBxTK51ORN6gE/5w== X-Gm-Gg: AeBDievECffBtMTP+sOGJ0ROPcRrUfxl43GfmhtMbBTritqJ4Jalu8yxr7BYz+xMdcq mM+6VwJ+UB0Wy7Hsk9zvFVPIEaE7KBm2dJZ6xyxHifaFWIDKD1fBijwM1xhZdbs0hagSUyLq0HK xFwcIAMucRQGVkNn0c0EfiV34xI0pp4rSakq0vcBn3ihiPu2I0UiTvjJ6OCev/3mIjgZGaFSiIO lkGoajcsXcBUF6Z+l/5fFbbwJJs//WtgW0qS7Yv2ghaZiH6Js/2J4a9mY+ZdD+3Y7nEktJUuztH jIuRnAfm779ra4uOPK10ukGMneQ/QC9X92z9fudYxV5XeSKmTbQ7l9II8soTevOlpylnp/LrxI0 z6+iQg66polJxkEmIMdFJPBE70WWZvJC3yi7ZA10jXyZc2mGZXzyxKm0VzKqRSW4mnGugPFSH/V C9nH16/1jYwuI0z5bbiP5K0CRUObsvNa9pL6OKpU4LxPeljP4SzLgx/281cX0tnWYlnAIuDEbUC oFyO6dUJoQnVCP5m2ke4g== X-Received: by 2002:a17:902:cf4c:b0:2b4:60e6:44bc with SMTP id d9443c01a7336-2b9f38a41abmr300485ad.13.1777659434630; Fri, 01 May 2026 11:17:14 -0700 (PDT) Received: from google.com (195.236.83.34.bc.googleusercontent.com. [34.83.236.195]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c7ffbc85c61sm2776855a12.22.2026.05.01.11.17.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2026 11:17:13 -0700 (PDT) Date: Fri, 1 May 2026 18:17:10 +0000 From: Samiullah Khawaja To: David Matlack Cc: iommu@lists.linux.dev, kexec@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-pci@vger.kernel.org, Adithya Jayachandran , Alexander Graf , Alex Williamson , Bjorn Helgaas , Chris Li , David Rientjes , Jacob Pan , Jason Gunthorpe , Joerg Roedel , Jonathan Corbet , Josh Hilke , Leon Romanovsky , Lukas Wunner , Mike Rapoport , Parav Pandit , Pasha Tatashin , Pranjal Shrivastava , Pratyush Yadav , Robin Murphy , Saeed Mahameed , Shuah Khan , Will Deacon , William Tu , Yi Liu Subject: Re: [PATCH v4 02/11] PCI: liveupdate: Track outgoing preserved PCI devices Message-ID: References: <20260423212316.3431746-1-dmatlack@google.com> <20260423212316.3431746-3-dmatlack@google.com> 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; format=flowed Content-Disposition: inline In-Reply-To: On Thu, Apr 30, 2026 at 09:15:14PM +0000, David Matlack wrote: >On 2026-04-28 05:24 PM, Samiullah Khawaja wrote: >> On Thu, Apr 23, 2026 at 09:23:06PM +0000, David Matlack wrote: > >> > + for (i = 0; i < ser->max_nr_devices; i++) { >> > + /* >> > + * Start searching at index ser->nr_devices. This should result >> > + * in a constant time search under expected conditions (devices >> > + * are not getting unpreserved). >> > + */ >> > + int index = (ser->nr_devices + i) % ser->max_nr_devices; >> > + struct pci_dev_ser *dev_ser = &ser->devices[index]; >> >> nit: Maybe we can move this logic in a separate function as down the road >> when we expand this to add VFs and Hotpluggable devices, this might >> change significantly? It's good if it is self-contained. > >Did you mean to leave this comment on pci_flb_preserve() where it >decides how many devices to allocate room for? I was talking about this one, as I think depending on the scheme we take this might change significantly. Just a nit, you can ignore it. > >> > +static inline struct pci_dev_ser *pci_liveupdate_outgoing(struct pci_dev *dev) >> > +{ >> > + return dev->liveupdate_outgoing; >> > +} >> >> Is this expected to be called under the outgoing lock? > >For now this API is only used during shutdown, at which point userspace >should have already been stopped so drivers should not be changing the >preservation status of an outgoing device. So I don't think this needs >to be under the outgoing lock, but it would be nice to have some more >explicit synchronization. Ok that makes sense. I have similar cases in my series, but maybe we can add kdoc regarding these stating in which context this is expected to be used?