qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Xiao Guangrong <guangrong.xiao@linux.intel.com>
To: Igor Mammedov <imammedo@redhat.com>,
	Stefan Hajnoczi <stefanha@gmail.com>
Cc: pbonzini@redhat.com, gleb@kernel.org, mtosatti@redhat.com,
	stefanha@redhat.com, mst@redhat.com, rth@twiddle.net,
	ehabkost@redhat.com, dan.j.williams@intel.com,
	kvm@vger.kernel.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 2/4] nvdimm acpi: introduce fit buffer
Date: Wed, 2 Nov 2016 00:00:12 +0800	[thread overview]
Message-ID: <d982cf67-53b1-4611-11d8-a28021623bde@linux.intel.com> (raw)
In-Reply-To: <20161101162505.57172707@nial.brq.redhat.com>



On 11/01/2016 11:25 PM, Igor Mammedov wrote:
> On Tue, 1 Nov 2016 15:17:01 +0000
> Stefan Hajnoczi <stefanha@gmail.com> wrote:
>
>> On Sat, Oct 29, 2016 at 12:35:38AM +0800, Xiao Guangrong wrote:
>>> The buffer is used to save the FIT info for all the presented nvdimm
>>> devices which is updated after the nvdimm device is plugged or
>>> unplugged. In the later patch, it will be used to construct NVDIMM
>>> ACPI _FIT method which reflects the presented nvdimm devices after
>>> nvdimm hotplug
>>>
>>> As FIT buffer can not completely mapped into guest address space,
>>> OSPM will exit to QEMU multiple times, however, there is the race
>>> condition - FIT may be changed during these multiple exits, so that
>>> some rules are introduced:
>>> 1) the user should hold the @lock to access the buffer and
>>
>> I don't understand the purpose of the QEMUMutex lock.  Don't all threads
>> calling nvdimm/acpi code hold the QEMU global mutex (main loop and vcpu
>> threads)?
>>
>>> -static void nvdimm_build_nfit(GSList *device_list, GArray *table_offsets,
>>> +static void nvdimm_init_fit_buffer(NvdimmFitBuffer *fit_buf)
>>> +{
>>> +    qemu_mutex_init(&fit_buf->lock);
>>> +    fit_buf->fit = g_array_new(false, true /* clear */, 1);
>>
>> Is it possible to call nvdimm_build_device_structure() here?  That way
>> we don't duplicate the g_array_new() details.
>>
>>> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
>>> index 5783442..d835e62 100644
>>> --- a/hw/core/qdev.c
>>> +++ b/hw/core/qdev.c
>>> @@ -945,10 +945,21 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
>>>                  goto child_realize_fail;
>>>              }
>>>          }
>>> +
>>>          if (dev->hotplugged) {
>>>              device_reset(dev);
>>>          }
>>>          dev->pending_deleted_event = false;
>>> +        dev->realized = value;
>>> +
>>> +        if (hotplug_ctrl) {
>>> +            hotplug_handler_post_plug(hotplug_ctrl, dev, &local_err);
>>> +        }
>>> +
>>> +        if (local_err != NULL) {
>>> +            dev->realized = value;
>>
>> dev->realized = value was already set above.
>>
>> In order to preserve semantics you would need a bool old_value =
>> dev->realized which you can restore in post_realize_fail.  QEMU current
>> does not assign dev->realized = value when there is a failure!
>
> Stefan,
>
> as agreed on
>  "Re: [Qemu-devel] [PULL 00/47] virtio, pc: fixes and features" thread
> this series would be merged as is and then as follow up author
> will fixup all issues with it.
>
> For this patch it means a patch on top of Michael pull req
> to drop lock and drop hotplug_handler_post_plug() code in favor
> of existing hotplug_handler_plug().
>

Thank you, Igor, Michael and Stefan. I will do it asap after
this patchset is merged. :)

  reply	other threads:[~2016-11-01 16:07 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-28 16:35 [Qemu-devel] [PATCH v3 0/4] nvdimm: hotplug support Xiao Guangrong
2016-10-28 16:35 ` [Qemu-devel] [PATCH v3 1/4] nvdimm acpi: prebuild nvdimm devices for available slots Xiao Guangrong
2016-11-01 15:16   ` Igor Mammedov
2016-10-28 16:35 ` [Qemu-devel] [PATCH v3 2/4] nvdimm acpi: introduce fit buffer Xiao Guangrong
2016-11-01 15:17   ` Stefan Hajnoczi
2016-11-01 15:25     ` Igor Mammedov
2016-11-01 16:00       ` Xiao Guangrong [this message]
2016-10-28 16:35 ` [Qemu-devel] [PATCH v3 3/4] nvdimm acpi: introduce _FIT Xiao Guangrong
2016-11-01 16:24   ` Igor Mammedov
2016-11-02 15:40     ` Xiao Guangrong
2016-11-03  9:15       ` Igor Mammedov
2016-11-01 16:41   ` Stefan Hajnoczi
2016-11-02 15:42     ` Xiao Guangrong
2016-11-02 13:56   ` Igor Mammedov
2016-11-02 15:54     ` Xiao Guangrong
2016-11-03  9:22       ` Igor Mammedov
2016-10-28 16:35 ` [Qemu-devel] [PATCH v3 4/4] pc: memhp: enable nvdimm device hotplug Xiao Guangrong
2016-11-01 16:44   ` Stefan Hajnoczi
2016-11-02 11:21   ` Igor Mammedov
2016-11-02 15:55     ` Xiao Guangrong
2016-11-02 14:01 ` [Qemu-devel] [PATCH v3 0/4] nvdimm: hotplug support Igor Mammedov
2016-11-03  4:53   ` Michael S. Tsirkin
2016-11-03  9:27     ` 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=d982cf67-53b1-4611-11d8-a28021623bde@linux.intel.com \
    --to=guangrong.xiao@linux.intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=ehabkost@redhat.com \
    --cc=gleb@kernel.org \
    --cc=imammedo@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=stefanha@gmail.com \
    --cc=stefanha@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 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).