qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Holding the BQL for emulate_ppc_hypercall
@ 2016-10-24 14:41 Alex Bennée
  2016-10-24 14:44 ` Alex Bennée
  2016-10-25  3:43 ` Nikunj A Dadhania
  0 siblings, 2 replies; 6+ messages in thread
From: Alex Bennée @ 2016-10-24 14:41 UTC (permalink / raw)
  To: Nikunj A Dadhania, Bharata B Rao, David Gibson; +Cc: qemu-ppc, Qemu Developers

Hi,

In the MTTCG patch set one of the big patches is to remove the
requirement to hold the BQL while running code:

  tcg: drop global lock during TCG code execution

And this broke the PPC code because emulate_ppc_hypercall can cause
changes to the global state. This function just calls spapr_hypercall()
and puts the results into the TCG register file. Normally
spapr_hypercall() is called under the BQL in KVM as
kvm_arch_handle_exit() does things with the BQL held.

I blithely wrapped the called in a lock/unlock pair only to find the
ppc64 check builds failed as the hypercall was made during the
cc->do_interrupt() code which also holds the BQL.

I'm a little confused by the nature of PPC hypercalls in TCG? Are they
not all detectable at code generation time? What is the case that causes
an exception to occur rather than the helper function doing the
hypercall?

I guess it comes down to can I avoid doing:

  /* If we come via cc->do_interrupt BQL may already be held */
  if (!qemu_mutex_iothread_locked()) {
      g_mutex_lock_iothread();
      env->gpr[3] = spapr_hypercall(cpu, env->gpr[3], &env->gpr[4]);
      g_muetx_unlock_iothread();
  } else {
      env->gpr[3] = spapr_hypercall(cpu, env->gpr[3], &env->gpr[4]);
  }

Any thoughts?

--
Alex Bennée

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-10-25  8:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-24 14:41 [Qemu-devel] Holding the BQL for emulate_ppc_hypercall Alex Bennée
2016-10-24 14:44 ` Alex Bennée
2016-10-25  2:47   ` David Gibson
2016-10-25  8:36     ` Alex Bennée
2016-10-25  3:43 ` Nikunj A Dadhania
2016-10-25  8:39   ` Alex Bennée

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).