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: Nam Cao <namcao@linutronix.de>, Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Marc Kleine-Budde <mkl@pengutronix.de>,
Oliver Neukum <oliver@neukum.org>, Kalle Valo <kvalo@kernel.org>
Subject: [PATCH 00/24] hrtimers: Switch to new hrtimer interface functions (3/5)
Date: Mon, 28 Oct 2024 08:34:13 +0100 [thread overview]
Message-ID: <cover.1729865232.git.namcao@linutronix.de> (raw)
This is the third part of a 5-part series (split for convenience). All 5
parts are:
Part 1: https://lore.kernel.org/lkml/cover.1729864615.git.namcao@linutronix.de
Part 2: https://lore.kernel.org/lkml/cover.1729864823.git.namcao@linutronix.de
Part 3: https://lore.kernel.org/lkml/cover.1729865232.git.namcao@linutronix.de
Part 4: https://lore.kernel.org/lkml/cover.1729865485.git.namcao@linutronix.de
Part 5: https://lore.kernel.org/lkml/cover.1729865740.git.namcao@linutronix.de
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);
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Oliver Neukum <oliver@neukum.org>
Cc: Kalle Valo <kvalo@kernel.org>
Nam Cao (24):
netdev: Switch to use hrtimer_setup()
net/sched: Switch to use hrtimer_setup()
mac802154: Switch to use hrtimer_setup()
tcp: Switch to use hrtimer_setup()
can: m_can: Switch to use hrtimer_setup()
can: mcp251xfd: Switch to use hrtimer_setup()
can: Switch to use hrtimer_setup()
net: ethernet: ti: Switch to use hrtimer_setup()
net: ethernet: cortina: Switch to use hrtimer_setup()
net: ethernet: ec_bhf: Switch to use hrtimer_setup()
net: ethernet: hisilicon: Switch to use hrtimer_setup()
net: sparx5: Switch to use hrtimer_setup()
net: ieee802154: at86rf230: Switch to use hrtimer_setup()
net: mvpp2: Switch to use hrtimer_setup()
net: qualcomm: rmnet: Switch to use hrtimer_setup()
net: stmmac: Switch to use hrtimer_setup()
net: fec: Switch to use hrtimer_setup()
net: wwan: iosm: Switch to use hrtimer_setup()
net/cdc_ncm: Switch to use hrtimer_setup()
wifi: Switch to use hrtimer_setup()
wifi: rt2x00: Switch to use hrtimer_setup()
igc: Switch to use hrtimer_setup()
octeontx2-pf: Switch to use hrtimer_setup()
xfrm: Switch to use hrtimer_setup()
drivers/net/can/m_can/m_can.c | 9 ++++---
.../net/can/spi/mcp251xfd/mcp251xfd-ring.c | 8 +++----
drivers/net/ethernet/cortina/gemini.c | 5 ++--
drivers/net/ethernet/ec_bhf.c | 3 +--
drivers/net/ethernet/freescale/fec_ptp.c | 4 ++--
drivers/net/ethernet/hisilicon/hip04_eth.c | 4 +---
drivers/net/ethernet/intel/igc/igc_main.c | 4 ++--
.../net/ethernet/marvell/mvpp2/mvpp2_main.c | 5 ++--
.../net/ethernet/marvell/octeontx2/af/ptp.c | 3 +--
.../ethernet/microchip/sparx5/sparx5_packet.c | 4 ++--
.../ethernet/qualcomm/rmnet/rmnet_map_data.c | 4 ++--
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 6 ++---
drivers/net/ethernet/ti/am65-cpsw-nuss.c | 9 ++++---
drivers/net/ethernet/ti/icssg/icssg_common.c | 5 ++--
drivers/net/ethernet/ti/icssg/icssg_prueth.c | 5 ++--
drivers/net/ieee802154/at86rf230.c | 4 ++--
drivers/net/usb/cdc_ncm.c | 3 +--
.../wireless/mediatek/mt76/mt76x02_usb_core.c | 4 ++--
.../net/wireless/ralink/rt2x00/rt2x00dev.c | 9 +++++--
drivers/net/wireless/virtual/mac80211_hwsim.c | 6 ++---
drivers/net/wwan/iosm/iosm_ipc_imem.c | 24 ++++++++-----------
net/can/bcm.c | 16 +++++--------
net/can/isotp.c | 10 ++++----
net/can/j1939/bus.c | 4 ++--
net/can/j1939/transport.c | 8 ++-----
net/core/dev.c | 3 +--
net/ipv4/tcp_timer.c | 10 ++++----
net/mac802154/main.c | 4 ++--
net/sched/act_gate.c | 3 +--
net/sched/sch_api.c | 3 +--
net/sched/sch_taprio.c | 6 ++---
net/xfrm/xfrm_state.c | 4 ++--
32 files changed, 84 insertions(+), 115 deletions(-)
--
2.39.5
next reply other threads:[~2024-10-28 7:34 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-28 7:34 Nam Cao [this message]
2024-10-28 7:34 ` [PATCH 01/24] netdev: Switch to use hrtimer_setup() Nam Cao
2024-10-28 7:34 ` [PATCH 02/24] net/sched: " Nam Cao
2024-10-28 7:34 ` [PATCH 03/24] mac802154: " Nam Cao
2024-10-28 7:34 ` [PATCH 04/24] tcp: " Nam Cao
2024-10-28 7:34 ` [PATCH 05/24] can: m_can: " Nam Cao
2024-10-28 14:02 ` Marc Kleine-Budde
2024-10-28 7:34 ` [PATCH 06/24] can: mcp251xfd: " Nam Cao
2024-10-28 14:02 ` Marc Kleine-Budde
2024-10-28 7:34 ` [PATCH 07/24] can: " Nam Cao
2024-10-28 14:03 ` Marc Kleine-Budde
2024-10-28 7:34 ` [PATCH 08/24] net: ethernet: ti: " Nam Cao
2024-10-28 7:34 ` [PATCH 09/24] net: ethernet: cortina: " Nam Cao
2024-10-28 7:34 ` [PATCH 10/24] net: ethernet: ec_bhf: " Nam Cao
2024-10-28 7:34 ` [PATCH 11/24] net: ethernet: hisilicon: " Nam Cao
2024-10-28 7:34 ` [PATCH 12/24] net: sparx5: " Nam Cao
2024-10-28 7:34 ` [PATCH 13/24] net: ieee802154: at86rf230: " Nam Cao
2024-10-28 7:34 ` [PATCH 14/24] net: mvpp2: " Nam Cao
2024-10-28 7:34 ` [PATCH 15/24] net: qualcomm: rmnet: " Nam Cao
2024-10-28 7:34 ` [PATCH 16/24] net: stmmac: " Nam Cao
2024-10-28 7:34 ` [PATCH 17/24] net: fec: " Nam Cao
2024-10-28 7:34 ` [PATCH 18/24] net: wwan: iosm: " Nam Cao
2024-10-28 7:34 ` [PATCH 19/24] net/cdc_ncm: " Nam Cao
2024-10-28 7:34 ` [PATCH 20/24] wifi: " Nam Cao
2024-10-28 7:34 ` [PATCH 21/24] wifi: rt2x00: " Nam Cao
2024-10-28 7:34 ` [PATCH 22/24] igc: " Nam Cao
2024-10-28 7:34 ` [PATCH 23/24] octeontx2-pf: " Nam Cao
2024-10-28 7:34 ` [PATCH 24/24] xfrm: " Nam Cao
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.1729865232.git.namcao@linutronix.de \
--to=namcao@linutronix.de \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=anna-maria@linutronix.de \
--cc=frederic@kernel.org \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=ojeda@kernel.org \
--cc=oliver@neukum.org \
--cc=pabeni@redhat.com \
--cc=tglx@linutronix.de \
/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