public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Glauber de Oliveira Costa <gcosta@redhat.com>
To: lguest@ozlabs.org
Cc: glommer@gmail.com, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org, rusty@rustcorp.com.au,
	rostedt@goodmis.org,
	Glauber de Oliveira Costa <gcosta@redhat.com>
Subject: [PATCH 15/16] make pending notifications per-vcpu
Date: Thu, 20 Dec 2007 11:33:55 -0200	[thread overview]
Message-ID: <11981577132025-git-send-email-gcosta@redhat.com> (raw)
In-Reply-To: <11981577083517-git-send-email-gcosta@redhat.com>

this patch makes the pending_notify field, used to control
pending notifications, per-vcpu, instead of per-guest

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
---
 drivers/lguest/core.c        |    6 +++---
 drivers/lguest/hypercalls.c  |    6 +++---
 drivers/lguest/lg.h          |    3 ++-
 drivers/lguest/lguest_user.c |    4 ++--
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
index 285a465..d628515 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -186,10 +186,10 @@ int run_guest(struct lguest_vcpu *vcpu, unsigned long __user *user)
 
 		/* It's possible the Guest did a NOTIFY hypercall to the
 		 * Launcher, in which case we return from the read() now. */
-		if (lg->pending_notify) {
-			if (put_user(lg->pending_notify, user))
+		if (vcpu->pending_notify) {
+			if (put_user(vcpu->pending_notify, user))
 				return -EFAULT;
-			return sizeof(lg->pending_notify);
+			return sizeof(vcpu->pending_notify);
 		}
 
 		/* Check for signals */
diff --git a/drivers/lguest/hypercalls.c b/drivers/lguest/hypercalls.c
index c6b87ef..95e1062 100644
--- a/drivers/lguest/hypercalls.c
+++ b/drivers/lguest/hypercalls.c
@@ -89,7 +89,7 @@ static void do_hcall(struct lguest_vcpu *vcpu, struct hcall_args *args)
 		vcpu->halted = 1;
 		break;
 	case LHCALL_NOTIFY:
-		lg->pending_notify = args->arg1;
+		vcpu->pending_notify = args->arg1;
 		break;
 	default:
 		/* It should be an architecture-specific hypercall. */
@@ -152,7 +152,7 @@ static void do_async_hcalls(struct lguest_vcpu *vcpu)
 
 		/* Stop doing hypercalls if they want to notify the Launcher:
 		 * it needs to service this first. */
-		if (lg->pending_notify)
+		if (vcpu->pending_notify)
 			break;
 	}
 }
@@ -217,7 +217,7 @@ void do_hypercalls(struct lguest_vcpu *vcpu)
 	/* If we stopped reading the hypercall ring because the Guest did a
 	 * NOTIFY to the Launcher, we want to return now.  Otherwise we do
 	 * the hypercall. */
-	if (!vcpu->lg->pending_notify) {
+	if (!vcpu->pending_notify) {
 		do_hcall(vcpu, vcpu->hcall);
 		/* Tricky point: we reset the hcall pointer to mark the
 		 * hypercall as "done".  We use the hcall pointer rather than
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h
index dbf70c6..6faf90d 100644
--- a/drivers/lguest/lg.h
+++ b/drivers/lguest/lg.h
@@ -51,6 +51,8 @@ struct lguest_vcpu {
 	u32 esp1;
 	u8 ss1;
 
+	unsigned long pending_notify; /* pfn from LHCALL_NOTIFY */
+
 	/* At end of a page shared mapped over lguest_pages in guest.  */
 	unsigned long regs_page;
 	struct lguest_regs *regs;
@@ -95,7 +97,6 @@ struct lguest
 	struct pgdir pgdirs[4];
 
 	unsigned long noirq_start, noirq_end;
-	unsigned long pending_notify; /* pfn from LHCALL_NOTIFY */
 
 	unsigned int stack_pages;
 	u32 tsc_khz;
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index d081db4..349d69d 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -88,8 +88,8 @@ static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o)
 
 	/* If we returned from read() last time because the Guest notified,
 	 * clear the flag. */
-	if (lg->pending_notify)
-		lg->pending_notify = 0;
+	if (vcpu->pending_notify)
+		vcpu->pending_notify = 0;
 
 	/* Run the Guest until something interesting happens. */
 	return run_guest(vcpu, (unsigned long __user *)user);
-- 
1.5.0.6


  reply	other threads:[~2007-12-20 13:40 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-20 13:33 [PATCH 0/16] lguest: introduce vcpu structure Glauber de Oliveira Costa
2007-12-20 13:33 ` [PATCH 01/16] introduce vcpu struct Glauber de Oliveira Costa
2007-12-20 13:33   ` [PATCH 02/16] adapt lguest launcher to per-cpuness Glauber de Oliveira Costa
2007-12-20 13:33     ` [PATCH 03/16] initialize vcpu Glauber de Oliveira Costa
2007-12-20 13:33       ` [PATCH 04/16] per-cpu run guest Glauber de Oliveira Costa
2007-12-20 13:33         ` [PATCH 05/16] make write() operation smp aware Glauber de Oliveira Costa
2007-12-20 13:33           ` [PATCH 06/16] make hypercalls use the vcpu struct Glauber de Oliveira Costa
2007-12-20 13:33             ` [PATCH 07/16] per-vcpu lguest timers Glauber de Oliveira Costa
2007-12-20 13:33               ` [PATCH 08/16] per-vcpu interrupt processing Glauber de Oliveira Costa
2007-12-20 13:33                 ` [PATCH 09/16] map_switcher_in_guest() per-vcpu Glauber de Oliveira Costa
2007-12-20 13:33                   ` [PATCH 10/16] make emulate_insn receive a vcpu struct Glauber de Oliveira Costa
2007-12-20 13:33                     ` [PATCH 11/16] make registers per-vcpu Glauber de Oliveira Costa
2007-12-20 13:33                       ` [PATCH 12/16] replace lguest_arch with lguest_vcpu_arch Glauber de Oliveira Costa
2007-12-20 13:33                         ` [PATCH 13/16] per-vcpu lguest task management Glauber de Oliveira Costa
2007-12-20 13:33                           ` [PATCH 14/16] makes special fields be per-vcpu Glauber de Oliveira Costa
2007-12-20 13:33                             ` Glauber de Oliveira Costa [this message]
2007-12-20 13:33                               ` [PATCH 16/16] per-vcpu lguest pgdir management Glauber de Oliveira Costa
2007-12-25 23:47                           ` [PATCH 13/16] per-vcpu lguest task management Rusty Russell
2007-12-25 23:47                   ` [PATCH 09/16] map_switcher_in_guest() per-vcpu Rusty Russell
2007-12-25 23:40           ` [PATCH 05/16] make write() operation smp aware Rusty Russell
2007-12-25 23:38         ` [PATCH 04/16] per-cpu run guest Rusty Russell
2007-12-25 23:35     ` [PATCH 02/16] adapt lguest launcher to per-cpuness Rusty Russell
2007-12-26 14:24       ` Steven Rostedt
2007-12-27  0:08         ` Rusty Russell
2007-12-25 23:34   ` [PATCH 01/16] introduce vcpu struct Rusty Russell
2007-12-25 23:54 ` [PATCH 0/16] lguest: introduce vcpu structure Rusty Russell
2008-01-06 17:33   ` Glauber de Oliveira Costa
2008-01-07  0:53     ` Rusty Russell
  -- strict thread matches above, loose matches on Subject: below --
2008-01-07 13:05 [PATCH 0/16 -v2] lguest smp infrastructure Glauber de Oliveira Costa
2008-01-07 13:05 ` [PATCH 01/16] introduce vcpu struct Glauber de Oliveira Costa
2008-01-07 13:05   ` [PATCH 02/16] adapt lguest launcher to per-cpuness Glauber de Oliveira Costa
2008-01-07 13:05     ` [PATCH 03/16] initialize vcpu Glauber de Oliveira Costa
2008-01-07 13:05       ` [PATCH 04/16] per-cpu run guest Glauber de Oliveira Costa
2008-01-07 13:05         ` [PATCH 05/16] make write() operation smp aware Glauber de Oliveira Costa
2008-01-07 13:05           ` [PATCH 06/16] make hypercalls use the vcpu struct Glauber de Oliveira Costa
2008-01-07 13:05             ` [PATCH 07/16] per-vcpu lguest timers Glauber de Oliveira Costa
2008-01-07 13:05               ` [PATCH 08/16] per-vcpu interrupt processing Glauber de Oliveira Costa
2008-01-07 13:05                 ` [PATCH 09/16] map_switcher_in_guest() per-vcpu Glauber de Oliveira Costa
2008-01-07 13:05                   ` [PATCH 10/16] make emulate_insn receive a vcpu struct Glauber de Oliveira Costa
2008-01-07 13:05                     ` [PATCH 11/16] make registers per-vcpu Glauber de Oliveira Costa
2008-01-07 13:05                       ` [PATCH 12/16] replace lguest_arch with lg_vcpu_arch Glauber de Oliveira Costa
2008-01-07 13:05                         ` [PATCH 13/16] per-vcpu lguest task management Glauber de Oliveira Costa
2008-01-07 13:05                           ` [PATCH 14/16] makes special fields be per-vcpu Glauber de Oliveira Costa
2008-01-07 13:05                             ` [PATCH 15/16] make pending notifications per-vcpu Glauber de Oliveira Costa

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=11981577132025-git-send-email-gcosta@redhat.com \
    --to=gcosta@redhat.com \
    --cc=glommer@gmail.com \
    --cc=lguest@ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=rusty@rustcorp.com.au \
    --cc=virtualization@lists.linux-foundation.org \
    /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