All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
	Laszlo Ersek <lersek@redhat.com>, Alexander Graf <agraf@suse.de>,
	Marcel Apfelbaum <marcel@redhat.com>,
	Thomas Huth <thuth@redhat.com>,
	Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [RFC 13/19] unimplemented-device: Remove user_creatable flag
Date: Mon, 3 Apr 2017 17:05:50 -0300	[thread overview]
Message-ID: <20170403200550.GI1910@thinpad.lan.raisama.net> (raw)
In-Reply-To: <CAFEAcA9s6+WMEsMxK0Twac=TCfU-Wf4ouB1CNvJ9uDj++fGJVQ@mail.gmail.com>

On Mon, Apr 03, 2017 at 08:42:12PM +0100, Peter Maydell wrote:
> On 3 April 2017 at 19:30, Eduardo Habkost <ehabkost@redhat.com> wrote:
> > On Mon, Apr 03, 2017 at 03:08:06PM +0100, Peter Maydell wrote:
> >> On 3 April 2017 at 14:54, Eduardo Habkost <ehabkost@redhat.com> wrote:
> >> > This, on the other hand, currently works:
> >> >   $ qemu-system-x86_64 -M q35 -device unimplemented-device,size=1024,name=foo
> >>
> >> That's a bug in the q35 machine or the handling of -device
> >> on non-platform-bus systems, though, isn't it? The default
> >> for all sysbus devices has always been "you can't use
> >> -device with this", [...]
> >
> > This was true until 2014, only. commit
> > 33cd52b5d7b9adfd009e95f07e6c64dd88ae2a31 changed sys-bus-device
> > to have cannot_instantiate_with_device_add_yet=false. See patch
> > 03/19 for more detailed info.
> 
> That commit shouldn't cause this problem -- unless the
> machine sets has_dynamic_sysbus then the machine_init_notify()
> that commit adds will cause it to complain.
> 
> I think the bug was introduced much later, in bf8d4924 in 2016,
> when q35 had the has_dynamic_sysbus flag added but without
> any code to restruct this to a whitelist of working
> devices. (In fact you can see in that commit a very
> minimal attempt to blacklist a few devices.)

It's true that the problem happened when q35 set
has_dynamic_sysbus=1 without a whitelist. The point of this
series is to make a per-machine-type whitelist unnecessary.

> 
> The commit message says only intel-iommu was supposed to
> be -device creatable, so it should have been the only
> thing on the whitelist.

There was a thread about it (Subject: "q35 and sysbus devices"),
and nobody knew for sure if the q35 whitelist was supposed to
have *-iommu only, or not.

The conclusion of that thread is that we can simply use
cannot_instantiate_with_device_add_yet to build the whitelist, if
the field was set consistently. This series renames
cannot_instantiate_with_device_add_yet to user_creatable, and
sets it consistently.

> Commit 9e3f9733 shows how this
> should be done (that's where spapr got has_dynamic_sysbus).
> 
> Maybe we should just fix the q35 bug first?

This fixes the q35 bug by setting user_creatable correctly on
sys-bus-devices, and makes a q35-specific whitelist unnecessary.

> 
> >>               [...] there's never been a requirement to
> >> mark them as such separately (because it would require
> >> touching the files for a huge number of devices for no
> >> particularly good reason when you can default the whole
> >> set of devices subclassing SysBusDevice).
> >
> > Yes, and this is the whole point of this series. At the end of
> > this series, only the few devices that are actually usable with
> > some machine will have an explicit user_creatable=true
> > assignment. See cover letter for details.
> 
> ...OK, but in that case why not just set that where it should
> be set, rather than having a big long patchset that touches
> a lot of devices that in the end are right back where
> they started? I think a lot of why I'm confused by
> this patchset is that it seems like it's changing
> behaviour on devices like this one which don't need
> any changes...

The devices don't get back right where they started: they start
with cannot_instantiate_with_device_add_yet=false (meaning they
are user-creatable in q35), and end up with user_creatable=false
(meaning they become non-user-creatable in all machines).

I could squash patches 04/19 to 19/19 into patch 03/19, it's
true. But then I would probably not get confirmation from you
(and other developers) that unimplemented-device (and other
devices) is really not supposed to be user-creatable. I wouldn't
know if I am breaking a valid q35 use case, or not.

-- 
Eduardo

  reply	other threads:[~2017-04-03 20:06 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-01  0:46 [Qemu-devel] [RFC 00/19] sysbus: Don't allow -device/device_add by default Eduardo Habkost
2017-04-01  0:46 ` [Qemu-devel] [RFC 01/19] qdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable Eduardo Habkost
2017-04-03 17:16   ` Alistair Francis
2017-04-01  0:46 ` [Qemu-devel] [RFC 02/19] s390: Add FIXME for unexplained user_creatable=false line Eduardo Habkost
2017-04-03  8:55   ` Cornelia Huck
2017-04-03 19:20     ` Eduardo Habkost
2017-04-04  6:46       ` Cornelia Huck
2017-04-01  0:46 ` [Qemu-devel] [RFC 03/19] sysbus: Set user_creatable=false by default on TYPE_SYS_BUS_DEVICE Eduardo Habkost
2017-04-03 19:49   ` Peter Maydell
2017-04-03 20:10     ` Eduardo Habkost
2017-04-03 20:15       ` Alexander Graf
2017-04-03 21:00         ` Eduardo Habkost
2017-04-04  6:53           ` Alexander Graf
2017-04-04  6:58             ` Thomas Huth
2017-04-04  7:02               ` Alexander Graf
2017-04-04 12:59                 ` Eduardo Habkost
2017-04-04 13:06                   ` Alexander Graf
2017-04-04 14:44                     ` Eduardo Habkost
2017-04-04 13:05             ` Eduardo Habkost
2017-04-01  0:46 ` [Qemu-devel] [RFC 04/19] fdc: Remove user_creatable flag from sysbus-fdc & SUNW, fdtwo Eduardo Habkost
2017-04-01  0:46 ` [Qemu-devel] [RFC 05/19] pflash_cfi01: Remove user_creatable flag Eduardo Habkost
2017-04-03 12:43   ` Philippe Mathieu-Daudé
2017-04-03 15:45   ` Laszlo Ersek
2017-04-01  0:46 ` [Qemu-devel] [RFC 06/19] iommu: Remove FIXME comment about user_creatable=true Eduardo Habkost
2017-04-01  0:46 ` [Qemu-devel] [RFC 07/19] kvmclock: Remove user_creatable flag Eduardo Habkost
2017-04-01  0:46 ` [Qemu-devel] [RFC 08/19] ioapic: " Eduardo Habkost
2017-04-01  0:46 ` [Qemu-devel] [RFC 09/19] kvmvapic: " Eduardo Habkost
2017-04-01  0:46 ` [Qemu-devel] [RFC 10/19] sysbus-ahci: " Eduardo Habkost
2017-04-03 17:19   ` Alistair Francis
2017-04-01  0:46 ` [Qemu-devel] [RFC 11/19] allwinner-ahci: " Eduardo Habkost
2017-04-01  0:46 ` [Qemu-devel] [RFC 12/19] isabus-bridge: " Eduardo Habkost
2017-04-01  0:46 ` [Qemu-devel] [RFC 13/19] unimplemented-device: " Eduardo Habkost
2017-04-03 12:44   ` Philippe Mathieu-Daudé
2017-04-03 12:57   ` Peter Maydell
2017-04-03 13:34     ` Eduardo Habkost
2017-04-03 13:38       ` Peter Maydell
2017-04-03 13:54         ` Eduardo Habkost
2017-04-03 14:08           ` Peter Maydell
2017-04-03 18:30             ` Eduardo Habkost
2017-04-03 19:42               ` Peter Maydell
2017-04-03 20:05                 ` Eduardo Habkost [this message]
2017-04-04  7:05                   ` Thomas Huth
2017-04-04  7:12                     ` Alexander Graf
2017-04-04 13:12                       ` Eduardo Habkost
2017-04-01  0:46 ` [Qemu-devel] [RFC 14/19] fw_cfg: " Eduardo Habkost
2017-04-03 15:46   ` Laszlo Ersek
2017-04-01  0:46 ` [Qemu-devel] [RFC 15/19] esp: " Eduardo Habkost
2017-04-01  0:46 ` [Qemu-devel] [RFC 16/19] generic-sdhci: " Eduardo Habkost
2017-04-03 17:20   ` Alistair Francis
2017-04-01  0:46 ` [Qemu-devel] [RFC 17/19] hpet: " Eduardo Habkost
2017-04-01  0:46 ` [Qemu-devel] [RFC 18/19] sysbus-ohci: " Eduardo Habkost
2017-04-01  0:46 ` [Qemu-devel] [RFC 19/19] virtio-mmio: " Eduardo Habkost
2017-04-03 15:50   ` Laszlo Ersek
2017-04-04 19:35     ` Eduardo Habkost
2017-04-05  8:30       ` Laszlo Ersek

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=20170403200550.GI1910@thinpad.lan.raisama.net \
    --to=ehabkost@redhat.com \
    --cc=agraf@suse.de \
    --cc=armbru@redhat.com \
    --cc=lersek@redhat.com \
    --cc=marcel@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.