Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
xen.5854
592fd5f0-stop_machine-fill-result-only-in-case-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 592fd5f0-stop_machine-fill-result-only-in-case-of-error.patch of Package xen.5854
# Commit d8b833d78f6bfde9855a949b5e6d3790d78c0fb7 # Date 2017-06-01 10:53:04 +0200 # Author Gregory Herrero <gregory.herrero@oracle.com> # Committer Jan Beulich <jbeulich@suse.com> stop_machine: fill fn_result only in case of error When stop_machine_run() is called with NR_CPUS as last argument, fn_result member must be filled only if an error happens since it is shared across all cpus. Assume CPU1 detects an error and set fn_result to -1, then CPU2 doesn't detect an error and set fn_result to 0. The error detected by CPU1 will be ignored. Note that in case multiple failures occur on different CPUs, only the last error will be reported. Signed-off-by: Gregory Herrero <gregory.herrero@oracle.com> Reviewed-by: Wei Liu <wei.liu2@citrix.com> --- a/xen/common/stop_machine.c +++ b/xen/common/stop_machine.c @@ -96,6 +96,7 @@ int stop_machine_run(int (*fn)(void *), stopmachine_data.fn_data = data; stopmachine_data.nr_cpus = nr_cpus; stopmachine_data.fn_cpu = cpu; + stopmachine_data.fn_result = 0; atomic_set(&stopmachine_data.done, 0); stopmachine_data.state = STOPMACHINE_START; @@ -114,7 +115,11 @@ int stop_machine_run(int (*fn)(void *), stopmachine_set_state(STOPMACHINE_INVOKE); if ( (cpu == smp_processor_id()) || (cpu == NR_CPUS) ) - stopmachine_data.fn_result = (*fn)(data); + { + ret = (*fn)(data); + if ( ret ) + write_atomic(&stopmachine_data.fn_result, ret); + } stopmachine_wait_state(); ret = stopmachine_data.fn_result; @@ -152,8 +157,12 @@ static void stopmachine_action(unsigned case STOPMACHINE_INVOKE: if ( (stopmachine_data.fn_cpu == smp_processor_id()) || (stopmachine_data.fn_cpu == NR_CPUS) ) - stopmachine_data.fn_result = - stopmachine_data.fn(stopmachine_data.fn_data); + { + int ret = stopmachine_data.fn(stopmachine_data.fn_data); + + if ( ret ) + write_atomic(&stopmachine_data.fn_result, ret); + } break; default: break;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor