Message ID | 20200929202509.673358734@linutronix.de |
---|---|
Headers | show |
Series | net: in_interrupt() cleanup and fixes | expand |
From: Thomas Gleixner <tglx@linutronix.de> Date: Tue, 29 Sep 2020 22:25:09 +0200 > in the discussion about preempt count consistency accross kernel configurations: > > https://lore.kernel.org/r/20200914204209.256266093@linutronix.de/ > > Linus clearly requested that code in drivers and libraries which changes > behaviour based on execution context should either be split up so that > e.g. task context invocations and BH invocations have different interfaces > or if that's not possible the context information has to be provided by the > caller which knows in which context it is executing. > > This includes conditional locking, allocation mode (GFP_*) decisions and > avoidance of code paths which might sleep. > > In the long run, usage of 'preemptible, in_*irq etc.' should be banned from > driver code completely. > > This is the second version of the first batch of related changes. V1 can be > found here: > > https://lore.kernel.org/r/20200927194846.045411263@linutronix.de ... Series applied to net-next, thanks.
On 9/29/2020 10:25 PM, Thomas Gleixner wrote: > From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> > > The usage of in_interrupt() in drivers is phased out and Linus clearly > requested that code which changes behaviour depending on context should > either be seperated or the context be conveyed in an argument passed by the > caller, which usually knows the context. > > brcmf_fweh_process_event() uses in_interrupt() to select the allocation > mode GFP_KERNEL/GFP_ATOMIC. Aside of the above reasons this check is > incomplete as it cannot detect contexts which just have preemption or > interrupts disabled. > > All callchains leading to brcmf_fweh_process_event() can clearly identify > the calling context. Convey a 'gfp' argument through the callchains and let > the callers hand in the appropriate GFP mode. > > This has also the advantage that any change of execution context or > preemption/interrupt state in these callchains will be detected by the > memory allocator for all GFP_KERNEL allocations. Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> > Signed-off-by: Thomas Gleixner <tglx@linutronix.de> > --- > V2: Adopt to the 'inirq' changes > --- > drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 10 ++++++---- > drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c | 8 ++------ > drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h | 7 ++++--- > drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 2 +- > 4 files changed, 13 insertions(+), 14 deletions(-)