xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Juergen Gross <jgross@suse.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
	Olaf Hering <olaf@aepfle.de>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	xen-devel@lists.xen.org
Subject: Re: [PATCH v4 1/3] libxc: do some retries in xc_cpupool_removecpu() for EBUSY case
Date: Tue, 12 Apr 2016 14:57:12 +0100	[thread overview]
Message-ID: <20160412135712.GE18652@citrix.com> (raw)
In-Reply-To: <570CFBE2.6060509@suse.com>

On Tue, Apr 12, 2016 at 03:45:06PM +0200, Juergen Gross wrote:
> On 12/04/16 15:02, Olaf Hering wrote:
> > On Thu, Mar 10, Juergen Gross wrote:
> > 
> >> +#define NUM_RMCPU_BUSY_RETRIES 5
> >> +
> >>  int xc_cpupool_removecpu(xc_interface *xch,
> >>                           uint32_t poolid,
> >>                           int cpu)
> >>  {
> >> +    unsigned retries;
> >> +    int err;
> >>      DECLARE_SYSCTL;
> >>  
> >>      sysctl.cmd = XEN_SYSCTL_cpupool_op;
> >>      sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_RMCPU;
> >>      sysctl.u.cpupool_op.cpupool_id = poolid;
> >>      sysctl.u.cpupool_op.cpu = (cpu < 0) ? XEN_SYSCTL_CPUPOOL_PAR_ANY : cpu;
> >> -    return do_sysctl_save(xch, &sysctl);
> >> +    for ( retries = 0; retries < NUM_RMCPU_BUSY_RETRIES; retries++ ) {
> >> +        err = do_sysctl_save(xch, &sysctl);
> >> +        if ( err < 0 && errno == EBUSY )
> >> +            sleep(1);
> >> +        else
> >> +            break;
> >> +    }
> >> +    return err;
> > 
> > This may fail with gcc-4.8, at least with -Og in 13.1:
> > 
> > [  105s] xc_cpupool.c: In function 'xc_cpupool_removecpu':
> > [  105s] xc_cpupool.c:168:5: error: 'err' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > [  105s]      return err;
> > [  105s]      ^
> 
> IMO this is a compiler bug. The compiler could detect easily that err
> can't be uninitialized at the return statement (e.g. via loop
> unrolling).
> 
> I can do a patch, of course. The question is whether I should. :-)
> 

You should -- and document that it is to make buggy compiler happy.
We've done this before.

Wei.

> 
> Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-04-12 13:57 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-10  5:27 [PATCH v4 0/3] add hypercall option to temporarily pin a vcpu Juergen Gross
2016-03-10  5:27 ` [PATCH v4 1/3] libxc: do some retries in xc_cpupool_removecpu() for EBUSY case Juergen Gross
2016-03-10 10:26   ` Dario Faggioli
2016-03-10 17:16   ` Wei Liu
2016-04-12 13:02   ` Olaf Hering
2016-04-12 13:45     ` Juergen Gross
2016-04-12 13:50       ` Olaf Hering
2016-04-12 13:57       ` Wei Liu [this message]
2016-04-14 16:04   ` Ian Jackson
2016-03-10  5:27 ` [PATCH v4 2/3] libxl: print message how to recover from xl cpupool-cpu-remove errors Juergen Gross
2016-04-14 16:06   ` Ian Jackson
2016-04-14 17:10     ` Dario Faggioli
2016-04-14 17:22       ` Ian Jackson
2016-04-14 17:27         ` Dario Faggioli
2016-03-10  5:27 ` [PATCH v4 3/3] libxl: add force option for xl vcpu-pin Juergen Gross
2016-03-10 10:25   ` Dario Faggioli
2016-03-10 17:17   ` Wei Liu
2016-04-14 16:10   ` Ian Jackson
2016-04-14 17:18     ` Dario Faggioli
2016-03-22  7:36 ` [PATCH v4 0/3] add hypercall option to temporarily pin a vcpu Juergen Gross
2016-03-24 14:03   ` Wei Liu
2016-03-24 17:58     ` Juergen Gross
2016-03-24 19:41       ` Wei Liu
2016-03-30 10:28         ` Juergen Gross
2016-03-30 14:23           ` Konrad Rzeszutek Wilk
2016-04-14 16:11             ` Ian Jackson
2016-04-14 19:15               ` 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=20160412135712.GE18652@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jgross@suse.com \
    --cc=olaf@aepfle.de \
    --cc=stefano.stabellini@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 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).