All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	Marc Zyngier <maz@kernel.org>,
	Shanker Donthineni <sdonthineni@nvidia.com>,
	Vikram Sethi <vsethi@nvidia.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	benh@kernel.crashing.org,
	Catalin Marinas <catalin.marinas@arm.com>,
	Jason Sequeira <jsequeira@nvidia.com>,
	Will Deacon <will@kernel.org>,
	kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC 1/2] vfio/pci: keep the prefetchable attribute of a BAR region in VMA
Date: Fri, 30 Apr 2021 09:38:07 -0300	[thread overview]
Message-ID: <20210430123807.GB1370958@nvidia.com> (raw)
In-Reply-To: <20210430095417.GA13686@lpieralisi>

On Fri, Apr 30, 2021 at 10:54:17AM +0100, Lorenzo Pieralisi wrote:
> [+Jason, Ben]
> 
> On Thu, Apr 29, 2021 at 11:29:05AM -0500, Shanker Donthineni wrote:
> > For pass-through device assignment, the ARM64 KVM hypervisor retrieves
> > the memory region properties physical address, size, and whether a
> > region backed with struct page or not from VMA. The prefetchable
> > attribute of a BAR region isn't visible to KVM to make an optimal
> > decision for stage2 attributes.
> > 
> > This patch updates vma->vm_page_prot and maps with write-combine
> > attribute if the associated BAR is prefetchable. For ARM64
> > pgprot_writecombine() is mapped to memory-type MT_NORMAL_NC which
> > has no side effects on reads and multiple writes can be combined.
> > 
> > Signed-off-by: Shanker Donthineni <sdonthineni@nvidia.com>
> >  drivers/vfio/pci/vfio_pci.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> A bit of background information that may be useful:
> 
> https://lore.kernel.org/linux-pci/2b539df4c9ec703458e46da2fc879ee3b310b31c.camel@kernel.crashing.org

This can't happen automatically.

writecombining or not is a uABI visible change. Userspace needs to
explicitly request and know that the mmap it gets back is
writecombining.

Jason
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

WARNING: multiple messages have this Message-ID (diff)
From: Jason Gunthorpe <jgg@nvidia.com>
To: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Shanker Donthineni <sdonthineni@nvidia.com>,
	Marc Zyngier <maz@kernel.org>,
	Alex Williamson <alex.williamson@redhat.com>,
	Will Deacon <will@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Christoffer Dall <christoffer.dall@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org, Vikram Sethi <vsethi@nvidia.com>,
	Jason Sequeira <jsequeira@nvidia.com>,
	benh@kernel.crashing.org
Subject: Re: [RFC 1/2] vfio/pci: keep the prefetchable attribute of a BAR region in VMA
Date: Fri, 30 Apr 2021 09:38:07 -0300	[thread overview]
Message-ID: <20210430123807.GB1370958@nvidia.com> (raw)
In-Reply-To: <20210430095417.GA13686@lpieralisi>

On Fri, Apr 30, 2021 at 10:54:17AM +0100, Lorenzo Pieralisi wrote:
> [+Jason, Ben]
> 
> On Thu, Apr 29, 2021 at 11:29:05AM -0500, Shanker Donthineni wrote:
> > For pass-through device assignment, the ARM64 KVM hypervisor retrieves
> > the memory region properties physical address, size, and whether a
> > region backed with struct page or not from VMA. The prefetchable
> > attribute of a BAR region isn't visible to KVM to make an optimal
> > decision for stage2 attributes.
> > 
> > This patch updates vma->vm_page_prot and maps with write-combine
> > attribute if the associated BAR is prefetchable. For ARM64
> > pgprot_writecombine() is mapped to memory-type MT_NORMAL_NC which
> > has no side effects on reads and multiple writes can be combined.
> > 
> > Signed-off-by: Shanker Donthineni <sdonthineni@nvidia.com>
> >  drivers/vfio/pci/vfio_pci.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> A bit of background information that may be useful:
> 
> https://lore.kernel.org/linux-pci/2b539df4c9ec703458e46da2fc879ee3b310b31c.camel@kernel.crashing.org

This can't happen automatically.

writecombining or not is a uABI visible change. Userspace needs to
explicitly request and know that the mmap it gets back is
writecombining.

Jason

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Jason Gunthorpe <jgg@nvidia.com>
To: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Shanker Donthineni <sdonthineni@nvidia.com>,
	Marc Zyngier <maz@kernel.org>,
	Alex Williamson <alex.williamson@redhat.com>,
	Will Deacon <will@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Christoffer Dall <christoffer.dall@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org, Vikram Sethi <vsethi@nvidia.com>,
	Jason Sequeira <jsequeira@nvidia.com>,
	benh@kernel.crashing.org
Subject: Re: [RFC 1/2] vfio/pci: keep the prefetchable attribute of a BAR region in VMA
Date: Fri, 30 Apr 2021 09:38:07 -0300	[thread overview]
Message-ID: <20210430123807.GB1370958@nvidia.com> (raw)
In-Reply-To: <20210430095417.GA13686@lpieralisi>

On Fri, Apr 30, 2021 at 10:54:17AM +0100, Lorenzo Pieralisi wrote:
> [+Jason, Ben]
> 
> On Thu, Apr 29, 2021 at 11:29:05AM -0500, Shanker Donthineni wrote:
> > For pass-through device assignment, the ARM64 KVM hypervisor retrieves
> > the memory region properties physical address, size, and whether a
> > region backed with struct page or not from VMA. The prefetchable
> > attribute of a BAR region isn't visible to KVM to make an optimal
> > decision for stage2 attributes.
> > 
> > This patch updates vma->vm_page_prot and maps with write-combine
> > attribute if the associated BAR is prefetchable. For ARM64
> > pgprot_writecombine() is mapped to memory-type MT_NORMAL_NC which
> > has no side effects on reads and multiple writes can be combined.
> > 
> > Signed-off-by: Shanker Donthineni <sdonthineni@nvidia.com>
> >  drivers/vfio/pci/vfio_pci.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> A bit of background information that may be useful:
> 
> https://lore.kernel.org/linux-pci/2b539df4c9ec703458e46da2fc879ee3b310b31c.camel@kernel.crashing.org

This can't happen automatically.

writecombining or not is a uABI visible change. Userspace needs to
explicitly request and know that the mmap it gets back is
writecombining.

Jason

  reply	other threads:[~2021-04-30 14:52 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 16:29 [RFC 0/2] [RFC] Honor PCI prefetchable attributes for a virtual machine on ARM64 Shanker Donthineni
2021-04-29 16:29 ` Shanker Donthineni
2021-04-29 16:29 ` Shanker Donthineni
2021-04-29 16:29 ` [RFC 1/2] vfio/pci: keep the prefetchable attribute of a BAR region in VMA Shanker Donthineni
2021-04-29 16:29   ` Shanker Donthineni
2021-04-29 16:29   ` Shanker Donthineni
2021-04-29 18:28   ` Alex Williamson
2021-04-29 18:28     ` Alex Williamson
2021-04-29 18:28     ` Alex Williamson
2021-04-29 19:14     ` Shanker R Donthineni
2021-04-29 19:14       ` Shanker R Donthineni
2021-04-29 19:14       ` Shanker R Donthineni
2021-04-29 19:46       ` Alex Williamson
2021-04-29 19:46         ` Alex Williamson
2021-04-29 19:46         ` Alex Williamson
2021-04-29 22:08         ` Vikram Sethi
2021-04-29 22:08           ` Vikram Sethi
2021-04-29 22:08           ` Vikram Sethi
2021-04-30 11:25         ` Shanker R Donthineni
2021-04-30 11:25           ` Shanker R Donthineni
2021-04-30 11:25           ` Shanker R Donthineni
2021-04-30 11:47           ` Marc Zyngier
2021-04-30 11:47             ` Marc Zyngier
2021-04-30 13:07             ` Shanker R Donthineni
2021-04-30 13:07               ` Shanker R Donthineni
2021-04-30 13:07               ` Shanker R Donthineni
2021-04-30 15:07               ` Marc Zyngier
2021-04-30 15:07                 ` Marc Zyngier
2021-04-30 14:58             ` Shanker R Donthineni
2021-04-30 14:58               ` Shanker R Donthineni
2021-04-30 14:58               ` Shanker R Donthineni
2021-04-30 15:31               ` Marc Zyngier
2021-04-30 15:31                 ` Marc Zyngier
2021-04-30 16:57                 ` Vikram Sethi
2021-04-30 16:57                   ` Vikram Sethi
2021-04-30 16:57                   ` Vikram Sethi
2021-05-01  9:30                   ` Marc Zyngier
2021-05-01  9:30                     ` Marc Zyngier
2021-05-01  9:30                     ` Marc Zyngier
2021-05-01 11:36                     ` Shanker R Donthineni
2021-05-01 11:36                       ` Shanker R Donthineni
2021-05-01 11:36                       ` Shanker R Donthineni
2021-05-03  9:50                       ` Marc Zyngier
2021-05-03  9:50                         ` Marc Zyngier
2021-05-03 12:08                         ` Shanker R Donthineni
2021-05-03 12:08                           ` Shanker R Donthineni
2021-05-03 12:08                           ` Shanker R Donthineni
2021-05-02 17:56                     ` Vikram Sethi
2021-05-02 17:56                       ` Vikram Sethi
2021-05-02 17:56                       ` Vikram Sethi
2021-05-03 10:17                       ` Marc Zyngier
2021-05-03 10:17                         ` Marc Zyngier
2021-05-03 10:17                         ` Marc Zyngier
2021-05-03 13:35                         ` Mark Kettenis
2021-05-03 13:35                           ` Mark Kettenis
2021-05-03 13:35                           ` Mark Kettenis
2021-05-03 13:59                           ` Vikram Sethi
2021-05-03 13:59                             ` Vikram Sethi
2021-05-03 13:59                             ` Vikram Sethi
2021-05-03 14:44                             ` Alex Williamson
2021-05-03 14:44                               ` Alex Williamson
2021-05-03 14:44                               ` Alex Williamson
2021-05-03 22:03                               ` Vikram Sethi
2021-05-03 22:03                                 ` Vikram Sethi
2021-05-03 22:03                                 ` Vikram Sethi
2021-05-04  8:30                                 ` Will Deacon
2021-05-04  8:30                                   ` Will Deacon
2021-05-04  8:30                                   ` Will Deacon
2021-05-05 18:02                                   ` Catalin Marinas
2021-05-05 18:02                                     ` Catalin Marinas
2021-05-05 18:02                                     ` Catalin Marinas
2021-05-06  7:22                                     ` Christoph Hellwig
2021-05-06  7:22                                       ` Christoph Hellwig
2021-05-06  7:22                                       ` Christoph Hellwig
2021-05-08 16:33                                     ` Shanker R Donthineni
2021-05-08 16:33                                       ` Shanker R Donthineni
2021-05-08 16:33                                       ` Shanker R Donthineni
2021-06-02  9:37                                       ` Marc Zyngier
2021-06-02  9:37                                         ` Marc Zyngier
2021-06-02  9:37                                         ` Marc Zyngier
2021-05-04 18:03                                 ` Alex Williamson
2021-05-04 18:03                                   ` Alex Williamson
2021-05-04 18:03                                   ` Alex Williamson
2021-06-02  9:11                                   ` Marc Zyngier
2021-06-02  9:11                                     ` Marc Zyngier
2021-06-02  9:11                                     ` Marc Zyngier
2021-04-30  9:54   ` Lorenzo Pieralisi
2021-04-30  9:54     ` Lorenzo Pieralisi
2021-04-30  9:54     ` Lorenzo Pieralisi
2021-04-30 12:38     ` Jason Gunthorpe [this message]
2021-04-30 12:38       ` Jason Gunthorpe
2021-04-30 12:38       ` Jason Gunthorpe
2021-04-29 16:29 ` [RFC 2/2] KVM: arm64: Add write-combine support for stage-2 entries Shanker Donthineni
2021-04-29 16:29   ` Shanker Donthineni
2021-04-29 16:29   ` Shanker Donthineni
2021-04-29 19:34   ` kernel test robot
2021-05-03  7:01 ` [RFC 0/2] [RFC] Honor PCI prefetchable attributes for a virtual machine on ARM64 Christoph Hellwig
2021-05-03  7:01   ` Christoph Hellwig
2021-05-03  7:01   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210430123807.GB1370958@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=benh@kernel.crashing.org \
    --cc=catalin.marinas@arm.com \
    --cc=jsequeira@nvidia.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=maz@kernel.org \
    --cc=sdonthineni@nvidia.com \
    --cc=vsethi@nvidia.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.