[pm:idle-tick 5/8] include/linux/tick.h:143:1: warning: no return statement in function returning non-void
by kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git idle-tick
head: 8ea6e4458a59dc0edcd43078fd8bc7c8d2c649ff
commit: 9ae50b1e0f7653cb22718b353dbd435cb3cd64cc [5/8] cpuidle: Return nohz hint from cpuidle_select()
config: x86_64-randconfig-x010-201811 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
git checkout 9ae50b1e0f7653cb22718b353dbd435cb3cd64cc
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
In file included from drivers/acpi/processor_idle.c:32:0:
include/linux/tick.h: In function 'tick_nohz_idle_got_tick':
>> include/linux/tick.h:143:1: warning: no return statement in function returning non-void [-Wreturn-type]
static inline bool tick_nohz_idle_got_tick(void) { }
^~~~~~
--
In file included from drivers/cpuidle/governors/menu.c:19:0:
include/linux/tick.h: In function 'tick_nohz_idle_got_tick':
>> include/linux/tick.h:143:1: warning: no return statement in function returning non-void [-Wreturn-type]
static inline bool tick_nohz_idle_got_tick(void) { }
^~~~~~
drivers/cpuidle/governors/menu.c: In function 'menu_select':
>> drivers/cpuidle/governors/menu.c:503:40: warning: 'measured_us' may be used uninitialized in this function [-Wmaybe-uninitialized]
data->intervals[data->interval_ptr++] = measured_us;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
drivers/cpuidle/governors/menu.c:434:15: note: 'measured_us' was declared here
unsigned int measured_us;
^~~~~~~~~~~
--
In file included from drivers//cpuidle/governors/menu.c:19:0:
include/linux/tick.h: In function 'tick_nohz_idle_got_tick':
>> include/linux/tick.h:143:1: warning: no return statement in function returning non-void [-Wreturn-type]
static inline bool tick_nohz_idle_got_tick(void) { }
^~~~~~
drivers//cpuidle/governors/menu.c: In function 'menu_select':
drivers//cpuidle/governors/menu.c:503:40: warning: 'measured_us' may be used uninitialized in this function [-Wmaybe-uninitialized]
data->intervals[data->interval_ptr++] = measured_us;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
drivers//cpuidle/governors/menu.c:434:15: note: 'measured_us' was declared here
unsigned int measured_us;
^~~~~~~~~~~
vim +143 include/linux/tick.h
135
136 #else /* !CONFIG_NO_HZ_COMMON */
137 #define tick_nohz_enabled (0)
138 static inline int tick_nohz_tick_stopped(void) { return 0; }
139 static inline void tick_nohz_idle_stop_tick(void) { }
140 static inline void tick_nohz_idle_restart_tick(void) { }
141 static inline void tick_nohz_idle_enter(void) { }
142 static inline void tick_nohz_idle_exit(void) { }
> 143 static inline bool tick_nohz_idle_got_tick(void) { }
144
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
4 years, 1 month
Re: [Devel] [PATCH v3] xen/acpi: upload _PSD info for non Dom0 CPUs too
by Rafael J. Wysocki
On Fri, Mar 16, 2018 at 2:57 PM, Joao Martins <joao.m.martins(a)oracle.com> wrote:
> On 03/15/2018 03:45 PM, Boris Ostrovsky wrote:
>> On 03/15/2018 10:22 AM, Joao Martins wrote:
>>> All uploaded PM data from non-dom0 CPUs takes the info from vCPU 0 and
>>> changing only the acpi_id. For processors which P-state coordination type
>>> is HW_ALL (0xFD) it is OK to upload bogus P-state dependency information
>>> (_PSD), because Xen will ignore any cpufreq domains created for past CPUs.
>>>
>>> Albeit for platforms which expose coordination types as SW_ANY or SW_ALL,
>>> this will have some unintended side effects. Effectively, it will look at
>>> the P-state domain existence and *if it already exists* it will skip the
>>> acpi-cpufreq initialization and thus inherit the policy from the first CPU
>>> in the cpufreq domain. This will finally lead to the original cpu not
>>> changing target freq to P0 other than the first in the domain. Which will
>>> make turbo boost not getting enabled (e.g. for 'performance' governor) for
>>> all cpus.
>>>
>>> This patch fixes that, by also evaluating _PSD when we enumerate all ACPI
>>> processors and thus always uploading the correct info to Xen. We export
>>> acpi_processor_get_psd() for that this purpose, but change signature
>>> to not assume an existent of acpi_processor given that ACPI isn't creating
>>> an acpi_processor for non-dom0 CPUs.
>>>
>>> Signed-off-by: Joao Martins <joao.m.martins(a)oracle.com>
>>
>> Reviewed-by: Boris Ostrovsky <boris.ostrovsky(a)oracle.com>
>>
> Thanks!
>
> I suppose what's remaining is review (or ack) from ACPI folks on the interface
> changes made to acpi_processor_get_psd().
There you go:
Acked-by: Rafael J. Wysocki <rafael.j.wysocki(a)intel.com>
Do you want to route this via Xen?
4 years, 2 months
[pm:idle-tick 6/7] drivers/cpuidle//governors/menu.c:317:36: error: too many arguments to function 'tick_nohz_get_sleep_length'
by kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git idle-tick
head: 40331e907dcafa83382cdda585d9bf5a9e6b8a67
commit: e5233f0d22c78a47563c9c49d2ee4fe836772899 [6/7] cpuidle: menu: Refine idle state selection for running tick
config: x86_64-randconfig-h0-03200551 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
git checkout e5233f0d22c78a47563c9c49d2ee4fe836772899
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
drivers/cpuidle//governors/menu.c: In function 'menu_select':
>> drivers/cpuidle//governors/menu.c:317:36: error: too many arguments to function 'tick_nohz_get_sleep_length'
data->next_timer_us = ktime_to_us(tick_nohz_get_sleep_length(&tick_time));
^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/cpuidle//governors/menu.c:19:0:
include/linux/tick.h:145:23: note: declared here
static inline ktime_t tick_nohz_get_sleep_length(void)
^~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/tick_nohz_get_sleep_length +317 drivers/cpuidle//governors/menu.c
279
280 /**
281 * menu_select - selects the next idle state to enter
282 * @drv: cpuidle driver containing state data
283 * @dev: the CPU
284 * @nohz_ret: indication on whether or not to stop the tick
285 */
286 static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
287 bool *nohz_ret)
288 {
289 struct menu_device *data = this_cpu_ptr(&menu_devices);
290 struct device *device = get_cpu_device(dev->cpu);
291 int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY);
292 int i;
293 int first_idx;
294 int idx;
295 unsigned int interactivity_req;
296 unsigned int expected_interval;
297 unsigned long nr_iowaiters, cpu_load;
298 int resume_latency = dev_pm_qos_raw_read_value(device);
299 ktime_t tick_time;
300
301 if (data->needs_update) {
302 menu_update(drv, dev);
303 data->needs_update = 0;
304 }
305
306 if (resume_latency < latency_req &&
307 resume_latency != PM_QOS_RESUME_LATENCY_NO_CONSTRAINT)
308 latency_req = resume_latency;
309
310 /* Special case when user has set very strict latency requirement */
311 if (unlikely(latency_req == 0)) {
312 *nohz_ret = false;
313 return 0;
314 }
315
316 /* determine the expected residency time, round up */
> 317 data->next_timer_us = ktime_to_us(tick_nohz_get_sleep_length(&tick_time));
318
319 get_iowait_load(&nr_iowaiters, &cpu_load);
320 data->bucket = which_bucket(data->next_timer_us, nr_iowaiters);
321
322 /*
323 * Force the result of multiplication to be 64 bits even if both
324 * operands are 32 bits.
325 * Make sure to round up for half microseconds.
326 */
327 data->predicted_us = DIV_ROUND_CLOSEST_ULL((uint64_t)data->next_timer_us *
328 data->correction_factor[data->bucket],
329 RESOLUTION * DECAY);
330
331 expected_interval = get_typical_interval(data);
332 expected_interval = min(expected_interval, data->next_timer_us);
333
334 first_idx = 0;
335 if (drv->states[0].flags & CPUIDLE_FLAG_POLLING) {
336 struct cpuidle_state *s = &drv->states[1];
337 unsigned int polling_threshold;
338
339 /*
340 * We want to default to C1 (hlt), not to busy polling
341 * unless the timer is happening really really soon, or
342 * C1's exit latency exceeds the user configured limit.
343 */
344 polling_threshold = max_t(unsigned int, 20, s->target_residency);
345 if (data->next_timer_us > polling_threshold &&
346 latency_req > s->exit_latency && !s->disabled &&
347 !dev->states_usage[1].disable)
348 first_idx = 1;
349 }
350
351 /*
352 * Use the lowest expected idle interval to pick the idle state.
353 */
354 data->predicted_us = min(data->predicted_us, expected_interval);
355
356 /*
357 * Use the performance multiplier and the user-configurable
358 * latency_req to determine the maximum exit latency.
359 */
360 interactivity_req = data->predicted_us / performance_multiplier(nr_iowaiters, cpu_load);
361 if (latency_req > interactivity_req)
362 latency_req = interactivity_req;
363
364 expected_interval = TICK_USEC_HZ;
365 /*
366 * Find the idle state with the lowest power while satisfying
367 * our constraints.
368 */
369 idx = -1;
370 for (i = first_idx; i < drv->state_count; i++) {
371 struct cpuidle_state *s = &drv->states[i];
372 struct cpuidle_state_usage *su = &dev->states_usage[i];
373
374 if (s->disabled || su->disable)
375 continue;
376 if (idx == -1)
377 idx = i; /* first enabled state */
378 if (s->target_residency > data->predicted_us) {
379 /*
380 * Retain the tick if the selected state is shallower
381 * than the deepest available one with target residency
382 * within the tick period range.
383 *
384 * This allows the tick to be stopped even if the
385 * predicted idle duration is within the tick period
386 * range to counter the effect by which the prediction
387 * may be skewed towards lower values due to the tick
388 * bias.
389 */
390 expected_interval = s->target_residency;
391 break;
392 }
393 if (s->exit_latency > latency_req) {
394 /*
395 * If we break out of the loop for latency reasons,
396 * retain the tick unless the target residency of the
397 * selected state is too high.
398 */
399 expected_interval = drv->states[idx].target_residency;
400 break;
401 }
402 idx = i;
403 }
404
405 if (idx == -1)
406 idx = 0; /* No states enabled. Must use 0. */
407
408 /*
409 * Don't stop the tick if the selected state is a polling one or it is
410 * not deep enough.
411 */
412 if (drv->states[idx].flags & CPUIDLE_FLAG_POLLING) {
413 *nohz_ret = false;
414 } else if (expected_interval < TICK_USEC_HZ) {
415 *nohz_ret = false;
416
417 if (!tick_nohz_tick_stopped()) {
418 unsigned int tick_us = ktime_to_us(tick_time);
419
420 /*
421 * Because the tick is not going to be stopped, make
422 * sure that the target residency of the state to be
423 * returned is within the time to the next timer event
424 * including the tick.
425 */
426 while (idx > 0 &&
427 (drv->states[idx].target_residency > tick_us ||
428 drv->states[idx].disabled ||
429 dev->states_usage[idx].disable))
430 idx--;
431 }
432 }
433
434 data->last_state_idx = idx;
435
436 return data->last_state_idx;
437 }
438
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
4 years, 2 months
[pm:bleeding-edge 66/71] drivers/acpi/scan.c:130:81: sparse: incorrect type in argument 3 (different modifiers)
by kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
head: a9270e3c4bfe7b1b49da139186430d223f77a6f8
commit: 628c073bb72cd67c3fb34bee59683844bcf41752 [66/71] ACPI / scan: Send the change uevent with offine environmental data
reproduce:
# apt-get install sparse
git checkout 628c073bb72cd67c3fb34bee59683844bcf41752
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>)
>> drivers/acpi/scan.c:130:81: sparse: incorrect type in argument 3 (different modifiers) @@ expected char **envp @@ got char cchar **envp @@
drivers/acpi/scan.c:130:81: expected char **envp
drivers/acpi/scan.c:130:81: got char const **<noident>
drivers/acpi/scan.c: In function 'acpi_scan_is_offline':
drivers/acpi/scan.c:130:53: error: passing argument 3 of 'kobject_uevent_env' from incompatible pointer type [-Werror=incompatible-pointer-types]
kobject_uevent_env(&pn->dev->kobj, KOBJ_CHANGE, envp);
^~~~
In file included from include/linux/module.h:17:0,
from drivers/acpi/scan.c:5:
include/linux/kobject.h:219:5: note: expected 'char **' but argument is of type 'const char **'
int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +130 drivers/acpi/scan.c
35
36 static LIST_HEAD(acpi_dep_list);
37 static DEFINE_MUTEX(acpi_dep_list_lock);
38 LIST_HEAD(acpi_bus_id_list);
39 static DEFINE_MUTEX(acpi_scan_lock);
40 static LIST_HEAD(acpi_scan_handlers_list);
> 41 DEFINE_MUTEX(acpi_device_lock);
42 LIST_HEAD(acpi_wakeup_device_list);
43 static DEFINE_MUTEX(acpi_hp_context_lock);
44
45 /*
46 * The UART device described by the SPCR table is the only object which needs
47 * special-casing. Everything else is covered by ACPI namespace paths in STAO
48 * table.
49 */
50 static u64 spcr_uart_addr;
51
52 struct acpi_dep_data {
53 struct list_head node;
54 acpi_handle master;
55 acpi_handle slave;
56 };
57
58 void acpi_scan_lock_acquire(void)
59 {
60 mutex_lock(&acpi_scan_lock);
61 }
62 EXPORT_SYMBOL_GPL(acpi_scan_lock_acquire);
63
64 void acpi_scan_lock_release(void)
65 {
66 mutex_unlock(&acpi_scan_lock);
67 }
68 EXPORT_SYMBOL_GPL(acpi_scan_lock_release);
69
70 void acpi_lock_hp_context(void)
71 {
72 mutex_lock(&acpi_hp_context_lock);
73 }
74
75 void acpi_unlock_hp_context(void)
76 {
77 mutex_unlock(&acpi_hp_context_lock);
78 }
79
80 void acpi_initialize_hp_context(struct acpi_device *adev,
81 struct acpi_hotplug_context *hp,
82 int (*notify)(struct acpi_device *, u32),
83 void (*uevent)(struct acpi_device *, u32))
84 {
85 acpi_lock_hp_context();
86 hp->notify = notify;
87 hp->uevent = uevent;
88 acpi_set_hp_context(adev, hp);
89 acpi_unlock_hp_context();
90 }
91 EXPORT_SYMBOL_GPL(acpi_initialize_hp_context);
92
93 int acpi_scan_add_handler(struct acpi_scan_handler *handler)
94 {
95 if (!handler)
96 return -EINVAL;
97
98 list_add_tail(&handler->list_node, &acpi_scan_handlers_list);
99 return 0;
100 }
101
102 int acpi_scan_add_handler_with_hotplug(struct acpi_scan_handler *handler,
103 const char *hotplug_profile_name)
104 {
105 int error;
106
107 error = acpi_scan_add_handler(handler);
108 if (error)
109 return error;
110
111 acpi_sysfs_add_hotplug_profile(&handler->hotplug, hotplug_profile_name);
112 return 0;
113 }
114
115 bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent)
116 {
117 struct acpi_device_physical_node *pn;
118 bool offline = true;
119 static const char *envp[] = { "EVENT=offline", NULL };
120
121 /*
122 * acpi_container_offline() calls this for all of the container's
123 * children under the container's physical_node_lock lock.
124 */
125 mutex_lock_nested(&adev->physical_node_lock, SINGLE_DEPTH_NESTING);
126
127 list_for_each_entry(pn, &adev->physical_node_list, node)
128 if (device_supports_offline(pn->dev) && !pn->dev->offline) {
129 if (uevent)
> 130 kobject_uevent_env(&pn->dev->kobj, KOBJ_CHANGE, envp);
131
132 offline = false;
133 break;
134 }
135
136 mutex_unlock(&adev->physical_node_lock);
137 return offline;
138 }
139
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
4 years, 2 months
[pm:bleeding-edge 66/71] drivers/acpi/scan.c:130:53: error: passing argument 3 of 'kobject_uevent_env' from incompatible pointer type
by kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
head: a9270e3c4bfe7b1b49da139186430d223f77a6f8
commit: 628c073bb72cd67c3fb34bee59683844bcf41752 [66/71] ACPI / scan: Send the change uevent with offine environmental data
config: x86_64-randconfig-x014-201811 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
git checkout 628c073bb72cd67c3fb34bee59683844bcf41752
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
drivers/acpi/scan.c: In function 'acpi_scan_is_offline':
>> drivers/acpi/scan.c:130:53: error: passing argument 3 of 'kobject_uevent_env' from incompatible pointer type [-Werror=incompatible-pointer-types]
kobject_uevent_env(&pn->dev->kobj, KOBJ_CHANGE, envp);
^~~~
In file included from include/linux/module.h:17:0,
from drivers/acpi/scan.c:5:
include/linux/kobject.h:219:5: note: expected 'char **' but argument is of type 'const char **'
int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
^~~~~~~~~~~~~~~~~~
Cyclomatic Complexity 5 include/linux/compiler.h:__read_once_size
Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls64
Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u64
Cyclomatic Complexity 1 include/linux/list.h:INIT_LIST_HEAD
Cyclomatic Complexity 1 include/linux/list.h:__list_add_valid
Cyclomatic Complexity 1 include/linux/list.h:__list_del_entry_valid
Cyclomatic Complexity 2 include/linux/list.h:__list_add
Cyclomatic Complexity 1 include/linux/list.h:list_add_tail
Cyclomatic Complexity 1 include/linux/list.h:__list_del
Cyclomatic Complexity 2 include/linux/list.h:__list_del_entry
Cyclomatic Complexity 1 include/linux/list.h:list_del
Cyclomatic Complexity 1 include/linux/list.h:list_empty
Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order
Cyclomatic Complexity 1 include/linux/string.h:strnlen
Cyclomatic Complexity 4 include/linux/string.h:strlen
Cyclomatic Complexity 4 include/linux/string.h:memcpy
Cyclomatic Complexity 2 include/linux/string.h:strcpy
Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
Cyclomatic Complexity 1 include/linux/workqueue.h:__init_work
Cyclomatic Complexity 1 include/linux/kobject.h:kobject_name
Cyclomatic Complexity 28 include/linux/slab.h:kmalloc_index
Cyclomatic Complexity 1 include/linux/slab.h:kmem_cache_alloc_trace
Cyclomatic Complexity 1 include/linux/slab.h:kmalloc_order_trace
Cyclomatic Complexity 68 include/linux/slab.h:kmalloc_large
Cyclomatic Complexity 5 include/linux/slab.h:kmalloc
Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
Cyclomatic Complexity 1 include/linux/pm_wakeup.h:device_set_wakeup_capable
Cyclomatic Complexity 1 include/linux/pm_wakeup.h:device_set_wakeup_enable
Cyclomatic Complexity 1 include/linux/pm_wakeup.h:device_init_wakeup
Cyclomatic Complexity 2 include/linux/device.h:dev_name
Cyclomatic Complexity 1 include/linux/device.h:dev_set_uevent_suppress
Cyclomatic Complexity 4 include/linux/device.h:device_supports_offline
Cyclomatic Complexity 1 include/acpi/acpi_bus.h:acpi_set_device_status
Cyclomatic Complexity 1 include/acpi/acpi_bus.h:acpi_set_hp_context
Cyclomatic Complexity 3 include/acpi/acpi_bus.h:acpi_device_enumerated
Cyclomatic Complexity 1 include/linux/acpi.h:acpi_device_set_enumerated
Cyclomatic Complexity 1 include/linux/acpi.h:acpi_device_clear_enumerated
Cyclomatic Complexity 1 include/linux/acpi_iort.h:iort_dma_setup
Cyclomatic Complexity 1 include/linux/acpi_iort.h:iort_iommu_configure
Cyclomatic Complexity 1 include/linux/dmi.h:dmi_name_in_vendors
Cyclomatic Complexity 1 include/linux/dma-mapping.h:arch_setup_dma_ops
Cyclomatic Complexity 1 include/linux/dma-mapping.h:arch_teardown_dma_ops
Cyclomatic Complexity 1 drivers/acpi/internal.h:acpi_amba_init
Cyclomatic Complexity 1 drivers/acpi/internal.h:acpi_watchdog_init
Cyclomatic Complexity 2 drivers/acpi/scan.c:acpi_check_serial_bus_slave
Cyclomatic Complexity 4 drivers/acpi/scan.c:acpi_match_madt
Cyclomatic Complexity 4 drivers/acpi/scan.c:acpi_init_coherency
Cyclomatic Complexity 6 drivers/acpi/scan.c:acpi_get_device_data
Cyclomatic Complexity 2 drivers/acpi/scan.c:acpi_scan_drop_device
Cyclomatic Complexity 5 drivers/acpi/scan.c:acpi_scan_handler_matching
Cyclomatic Complexity 1 include/acpi/platform/aclinuxex.h:acpi_os_free
Cyclomatic Complexity 2 drivers/acpi/scan.c:get_acpi_device
Cyclomatic Complexity 5 drivers/acpi/scan.c:acpi_object_is_system_bus
Cyclomatic Complexity 5 drivers/acpi/scan.c:acpi_backlight_cap_match
Cyclomatic Complexity 5 drivers/acpi/scan.c:acpi_bus_get_flags
Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
Cyclomatic Complexity 7 drivers/acpi/scan.c:acpi_device_get_busid
Cyclomatic Complexity 7 drivers/acpi/scan.c:acpi_ibm_smbus_match
Cyclomatic Complexity 3 drivers/acpi/scan.c:acpi_add_id
Cyclomatic Complexity 5 drivers/acpi/scan.c:acpi_is_serial_bus_slave
Cyclomatic Complexity 5 drivers/acpi/scan.c:acpi_scan_match_handler
Cyclomatic Complexity 8 drivers/acpi/scan.c:acpi_scan_attach_handler
Cyclomatic Complexity 2 drivers/acpi/scan.c:acpi_default_enumeration
Cyclomatic Complexity 2 drivers/acpi/scan.c:acpi_generic_device_attach
Cyclomatic Complexity 5 drivers/acpi/scan.c:acpi_device_should_be_hidden
Cyclomatic Complexity 8 drivers/acpi/scan.c:acpi_bus_type_and_status
Cyclomatic Complexity 2 drivers/acpi/scan.c:acpi_get_resource_memory
Cyclomatic Complexity 10 drivers/acpi/scan.c:acpi_bus_init_power_state
Cyclomatic Complexity 9 drivers/acpi/scan.c:acpi_bus_get_power_flags
Cyclomatic Complexity 16 drivers/acpi/scan.c:acpi_bus_extract_wakeup_device_power_package
Cyclomatic Complexity 4 drivers/acpi/scan.c:acpi_free_power_resources_lists
Cyclomatic Complexity 4 drivers/acpi/scan.c:acpi_wakeup_gpe_init
Cyclomatic Complexity 6 drivers/acpi/scan.c:acpi_bus_get_wakeup_device_flags
Cyclomatic Complexity 9 drivers/acpi/scan.c:acpi_device_dep_initialize
Cyclomatic Complexity 2 drivers/acpi/scan.c:acpi_get_spcr_uart_addr
Cyclomatic Complexity 1 include/linux/workqueue.h:queue_work
Cyclomatic Complexity 1 include/linux/workqueue.h:schedule_work
Cyclomatic Complexity 1 drivers/acpi/scan.c:acpi_scan_lock_acquire
Cyclomatic Complexity 1 drivers/acpi/scan.c:acpi_scan_lock_release
Cyclomatic Complexity 1 drivers/acpi/scan.c:acpi_lock_hp_context
Cyclomatic Complexity 1 drivers/acpi/scan.c:acpi_unlock_hp_context
Cyclomatic Complexity 1 drivers/acpi/scan.c:acpi_initialize_hp_context
Cyclomatic Complexity 2 drivers/acpi/scan.c:acpi_scan_add_handler
Cyclomatic Complexity 2 drivers/acpi/scan.c:acpi_scan_add_handler_with_hotplug
Cyclomatic Complexity 7 drivers/acpi/scan.c:acpi_scan_is_offline
Cyclomatic Complexity 1 drivers/acpi/scan.c:acpi_bus_get_device
Cyclomatic Complexity 11 drivers/acpi/scan.c:acpi_bus_offline
Cyclomatic Complexity 6 drivers/acpi/scan.c:acpi_bus_online
Cyclomatic Complexity 5 drivers/acpi/scan.c:acpi_scan_try_to_offline
Cyclomatic Complexity 5 drivers/acpi/scan.c:acpi_bus_get_parent
Cyclomatic Complexity 1 drivers/acpi/scan.c:acpi_bus_get_acpi_device
Cyclomatic Complexity 1 drivers/acpi/scan.c:acpi_bus_put_acpi_device
vim +/kobject_uevent_env +130 drivers/acpi/scan.c
114
115 bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent)
116 {
117 struct acpi_device_physical_node *pn;
118 bool offline = true;
119 static const char *envp[] = { "EVENT=offline", NULL };
120
121 /*
122 * acpi_container_offline() calls this for all of the container's
123 * children under the container's physical_node_lock lock.
124 */
125 mutex_lock_nested(&adev->physical_node_lock, SINGLE_DEPTH_NESTING);
126
127 list_for_each_entry(pn, &adev->physical_node_list, node)
128 if (device_supports_offline(pn->dev) && !pn->dev->offline) {
129 if (uevent)
> 130 kobject_uevent_env(&pn->dev->kobj, KOBJ_CHANGE, envp);
131
132 offline = false;
133 break;
134 }
135
136 mutex_unlock(&adev->physical_node_lock);
137 return offline;
138 }
139
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
4 years, 2 months
[pm:bleeding-edge 66/71] drivers/acpi/scan.c:130:53: warning: passing argument 3 of 'kobject_uevent_env' from incompatible pointer type
by kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
head: a9270e3c4bfe7b1b49da139186430d223f77a6f8
commit: 628c073bb72cd67c3fb34bee59683844bcf41752 [66/71] ACPI / scan: Send the change uevent with offine environmental data
config: i386-randconfig-a0-201811 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
git checkout 628c073bb72cd67c3fb34bee59683844bcf41752
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
drivers/acpi/scan.c: In function 'acpi_scan_is_offline':
>> drivers/acpi/scan.c:130:53: warning: passing argument 3 of 'kobject_uevent_env' from incompatible pointer type
kobject_uevent_env(&pn->dev->kobj, KOBJ_CHANGE, envp);
^
In file included from include/linux/module.h:17:0,
from drivers/acpi/scan.c:5:
include/linux/kobject.h:219:5: note: expected 'char **' but argument is of type 'const char **'
int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
^
vim +/kobject_uevent_env +130 drivers/acpi/scan.c
114
115 bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent)
116 {
117 struct acpi_device_physical_node *pn;
118 bool offline = true;
119 static const char *envp[] = { "EVENT=offline", NULL };
120
121 /*
122 * acpi_container_offline() calls this for all of the container's
123 * children under the container's physical_node_lock lock.
124 */
125 mutex_lock_nested(&adev->physical_node_lock, SINGLE_DEPTH_NESTING);
126
127 list_for_each_entry(pn, &adev->physical_node_list, node)
128 if (device_supports_offline(pn->dev) && !pn->dev->offline) {
129 if (uevent)
> 130 kobject_uevent_env(&pn->dev->kobj, KOBJ_CHANGE, envp);
131
132 offline = false;
133 break;
134 }
135
136 mutex_unlock(&adev->physical_node_lock);
137 return offline;
138 }
139
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
4 years, 2 months
Re: [Devel] [PATCH v10 2/5] arm64: KVM: export the capability to set guest SError syndrome
by gengdongjiu
Hi James,
Thanks for your time to review and give comments.
[...]
> > +
> > +8.14 KVM_CAP_ARM_SET_SERROR_ESR
> > +
> > +Architectures: arm, arm64
> > +
> > +This capability indicates that userspace can specify syndrome value
> > +reported to guest OS when guest takes a virtual SError interrupt exception.
>
> "when userspace triggers a virtual SError"... how?
In the user space(QEMU), it will call kvm_arch_put_registers() or kvm_arch_get_registers() to set or get KVM registers through KVM_SET_ONE_REG/ KVM_GET_ONE_REG IOCTL, at the same time the two functions will separately call kvm_arm_vcpu_get_events() and kvm_arm_vcpu_set_events() to get/set vcpu events. If user space want to trigger a virtual SError with specified ESR, it only need to setup the kvm_vcpu_events struct(exception.serror_pending = 1; exception.serror_has_esr=1; serror_esr=xxxxx), then KVM will trigger this virtual SError.
userspace can trigger it at any time, for example, for debug purpose. Or simulate a SError after recording a CPER for guest. But before triggering a virtual SError, it needs to know whether KVM has such capability, so KVM needs to export this capability to user space. If has this capability, User space will call kvm_arm_vcpu_set_events() to trigger a virtual SError.
>
>
> > +If KVM has this capability, userspace can only specify the ISS field
> > +for the ESR syndrome, can not specify the EC field which is not under control by KVM.
>
> Where do I put the ESR?
> If you re-order this after the patch that adds the API, you can describe how this can be used.
Ok, thank a lot for your suggestion.
>
>
> Thanks,
>
> James
>
>
>
> > +If this virtual SError is taken to EL1 using AArch64, this value will
> > +be reported into ISS filed of ESR_EL1.
> > diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c index
> > 3256b92..38c8a64 100644
> > --- a/arch/arm64/kvm/reset.c
> > +++ b/arch/arm64/kvm/reset.c
> > @@ -77,6 +77,9 @@ int kvm_arch_dev_ioctl_check_extension(struct kvm *kvm, long ext)
> > case KVM_CAP_ARM_PMU_V3:
> > r = kvm_arm_support_pmu_v3();
> > break;
> > + case KVM_CAP_ARM_INJECT_SERROR_ESR:
> > + r = cpus_have_const_cap(ARM64_HAS_RAS_EXTN);
> > + break;
> > case KVM_CAP_SET_GUEST_DEBUG:
> > case KVM_CAP_VCPU_ATTRIBUTES:
> > r = 1;
> > diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index
> > 8fb90a0..3587b33 100644
> > --- a/include/uapi/linux/kvm.h
> > +++ b/include/uapi/linux/kvm.h
> > @@ -934,6 +934,7 @@ struct kvm_ppc_resize_hpt { #define
> > KVM_CAP_S390_AIS_MIGRATION 150 #define KVM_CAP_PPC_GET_CPU_CHAR 151
> > #define KVM_CAP_S390_BPB 152
> > +#define KVM_CAP_ARM_INJECT_SERROR_ESR 153
> >
> > #ifdef KVM_CAP_IRQ_ROUTING
> >
> >
4 years, 2 months
Re: [Devel] [PATCH v10 3/5] arm/arm64: KVM: Introduce set and get per-vcpu event
by gengdongjiu
Hi James,
Thanks for your review and good suggestion.
>
> Hi Dongjiu Geng,
>
> On 03/03/18 16:09, Dongjiu Geng wrote:
> > RAS Extension provides VSESR_EL2 register to specify virtual SError
> > syndrome value, this patch adds a new IOCTL to export user-invisible
> > states related to SError exceptions. User space can setup the
> > kvm_vcpu_events to inject specified SError, also it can support live
> > migration.
>
> > diff --git a/Documentation/virtual/kvm/api.txt
> > b/Documentation/virtual/kvm/api.txt
> > index 8a3d708..26ae151 100644
> > --- a/Documentation/virtual/kvm/api.txt
> > +++ b/Documentation/virtual/kvm/api.txt
> > @@ -819,11 +819,13 @@ struct kvm_clock_data {
> >
> > Capability: KVM_CAP_VCPU_EVENTS
> > Extended by: KVM_CAP_INTR_SHADOW
> > -Architectures: x86
> > +Architectures: x86, arm, arm64
> > Type: vm ioctl
> > Parameters: struct kvm_vcpu_event (out)
> > Returns: 0 on success, -1 on error
> >
> > +X86:
> > +
> > Gets currently pending exceptions, interrupts, and NMIs as well as
> > related states of the vcpu.
> >
> > @@ -865,15 +867,29 @@ Only two fields are defined in the flags field:
> > - KVM_VCPUEVENT_VALID_SMM may be set in the flags field to signal that
> > smi contains a valid state.
> >
> > +ARM, ARM64:
> > +
> > +Gets currently pending SError exceptions as well as related states of the vcpu.
> > +
> > +struct kvm_vcpu_events {
> > + struct {
> > + bool serror_pending;
> > + bool serror_has_esr;
> > + u64 serror_esr;
> > + } exception;
> > +};
>
> Don't put bool in an ABI struct. The encoding is up to the compiler.
> The compiler will insert padding in this struct to make serror_esr naturally aligned. Different compilers may do it differently. You'll see that
> the existing struct kvm_vcpu_events has 'pad' fields to ensure each element in the struct is naturally aligned.
I checked the exited x86 strut kvm_vcpu_events definition, it aligned to 32 bits, so how about using below kvm_vcpu_events struct definition for arm64?
struct kvm_vcpu_events {
struct {
__u8_8 serror_pending;
__u8 serror_has_esr;
__u8 pad[2];
__u64 serror_esr;
} exception;
};
>
> serror_pending and serror_has_esr need to be in a flags field.
How about this definition?
struct kvm_vcpu_events {
struct {
__u8_8 serror_pending;
__u8 serror_has_esr;
__u8 pad[2];
__u64 serror_esr;
} exception;
};
>
> I thought the logic for re-using the CAP was so user-space could re-use save/restore code to transfer whatever we put in here during
> migration. If the struct is a different size the code has to be different anyway.
> My understanding of Drew and Christoffer's comments was that we should re-use the existing struct. (but now that I look at it, its not so
> clear).
>
> (If we reuse the struct, we can put the esr in exception.error_code, if we can get away with it: It would be good to union exception up with
> a u64, then use that. This would let us transfer anything we need in those RES0 bits of the 64bit VSESR_EL2).
It seems Drew and Christoffer's comments suggested to use the KVM_GET/SET_VCPU_EVENTS ABI, not suggested arm64 must use the same struct
kvm_vcpu_events definition with x86.
>
>
> > 4.32 KVM_SET_VCPU_EVENTS
> >
> > Capability: KVM_CAP_VCPU_EVENTS
> > Extended by: KVM_CAP_INTR_SHADOW
> > -Architectures: x86
> > +Architectures: x86, arm, arm64
> > Type: vm ioctl
> > Parameters: struct kvm_vcpu_event (in)
> > Returns: 0 on success, -1 on error
> >
> > +X86:
> > +
> > Set pending exceptions, interrupts, and NMIs as well as related
> > states of the vcpu.
> >
> > @@ -894,6 +910,12 @@ shall be written into the VCPU.
> >
> > KVM_VCPUEVENT_VALID_SMM can only be set if KVM_CAP_X86_SMM is available.
> >
> > +ARM, ARM64:
> > +
> > +Set pending SError exceptions as well as related states of the vcpu.
> > +
> > +See KVM_GET_VCPU_EVENTS for the data structure.
> > +
> >
> > 4.33 KVM_GET_DEBUGREGS
> >
>
> > diff --git a/arch/arm64/include/uapi/asm/kvm.h
> > b/arch/arm64/include/uapi/asm/kvm.h
> > index 9abbf30..32c0eae 100644
> > --- a/arch/arm64/include/uapi/asm/kvm.h
> > +++ b/arch/arm64/include/uapi/asm/kvm.h
> > @@ -39,6 +39,7 @@
> > #define __KVM_HAVE_GUEST_DEBUG
> > #define __KVM_HAVE_IRQ_LINE
> > #define __KVM_HAVE_READONLY_MEM
> > +#define __KVM_HAVE_VCPU_EVENTS
> >
> > #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
> >
> > @@ -153,6 +154,15 @@ struct kvm_sync_regs { struct
> > kvm_arch_memory_slot { };
> >
> > +/* for KVM_GET/SET_VCPU_EVENTS */
> > +struct kvm_vcpu_events {
> > + struct {
> > + bool serror_pending;
> > + bool serror_has_esr;
> > + u64 serror_esr;
> > + } exception;
> > +};
> > +
>
> > /* If you need to interpret the index values, here is the key: */
> > #define KVM_REG_ARM_COPROC_MASK 0x000000000FFF0000
> > #define KVM_REG_ARM_COPROC_SHIFT 16
> > diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index
> > 5c7f657..62d49c2 100644
> > --- a/arch/arm64/kvm/guest.c
> > +++ b/arch/arm64/kvm/guest.c
> > @@ -277,6 +277,32 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
> > return -EINVAL;
> > }
> >
> > +int kvm_arm_vcpu_get_events(struct kvm_vcpu *vcpu,
> > + struct kvm_vcpu_events *events)
> > +{
> > + events->exception.serror_pending = (vcpu_get_hcr(vcpu) & HCR_VSE);
> > + events->exception.serror_has_esr =
> > + cpus_have_const_cap(ARM64_HAS_RAS_EXTN) &&
> > + (!!vcpu_get_vsesr(vcpu));
> > + events->exception.serror_esr = vcpu_get_vsesr(vcpu);
> > +
> > + return 0;
>
> Nothing checks the return value. Why is it here?
"return 0" means it is always successful, I do not know in which condition it needs to "return false" for kvm_arm_vcpu_get_events()
So I let it always "return 0".
Now this function caller does not check this function return value, I can remove "return 0".
>
> > +}
> > +
> > +int kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu,
> > + struct kvm_vcpu_events *events)
> > +{
> > + bool injected = events->exception.serror_pending;
> > + bool has_esr = events->exception.serror_has_esr;
>
> Could you validate 'events' describes something we support. What if
> cpus_have_const_cap(ARM64_HAS_RAS_EXTN) is false, we still call kvm_set_sei_esr().
>
> Please check any parts of the struct that should be zero, are zero. This lets us add new features, and reject attempts to migrate them
> (instead of silently ignoring them).
Sure, it needs, how about something like below?
If(!cpus_have_const_cap(ARM64_HAS_RAS_EXTN))
return -EINVAL;
if(!injected || !has_esr)
return -EINVAL;
>
>
> > + if (injected && has_esr)
> > + kvm_set_sei_esr(vcpu, events->exception.serror_esr);
> > + else if (injected)
> > + kvm_inject_vabt(vcpu);
> > +
> > + return 0;
>
> Nothing checks the return value. Why is it here?
kvm_arch_vcpu_ioctl() will check the return value.
>
>
> > +}
> > +
> > int __attribute_const__ kvm_target_cpu(void) {
> > unsigned long implementor = read_cpuid_implementor();
>
>
> > diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index
> > 7e3941f..30c56e0 100644
> > --- a/virt/kvm/arm/arm.c
> > +++ b/virt/kvm/arm/arm.c
> > @@ -1051,6 +1051,24 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
> > return -EFAULT;
> > return kvm_arm_vcpu_has_attr(vcpu, &attr);
> > }
> > + case KVM_GET_VCPU_EVENTS: {
> > + struct kvm_vcpu_events events;
>
> Please initialise events to 0 so that padding transferred to user-space doesn't contain kernel stack.
OK, thanks a lot for the good suggestion.
>
>
> > + kvm_arm_vcpu_get_events(vcpu, &events);
> > +
> > + if (copy_to_user(argp, &events, sizeof(struct kvm_vcpu_events)))
> > + return -EFAULT;
> > +
> > + return 0;
> > + }
> > + case KVM_SET_VCPU_EVENTS: {
> > + struct kvm_vcpu_events events;
> > +
> > + if (copy_from_user(&events, argp, sizeof(struct kvm_vcpu_events)))
> > + return -EFAULT;
> > +
> > + return kvm_arm_vcpu_set_events(vcpu, &events);
> > + }
> > default:
> > return -EINVAL;
> > }
> >
>
> Thanks,
>
> James
4 years, 2 months
Re: [Devel] [PATCH v10 1/5] arm64: KVM: Prepare set virtual SEI syndrome value
by gengdongjiu
Hi James,
>
> Hi Dongjiu Geng,
>
> On 03/03/18 16:09, Dongjiu Geng wrote:
> > Export one API to specify virtual SEI syndrome value for guest, and
> > add a helper to get the VSESR_EL2 value.
>
> This patch adds two helpers that nothing calls... its not big, please merge it with the patch that uses these.
OK, thanks, I will merge them.
>
>
> > diff --git a/arch/arm64/include/asm/kvm_emulate.h
> > b/arch/arm64/include/asm/kvm_emulate.h
> > index 413dc82..3294885 100644
> > --- a/arch/arm64/include/asm/kvm_emulate.h
> > +++ b/arch/arm64/include/asm/kvm_emulate.h
> > @@ -71,6 +71,11 @@ static inline void vcpu_set_hcr(struct kvm_vcpu *vcpu, unsigned long hcr)
> > vcpu->arch.hcr_el2 = hcr;
> > }
> >
> > +static inline unsigned long vcpu_get_vsesr(struct kvm_vcpu *vcpu) {
> > + return vcpu->arch.vsesr_el2;
> > +}
> > +
> > static inline void vcpu_set_vsesr(struct kvm_vcpu *vcpu, u64 vsesr)
> > {
> > vcpu->arch.vsesr_el2 = vsesr;
> > diff --git a/arch/arm64/include/asm/kvm_host.h
> > b/arch/arm64/include/asm/kvm_host.h
> > index a73f63a..3dc49b7 100644
> > --- a/arch/arm64/include/asm/kvm_host.h
> > +++ b/arch/arm64/include/asm/kvm_host.h
> > @@ -354,6 +354,8 @@ void handle_exit_early(struct kvm_vcpu *vcpu,
> > struct kvm_run *run, int kvm_perf_init(void); int
> > kvm_perf_teardown(void);
> >
> > +void kvm_set_sei_esr(struct kvm_vcpu *vcpu, u64 syndrome);
> > +
> > struct kvm_vcpu *kvm_mpidr_to_vcpu(struct kvm *kvm, unsigned long
> > mpidr);
> >
> > static inline void __cpu_init_hyp_mode(phys_addr_t pgd_ptr, diff
> > --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c
> > index 60666a0..78ecb28 100644
> > --- a/arch/arm64/kvm/inject_fault.c
> > +++ b/arch/arm64/kvm/inject_fault.c
> > @@ -186,3 +186,8 @@ void kvm_inject_vabt(struct kvm_vcpu *vcpu) {
> > pend_guest_serror(vcpu, ESR_ELx_ISV); }
> > +
> > +void kvm_set_sei_esr(struct kvm_vcpu *vcpu, u64 syndrome) {
> > + pend_guest_serror(vcpu, syndrome & ESR_ELx_ISS_MASK);
>
> If you move the ISS_MASK into pend_guest_serror(), you wouldn't need this at all.
>
> It would be better if any validation were in the user-space helpers so we can check user-space hasn't put something funny in the top bits.
Yes, I agree your idea, thanks for the good suggestion.
>
> > +}
> >
>
>
> Thanks,
>
> James
4 years, 2 months
[PATCH v10 0/5] set VSESR_EL2 by user space and support NOTIFY_SEI notification
by Dongjiu Geng
1. Detect whether KVM can set set guest SError syndrome
2. Support to Set VSESR_EL2 and inject SError by user space.
3. Support live migration to keep SError pending state and VSESR_EL2 value.
4. ACPI 6.1 adds support for NOTIFY_SEI as a GHES notification mechanism, so support this
notification in software, KVM or kernel ARCH code call handle_guest_sei() to let ACP driver
to handle this notification.
Dongjiu Geng (5):
arm64: KVM: Prepare set virtual SEI syndrome value
arm64: KVM: export the capability to set guest SError syndrome
arm/arm64: KVM: Introduce set and get per-vcpu event
ACPI / APEI: Add SEI notification type support for ARMv8
arm64: handle NOTIFY_SEI notification by the APEI driver
Documentation/virtual/kvm/api.txt | 37 +++++++++++++++++++++++--
arch/arm/include/asm/kvm_host.h | 6 ++++
arch/arm/kvm/guest.c | 12 ++++++++
arch/arm64/include/asm/kvm_emulate.h | 5 ++++
arch/arm64/include/asm/kvm_host.h | 7 +++++
arch/arm64/include/asm/system_misc.h | 1 +
arch/arm64/include/uapi/asm/kvm.h | 10 +++++++
arch/arm64/kernel/traps.c | 4 +++
arch/arm64/kvm/guest.c | 26 ++++++++++++++++++
arch/arm64/kvm/inject_fault.c | 5 ++++
arch/arm64/kvm/reset.c | 4 +++
arch/arm64/mm/fault.c | 10 +++++++
drivers/acpi/apei/Kconfig | 15 ++++++++++
drivers/acpi/apei/ghes.c | 53 ++++++++++++++++++++++++++++++++++++
include/acpi/ghes.h | 1 +
include/uapi/linux/kvm.h | 1 +
virt/kvm/arm/arm.c | 18 ++++++++++++
17 files changed, 213 insertions(+), 2 deletions(-)
--
1.9.1
4 years, 2 months