Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

timers/migration: Prevent from lockdep false positive warning

Testing housekeeping_cpu() will soon require that either the RCU "lock"
is held or the cpuset mutex.

When CPUs get isolated through cpuset, the change is propagated to
timer migration such that isolation is also performed from the migration
tree. However that propagation is done using workqueue which tests if
the target is actually isolated before proceeding.

Lockdep doesn't know that the workqueue caller holds cpuset mutex and
that it waits for the work, making the housekeeping cpumask read safe.

Shut down the future warning by removing this test. It is unecessary
beyond hotplug, the workqueue is already targeted towards isolated CPUs.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Gabriele Monaco <gmonaco@redhat.com>

+15 -5
+15 -5
kernel/time/timer_migration.c
··· 1497 1497 return 0; 1498 1498 } 1499 1499 1500 - static int tmigr_set_cpu_available(unsigned int cpu) 1500 + static int __tmigr_set_cpu_available(unsigned int cpu) 1501 1501 { 1502 1502 struct tmigr_cpu *tmc = this_cpu_ptr(&tmigr_cpu); 1503 1503 1504 1504 /* Check whether CPU data was successfully initialized */ 1505 1505 if (WARN_ON_ONCE(!tmc->tmgroup)) 1506 1506 return -EINVAL; 1507 - 1508 - if (tmigr_is_isolated(cpu)) 1509 - return 0; 1510 1507 1511 1508 guard(mutex)(&tmigr_available_mutex); 1512 1509 ··· 1520 1523 return 0; 1521 1524 } 1522 1525 1526 + static int tmigr_set_cpu_available(unsigned int cpu) 1527 + { 1528 + if (tmigr_is_isolated(cpu)) 1529 + return 0; 1530 + 1531 + return __tmigr_set_cpu_available(cpu); 1532 + } 1533 + 1523 1534 static void tmigr_cpu_isolate(struct work_struct *ignored) 1524 1535 { 1525 1536 tmigr_clear_cpu_available(smp_processor_id()); ··· 1535 1530 1536 1531 static void tmigr_cpu_unisolate(struct work_struct *ignored) 1537 1532 { 1538 - tmigr_set_cpu_available(smp_processor_id()); 1533 + /* 1534 + * Don't call tmigr_is_isolated() ->housekeeping_cpu() directly because 1535 + * the cpuset mutex is correctly held by the workqueue caller but lockdep 1536 + * doesn't know that. 1537 + */ 1538 + __tmigr_set_cpu_available(smp_processor_id()); 1539 1539 } 1540 1540 1541 1541 /**