From: Nam Cao <namcao@linutronix.de>
To: Anna-Maria Behnsen <anna-maria@linutronix.de>,
Frederic Weisbecker <frederic@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Andreas Hindborg <a.hindborg@kernel.org>,
Alice Ryhl <aliceryhl@google.com>,
Miguel Ojeda <ojeda@kernel.org>, Kees Cook <kees@kernel.org>,
linux-kernel@vger.kernel.org
Cc: Jani Nikula <jani.nikula@linux.intel.com>,
intel-gfx@lists.freedesktop.org,
Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
x86@kernel.org, Jakub Kicinski <kuba@kernel.org>,
Kalle Valo <kvalo@kernel.org>, Jens Axboe <axboe@kernel.dk>,
Christian Brauner <brauner@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
John Stultz <jstultz@google.com>, Nam Cao <namcao@linutronix.de>,
Oliver Hartkopp <socketcan@hartkopp.net>
Subject: [RESEND PATCH v2 00/19] hrtimers: Consolidate hrtimer initialization - Part 1
Date: Thu, 31 Oct 2024 16:14:14 +0100 [thread overview]
Message-ID: <cover.1730386209.git.namcao@linutronix.de> (raw)
(resend due to broken emails)
This is a follow up to version 1, which can be found here:
https://lore.kernel.org/lkml/cover.1729864615.git.namcao@linutronix.de/
hrtimers must be initialized with a hrtimer_init() variant, and after that
the timer's callback function must be setup separately.
This separate initialization is error prone and awkward to use. The
separate initialization is also problematic for a clean Rust abstraction.
A combined setup function like timer_setup() is less error prone and
simpler to use.
This first part of the conversion provides:
- a set of hrtimer_setup*() variants, which take the function pointer as
argument.
- hrtimer_update_function() which allows to change the callback function
after initialization with the proper safety checks in place.
- conversion of the hrtimer_init*_on_stack() variants
- some minor cleanups
The remaining users will be converted in follow up series.
Most conversions were done with Coccinelle. See sematic patch below.
Changes versus v1:
- Open code kvm_xen_init_vcpu() (Sean)
- Drop the can/bcm patch (Oliver)
- Folded the removal of hrtimer_init_sleeper() (tglx)
- Update change logs and cover letter
The series applies on top of:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
and is also available from git:
git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git hrtimer-setup-part1-v2
Best regards,
Nam
---
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);
---
arch/x86/kvm/xen.c | 12 +--
drivers/gpu/drm/i915/i915_request.c | 17 ++--
drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 2 -
fs/aio.c | 2 +-
include/linux/hrtimer.h | 51 +++++++-----
include/linux/wait.h | 4 +-
io_uring/io_uring.c | 7 +-
io_uring/timeout.c | 1 -
kernel/futex/core.c | 6 +-
kernel/sched/idle.c | 4 +-
kernel/time/alarmtimer.c | 9 +-
kernel/time/hrtimer.c | 110 ++++++++++++++++++-------
kernel/time/sleep_timeout.c | 2 +-
net/core/pktgen.c | 2 +-
14 files changed, 136 insertions(+), 93 deletions(-)
next reply other threads:[~2024-11-01 10:08 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-31 15:14 Nam Cao [this message]
2024-10-31 15:14 ` [RESEND PATCH v2 01/19] hrtimers: Add missing hrtimer_init() trace points Nam Cao
2024-10-31 15:14 ` [RESEND PATCH v2 02/19] drm/i915/request: Remove unnecessary modification of hrtimer::function Nam Cao
2024-10-31 15:14 ` [RESEND PATCH v2 03/19] KVM: x86/xen: Initialize hrtimer in kvm_xen_init_vcpu() Nam Cao
2024-10-31 15:14 ` [RESEND PATCH v2 04/19] wifi: rt2x00: Remove redundant hrtimer_init() Nam Cao
2024-10-31 15:14 ` [RESEND PATCH v2 05/19] io_uring: Remove redundant hrtimer's callback function setup Nam Cao
2024-10-31 15:21 ` Jens Axboe
2024-10-31 15:14 ` [RESEND PATCH v2 06/19] hrtimers: Introduce hrtimer_setup() to replace hrtimer_init() Nam Cao
2024-10-31 15:14 ` [RESEND PATCH v2 07/19] hrtimers: Introduce hrtimer_setup_on_stack() Nam Cao
2024-10-31 15:14 ` [RESEND PATCH v2 08/19] hrtimers: Introduce hrtimer_setup_sleeper_on_stack() Nam Cao
2024-10-31 15:14 ` [RESEND PATCH v2 09/19] hrtimers: Introduce hrtimer_update_function() Nam Cao
2024-10-31 15:14 ` [RESEND PATCH v2 10/19] fs/aio: Switch to use hrtimer_setup_sleeper_on_stack() Nam Cao
2024-10-31 15:14 ` [RESEND PATCH v2 11/19] futex: " Nam Cao
2024-10-31 15:14 ` [RESEND PATCH v2 12/19] net: pktgen: " Nam Cao
2024-10-31 15:14 ` [RESEND PATCH v2 13/19] timers: " Nam Cao
2024-10-31 15:14 ` [RESEND PATCH v2 14/19] wait: " Nam Cao
2024-10-31 15:14 ` [RESEND PATCH v2 15/19] hrtimers: Delete hrtimer_init_sleeper_on_stack() Nam Cao
2024-10-31 15:14 ` [RESEND PATCH v2 16/19] sched/idle: Switch to use hrtimer_setup_on_stack() Nam Cao
2024-10-31 15:14 ` [RESEND PATCH v2 17/19] io_uring: " Nam Cao
2024-10-31 15:14 ` [RESEND PATCH v2 18/19] alarmtimer: Switch to use hrtimer_setup() and hrtimer_setup_on_stack() Nam Cao
2024-10-31 15:14 ` [RESEND PATCH v2 19/19] hrtimers: Delete hrtimer_init_on_stack() Nam Cao
2024-11-04 10:56 ` ✗ Fi.CI.BUILD: failure for hrtimers: Consolidate hrtimer initialization - Part 1 (rev2) Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1730386209.git.namcao@linutronix.de \
--to=namcao@linutronix.de \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=anna-maria@linutronix.de \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=frederic@kernel.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=jstultz@google.com \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=seanjc@google.com \
--cc=socketcan@hartkopp.net \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox