From: Hannes Reinecke <hare@suse.de>
To: Klaus Jensen <its@irrelevant.dk>, Max Reitz <mreitz@redhat.com>
Cc: Bug 1925496 <1925496@bugs.launchpad.net>,
kwolf@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Bug 1925496] Re: nvme disk cannot be hotplugged after removal
Date: Tue, 11 May 2021 09:37:27 +0200 [thread overview]
Message-ID: <495074fe-0502-4a0a-30fc-3a8472fed35e@suse.de> (raw)
In-Reply-To: <YI+l2X3jtvaZC6wv@apples.localdomain>
On 5/3/21 9:27 AM, Klaus Jensen wrote:
> On Apr 28 15:00, Max Reitz wrote:
>> On 28.04.21 12:12, Klaus Jensen wrote:
>>> On Apr 28 09:31, Oguz Bektas wrote:
>>>>> My understanding is that this is the expected behavior. The reason is
>>>>> that the drive cannot be deleted immediately when the device is
>>>>> hot-unplugged, since it might not be safe (other parts of QEMU could
>>>>> be using it, like background block jobs).
>>>>>
>>>>> On the other hand, the fact that if the drive is removed explicitly
>>>>> through QMP (or in the monitor with drive_del), the drive id is
>>>>> remains "in use". This might be a completely different bug that is
>>>>> unrelated to the nvme device.
>>>>
>>>> using the same commands I can hot-plug and hot-unplug a scsi disk like
>>>> this without issue - this behavior only appeared on nvme devices.
>>>>
>>>
>>> Kevin, Max, can you shed any light on this?
>>>
>>> Specifically what the expected behavior is wrt. to the drive when
>>> unplugging a device that has one attached?
>>>
>>> If the scsi disk is capable of "cleaning up" immediately, then I
>>> suppose that some steps are missing in the nvme unrealization.
>>
>
> Hi Max,
>
> Thanks for your help!
>
>> I’m not very strong when it comes to question for guest devices, but
>> looking into the QAPI documentation, it says that when DEVICE_DELETED
>> is emitted, it’s safe to reuse the device ID. Before then, it isn’t,
>> because the guest may yet need to release the device.
>>
>
> This is specifically related to releasing the "drive", not the device.
> Problem is that when the device is deleted (using device_del), the pci
> device goes away rapidly, but the drive (as shown in `info block`)
> lingers for a couple of seconds before going into the "unlocked" state.
> If the drive is then deleted (`drive_del`) everything is good, but if
> the drive is deleted within those couple of seconds, the drive_del
> completes successfully, but the drive id never becomes available again.
>
>> So the questions that come to my mind are:
>> - Do nvme guest devices have a release protocol with the guest, so
>> that it just may take some time for the guest to release the device?
>> I.e. that this would be perfectly normal and documented behavior?
>> (Perhaps this just isn’t the case for scsi, or the guest just releases
>> those devices much quicker)
>>
>
> The NVMe device is a PCIDevice, I wonder if that is what adds some delay
> on this?
>
>> - Did Oguz always wait for the DEVICE_DELETED event before reusing the
>> ID? Sounds like it would be a bug if reusing the ID after getting
>> that event failed.
>>
>
> From the bug report, it does not look like anything like that is done.
>
> I basically dont understand the deletion protocol here and why the drive
> is not released immediately. Even if I add a call to
> blockdev_mark_auto_del() there is a delay, but the drive does get
> automatically deleted.
FWIW, I've just sent a patch to re-enable NVMe namespace hotplug;
basically you can 'hot-delete' an nvme device via 'device_del <pcidev>',
but you cannot 'hot-add' an nvme device via 'device_add <pcidev>'.
Or, rather, you can, but then you end up with a NVME controller with no
namespaces which tends to be kinda pointless.
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions Germany GmbH, 90409 Nürnberg
GF: F. Imendörffer, HRB 36809 (AG Nürnberg)
next prev parent reply other threads:[~2021-05-11 7:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-22 12:34 [Bug 1925496] [NEW] nvme disk cannot be hotplugged after removal Oguz Bektas
2021-04-22 12:55 ` [Bug 1925496] " Klaus Jensen
2021-04-22 13:38 ` Oguz Bektas
2021-04-22 14:24 ` Klaus Jensen
2021-04-26 9:31 ` Oguz Bektas
2021-04-28 7:38 ` Klaus Jensen
2021-04-28 9:31 ` Oguz Bektas
2021-04-28 10:12 ` Klaus Jensen
2021-04-28 13:00 ` Max Reitz
2021-05-03 7:27 ` Klaus Jensen
2021-05-11 7:37 ` Hannes Reinecke [this message]
2021-05-18 4:32 ` Thomas Huth
2021-06-16 14:54 ` Thomas Huth
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=495074fe-0502-4a0a-30fc-3a8472fed35e@suse.de \
--to=hare@suse.de \
--cc=1925496@bugs.launchpad.net \
--cc=its@irrelevant.dk \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).