hrtimers: Switch to new hrtimer interface functions (2/5)
Subsystems (49)
cover hrtimers: Switch to new hrtimer interface functions (2/5)
This is the second part of a 5-part series (split for convenience). All 5 parts are:
Part 1: https://lore.kernel.org/lkml/[email protected]
Part 2: https://lore.kernel.org/lkml/[email protected]
Part 3: https://lore.kernel.org/lkml/[email protected]
Part 4: https://lore.kernel.org/lkml/[email protected]
Part 5: https://lore.kernel.org/lkml/[email protected]
To use hrtimer, hrtimer_init() (or one of its variant) must be called, and also the timer's callfack function must be setup separately.
That can cause misuse of hrtimer. For example, because:
- The callback function is not setup
- The callback function is setup while it is not safe to do so
To prevent misuse of hrtimer, this series:
- Introduce new functions hrtimer_setup*(). These new functions are similar to hrtimer_init*(), except that they also sanity-check and initialize the callback function.
- Introduce hrtimer_update_function() which checks that it is safe to change the callback function. The 'function' field of hrtimer is then made private.
- Convert all users to use the new functions.
- Some minor cleanups on the way.
Most conversion patches were created using Coccinelle with the sematic patch below; except for tricky cases that Coccinelle cannot handle, or for some cases where a Coccinelle's bug regarding 100 column limit is triggered. Any patches not mentioning Coccinelle were done manually.
virtual patch
@@ expression timer, clock, mode, func; @@
- hrtimer_init(timer, clock, mode);
...
- timer->function = func;
+ hrtimer_setup(timer, func, clock, mode);
@@ expression timer, clock, mode, func; @@
- hrtimer_init(&timer, clock, mode);
...
- timer.function = func;
+ hrtimer_setup(&timer, func, clock, mode);
@@ expression timer, clock, mode, func; @@
- hrtimer_init_on_stack(&timer, clock, mode);
...
- timer.function = func;
+ hrtimer_setup_on_stack(&timer, func, clock, mode);
@@ expression timer, clock, mode; @@
- hrtimer_init_sleeper_on_stack(timer, clock, mode);
+ hrtimer_setup_sleeper_on_stack(timer, clock, mode);
Nam Cao (31):
KVM: MIPS: Switch to use hrtimer_setup()
KVM: PPC: Switch to use hrtimer_setup()
KVM: s390: Switch to use hrtimer_setup()
KVM: x86: Switch to use hrtimer_setup()
KVM: arm64: Switch to use hrtimer_setup()
LoongArch: KVM: Switch to use hrtimer_setup()
riscv: kvm: Switch to use hrtimer_setup()
ARM: imx: Switch to use hrtimer_setup()
ARM: 8611/1: l2x0: Switch to use hrtimer_setup() powerpc/watchdog: Switch to use hrtimer_setup() perf/x86: Switch to use hrtimer_setup() s390/ap_bus: Switch to use hrtimer_setup()
sched: Switch to use hrtimer_setup()
rcu: Switch to use hrtimer_setup()
lib: test_objpool: Switch to use hrtimer_setup() io_uring/timeout: Switch to use hrtimer_setup()
fork: Switch to use hrtimer_setup()
perf: Switch to use hrtimer_setup()
timerfd: Switch to use hrtimer_setup()
time: Switch to hrtimer_setup()
bpf: Switch to use hrtimer_setup()
ubifs: Switch to use hrtimer_setup()
watchdog: Switch to use hrtimer_setup() tracing/osnoise: Switch to use hrtimer_setup() block, bfq: Switch to use hrtimer_setup()
ata: pata_octeon_cf: Switch to use hrtimer_setup()
blk_iocost: Switch to use hrtimer_setup()
PM: runtime: Switch to use hrtimer_setup()
PM / devfreq: rockchip-dfi: Switch to use hrtimer_setup()
null_blk: Switch to use hrtimer_setup()
hwrng: timeriomem: Switch to use hrtimer_setup()
arch/arm/mach-imx/mmdc.c | 5 ++--- arch/arm/mm/cache-l2x0-pmu.c | 3 +-- arch/arm64/kvm/arch_timer.c | 7 +++---- arch/loongarch/kvm/vcpu.c | 4 ++-- arch/mips/kvm/mips.c | 5 ++--- arch/powerpc/kernel/watchdog.c | 3 +-- arch/powerpc/kvm/powerpc.c | 4 ++-- arch/riscv/kvm/vcpu_timer.c | 7 ++++--- arch/s390/kvm/interrupt.c | 3 +-- arch/s390/kvm/kvm-s390.c | 4 ++-- arch/x86/events/intel/uncore.c | 3 +-- arch/x86/events/rapl.c | 3 +-- arch/x86/kvm/hyperv.c | 3 +-- arch/x86/kvm/i8254.c | 3 +-- arch/x86/kvm/lapic.c | 5 ++--- arch/x86/kvm/vmx/nested.c | 5 ++--- arch/x86/kvm/xen.c | 5 ++--- block/bfq-iosched.c | 5 ++--- block/blk-iocost.c | 3 +-- drivers/ata/pata_octeon_cf.c | 5 ++--- drivers/base/power/runtime.c | 4 ++-- drivers/block/null_blk/main.c | 7 +++---- drivers/char/hw_random/timeriomem-rng.c | 3 +-- drivers/devfreq/event/rockchip-dfi.c | 3 +-- drivers/s390/crypto/ap_bus.c | 3 +-- drivers/watchdog/softdog.c | 8 +++----- drivers/watchdog/watchdog_dev.c | 4 ++-- drivers/watchdog/watchdog_hrtimer_pretimeout.c | 4 ++-- fs/timerfd.c | 5 ++--- fs/ubifs/io.c | 3 +-- io_uring/timeout.c | 13 ++++++------- kernel/bpf/helpers.c | 3 +-- kernel/events/core.c | 7 +++---- kernel/fork.c | 3 +-- kernel/rcu/tree.c | 4 ++-- kernel/sched/core.c | 3 +-- kernel/sched/deadline.c | 6 ++---- kernel/sched/fair.c | 8 ++++---- kernel/sched/rt.c | 5 ++--- kernel/time/ntp.c | 3 +-- kernel/time/posix-timers.c | 7 +++---- kernel/time/sched_clock.c | 3 +-- kernel/time/tick-broadcast-hrtimer.c | 3 +-- kernel/time/tick-sched.c | 6 ++---- kernel/trace/trace_osnoise.c | 6 ++---- kernel/watchdog.c | 3 +-- lib/test_objpool.c | 3 +-- 47 files changed, 87 insertions(+), 128 deletions(-)
Signature · 1 line
2.39.5
PATCH 1/31 KVM: MIPS: Switch to use hrtimer_setup()
There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Thomas Bogendoerfer <[email protected]>
--- arch/mips/kvm/mips.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/mips/kvm/mips.c +2 -3
@@ -288,9 +288,8 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)if (err)return err; -hrtimer_init (&vcpu->arch.comparecount_timer,CLOCK_MONOTONIC , -HRTIMER_MODE_REL ); - vcpu->arch.comparecount_timer.function = kvm_mips_comparecount_wakeup; +hrtimer_setup (&vcpu->arch.comparecount_timer, kvm_mips_comparecount_wakeup,CLOCK_MONOTONIC , +HRTIMER_MODE_REL );/* * Allocate space for host mode exception handlers that handle
Signature · 1 line
2.39.5
PATCH 2/31 KVM: PPC: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Michael Ellerman <[email protected]>
--- arch/powerpc/kvm/powerpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kvm/powerpc.c +2 -2
@@ -769,8 +769,8 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu) {int err; -hrtimer_init (&vcpu->arch.dec_timer,CLOCK_REALTIME ,HRTIMER_MODE_ABS ); - vcpu->arch.dec_timer.function = kvmppc_decrementer_wakeup; +hrtimer_setup (&vcpu->arch.dec_timer, kvmppc_decrementer_wakeup,CLOCK_REALTIME , +HRTIMER_MODE_ABS );#ifdef CONFIG_KVM_EXIT_TIMING mutex_init (&vcpu->arch.exit_timing_lock);
Signature · 1 line
2.39.5
PATCH 3/31 KVM: s390: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Christian Borntraeger <[email protected]>
--- arch/s390/kvm/interrupt.c | 3 +-- arch/s390/kvm/kvm-s390.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-)
arch/s390/kvm/interrupt.c +1 -2
@@ -3174,8 +3174,7 @@ void kvm_s390_gisa_init(struct kvm *kvm) gi->alert.mask =0 ;spin_lock_init (&gi->alert.ref_lock); gi->expires =50 *1000 ;/* 50 usec */ -hrtimer_init (&gi->timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); - gi->timer.function = gisa_vcpu_kicker; +hrtimer_setup (&gi->timer, gisa_vcpu_kicker,CLOCK_MONOTONIC ,HRTIMER_MODE_REL );memset (gi->origin,0 ,sizeof (struct kvm_s390_gisa )); gi->origin->next_alert = (u32 )virt_to_phys (gi->origin);VM_EVENT (kvm,3 ,"gisa 0x%pK initialized" , gi->origin);
arch/s390/kvm/kvm-s390.c +2 -2
@@ -3896,8 +3896,8 @@ static int kvm_s390_vcpu_setup(struct kvm_vcpu *vcpu)if (rc)return rc; } -hrtimer_init (&vcpu->arch.ckc_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); - vcpu->arch.ckc_timer.function = kvm_s390_idle_wakeup; +hrtimer_setup (&vcpu->arch.ckc_timer, kvm_s390_idle_wakeup,CLOCK_MONOTONIC , +HRTIMER_MODE_REL ); vcpu->arch.sie_block->hpid =HPID_KVM ;
Signature · 1 line
2.39.5
PATCH 4/31 KVM: x86: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Sean Christopherson <[email protected]>
--- arch/x86/kvm/hyperv.c | 3 +-- arch/x86/kvm/i8254.c | 3 +-- arch/x86/kvm/lapic.c | 5 ++--- arch/x86/kvm/vmx/nested.c | 5 ++--- arch/x86/kvm/xen.c | 5 ++--- 5 files changed, 8 insertions(+), 13 deletions(-)
arch/x86/kvm/hyperv.c +1 -2
@@ -952,8 +952,7 @@ static void stimer_init(struct kvm_vcpu_hv_stimer *stimer, int timer_index) {memset (stimer,0 ,sizeof (*stimer)); stimer->index = timer_index; -hrtimer_init (&stimer->timer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS ); - stimer->timer.function = stimer_timer_callback; +hrtimer_setup (&stimer->timer, stimer_timer_callback,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS );stimer_prepare_msg (stimer); }
arch/x86/kvm/i8254.c +1 -2
@@ -690,8 +690,7 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm, u32 flags) pit->kvm = kvm; pit_state = &pit->pit_state; -hrtimer_init (&pit_state->timer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS ); - pit_state->timer.function = pit_timer_fn; +hrtimer_setup (&pit_state->timer, pit_timer_fn,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS ); pit_state->irq_ack_notifier.gsi =0 ; pit_state->irq_ack_notifier.irq_acked = kvm_pit_ack_irq;
arch/x86/kvm/lapic.c +2 -3
@@ -2887,9 +2887,8 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu) apic->nr_lvt_entries =kvm_apic_calc_nr_lvt_entries (vcpu); -hrtimer_init (&apic->lapic_timer.timer,CLOCK_MONOTONIC , -HRTIMER_MODE_ABS_HARD ); - apic->lapic_timer.timer.function = apic_timer_fn; +hrtimer_setup (&apic->lapic_timer.timer, apic_timer_fn,CLOCK_MONOTONIC , +HRTIMER_MODE_ABS_HARD );if (lapic_timer_advance) apic->lapic_timer.timer_advance_ns =LAPIC_TIMER_ADVANCE_NS_INIT ;
arch/x86/kvm/vmx/nested.c +2 -3
@@ -5279,9 +5279,8 @@ static int enter_vmx_operation(struct kvm_vcpu *vcpu)if (enable_shadow_vmcs && !alloc_shadow_vmcs (vcpu)) goto out_shadow_vmcs; -hrtimer_init (&vmx->nested.preemption_timer,CLOCK_MONOTONIC , -HRTIMER_MODE_ABS_PINNED ); - vmx->nested.preemption_timer.function = vmx_preemption_timer_fn; +hrtimer_setup (&vmx->nested.preemption_timer, vmx_preemption_timer_fn,CLOCK_MONOTONIC , +HRTIMER_MODE_ABS_PINNED ); vmx->nested.vpid02 =allocate_vpid ();
arch/x86/kvm/xen.c +2 -3
@@ -265,9 +265,8 @@ static void kvm_xen_stop_timer(struct kvm_vcpu *vcpu)static void kvm_xen_init_timer (struct kvm_vcpu *vcpu) { -hrtimer_init (&vcpu->arch.xen.timer,CLOCK_MONOTONIC , -HRTIMER_MODE_ABS_HARD ); - vcpu->arch.xen.timer.function = xen_timer_callback; +hrtimer_setup (&vcpu->arch.xen.timer, xen_timer_callback,CLOCK_MONOTONIC , +HRTIMER_MODE_ABS_HARD ); }static void kvm_xen_update_runstate_guest (struct kvm_vcpu *v,bool atomic)
Signature · 1 line
2.39.5
kernel test robot
build botRe: [PATCH 04/31] KVM: x86: Switch to use hrtimer_setup()
kernel test robot noticed the following build errors:
Hi Nam,
kernel test robot noticed the following build errors:
[auto build test ERROR on kvm/queue]
[also build test ERROR on tip/sched/core perf-tools-next/perf-tools-next tip/perf/core perf-tools/perf-tools tip/timers/core axboe-block/for-next linus/master v6.12-rc5 next-20241028] [cannot apply to kvm/linux-next acme/perf/core]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Nam-Cao/KVM-MIPS-Switch-to-use-hrtimer_setup/20241028-154142 base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue patch link: https://lore.kernel.org/r/8774212e6c10c550743219e00738492eb379227c.1729864823.git.namcao%40linutronix.de patch subject: [PATCH 04/31] KVM: x86: Switch to use hrtimer_setup() config: x86_64-rhel-8.3 (https://download.01.org/0day-ci/archive/20241028/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241028/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
arch/x86/kvm/lapic.c: In function 'kvm_create_lapic':
>> arch/x86/kvm/lapic.c:2878:9: error: implicit declaration of function 'hrtimer_setup'; did you mean 'timer_setup'? [-Werror=implicit-function-declaration]
2878 | hrtimer_setup(&apic->lapic_timer.timer, apic_timer_fn, CLOCK_MONOTONIC,
| ^~~~~~~~~~~~~
| timer_setup
cc1: some warnings being treated as errors
--
arch/x86/kvm/i8254.c: In function 'kvm_create_pit':
>> arch/x86/kvm/i8254.c:693:9: error: implicit declaration of function 'hrtimer_setup'; did you mean 'timer_setup'? [-Werror=implicit-function-declaration]
693 | hrtimer_setup(&pit_state->timer, pit_timer_fn, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
| ^~~~~~~~~~~~~
| timer_setup
cc1: some warnings being treated as errors
--
arch/x86/kvm/hyperv.c: In function 'stimer_init':
>> arch/x86/kvm/hyperv.c:955:9: error: implicit declaration of function 'hrtimer_setup'; did you mean 'timer_setup'? [-Werror=implicit-function-declaration]
955 | hrtimer_setup(&stimer->timer, stimer_timer_callback, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
| ^~~~~~~~~~~~~
| timer_setup
cc1: some warnings being treated as errors
--
arch/x86/kvm/vmx/nested.c: In function 'enter_vmx_operation':
>> arch/x86/kvm/vmx/nested.c:5278:9: error: implicit declaration of function 'hrtimer_setup'; did you mean 'timer_setup'? [-Werror=implicit-function-declaration]
5278 | hrtimer_setup(&vmx->nested.preemption_timer, vmx_preemption_timer_fn, CLOCK_MONOTONIC,
| ^~~~~~~~~~~~~
| timer_setupcc1: some warnings being treated as errors
vim +2878 arch/x86/kvm/lapic.c
2847
2848 int kvm_create_lapic(struct kvm_vcpu *vcpu)
2849 {
2850 struct kvm_lapic *apic;
2851
2852 ASSERT(vcpu != NULL);
2853
2854 if (!irqchip_in_kernel(vcpu->kvm)) {
2855 static_branch_inc(&kvm_has_noapic_vcpu);
2856 return 0;
2857 }
2858
2859 apic = kzalloc(sizeof(*apic), GFP_KERNEL_ACCOUNT);
2860 if (!apic)
2861 goto nomem;
2862
2863 vcpu->arch.apic = apic;
2864
2865 if (kvm_x86_ops.alloc_apic_backing_page)
2866 apic->regs = kvm_x86_call(alloc_apic_backing_page)(vcpu);
2867 else
2868 apic->regs = (void *)get_zeroed_page(GFP_KERNEL_ACCOUNT);
2869 if (!apic->regs) {
2870 printk(KERN_ERR "malloc apic regs error for vcpu %x\n",
2871 vcpu->vcpu_id);
2872 goto nomem_free_apic;
2873 }
2874 apic->vcpu = vcpu;
2875
2876 apic->nr_lvt_entries = kvm_apic_calc_nr_lvt_entries(vcpu);
2877
> 2878 hrtimer_setup(&apic->lapic_timer.timer, apic_timer_fn, CLOCK_MONOTONIC,
2879 HRTIMER_MODE_ABS_HARD);
2880 if (lapic_timer_advance)
2881 apic->lapic_timer.timer_advance_ns = LAPIC_TIMER_ADVANCE_NS_INIT;
2882
2883 /*
2884 * Stuff the APIC ENABLE bit in lieu of temporarily incrementing
2885 * apic_hw_disabled; the full RESET value is set by kvm_lapic_reset().
2886 */
2887 vcpu->arch.apic_base = MSR_IA32_APICBASE_ENABLE;
2888 static_branch_inc(&apic_sw_disabled.key); /* sw disabled at reset */
2889 kvm_iodevice_init(&apic->dev, &apic_mmio_ops);
2890
2891 /*
2892 * Defer evaluating inhibits until the vCPU is first run, as this vCPU
2893 * will not get notified of any changes until this vCPU is visible to
2894 * other vCPUs (marked online and added to the set of vCPUs).
2895 *
2896 * Opportunistically mark APICv active as VMX in particularly is highly
2897 * unlikely to have inhibits. Ignore the current per-VM APICv state so
2898 * that vCPU creation is guaranteed to run with a deterministic value,
2899 * the request will ensure the vCPU gets the correct state before VM-Entry.
2900 */
2901 if (enable_apicv) {
2902 apic->apicv_active = true;
2903 kvm_make_request(KVM_REQ_APICV_UPDATE, vcpu);
2904 }
2905
2906 return 0;
2907 nomem_free_apic:
2908 kfree(apic);
2909 vcpu->arch.apic = NULL;
2910 nomem:
2911 return -ENOMEM;
2912 }
2913
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH 04/31] KVM: x86: Switch to use hrtimer_setup()
In reply to Nam Caokernel test robot noticed the following build errors:
Hi Nam,
kernel test robot noticed the following build errors:
[auto build test ERROR on kvm/queue]
[also build test ERROR on tip/sched/core perf-tools-next/perf-tools-next tip/perf/core perf-tools/perf-tools tip/timers/core axboe-block/for-next linus/master v6.12-rc5 next-20241028] [cannot apply to kvm/linux-next acme/perf/core]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Nam-Cao/KVM-MIPS-Switch-to-use-hrtimer_setup/20241028-154142 base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue patch link: https://lore.kernel.org/r/8774212e6c10c550743219e00738492eb379227c.1729864823.git.namcao%40linutronix.de patch subject: [PATCH 04/31] KVM: x86: Switch to use hrtimer_setup() config: x86_64-kexec (https://download.01.org/0day-ci/archive/20241029/[email protected]/config) compiler: clang version 19.1.2 (https://github.com/llvm/llvm-project 7ba7d8e2f7b6445b60679da826210cdde29eaf8b) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241029/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from arch/x86/kvm/lapic.c:20:
In file included from include/linux/kvm_host.h:16:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
504 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
505 | item];
| ~~~~
include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
511 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
512 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
524 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
525 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/kvm/lapic.c:2878:2: error: call to undeclared function 'hrtimer_setup'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
2878 | hrtimer_setup(&apic->lapic_timer.timer, apic_timer_fn, CLOCK_MONOTONIC,
| ^ arch/x86/kvm/lapic.c:2878:2: note: did you mean 'hrtimer_start'?
include/linux/hrtimer.h:272:20: note: 'hrtimer_start' declared here
272 | static inline void hrtimer_start(struct hrtimer *timer, ktime_t tim,
| ^
4 warnings and 1 error generated.
--
In file included from arch/x86/kvm/i8254.c:35:
In file included from include/linux/kvm_host.h:16:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
504 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
505 | item];
| ~~~~
include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
511 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
512 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
524 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
525 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/kvm/i8254.c:693:2: error: call to undeclared function 'hrtimer_setup'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
693 | hrtimer_setup(&pit_state->timer, pit_timer_fn, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
| ^ arch/x86/kvm/i8254.c:693:2: note: did you mean 'hrtimer_start'?
include/linux/hrtimer.h:272:20: note: 'hrtimer_start' declared here
272 | static inline void hrtimer_start(struct hrtimer *timer, ktime_t tim,
| ^
4 warnings and 1 error generated.
--
In file included from arch/x86/kvm/hyperv.c:22:
In file included from arch/x86/kvm/x86.h:5:
In file included from include/linux/kvm_host.h:16:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
504 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
505 | item];
| ~~~~
include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
511 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
512 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
524 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
525 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/kvm/hyperv.c:955:2: error: call to undeclared function 'hrtimer_setup'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
955 | hrtimer_setup(&stimer->timer, stimer_timer_callback, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
| ^ arch/x86/kvm/hyperv.c:955:2: note: did you mean 'hrtimer_start'?
include/linux/hrtimer.h:272:20: note: 'hrtimer_start' declared here
272 | static inline void hrtimer_start(struct hrtimer *timer, ktime_t tim,
| ^
4 warnings and 1 error generated.
--
In file included from arch/x86/kvm/vmx/nested.c:8:
In file included from arch/x86/include/asm/mmu_context.h:8:
In file included from include/linux/pkeys.h:5:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
504 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
505 | item];
| ~~~~
include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
511 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
512 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
524 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
525 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/kvm/vmx/nested.c:5278:2: error: call to undeclared function 'hrtimer_setup'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
5278 | hrtimer_setup(&vmx->nested.preemption_timer, vmx_preemption_timer_fn, CLOCK_MONOTONIC,
| ^ arch/x86/kvm/vmx/nested.c:5278:2: note: did you mean 'hrtimer_start'? include/linux/hrtimer.h:272:20: note: 'hrtimer_start' declared here
272 | static inline void hrtimer_start(struct hrtimer *timer, ktime_t tim,
| ^
4 warnings and 1 error generated.
vim +/hrtimer_setup +2878 arch/x86/kvm/lapic.c
2847
2848 int kvm_create_lapic(struct kvm_vcpu *vcpu)
2849 {
2850 struct kvm_lapic *apic;
2851
2852 ASSERT(vcpu != NULL);
2853
2854 if (!irqchip_in_kernel(vcpu->kvm)) {
2855 static_branch_inc(&kvm_has_noapic_vcpu);
2856 return 0;
2857 }
2858
2859 apic = kzalloc(sizeof(*apic), GFP_KERNEL_ACCOUNT);
2860 if (!apic)
2861 goto nomem;
2862
2863 vcpu->arch.apic = apic;
2864
2865 if (kvm_x86_ops.alloc_apic_backing_page)
2866 apic->regs = kvm_x86_call(alloc_apic_backing_page)(vcpu);
2867 else
2868 apic->regs = (void *)get_zeroed_page(GFP_KERNEL_ACCOUNT);
2869 if (!apic->regs) {
2870 printk(KERN_ERR "malloc apic regs error for vcpu %x\n",
2871 vcpu->vcpu_id);
2872 goto nomem_free_apic;
2873 }
2874 apic->vcpu = vcpu;
2875
2876 apic->nr_lvt_entries = kvm_apic_calc_nr_lvt_entries(vcpu);
2877
> 2878 hrtimer_setup(&apic->lapic_timer.timer, apic_timer_fn, CLOCK_MONOTONIC,
2879 HRTIMER_MODE_ABS_HARD);
2880 if (lapic_timer_advance)
2881 apic->lapic_timer.timer_advance_ns = LAPIC_TIMER_ADVANCE_NS_INIT;
2882
2883 /*
2884 * Stuff the APIC ENABLE bit in lieu of temporarily incrementing
2885 * apic_hw_disabled; the full RESET value is set by kvm_lapic_reset().
2886 */
2887 vcpu->arch.apic_base = MSR_IA32_APICBASE_ENABLE;
2888 static_branch_inc(&apic_sw_disabled.key); /* sw disabled at reset */
2889 kvm_iodevice_init(&apic->dev, &apic_mmio_ops);
2890
2891 /*
2892 * Defer evaluating inhibits until the vCPU is first run, as this vCPU
2893 * will not get notified of any changes until this vCPU is visible to
2894 * other vCPUs (marked online and added to the set of vCPUs).
2895 *
2896 * Opportunistically mark APICv active as VMX in particularly is highly
2897 * unlikely to have inhibits. Ignore the current per-VM APICv state so
2898 * that vCPU creation is guaranteed to run with a deterministic value,
2899 * the request will ensure the vCPU gets the correct state before VM-Entry.
2900 */
2901 if (enable_apicv) {
2902 apic->apicv_active = true;
2903 kvm_make_request(KVM_REQ_APICV_UPDATE, vcpu);
2904 }
2905
2906 return 0;
2907 nomem_free_apic:
2908 kfree(apic);
2909 vcpu->arch.apic = NULL;
2910 nomem:
2911 return -ENOMEM;
2912 }
2913
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH 5/31 KVM: arm64: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
---
Cc: Marc Zyngier <[email protected]>
--- arch/arm64/kvm/arch_timer.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
arch/arm64/kvm/arch_timer.c +3 -4
@@ -993,8 +993,7 @@ static void timer_context_init(struct kvm_vcpu *vcpu, int timerid)else ctxt->offset.vm_offset = &kvm->arch.timer_data.poffset; -hrtimer_init (&ctxt->hrtimer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_HARD ); - ctxt->hrtimer.function = kvm_hrtimer_expire; +hrtimer_setup (&ctxt->hrtimer, kvm_hrtimer_expire,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_HARD );switch (timerid) {case TIMER_PTIMER :
@@ -1021,8 +1020,8 @@ void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu)timer_set_offset (vcpu_ptimer (vcpu),0 ); } -hrtimer_init (&timer->bg_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_HARD ); - timer->bg_timer.function = kvm_bg_timer_expire; +hrtimer_setup (&timer->bg_timer, kvm_bg_timer_expire,CLOCK_MONOTONIC , +HRTIMER_MODE_ABS_HARD ); }void kvm_timer_init_vm (struct kvm *kvm)
Signature · 1 line
2.39.5
Re: [PATCH 05/31] KVM: arm64: Switch to use hrtimer_setup()
[+ the rest of the KVM/arm64 maintainers/reviewers]
Quoted 29 lines · Nam Cao
There is a newly introduced
hrtimer_setup()which will replacehrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.Switch to use this new function.
Signed-off-by Nam Cao <[email protected]>---
Cc: Marc Zyngier <[email protected]>--- arch/arm64/kvm/arch_timer.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)arch/arm64/kvm/arch_timer.c +1
-2@@ -993,8 +993,7 @@ static void timer_context_init(struct kvm_vcpu *vcpu, int timerid)else ctxt->offset.vm_offset = &kvm->arch.timer_data.poffset; -hrtimer_init (&ctxt->hrtimer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_HARD ); - ctxt->hrtimer.function = kvm_hrtimer_expire; +hrtimer_setup (&ctxt->hrtimer, kvm_hrtimer_expire,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_HARD );switch (timerid) {case TIMER_PTIMER :
arch/arm64/kvm/arch_timer.c void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu) · line 1027
Quoted 10 lines
arch/arm64/kvm/arch_timer.c +2
-2@@ -1021,8 +1020,8 @@ void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu)timer_set_offset (vcpu_ptimer (vcpu),0 ); } -hrtimer_init (&timer->bg_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_HARD ); - timer->bg_timer.function = kvm_bg_timer_expire; +hrtimer_setup (&timer->bg_timer, kvm_bg_timer_expire,CLOCK_MONOTONIC , +HRTIMER_MODE_ABS_HARD ); }void kvm_timer_init_vm (struct kvm *kvm)
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
PATCH 6/31 LoongArch: KVM: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Huacai Chen <[email protected]>
--- arch/loongarch/kvm/vcpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/loongarch/kvm/vcpu.c +2 -2
@@ -1457,8 +1457,8 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu) vcpu->arch.vpid =0 ; vcpu->arch.flush_gpa =INVALID_GPA ; -hrtimer_init (&vcpu->arch.swtimer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_PINNED ); - vcpu->arch.swtimer.function = kvm_swtimer_wakeup; +hrtimer_setup (&vcpu->arch.swtimer, kvm_swtimer_wakeup,CLOCK_MONOTONIC , +HRTIMER_MODE_ABS_PINNED ); vcpu->arch.handle_exit = kvm_handle_exit; vcpu->arch.guest_eentry = (unsigned long )kvm_loongarch_ops->exc_entry;
Signature · 1 line
2.39.5
PATCH 7/31 riscv: kvm: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Anup Patel <[email protected]>
--- arch/riscv/kvm/vcpu_timer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/riscv/kvm/vcpu_timer.c +4 -3
@@ -248,18 +248,19 @@ int kvm_riscv_vcpu_timer_init(struct kvm_vcpu *vcpu)if (t->init_done)return -EINVAL ; -hrtimer_init (&t->hrt,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); t->init_done = true; t->next_set = false;/* Enable sstc for every vcpu if available in hardware */ if (riscv_isa_extension_available (NULL ,SSTC )) { t->sstc_enabled = true; - t->hrt.function = kvm_riscv_vcpu_vstimer_expired; +hrtimer_setup (&t->hrt, kvm_riscv_vcpu_vstimer_expired,CLOCK_MONOTONIC , +HRTIMER_MODE_REL ); t->timer_next_event = kvm_riscv_vcpu_update_vstimecmp; }else { t->sstc_enabled = false; - t->hrt.function = kvm_riscv_vcpu_hrtimer_expired; +hrtimer_setup (&t->hrt, kvm_riscv_vcpu_hrtimer_expired,CLOCK_MONOTONIC , +HRTIMER_MODE_REL ); t->timer_next_event = kvm_riscv_vcpu_update_hrtimer; }
Signature · 1 line
2.39.5
PATCH 8/31 ARM: imx: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
---
Cc: Sascha Hauer <[email protected]>
--- arch/arm/mach-imx/mmdc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm/mach-imx/mmdc.c +2 -3
@@ -509,9 +509,8 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b pmu_mmdc->mmdc_ipg_clk = mmdc_ipg_clk; pmu_mmdc->devtype_data =device_get_match_data (&pdev->dev); -hrtimer_init (&pmu_mmdc->hrtimer,CLOCK_MONOTONIC , -HRTIMER_MODE_REL ); - pmu_mmdc->hrtimer.function = mmdc_pmu_timer_handler; +hrtimer_setup (&pmu_mmdc->hrtimer, mmdc_pmu_timer_handler,CLOCK_MONOTONIC , +HRTIMER_MODE_REL );cpumask_set_cpu (raw_smp_processor_id (), &pmu_mmdc->cpu);
Signature · 1 line
2.39.5
PATCH 9/31 ARM: 8611/1: l2x0: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Russell King <[email protected]>
--- arch/arm/mm/cache-l2x0-pmu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/mm/cache-l2x0-pmu.c +1 -2
@@ -539,8 +539,7 @@ static __init int l2x0_pmu_init(void)* at higher frequencies. */ l2x0_pmu_poll_period =ms_to_ktime (1000 ); -hrtimer_init (&l2x0_pmu_hrtimer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); - l2x0_pmu_hrtimer.function = l2x0_pmu_poll; +hrtimer_setup (&l2x0_pmu_hrtimer, l2x0_pmu_poll,CLOCK_MONOTONIC ,HRTIMER_MODE_REL );cpumask_set_cpu (0 , &pmu_cpu); ret = cpuhp_setup_state_nocalls(CPUHP_AP_PERF_ARM_L2X0_ONLINE,
Signature · 1 line
2.39.5
PATCH 10/31 powerpc/watchdog: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Michael Ellerman <[email protected]>
--- arch/powerpc/kernel/watchdog.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/kernel/watchdog.c +1 -2
@@ -495,8 +495,7 @@ static void start_watchdog(void *arg) *this_cpu_ptr (&wd_timer_tb) =get_tb (); -hrtimer_init (hrtimer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); - hrtimer->function = watchdog_timer_fn; +hrtimer_setup (hrtimer, watchdog_timer_fn,CLOCK_MONOTONIC ,HRTIMER_MODE_REL );hrtimer_start (hrtimer,ms_to_ktime (wd_timer_period_ms),HRTIMER_MODE_REL_PINNED ); }
Signature · 1 line
2.39.5
PATCH 11/31 perf/x86: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Peter Zijlstra <[email protected]>
--- arch/x86/events/intel/uncore.c | 3 +-- arch/x86/events/rapl.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
arch/x86/events/intel/uncore.c +1 -2
@@ -347,8 +347,7 @@ void uncore_pmu_cancel_hrtimer(struct intel_uncore_box *box)static void uncore_pmu_init_hrtimer (struct intel_uncore_box *box) { -hrtimer_init (&box->hrtimer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); - box->hrtimer.function = uncore_pmu_hrtimer; +hrtimer_setup (&box->hrtimer, uncore_pmu_hrtimer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); } static struct intel_uncore_box *uncore_alloc_box(struct intel_uncore_type *type,
arch/x86/events/rapl.c +1 -2
@@ -264,8 +264,7 @@ static void rapl_hrtimer_init(struct rapl_pmu *pmu) {struct hrtimer *hr = &pmu->hrtimer; -hrtimer_init (hr,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); - hr->function = rapl_hrtimer_handle; +hrtimer_setup (hr, rapl_hrtimer_handle,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); } static void __rapl_pmu_event_start(struct rapl_pmu *pmu,
Signature · 1 line
2.39.5
PATCH 12/31 s390/ap_bus: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Christian Borntraeger <[email protected]>
--- drivers/s390/crypto/ap_bus.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/s390/crypto/ap_bus.c +1 -2
@@ -2327,8 +2327,7 @@ static inline int __init ap_async_init(void)*/ if (MACHINE_IS_VM ) poll_high_timeout =1500000 ; -hrtimer_init (&ap_poll_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS ); - ap_poll_timer.function = ap_poll_timeout; +hrtimer_setup (&ap_poll_timer, ap_poll_timeout,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS );queue_work (system_long_wq, &ap_scan_bus_work);
Signature · 1 line
2.39.5
PATCH 13/31 sched: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
---
Cc: Peter Zijlstra <[email protected]>
--- kernel/sched/core.c | 3 +-- kernel/sched/deadline.c | 6 ++---- kernel/sched/fair.c | 8 ++++---- kernel/sched/rt.c | 5 ++--- 4 files changed, 9 insertions(+), 13 deletions(-)
kernel/sched/core.c +1 -2
@@ -903,8 +903,7 @@ static void hrtick_rq_init(struct rq *rq)#ifdef CONFIG_SMP INIT_CSD (&rq->hrtick_csd, __hrtick_start, rq);#endif -hrtimer_init (&rq->hrtick_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL_HARD ); - rq->hrtick_timer.function = hrtick; + hrtimer_setup(&rq->hrtick_timer, hrtick, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD); }#else /* CONFIG_SCHED_HRTICK */ static inline void hrtick_clear (struct rq *rq)
kernel/sched/deadline.c +2 -4
@@ -1362,8 +1362,7 @@ static void init_dl_task_timer(struct sched_dl_entity *dl_se) {struct hrtimer *timer = &dl_se->dl_timer; -hrtimer_init (timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL_HARD ); - timer->function = dl_task_timer; +hrtimer_setup (timer, dl_task_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL_HARD ); }/*
@@ -1817,8 +1816,7 @@ static void init_dl_inactive_task_timer(struct sched_dl_entity *dl_se) {struct hrtimer *timer = &dl_se->inactive_timer; -hrtimer_init (timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL_HARD ); - timer->function = inactive_task_timer; +hrtimer_setup (timer, inactive_task_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL_HARD ); }#define __node_2_dle (node) \
kernel/sched/fair.c +4 -4
@@ -6576,14 +6576,14 @@ void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b, struct cfs_bandwidth *paren cfs_b->hierarchical_quota = parent ? parent->hierarchical_quota :RUNTIME_INF ;INIT_LIST_HEAD (&cfs_b->throttled_cfs_rq); -hrtimer_init (&cfs_b->period_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_PINNED ); - cfs_b->period_timer.function = sched_cfs_period_timer; +hrtimer_setup (&cfs_b->period_timer, sched_cfs_period_timer,CLOCK_MONOTONIC , +HRTIMER_MODE_ABS_PINNED );/* Add a random offset so that timers interleave */ hrtimer_set_expires (&cfs_b->period_timer,get_random_u32_below (cfs_b->period)); -hrtimer_init (&cfs_b->slack_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); - cfs_b->slack_timer.function = sched_cfs_slack_timer; +hrtimer_setup (&cfs_b->slack_timer, sched_cfs_slack_timer,CLOCK_MONOTONIC , +HRTIMER_MODE_REL ); cfs_b->slack_started = false; }
kernel/sched/rt.c +2 -3
@@ -127,9 +127,8 @@ void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 period, u64 runtime)raw_spin_lock_init (&rt_b->rt_runtime_lock); -hrtimer_init (&rt_b->rt_period_timer,CLOCK_MONOTONIC , -HRTIMER_MODE_REL_HARD ); - rt_b->rt_period_timer.function = sched_rt_period_timer; +hrtimer_setup (&rt_b->rt_period_timer, sched_rt_period_timer,CLOCK_MONOTONIC , +HRTIMER_MODE_REL_HARD ); }static inline void do_start_rt_bandwidth (struct rt_bandwidth *rt_b)
Signature · 1 line
2.39.5
kernel test robot
build botRe: [PATCH 13/31] sched: Switch to use hrtimer_setup()
kernel test robot noticed the following build errors:
Hi Nam,
kernel test robot noticed the following build errors:
[auto build test ERROR on kvm/queue]
[also build test ERROR on tip/sched/core perf-tools-next/perf-tools-next tip/perf/core perf-tools/perf-tools tip/timers/core axboe-block/for-next] [cannot apply to linus/master kvm/linux-next acme/perf/core v6.12-rc5 next-20241028]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Nam-Cao/KVM-MIPS-Switch-to-use-hrtimer_setup/20241028-154142 base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue patch link: https://lore.kernel.org/r/f83c7ad9954fce1f84eaec94bb7b58f5f6974fc4.1729864823.git.namcao%40linutronix.de patch subject: [PATCH 13/31] sched: Switch to use hrtimer_setup() config: x86_64-rhel-8.3-func (https://download.01.org/0day-ci/archive/20241028/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241028/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from kernel/sched/build_policy.c:52:
kernel/sched/rt.c: In function 'init_rt_bandwidth':
>> kernel/sched/rt.c:130:9: error: implicit declaration of function 'hrtimer_setup'; did you mean 'timer_setup'? [-Werror=implicit-function-declaration]
130 | hrtimer_setup(&rt_b->rt_period_timer, sched_rt_period_timer, CLOCK_MONOTONIC,
| ^~~~~~~~~~~~~
| timer_setupcc1: some warnings being treated as errors
vim +130 kernel/sched/rt.c
122
123 void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 period, u64 runtime)
124 {
125 rt_b->rt_period = ns_to_ktime(period);
126 rt_b->rt_runtime = runtime;
127
128 raw_spin_lock_init(&rt_b->rt_runtime_lock);
129
> 130 hrtimer_setup(&rt_b->rt_period_timer, sched_rt_period_timer, CLOCK_MONOTONIC,
131 HRTIMER_MODE_REL_HARD);
132 }
133
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH 14/31 rcu: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: "Paul E. McKenney" <[email protected]>
--- kernel/rcu/tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/rcu/tree.c +2 -2
@@ -3701,8 +3701,8 @@ run_page_cache_worker(struct kfree_rcu_cpu *krcp) &krcp->page_cache_work, msecs_to_jiffies(rcu_delay_page_cache_fill_msec)); }else { -hrtimer_init (&krcp->hrtimer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); - krcp->hrtimer.function = schedule_page_work_fn; +hrtimer_setup (&krcp->hrtimer, schedule_page_work_fn,CLOCK_MONOTONIC , +HRTIMER_MODE_REL );hrtimer_start (&krcp->hrtimer,0 ,HRTIMER_MODE_REL ); } }
Signature · 1 line
2.39.5
Re: [PATCH 14/31] rcu: Switch to use hrtimer_setup()
Quoted 9 lines · Nam Cao
There is a newly introduced
hrtimer_setup()which will replacehrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.Switch to use this new function.
Patch was created by using Coccinelle.
Signed-off-by Nam Cao <[email protected]>
Quoted 24 lines
---
Cc: "Paul E. McKenney" <[email protected]>--- kernel/rcu/tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kernel/rcu/tree.c +2
-2@@ -3701,8 +3701,8 @@ run_page_cache_worker(struct kfree_rcu_cpu *krcp) &krcp->page_cache_work, msecs_to_jiffies(rcu_delay_page_cache_fill_msec)); }else { -hrtimer_init (&krcp->hrtimer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); - krcp->hrtimer.function = schedule_page_work_fn; +hrtimer_setup (&krcp->hrtimer, schedule_page_work_fn,CLOCK_MONOTONIC , +HRTIMER_MODE_REL );hrtimer_start (&krcp->hrtimer,0 ,HRTIMER_MODE_REL ); } }Signature · 1 line
2.39.5
PATCH 15/31 lib: test_objpool: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Andrew Morton <[email protected]>
--- lib/test_objpool.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
lib/test_objpool.c +1 -2
@@ -190,8 +190,7 @@ static int ot_init_hrtimer(struct ot_item *item, unsigned long hrtimer)return -ENOENT ; item->hrtcycle =ktime_set (0 , hrtimer *1000000UL ); -hrtimer_init (hrt,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); - hrt->function = ot_hrtimer_handler; +hrtimer_setup (hrt, ot_hrtimer_handler,CLOCK_MONOTONIC ,HRTIMER_MODE_REL );return 0 ; }
Signature · 1 line
2.39.5
PATCH 16/31 io_uring/timeout: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use the new function.
This new function is also used to initialize the callback function in .prep() (the callback function depends on whether it is IORING_OP_TIMEOUT or IORING_OP_LINK_TIMEOUT). Thus, callback function setup in io_timeout() and io_queue_linked_timeout() are now redundant, therefore remove them.
---
Cc: Jens Axboe <[email protected]>
--- io_uring/timeout.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
io_uring/timeout.c +6 -7
@@ -388,8 +388,7 @@ static int io_linked_timeout_update(struct io_ring_ctx *ctx, __u64 user_data, io = req->async_data;if (hrtimer_try_to_cancel (&io->timer) ==-1 )return -EALREADY ; -hrtimer_init (&io->timer,io_timeout_get_clock (io), mode); - io->timer.function = io_link_timeout_fn; +hrtimer_setup (&io->timer, io_link_timeout_fn,io_timeout_get_clock (io), mode);hrtimer_start (&io->timer,timespec64_to_ktime (*ts), mode);return 0 ; }
@@ -409,8 +408,7 @@ static int io_timeout_update(struct io_ring_ctx *ctx, __u64 user_data, timeout->off =0 ;/* noseq */ data = req->async_data;list_add_tail (&timeout->list, &ctx->timeout_list); -hrtimer_init (&data->timer,io_timeout_get_clock (data), mode); - data->timer.function = io_timeout_fn; +hrtimer_setup (&data->timer, io_timeout_fn,io_timeout_get_clock (data), mode);hrtimer_start (&data->timer,timespec64_to_ktime (*ts), mode);return 0 ; }
@@ -537,7 +535,6 @@ static int __io_timeout_prep(struct io_kiocb *req,return -EINVAL ; data->mode =io_translate_timeout_mode (flags); -hrtimer_init (&data->timer,io_timeout_get_clock (data), data->mode);if (is_timeout_link) {struct io_submit_link *link = &req->ctx->submit_state.link;
@@ -548,6 +545,10 @@ static int __io_timeout_prep(struct io_kiocb *req,return -EINVAL ; timeout->head = link->last; link->last->flags |=REQ_F_ARM_LTIMEOUT ; +hrtimer_setup (&data->timer, io_link_timeout_fn,io_timeout_get_clock (data), + data->mode); + }else { +hrtimer_setup (&data->timer, io_timeout_fn,io_timeout_get_clock (data), data->mode); }return 0 ; }
@@ -607,7 +608,6 @@ int io_timeout(struct io_kiocb *req, unsigned int issue_flags) } add:list_add (&timeout->list, entry); - data->timer.function = io_timeout_fn;hrtimer_start (&data->timer,timespec64_to_ktime (data->ts), data->mode);spin_unlock_irq (&ctx->timeout_lock);return IOU_ISSUE_SKIP_COMPLETE ;
@@ -626,7 +626,6 @@ void io_queue_linked_timeout(struct io_kiocb *req)if (timeout->head) {struct io_timeout_data *data = req->async_data; - data->timer.function = io_link_timeout_fn;hrtimer_start (&data->timer,timespec64_to_ktime (data->ts), data->mode);list_add_tail (&timeout->list, &ctx->ltimeout_list);
Signature · 1 line
2.39.5
Re: [PATCH 16/31] io_uring/timeout: Switch to use hrtimer_setup()
Quoted 10 lines · Nam Cao
There is a newly introduced
hrtimer_setup()which will replacehrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.Switch to use the new function.
This new function is also used to initialize the callback function in .prep() (the callback function depends on whether it is
IORING_OP_TIMEOUTorIORING_OP_LINK_TIMEOUT). Thus, callback function setup inio_timeout()andio_queue_linked_timeout()are now redundant, therefore remove them.
Next time do the basic courtesy of CC'ing io_uring mailing list if you're sending io_uring patches, so that people don't have to guess months later why there is an unknown patch in the tree and where the hell did it came from.
Signature · 1 line
Pavel Begunkov
PATCH 17/31 fork: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Oleg Nesterov <[email protected]>
--- kernel/fork.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/fork.c +1 -2
@@ -1864,8 +1864,7 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)#ifdef CONFIG_POSIX_TIMERS INIT_HLIST_HEAD (&sig->posix_timers); -hrtimer_init (&sig->real_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); - sig->real_timer.function = it_real_fn; +hrtimer_setup (&sig->real_timer, it_real_fn,CLOCK_MONOTONIC ,HRTIMER_MODE_REL );#endif task_lock (current->group_leader);
Signature · 1 line
2.39.5
PATCH 18/31 perf: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Peter Zijlstra <[email protected]>
--- kernel/events/core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
kernel/events/core.c +3 -4
@@ -1151,8 +1151,8 @@ static void __perf_mux_hrtimer_init(struct perf_cpu_pmu_context *cpc, int cpu) cpc->hrtimer_interval =ns_to_ktime (NSEC_PER_MSEC * interval);raw_spin_lock_init (&cpc->hrtimer_lock); -hrtimer_init (timer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_PINNED_HARD ); - timer->function = perf_mux_hrtimer_handler; +hrtimer_setup (timer, perf_mux_hrtimer_handler,CLOCK_MONOTONIC , +HRTIMER_MODE_ABS_PINNED_HARD ); }static int perf_mux_hrtimer_restart (struct perf_cpu_pmu_context *cpc)
@@ -11273,8 +11273,7 @@ static void perf_swevent_init_hrtimer(struct perf_event *event)if (!is_sampling_event (event))return ; -hrtimer_init (&hwc->hrtimer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL_HARD ); - hwc->hrtimer.function = perf_swevent_hrtimer; +hrtimer_setup (&hwc->hrtimer, perf_swevent_hrtimer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL_HARD );/* * Since hrtimers have a fixed rate, we can do a static freq->period
Signature · 1 line
2.39.5
PATCH 19/31 timerfd: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
---
Cc: Christian Brauner <[email protected]>
--- fs/timerfd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/timerfd.c +2 -3
@@ -207,9 +207,8 @@ static int timerfd_setup(struct timerfd_ctx *ctx, int flags, ALARM_REALTIME :ALARM_BOOTTIME , timerfd_alarmproc); }else { -hrtimer_init (&ctx->t.tmr, clockid, htmode); +hrtimer_setup (&ctx->t.tmr, timerfd_tmrproc, clockid, htmode);hrtimer_set_expires (&ctx->t.tmr, texp); - ctx->t.tmr.function = timerfd_tmrproc; }if (texp !=0 ) {
@@ -444,7 +443,7 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) ALARM_REALTIME :ALARM_BOOTTIME , timerfd_alarmproc); else - hrtimer_init(&ctx->t.tmr, clockid, HRTIMER_MODE_ABS); + hrtimer_setup(&ctx->t.tmr, timerfd_tmrproc, clockid, HRTIMER_MODE_ABS); ctx->moffs =ktime_mono_to_real (0 );
Signature · 1 line
2.39.5
PATCH 20/31 time: Switch to hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
---
Cc: John Stultz <[email protected]>
--- kernel/time/ntp.c | 3 +-- kernel/time/posix-timers.c | 7 +++---- kernel/time/sched_clock.c | 3 +-- kernel/time/tick-broadcast-hrtimer.c | 3 +-- kernel/time/tick-sched.c | 6 ++---- 5 files changed, 8 insertions(+), 14 deletions(-)
kernel/time/ntp.c +1 -2
@@ -678,8 +678,7 @@ void ntp_notify_cmos_timer(bool offset_set)static void __init ntp_init_cmos_sync (void ) { -hrtimer_init (&sync_hrtimer,CLOCK_REALTIME ,HRTIMER_MODE_ABS ); - sync_hrtimer.function = sync_timer_callback; +hrtimer_setup (&sync_hrtimer, sync_timer_callback,CLOCK_REALTIME ,HRTIMER_MODE_ABS ); }#else /* CONFIG_GENERIC_CMOS_UPDATE) || defined(CONFIG_RTC_SYSTOHC) */ static inline void __init ntp_init_cmos_sync (void ) { }
kernel/time/posix-timers.c +3 -4
@@ -430,7 +430,7 @@ static void posix_timer_unhash_and_free(struct k_itimer *tmr)static int common_timer_create (struct k_itimer *new_timer) { -hrtimer_init (&new_timer->it.real.timer, new_timer->it_clock,0 ); +hrtimer_setup (&new_timer->it.real.timer, posix_timer_fn, new_timer->it_clock,0 );return 0 ; }
@@ -784,7 +784,7 @@ static void common_hrtimer_arm(struct k_itimer *timr, ktime_t expires,/* * Posix magic: Relative CLOCK_REALTIME timers are not affected by * clock modifications, so they become CLOCK_MONOTONIC based under the -* hood. See hrtimer_init(). Update timr->kclock, so the generic +* hood. See hrtimer_setup(). Update timr->kclock, so the generic * functions which use timr->kclock->clock_get_*() work. * * Note: it_clock stays unmodified, because the next timer_set() might
@@ -793,8 +793,7 @@ static void common_hrtimer_arm(struct k_itimer *timr, ktime_t expires,if (timr->it_clock ==CLOCK_REALTIME ) timr->kclock = absolute ? &clock_realtime : &clock_monotonic; -hrtimer_init (&timr->it.real.timer, timr->it_clock, mode); - timr->it.real.timer.function = posix_timer_fn; +hrtimer_setup (&timr->it.real.timer, posix_timer_fn, timr->it_clock, mode);if (!absolute) expires =ktime_add_safe (expires, timer->base->get_time ());
kernel/time/sched_clock.c +1 -2
@@ -249,8 +249,7 @@ void __init generic_sched_clock_init(void)* Start the timer to keep sched_clock() properly updated and * sets the initial epoch. */ -hrtimer_init (&sched_clock_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL_HARD ); - sched_clock_timer.function = sched_clock_poll; +hrtimer_setup (&sched_clock_timer, sched_clock_poll,CLOCK_MONOTONIC ,HRTIMER_MODE_REL_HARD );hrtimer_start (&sched_clock_timer, cd.wrap_kt,HRTIMER_MODE_REL_HARD ); }
kernel/time/tick-broadcast-hrtimer.c +1 -2
@@ -100,7 +100,6 @@ static enum hrtimer_restart bc_handler(struct hrtimer *t)void tick_setup_hrtimer_broadcast (void ) { -hrtimer_init (&bctimer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_HARD ); - bctimer.function = bc_handler; +hrtimer_setup (&bctimer, bc_handler,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_HARD );clockevents_register_device (&ce_broadcast_hrtimer); }
kernel/time/tick-sched.c +2 -4
@@ -1572,12 +1572,10 @@ void tick_setup_sched_timer(bool hrtimer)struct tick_sched *ts =this_cpu_ptr (&tick_cpu_sched);/* Emulate tick processing via per-CPU hrtimers: */ -hrtimer_init (&ts->sched_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_HARD ); +hrtimer_setup (&ts->sched_timer, tick_nohz_handler,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_HARD ); -if (IS_ENABLED (CONFIG_HIGH_RES_TIMERS ) && hrtimer) { +if (IS_ENABLED (CONFIG_HIGH_RES_TIMERS ) && hrtimer)tick_sched_flag_set (ts,TS_FLAG_HIGHRES ); - ts->sched_timer.function = tick_nohz_handler; - }/* Get the next period (per-CPU) */ hrtimer_set_expires (&ts->sched_timer,tick_init_jiffy_update ());
Signature · 1 line
2.39.5
PATCH 21/31 bpf: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Alexei Starovoitov <[email protected]>
--- kernel/bpf/helpers.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/bpf/helpers.c +1 -2
@@ -1284,8 +1284,7 @@ static int __bpf_async_init(struct bpf_async_kern *async, struct bpf_map *map, uatomic_set (&t->cancelling,0 );INIT_WORK (&t->cb.delete_work, bpf_timer_delete_work); -hrtimer_init (&t->timer, clockid,HRTIMER_MODE_REL_SOFT ); - t->timer.function = bpf_timer_cb; +hrtimer_setup (&t->timer, bpf_timer_cb, clockid,HRTIMER_MODE_REL_SOFT ); cb->value = (void *)async - map->record->timer_off;break ;case BPF_ASYNC_TYPE_WQ :
Signature · 1 line
2.39.5
PATCH 22/31 ubifs: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Richard Weinberger <[email protected]>
--- fs/ubifs/io.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ubifs/io.c +1 -2
@@ -1179,8 +1179,7 @@ int ubifs_wbuf_init(struct ubifs_info *c, struct ubifs_wbuf *wbuf) wbuf->c = c; wbuf->next_ino =0 ; -hrtimer_init (&wbuf->timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); - wbuf->timer.function = wbuf_timer_callback_nolock; +hrtimer_setup (&wbuf->timer, wbuf_timer_callback_nolock,CLOCK_MONOTONIC ,HRTIMER_MODE_REL );return 0 ; }
Signature · 1 line
2.39.5
PATCH 23/31 watchdog: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Wim Van Sebroeck <[email protected]>
--- drivers/watchdog/softdog.c | 8 +++----- drivers/watchdog/watchdog_dev.c | 4 ++-- drivers/watchdog/watchdog_hrtimer_pretimeout.c | 4 ++-- kernel/watchdog.c | 3 +-- 4 files changed, 8 insertions(+), 11 deletions(-)
drivers/watchdog/softdog.c +3 -5
@@ -187,14 +187,12 @@ static int __init softdog_init(void)watchdog_set_nowayout (&softdog_dev, nowayout);watchdog_stop_on_reboot (&softdog_dev); -hrtimer_init (&softdog_ticktock,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); - softdog_ticktock.function = softdog_fire; +hrtimer_setup (&softdog_ticktock, softdog_fire,CLOCK_MONOTONIC ,HRTIMER_MODE_REL );if (IS_ENABLED (CONFIG_SOFT_WATCHDOG_PRETIMEOUT )) { softdog_info.options |=WDIOF_PRETIMEOUT ; -hrtimer_init (&softdog_preticktock,CLOCK_MONOTONIC , -HRTIMER_MODE_REL ); - softdog_preticktock.function = softdog_pretimeout; +hrtimer_setup (&softdog_preticktock, softdog_pretimeout,CLOCK_MONOTONIC , +HRTIMER_MODE_REL ); }if (soft_active_on_boot)
drivers/watchdog/watchdog_dev.c +2 -2
@@ -1051,8 +1051,8 @@ static int watchdog_cdev_register(struct watchdog_device *wdd) }kthread_init_work (&wd_data->work, watchdog_ping_work); -hrtimer_init (&wd_data->timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL_HARD ); - wd_data->timer.function = watchdog_timer_expired; +hrtimer_setup (&wd_data->timer, watchdog_timer_expired,CLOCK_MONOTONIC , +HRTIMER_MODE_REL_HARD );watchdog_hrtimer_pretimeout_init (wdd);if (wdd->id ==0 ) {
drivers/watchdog/watchdog_hrtimer_pretimeout.c +2 -2
@@ -23,8 +23,8 @@ void watchdog_hrtimer_pretimeout_init(struct watchdog_device *wdd) {struct watchdog_core_data *wd_data = wdd->wd_data; -hrtimer_init (&wd_data->pretimeout_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); - wd_data->pretimeout_timer.function = watchdog_hrtimer_pretimeout; +hrtimer_setup (&wd_data->pretimeout_timer, watchdog_hrtimer_pretimeout,CLOCK_MONOTONIC , +HRTIMER_MODE_REL ); }void watchdog_hrtimer_pretimeout_start (struct watchdog_device *wdd)
kernel/watchdog.c +1 -2
@@ -789,8 +789,7 @@ static void watchdog_enable(unsigned int cpu)* Start the timer first to prevent the hardlockup watchdog triggering * before the timer has a chance to fire. */ -hrtimer_init (hrtimer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL_HARD ); - hrtimer->function = watchdog_timer_fn; +hrtimer_setup (hrtimer, watchdog_timer_fn,CLOCK_MONOTONIC ,HRTIMER_MODE_REL_HARD );hrtimer_start (hrtimer,ns_to_ktime (sample_period),HRTIMER_MODE_REL_PINNED_HARD );
Signature · 1 line
2.39.5
PATCH 24/31 tracing/osnoise: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Steven Rostedt <[email protected]>
--- kernel/trace/trace_osnoise.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
kernel/trace/trace_osnoise.c +2 -4
@@ -1896,8 +1896,7 @@ static int timerlat_main(void *data) tlat->count =0 ; tlat->tracing_thread = false; -hrtimer_init (&tlat->timer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_PINNED_HARD ); - tlat->timer.function = timerlat_irq; +hrtimer_setup (&tlat->timer, timerlat_irq,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_PINNED_HARD ); tlat->kthread = current; osn_var->pid = current->pid;/*
@@ -2461,8 +2460,7 @@ static int timerlat_fd_open(struct inode *inode, struct file *file) tlat =this_cpu_tmr_var (); tlat->count =0 ; -hrtimer_init (&tlat->timer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_PINNED_HARD ); - tlat->timer.function = timerlat_irq; +hrtimer_setup (&tlat->timer, timerlat_irq,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_PINNED_HARD );migrate_enable ();return 0 ;
Signature · 1 line
2.39.5
Re: [PATCH 24/31] tracing/osnoise: Switch to use hrtimer_setup()
Quoted 8 lines · On Mon, 28 Oct 2024 08:31:57 +0100 Nam Cao <[email protected]> wrote:
There is a newly introduced
hrtimer_setup()which will replacehrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.Switch to use this new function.
Patch was created by using Coccinelle.
-- Steve
Quoted 31 lines
Signed-off-by Nam Cao <[email protected]>---
Cc: Steven Rostedt <[email protected]>--- kernel/trace/trace_osnoise.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)kernel/trace/trace_osnoise.c +2
-4@@ -1896,8 +1896,7 @@ static int timerlat_main(void *data) tlat->count =0 ; tlat->tracing_thread = false; -hrtimer_init (&tlat->timer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_PINNED_HARD ); - tlat->timer.function = timerlat_irq; +hrtimer_setup (&tlat->timer, timerlat_irq,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_PINNED_HARD ); tlat->kthread = current; osn_var->pid = current->pid;/* @@ -2461,8 +2460,7 @@ static int timerlat_fd_open(struct inode *inode, struct file *file) tlat =this_cpu_tmr_var (); tlat->count =0 ; -hrtimer_init (&tlat->timer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_PINNED_HARD ); - tlat->timer.function = timerlat_irq; +hrtimer_setup (&tlat->timer, timerlat_irq,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_PINNED_HARD );migrate_enable ();return 0 ;
PATCH 25/31 block, bfq: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Jens Axboe <[email protected]>
--- block/bfq-iosched.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
block/bfq-iosched.c +2 -3
@@ -7294,9 +7294,8 @@ static int bfq_init_queue(struct request_queue *q, struct elevator_type *e)INIT_LIST_HEAD (&bfqd->dispatch); -hrtimer_init (&bfqd->idle_slice_timer,CLOCK_MONOTONIC , -HRTIMER_MODE_REL ); - bfqd->idle_slice_timer.function = bfq_idle_slice_timer; +hrtimer_setup (&bfqd->idle_slice_timer, bfq_idle_slice_timer,CLOCK_MONOTONIC , +HRTIMER_MODE_REL ); bfqd->queue_weights_tree =RB_ROOT_CACHED ;#ifdef CONFIG_BFQ_GROUP_IOSCHED
Signature · 1 line
2.39.5
PATCH 26/31 ata: pata_octeon_cf: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Damien Le Moal <[email protected]>
--- drivers/ata/pata_octeon_cf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/ata/pata_octeon_cf.c +2 -3
@@ -935,9 +935,8 @@ static int octeon_cf_probe(struct platform_device *pdev) ap->mwdma_mask = enable_dma ?ATA_MWDMA4 :0 ;/* True IDE mode needs a timer to poll for not-busy. */ -hrtimer_init (&cf_port->delayed_finish,CLOCK_MONOTONIC , -HRTIMER_MODE_REL ); - cf_port->delayed_finish.function = octeon_cf_delayed_finish; +hrtimer_setup (&cf_port->delayed_finish, octeon_cf_delayed_finish,CLOCK_MONOTONIC , +HRTIMER_MODE_REL ); }else {/* 16 bit but not True IDE */ base = cs0 +0x800 ;
Signature · 1 line
2.39.5
Re: [PATCH 26/31] ata: pata_octeon_cf: Switch to use hrtimer_setup()
Quoted 9 lines · Nam Cao
There is a newly introduced
hrtimer_setup()which will replacehrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.Switch to use this new function.
Patch was created by using Coccinelle.
Signed-off-by Nam Cao <[email protected]>
Signature · 2 lines
Damien Le Moal Western Digital Research
PATCH 27/31 blk_iocost: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Jens Axboe <[email protected]>
--- block/blk-iocost.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
block/blk-iocost.c +1 -2
@@ -2997,8 +2997,7 @@ static void ioc_pd_init(struct blkg_policy_data *pd) iocg->hweight_inuse =WEIGHT_ONE ;init_waitqueue_head (&iocg->waitq); -hrtimer_init (&iocg->waitq_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS ); - iocg->waitq_timer.function = iocg_waitq_timer_fn; +hrtimer_setup (&iocg->waitq_timer, iocg_waitq_timer_fn,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS ); iocg->level = blkg->blkcg->css.cgroup->level;
Signature · 1 line
2.39.5
PATCH 28/31 PM: runtime: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: "Rafael J. Wysocki" <[email protected]>
--- drivers/base/power/runtime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/base/power/runtime.c +2 -2
@@ -1764,8 +1764,8 @@ void pm_runtime_init(struct device *dev)INIT_WORK (&dev->power.work, pm_runtime_work); dev->power.timer_expires =0 ; -hrtimer_init (&dev->power.suspend_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS ); - dev->power.suspend_timer.function = pm_suspend_timer_fn; +hrtimer_setup (&dev->power.suspend_timer, pm_suspend_timer_fn,CLOCK_MONOTONIC , +HRTIMER_MODE_ABS );init_waitqueue_head (&dev->power.wait_queue); }
Signature · 1 line
2.39.5
Re: [PATCH 28/31] PM: runtime: Switch to use hrtimer_setup()
Quoted 5 lines · Nam Cao
There is a newly introduced
hrtimer_setup()which will replacehrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Quoted 7 lines
Switch to use this new function.
Patch was created by using Coccinelle.
Signed-off-by Nam Cao <[email protected]>---
Cc: "Rafael J. Wysocki" <[email protected]>
Fine by me.
Quoted 22 lines
--- drivers/base/power/runtime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/base/power/runtime.c +2
-3@@ -1764,8 +1764,8 @@ void pm_runtime_init(struct device *dev)INIT_WORK (&dev->power.work, pm_runtime_work); dev->power.timer_expires =0 ; -hrtimer_init (&dev->power.suspend_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS ); - dev->power.suspend_timer.function = pm_suspend_timer_fn; +hrtimer_setup (&dev->power.suspend_timer, pm_suspend_timer_fn,CLOCK_MONOTONIC , +HRTIMER_MODE_ABS );init_waitqueue_head (&dev->power.wait_queue); } --2.39.5
PATCH 29/31 PM / devfreq: rockchip-dfi: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Heiko Stuebner <[email protected]>
--- drivers/devfreq/event/rockchip-dfi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/devfreq/event/rockchip-dfi.c +1 -2
@@ -642,8 +642,7 @@ static int rockchip_ddr_perf_init(struct rockchip_dfi *dfi)if (ret)return ret; -hrtimer_init (&dfi->timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); - dfi->timer.function = rockchip_dfi_timer; +hrtimer_setup (&dfi->timer, rockchip_dfi_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL );switch (dfi->ddr_type) {case ROCKCHIP_DDRTYPE_LPDDR2 :
Signature · 1 line
2.39.5
Re: [PATCH 29/31] PM / devfreq: rockchip-dfi: Switch to use hrtimer_setup()
Hi,
Thanks,
Quoted 34 lines · Nam Cao
There is a newly introduced
hrtimer_setup()which will replacehrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.Switch to use this new function.
Patch was created by using Coccinelle.
Signed-off-by Nam Cao <[email protected]>---
Cc: Heiko Stuebner <[email protected]>--- drivers/devfreq/event/rockchip-dfi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/devfreq/event/rockchip-dfi.c +1
-3@@ -642,8 +642,7 @@ static int rockchip_ddr_perf_init(struct rockchip_dfi *dfi)if (ret)return ret; -hrtimer_init (&dfi->timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); - dfi->timer.function = rockchip_dfi_timer; +hrtimer_setup (&dfi->timer, rockchip_dfi_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL );switch (dfi->ddr_type) {case ROCKCHIP_DDRTYPE_LPDDR2 : --2.39.5
Signature · 3 lines
Best Regards, Chanwoo Choi Samsung Electronics
PATCH 30/31 null_blk: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Jens Axboe <[email protected]>
--- drivers/block/null_blk/main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/block/null_blk/main.c +3 -4
@@ -1418,8 +1418,7 @@ static void nullb_setup_bwtimer(struct nullb *nullb) {ktime_t timer_interval =ktime_set (0 ,TIMER_INTERVAL ); -hrtimer_init (&nullb->bw_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); - nullb->bw_timer.function = nullb_bwtimer_fn; +hrtimer_setup (&nullb->bw_timer, nullb_bwtimer_fn,CLOCK_MONOTONIC ,HRTIMER_MODE_REL );atomic_long_set (&nullb->cur_bytes,mb_per_tick (nullb->dev->mbps));hrtimer_start (&nullb->bw_timer, timer_interval,HRTIMER_MODE_REL ); }
@@ -1596,8 +1595,8 @@ static blk_status_t null_queue_rq(struct blk_mq_hw_ctx *hctx,might_sleep_if (hctx->flags &BLK_MQ_F_BLOCKING );if (!is_poll && nq->dev->irqmode ==NULL_IRQ_TIMER ) { -hrtimer_init (&cmd->timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); - cmd->timer.function = null_cmd_timer_expired; +hrtimer_setup (&cmd->timer, null_cmd_timer_expired,CLOCK_MONOTONIC , +HRTIMER_MODE_REL ); } cmd->error =BLK_STS_OK ; cmd->nq = nq;
Signature · 1 line
2.39.5
PATCH 31/31 hwrng: timeriomem: Switch to use hrtimer_setup()
In reply to Nam CaoThere is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.
Switch to use this new function.
Patch was created by using Coccinelle.
---
Cc: Herbert Xu <[email protected]>
--- drivers/char/hw_random/timeriomem-rng.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/char/hw_random/timeriomem-rng.c +1 -2
@@ -152,8 +152,7 @@ static int timeriomem_rng_probe(struct platform_device *pdev) priv->period =ns_to_ktime (period *NSEC_PER_USEC );init_completion (&priv->completion); -hrtimer_init (&priv->timer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS ); - priv->timer.function = timeriomem_rng_trigger; +hrtimer_setup (&priv->timer, timeriomem_rng_trigger,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS ); priv->rng_ops.name =dev_name (&pdev->dev); priv->rng_ops.read = timeriomem_rng_read;
Signature · 1 line
2.39.5