From: Keir Fraser Subject: Re: [PATCH 2/6] xen/hvm kexec: unregister shutdown+sysrq watches during reboot Date: Thu, 28 Jul 2011 21:30:24 +0100 Message-ID: References: <20110728195029.GA18283@aepfle.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="B_3394733428_68223604" Return-path: In-Reply-To: <20110728195029.GA18283@aepfle.de> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Olaf Hering Cc: "xen-devel@lists.xensource.com" , Ian Campbell , Jan Beulich List-Id: xen-devel@lists.xenproject.org > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3394733428_68223604 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit On 28/07/2011 20:50, "Olaf Hering" wrote: > On Thu, Jul 28, Keir Fraser wrote: > >> On 28/07/2011 15:07, "Olaf Hering" wrote: >> >>> On Thu, Jul 28, Ian Campbell wrote: >>> >>>>> Are you suggesting that there have to be ways for a domU to query the >>>>> state of its registered watches and shut them all down during very early >>>>> boot? >>>> >>>> Perhaps the xenstore protocol could be enhanced with a mechanism to >>>> clear all existing watches? A kernel could call that at start of day. >>> >>> I poked around in the xenstore sources, there is appearently nothing >>> that can be used to shutdown all. Or would calling XS_RELEASE do the trick? >> >> XS_INTRODUCE > > Unfortunately do_introduce() is not preprared for that. > > On enter, conn->id contains the domain_id, so it errors out early. > Later it compares domain->conn != conn and does not enter the correct path. Oh of course you want to do it from *inside* the guest... > If I remove both checks the kexec appears to work ok. > Is it save to remove both checks? Hmm, no. Attached patch would be safer, give it a try. And note that it is *dangerous* to reset the domain xenstore connection if there could be any other concurrent activity on the connection that could confuse the guest kernel. So doing the reset during kernel bringup might be safest, there you can do it in the kernel before the whole xenbus subsystem is fully up. -- Keir > The only issue I havent figured out: > How to get the domid from within the kernel? > > Olaf > > diff -r 42edf1481c57 tools/xenstore/xenstored_domain.c > --- a/tools/xenstore/xenstored_domain.c > +++ b/tools/xenstore/xenstored_domain.c > @@ -326,7 +326,7 @@ void do_introduce(struct connection *con > return; > } > > - if (conn->id != 0 || !conn->can_write) { > + if (!conn->can_write) { > send_error(conn, EACCES); > return; > } > @@ -365,7 +365,7 @@ void do_introduce(struct connection *con > talloc_steal(domain->conn, domain); > > fire_watches(NULL, "@introduceDomain", false); > - } else if ((domain->mfn == mfn) && (domain->conn != conn)) { > + } else if (domain->mfn == mfn) { > /* Use XS_INTRODUCE for recreating the xenbus event-channel. */ > if (domain->port) > xc_evtchn_unbind(xce_handle, domain->port); --B_3394733428_68223604 Content-type: application/octet-stream; name="00-xenstore-introduce" Content-disposition: attachment; filename="00-xenstore-introduce" Content-transfer-encoding: base64 ZGlmZiAtciAwZjM2YzJlZWMyZTEgdG9vbHMveGVuc3RvcmUveGVuc3RvcmVkX2RvbWFpbi5j Ci0tLSBhL3Rvb2xzL3hlbnN0b3JlL3hlbnN0b3JlZF9kb21haW4uYwlUaHUgSnVsIDI4IDE1 OjQwOjU0IDIwMTEgKzAxMDAKKysrIGIvdG9vbHMveGVuc3RvcmUveGVuc3RvcmVkX2RvbWFp bi5jCVRodSBKdWwgMjggMjE6MjY6NDkgMjAxMSArMDEwMApAQCAtMzI2LDcgKzMyNiw3IEBA IHZvaWQgZG9faW50cm9kdWNlKHN0cnVjdCBjb25uZWN0aW9uICpjb24KIAkJcmV0dXJuOwog CX0KIAotCWlmIChjb25uLT5pZCAhPSAwIHx8ICFjb25uLT5jYW5fd3JpdGUpIHsKKwlpZiAo IWNvbm4tPmNhbl93cml0ZSkgewogCQlzZW5kX2Vycm9yKGNvbm4sIEVBQ0NFUyk7CiAJCXJl dHVybjsKIAl9CkBAIC0zNDMsNyArMzQzLDE2IEBAIHZvaWQgZG9faW50cm9kdWNlKHN0cnVj dCBjb25uZWN0aW9uICpjb24KIAogCWRvbWFpbiA9IGZpbmRfZG9tYWluX2J5X2RvbWlkKGRv bWlkKTsKIAotCWlmIChkb21haW4gPT0gTlVMTCkgeworCWlmIChjb25uLT5pZCAhPSAwKSB7 CisJCWlmICgoZG9tYWluID09IE5VTEwpIHx8IChkb21haW4tPmNvbm4gIT0gY29ubikpIHsK KwkJCXNlbmRfZXJyb3IoY29ubiwgRUFDQ0VTKTsKKwkJCXJldHVybjsKKwkJfQorCQlpZiAo KGRvbWFpbi0+bWZuICE9IG1mbikgfHwgKGRvbWFpbi0+cmVtb3RlX3BvcnQgIT0gcG9ydCkp IHsKKwkJCXNlbmRfZXJyb3IoY29ubiwgRUlOVkFMKTsKKwkJCXJldHVybjsKKwkJfQorCX0g ZWxzZSBpZiAoZG9tYWluID09IE5VTEwpIHsKIAkJaW50ZXJmYWNlID0geGNfbWFwX2ZvcmVp Z25fcmFuZ2UoCiAJCQkqeGNfaGFuZGxlLCBkb21pZCwKIAkJCWdldHBhZ2VzaXplKCksIFBS T1RfUkVBRHxQUk9UX1dSSVRFLCBtZm4pOwo= --B_3394733428_68223604 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --B_3394733428_68223604--