qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
To: Greg Kurz <groug@kaod.org>
Cc: qemu-ppc@nongnu.org, alex.bennee@linaro.org,
	david@gibson.dropbear.id.au, rth@twiddle.net,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH RFC 1/4] spapr-hcall: take iothread lock during handler call
Date: Fri, 02 Sep 2016 14:58:12 +0530	[thread overview]
Message-ID: <877faur6qb.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <20160902105348.6ea4a550@bahia.lan>

Greg Kurz <groug@kaod.org> writes:

> On Fri,  2 Sep 2016 12:02:53 +0530
> Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> wrote:
>
>> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
>> ---
>>  hw/ppc/spapr_hcall.c | 11 +++++++++--
>>  1 file changed, 9 insertions(+), 2 deletions(-)
>> 
>> diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
>> index e5eca67..daea7a0 100644
>> --- a/hw/ppc/spapr_hcall.c
>> +++ b/hw/ppc/spapr_hcall.c
>> @@ -1075,20 +1075,27 @@ target_ulong spapr_hypercall(PowerPCCPU *cpu, target_ulong opcode,
>>                               target_ulong *args)
>>  {
>>      sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
>> +    target_ulong ret;
>>  
>>      if ((opcode <= MAX_HCALL_OPCODE)
>>          && ((opcode & 0x3) == 0)) {
>>          spapr_hcall_fn fn = papr_hypercall_table[opcode / 4];
>>  
>>          if (fn) {
>> -            return fn(cpu, spapr, opcode, args);
>> +            qemu_mutex_lock_iothread();
>> +            ret = fn(cpu, spapr, opcode, args);
>> +            qemu_mutex_unlock_iothread();
>> +            return ret;
>>          }
>>      } else if ((opcode >= KVMPPC_HCALL_BASE) &&
>>                 (opcode <= KVMPPC_HCALL_MAX)) {
>>          spapr_hcall_fn fn = kvmppc_hypercall_table[opcode - KVMPPC_HCALL_BASE];
>>  
>>          if (fn) {
>> -            return fn(cpu, spapr, opcode, args);
>> +            qemu_mutex_lock_iothread();
>> +            ret = fn(cpu, spapr, opcode, args);
>> +            qemu_mutex_unlock_iothread();
>> +            return ret;
>>          }
>>      }
>>  
>
> This will serialize all hypercalls, even when it is not needed... Isn't that
> too much coarse grain locking ?

You are right, I was thinking to do this only for emulation case, as
this is not needed for hardware acceleration.

Regards
Nikunj

  reply	other threads:[~2016-09-02  9:28 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-02  6:32 [Qemu-devel] [PATCH RFC 0/4] Enable MTTCG on PowerPC Nikunj A Dadhania
2016-09-02  6:32 ` [Qemu-devel] [PATCH RFC 1/4] spapr-hcall: take iothread lock during handler call Nikunj A Dadhania
2016-09-02  8:53   ` Greg Kurz
2016-09-02  9:28     ` Nikunj A Dadhania [this message]
2016-09-02  9:57       ` Greg Kurz
2016-09-03 16:31         ` Nikunj A Dadhania
2016-09-02 10:06   ` Thomas Huth
2016-09-03 16:33     ` Nikunj A Dadhania
2016-09-02  6:32 ` [Qemu-devel] [PATCH RFC 2/4] target-ppc: with MTTCG report more threads Nikunj A Dadhania
2016-09-02  9:28   ` Greg Kurz
2016-09-02  9:34     ` Nikunj A Dadhania
2016-09-02 10:45       ` Greg Kurz
2016-09-03 16:34         ` Nikunj A Dadhania
2016-09-07  3:51   ` David Gibson
2016-09-07  4:41     ` Nikunj A Dadhania
2016-09-02  6:32 ` [Qemu-devel] [PATCH RFC 3/4] target-ppc: use atomic_cmpxchg for ld/st reservation Nikunj A Dadhania
2016-09-07  4:02   ` David Gibson
2016-09-07  4:47     ` Nikunj A Dadhania
2016-09-07  5:24       ` Benjamin Herrenschmidt
2016-09-07  8:42         ` Nikunj A Dadhania
2016-09-07  5:34       ` David Gibson
2016-09-07  7:13         ` Alex Bennée
2016-09-12  1:19           ` David Gibson
2016-09-12  8:39             ` Alex Bennée
2016-09-12  9:15               ` Benjamin Herrenschmidt
2016-09-02  6:32 ` [Qemu-devel] [PATCH RFC 4/4] target-ppc: flush tlb from all the cpu Nikunj A Dadhania
2016-09-02  7:22   ` Benjamin Herrenschmidt
2016-09-02  7:34     ` Nikunj A Dadhania
2016-09-04 17:00       ` Alex Bennée
2016-09-04 22:17         ` Benjamin Herrenschmidt
2016-09-05  0:10         ` Benjamin Herrenschmidt
2016-09-06  1:55           ` Nikunj A Dadhania
2016-09-06  3:05             ` Benjamin Herrenschmidt
2016-09-06  4:53               ` Nikunj A Dadhania
2016-09-06  5:30                 ` Benjamin Herrenschmidt
2016-09-06  6:57                   ` Nikunj A Dadhania
2016-09-02  6:43 ` [Qemu-devel] [PATCH RFC 0/4] Enable MTTCG on PowerPC Cédric Le Goater
2016-09-02  6:46   ` Nikunj A Dadhania
2016-09-02  7:57   ` Thomas Huth
2016-09-02 11:44     ` Cédric Le Goater
2016-09-02  7:19 ` Benjamin Herrenschmidt
2016-09-02  7:39   ` Nikunj A Dadhania
2016-09-02 12:13     ` Benjamin Herrenschmidt
2016-09-07  4:08   ` David Gibson
2016-09-07  4:48     ` Nikunj A Dadhania

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=877faur6qb.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me \
    --to=nikunj@linux.vnet.ibm.com \
    --cc=alex.bennee@linaro.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=groug@kaod.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rth@twiddle.net \
    /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).