From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (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 471E829D26B for ; Thu, 30 Apr 2026 21:15:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777583722; cv=none; b=qB80Ph+E2iNrhncDenpXF3Cc4772WIPhjwc9AoA3CGMWEXjyProUxlJMpRCC/U9sARU66Ue+ueRIVJst7Dn8sAvaHUJaZDjRHmrWRheHIKcsZ3dHuAPRJeHSKG6OeZzO//tMBHmxHXC2DLYASqNcR26DhToujLN+WKSNjHj6RUg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777583722; c=relaxed/simple; bh=inZO7ZV0wRh5CqvM/ucg9lY2CTAYKdanpisWvC3TQ9o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GSZpfk9ZLFEa7/6UGC8jYSUKrSAjMw/qSEGSbdo7aqhIhXRzkf8Tl+LNXI7nsPt5Psry+iu2c13CkV6v2zS/QV/a7TzSjUhwUVW4/bilDqQG0urLRZE3gyjtdZwcjc0HV1NUmF+yBFAOYIwB7UPsHX6Cv0W9i0aPOcFW4Q4qucE= 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=UxMLn1IQ; arc=none smtp.client-ip=209.85.216.46 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="UxMLn1IQ" Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-35fbca04006so688441a91.1 for ; Thu, 30 Apr 2026 14:15:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1777583721; x=1778188521; 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=tuRbo58QsKRQvu4meQcJrzjCe/FSskWcv20z3c8VC1o=; b=UxMLn1IQuNma/45TLDGLHz7WiSXx7C7t5cQnqX8cRydSOs+re11gX2q69MKSOFV5ms yzthR0GcbnPt38XRXtjcPQI27tCEEsTLsHTm7/HsVItkFHFB6kNkkqfabx8KCKV2Yof3 5QMTGStowS9Yb+/aUll4kFgcze81ZfZiNf9dKQCD7jnAOS88QKSGDVNpMGbf7nCvNZOv 6PoA3uAi7zNQx/tuulBDn91lWPx0TiPRc8UdtO/DFhgWQSXZsSzqqEnXVtmjyuLaOWPS BhV8nuFuXAvRMRbu9h1BooBDLqEWX+aD2Vh3NaB5F6bGPg2Bu7khJEKb1bhGnB4LjGk1 C2qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777583721; x=1778188521; 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=tuRbo58QsKRQvu4meQcJrzjCe/FSskWcv20z3c8VC1o=; b=PXwCjRebCaBrR0cNp2s+YpYgnZs01GhbpQLKWNM1fL1igabaKfXM7XscMb/dqWY3Q5 ztHZlAyiiTXMVGO8gaiJi3bOxGmE8zpE6zPPtxZbYZKHOJLaLl5qiCxvS1cOkcRlR1SF mDEEOkL0wb9Uxyv4yr/Q/ss3wuhx8BA9aIZpB3KhPNZBHL8M1Jao9Ww0/PufneCD6+4g kHXEOwOmSAg1HY9kI8LqU0p6A3u5Ial1ys/0IjgyoQmI1mcxxdcaiACk8YiQ6NvVwq9p Wd94/aCu5fWjruqU76+N6V3MILP6ctNjKRshOp9xtCgUKG1zLD+mYz0KtiFbkCumZBom H1Gw== X-Forwarded-Encrypted: i=1; AFNElJ/8lGIzMTSLs/J6mbHY+wpaXHIQxAREX/bK/Cq198rIoP5tCMmQTMwA274uhYcSnotr08jAlKmzDOak1EY=@vger.kernel.org X-Gm-Message-State: AOJu0YwRqJhrF8BCJMnEQYtbRXNyeaDAX7yIl1/ta7wWbSzh/R/DfrSW Mwd706MqsiW4fq7ATWAxUFRVs0AljSUiYIFO2AEuOJMkdiO226bSMEH3lxMbOk8VDw== X-Gm-Gg: AeBDiet10XXJp4gquvW5+8a5JBDUmfbTesR5s/3Zzb9kTriILwkt4I3nzcRwvmvuEn2 35x5e7/RVn+o61+7+Ptbp4jk2lAtaRG0rbVtC2N8To/0XDFxz/kOCAK3h5M+oLDSzS0z98qn+Xd gKi43nlQQEQYqIpyI0C7BZB7NAsXYqfivjX03l91AwfQWnijDt9U+giISgnM/WeitNYymvLDcUk 4dB+LpQT2qVi2orxJOGazx5RM7mBgLTJ2U6ylyzzmQaNVE5beLjRiFcskR1G3ljCDeN0iTwmwef 8Lgs2H3ihtF4fK4zWmYVcNGVHgmLKuyhvYiul+RJB2w86JcV/dWzJHtzeczNUW1GPm0FTMNbtFM HJwO9Xsm/D+7zSvLvLj9KVTNKMJrLKd3Vh6qE82i9vxB4blbOst0Jhb0JKICWyWm6p9bhwV4jYA rsyvNi//2wQzDCbAIFPJ73Hm6/4RAliD7ZxUHBjlOT6zmBhjb33vBIXoyZk4XLdARv5B6hB8kvV vubrBAqFwWdC9GK X-Received: by 2002:a17:90b:2790:b0:35b:e51a:ec77 with SMTP id 98e67ed59e1d1-364c309bc21mr4610958a91.16.1777583720228; Thu, 30 Apr 2026 14:15:20 -0700 (PDT) Received: from google.com (76.9.127.34.bc.googleusercontent.com. [34.127.9.76]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-364ebd46484sm474408a91.0.2026.04.30.14.15.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 14:15:19 -0700 (PDT) Date: Thu, 30 Apr 2026 21:15:14 +0000 From: David Matlack To: Samiullah Khawaja 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 Content-Disposition: inline In-Reply-To: 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? > > +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.