All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Christian Lindig <christian.lindig@citrix.com>,
	David Scott <dave@recoil.org>,
	Edwin Torok <edvin.torok@citrix.com>,
	Rob Hoes <Rob.Hoes@citrix.com>
Subject: [PATCH v2 2/6] tools/oxenstored: Bind the DOM_EXC VIRQ in in Event.init()
Date: Wed, 30 Nov 2022 16:54:51 +0000	[thread overview]
Message-ID: <20221130165455.31125-3-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20221130165455.31125-1-andrew.cooper3@citrix.com>

Xenstored always needs to bind the DOM_EXC VIRQ.

Instead of doing it shortly after the call to Event.init(), do it in the
init() call itself.  This removes the need for the field to be a mutable
option.

It will also simplify a future change to restore both parts from the live
update record, rather than re-initialising them from scratch.

Rename the field from virq_port (which could be any VIRQ) to it's proper name.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Christian Lindig <christian.lindig@citrix.com>
CC: David Scott <dave@recoil.org>
CC: Edwin Torok <edvin.torok@citrix.com>
CC: Rob Hoes <Rob.Hoes@citrix.com>

v2:
 * New.
---
 tools/ocaml/xenstored/event.ml     | 9 ++++++---
 tools/ocaml/xenstored/xenstored.ml | 4 +---
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/tools/ocaml/xenstored/event.ml b/tools/ocaml/xenstored/event.ml
index ccca90b6fc4f..a3be296374ff 100644
--- a/tools/ocaml/xenstored/event.ml
+++ b/tools/ocaml/xenstored/event.ml
@@ -17,12 +17,15 @@
 (**************** high level binding ****************)
 type t = {
 	handle: Xeneventchn.handle;
-	mutable virq_port: Xeneventchn.t option;
+	domexc: Xeneventchn.t;
 }
 
-let init () = { handle = Xeneventchn.init (); virq_port = None; }
+let init () =
+	let handle = Xeneventchn.init () in
+	let domexc = Xeneventchn.bind_dom_exc_virq handle in
+	{ handle; domexc }
+
 let fd eventchn = Xeneventchn.fd eventchn.handle
-let bind_dom_exc_virq eventchn = eventchn.virq_port <- Some (Xeneventchn.bind_dom_exc_virq eventchn.handle)
 let bind_interdomain eventchn domid port = Xeneventchn.bind_interdomain eventchn.handle domid port
 let unbind eventchn port = Xeneventchn.unbind eventchn.handle port
 let notify eventchn port = Xeneventchn.notify eventchn.handle port
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index c5dc7a28d082..55071b49eccb 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -397,7 +397,6 @@ let _ =
 	if cf.restart && Sys.file_exists Disk.xs_daemon_database then (
 		let rwro = DB.from_file store domains cons Disk.xs_daemon_database in
 		info "Live reload: database loaded";
-		Event.bind_dom_exc_virq eventchn;
 		Process.LiveUpdate.completed ();
 		rwro
 	) else (
@@ -413,7 +412,6 @@ let _ =
 
 		if cf.domain_init then (
 			Connections.add_domain cons (Domains.create0 domains);
-			Event.bind_dom_exc_virq eventchn
 		);
 		rw_sock
 	) in
@@ -451,7 +449,7 @@ let _ =
 			let port = Event.pending eventchn in
 			debug "pending port %d" (Xeneventchn.to_int port);
 			finally (fun () ->
-				if Some port = eventchn.Event.virq_port then (
+				if port = eventchn.Event.domexc then (
 					let (notify, deaddom) = Domains.cleanup domains in
 					List.iter (Store.reset_permissions store) deaddom;
 					List.iter (Connections.del_domain cons) deaddom;
-- 
2.11.0



  parent reply	other threads:[~2022-11-30 16:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-30 16:54 [PATCH v2 0/6] More Oxenstored live update fixes Andrew Cooper
2022-11-30 16:54 ` [PATCH v2 1/6] tools/oxenstored: Style fixes to Domain Andrew Cooper
2022-11-30 17:14   ` Edwin Torok
2022-12-01 11:11   ` Christian Lindig
2022-11-30 16:54 ` Andrew Cooper [this message]
2022-11-30 17:16   ` [PATCH v2 2/6] tools/oxenstored: Bind the DOM_EXC VIRQ in in Event.init() Edwin Torok
2022-12-01 11:27   ` Christian Lindig
2022-11-30 16:54 ` [PATCH v2 3/6] tools/oxenstored: Rename some 'port' variables to 'remote_port' Andrew Cooper
2022-11-30 17:16   ` Edwin Torok
2022-12-01 11:26   ` Christian Lindig
2022-12-01 12:02     ` Andrew Cooper
2022-11-30 16:54 ` [PATCH v2 4/6] tools/oxenstored: Implement Domain.rebind_evtchn Andrew Cooper
2022-11-30 17:15   ` Edwin Torok
2022-12-01 11:20   ` Christian Lindig
2022-12-01 12:10     ` Andrew Cooper
2022-12-01 13:10       ` Christian Lindig
2022-12-02  9:11       ` Edwin Torok
2022-11-30 16:54 ` [PATCH v2 5/6] tools/oxenstored: Rework Domain evtchn handling to use port_pair Andrew Cooper
2022-11-30 17:17   ` Edwin Torok
2022-12-01 11:59   ` Christian Lindig
2022-12-01 14:22     ` Andrew Cooper
2022-12-01 15:22       ` Edwin Torok
2022-11-30 16:54 ` [PATCH v2 6/6] tools/oxenstored: Keep /dev/xen/evtchn open across live update Andrew Cooper

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=20221130165455.31125-3-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Rob.Hoes@citrix.com \
    --cc=christian.lindig@citrix.com \
    --cc=dave@recoil.org \
    --cc=edvin.torok@citrix.com \
    --cc=xen-devel@lists.xenproject.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 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.