[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v4 1/3] libxc: do some retries in xc_cpupool_removecpu() for EBUSY case



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. :-)


Juergen

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.