Re: [Qemu-devel] [PATCH v3] vfio : add aer process

2016-08-18 Thread Zhou Jie
ping On 2016/8/15 10:53, Zhou Jie wrote: ping On 2016/8/2 11:57, Zhou Jie wrote: During aer err occurs and resume do following to protect device from being accessed. 1. Make config space read only. 2. Disable INTx/MSI Interrupt. 3. Do nothing for bar regions. Signed-off-by: Zhou Jie --- v2

Re: [Qemu-devel] [PATCH v3] vfio : add aer process

2016-08-14 Thread Zhou Jie
ping On 2016/8/2 11:57, Zhou Jie wrote: During aer err occurs and resume do following to protect device from being accessed. 1. Make config space read only. 2. Disable INTx/MSI Interrupt. 3. Do nothing for bar regions. Signed-off-by: Zhou Jie --- v2-v3: 1. Call init_completion() in

[Qemu-devel] [PATCH v3] vfio : add aer process

2016-08-01 Thread Zhou Jie
During aer err occurs and resume do following to protect device from being accessed. 1. Make config space read only. 2. Disable INTx/MSI Interrupt. 3. Do nothing for bar regions. Signed-off-by: Zhou Jie --- v2-v3: 1. Call init_completion() in vfio_pci_probe. 2. Call reinit_completion() in

Re: [Qemu-devel] [PATCH v2 2/2] vfio : add aer process

2016-08-01 Thread Zhou Jie
Hi, Alex Clearly this has only been tested for a single instance of an AER error event and resume per device. Are the things you're intending to block actually blocked for subsequent events? Note how complete_all() fills the done field to let all current and future waiters go through and nowhe

Re: [Qemu-devel] [PATCH v2 2/2] vfio : add aer process

2016-07-31 Thread Zhou Jie
Hi, Alex On 2016/7/30 1:12, Alex Williamson wrote: On Tue, 19 Jul 2016 15:32:43 +0800 Zhou Jie wrote: From: Chen Fan During aer err occurs and resume do following to protect device from being accessed. 1. Make config space read only. 2. Disable INTx/MSI Interrupt. 3. Do nothing for bar

Re: [Qemu-devel] [PATCH v2 1/2] vfio : resume notifier

2016-07-31 Thread Zhou Jie
Hi, Alex On 2016/7/30 1:11, Alex Williamson wrote: On Tue, 19 Jul 2016 15:52:45 +0800 Zhou Jie wrote: From: Chen Fan An empty commit log is unacceptable for all but the most trivial patches. There's also no sign-off on this patch. Sorry. I should note it. I also don't know w

Re: [Qemu-devel] [PATCH v2 0/2] vfio: add aer process

2016-07-25 Thread Zhou Jie
ping On 2016/7/19 16:13, Zhou Jie wrote: From: Chen Fan v1-v2: 1. Add aer process to vfio driver. Chen Fan (2): vfio : add aer process vfio : resume notifier drivers/vfio/pci/vfio_pci.c | 58 - drivers/vfio/pci/vfio_pci_intrs.c | 18

[Qemu-devel] [PATCH v2 0/2] vfio: add aer process

2016-07-19 Thread Zhou Jie
From: Chen Fan v1-v2: 1. Add aer process to vfio driver. Chen Fan (2): vfio : add aer process vfio : resume notifier drivers/vfio/pci/vfio_pci.c | 58 - drivers/vfio/pci/vfio_pci_intrs.c | 18 drivers/vfio/pci/vfio_pci_private.h

[Qemu-devel] [PATCH v2 1/2] vfio : resume notifier

2016-07-19 Thread Zhou Jie
From: Chen Fan --- drivers/vfio/pci/vfio_pci.c | 28 +++- drivers/vfio/pci/vfio_pci_intrs.c | 18 ++ drivers/vfio/pci/vfio_pci_private.h | 1 + include/uapi/linux/vfio.h | 1 + 4 files changed, 47 insertions(+), 1 deletion(-) diff --

[Qemu-devel] [PATCH v9 10/11] vfio: Add waiting for host aer error progress

2016-07-19 Thread Zhou Jie
prevent it from further interacting with the VM. 4. Reset bus. Signed-off-by: Chen Fan Signed-off-by: Zhou Jie --- hw/vfio/pci.c | 51 +- hw/vfio/pci.h | 1 + linux-headers/linux/vfio.h | 4 3 files changed, 55

[Qemu-devel] [PATCH v9 04/11] vfio: refine function vfio_pci_host_match

2016-07-19 Thread Zhou Jie
From: Chen Fan Signed-off-by: Chen Fan --- hw/vfio/pci.c | 21 + 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 11c895c..21fd801 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -2060,14 +2060,27 @@ static void vfio_pci_po

[Qemu-devel] [PATCH v9 09/11] vfio-pci: pass the aer error to guest

2016-07-19 Thread Zhou Jie
From: Chen Fan when the vfio device encounters an uncorrectable error in host, the vfio_pci driver will signal the eventfd registered by this vfio device, resulting in the qemu eventfd handler getting invoked. this patch is to pass the error to guest and let the guest driver recover from the err

[Qemu-devel] [PATCH v9 11/11] vfio: add 'aer' property to expose aercap

2016-07-19 Thread Zhou Jie
From: Chen Fan add 'aer' property to let user able to decide whether expose the aer capability. by default we should disable aer feature, because it needs configuration restrictions. Signed-off-by: Chen Fan --- hw/vfio/pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/vfio/pci.c b

[Qemu-devel] [PATCH v9 03/11] vfio: add aer support for vfio device

2016-07-19 Thread Zhou Jie
From: Chen Fan Calling pcie_aer_init to initilize aer related registers for vfio device, then reload physical related registers to expose device capability. Signed-off-by: Chen Fan --- hw/vfio/pci.c | 75 ++- hw/vfio/pci.h | 3 +++ 2 fil

[Qemu-devel] [PATCH v9 05/11] vfio: add check host bus reset is support or not

2016-07-19 Thread Zhou Jie
From: Chen Fan When assigning a vfio device with AER enabled, we must check whether the device supports a host bus reset (ie. hot reset) as this may be used by the guest OS in order to recover the device from an AER error. QEMU must therefore have the ability to perform a physical host bus reset

[Qemu-devel] [PATCH v9 08/11] vfio: vote the function 0 to do host bus reset when aer occurred

2016-07-19 Thread Zhou Jie
From: Chen Fan Due to all devices assigned to VM on the same way as host if enable aer, so we can easily do the hot reset by selecting the function #0 to do the hot reset. Signed-off-by: Chen Fan --- hw/vfio/pci.c | 14 ++ hw/vfio/pci.h | 1 + 2 files changed, 15 insertions(+) di

[Qemu-devel] [PATCH v9 07/11] vfio: add check aer functionality for hotplug device

2016-07-19 Thread Zhou Jie
From: Chen Fan when function 0 is hot-added, we can check the vfio device whether support hot bus reset. Signed-off-by: Chen Fan --- hw/vfio/pci.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 242c1e4..8bcb26b 100644 --- a/hw/vfio/pci.c

[Qemu-devel] [PATCH v9 00/11] vfio-pci: pass the aer error to guest

2016-07-19 Thread Zhou Jie
From: Chen Fan v8-v9: 1. Don't use resume notification. Host vfio driver will process aer. Poll the vfio_device_info to assure host reset completely. v7-v8: 1. Use bitmap to record error and resume notification. v6-v7: 1. Stall any access to the device until resume is signa

[Qemu-devel] [PATCH v9 02/11] vfio: squeeze out vfio_pci_do_hot_reset for support bus reset

2016-07-19 Thread Zhou Jie
From: Chen Fan Squeeze out vfio_pci_do_hot_reset to do host bus reset when AER recovery. Signed-off-by: Chen Fan --- hw/vfio/pci.c | 75 +++ 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c ind

[Qemu-devel] [PATCH v9 06/11] pci: add a pci_function_is_valid callback to check function if valid

2016-07-19 Thread Zhou Jie
From: Chen Fan PCI hotplug requires that function 0 is added last to close the slot. Since vfio supporting AER, we require that the VM bus contains the same set of devices as the host bus to support AER, we can perform an AER validation test whenever a function 0 in the VM is hot-added. Signed-

[Qemu-devel] [PATCH v9 01/11] vfio: extract vfio_get_hot_reset_info as a single function

2016-07-19 Thread Zhou Jie
From: Chen Fan The function is used to get affected devices by bus reset. So here extract it, and can used for aer soon. Signed-off-by: Chen Fan --- hw/vfio/pci.c | 66 +++ 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/h

[Qemu-devel] [PATCH v2 2/2] vfio : add aer process

2016-07-19 Thread Zhou Jie
From: Chen Fan During aer err occurs and resume do following to protect device from being accessed. 1. Make config space read only. 2. Disable INTx/MSI Interrupt. 3. Do nothing for bar regions. Signed-off-by: Zhou Jie --- drivers/vfio/pci/vfio_pci.c | 30

[Qemu-devel] [PATCH v2 1/2] vfio : resume notifier

2016-07-19 Thread Zhou Jie
From: root --- drivers/vfio/pci/vfio_pci.c | 28 +++- drivers/vfio/pci/vfio_pci_intrs.c | 18 ++ drivers/vfio/pci/vfio_pci_private.h | 1 + include/uapi/linux/vfio.h | 1 + 4 files changed, 47 insertions(+), 1 deletion(-) diff --git

[Qemu-devel] [PATCH v2 0/2] vfio: add aer process

2016-07-19 Thread Zhou Jie
From: Chen Fan v1-v2: 1. Add aer process to vfio driver. Chen Fan (1): vfio : add aer process root (1): vfio : resume notifier drivers/vfio/pci/vfio_pci.c | 58 - drivers/vfio/pci/vfio_pci_intrs.c | 18 drivers/vfio/pci/vfio_pc

Re: [Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-07-12 Thread Zhou Jie
e to true in "struct vfio_pci_device" 6. vfio_fops Add poll function I would still suggest that the name "workable_state" is quite vague. Something like aer_error_in_progress is much more specific. Thanks, OK, I will alter the name. Sincerely Zhou Jie

Re: [Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-07-12 Thread Zhou Jie
to false in "struct vfio_pci_device" teardown the interrupt 5. vfio_pci_aer_resume Set workable_state to true in "struct vfio_pci_device" 6. vfio_fops Add poll function Sincerely Zhou Jie

Re: [Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-07-11 Thread Zhou Jie
_slot_reset, .resume = ixgbevf_io_resume, }; User tear-down the interrupts in ixgbevf_io_error_detected function. And up the interrupts in ixgbevf_io_resume. Guest OS driver will do both tear-down the interrupts and re-establish them. Because it don't know what host vfio driver has done. I disable the interrupts to pretend them interfere with device reset. Sincerely Zhou Jie

Re: [Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-07-09 Thread Zhou Jie
Hi Alex, The variable clearly isn't visible to the user, so the user can know whether the kernel supports this feature, but not whether the feature is currently active. Perhaps there's no way to avoid races completely, but don't you expect that if we define that certain operations are blocked a

Re: [Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-07-07 Thread Zhou Jie
he guest will do. What I want to do in vfio driver is as following. 1. aer occurs 2. Disable INTx and MSI 3. aer driver reset the device 4. Restore INTx and MSI 5. user process the aer event Sincerely Zhou Jie

Re: [Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-07-05 Thread Zhou Jie
user 5. user process the aer event Maybe reset the device and reinitialization What I do is make sure the following points. 1. Host can reset the device between step 2 and 4. 2. The user settings is the same at step 1 and 5. Sincerely Zhou Jie

Re: [Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-07-04 Thread Zhou Jie
ping On 2016/7/3 12:00, Zhou Jie wrote: Hi Alex, On 2016/6/30 9:45, Zhou Jie wrote: Hi Alex, On 2016/6/30 2:22, Alex Williamson wrote: On Wed, 29 Jun 2016 16:54:05 +0800 Zhou Jie wrote: Hi Alex, And yet we have struct pci_dev.broken_intx_masking and we test for working DisINTx via

Re: [Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-07-02 Thread Zhou Jie
Hi Alex, On 2016/6/30 9:45, Zhou Jie wrote: Hi Alex, On 2016/6/30 2:22, Alex Williamson wrote: On Wed, 29 Jun 2016 16:54:05 +0800 Zhou Jie wrote: Hi Alex, And yet we have struct pci_dev.broken_intx_masking and we test for working DisINTx via pci_intx_mask_supported() rather than simply

Re: [Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-06-29 Thread Zhou Jie
Hi Alex, On 2016/6/30 2:22, Alex Williamson wrote: On Wed, 29 Jun 2016 16:54:05 +0800 Zhou Jie wrote: Hi Alex, And yet we have struct pci_dev.broken_intx_masking and we test for working DisINTx via pci_intx_mask_supported() rather than simply looking for a PCIe device. Some devices are

Re: [Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-06-29 Thread Zhou Jie
cause write configure space maybe happened in interrupt handler. I think block is not a good choice. Sincerely Zhou Jie

Re: [Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-06-27 Thread Zhou Jie
Hi Alex, On 2016/6/28 11:58, Alex Williamson wrote: On Tue, 28 Jun 2016 11:26:33 +0800 Zhou Jie wrote: Hi Alex, The INTx/MSI part needs further definition for the user. Are we actually completely tearing down interrupts with the expectation that the user will re-enable them or are we just

Re: [Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-06-27 Thread Zhou Jie
ms like a reasonable approach, but I can't guarantee we won't find new issues along the way. For instance we'll need to test how -EAGAIN returns interact with existing QEMU and maybe decided whether there are cases that are better handled by doing an interruptible wait. Thanks, I will dig into it. Sincerely Zhou Jie

Re: [Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-06-24 Thread Zhou Jie
Hi Alex, We should never depend on the guest driver to behave in a certain way, but we need to prioritize what that actually means. vfio in the kernel has a responsibility first and foremost to the host kernel. User owned devices cannot be allowed to exploit or interfere with the host regardle

Re: [Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-06-22 Thread Zhou Jie
Hi Alex, On 2016/6/22 13:45, Zhou Jie wrote: Hi Alex, In vfio I have some questions. 1. How can I disable the access by mmap? We can disable all access to vfio fd by returning a EAGAIN error if user try to access it during the reset period until the host reset finished. But

Re: [Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-06-21 Thread Zhou Jie
Hi Alex, In vfio I have some questions. 1. How can I disable the access by mmap? We can disable all access to vfio fd by returning a EAGAIN error if user try to access it during the reset period until the host reset finished. But about the bar region which is maped by vfio_pci_m

Re: [Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-06-21 Thread Zhou Jie
Hi Alex, Hi Alex, on kernel side, I think if we don't trust the user behaviors, we should disable the access of vfio-pci interface once vfio-pci driver got the error_detected, we should disable all access to vfio fd regardless whether the vfio-pci was assigned to a VM, we also can re

Re: [Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-06-20 Thread Zhou Jie
only make sure the disabled device will not interact with the VM. Sincerely Zhou jie Alex . -- 周潔 Dept 1 No. 6 Wenzhu Road, Nanjing, 210012, China TEL:+86+25-86630566-8557 FUJITSU INTERNAL:7998-8557 E-Mail:zhoujie2...@cn.fujitsu.com

Re: [Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-06-20 Thread Zhou Jie
ping On 2016/6/12 10:38, Zhou Jie wrote: Hi, Alex It seems like we have a number of questions open in the thread with MST from the previous version, particularly whether we should actually drop the resume notifier and block the reset in the kernel. The concern being that it's not very

Re: [Qemu-devel] [RFC PATCH 0/3] x86: Add support for guest DMA dirty page tracking

2016-06-11 Thread Zhou Jie
Hi, Alex On 2016/6/9 23:39, Alexander Duyck wrote: On Thu, Jun 9, 2016 at 3:14 AM, Zhou Jie wrote: TO Alex TO Michael In your solution you add a emulate PCI bridge to act as a bridge between direct assigned devices and the host bridge. Do you mean put all direct assigned devices to

Re: [Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-06-11 Thread Zhou Jie
ing resume notification? Sincerely Zhou Jie

Re: [Qemu-devel] [RFC PATCH 0/3] x86: Add support for guest DMA dirty page tracking

2016-06-09 Thread Zhou Jie
devices unaffected by the bus reset, be configured on the same virtual bus. http://lists.nongnu.org/archive/html/qemu-devel/2016-05/msg02989.html Sincerely, Zhou Jie On 2016/6/7 0:04, Alex Duyck wrote: On Mon, Jun 6, 2016 at 2:18 AM, Zhou Jie wrote: Hi Alex, On 2016/1/6 0:18, Alexander

Re: [Qemu-devel] [RFC PATCH 0/3] x86: Add support for guest DMA dirty page tracking

2016-06-06 Thread Zhou Jie
ion? Sincerely, Zhou Jie So 1.- host tells guest to start tracking memory writes 2.- guest acks 3.- migration starts 4.- most memory is migrated 5.- host tells guest to eject device 6.- guest acks 7.- stop vm and migrate rest of state Sounds about right. The only way this differs from wh

[Qemu-devel] [PATCH v8 11/12] vfio: register aer resume notification handler for aer resume

2016-05-26 Thread Zhou Jie
ether and unplug of the device to prevent it from further interacting with the VM. 5. After get the resume notification reset bus. Signed-off-by: Chen Fan Signed-off-by: Zhou Jie --- v7->v8 *Add a comment for why VFIO_RESET_TIMEOUT value is 1000. *change vfio_resume_cap to pci_aer_ha

Re: [Qemu-devel] [PATCH 11/12] vfio: register aer resume notification handler for aer resume

2016-05-25 Thread Zhou Jie
{ >> /* We failed */ >> } else { >> /* Proceed with reset */ >> } >> >> Does QEMU have enough concurrency to do this? Thanks,On 2016/5/25 In my test, it can not work. vfio_aer_resume_notifier_handler is invoked after vfio_pci_reset. It is useless to wait in vfio_p

Re: [Qemu-devel] [PATCH 11/12] vfio: register aer resume notification handler for aer resume

2016-05-24 Thread Zhou Jie
g any access to the vga device region. 3. vfio_pci_read_config and vfio_pci_write_config For stalling any access to the device config space. What will happen if I don't stall any access to the device? Sincerely, Zhou Jie

Re: [Qemu-devel] [patch v6 11/12] vfio: register aer resume notification handler for aer resume

2016-05-24 Thread Zhou Jie
So I needn't disable access to the device between being notified that the error occurred and being notified to resume. This will make code simpler. Am I right? On 2016/5/24 18:49, Michael S. Tsirkin wrote: On Tue, Apr 26, 2016 at 08:48:15AM -0600, Alex Williamson wrote: I think that means tha

Re: [Qemu-devel] [PATCH 11/12] vfio: register aer resume notification handler for aer resume

2016-05-18 Thread Zhou Jie
On 2016/5/19 10:18, Alex Williamson wrote: On Thu, 19 May 2016 09:49:00 +0800 Zhou Jie wrote: On 2016/5/19 2:26, Alex Williamson wrote: On Wed, 18 May 2016 11:31:09 +0800 Zhou Jie wrote: From: Chen Fan For supporting aer recovery, host and guest would run the same aer recovery code

Re: [Qemu-devel] [PATCH 11/12] vfio: register aer resume notification handler for aer resume

2016-05-18 Thread Zhou Jie
On 2016/5/19 10:18, Alex Williamson wrote: On Thu, 19 May 2016 09:49:00 +0800 Zhou Jie wrote: On 2016/5/19 2:26, Alex Williamson wrote: On Wed, 18 May 2016 11:31:09 +0800 Zhou Jie wrote: From: Chen Fan For supporting aer recovery, host and guest would run the same aer recovery code

Re: [Qemu-devel] [PATCH 11/12] vfio: register aer resume notification handler for aer resume

2016-05-18 Thread Zhou Jie
On 2016/5/19 2:26, Alex Williamson wrote: On Wed, 18 May 2016 11:31:09 +0800 Zhou Jie wrote: From: Chen Fan For supporting aer recovery, host and guest would run the same aer recovery code, that would do the secondary bus reset if the error is fatal, the aer recovery process: 1

[Qemu-devel] [PATCH 10/12] vfio-pci: pass the aer error to guest

2016-05-17 Thread Zhou Jie
From: Chen Fan when the vfio device encounters an uncorrectable error in host, the vfio_pci driver will signal the eventfd registered by this vfio device, resulting in the qemu eventfd handler getting invoked. this patch is to pass the error to guest and let the guest driver recover from the err

[Qemu-devel] [PATCH 09/12] vfio: vote the function 0 to do host bus reset when aer occurred

2016-05-17 Thread Zhou Jie
From: Chen Fan Due to all devices assigned to VM on the same way as host if enable aer, so we can easily do the hot reset by selecting the function #0 to do the hot reset. Signed-off-by: Chen Fan --- hw/vfio/pci.c | 14 ++ hw/vfio/pci.h | 1 + 2 files changed, 15 insertions(+) di

[Qemu-devel] [PATCH 04/12] vfio: add aer support for vfio device

2016-05-17 Thread Zhou Jie
From: Chen Fan Calling pcie_aer_init to initilize aer related registers for vfio device, then reload physical related registers to expose device capability. Signed-off-by: Chen Fan --- hw/vfio/pci.c | 83 +-- hw/vfio/pci.h | 3 +++ 2 fil

[Qemu-devel] [PATCH 12/12] vfio: add 'aer' property to expose aercap

2016-05-17 Thread Zhou Jie
From: Chen Fan add 'aer' property to let user able to decide whether expose the aer capability. by default we should disable aer feature, because it needs configuration restrictions. Signed-off-by: Chen Fan --- hw/vfio/pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/vfio/pci.c b

[Qemu-devel] [PATCH 05/12] vfio: refine function vfio_pci_host_match

2016-05-17 Thread Zhou Jie
From: Chen Fan Signed-off-by: Chen Fan --- hw/vfio/pci.c | 21 + 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 0516d94..5b23a86 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -2060,14 +2060,27 @@ static void vfio_pci_po

[Qemu-devel] [PATCH 02/12] vfio: squeeze out vfio_pci_do_hot_reset for support bus reset

2016-05-17 Thread Zhou Jie
From: Chen Fan Squeeze out vfio_pci_do_hot_reset to do host bus reset when AER recovery. Signed-off-by: Chen Fan --- hw/vfio/pci.c | 75 +++ 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c ind

[Qemu-devel] [PATCH 03/12] vfio: add pcie extended capability support

2016-05-17 Thread Zhou Jie
From: Chen Fan For vfio pcie device, we could expose the extended capability on PCIE bus. due to add a new pcie capability at the tail of the chain, in order to avoid config space overwritten, we introduce a copy config for parsing extended caps. and rebuild the pcie extended config space. Signe

[Qemu-devel] [PATCH 06/12] vfio: add check host bus reset is support or not

2016-05-17 Thread Zhou Jie
From: Chen Fan When assigning a vfio device with AER enabled, we must check whether the device supports a host bus reset (ie. hot reset) as this may be used by the guest OS in order to recover the device from an AER error. QEMU must therefore have the ability to perform a physical host bus reset

[Qemu-devel] [PATCH 11/12] vfio: register aer resume notification handler for aer resume

2016-05-17 Thread Zhou Jie
some timeout, we would abort the guest directed bus reset altogether and unplug of the device to prevent it from further interacting with the VM. 6. After get the resume notification reset bus. Signed-off-by: Chen Fan Signed-off-by: Zhou Jie --- hw/vfio/pci.c

[Qemu-devel] [PATCH 01/12] vfio: extract vfio_get_hot_reset_info as a single function

2016-05-17 Thread Zhou Jie
From: Chen Fan The function is used to get affected devices by bus reset. So here extract it, and can used for aer soon. Signed-off-by: Chen Fan --- hw/vfio/pci.c | 66 +++ 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/h

[Qemu-devel] [PATCH 08/12] vfio: add check aer functionality for hotplug device

2016-05-17 Thread Zhou Jie
From: Chen Fan when function 0 is hot-added, we can check the vfio device whether support hot bus reset. Signed-off-by: Chen Fan --- hw/vfio/pci.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 832f25e..109b11b 100644 --- a/hw/vfio/pci.c

[Qemu-devel] [PATCH v7 00/12] vfio-pci: pass the aer error to guest

2016-05-17 Thread Zhou Jie
From: Chen Fan v6-v7: 1. Stall any access to the device until resume is signaled. Do guest directed bus reset after receive resume notification. If don't get the resume notification after some timeout unplug the device. 2. fix the patches 11/12 as Alex sugguestion. v5-v6: 1.

[Qemu-devel] [PATCH 07/12] pci: add a pci_function_is_valid callback to check function if valid

2016-05-17 Thread Zhou Jie
From: Chen Fan PCI hotplug requires that function 0 is added last to close the slot. Since vfio supporting AER, we require that the VM bus contains the same set of devices as the host bus to support AER, we can perform an AER validation test whenever a function 0 in the VM is hot-added. Signed-

Re: [Qemu-devel] [patch v6 11/12] vfio: register aer resume notification handler for aer resume

2016-05-10 Thread Zhou Jie
second bus reset. Because the host did bus reset already. But as you said we shouldn't necessarily design the API that strictly around the current behavior of the Linux AER handler. Sincerely, Zhou Jie On 2016/5/7 0:39, Alex Williamson wrote: On Fri, 6 May 2016 09:38:41 +0800

[Qemu-devel] [PATCH v4] block: always compile-check debug prints

2016-04-28 Thread Zhou Jie
Files with conditional debug statements should ensure that the printf is always compiled. This prevents bitrot of the format string of the debug statement. And switch debug output to stderr. Signed-off-by: Zhou Jie Reviewed-by: Eric Blake --- v3 -> v4: * Alter commit message to add "An

[Qemu-devel] [PATCH v3] block: always compile-check debug prints

2016-04-28 Thread Zhou Jie
Files with conditional debug statements should ensure that the printf is always compiled. This prevents bitrot of the format string of the debug statement. Signed-off-by: Zhou Jie Reviewed-by: Eric Blake --- v1 -> v2: * Keep the user-visible witness as defined/undefined, and creat

[Qemu-devel] [PATCH v2] block: always compile-check debug prints

2016-04-28 Thread Zhou Jie
Files with conditional debug statements should ensure that the printf is always compiled. This prevents bitrot of the format string of the debug statement. Signed-off-by: Zhou Jie --- block/curl.c | 10 -- block/sheepdog.c | 13 - 2 files changed, 16 insertions(+), 7

[Qemu-devel] [PATCH] block: always compile-check debug prints

2016-04-28 Thread Zhou Jie
Files with conditional debug statements should ensure that the printf is always compiled. This prevents bitrot of the format string of the debug statement. Signed-off-by: Zhou Jie --- block/curl.c | 13 +++-- block/sheepdog.c | 13 ++--- 2 files changed, 13 insertions(+), 13

Re: [Qemu-devel] [PATCH v2] hw/net/opencores_eth: Allocating Large sized arrays to heap

2016-04-26 Thread Zhou Jie
On 2016/4/27 10:46, Max Filippov wrote: Hi Zhou, On Wed, Apr 27, 2016 at 10:18:56AM +0800, Zhou Jie wrote: When I committed another patch which named as "hw/net/virtio-net: Allocating Large sized arrays to heap" . Christian Borntraeger said that 16k is usually perf

Re: [Qemu-devel] [PATCH v2] hw/net/opencores_eth: Allocating Large sized arrays to heap

2016-04-26 Thread Zhou Jie
Although the size is 65536 bytes here, I think open_eth_start_xmit is in a hot path. So, it is OK, if you think that this patch should not be applied. Sincerely, Zhou Jie On 2016/4/27 10:07, Zhou Jie wrote: open_eth_start_xmit has a huge stack usage of 65536 bytes approx. Moving large

[Qemu-devel] [PATCH v2] hw/net/opencores_eth: Allocating Large sized arrays to heap

2016-04-26 Thread Zhou Jie
open_eth_start_xmit has a huge stack usage of 65536 bytes approx. Moving large arrays to heap to reduce stack usage. Signed-off-by: Zhou Jie --- hw/net/opencores_eth.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/net/opencores_eth.c b/hw/net/opencores_eth.c

Re: [Qemu-devel] [PATCH] hw/net/opencores_eth: Allocating Large sized arrays to heap

2016-04-26 Thread Zhou Jie
On 2016/4/26 12:12, Max Filippov wrote: Hi Zhou, On Tue, Apr 26, 2016 at 6:35 AM, Zhou Jie wrote: open_eth_start_xmit has a huge stack usage of 65536 bytes approx. Moving large arrays to heap to reduce stack usage. It's an exception, not the rule when full 65536 byte long buffer mig

Re: [Qemu-devel] [PATCH] hw/net/virtio-net: Allocating Large sized arrays to heap

2016-04-26 Thread Zhou Jie
On 2016/4/26 20:42, Michael S. Tsirkin wrote: On Tue, Apr 26, 2016 at 04:05:24PM +0800, Zhou Jie wrote: virtio_net_flush_tx has a huge stack usage of 16392 bytes approx. Moving large arrays to heap to reduce stack usage. Signed-off-by: Zhou Jie I don't think it's appropriate f

Re: [Qemu-devel] [PATCH] hw/net/virtio-net: Allocating Large sized arrays to heap

2016-04-26 Thread Zhou Jie
On 2016/4/26 16:49, Christian Borntraeger wrote: On 04/26/2016 10:05 AM, Zhou Jie wrote: virtio_net_flush_tx has a huge stack usage of 16392 bytes approx. Moving large arrays to heap to reduce stack usage. Signed-off-by: Zhou Jie --- hw/net/virtio-net.c | 15 +++ 1 file changed

Re: [Qemu-devel] [PATCH] net/tap: Allocating Large sized arrays to heap

2016-04-26 Thread Zhou Jie
On 2016/4/26 15:45, Christian Borntraeger wrote: On 04/26/2016 03:26 AM, Zhou Jie wrote: net_init_tap has a huge stack usage of 8192 bytes approx. Moving large arrays to heap to reduce stack usage. I am wondering. Why is 8k a problem for a user space program? For 64bit machine it will be 16k

[Qemu-devel] [PATCH] hw/net/virtio-net: Allocating Large sized arrays to heap

2016-04-26 Thread Zhou Jie
virtio_net_flush_tx has a huge stack usage of 16392 bytes approx. Moving large arrays to heap to reduce stack usage. Signed-off-by: Zhou Jie --- hw/net/virtio-net.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c

[Qemu-devel] [PATCH] hw/arm/nseries: Allocating Large sized arrays to heap

2016-04-25 Thread Zhou Jie
n8x0_init has a huge stack usage of 65536 bytes approx. Moving large arrays to heap to reduce stack usage. Signed-off-by: Zhou Jie --- hw/arm/nseries.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c index 5382505..c7068c0 100644 --- a

[Qemu-devel] [PATCH] hw/net/opencores_eth: Allocating Large sized arrays to heap

2016-04-25 Thread Zhou Jie
open_eth_start_xmit has a huge stack usage of 65536 bytes approx. Moving large arrays to heap to reduce stack usage. Signed-off-by: Zhou Jie --- hw/net/opencores_eth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/net/opencores_eth.c b/hw/net/opencores_eth.c index

[Qemu-devel] [PATCH] net/tap: Allocating Large sized arrays to heap

2016-04-25 Thread Zhou Jie
net_init_tap has a huge stack usage of 8192 bytes approx. Moving large arrays to heap to reduce stack usage. Signed-off-by: Zhou Jie --- net/tap.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/tap.c b/net/tap.c index 740e8a2..49817c7 100644 --- a/net/tap.c +++ b

[Qemu-devel] [PATCH] Added negative check for get_image_size()

2016-04-24 Thread Zhou Jie
This patch adds check for negative return value from get_image_size(), where it is missing. It avoids unnecessary two function calls. Signed-off-by: Zhou Jie --- hw/ppc/spapr.c | 4 1 file changed, 4 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index feaab08..ccea633 100644