All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: quintela@redhat.com
Cc: qemu-devel@nongnu.org, dgilbert@redhat.com,
	borntraeger@de.ibm.com,
	"Jason J. Herne" <jjherne@linux.vnet.ibm.com>,
	amit.shah@redhat.com, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH v7 1/5] cpu: Provide vcpu throttling interface
Date: Wed, 9 Sep 2015 14:11:52 +0200	[thread overview]
Message-ID: <55F02208.5070205@redhat.com> (raw)
In-Reply-To: <87a8sv6emo.fsf@neno.neno>



On 09/09/2015 13:01, Juan Quintela wrote:
> Paolo Bonzini <pbonzini@redhat.com> wrote:
>> On 09/09/2015 12:41, Juan Quintela wrote:
>>>>> +    qemu_mutex_unlock_iothread();
>>>>> +    atomic_set(&cpu->throttle_thread_scheduled, 0);
>>>>> +    g_usleep(sleeptime_ns / 1000); /* Convert ns to us for usleep call */
>>>>> +    qemu_mutex_lock_iothread();
>>>
>>> Why is this thread safe?
>>>
>>> qemu_mutex_lock_iothread() is protecting (at least) cpu_work_first on
>>> each cpu.  How can we be sure that _nothing_ will change that while we
>>> are waiting?
>>
>> You only have to be sure that the queued work list remains consistent;
>> not that nothing changes.
> 
> 
> But nothing else is protected by the iothread?

Not at this point.  Notice how qemu_kvm_wait_io_event calls
qemu_cond_wait just before qemu_wait_io_event_common (which in turn is
what calls flush_queued_work).

So you can be quite sure that qemu_wait_io_event_common runs at a point
where there's nothing hidden that relies on the iothread mutex.

Paolo

  reply	other threads:[~2015-09-09 12:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-08 17:12 [Qemu-devel] [PATCH v7 0/5] migration: Dynamic cpu throttling for auto-converge Jason J. Herne
2015-09-08 17:12 ` [Qemu-devel] [PATCH v7 1/5] cpu: Provide vcpu throttling interface Jason J. Herne
2015-09-09  9:42   ` Paolo Bonzini
2015-09-09 10:50     ` Juan Quintela
2015-09-09 10:41   ` Juan Quintela
2015-09-09 10:52     ` Paolo Bonzini
2015-09-09 11:01       ` Juan Quintela
2015-09-09 12:11         ` Paolo Bonzini [this message]
2015-09-08 17:12 ` [Qemu-devel] [PATCH v7 2/5] migration: Parameters for auto-converge cpu throttling Jason J. Herne
2015-09-09 10:43   ` Juan Quintela
2015-09-09 11:21   ` Juan Quintela
2015-09-08 17:12 ` [Qemu-devel] [PATCH v7 3/5] migration: Dynamic cpu throttling for auto-converge Jason J. Herne
2015-09-09 10:44   ` Juan Quintela
2015-09-08 17:12 ` [Qemu-devel] [PATCH v7 4/5] qmp/hmp: Add throttle ratio to query-migrate and info migrate Jason J. Herne
2015-09-09 10:46   ` Juan Quintela
2015-09-08 17:12 ` [Qemu-devel] [PATCH v7 5/5] migration: Disambiguate MAX_THROTTLE Jason J. Herne
2015-09-09 10:45   ` Juan Quintela
2015-09-09 11:51 ` [Qemu-devel] [PATCH v7 0/5] migration: Dynamic cpu throttling for auto-converge Juan Quintela
2015-09-09 12:51   ` Jason J. Herne

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=55F02208.5070205@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=amit.shah@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=dgilbert@redhat.com \
    --cc=jjherne@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@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.