Re: [PATCH v7 3/3] vduse: enable Virtio-net device type

2024-01-09 Thread Yongji Xie
On Tue, Jan 9, 2024 at 7:10 PM Maxime Coquelin wrote: > > This patch adds Virtio-net device type to the supported > devices types. > > Initialization fails if the device does not support > VIRTIO_F_VERSION_1 feature, in order to guarantee the > configuration space is read-only. It also fails with

Re: [PATCH v7 2/3] vduse: Temporarily fail if control queue feature requested

2024-01-09 Thread Yongji Xie
On Tue, Jan 9, 2024 at 7:10 PM Maxime Coquelin wrote: > > Virtio-net driver control queue implementation is not safe > when used with VDUSE. If the VDUSE application does not > reply to control queue messages, it currently ends up > hanging the kernel thread sending this command. > > Some work is

Re: [RFC] locking/rwsem: Avoid issuing wakeup before setting the reader waiter to nil

2018-12-17 Thread Yongji Xie
On Mon, 17 Dec 2018 at 19:37, Peter Zijlstra wrote: > > On Mon, Dec 10, 2018 at 11:12:52PM +0800, Yongji Xie wrote: > > Hi Peter, > > > > Please let me know If there is any progress on this issue. Thank you! > > Right, sorry, my brain was filled with snot and didn't

Re: [RFC] locking/rwsem: Avoid issuing wakeup before setting the reader waiter to nil

2018-12-10 Thread Yongji Xie
On Fri, 30 Nov 2018 at 06:17, Peter Zijlstra wrote: > > On Thu, Nov 29, 2018 at 01:34:21PM -0800, Davidlohr Bueso wrote: > > I messed up something such that waiman was not in the thread. Ccing. > > > > > On Thu, 29 Nov 2018, Waiman Long wrote: > > > > > > > That can be costly for x86 which will

Re: [RFC] locking/rwsem: Avoid issuing wakeup before setting the reader waiter to nil

2018-11-29 Thread Yongji Xie
On Thu, 29 Nov 2018 at 21:45, Peter Zijlstra wrote: > > On Thu, Nov 29, 2018 at 02:12:32PM +0100, Peter Zijlstra wrote: > > > > +Cc davidlohr and waiman > > > Urgh; so the case where the cmpxchg() fails because it already has a > > wakeup in progress, which then 'violates' our expectation of when

Re: [RFC] locking/rwsem: Avoid issuing wakeup before setting the reader waiter to nil

2018-11-29 Thread Yongji Xie
On Thu, 29 Nov 2018 at 21:45, Peter Zijlstra wrote: > > On Thu, Nov 29, 2018 at 02:12:32PM +0100, Peter Zijlstra wrote: > > > > +Cc davidlohr and waiman > > > Urgh; so the case where the cmpxchg() fails because it already has a > > wakeup in progress, which then 'violates' our expectation of when

[RFC] locking/rwsem: Avoid issuing wakeup before setting the reader waiter to nil

2018-11-29 Thread Yongji Xie
From: Xie Yongji Our system encountered a problem recently, the khungtaskd detected some process hang on mmap_sem. But the odd thing was that one task which is not on mmap_sem.wait_list still sleeps in rwsem_down_read_failed(). Through code inspection, we found a potential bug can lead to this.

[RFC] locking/rwsem: Avoid issuing wakeup before setting the reader waiter to nil

2018-11-29 Thread Yongji Xie
From: Xie Yongji Our system encountered a problem recently, the khungtaskd detected some process hang on mmap_sem. But the odd thing was that one task which is not on mmap_sem.wait_list still sleeps in rwsem_down_read_failed(). Through code inspection, we found a potential bug can lead to this.

Re: [PATCH v3 0/7] PCI: Add support for enforcing all MMIO BARs not to share PAGE_SIZE

2016-07-11 Thread Yongji Xie
Hi Bjorn, Any comment on V3? Thanks, Yongji On 2016/6/30 18:53, Yongji Xie wrote: This series aims to add an option for PCI resource allocator to force BARs not to share PAGE_SIZE. This would make sense to VFIO driver. Because current VFIO implementation disallows to mmap sub-page(size

Re: [PATCH v3 0/7] PCI: Add support for enforcing all MMIO BARs not to share PAGE_SIZE

2016-07-11 Thread Yongji Xie
Hi Bjorn, Any comment on V3? Thanks, Yongji On 2016/6/30 18:53, Yongji Xie wrote: This series aims to add an option for PCI resource allocator to force BARs not to share PAGE_SIZE. This would make sense to VFIO driver. Because current VFIO implementation disallows to mmap sub-page(size

Re: [PATCH v3 3/7] PCI: Do not disable memory decoding in pci_reassigndev_resource_alignment()

2016-07-01 Thread Yongji Xie
Hi Gavin, On 2016/7/1 8:50, Gavin Shan wrote: On Thu, Jun 30, 2016 at 06:53:09PM +0800, Yongji Xie wrote: We should not disable memory decoding when we reassign alignment in pci_reassigndev_resource_alignment(). It's meaningless and have some side effect. For example, some fixup functions

Re: [PATCH v3 3/7] PCI: Do not disable memory decoding in pci_reassigndev_resource_alignment()

2016-07-01 Thread Yongji Xie
Hi Gavin, On 2016/7/1 8:50, Gavin Shan wrote: On Thu, Jun 30, 2016 at 06:53:09PM +0800, Yongji Xie wrote: We should not disable memory decoding when we reassign alignment in pci_reassigndev_resource_alignment(). It's meaningless and have some side effect. For example, some fixup functions

Re: [PATCH v3 5/7] PCI: Do not use IORESOURCE_STARTALIGN to identify bridge resources

2016-07-01 Thread Yongji Xie
Hi Gavin, On 2016/7/1 10:34, Gavin Shan wrote: On Thu, Jun 30, 2016 at 06:53:11PM +0800, Yongji Xie wrote: Now we use the IORESOURCE_STARTALIGN to identify bridge resources in __assign_resources_sorted(). That's quite fragile. We may also set flag IORESOURCE_STARTALIGN for SR-IOV resources

Re: [PATCH v3 5/7] PCI: Do not use IORESOURCE_STARTALIGN to identify bridge resources

2016-07-01 Thread Yongji Xie
Hi Gavin, On 2016/7/1 10:34, Gavin Shan wrote: On Thu, Jun 30, 2016 at 06:53:11PM +0800, Yongji Xie wrote: Now we use the IORESOURCE_STARTALIGN to identify bridge resources in __assign_resources_sorted(). That's quite fragile. We may also set flag IORESOURCE_STARTALIGN for SR-IOV resources

Re: [PATCH v3 4/7] PCI: Add a new option for resource_alignment to reassign alignment

2016-07-01 Thread Yongji Xie
Hi Gavin, On 2016/7/1 10:25, Gavin Shan wrote: On Thu, Jun 30, 2016 at 06:53:10PM +0800, Yongji Xie wrote: When using resource_alignment kernel parameter, the current implement reassigns the alignment by changing resources' size which can potentially break some drivers. For example

Re: [PATCH v3 4/7] PCI: Add a new option for resource_alignment to reassign alignment

2016-07-01 Thread Yongji Xie
Hi Gavin, On 2016/7/1 10:25, Gavin Shan wrote: On Thu, Jun 30, 2016 at 06:53:10PM +0800, Yongji Xie wrote: When using resource_alignment kernel parameter, the current implement reassigns the alignment by changing resources' size which can potentially break some drivers. For example

Re: [PATCH v3 2/7] PCI: Ignore enforced alignment to VF BARs

2016-07-01 Thread Yongji Xie
Hi Gavin, On 2016/7/1 14:05, Gavin Shan wrote: On Fri, Jul 01, 2016 at 01:27:17PM +0800, Yongji Xie wrote: On Thu, Jun 30, 2016 at 06:53:08PM +0800, Yongji Xie wrote: VF BARs are read-only zeroes according to SRIOV spec, the normal way(writing BARs) of allocating resources wouldn't

Re: [PATCH v3 2/7] PCI: Ignore enforced alignment to VF BARs

2016-07-01 Thread Yongji Xie
Hi Gavin, On 2016/7/1 14:05, Gavin Shan wrote: On Fri, Jul 01, 2016 at 01:27:17PM +0800, Yongji Xie wrote: On Thu, Jun 30, 2016 at 06:53:08PM +0800, Yongji Xie wrote: VF BARs are read-only zeroes according to SRIOV spec, the normal way(writing BARs) of allocating resources wouldn't

Re: [PATCH v3 2/7] PCI: Ignore enforced alignment to VF BARs

2016-06-30 Thread Yongji Xie
Hi Gavin, On 2016/7/1 8:39, Gavin Shan wrote: On Thu, Jun 30, 2016 at 06:53:08PM +0800, Yongji Xie wrote: VF BARs are read-only zeroes according to SRIOV spec, the normal way(writing BARs) of allocating resources wouldn't be applied to VFs. The VFs' resources would be allocated when we enable

Re: [PATCH v3 2/7] PCI: Ignore enforced alignment to VF BARs

2016-06-30 Thread Yongji Xie
Hi Gavin, On 2016/7/1 8:39, Gavin Shan wrote: On Thu, Jun 30, 2016 at 06:53:08PM +0800, Yongji Xie wrote: VF BARs are read-only zeroes according to SRIOV spec, the normal way(writing BARs) of allocating resources wouldn't be applied to VFs. The VFs' resources would be allocated when we enable

Re: [PATCH v3 1/7] PCI: Ignore enforced alignment when kernel uses existing firmware setup

2016-06-30 Thread Yongji Xie
Hi Gavin, On 2016/7/1 8:28, Gavin Shan wrote: On Thu, Jun 30, 2016 at 06:53:07PM +0800, Yongji Xie wrote: PCI resources allocator will use firmware setup and not try to reassign resource when PCI_PROBE_ONLY or IORESOURCE_PCI_FIXED is set. The enforced alignment

Re: [PATCH v3 1/7] PCI: Ignore enforced alignment when kernel uses existing firmware setup

2016-06-30 Thread Yongji Xie
Hi Gavin, On 2016/7/1 8:28, Gavin Shan wrote: On Thu, Jun 30, 2016 at 06:53:07PM +0800, Yongji Xie wrote: PCI resources allocator will use firmware setup and not try to reassign resource when PCI_PROBE_ONLY or IORESOURCE_PCI_FIXED is set. The enforced alignment

[PATCH v3 7/7] PCI: Add a macro to set default alignment for all PCI devices

2016-06-30 Thread Yongji Xie
fault on some platforms such as PowerNV platform which would easily see those sub-page BARs because of its 64K page. To achieve that, we add a macro PCIBIOS_DEFAULT_ALIGNMENT to set default alignment for all PCI devices and define it on PowerNV platform. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ib

[PATCH v3 7/7] PCI: Add a macro to set default alignment for all PCI devices

2016-06-30 Thread Yongji Xie
fault on some platforms such as PowerNV platform which would easily see those sub-page BARs because of its 64K page. To achieve that, we add a macro PCIBIOS_DEFAULT_ALIGNMENT to set default alignment for all PCI devices and define it on PowerNV platform. Signed-off-by: Yongji Xie --- arch/powerpc/incl

[PATCH v3 5/7] PCI: Do not use IORESOURCE_STARTALIGN to identify bridge resources

2016-06-30 Thread Yongji Xie
. In this patch, we try to use a more robust way to identify bridge resources. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- drivers/pci/setup-bus.c |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bu

[PATCH v3 5/7] PCI: Do not use IORESOURCE_STARTALIGN to identify bridge resources

2016-06-30 Thread Yongji Xie
. In this patch, we try to use a more robust way to identify bridge resources. Signed-off-by: Yongji Xie --- drivers/pci/setup-bus.c |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 55641a3..216ddbc 100644 ---

[PATCH v3 3/7] PCI: Do not disable memory decoding in pci_reassigndev_resource_alignment()

2016-06-30 Thread Yongji Xie
. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- drivers/pci/pci.c |8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 6ae02de..6241cfc 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -4820,7 +4820,6 @

[PATCH v3 1/7] PCI: Ignore enforced alignment when kernel uses existing firmware setup

2016-06-30 Thread Yongji Xie
and not re-allocated. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- drivers/pci/pci.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index c8b4dbd..be8f72c 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -4760,6 +4

[PATCH v3 2/7] PCI: Ignore enforced alignment to VF BARs

2016-06-30 Thread Yongji Xie
and will release the allocated resources which leads to a bug. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- drivers/pci/pci.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index be8f72c..6ae02de 100644 --- a/drivers/pci/pci.c +++ b/drive

[PATCH v3 0/7] PCI: Add support for enforcing all MMIO BARs not to share PAGE_SIZE

2016-06-30 Thread Yongji Xie
ory decoding when reassigning the alignment - Only enable default alignment on PowerNV platform Changelog v2: - Ignore enforced alignment to VF BARs on pci_reassigndev_resource_alignment() Yongji Xie (7): PCI: Ignore enforced alignment when kernel uses existing firmware setup PCI: Ignore enfor

[PATCH v3 6/7] PCI: Add support for enforcing all MMIO BARs to be page aligned

2016-06-30 Thread Yongji Xie
ent of all MMIO BARs to be at least PAGE_SIZE so that one BAR's mmio page would not be shared with other BARs. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- Documentation/kernel-parameters.txt |2 ++ drivers/pci/pci.c | 60

[PATCH v3 3/7] PCI: Do not disable memory decoding in pci_reassigndev_resource_alignment()

2016-06-30 Thread Yongji Xie
. Signed-off-by: Yongji Xie --- drivers/pci/pci.c |8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 6ae02de..6241cfc 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -4820,7 +4820,6 @@ void

[PATCH v3 1/7] PCI: Ignore enforced alignment when kernel uses existing firmware setup

2016-06-30 Thread Yongji Xie
and not re-allocated. Signed-off-by: Yongji Xie --- drivers/pci/pci.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index c8b4dbd..be8f72c 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -4760,6 +4760,13 @@ static resource_size_t

[PATCH v3 2/7] PCI: Ignore enforced alignment to VF BARs

2016-06-30 Thread Yongji Xie
and will release the allocated resources which leads to a bug. Signed-off-by: Yongji Xie --- drivers/pci/pci.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index be8f72c..6ae02de 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -4822,6 +4822,10

[PATCH v3 0/7] PCI: Add support for enforcing all MMIO BARs not to share PAGE_SIZE

2016-06-30 Thread Yongji Xie
ory decoding when reassigning the alignment - Only enable default alignment on PowerNV platform Changelog v2: - Ignore enforced alignment to VF BARs on pci_reassigndev_resource_alignment() Yongji Xie (7): PCI: Ignore enforced alignment when kernel uses existing firmware setup PCI: Ignore enfor

[PATCH v3 6/7] PCI: Add support for enforcing all MMIO BARs to be page aligned

2016-06-30 Thread Yongji Xie
ent of all MMIO BARs to be at least PAGE_SIZE so that one BAR's mmio page would not be shared with other BARs. Signed-off-by: Yongji Xie --- Documentation/kernel-parameters.txt |2 ++ drivers/pci/pci.c | 60 --- 2 files changed, 51 inserti

[PATCH v3 4/7] PCI: Add a new option for resource_alignment to reassign alignment

2016-06-30 Thread Yongji Xie
"noresize" for the parameter to solve this problem. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- Documentation/kernel-parameters.txt |5 - drivers/pci/pci.c | 35 +-- 2 files changed, 29 insertions(+), 11 deletion

[PATCH v3 4/7] PCI: Add a new option for resource_alignment to reassign alignment

2016-06-30 Thread Yongji Xie
"noresize" for the parameter to solve this problem. Signed-off-by: Yongji Xie --- Documentation/kernel-parameters.txt |5 - drivers/pci/pci.c | 35 +-- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/Documentat

[PATCH v5] vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive

2016-06-30 Thread Yongji Xie
ard to access this BAR in userspace because we have no way to get the BAR's location in a page. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- drivers/vfio/pci/vfio_pci.c | 88 --- drivers/vfio/pci/vfio_pci_private.h |8 2 files ch

[PATCH v5] vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive

2016-06-30 Thread Yongji Xie
ard to access this BAR in userspace because we have no way to get the BAR's location in a page. Signed-off-by: Yongji Xie --- drivers/vfio/pci/vfio_pci.c | 88 --- drivers/vfio/pci/vfio_pci_private.h |8 2 files changed, 90 insertions(+), 6 deleti

Re: [PATCH v4] vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive

2016-06-29 Thread Yongji Xie
On 2016/6/30 10:53, Alex Williamson wrote: On Thu, 30 Jun 2016 10:40:23 +0800 Yongji Xie <xyj...@linux.vnet.ibm.com> wrote: Hi Alex, On 2016/6/30 4:03, Alex Williamson wrote: On Tue, 28 Jun 2016 13:47:23 -0600 Alex Williamson <alex.william...@redhat.com> wrote: On Tue, 28

Re: [PATCH v4] vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive

2016-06-29 Thread Yongji Xie
On 2016/6/30 10:53, Alex Williamson wrote: On Thu, 30 Jun 2016 10:40:23 +0800 Yongji Xie wrote: Hi Alex, On 2016/6/30 4:03, Alex Williamson wrote: On Tue, 28 Jun 2016 13:47:23 -0600 Alex Williamson wrote: On Tue, 28 Jun 2016 18:09:46 +0800 Yongji Xie wrote: Hi, Alex On 2016/6

Re: [PATCH v4] vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive

2016-06-29 Thread Yongji Xie
Hi Alex, On 2016/6/30 4:03, Alex Williamson wrote: On Tue, 28 Jun 2016 13:47:23 -0600 Alex Williamson <alex.william...@redhat.com> wrote: On Tue, 28 Jun 2016 18:09:46 +0800 Yongji Xie <xyj...@linux.vnet.ibm.com> wrote: Hi, Alex On 2016/6/25 0:43, Alex Williamson wrote: On

Re: [PATCH v4] vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive

2016-06-29 Thread Yongji Xie
Hi Alex, On 2016/6/30 4:03, Alex Williamson wrote: On Tue, 28 Jun 2016 13:47:23 -0600 Alex Williamson wrote: On Tue, 28 Jun 2016 18:09:46 +0800 Yongji Xie wrote: Hi, Alex On 2016/6/25 0:43, Alex Williamson wrote: On Fri, 24 Jun 2016 23:37:02 +0800 Yongji Xie wrote: Hi, Alex

Re: [PATCH v4] vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive

2016-06-28 Thread Yongji Xie
Hi, Alex On 2016/6/25 0:43, Alex Williamson wrote: On Fri, 24 Jun 2016 23:37:02 +0800 Yongji Xie <xyj...@linux.vnet.ibm.com> wrote: Hi, Alex On 2016/6/24 11:37, Alex Williamson wrote: On Fri, 24 Jun 2016 10:52:58 +0800 Yongji Xie <xyj...@linux.vnet.ibm.com> wrote: On 2016/6/2

Re: [PATCH v4] vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive

2016-06-28 Thread Yongji Xie
Hi, Alex On 2016/6/25 0:43, Alex Williamson wrote: On Fri, 24 Jun 2016 23:37:02 +0800 Yongji Xie wrote: Hi, Alex On 2016/6/24 11:37, Alex Williamson wrote: On Fri, 24 Jun 2016 10:52:58 +0800 Yongji Xie wrote: On 2016/6/24 0:12, Alex Williamson wrote: On Mon, 30 May 2016 21:06:37 +0800

Re: [PATCH v4] vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive

2016-06-24 Thread Yongji Xie
Hi, Alex On 2016/6/24 11:37, Alex Williamson wrote: On Fri, 24 Jun 2016 10:52:58 +0800 Yongji Xie <xyj...@linux.vnet.ibm.com> wrote: On 2016/6/24 0:12, Alex Williamson wrote: On Mon, 30 May 2016 21:06:37 +0800 Yongji Xie <xyj...@linux.vnet.ibm.com> wrote: +static void vfio_pci

Re: [PATCH v4] vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive

2016-06-24 Thread Yongji Xie
Hi, Alex On 2016/6/24 11:37, Alex Williamson wrote: On Fri, 24 Jun 2016 10:52:58 +0800 Yongji Xie wrote: On 2016/6/24 0:12, Alex Williamson wrote: On Mon, 30 May 2016 21:06:37 +0800 Yongji Xie wrote: +static void vfio_pci_probe_mmaps(struct vfio_pci_device *vdev) +{ + struct

Re: [PATCH v4] vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive

2016-06-23 Thread Yongji Xie
Hi, Alex On 2016/6/24 0:12, Alex Williamson wrote: On Mon, 30 May 2016 21:06:37 +0800 Yongji Xie <xyj...@linux.vnet.ibm.com> wrote: Current vfio-pci implementation disallows to mmap sub-page(size < PAGE_SIZE) MMIO BARs because these BARs' mmio page may be shared with o

Re: [PATCH v4] vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive

2016-06-23 Thread Yongji Xie
Hi, Alex On 2016/6/24 0:12, Alex Williamson wrote: On Mon, 30 May 2016 21:06:37 +0800 Yongji Xie wrote: Current vfio-pci implementation disallows to mmap sub-page(size < PAGE_SIZE) MMIO BARs because these BARs' mmio page may be shared with other BARs. This will cause some performance iss

Re: [PATCH v4] vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive

2016-06-22 Thread Yongji Xie
Hi, Alex On 2016/6/23 6:04, Alex Williamson wrote: On Mon, 30 May 2016 21:06:37 +0800 Yongji Xie <xyj...@linux.vnet.ibm.com> wrote: Current vfio-pci implementation disallows to mmap sub-page(size < PAGE_SIZE) MMIO BARs because these BARs' mmio page may be shared with o

Re: [PATCH v4] vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive

2016-06-22 Thread Yongji Xie
Hi, Alex On 2016/6/23 6:04, Alex Williamson wrote: On Mon, 30 May 2016 21:06:37 +0800 Yongji Xie wrote: Current vfio-pci implementation disallows to mmap sub-page(size < PAGE_SIZE) MMIO BARs because these BARs' mmio page may be shared with other BARs. This will cause some performance iss

Re: [RESEND PATCH v2 1/4] PCI: Ignore resource_alignment if PCI_PROBE_ONLY was set\\

2016-06-21 Thread Yongji Xie
On 2016/6/21 10:16, Yongji Xie wrote: On 2016/6/21 9:43, Bjorn Helgaas wrote: On Thu, Jun 02, 2016 at 01:46:48PM +0800, Yongji Xie wrote: The resource_alignment will releases memory resources allocated by firmware so that kernel can reassign new resources later on. But this will cause

Re: [RESEND PATCH v2 1/4] PCI: Ignore resource_alignment if PCI_PROBE_ONLY was set\\

2016-06-21 Thread Yongji Xie
On 2016/6/21 10:16, Yongji Xie wrote: On 2016/6/21 9:43, Bjorn Helgaas wrote: On Thu, Jun 02, 2016 at 01:46:48PM +0800, Yongji Xie wrote: The resource_alignment will releases memory resources allocated by firmware so that kernel can reassign new resources later on. But this will cause

Re: [RESEND PATCH v2 4/4] PCI: Add support for enforcing all MMIO BARs to be page aligned

2016-06-21 Thread Yongji Xie
On 2016/6/21 10:26, Bjorn Helgaas wrote: On Thu, Jun 02, 2016 at 01:46:51PM +0800, Yongji Xie wrote: When vfio passthrough a PCI device of which MMIO BARs are smaller than PAGE_SIZE, guest will not handle the mmio accesses to the BARs which leads to mmio emulations in host. This is because

Re: [RESEND PATCH v2 4/4] PCI: Add support for enforcing all MMIO BARs to be page aligned

2016-06-21 Thread Yongji Xie
On 2016/6/21 10:26, Bjorn Helgaas wrote: On Thu, Jun 02, 2016 at 01:46:51PM +0800, Yongji Xie wrote: When vfio passthrough a PCI device of which MMIO BARs are smaller than PAGE_SIZE, guest will not handle the mmio accesses to the BARs which leads to mmio emulations in host. This is because

Re: [RESEND PATCH v2 1/4] PCI: Ignore resource_alignment if PCI_PROBE_ONLY was set\\

2016-06-20 Thread Yongji Xie
On 2016/6/21 9:43, Bjorn Helgaas wrote: On Thu, Jun 02, 2016 at 01:46:48PM +0800, Yongji Xie wrote: The resource_alignment will releases memory resources allocated by firmware so that kernel can reassign new resources later on. But this will cause the problem that no resources can be allocated

Re: [RESEND PATCH v2 1/4] PCI: Ignore resource_alignment if PCI_PROBE_ONLY was set\\

2016-06-20 Thread Yongji Xie
On 2016/6/21 9:43, Bjorn Helgaas wrote: On Thu, Jun 02, 2016 at 01:46:48PM +0800, Yongji Xie wrote: The resource_alignment will releases memory resources allocated by firmware so that kernel can reassign new resources later on. But this will cause the problem that no resources can be allocated

Re: [RESEND PATCH v2 3/4] PCI: Add a new option for resource_alignment to reassign alignment

2016-06-20 Thread Yongji Xie
On 2016/6/21 9:57, Bjorn Helgaas wrote: On Thu, Jun 02, 2016 at 01:46:50PM +0800, Yongji Xie wrote: When using resource_alignment kernel parameter, the current implement reassigns the alignment by changing resources' size which can potentially break some drivers. For example, the driver uses

Re: [RESEND PATCH v2 3/4] PCI: Add a new option for resource_alignment to reassign alignment

2016-06-20 Thread Yongji Xie
On 2016/6/21 9:57, Bjorn Helgaas wrote: On Thu, Jun 02, 2016 at 01:46:50PM +0800, Yongji Xie wrote: When using resource_alignment kernel parameter, the current implement reassigns the alignment by changing resources' size which can potentially break some drivers. For example, the driver uses

Re: [RESEND PATCH v2 2/4] PCI: Do not Use IORESOURCE_STARTALIGN to identify bridge resources

2016-06-20 Thread Yongji Xie
On 2016/6/21 9:50, Bjorn Helgaas wrote: On Thu, Jun 02, 2016 at 01:46:49PM +0800, Yongji Xie wrote: Now we use the IORESOURCE_STARTALIGN to identify bridge resources in __assign_resources_sorted(). That's quite fragile. We can't make sure that the PCI devices' resources will not use

Re: [RESEND PATCH v2 2/4] PCI: Do not Use IORESOURCE_STARTALIGN to identify bridge resources

2016-06-20 Thread Yongji Xie
On 2016/6/21 9:50, Bjorn Helgaas wrote: On Thu, Jun 02, 2016 at 01:46:49PM +0800, Yongji Xie wrote: Now we use the IORESOURCE_STARTALIGN to identify bridge resources in __assign_resources_sorted(). That's quite fragile. We can't make sure that the PCI devices' resources will not use

Re: [RESEND PATCH v2 0/6] vfio-pci: Add support for mmapping MSI-X table

2016-06-08 Thread Yongji Xie
Hi, Eric On 2016/6/8 15:41, Auger Eric wrote: Hi Yongji, Le 02/06/2016 à 08:09, Yongji Xie a écrit : Current vfio-pci implementation disallows to mmap the page containing MSI-X table in case that users can write directly to MSI-X table and generate an incorrect MSIs. However

Re: [RESEND PATCH v2 0/6] vfio-pci: Add support for mmapping MSI-X table

2016-06-08 Thread Yongji Xie
Hi, Eric On 2016/6/8 15:41, Auger Eric wrote: Hi Yongji, Le 02/06/2016 à 08:09, Yongji Xie a écrit : Current vfio-pci implementation disallows to mmap the page containing MSI-X table in case that users can write directly to MSI-X table and generate an incorrect MSIs. However

Re: [RESEND PATCH v2 2/6] PCI: Set PCI_BUS_FLAGS_MSI_REMAP if MSI controller enables IRQ remapping

2016-06-06 Thread Yongji Xie
-ci/linux/commits/Yongji-Xie/PCI-Add-a-new-PCI_BUS_FLAGS_MSI_REMAP-flag/20160530-215348 base: https://github.com/awilliam/linux-vfio.git next config: arm-allmodconfig (attached as .config) compiler: arm-linux-gnueabi-gcc (Debian 5.3.1-8) 5.3.1 20160205 reproduce: wget https

Re: [RESEND PATCH v2 2/6] PCI: Set PCI_BUS_FLAGS_MSI_REMAP if MSI controller enables IRQ remapping

2016-06-06 Thread Yongji Xie
-ci/linux/commits/Yongji-Xie/PCI-Add-a-new-PCI_BUS_FLAGS_MSI_REMAP-flag/20160530-215348 base: https://github.com/awilliam/linux-vfio.git next config: arm-allmodconfig (attached as .config) compiler: arm-linux-gnueabi-gcc (Debian 5.3.1-8) 5.3.1 20160205 reproduce: wget https

Re: [RESEND PATCH v2 2/6] PCI: Set PCI_BUS_FLAGS_MSI_REMAP if MSI controller enables IRQ remapping

2016-06-06 Thread Yongji Xie
-ci/linux/commits/Yongji-Xie/PCI-Add-a-new-PCI_BUS_FLAGS_MSI_REMAP-flag/20160530-215348 base: https://github.com/awilliam/linux-vfio.git next config: arm-sa1100 (attached as .config) compiler: arm-linux-gnueabi-gcc (Debian 5.3.1-8) 5.3.1 20160205 reproduce: wget https://git.kernel.org

Re: [RESEND PATCH v2 2/6] PCI: Set PCI_BUS_FLAGS_MSI_REMAP if MSI controller enables IRQ remapping

2016-06-06 Thread Yongji Xie
-ci/linux/commits/Yongji-Xie/PCI-Add-a-new-PCI_BUS_FLAGS_MSI_REMAP-flag/20160530-215348 base: https://github.com/awilliam/linux-vfio.git next config: arm-sa1100 (attached as .config) compiler: arm-linux-gnueabi-gcc (Debian 5.3.1-8) 5.3.1 20160205 reproduce: wget https://git.kernel.org

Re: [RESEND PATCH v2 0/6] vfio-pci: Add support for mmapping MSI-X table

2016-06-02 Thread Yongji Xie
2016 14:09:57 +0800 Yongji Xie <xyj...@linux.vnet.ibm.com> wrote: Current vfio-pci implementation disallows to mmap the page containing MSI-X table in case that users can write directly to MSI-X table and generate an incorrect MSIs. However, this will cause some performance issu

Re: [RESEND PATCH v2 0/6] vfio-pci: Add support for mmapping MSI-X table

2016-06-02 Thread Yongji Xie
2016 14:09:57 +0800 Yongji Xie wrote: Current vfio-pci implementation disallows to mmap the page containing MSI-X table in case that users can write directly to MSI-X table and generate an incorrect MSIs. However, this will cause some performance issue when there are some critical device

[RESEND PATCH v2 2/6] PCI: Set PCI_BUS_FLAGS_MSI_REMAP if MSI controller enables IRQ remapping

2016-06-02 Thread Yongji Xie
. [1] https://www.mail-archive.com/linux-kernel%40vger.kernel.org/msg1138820.html Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- drivers/pci/msi.c | 15 +++ drivers/pci/probe.c |3 +++ include/linux/msi.h |5 - 3 files changed, 22 insertions(+), 1 de

[RESEND PATCH v2 1/6] PCI: Add a new PCI_BUS_FLAGS_MSI_REMAP flag

2016-06-02 Thread Yongji Xie
chs. With this flag enabled, we can easily know whether it's safe to expose MSI-X tables of PCI BARs to userspace. Some usespace drivers such as VFIO may benefit from this. [1] https://www.mail-archive.com/linux-kernel%40vger.kernel.org/msg1138820.html Signed-off-by: Yongji Xie &

[RESEND PATCH v2 1/6] PCI: Add a new PCI_BUS_FLAGS_MSI_REMAP flag

2016-06-02 Thread Yongji Xie
chs. With this flag enabled, we can easily know whether it's safe to expose MSI-X tables of PCI BARs to userspace. Some usespace drivers such as VFIO may benefit from this. [1] https://www.mail-archive.com/linux-kernel%40vger.kernel.org/msg1138820.html Signed-off-by: Yongji Xie --- include/linux/pc

[RESEND PATCH v2 2/6] PCI: Set PCI_BUS_FLAGS_MSI_REMAP if MSI controller enables IRQ remapping

2016-06-02 Thread Yongji Xie
. [1] https://www.mail-archive.com/linux-kernel%40vger.kernel.org/msg1138820.html Signed-off-by: Yongji Xie --- drivers/pci/msi.c | 15 +++ drivers/pci/probe.c |3 +++ include/linux/msi.h |5 - 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/pci

[RESEND PATCH v2 6/6] vfio-pci: Allow to expose MSI-X table to userspace if interrupt remapping is enabled

2016-06-02 Thread Yongji Xie
directly. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- drivers/vfio/pci/vfio_pci.c | 17 ++--- drivers/vfio/pci/vfio_pci_rdwr.c |3 ++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c

[RESEND PATCH v2 6/6] vfio-pci: Allow to expose MSI-X table to userspace if interrupt remapping is enabled

2016-06-02 Thread Yongji Xie
directly. Signed-off-by: Yongji Xie --- drivers/vfio/pci/vfio_pci.c | 17 ++--- drivers/vfio/pci/vfio_pci_rdwr.c |3 ++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 188b1ff..6bae388 100644

[RESEND PATCH v2 0/6] vfio-pci: Add support for mmapping MSI-X table

2016-06-02 Thread Yongji Xie
://www.mail-archive.com/linux-kernel%40vger.kernel.org/msg1138820.html Yongji Xie (6): PCI: Add a new PCI_BUS_FLAGS_MSI_REMAP flag PCI: Set PCI_BUS_FLAGS_MSI_REMAP if MSI controller enables IRQ remapping PCI: Set PCI_BUS_FLAGS_MSI_REMAP if IOMMU have capability of IRQ remapping iommu: Set

[RESEND PATCH v2 4/6] iommu: Set PCI_BUS_FLAGS_MSI_REMAP on iommu driver initialization

2016-06-02 Thread Yongji Xie
Some iommu drivers would be initialized after PCI device enumeration. So PCI_BUS_FLAGS_MSI_REMAP would not be set when probing PCI devices although IOMMU enables capability of IRQ remapping. This patch tests this capability and set the flag when iommu driver is initialized. Signed-off-by: Yongji

[RESEND PATCH v2 5/6] pci-ioda: Set PCI_BUS_FLAGS_MSI_REMAP for IODA host bridge

2016-06-02 Thread Yongji Xie
Any IODA host bridge have the capability of IRQ remapping. So we set PCI_BUS_FLAGS_MSI_REMAP when this kind of host birdge is detected. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> Reviewed-by: Alexey Kardashevskiy <a...@ozlabs.ru> --- arch/powerpc/platforms/powernv/pci-i

[RESEND PATCH v2 3/6] PCI: Set PCI_BUS_FLAGS_MSI_REMAP if IOMMU have capability of IRQ remapping

2016-06-02 Thread Yongji Xie
. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- drivers/pci/probe.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 2b9e3ba..15a33e2 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -16,6 +16,7 @@ #include #i

[RESEND PATCH v2 0/6] vfio-pci: Add support for mmapping MSI-X table

2016-06-02 Thread Yongji Xie
://www.mail-archive.com/linux-kernel%40vger.kernel.org/msg1138820.html Yongji Xie (6): PCI: Add a new PCI_BUS_FLAGS_MSI_REMAP flag PCI: Set PCI_BUS_FLAGS_MSI_REMAP if MSI controller enables IRQ remapping PCI: Set PCI_BUS_FLAGS_MSI_REMAP if IOMMU have capability of IRQ remapping iommu: Set

[RESEND PATCH v2 4/6] iommu: Set PCI_BUS_FLAGS_MSI_REMAP on iommu driver initialization

2016-06-02 Thread Yongji Xie
Some iommu drivers would be initialized after PCI device enumeration. So PCI_BUS_FLAGS_MSI_REMAP would not be set when probing PCI devices although IOMMU enables capability of IRQ remapping. This patch tests this capability and set the flag when iommu driver is initialized. Signed-off-by: Yongji

[RESEND PATCH v2 5/6] pci-ioda: Set PCI_BUS_FLAGS_MSI_REMAP for IODA host bridge

2016-06-02 Thread Yongji Xie
Any IODA host bridge have the capability of IRQ remapping. So we set PCI_BUS_FLAGS_MSI_REMAP when this kind of host birdge is detected. Signed-off-by: Yongji Xie Reviewed-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci-ioda.c |8 1 file changed, 8 insertions

[RESEND PATCH v2 3/6] PCI: Set PCI_BUS_FLAGS_MSI_REMAP if IOMMU have capability of IRQ remapping

2016-06-02 Thread Yongji Xie
. Signed-off-by: Yongji Xie --- drivers/pci/probe.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 2b9e3ba..15a33e2 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -16,6 +16,7 @@ #include #include #include +#include

[RESEND PATCH v2 1/4] PCI: Ignore resource_alignment if PCI_PROBE_ONLY was set

2016-06-02 Thread Yongji Xie
to use firmware setup and not to reassign any resources. To solve this problem, this patch ignores resource_alignment if PCI_PROBE_ONLY was set. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- drivers/pci/pci.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/pci/p

[RESEND PATCH v2 4/4] PCI: Add support for enforcing all MMIO BARs to be page aligned

2016-06-02 Thread Yongji Xie
be applied to VFs whose BARs are always page aligned and should be never reassigned according to SRIOV spec. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- Documentation/kernel-parameters.txt |2 ++ arch/powerpc/include/asm/pci.h |2 ++ drivers/pci/pci.c

[RESEND PATCH v2 1/4] PCI: Ignore resource_alignment if PCI_PROBE_ONLY was set

2016-06-02 Thread Yongji Xie
to use firmware setup and not to reassign any resources. To solve this problem, this patch ignores resource_alignment if PCI_PROBE_ONLY was set. Signed-off-by: Yongji Xie --- drivers/pci/pci.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index

[RESEND PATCH v2 4/4] PCI: Add support for enforcing all MMIO BARs to be page aligned

2016-06-02 Thread Yongji Xie
be applied to VFs whose BARs are always page aligned and should be never reassigned according to SRIOV spec. Signed-off-by: Yongji Xie --- Documentation/kernel-parameters.txt |2 ++ arch/powerpc/include/asm/pci.h |2 ++ drivers/pci/pci.c

[RESEND PATCH v2 3/4] PCI: Add a new option for resource_alignment to reassign alignment

2016-06-01 Thread Yongji Xie
"noresize" for the parameter to solve this problem. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- Documentation/kernel-parameters.txt |5 - drivers/pci/pci.c | 35 +-- 2 files changed, 29 insertions(+), 11 deletion

[RESEND PATCH v2 2/4] PCI: Do not Use IORESOURCE_STARTALIGN to identify bridge resources

2016-06-01 Thread Yongji Xie
. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- drivers/pci/setup-bus.c |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 55641a3..216ddbc 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup

[RESEND PATCH v2 0/4] PCI: Add support for enforcing all MMIO BARs not to share PAGE_SIZE

2016-06-01 Thread Yongji Xie
ARs; patch 4 modified resource_alignment to support syntax which can be used to enforce the alignment of all MMIO BARs to be at least PAGE_SIZE. Changelog v2: - Ignore enforced alignment to VF BARs on pci_reassigndev_resource_alignment() Yongji Xie (4): PCI: Ignore resource_alignm

[RESEND PATCH v2 3/4] PCI: Add a new option for resource_alignment to reassign alignment

2016-06-01 Thread Yongji Xie
"noresize" for the parameter to solve this problem. Signed-off-by: Yongji Xie --- Documentation/kernel-parameters.txt |5 - drivers/pci/pci.c | 35 +-- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/Documentat

[RESEND PATCH v2 2/4] PCI: Do not Use IORESOURCE_STARTALIGN to identify bridge resources

2016-06-01 Thread Yongji Xie
. Signed-off-by: Yongji Xie --- drivers/pci/setup-bus.c |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 55641a3..216ddbc 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -390,6 +390,7 @@ static

[RESEND PATCH v2 0/4] PCI: Add support for enforcing all MMIO BARs not to share PAGE_SIZE

2016-06-01 Thread Yongji Xie
ARs; patch 4 modified resource_alignment to support syntax which can be used to enforce the alignment of all MMIO BARs to be at least PAGE_SIZE. Changelog v2: - Ignore enforced alignment to VF BARs on pci_reassigndev_resource_alignment() Yongji Xie (4): PCI: Ignore resource_alignm

[PATCH v2 5/6] pci-ioda: Set PCI_BUS_FLAGS_MSI_REMAP for IODA host bridge

2016-05-30 Thread Yongji Xie
Any IODA host bridge have the capability of IRQ remapping. So we set PCI_BUS_FLAGS_MSI_REMAP when this kind of host birdge is detected. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> Reviewed-by: Alexey Kardashevskiy <a...@ozlabs.ru> --- arch/powerpc/platforms/powernv/pci-i

[PATCH v2 6/6] vfio-pci: Allow to expose MSI-X table to userspace if interrupt remapping is enabled

2016-05-30 Thread Yongji Xie
directly. Signed-off-by: Yongji Xie <xyj...@linux.vnet.ibm.com> --- drivers/vfio/pci/vfio_pci.c | 17 ++--- drivers/vfio/pci/vfio_pci_rdwr.c |3 ++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c

[PATCH v2 5/6] pci-ioda: Set PCI_BUS_FLAGS_MSI_REMAP for IODA host bridge

2016-05-30 Thread Yongji Xie
Any IODA host bridge have the capability of IRQ remapping. So we set PCI_BUS_FLAGS_MSI_REMAP when this kind of host birdge is detected. Signed-off-by: Yongji Xie Reviewed-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci-ioda.c |8 1 file changed, 8 insertions

[PATCH v2 6/6] vfio-pci: Allow to expose MSI-X table to userspace if interrupt remapping is enabled

2016-05-30 Thread Yongji Xie
directly. Signed-off-by: Yongji Xie --- drivers/vfio/pci/vfio_pci.c | 17 ++--- drivers/vfio/pci/vfio_pci_rdwr.c |3 ++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 188b1ff..6bae388 100644

[PATCH v2 4/6] iommu: Set PCI_BUS_FLAGS_MSI_REMAP on iommu driver initialization

2016-05-30 Thread Yongji Xie
Some iommu drivers would be initialized after PCI device enumeration. So PCI_BUS_FLAGS_MSI_REMAP would not be set when probing PCI devices although IOMMU enables capability of IRQ remapping. This patch tests this capability and set the flag when iommu driver is initialized. Signed-off-by: Yongji

[PATCH v2 4/6] iommu: Set PCI_BUS_FLAGS_MSI_REMAP on iommu driver initialization

2016-05-30 Thread Yongji Xie
Some iommu drivers would be initialized after PCI device enumeration. So PCI_BUS_FLAGS_MSI_REMAP would not be set when probing PCI devices although IOMMU enables capability of IRQ remapping. This patch tests this capability and set the flag when iommu driver is initialized. Signed-off-by: Yongji

  1   2   3   4   >