xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Jürgen Groß" <jgross@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	xen-devel@lists.xenproject.org
Cc: Ian Jackson <ian.jackson@eu.citrix.com>, Wei Liu <wl@xen.org>
Subject: Re: [Xen-devel] [PATCH 1/3] xenstore: setup xenstore stubdom console interface properly
Date: Wed, 12 Feb 2020 06:31:41 +0100	[thread overview]
Message-ID: <0922fc5d-9033-30d0-cf14-191a4ab09635@suse.com> (raw)
In-Reply-To: <6c49ac2f-fb4f-dd40-d916-a8a6f7e6272e@citrix.com>

On 11.02.20 21:18, Andrew Cooper wrote:
> On 28/01/2020 14:28, Juergen Gross wrote:
>> In order to be able to get access to the console of Xenstore stubdom
>> we need an appropriate granttab entry. So call xc_dom_gnttab_init()
>> when constructing the domain and preset some information needed
>> for that function in the dom structure.
>>
>> We need to create the event channel for the console, too. Do that and
>> store all necessary data locally.
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>> ---
>>   tools/helpers/init-xenstore-domain.c | 13 +++++++++++++
>>   1 file changed, 13 insertions(+)
>>
>> diff --git a/tools/helpers/init-xenstore-domain.c b/tools/helpers/init-xenstore-domain.c
>> index adb8408b63..a312bc38b8 100644
>> --- a/tools/helpers/init-xenstore-domain.c
>> +++ b/tools/helpers/init-xenstore-domain.c
>> @@ -24,6 +24,8 @@ static char *param;
>>   static char *name = "Xenstore";
>>   static int memory;
>>   static int maxmem;
>> +static xen_pfn_t console_mfn;
>> +static unsigned int console_evtchn;
>>   
>>   static struct option options[] = {
>>       { "kernel", 1, NULL, 'k' },
>> @@ -113,6 +115,7 @@ static int build(xc_interface *xch)
>>           fprintf(stderr, "xc_domain_setmaxmem failed\n");
>>           goto err;
>>       }
>> +    console_evtchn = xc_evtchn_alloc_unbound(xch, domid, 0);
> 
> Presumably some form of error checking?

Yes.

> 
> Also, while it is probably fine for now, I think this does highlight a
> future issue.  What happens when xenconsoled is also a stubdomain?
> 
> I suspect we have a looming chicken&egg problem, where the toolstack is
> going to have to do some careful domid and plumbing to set up build both
> stubdoms in tandem.

Hmm, I'd rather defer console setup in xenstore-stubdom then and do it
later via a XS_CONTROL message. This will even enable a restart of
console-stubdom.

> 
>>       rv = xc_domain_set_memmap_limit(xch, domid, limit_kb);
>>       if ( rv )
>>       {
>> @@ -133,6 +136,9 @@ static int build(xc_interface *xch)
>>           snprintf(cmdline, 512, "--event %d --internal-db", rv);
>>   
>>       dom = xc_dom_allocate(xch, cmdline, NULL);
> 
> Any chance of some error handling, unlikely as it is to go wrong?

Okay.

> 
>> +    dom->container_type = XC_DOM_PV_CONTAINER;
>> +    dom->xenstore_domid = domid;
>> +    dom->console_evtchn = console_evtchn;
> 
> and a newline here?

Okay.

> 
>>       rv = xc_dom_kernel_file(dom, kernel);
>>       if ( rv )
>>       {
>> @@ -186,6 +192,12 @@ static int build(xc_interface *xch)
>>           fprintf(stderr, "xc_dom_boot_image failed\n");
>>           goto err;
>>       }
>> +    rv = xc_dom_gnttab_init(dom);
>> +    if ( rv )
>> +    {
>> +        fprintf(stderr, "xc_dom_gnttab_init failed\n");
>> +        goto err;
>> +    }
>>   
>>       rv = xc_domain_set_virq_handler(xch, domid, VIRQ_DOM_EXC);
>>       if ( rv )
>> @@ -201,6 +213,7 @@ static int build(xc_interface *xch)
>>       }
>>   
>>       rv = 0;
>> +    console_mfn = xc_dom_p2m(dom, dom->console_pfn);
> 
> This doesn't appear to be used.

Oh, the usage is in patch 2. Probably I should move this addition to
that patch then.


Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2020-02-12  5:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-28 14:28 [Xen-devel] [PATCH 0/3] tools/xenstore Juergen Gross
2020-01-28 14:28 ` [Xen-devel] [PATCH 1/3] xenstore: setup xenstore stubdom console interface properly Juergen Gross
2020-02-11 20:18   ` Andrew Cooper
2020-02-12  5:31     ` Jürgen Groß [this message]
2020-01-28 14:28 ` [Xen-devel] [PATCH 2/3] xenstore: add console xenstore entries for xenstore stubdom Juergen Gross
2020-02-11 20:25   ` Andrew Cooper
2020-02-12  5:34     ` Jürgen Groß
2020-01-28 14:28 ` [Xen-devel] [PATCH 3/3] xenstore: remove not applicable control commands in stubdom Juergen Gross
2020-02-11 20:26   ` Andrew Cooper
2020-02-11 15:39 ` [Xen-devel] [PATCH 0/3] tools/xenstore Jürgen Groß

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=0922fc5d-9033-30d0-cf14-191a4ab09635@suse.com \
    --to=jgross@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=wl@xen.org \
    --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 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).