All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH 2/3] libxl: Change claim_mode from bool to int.
Date: Thu, 9 May 2013 09:23:00 -0400	[thread overview]
Message-ID: <20130509132300.GE7945@konrad-lan.dumpdata.com> (raw)
In-Reply-To: <1368087000.17285.84.camel@zakaz.uk.xensource.com>

On Thu, May 09, 2013 at 09:10:00AM +0100, Ian Campbell wrote:
> On Wed, 2013-05-08 at 19:35 +0100, Konrad Rzeszutek Wilk wrote:
> > During the review it was noticed that it would be better if internally
> > the claim_mode was held as an 'int' instead of a 'bool'. The reason
> > is that during the startup of xl, one has call the libxl_defbool_setdefault.
> > otherwise any usage of claim_mode would result in assert break.
> > 
> > The assert is due to the fact that using defbool without any set
> > values (either true of false) will cause it hit an assertion.
> > 
> > If we use an 'int' we don't have to worry about it and by default
> > the value of zero will suffice for checks whether the claim is
> > enabled or disabled.
> 
> In <1366102243.8399.118.camel@zakaz.uk.xensource.com> I mentioned that
> it doesn't seem correct that this is a libxl_domain_build_info setting
> at all, in that thread you said that claim was a host global setting not
> a per domain one.
> 
> Perhaps we want to consider moving claim_mode from
> libxl_domain_build_info to e.g. libxl_ctx now to save us some API churn
> in the future? Oh, except libxl_ctx is opaque to the callers of libxl so
> it's not much use and we're therefore back to having to add APIs to
> expose these settings and all the faff.
> 
> OK, so I think I've convinced myself that this patch is OK for 4.3
> (modulo the comment below on the libxl_create.c change) and we can have
> a rethink about libxl default handling for 4.4. Keeping the libxl
> interface for claim as a defbool in build_info will facilitate us
> implementing this rethink since it effectively then becomes a per-domain
> override of the host global setting, so it doesn't paint us into too
> much of a corner.
> 
> > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > ---
> >  tools/libxl/libxl_create.c |    2 --
> >  tools/libxl/xl.c           |    6 +++---
> >  tools/libxl/xl.h           |    2 +-
> >  tools/libxl/xl_cmdimpl.c   |    6 +++---
> >  4 files changed, 7 insertions(+), 9 deletions(-)
> > 
> > diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> > index cb9c822..c116186 100644
> > --- a/tools/libxl/libxl_create.c
> > +++ b/tools/libxl/libxl_create.c
> > @@ -202,8 +202,6 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
> >      if (b_info->target_memkb == LIBXL_MEMKB_DEFAULT)
> >          b_info->target_memkb = b_info->max_memkb;
> >  
> > -    libxl_defbool_setdefault(&b_info->claim_mode, false);
> 
> This line should stay, since it allows callers of libxl to not care
> about claim if they don't want to (xl does, others may not).
> 
> > diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> > index 5259b2e..76ee33a 100644
> > --- a/tools/libxl/xl_cmdimpl.c
> > +++ b/tools/libxl/xl_cmdimpl.c
> > @@ -734,7 +734,7 @@ static void parse_config_data(const char *config_source,
> >      if (!xlu_cfg_get_long (config, "maxmem", &l, 0))
> >          b_info->max_memkb = l * 1024;
> >  
> > -    b_info->claim_mode = claim_mode;
> > +    libxl_defbool_set(&b_info->claim_mode, claim_mode);
> >  
> >      if (xlu_cfg_get_string (config, "on_poweroff", &buf, 0))
> >          buf = "destroy";
> > @@ -4607,7 +4607,7 @@ static void output_physinfo(void)
> >      /*
> >       * Only if enabled (claim_mode=1) or there are outstanding claims.
> >       */
> > -    if (libxl_defbool_val(claim_mode) || info.outstanding_pages)
> > +    if (claim_mode || info.outstanding_pages)
> >          printf("outstanding_claims     : %ld\n", info.outstanding_pages / i);
> 
> There wouldn't seem to be much harm in printing this unconditionally, it
> would print 0 if claim mode was disabled, which is ok.

OK, making the change.
> 
> >  
> >      if (!libxl_get_freecpus(ctx, &cpumap)) {
> > @@ -5911,7 +5911,7 @@ int main_claims(int argc, char **argv)
> >          /* No options */
> >      }
> >  
> > -    if (!libxl_defbool_val(claim_mode))
> > +    if (!claim_mode)
> >          fprintf(stderr, "claim_mode not enabled (see man xl.conf).\n");
> 
> You don't exit here? Like above I think it would be actually OK for it
> to just list the domains with claims of zero.

Ian Jackson during the review suggested that it just print that warning
and continue on. And now that I am using I actually like the warning. It
reminds me that I forgot to enable or disable it.

> 
> FWIW It occurs to me now that this could have just been "xl list
> --claims/-c", but it's there now.

I can certainly try to redo it. I think I tried it two weeks ago and ran
in the trouble of having to modify a bunch of extra print_* functions to
have the extra claim information. And also not being sure how to expose
it via the JSON or sxp. So I choose the less invasive method as it was
close to the feature freeze (or already past it).

I can certainly rework this for Xen 4.4 ? Or for Xen 4.3 if you think
that George would be OK with that.
> 
> (those last three comments are a bit orthogonal to the actual patch...)

> 
> Ian.
> 

  reply	other threads:[~2013-05-09 13:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-08 18:35 [PATCH 1/3] xen/tools: Remove the XENMEM_get_oustanding_pages and provide the data via xc_phys_info Konrad Rzeszutek Wilk
2013-05-08 18:35 ` [PATCH 2/3] libxl: Change claim_mode from bool to int Konrad Rzeszutek Wilk
2013-05-09  8:10   ` Ian Campbell
2013-05-09 13:23     ` Konrad Rzeszutek Wilk [this message]
2013-05-09 13:40       ` Ian Campbell
2013-05-08 18:35 ` [PATCH 3/3] MAINTAINERS: Change tmem maintainer Konrad Rzeszutek Wilk
2013-05-09  8:25   ` Ian Campbell
2013-05-09  7:44 ` [PATCH 1/3] xen/tools: Remove the XENMEM_get_oustanding_pages and provide the data via xc_phys_info Ian Campbell
2013-05-09 11:16   ` Tim Deegan
2013-05-10  8:38   ` Jan Beulich
2013-05-10 13:58     ` Keir Fraser
2013-05-09 13:02 ` Daniel De Graaf
2013-05-10 19:18   ` Konrad Rzeszutek Wilk

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=20130509132300.GE7945@konrad-lan.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.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.