[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v8 02/13] vpci: use per-domain PCI lock to protect vpci structure


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Thu, 20 Jul 2023 15:50:58 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vCQlYJOl/406gLgRUbair3VkQa9t1mHIdjh+qgkBVbw=; b=E1NnCTdsy9Wb4B7szy9cfZuWys47EH24PUYQ7PYPUWpoosl27cNiETN0xpXjA46qlv4CzQrqzBPYkjByhfCXYmJ7FLfEQvptaTbsM8p8se7f82nNC749mSx569NPONLNRCC1UPfauX78N9K2AOdxeT/s0U2wAPpQelTMhPBd5gfYj/jZMPsX8gIOd2NQvxE1biNwzF5SbCaziYh5gLM+S9zUe4+qO6qkak0dpLPJWTt9KILhGQ90K+p0ri1U4YVJRp85DInJtspnAiYglebfW2DMy+oFeJ+IJNixdEupwN4foiuqKMw5oTCn28UP3IIdtssGjJTWMsclIBkONewayw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hklexdhw6smU5GtrkHa+IKPTadcRbPRsgf06/EB5WH5YQXjnHuVJFnhasOA6XoAh86g6R3FoFf9wW1jTZIypBzJyNiMblxDmULxPOMlLBREoCGpRHj0B8IqdCuTqfGMCrByGzYBEE6V+f79shgZIPIyf1dVBJxnfQrQLouMOfWDVdqGTkIwbrGptxqGEBkRVdZ9ATsyfkQ2BeWjzqAvRwlll0r+L96tVmj4p8UUs+TGwG2ZvYrcpAcLG20RRdqrrydgWi3n+52Wb+A5guBpFRK8kyBSVbbnH+VlU54VIQNTV4QmKqFDrjQ8CubiCDlz0y9xAPsyDDxTbrDi8eGSmFA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 20 Jul 2023 13:52:05 +0000
  • Ironport-data: A9a23:U/I3mKrSEGv6WaRsXqS6UaNQWlpeBmLLZBIvgKrLsJaIsI4StFCzt garIBmEP6mNZWbxfd11b4myoEhXu5aHmIRgSAU5pH0wEnwV8puZCYyVIHmrMnLJJKUvbq7FA +Y2MYCccZ9uHhcwgj/3b9ANeFEljfngqoLUUbKCYWYpA1c/Ek/NsDo788YhmIlknNOlNA2Ev NL2sqX3NUSsnjV5KQr40YrawP9UlKq04GpwUmAWP6gR5weBzSFNVfrzGInqR5fGatgMdgKFb 76rIIGRpgvx4xorA9W5pbf3GmVirmn6ZFXmZtJ+AsBOszAazsAA+v9T2Mk0MC+7vw6hjdFpo OihgLTrIesf0g8gr8xGO/VQO3kW0aSrY9YrK1Dn2SCY5xWun3cBX5yCpaz5VGEV0r8fPI1Ay RAXADEMdiDahum4+o2EbcBDtJUxE8PFDLpK7xmMzRmBZRonabbqZvyQoPN9gnI3jM0IGuvCb c0EbzYpdA7HfxBEJlYQDtQ5gfusgX78NTZfrTp5p4JuuzSVkFM3jemraYWNEjCJbZw9ckKwv GXJ8n6/GhgHHNee1SCE4jSngeqncSbTAdtMS+HlqKIw6LGV7k0MEgQsTQT4mOWWs0mgZNdeL ExJ/wN7+MDe82TuFLERRSaQonSJoxodUNp4CPAh5UeGza+8yxaUAC0IQyBMbPQitdQqXno62 1mRhdTrCDdz9rqPRhq10bOZrii7PyQPGkYEaTUZVgsO49Tlo4YbgwrGS5BoF6vdpuPyHTb80 jWbth8Ujr8YjdMI/6ij9FWBiDWpzqUlVSYw7wTTG26gsAVwYdf/Y5TysAeDq/FdMIyeU1+N+ mAenNST5/wPCpfLkzGRROIKH/ei4PPt3CDgvGOD1qIJr1yFk0NPt6gJvFmS+G8B3h44RALU
  • Ironport-hdrordr: A9a23:Uvqj5KiL5ofHz38ODj0yQnQ8OnBQX7p23DAbv31ZSRFFG/FwyP rCoB1L73XJYWgqM03I+eruBEBPewK4yXdQ2/hoAV7EZnichILIFvAa0WKG+VHd8kLFltK1uZ 0QEJSWTeeAd2SS7vyKnzVQcexQp+VvmZrA7Ym+854ud3ANV0gJ1XYENu/xKDwTeOApP+taKH LKjfA32gZINE5nGPiTNz0gZazuttfLnJXpbVovAAMm0hCHiXeF+aP3CB+R2zYZSndqza05+W bIvgTl7uH72svLgCP05iv21dB7idHhwtxMCIiljdUUECzljkKFdZlsQLqLuREyuaWK5EwxmN fBjh88N4BY6m/XfEuyvRzxsjOQmwoG2jvH8xu1kHHjqcv2SHYTDNdAv5tQdl/851A7tN9x/a pX1ybB3qAnRS/orWDY3ZzlRhtqnk27rT4LlvMStWVWVc87ZKVKpYIS0UtJGNMrHT786qogDO 5yZfusrcp+QBe/VTT0r2NvyNujUjAaGQqHeFELvoiv3z1fjBlCvj4l7f1auk1F2IM2SpFC6e iBGL9vjqtyQsgfar84LPsdQOOsY1a9Dy7kASa3GxDKBasHM3XCp9rc+7Mu/tynf5QO0d8bhI nBalVFrmQ/EnieRvFm5Kc7siwlfV/NHggEkqplltpEU/zHNfbW2BS4ORETe5DKmYRbPiXZM8 zDSq6+TcWTaVcGIrw5rzEWa6MiV0X2b/dly+rTe2j+1v4jebeawdDzQbL0GIfHNwoCdyfWPk YjNQKDV/moqHrbF0PFvA==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, Jul 20, 2023 at 03:27:29PM +0200, Jan Beulich wrote:
> On 20.07.2023 13:20, Roger Pau Monné wrote:
> > On Thu, Jul 20, 2023 at 12:32:31AM +0000, Volodymyr Babchuk wrote:
> >> @@ -447,8 +476,16 @@ void vpci_write(pci_sbdf_t sbdf, unsigned int reg, 
> >> unsigned int size,
> >>  
> >>      /*
> >>       * Find the PCI dev matching the address, which for hwdom also 
> >> requires
> >> -     * consulting DomXEN.  Passthrough everything that's not trapped.
> >> +     * consulting DomXEN. Passthrough everything that's not trapped.
> >> +     * If this is hwdom, we need to hold locks for both domain in case if
> >> +     * modify_bars is called()
> > 
> > Typo: the () wants to be at the end of modify_bars().
> > 
> >>       */
> >> +    read_lock(&d->pci_lock);
> >> +
> >> +    /* dom_xen->pci_lock always should be taken second to prevent 
> >> deadlock */
> >> +    if ( is_hardware_domain(d) )
> >> +        read_lock(&dom_xen->pci_lock);
> > 
> > For modify_bars() we also want the locks to be in write mode (at least
> > the hw one), so that the position of the BARs can't be changed while
> > modify_bars() is iterating over them.
> 
> Isn't changing of the BARs happening under the vpci lock?

It is.

> Or else I guess
> I haven't understood the description correctly: My reading so far was
> that it is only the presence (allocation status / pointer validity) that
> is protected by this new lock.

Hm, I see, yes.  I guess it was a previous patch version that also
took care of the modify_bars() issue by taking the lock in exclusive
mode here.

We can always do that later, so forget about that comment (for now).

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.