From: Wei Liu <wei.liu2@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: AndrewCooper <andrew.cooper3@citrix.com>,
Wei Liu <wei.liu2@citrix.com>,
Xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v3 1/3] xen: add warning infrastructure
Date: Thu, 23 Jun 2016 11:37:43 +0100 [thread overview]
Message-ID: <20160623103743.GL1790@citrix.com> (raw)
In-Reply-To: <576ACC7702000078000F7BF5@prv-mh.provo.novell.com>
On Wed, Jun 22, 2016 at 09:35:51AM -0600, Jan Beulich wrote:
> >>> On 20.06.16 at 18:30, <wei.liu2@citrix.com> wrote:
> > @@ -1582,6 +1583,8 @@ void __init noreturn __start_xen(unsigned long mbi_p)
> >
> > init_constructors();
> >
> > + warning_print();
> > +
> > console_endboot();
>
> What about an ARM equivalent? Perhaps put this in console_endboot()?
>
Fine with putting this in console_endboot.
> > --- a/xen/common/Makefile
> > +++ b/xen/common/Makefile
> > @@ -59,6 +59,7 @@ obj-y += vm_event.o
> > obj-y += vmap.o
> > obj-y += vsprintf.o
> > obj-y += wait.o
> > +obj-y += warning.o
>
> And perhaps better to put the new code into the console code too?
> In any event if you want to keep this in a separate file, considering
> that all of it is code/data contributions to .init.*, this wants to be
>
I will keep a separate file, and ...
> obj-bin-y += warning.init.o
>
... use this.
> so that namely string literals get moved to .init.* too.
>
> > --- /dev/null
> > +++ b/xen/common/warning.c
> > @@ -0,0 +1,50 @@
> > +#include <xen/delay.h>
> > +#include <xen/init.h>
> > +#include <xen/lib.h>
> > +#include <xen/softirq.h>
> > +#include <xen/warning.h>
> > +
> > +#define WARNING_ARRAY_SIZE 20
> > +static unsigned int __initdata nr_warnings;
> > +static const char __initdata *warnings[WARNING_ARRAY_SIZE];
>
> The __initdata belongs after the *.
>
Fixed.
> > +void __init warning_add(const char *warning)
> > +{
> > + if ( nr_warnings >= WARNING_ARRAY_SIZE )
> > + panic("Too many pieces of warning text.");
>
> panic() seems a bit harsh, but this shouldn't trigger anyway.
>
> > + warnings[nr_warnings] = warning;
> > + nr_warnings++;
> > +}
> > +
> > +void __init warning_print(void)
> > +{
> > + unsigned int i, j;
> > +
> > + if ( !nr_warnings )
> > + return;
>
> Perhaps a single instance of the ***** separators could be printed
> here ...
>
> > + for ( i = 0; i < nr_warnings; i++ )
> > + printk("%s", warnings[i]);
>
> ... and here, avoiding each caller to add such?
>
The warning text (multiple lines) is added as one single string, which
means we can't trivially add leading stars at the beginning of each
line.
I don't feel like arguing over how the text would look like, so if
something like:
************************************************
WARNING 1
************************************************
WARNING 2
************************************************
...
************************************************
WARNING N
************************************************
is ok to you, I'm fine with using that format, too.
Wei.
> Jan
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-06-23 10:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 16:30 [PATCH v3 0/3] Make hvm_fep available to non-debug build Wei Liu
2016-06-20 16:30 ` [PATCH v3 1/3] xen: add warning infrastructure Wei Liu
2016-06-22 15:35 ` Jan Beulich
2016-06-23 10:37 ` Wei Liu [this message]
2016-06-23 11:17 ` Wei Liu
2016-06-23 11:21 ` Andrew Cooper
2016-06-23 12:18 ` Jan Beulich
2016-06-20 16:30 ` [PATCH v3 2/3] console: use warning infrastructure for sync console warning Wei Liu
2016-06-22 15:37 ` Jan Beulich
2016-06-23 10:45 ` Wei Liu
2016-06-20 16:30 ` [PATCH v3 3/3] xen: make available hvm_fep to non-debug build as well Wei Liu
2016-06-22 15:42 ` Jan Beulich
2016-06-23 10:50 ` Wei Liu
2016-06-23 12:20 ` Jan Beulich
2016-06-23 12:44 ` Wei Liu
2016-06-23 12:48 ` Andrew Cooper
2016-06-23 12:50 ` Wei Liu
2016-06-23 13:05 ` Jan Beulich
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=20160623103743.GL1790@citrix.com \
--to=wei.liu2@citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@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.