Re: [PATCH] vfio/type1: remove hugepage checks in is_invalid_reserved_pfn()

2019-10-18 Thread Ben Luo
A friendly reminder :) Thanks,     Ben 在 2019/10/4 上午12:41, Andrea Arcangeli 写道: On Thu, Oct 03, 2019 at 11:49:42AM +0800, Ben Luo wrote: Currently, no hugepage split code can transfer the reserved bit from head to tail during the split, so checking the head can't make a difference

[PATCH] vfio/type1: remove hugepage checks in is_invalid_reserved_pfn()

2019-10-02 Thread Ben Luo
at boot, if any driver sets the reserved bit of head page before mapping the hugepage in userland, it needs to set the reserved bit in all subpages to be safe. Signed-off-by: Ben Luo --- drivers/vfio/vfio_iommu_type1.c | 26 -- 1 file changed, 4 insertions(+), 22 deletions

Re: [PATCH v6 0/3] genirq/vfio: Introduce irq_update_devid() and optimize VFIO irq ops

2019-09-10 Thread Ben Luo
A friendly reminder. Thanks,     Ben 在 2019/9/2 下午12:01, Ben Luo 写道: Currently, VFIO takes a free-then-request-irq way to do interrupt affinity setting and masking/unmasking for a VM with device passthru via VFIO. Sometimes it only changes the cookie data of irqaction or even changes nothing

Re: [PATCH v2] vfio/type1: avoid redundant PageReserved checking

2019-09-02 Thread Ben Luo
在 2019/8/30 上午1:06, Alex Williamson 写道: On Fri, 30 Aug 2019 00:58:22 +0800 Ben Luo wrote: 在 2019/8/28 下午11:55, Alex Williamson 写道: On Wed, 28 Aug 2019 12:28:04 +0800 Ben Luo wrote: currently, if the page is not a tail of compound page, it will be checked twice for the same thing

[PATCH v6 2/3] genirq: introduce irq_update_devid()

2019-09-01 Thread Ben Luo
process. Signed-off-by: Ben Luo --- include/linux/interrupt.h | 3 ++ kernel/irq/manage.c | 75 +++ 2 files changed, 78 insertions(+) diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 5b8328a..09b6a0f 100644 --- a/include

[PATCH v6 3/3] vfio/pci: make use of irq_update_devid() and optimize irq ops

2019-09-01 Thread Ben Luo
ger a free-then-request-irq action, which actually changes nothing in irqaction. This patch makes use of irq_update_devid() and optimize both cases above, which reduces the risk of losing interrupt and also cuts some overhead. Signed-off-by: Ben Luo --- drivers/vfio/pci/vfio_pci_int

[PATCH v6 1/3] genirq: enhance error recovery code in free irq

2019-09-01 Thread Ben Luo
__free_irq()/__free_percpu_irq() need to return if called from IRQ context because the interrupt handler loop runs with desc->lock dropped and dev_id can be subject to load and store tearing. Also move WARNs out of lock region and print out dev_id to help debugging. Signed-off-by: Ben

[PATCH v6 0/3] genirq/vfio: Introduce irq_update_devid() and optimize VFIO irq ops

2019-09-01 Thread Ben Luo
to enhance error recovery etc. in free irq per tglx's comments - enhance error recovery code and debugging info in irq_update_devid - use __must_check in external referencing of this function - use EXPORT_SYMBOL_GPL for irq_update_devid - reformat code of patch 3 for better readability Ben Luo (3

Re: [PATCH v5 3/3] vfio/pci: make use of irq_update_devid and optimize irq ops

2019-08-30 Thread Ben Luo
在 2019/8/31 上午4:06, Alex Williamson 写道: On Fri, 30 Aug 2019 16:42:06 +0800 Ben Luo wrote: When userspace (e.g. qemu) triggers a switch between KVM irqfd and userspace eventfd, only dev_id of irqaction (i.e. the "trigger" in this patch's context) will be changed, but a free-then-r

[PATCH v5 3/3] vfio/pci: make use of irq_update_devid and optimize irq ops

2019-08-30 Thread Ben Luo
Signed-off-by: Ben Luo --- drivers/vfio/pci/vfio_pci_intrs.c | 124 ++ 1 file changed, 87 insertions(+), 37 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c index 3fa3f72..d3a93d7 100644 --- a/driver

[PATCH v5 2/3] genirq: introduce irq_update_devid()

2019-08-30 Thread Ben Luo
process. Signed-off-by: Ben Luo --- include/linux/interrupt.h | 3 ++ kernel/irq/manage.c | 75 +++ 2 files changed, 78 insertions(+) diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 5b8328a..09b6a0f 100644 --- a/include

[PATCH v5 1/3] genirq: enhance error recovery code in free irq

2019-08-30 Thread Ben Luo
__free_irq()/__free_percpu_irq() need to return if called from IRQ context because the interrupt handler loop runs with desc->lock dropped and dev_id can be subject to load and store tearing. Also move WARNs out of lock region and print out dev_id to help debugging. Signed-off-by: Ben

[PATCH v5 0/3] genirq/vfio: Introduce irq_update_devid() and optimize VFIO irq ops

2019-08-30 Thread Ben Luo
in irq_update_devid - use __must_check in external referencing of this function - use EXPORT_SYMBOL_GPL for irq_update_devid - reformat code of patch 3 for better readability Ben Luo (3): genirq: enhance error recovery code in free irq genirq: introduce irq_update_devid() vfio/pci: make use

Re: [PATCH v2] vfio/type1: avoid redundant PageReserved checking

2019-08-29 Thread Ben Luo
在 2019/8/28 下午11:55, Alex Williamson 写道: On Wed, 28 Aug 2019 12:28:04 +0800 Ben Luo wrote: currently, if the page is not a tail of compound page, it will be checked twice for the same thing. Signed-off-by: Ben Luo --- drivers/vfio/vfio_iommu_type1.c | 3 +-- 1 file changed, 1 insertion

Re: [PATCH v4 3/3] vfio/pci: make use of irq_update_devid and optimize irq ops

2019-08-28 Thread Ben Luo
在 2019/8/29 上午1:23, Alex Williamson 写道: On Wed, 28 Aug 2019 18:08:02 +0800 Ben Luo wrote: 在 2019/8/28 上午4:33, Alex Williamson 写道: On Thu, 22 Aug 2019 23:34:43 +0800 Ben Luo wrote: When userspace (e.g. qemu) triggers a switch between KVM irqfd and userspace eventfd, only dev_id of irq

Re: [PATCH v4 3/3] vfio/pci: make use of irq_update_devid and optimize irq ops

2019-08-28 Thread Ben Luo
在 2019/8/28 上午4:33, Alex Williamson 写道: On Thu, 22 Aug 2019 23:34:43 +0800 Ben Luo wrote: When userspace (e.g. qemu) triggers a switch between KVM irqfd and userspace eventfd, only dev_id of irq action (i.e. the "trigger" in this patch's context) will be changed, but a free-then-r

[PATCH v2] vfio/type1: avoid redundant PageReserved checking

2019-08-27 Thread Ben Luo
currently, if the page is not a tail of compound page, it will be checked twice for the same thing. Signed-off-by: Ben Luo --- drivers/vfio/vfio_iommu_type1.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c

[PATCH] vfio/type1: avoid redundant PageReserved checking

2019-08-27 Thread Ben Luo
currently, if the page is not a tail of compound page, it will be checked twice for the same thing. Signed-off-by: Ben Luo --- drivers/vfio/vfio_iommu_type1.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1

[PATCH v4 3/3] vfio/pci: make use of irq_update_devid and optimize irq ops

2019-08-22 Thread Ben Luo
e overhead. Signed-off-by: Ben Luo --- drivers/vfio/pci/vfio_pci_intrs.c | 112 +- 1 file changed, 74 insertions(+), 38 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c index 3fa3f72..60d3023 100644 --- a/driver

[PATCH v4 1/3] genirq: enhance error recovery code in free irq

2019-08-22 Thread Ben Luo
__free_irq()/__free_percpu_irq() need to return if called from IRQ context because the interrupt handler loop runs with desc->lock dropped and dev_id can be subject to load and store tearing. Also move WARNs out of lock region and print out dev_id to help debugging. Signed-off-by: Ben

[PATCH v4 2/3] genirq: introduce irq_update_devid()

2019-08-22 Thread Ben Luo
process. Signed-off-by: Ben Luo --- include/linux/interrupt.h | 3 ++ kernel/irq/manage.c | 75 +++ 2 files changed, 78 insertions(+) diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 5b8328a..09b6a0f 100644 --- a/include

[PATCH v4 0/3] genirq/vfio: Introduce irq_update_devid() and optimize VFIO irq ops

2019-08-22 Thread Ben Luo
readability Ben Luo (3): genirq: enhance error recovery code in free irq genirq: introduce irq_update_devid() vfio/pci: make use of irq_update_devid and optimize irq ops drivers/vfio/pci/vfio_pci_intrs.c | 112 +- include/linux/interrupt.h | 3 + kernel

[PATCH v3 2/3] genirq: introduce update_irq_devid()

2019-08-15 Thread Ben Luo
referencing to different fds' contexts. So, instead of free/request irq, only update dev_id of irqaction. This narrows the gap for setting up new irq (and irte, if has) and also gains some performance benefit. Signed-off-by: Ben Luo Reviewed-by: Liu Jiang Reviewed-by: Thomas Gleixner --- include/linux

[PATCH v3 3/3] vfio_pci: make use of update_irq_devid and optimize irq ops

2019-08-15 Thread Ben Luo
e overhead. Signed-off-by: Ben Luo Reviewed-by: Liu Jiang Reviewed-by: Zou Nanhai Reviewed-by: Yunsheng Lin --- drivers/vfio/pci/vfio_pci_intrs.c | 101 -- 1 file changed, 63 insertions(+), 38 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/driver

[PATCH v3 1/3] genirq: enhance error recovery code in free irq

2019-08-15 Thread Ben Luo
Per Thomas Gleixner's comments: 1) free_irq/free_percpu_irq returns if called from IRQ context 2) move WARN out of the locked region and print out dev_id Signed-off-by: Ben Luo --- kernel/irq/manage.c | 32 1 file changed, 20 insertions(+), 12 deletions(-) diff

[PATCH v3 0/3] genirq/vfio: Introduce update_irq_devid and optimize VFIO irq ops

2019-08-15 Thread Ben Luo
EXPORT_SYMBOL_GPL for update_irq_devid - reformat code of patch 3 for better readability Ben Luo (3): genirq: enhance error recovery code in free irq genirq: introduce update_irq_devid() vfio_pci: make use of update_irq_devid and optimize irq ops drivers/vfio/pci/vfio_pci_intrs.c | 101

[PATCH v2 3/3] vfio_pci: make use of update_irq_devid and optimize irq ops

2019-08-12 Thread Ben Luo
e overhead. Signed-off-by: Ben Luo Reviewed-by: Liu Jiang Reviewed-by: Zou Nanhai Reviewed-by: Yunsheng Lin --- drivers/vfio/pci/vfio_pci_intrs.c | 99 --- 1 file changed, 61 insertions(+), 38 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/driver

[PATCH v2 2/3] genirq: introduce update_irq_devid()

2019-08-12 Thread Ben Luo
referencing to different fds' contexts. So, instead of free/request irq, only update dev_id of irqaction. This narrows the gap for setting up new irq (and irte, if has) and also gains some performance benefit. Signed-off-by: Ben Luo Reviewed-by: Liu Jiang Reviewed-by: Thomas Gleixner --- include/linux

[PATCH v2 0/3] introduce update_irq_devid and optimize VFIO irq ops

2019-08-12 Thread Ben Luo
1 to enhance error recovery etc. in free irq per tglx's comments - enhance error recovery code and debugging info in update_irq_devid - use __must_check in external referencing of update_irq_devid - use EXPORT_SYMBOL_GPL for update_irq_devid - reformat code of patch 3 for better readability Ben

[PATCH v2 1/3] genirq: enhance error recovery code in free irq

2019-08-12 Thread Ben Luo
Per Thomas Gleixner's comments: 1) free_irq/free_percpu_irq returns if called from IRQ context 2) move WARN out of the locked region and print out dev_id Signed-off-by: Ben Luo --- kernel/irq/manage.c | 32 1 file changed, 20 insertions(+), 12 deletions(-) diff

[PATCH 2/2] vfio_pci: make use of update_irq_devid and optimize irq ops

2019-08-08 Thread Ben Luo
e overhead. Signed-off-by: Ben Luo Reviewed-by: Liu Jiang --- drivers/vfio/pci/vfio_pci_intrs.c | 100 +++--- 1 file changed, 62 insertions(+), 38 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c index 3fa3f72..1323

[PATCH 1/2] genirq: introduce update_irq_devid()

2019-08-08 Thread Ben Luo
referencing to different fds' contexts. So, instead of free/request irq, only update dev_id of irqaction. This narrows the gap for setting up new irq (and irte, if has) and also gains some performance benefit. Signed-off-by: Ben Luo Reviewed-by: Liu Jiang --- include/linux/interrupt.h | 3 ++ kernel

[PATCH 0/2] introduce update_irq_devid and optimize VFIO irq ops

2019-08-08 Thread Ben Luo
the risk of losing interrupt, this may lead to a VM hung forever in waiting IO completion This patchset solved this issue by: patch 1 introduces update_irq_devid to only update dev_id of irqaction patch 2 make use of update_irq_devid and optimize irq operations in VFIO Ben Luo (2): genirq