All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Wei Yang <richardw.yang@linux.intel.com>
Cc: pbonzini@redhat.com, thuth@redhat.com, rth@twiddle.net,
	qemu-devel@nongnu.org, ehabkost@redhat.com
Subject: Re: [Qemu-devel] [PATCH] hw/i386/pc: check apci hotplug capability before nvdimm's
Date: Tue, 28 May 2019 14:26:27 +0200	[thread overview]
Message-ID: <20190528142627.6841e91a@redhat.com> (raw)
In-Reply-To: <20190528013548.GA8813@richard>

On Tue, 28 May 2019 09:35:48 +0800
Wei Yang <richardw.yang@linux.intel.com> wrote:

> On Mon, May 27, 2019 at 02:21:14PM +0200, Igor Mammedov wrote:
> >On Thu, 11 Apr 2019 15:17:39 +0800
> >Wei Yang <richardw.yang@linux.intel.com> wrote:
> >  
> >> pc_memory_pre_plug() is called during hotplug for both pc-dimm and
> >> nvdimm. This is more proper to check apci hotplug capability before
> >> check nvdimm specific capability.  
> >not sure what this about.
> >Currently we are checking if ACPI is enabled
> >  if (!pcms->acpi_dev || !acpi_enabled) { ...
> >before nvdimm check and it looks better to me that we cancel
> >nvdimm hotplug earlier than passing it to
> >    hotplug_handler_pre_plug(pcms->acpi_dev, dev, &local_err)
> >with this patch ACPI device handler will be called before
> >nvdimm check happens, so it's +1 unnecessary call chain in
> >the case of nvdimm, which I'd rather not have.
> >
> >Are there any issues with current call flow?
> >(commit message doesn't really explaining why we need this patch)
> >  
> 
> My idea is to check more generic requirement and then specific one.
> 
> For example, the call flow looks like this:
> 
> pc_memory_pre_plug
> 
>     piix4_device_pre_plug_cb | ich9_pm_device_pre_plug_cb
>         if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) &&
>             !lpc->pm.acpi_memory_hotplug.is_enabled)
> 
>     if (is_nvdimm && !ms->nvdimms_state->is_enabled)
>     
> 
> In hotplug_handler_pre_plug(), it checks the acpi hotplug capability. And then
> if it has memory hotplug capability and is nvdimm, we check whether nvdimm is
> enabled.

I don't think pc_memory_pre_plug() should rely on what hotplug_handler_pre_plug()
checks or does. Similarly the later is taking care of whatever piix4 needs to care
and shouldn't care about what machine code does.

Moreover when hotplug_handler_pre_plug() starts to reserve resources, then
if you move check as suggested you'd need to rollback all that
hotplug_handler_pre_plug() done to gracefully abort hotplug.

So I'd leave the code as it is now, since it doesn't depend on concrete
hotplug_handler_pre_plug() implementation and won't break if
hotplug_handler_pre_plug() will start consuming resources (which could
happen and you won't even notice it since changed code is in piix4/q35
files when reviewing patches).

> This is why I suggest to change the order here. No functional issue for
> current code.
> 



  reply	other threads:[~2019-05-28 12:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11  7:17 [Qemu-devel] [PATCH] hw/i386/pc: check apci hotplug capability before nvdimm's Wei Yang
2019-04-11  7:17 ` Wei Yang
2019-04-11  8:32 ` Thomas Huth
2019-04-11  8:32   ` Thomas Huth
2019-04-11  8:38   ` Wei Yang
2019-04-11  8:38     ` Wei Yang
2019-05-27  2:29   ` Wei Yang
2019-05-27 12:21 ` Igor Mammedov
2019-05-28  1:35   ` Wei Yang
2019-05-28 12:26     ` Igor Mammedov [this message]
2019-05-29  0:32       ` Wei Yang
2019-05-29  8:57         ` Igor Mammedov
2019-05-30  0:27           ` Wei Yang

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=20190528142627.6841e91a@redhat.com \
    --to=imammedo@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richardw.yang@linux.intel.com \
    --cc=rth@twiddle.net \
    --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.