All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, kraxel@redhat.com,
	liuxiaojian6@huawei.com, mst@redhat.com, rkrcmar@redhat.com,
	peterx@redhat.com, kevin@koconnor.net, pbonzini@redhat.com,
	lersek@redhat.com, chao.gao@intel.com
Subject: Re: [Qemu-devel] [PATCH v3 06/13] pc: apic_common: extend APIC ID property to 32bit
Date: Tue, 18 Oct 2016 16:38:30 +0200	[thread overview]
Message-ID: <20161018163830.511dee8b@nial.brq.redhat.com> (raw)
In-Reply-To: <20161018141443.GW3275@thinpad.lan.raisama.net>

On Tue, 18 Oct 2016 12:14:43 -0200
Eduardo Habkost <ehabkost@redhat.com> wrote:

> On Tue, Oct 18, 2016 at 04:01:56PM +0200, Igor Mammedov wrote:
> > On Tue, 18 Oct 2016 10:59:17 -0200
> > Eduardo Habkost <ehabkost@redhat.com> wrote:
> >   
> > > On Tue, Oct 18, 2016 at 02:36:10PM +0200, Igor Mammedov wrote:  
> > > > On Tue, 18 Oct 2016 08:56:28 -0200
> > > > Eduardo Habkost <ehabkost@redhat.com> wrote:
> > > >     
> > > > > On Thu, Oct 13, 2016 at 11:52:40AM +0200, Igor Mammedov wrote:    
> > > > > > ACPI ID is 32 bit wide on CPUs with x2APIC support.
> > > > > > Extend 'id' property to support it.
> > > > > > 
> > > > > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > > > > ---
> > > > > > v3:
> > > > > >    keep original behaviour where 'id' is readonly after
> > > > > >    object is realized (pbonzini)
> > > > > > ---      
> > > > > [...]    
> > > > > > diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c
> > > > > > index 8d01c9c..30f2af0 100644
> > > > > > --- a/hw/intc/apic_common.c
> > > > > > +++ b/hw/intc/apic_common.c
> > > > > > @@ -428,7 +429,6 @@ static const VMStateDescription vmstate_apic_common = {
> > > > > >  };
> > > > > >  
> > > > > >  static Property apic_properties_common[] = {
> > > > > > -    DEFINE_PROP_UINT8("id", APICCommonState, id, -1),
> > > > > >      DEFINE_PROP_UINT8("version", APICCommonState, version, 0x14),
> > > > > >      DEFINE_PROP_BIT("vapic", APICCommonState, vapic_control, VAPIC_ENABLE_BIT,
> > > > > >                      true),
> > > > > > @@ -437,6 +437,49 @@ static Property apic_properties_common[] = {
> > > > > >      DEFINE_PROP_END_OF_LIST(),
> > > > > >  };
> > > > > >  
> > > > > > +static void apic_common_get_id(Object *obj, Visitor *v, const char *name,
> > > > > > +                               void *opaque, Error **errp)
> > > > > > +{
> > > > > > +    APICCommonState *s = APIC_COMMON(obj);
> > > > > > +    int64_t value;
> > > > > > +
> > > > > > +    value = s->apicbase & MSR_IA32_APICBASE_EXTD ? s->initial_apic_id : s->id;
> > > > > > +    visit_type_int(v, name, &value, errp);
> > > > > > +}      
> > > > > 
> > > > > Who exactly is going to read this property and require this logic
> > > > > to be in the property getter?    
> > > > As it's set/read only from CPU we don't actually have to expose it
> > > > as property.
> > > > However, I've kept it as read/write property because it has already
> > > > been this way and been exposed to external users as some magic property.
> > > > Not sure is anyone cares.
> > > > 
> > > >     
> > > > > Do we really need to expose this to the outside as a magic
> > > > > property that changes depending on hardware state? Returning
> > > > > initial_apic_id sounds much simpler.    
> > > > Well that's what it is now, so I've kept current behavior.
> > > > If we decide to change property behavior or drop it altogether
> > > > I can do it on top.
> > > >     
> > > 
> > > I agree to make them static properties as follow-up patch. This
> > > way, if the change breaks anything we can revert only that patch.  
> > Static property won't work here as it should show APIC ID
> > depending on current CPU mode.  
> 
> My suggestion is to _not_ show a different ID depending on the
> current mode, to keep it simple. We can just have
> "initial-apic-id" and "id" properties.
> 
> But, anyway, I didn't mean to suggest static properties
> specifically. Where I say "static property" above, please read
> "simple property that returns just a simple struct field and
> don't need custom getter/setter code". That means either using a
> static property (in case we still want it to be writeable, which
> I doubt) or using object_property_add_uint*_ptr().
> 
> > 
> > I could make it readonly property on respin,
> > and set apic.id/initial_apic_id directly from CPU.
> > Change would be
> >    - apic_common_set_id()
> >    + apic_common::set_apic_id() callback
> > It won't get us less LOC, more likely it will take even more
> > code to do so.
> > As it's in this patch, it's at least consistent in a way
> > values are get/set. And effectively it's readonly due to check:  
> 
> Don't worry about doing it on the respin. I'm OK with keeping the
> current version by now, and change it in a follow-up patch.
> 
> > 
> > +    if (dev->realized) {
> > +        qdev_prop_set_after_realize(dev, name, errp);
> > +        return;
> > +    }
> > 
> > as external user can see only realized apic device.  
> 
> That's true. But we could avoid all the extra getter/setter code
> if we just use a static property or a read-only
> object_property_add_uint*_ptr() property.
> 
> (All I say above are suggestions for a follow-up patch. I'm OK
> with keeping the existing behavior like you do in this patch, to
> keep this series simple.)
Ok, I'll respin this patch as is and think/try
the way you are suggesting in follow up.

  reply	other threads:[~2016-10-18 14:38 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-13  9:52 [Qemu-devel] [PATCH v3 00/13] pc: q35: x2APIC support in kvm_apic mode Igor Mammedov
2016-10-13  9:52 ` [Qemu-devel] [PATCH v3 01/13] pc: acpi: x2APIC support for MADT table Igor Mammedov
2016-10-18 12:47   ` Eduardo Habkost
2016-10-18 13:00     ` Igor Mammedov
2016-10-18 13:05     ` Eduardo Habkost
2016-10-18 13:42       ` Igor Mammedov
2016-10-13  9:52 ` [Qemu-devel] [PATCH v3 02/13] pc: acpi: x2APIC support for SRAT table Igor Mammedov
2016-10-18 13:07   ` Eduardo Habkost
2016-10-18 13:47     ` Igor Mammedov
2016-10-13  9:52 ` [Qemu-devel] [PATCH v3 03/13] acpi: cphp: support x2APIC entry in cpu._MAT Igor Mammedov
2016-10-18 13:34   ` Eduardo Habkost
2016-10-18 13:46     ` Igor Mammedov
2016-10-18 13:47       ` Eduardo Habkost
2016-10-18 14:02         ` Igor Mammedov
2016-10-13  9:52 ` [Qemu-devel] [PATCH v3 04/13] acpi: cphp: force switch to modern cpu hotplug if APIC ID > 254 Igor Mammedov
2016-10-18 13:38   ` Eduardo Habkost
2016-10-18 14:34     ` Igor Mammedov
2016-10-18 15:05       ` Eduardo Habkost
2016-10-18 15:23         ` Igor Mammedov
2016-10-18 16:37           ` Eduardo Habkost
2016-10-19 10:35             ` Igor Mammedov
2016-10-13  9:52 ` [Qemu-devel] [PATCH v3 05/13] pc: leave max apic_id_limit only in legacy cpu hotplug code Igor Mammedov
2016-10-17 21:44   ` Eduardo Habkost
2016-10-18  9:02     ` Igor Mammedov
2016-10-18 10:31       ` Eduardo Habkost
2016-10-18 11:37         ` [Qemu-devel] [PATCH v4 " Igor Mammedov
2016-10-18 12:01           ` Eduardo Habkost
2016-10-18  9:12     ` [Qemu-devel] [PATCH v3 " Igor Mammedov
2016-10-18 10:39       ` Eduardo Habkost
2016-10-18 12:10         ` Igor Mammedov
2016-10-13  9:52 ` [Qemu-devel] [PATCH v3 06/13] pc: apic_common: extend APIC ID property to 32bit Igor Mammedov
2016-10-18 10:56   ` Eduardo Habkost
2016-10-18 12:36     ` Igor Mammedov
2016-10-18 12:59       ` Eduardo Habkost
2016-10-18 14:01         ` Igor Mammedov
2016-10-18 14:14           ` Eduardo Habkost
2016-10-18 14:38             ` Igor Mammedov [this message]
2016-10-13  9:52 ` [Qemu-devel] [PATCH v3 07/13] pc: apic_common: restore APIC ID to initial ID on reset Igor Mammedov
2016-10-13  9:52 ` [Qemu-devel] [PATCH v3 08/13] pc: apic_common: reset APIC ID to initial ID when switching into x2APIC mode Igor Mammedov
2016-10-13 14:11   ` Radim Krčmář
2016-10-13  9:52 ` [Qemu-devel] [PATCH v3 09/13] pc: kvm_apic: pass APIC ID depending on xAPIC/x2APIC mode Igor Mammedov
2016-10-13 14:08   ` Radim Krčmář
2016-10-14 11:21     ` [Qemu-devel] [PATCH v4 " Igor Mammedov
2016-10-17 12:35       ` Radim Krčmář
2016-10-18 14:56       ` Eduardo Habkost
2016-10-18 16:26         ` Radim Krčmář
2016-10-18 18:04           ` Eduardo Habkost
2016-10-17 21:51   ` [Qemu-devel] [PATCH v3 " Eduardo Habkost
2016-10-18  7:17     ` Igor Mammedov
2016-10-18 10:40       ` Eduardo Habkost
2016-10-13  9:52 ` [Qemu-devel] [PATCH v3 10/13] pc: clarify FW_CFG_MAX_CPUS usage comment Igor Mammedov
2016-10-13  9:52 ` [Qemu-devel] [PATCH v3 11/13] increase MAX_CPUMASK_BITS from 255 to 288 Igor Mammedov
2016-10-13 13:01   ` Andrew Jones
2016-10-13  9:52 ` [Qemu-devel] [PATCH v3 12/13] pc: add 'etc/boot-cpus' fw_cfg file for machine with more than 255 CPUs Igor Mammedov
2016-10-13  9:52 ` [Qemu-devel] [PATCH v3 13/13] pc: require IRQ remapping and EIM if there could be x2APIC CPUs Igor Mammedov
2016-10-13 13:56   ` Radim Krčmář
2016-10-14 11:25     ` [Qemu-devel] [PATCH v4 " Igor Mammedov
2016-10-18 11:27       ` Eduardo Habkost
2016-10-18 12:44         ` Igor Mammedov
2016-10-18 12:55           ` Eduardo Habkost
2016-10-18 14:39             ` Igor Mammedov
2016-10-13 10:01 ` [Qemu-devel] [PATCH v3 00/13] pc: q35: x2APIC support in kvm_apic mode Paolo Bonzini
2016-10-13 10:15   ` Igor Mammedov
2016-10-13 10:28   ` Gerd Hoffmann
2016-10-13 13:24 ` [Qemu-devel] [PATCH v3 14/13] pc: q35: bump max_cpus to 288 Igor Mammedov
2016-10-13 13:53   ` Radim Krčmář
2016-10-14  4:05 ` [Qemu-devel] [PATCH v3 00/13] pc: q35: x2APIC support in kvm_apic mode no-reply
2016-10-14  7:59   ` Igor Mammedov

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=20161018163830.511dee8b@nial.brq.redhat.com \
    --to=imammedo@redhat.com \
    --cc=chao.gao@intel.com \
    --cc=ehabkost@redhat.com \
    --cc=kevin@koconnor.net \
    --cc=kraxel@redhat.com \
    --cc=lersek@redhat.com \
    --cc=liuxiaojian6@huawei.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rkrcmar@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.