qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Klaus Jensen <its@irrelevant.dk>
Cc: mst@redhat.com, Markus Armbruster <armbru@redhat.com>,
	qemu-block@nongnu.org, qemu-devel@nongnu.org
Subject: Re: making a qdev bus available from a (non-qtree?) device
Date: Mon, 17 May 2021 10:56:30 +0100	[thread overview]
Message-ID: <YKI9zh2AqX35S8wd@stefanha-x1.localdomain> (raw)
In-Reply-To: <YKITdgeMFo6hfzB/@apples.localdomain>

[-- Attachment #1: Type: text/plain, Size: 3589 bytes --]

On Mon, May 17, 2021 at 08:55:50AM +0200, Klaus Jensen wrote:
> On May 13 15:02, Stefan Hajnoczi wrote:
> > On Wed, May 12, 2021 at 02:02:50PM +0200, Markus Armbruster wrote:
> > > Klaus Jensen <its@irrelevant.dk> writes:
> > > > I can then call `qdev_set_parent_bus()` and set the parent bus to the
> > > > bus creates in the nvme-subsys device. This solves the problem since
> > > > the namespaces are not "garbage collected" when the nvme device is
> > > > removed, but it just feels wrong you know? Also, if possible, I'd of
> > > > course really like to retain the nice entries in `info qtree`.
> > > 
> > > I'm afraid I'm too ignorant on NVME to give useful advice.
> > > 
> > > Can you give us a brief primer on the aspects of physical NVME devices
> > > you'd like to model in QEMU?  What are "controllers", "namespaces", and
> > > "subsystems", and how do they work together?
> > > 
> > > Once we understand the relevant aspects of physical devices, we can
> > > discuss how to best model them in QEMU.
> > 
> > One specific question about the nature of devices vs subsystems vs
> > namespaces:
> > 
> > Does the device expose all the namespaces from one subsystem, or does it
> > need to be able to filter them (e.g. hide certain namespaces or present
> > a mix of namespaces from multiple subsystems)?
> > 
> 
> Subsystems are fully isolated. There are no interaction possible between
> different subsystems. Within a subsystem, all the "resources" (controllers
> and namespaces) are potentially "shared". That is, there may exists
> many-to-many relationships. A controller may have multiple namespaces
> attached and namespaces may be attached to multiple controllers.
> 
> > The status of the namespace as a DeviceState is a bit questionable since
> > the only possible parent it could have is a device, but multiple devices
> > want to use it. I understand why you're considering whether it should be
> > an --object...
> > 
> 
> When you say parent, I think you mean parent in terms of bus-device
> relationship? In that case, then the parent can actually be the subsystem,
> since if the namespace is not attached to any controllers, then it is just
> an entity/object in the subsystem that the controllers (the actual devices)
> may attach to[1].
> 
> Yes, the more I think about this and understand qdev I realize that it was a
> mistake to define nvme-ns to be a TYPE_DEVICE, since it does not act as a
> piece of virtual hardware. It is just an entity (object). The biggest
> mistake right now seems to be the bus_type use. It just worked wonderfully
> in the absence of subsystem support, but I feel that that choice is coming
> back to haunt me now. If we'd used a 'ctrl' link property we could just add
> a 'subsys' link property now and be happy.
> 
> Is there any way that we can "overload" the implicit "bus=" parameter to
> provide backwards compatibility (while basically changing it to function
> like a "link" parameter)?

I would consider adding new --object types and deprecating the devices
so they can be dropped in a future QEMU release. It may be necessary to
choose new names to avoid collisions with the existing ones.

Backwards compatibility might be tricky. One way might be to extract
most of the code from --device nvme-ns and move it into the new
--object, but leave the device to instantiate an object behind the
scenes? Then the device can still have its bus and translate that
relationship to --object somehow. I'm not sure, it depends on the
details of the code.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2021-05-17 10:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11 18:17 making a qdev bus available from a (non-qtree?) device Klaus Jensen
2021-05-12  3:39 ` Philippe Mathieu-Daudé
2021-05-12  8:00   ` Peter Maydell
2021-05-12 12:02 ` Markus Armbruster
2021-05-13 14:02   ` Stefan Hajnoczi
2021-05-17  6:55     ` Klaus Jensen
2021-05-17  9:56       ` Stefan Hajnoczi [this message]
2021-05-17  6:44   ` Klaus Jensen
2021-05-21  7:33     ` Markus Armbruster
2021-05-21  8:48       ` Klaus Jensen

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=YKI9zh2AqX35S8wd@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=armbru@redhat.com \
    --cc=its@irrelevant.dk \
    --cc=mst@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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).