From: Juergen Gross <jgross@suse.com>
To: Dario Faggioli <dario.faggioli@citrix.com>, xen-devel@lists.xen.org
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
Wei Liu <wei.liu2@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: [PATCH v3 4/6] libxc: do some retries in xc_cpupool_removecpu() for EBUSY case
Date: Tue, 8 Mar 2016 17:12:37 +0100 [thread overview]
Message-ID: <56DEF9F5.6060709@suse.com> (raw)
In-Reply-To: <1457442992.3102.210.camel@citrix.com>
On 08/03/16 14:16, Dario Faggioli wrote:
> On Thu, 2016-03-03 at 17:48 +0100, Juergen Gross wrote:
>> The hypervisor might return EBUSY when trying to remove a cpu from a
>> cpupool when a domain running in this cpupool has pinned a vcpu
>> temporarily. Do some retries in this case, perhaps the situation
>> cleans up.
>>
> I now I'm at high risk of being called nitpicker (or, more likely, much
> worse names), but I think that:
>
>> --- a/tools/libxc/xc_cpupool.c
>> +++ b/tools/libxc/xc_cpupool.c
>> @@ -20,8 +20,11 @@
>> */
>>
>> #include <stdarg.h>
>> +#include <unistd.h>
>> #include "xc_private.h"
>>
>> +#define LIBXC_BUSY_RETRIES 5
>> +
> This name makes me think about something which wants to be more generic
> than it is actually the case... Like some number of retries that libxc
> does in general, while it's only applicable to a very specific cpupool
> operation.
>
> Just something like CPUPOOL_NUM_REMOVECPU_RETRIES (or, maybe, even
> without the CPUPOOL_ prefix, as we're already inside cpupool.c) would
> be more appropriate.
>
> I'd also define it closer to xc_cpupool_removecpu() (but that is a lot
> about personal taste, I guess) and would add a brief comment
> (basically, a summary of what's in the changelog already), if only to
> save people having to go through `git blame'.
>
>> @@ -141,13 +144,21 @@ 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 < LIBXC_BUSY_RETRIES; retries++ ) {
>> + err = do_sysctl_save(xch, &sysctl);
>> + if ( err >= 0 || errno != EBUSY )
>> + break;
>> + sleep(1);
>> + }
>>
> Doing this the other way round (basically, exactly as the same thing is
> done in do_sysctl_save() already), reads, IMHO, more natural:
>
> for (...) {
> err = do_sysctl_save(..);
> if ( err < 0 && errno == EBUSY )
> sleep(1);
> else
> break;
> }
>
> But yeah, this really is nitpicking. :-)
Nevertheless I can do it. Need to respin anyway.
Juergen
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-03-08 16:12 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-03 16:48 [PATCH v3 0/6] add hypercall option to temporarily pin a vcpu Juergen Gross
2016-03-03 16:48 ` [PATCH v3 1/6] xen, cpupool: correct error handling when removing cpu from cpupool Juergen Gross
2016-03-04 9:42 ` Jan Beulich
[not found] ` <56D9668602000078000D9400@suse.com>
2016-03-04 9:54 ` Juergen Gross
2016-03-04 10:03 ` Jan Beulich
2016-03-08 10:46 ` Dario Faggioli
2016-03-03 16:48 ` [PATCH v3 2/6] xen: add hypercall option to override and restore vcpu affinity Juergen Gross
2016-03-04 9:44 ` Jan Beulich
2016-03-08 11:45 ` Dario Faggioli
2016-03-03 16:48 ` [PATCH v3 3/6] xen: add force flag to xen_domctl_vcpuaffinity for undoing pin override Juergen Gross
2016-03-04 9:45 ` Jan Beulich
2016-03-03 16:48 ` [PATCH v3 4/6] libxc: do some retries in xc_cpupool_removecpu() for EBUSY case Juergen Gross
2016-03-08 13:16 ` Dario Faggioli
2016-03-08 16:12 ` Juergen Gross [this message]
2016-03-03 16:48 ` [PATCH v3 5/6] libxl: print message how to recover from xl cpupool-cpu-remove errors Juergen Gross
2016-03-08 13:18 ` Dario Faggioli
2016-03-08 15:58 ` Wei Liu
2016-03-03 16:48 ` [PATCH v3 6/6] libxl: add force option for xl vcpu-pin Juergen Gross
2016-03-08 13:29 ` Dario Faggioli
2016-03-08 15:58 ` Wei Liu
2016-03-08 16:11 ` Juergen Gross
2016-03-08 17:16 ` Dario Faggioli
2016-03-08 17:19 ` Juergen Gross
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=56DEF9F5.6060709@suse.com \
--to=jgross@suse.com \
--cc=dario.faggioli@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--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 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).