qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Halil Pasic <pasic@linux.vnet.ibm.com>
Cc: qemu-devel@nongnu.org, Marcel Apfelbaum <marcel@redhat.com>,
	Cornelia Huck <cohuck@redhat.com>, Greg Kurz <groug@kaod.org>
Subject: Re: [Qemu-devel] [PATCH 2/3] test-qdev-global-props: Test global property ordering
Date: Mon, 17 Jul 2017 14:38:52 -0300	[thread overview]
Message-ID: <20170717173852.GT6020@localhost.localdomain> (raw)
In-Reply-To: <93527f47-ad79-9c5b-d7ed-d33a089a024c@linux.vnet.ibm.com>

On Sun, Jul 16, 2017 at 02:35:49PM +0200, Halil Pasic wrote:
> On 07/12/2017 08:48 PM, Eduardo Habkost wrote:
> > On Wed, Jul 12, 2017 at 08:06:14PM +0200, Halil Pasic wrote:
> >>
> >>
> >> On 07/11/2017 02:43 AM, Eduardo Habkost wrote:
> >>> Test case to detect the bug fixed by commit
> >>> "qdev: fix the order compat and global properties are applied".
> >>>
> >>> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> >>
> >> Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>
> >>
> >> Please see below nevertheless.
> >>
> >>> ---
> >>>  tests/test-qdev-global-props.c | 33 +++++++++++++++++++++++++++++++++
> >>>  1 file changed, 33 insertions(+)
> >>>
> >>> diff --git a/tests/test-qdev-global-props.c b/tests/test-qdev-global-props.c
> >>> index 48e5b73..ef2951f 100644
> >>> --- a/tests/test-qdev-global-props.c
> >>> +++ b/tests/test-qdev-global-props.c
> >>> @@ -33,6 +33,8 @@
> >>>  #define STATIC_TYPE(obj) \
> >>>      OBJECT_CHECK(MyType, (obj), TYPE_STATIC_PROPS)
> >>>
> >>> +#define TYPE_SUBCLASS "static_prop_subtype"
> >>> +
> >>>  #define PROP_DEFAULT 100
> >>>
> >>>  typedef struct MyType {
> >>> @@ -63,6 +65,11 @@ static const TypeInfo static_prop_type = {
> >>>      .class_init = static_prop_class_init,
> >>>  };
> >>>
> >>> +static const TypeInfo subclass_type = {
> >>> +    .name = TYPE_SUBCLASS,
> >>> +    .parent = TYPE_STATIC_PROPS,
> >>> +};
> >>> +
> >>>  /* Test simple static property setting to default value */
> >>>  static void test_static_prop_subprocess(void)
> >>>  {
> >>> @@ -279,12 +286,35 @@ static void test_dynamic_globalprop_nouser(void)
> >>>      g_test_trap_assert_stdout("");
> >>>  }
> >>>
> >>> +/* Test if global props affecting subclasses are applied in the right order */
> >>
> >> Now that I think about it this is affecting an  external and
> >> (end-)user facing interface. You say this is the right order.
> >> Based on what is this the right order? Do we need to update some
> >> documentation too?
> > 
> > -global documentation is already very poor, as you have noticed:
> > 
> >>
> >> I've checked out the user manual. There we talk about 'driver' but
> >> I could not find a spot where 'driver' is explained.
> > 
> > Yes.  For that reason, it looks like there's nothing to be
> > updated on the existing (poor) documentation.  I will re-read it
> > to be sure.
> > 
> 
> I don't agree. IMHO poor is reason enough to update.

I agree we should update it.  I just meant I don't see any
existing documentation that will become incorrect/outdated when
we apply this patch.

> 
> >>
> >> If I would have to translate between user manual terminology and
> >> code terminology, I would say a driver is a not abstract class
> >> inheriting from device. If that's right I wonder if it should
> >> be allowed for a non-abstract class inheriting from device to
> >> inherit form another non-abstract class.
> > 
> > We could, but this wouldn't save us from having to decide what to
> > do if people are already using those non-abstract superclasses
> > with -global.  e.g.: "-global spapr-pci-host-bridge.FOO=BAR"
> > (spapr-pci-host-bridge is the parent of spapr-pci-vfio-host-bridge).
> > 
> > This means a new rule like this would necessarily break
> > command-line compatibility.  Probably not a blocker in the
> > spapr-pci-host-bridge case, but to me it looks like the rule
> > would cause more problems than it would solve.
> 
> We are already breaking the command line compatibility with this
> series aren't we?
> 
> You may be right about the cause more problems than it solves though.
> I may end up thinking some more about this (or forgetting about it).

Yeah.  Breaking compatibility is not a blocker, but one
additional obstacle for changing the rules.

> > 
> >>
> >> Another question is -global with an abstract class seems to be
> >> accepted on the command line. Is that an undocumented feature?
> > 
> > Considering that we never documented that "driver" could be a
> > superclass, that's true: it is an undocumented feature.
> > 
> > However, it is a feature people are likely to be relying upon, to
> > configure a feature on all devices of a given type.
> > 
> 
> Nod. I do however see a difference between abstract and non-abstract.

I think I see your point.  The semantics of "-global" would be
clearer if all non-leaf classes were abstract.

-- 
Eduardo

  reply	other threads:[~2017-07-17 17:39 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-11  0:43 [Qemu-devel] [PATCH 0/3] qdev: fix the order compat and global properties are applied Eduardo Habkost
2017-07-11  0:43 ` [Qemu-devel] [PATCH 1/3] " Eduardo Habkost
2017-07-11 12:46   ` Cornelia Huck
2017-07-12 17:33   ` Halil Pasic
2017-07-12 18:29     ` Eduardo Habkost
2017-07-13 11:54       ` Halil Pasic
2017-07-13 16:15         ` Eduardo Habkost
2017-07-16 12:21           ` Halil Pasic
2017-07-11  0:43 ` [Qemu-devel] [PATCH 2/3] test-qdev-global-props: Test global property ordering Eduardo Habkost
2017-07-11 12:48   ` Cornelia Huck
2017-07-11 13:16   ` Greg Kurz
2017-07-12 18:06   ` Halil Pasic
2017-07-12 18:48     ` Eduardo Habkost
2017-07-16 12:35       ` Halil Pasic
2017-07-17 17:38         ` Eduardo Habkost [this message]
2017-07-11  0:43 ` [Qemu-devel] [PATCH 3/3] Revert "machine: Convert abstract typename on compat_props to subclass names" Eduardo Habkost
2017-07-11 12:49   ` Cornelia Huck
2017-07-11 13:16   ` Greg Kurz
2017-07-12 17:49   ` Halil Pasic
2017-07-12 19:20     ` Eduardo Habkost
2017-07-13 12:11       ` Halil Pasic
2017-07-13 16:20         ` Eduardo Habkost

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=20170717173852.GT6020@localhost.localdomain \
    --to=ehabkost@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=groug@kaod.org \
    --cc=marcel@redhat.com \
    --cc=pasic@linux.vnet.ibm.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).