All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Tim Deegan <tim@xen.org>, Xen-devel <xen-devel@lists.xen.org>,
	Julien Grall <julien.grall@arm.com>
Subject: Re: [PATCH RFC] xen/vsprintf: Introduce %pd formatter for domains
Date: Thu, 30 Aug 2018 08:18:49 -0600	[thread overview]
Message-ID: <5B87FCC902000078001E38CD@prv1-mh.provo.novell.com> (raw)
In-Reply-To: <1535634403-27177-1-git-send-email-andrew.cooper3@citrix.com>

>>> On 30.08.18 at 15:06, <andrew.cooper3@citrix.com> wrote:
> This allows all system domids to be printed by name, rather than special
> casing the idle vcpus alone.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: George Dunlap <George.Dunlap@eu.citrix.com>
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Tim Deegan <tim@xen.org>
> CC: Wei Liu <wei.liu2@citrix.com>
> CC: Julien Grall <julien.grall@arm.com>
> 
> RFC, because this was proposed before but rejected at the time.  I'm looking
> to try and turn errors like this:
> 
>   (XEN) mm.c:1023:d0v2 pg_owner d32754 l1e_owner d0, but real_pg_owner d0
>   (XEN) mm.c:1099:d0v2 Error getting mfn 810020 (pfn 59db1) from L1 entry 8000000810020227 for l1e_owner d0, pg_owner d32754
> 
> into the slightly more helpful:
> 
>   (XEN) mm.c:1022:d0v2 pg_owner dXEN l1e_owner d0, but real_pg_owner d0
>   (XEN) mm.c:1098:d0v2 Error getting mfn 810020 (pfn 59db1) from L1 entry 8000000810020227 for l1e_owner d0, pg_owner dXEN
> 
> although even in this case, the former printk has an awkward corner case of a
> possibly NULL domain pointer, which can possibly only reasonably be fixed
> inside pointer() itself.

Or in print_domain(), producing "NULL".

> --- a/docs/misc/printk-formats.txt
> +++ b/docs/misc/printk-formats.txt
> @@ -28,5 +28,8 @@ Symbol/Function pointers:
>  
>  Domain and vCPU information:
>  
> +       %pd     Domain from a 'struct domain *d' (printed as d<domid>, but with
> +               system domains represented by name, e.g. 'dIDLE')

This looks a little awkward - how about d<IDLE> etc?

> --- a/xen/common/vsprintf.c
> +++ b/xen/common/vsprintf.c
> @@ -264,6 +264,41 @@ static char *string(char *str, char *end, const char *s,
>      return str;
>  }
>  
> +/* Print a domain as d<num> or d<str> for system domains. */
> +static char *print_domain(char *str, char *end, const struct domain *d)
> +{
> +    const char *name = NULL;
> +
> +    if ( str < end )
> +        *str++ = 'd';

I would guess you've copied this idiom from somewhere, and if so
it would be good to know where we still have got such broken
construct(s) left: The increment needs to happen outside of the
if(), for snprintf() et al to return a large enough number. See e.g.
string(). Perhaps best to do this like you do ...

> +static char *print_vcpu(char *str, char *end, const struct vcpu *v)
> +{
> +    str = print_domain(str, end, v->domain);
> +
> +    if ( str < end )
> +        *str = 'v';
> +
> +    return number(str + 1, end, v->vcpu_id, 10, -1, -1, 0);

... here.

Jan



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

  reply	other threads:[~2018-08-30 14:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-30 13:06 [PATCH RFC] xen/vsprintf: Introduce %pd formatter for domains Andrew Cooper
2018-08-30 14:18 ` Jan Beulich [this message]
2018-09-07 11:11   ` 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=5B87FCC902000078001E38CD@prv1-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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.