Linux s390 Architecture development
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Dipankar Sarma <dipankar@in.ibm.com>
Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Cornelia Huck <cornelia.huck@de.ibm.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Gleb Natapov <gleb@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>
Subject: [PATCH] [RFC] s390/kvm: note a quiescing state if we interupt guest mode
Date: Thu,  2 May 2013 10:09:52 +0200	[thread overview]
Message-ID: <1367482192-2753-1-git-send-email-borntraeger@de.ibm.com> (raw)

The SIE instruction is interruptible, so instead of having a guest
exit on a host interrupt we basically return to guest mode.
We have some logic in the interrupt handler to check for
need_resched, machine checks or sigpending to exit SIE the hard
way, but RCU is currently not handled, leading to several second
delays on cpu bound guests.

Lets mark SIE (guest context) as quiescing state in the external
interrupt handler (hz tick, timers sigp and others) thus making
RCU working properly again.

Long term we might want to use proper state tracking (just like
the dynticks folks) and mark guest state similar to user space
as an extended grace period, but this is not ready yet.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Dipankar Sarma <dipankar@in.ibm.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Gleb Natapov <gleb@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
---
 arch/s390/kernel/irq.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index 1630f43..d6ccb1d 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -244,6 +244,17 @@ void __irq_entry do_extint(struct pt_regs *regs, struct ext_code ext_code,
 	int index;
 
 	old_regs = set_irq_regs(regs);
+	/*
+	 * The SIE instruction is interruptible, so instead of having a guest
+	 * exit on a host interrupt we basically return to guest mode if there
+	 * is no need_resched, machine check or signal pending. So we can
+	 * stay in guest mode for several seconds or even minutes. This
+	 * lets RCU wait for a grace period much too long. In case of PF_VCPU
+	 * we know that we do not hold any rcu data, so lets claim that a
+	 * context switch happened, which is a quiescing state.
+	 */
+	if (current->flags & PF_VCPU) 
+		rcu_sched_qs(smp_processor_id());
 	irq_enter();
 	if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) {
 		/* Serve timer interrupts first. */
-- 
1.8.1.4

             reply	other threads:[~2013-05-02  8:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-02  8:09 Christian Borntraeger [this message]
2013-05-02 15:09 ` [PATCH] [RFC] s390/kvm: note a quiescing state if we interupt guest mode Paul E. McKenney
2013-05-02 15:32   ` Christian Borntraeger

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=1367482192-2753-1-git-send-email-borntraeger@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=dipankar@in.ibm.com \
    --cc=gleb@redhat.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=schwidefsky@de.ibm.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