Skip to content

Commit 554b000

Browse files
Kevin Hilmanfweisbec
authored andcommitted
vtime: Add HAVE_VIRT_CPU_ACCOUNTING_GEN Kconfig
With VIRT_CPU_ACCOUNTING_GEN, cputime_t becomes 64-bit. In order to use that feature, arch code should be audited to ensure there are no races in concurrent read/write of cputime_t. For example, reading/writing 64-bit cputime_t on some 32-bit arches may require multiple accesses for low and high value parts, so proper locking is needed to protect against concurrent accesses. Therefore, add CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN which arches can enable after they've been audited for potential races. This option is automatically enabled on 64-bit platforms. Feature requested by Frederic Weisbecker. Signed-off-by: Kevin Hilman <khilman@linaro.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Russell King <rmk@arm.linux.org.uk> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Arm Linux <linux-arm-kernel@lists.infradead.org> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
1 parent 15c03dd commit 554b000

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

arch/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,18 @@ config HAVE_CONTEXT_TRACKING
353353
config HAVE_VIRT_CPU_ACCOUNTING
354354
bool
355355

356+
config HAVE_VIRT_CPU_ACCOUNTING_GEN
357+
bool
358+
default y if 64BIT
359+
help
360+
With VIRT_CPU_ACCOUNTING_GEN, cputime_t becomes 64-bit.
361+
Before enabling this option, arch code must be audited
362+
to ensure there are no races in concurrent read/write of
363+
cputime_t. For example, reading/writing 64-bit cputime_t on
364+
some 32-bit arches may require multiple accesses, so proper
365+
locking is needed to protect against concurrent accesses.
366+
367+
356368
config HAVE_IRQ_TIME_ACCOUNTING
357369
bool
358370
help

init/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ config VIRT_CPU_ACCOUNTING_NATIVE
355355
config VIRT_CPU_ACCOUNTING_GEN
356356
bool "Full dynticks CPU time accounting"
357357
depends on HAVE_CONTEXT_TRACKING && 64BIT
358+
depends on HAVE_VIRT_CPU_ACCOUNTING_GEN
358359
select VIRT_CPU_ACCOUNTING
359360
select CONTEXT_TRACKING
360361
help

kernel/time/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ config NO_HZ_FULL
101101
depends on HAVE_CONTEXT_TRACKING
102102
# VIRT_CPU_ACCOUNTING_GEN dependency
103103
depends on 64BIT
104+
depends on HAVE_VIRT_CPU_ACCOUNTING_GEN
104105
select NO_HZ_COMMON
105106
select RCU_USER_QS
106107
select RCU_NOCB_CPU

0 commit comments

Comments
 (0)