mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Campbell <Ian.Campbell@citrix.com>
To: ANNIE LI <annie.li@oracle.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"konrad.wilk@oracle.com" <konrad.wilk@oracle.com>,
	"jeremy@goop.org" <jeremy@goop.org>,
	Paul Durrant <Paul.Durrant@citrix.com>,
	"kurt.hackel@oracle.com" <kurt.hackel@oracle.com>
Subject: Re: [PATCH 2/3] xen/granttable: Grant tables V2 implementation
Date: Fri, 18 Nov 2011 11:02:45 +0000	[thread overview]
Message-ID: <1321614166.3664.311.camel@zakaz.uk.xensource.com> (raw)
In-Reply-To: <4EC62FE5.2080608@oracle.com>

On Fri, 2011-11-18 at 10:13 +0000, ANNIE LI wrote:
> static void gnttab_request_version(void)
>  {
> -       grant_table_version = 1;
> -       gnttab_interface = &gnttab_v1_ops;
> +       int rc;
> +       struct gnttab_set_version gsv;
> +       const char *str = "we need grant tables version 2, but only version 1 is available\n";
> +
> +       gsv.version = 2;
> +       rc = HYPERVISOR_grant_table_op(GNTTABOP_set_version, &gsv, 1);
> +       if (rc == 0) {
> +               grant_table_version = 2;
> +               gnttab_interface = &gnttab_v2_ops;
> +       } else {
> +               if (grant_table_version == 2) {

	  } else if (...) {
		panic
	  } else {
		setup v1
	  }

> +                       /*
> +                        * If we've already used version 2 features,
> +                        * but then suddenly discover that they're not
> +                        * available (e.g. migrating to an older
> +                        * version of Xen), almost unbounded badness
> +                        * can happen.
> +                        */
> +                       xen_raw_printk(str);
> +                       panic(str);

I expect you've just copied this style from elsewhere but I really
dislike this duplication of prints. If panic is not useful here we
really ought to address that at the root instead of going around
patching things to print every panic message twice. I thought
earlyprintk was supposed to solve this problem. Perhaps a generic
early_panic_print could be added to the panic code?

If we stick with this (which is fair enough since it is outside the
scope of this series) you should move the const char *str into this code
block so it is near to the use.

> +               }
> +               grant_table_version = 1;
> +               gnttab_interface = &gnttab_v1_ops;
> +       }
>         printk(KERN_INFO "Grant tables using version %d layout.\n",
>                 grant_table_version);
>  } 


  reply	other threads:[~2011-11-18 11:02 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4EC3B62F.6080702@oracle.com>
2011-11-16 13:23 ` [Xen-devel] Improved patches of upstreaming grant table version 2 annie li
2011-11-16 13:48 ` [PATCH 1/3] xen/granttable: Introducing grant table V2 stucture annie.li
2011-11-17 10:35   ` Ian Campbell
     [not found]     ` <4EC53119.7060307@oracle.com>
2011-11-17 16:29       ` Konrad Rzeszutek Wilk
2011-11-18  3:08         ` [Xen-devel] " ANNIE LI
2011-11-17 16:55       ` Ian Campbell
2011-11-18 10:07   ` [Xen-devel] " ANNIE LI
2011-11-18 10:54     ` Ian Campbell
     [not found]       ` <4EC6818B.3010904@oracle.com>
2011-11-18 16:04         ` Ian Campbell
2011-11-21  9:51           ` ANNIE LI
2011-11-21 10:36             ` Ian Campbell
2011-11-16 13:49 ` [PATCH 2/3] xen/granttable: Grant tables V2 implementation annie.li
2011-11-18 10:13   ` ANNIE LI
2011-11-18 11:02     ` Ian Campbell [this message]
2011-11-18 13:52       ` [Xen-devel] " Konrad Rzeszutek Wilk
2011-11-18 14:00         ` Ian Campbell
2011-11-18 16:10           ` annie li
2011-11-18 18:05             ` Konrad Rzeszutek Wilk
2011-11-19  3:36               ` annie li
2011-11-21  9:51               ` ANNIE LI
2011-11-21 10:35                 ` Ian Campbell
2011-11-21 11:42                   ` annie li
2011-11-16 13:50 ` [PATCH 3/3] xen/granttable: Keep code format clean annie.li
2011-11-18 10:16   ` ANNIE LI

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=1321614166.3664.311.camel@zakaz.uk.xensource.com \
    --to=ian.campbell@citrix.com \
    --cc=Paul.Durrant@citrix.com \
    --cc=annie.li@oracle.com \
    --cc=jeremy@goop.org \
    --cc=konrad.wilk@oracle.com \
    --cc=kurt.hackel@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xen-devel@lists.xensource.com \
    /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

all inboxes | Powered by JetHome®