qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH for-3.1 2/2] acpi: Decouple ACPI hotplug callbac


From: Eduardo Habkost
Subject: Re: [Qemu-devel] [PATCH for-3.1 2/2] acpi: Decouple ACPI hotplug callbacks from HotplugHandler
Date: Tue, 24 Jul 2018 12:48:59 -0300
User-agent: Mutt/1.9.2 (2017-12-15)

On Tue, Jul 24, 2018 at 05:28:44PM +0200, Igor Mammedov wrote:
> On Tue, 24 Jul 2018 09:39:16 -0300
> Eduardo Habkost <address@hidden> wrote:
> 
> > On Tue, Jul 24, 2018 at 02:29:49PM +0200, Igor Mammedov wrote:
> > > On Mon, 23 Jul 2018 16:31:45 -0300
> > > Eduardo Habkost <address@hidden> wrote:
> > >   
> > > > The ACPI hotplug callbacks get a HotplugHandler object as
> > > > argument.  This has two problems:
> > > > 
> > > > 1) The functions require a TYPE_ACPI_DEVICE_IF object, but the
> > > >    function prototype doesn't indicate that.  It's possible to
> > > >    pass an object that would make the function crash.
> > > > 2) The function does not require the object to implement
> > > >    TYPE_HOTPLUG_HANDLER at all, but the function prototype
> > > >    imposes that for no reason.
> > > > 
> > > > Change the argument type to AcpiDeviceIf instead of
> > > > HotplugHandler.  
> > > What is the motivation for this patch,
> > > do you actually get crashes?  
> > 
> > I didn't get crashes, but the idea for the change came when
> > Michael asked me how to get the HotplugHandler object.  I was
> > going to suggest current_machine (which is also a hotplug
> > handler), when I noticed he actually needed an AcpiDeviceIf
> > object.
> > 
> > The main motivation, however, is to simply make the function
> > prototypes make sense.  Is there a single reason to make the ACPI
> > functions get a HotplugHandler argument instead of AcpiDeviceIf?
> I'd rather to keep current *_cb() functions as is,
> as we might actually need access to hotplug handler there and in
> that case keeping more generic hotplug handler would be better
> and it also sort of documents better what is being passed in.

I think it doesn't document what is being passed in at all.  The
function looks like it requires only a HotplugHandler object, but
it actually requires an AcpiDeviceIf object.


> 
> Also we won't have to rewrite it back from AcpiDeviceIf to
> HotplugHandler again if it's needed.
> 

My main problem is: today there's a hard requirement that
HotplugHandler and AcpiDeviceIf must be the same object, but it's
not documented anywhere.

The proposal in this patch is to remove that requirement, and
make the callbacks just require an AcpiDeviceIf object.

If you plan to keep that requirement, that may be OK, but the
requirement needs to be documented somehow.  How do you think the
requirement can be enforced and/or documented?

-- 
Eduardo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]