[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] pcie: fix device hotplug failure at the meantim
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [Qemu-devel] [PATCH] pcie: fix device hotplug failure at the meantime of VM boot |
Date: |
Tue, 23 Jul 2019 11:18:03 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 |
Hi Oscar,
On 7/23/19 9:47 AM, Zhangbo (Oscar) wrote:
> If the PCI_EXP_LNKSTA_DLLLA capability is set by default, linux kernel will
> send
> PDC event to detect whether there is a device in pcie slot. If a device is
> pluged
> in the pcie-root-port at the same time, hot-plug device will send ABP + PDC
> events to the kernel. The VM kernel will wrongly unplug the device if two PDC
> events get too close. Thus we'd better set the PCI_EXP_LNKSTA_DLLLA
> capability only in hotplug callback.
>
> By the way, we should clean up the PCI_EXP_LNKSTA_DLLLA capability during
> unplug to avoid VM restart or migration failure which will enter the same
> abnormal scenario as above.
>
> Signed-off-by: address@hidden
> Signed-off-by: address@hidden
QEMU contribution guideline says:
Please use your real name to sign a patch (not an alias or acronym).
See:
https://wiki.qemu.org/Contribute/SubmitAPatch#Patch_emails_must_include_a_Signed-off-by:_line
We can infer limingwang@ real name is Liming Wang, oscar.zhangbo@ is
Oscar Zhangbo, but for fangying1@ it is too hard.
Can you provide his real name?
Thanks,
Phil.
> Signed-off-by: address@hidden
> ---
> hw/pci/pcie.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
> index a6beb56..174f392 100644
> --- a/hw/pci/pcie.c
> +++ b/hw/pci/pcie.c
> @@ -75,10 +75,6 @@ pcie_cap_v1_fill(PCIDevice *dev, uint8_t port, uint8_t
> type, uint8_t version)
> QEMU_PCI_EXP_LNKSTA_NLW(QEMU_PCI_EXP_LNK_X1) |
> QEMU_PCI_EXP_LNKSTA_CLS(QEMU_PCI_EXP_LNK_2_5GT));
>
> - if (dev->cap_present & QEMU_PCIE_LNKSTA_DLLLA) {
> - pci_word_test_and_set_mask(exp_cap + PCI_EXP_LNKSTA,
> - PCI_EXP_LNKSTA_DLLLA);
> - }
>
> /* We changed link status bits over time, and changing them across
> * migrations is generally fine as hardware changes them too.
> @@ -484,6 +480,11 @@ void pcie_cap_slot_unplug_request_cb(HotplugHandler
> *hotplug_dev,
> return;
> }
>
> + if (pci_dev->cap_present & QEMU_PCIE_LNKSTA_DLLLA) {
> + pci_word_test_and_clear_mask(exp_cap + PCI_EXP_LNKSTA,
> + PCI_EXP_LNKSTA_DLLLA);
> + }
> +
> pcie_cap_slot_push_attention_button(PCI_DEVICE(hotplug_dev));
> }
>
>