Message ID | 20200927194846.045411263@linutronix.de |
---|---|
Headers | show |
Series | net: in_interrupt() cleanup and fixes | expand |
On Sun, 2020-09-27 at 21:48 +0200, Thomas Gleixner wrote: > Folks, > > 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. Are these patches intended to be applied to Linus' tree before v5.9 is released? This patchset will cause conflicts against -next. For instance, in patch 34, RT_TRACE has already been removed in -next.
From: Thomas Gleixner <tglx@linutronix.de> Date: Sun, 27 Sep 2020 21:48:46 +0200 > in the discussion about preempt count consistency accross kernel configurations: Please respin this against net-next, some of the patches in here are already in net-next (the wireless debug macro one) and even after that the series doesn't build: drivers/net/ethernet/cisco/enic/enic_main.c: In function ‘enic_reset’: drivers/net/ethernet/cisco/enic/enic_main.c:2315:2: error: implicit declaration of function ‘enic_set_api_state’; did you mean ‘enic_set_api_busy’? [-Werror=implicit-function-declaration] 2315 | enic_set_api_state(enic, true); | ^~~~~~~~~~~~~~~~~~ | enic_set_api_busy At top level: drivers/net/ethernet/cisco/enic/enic_main.c:2298:13: warning: ‘enic_set_api_busy’ defined but not used [-Wunused-function] 2298 | static void enic_set_api_busy(struct enic *enic, bool busy) | ^~~~~~~~~~~~~~~~~
On Sun, 2020-09-27 at 21:49 +0200, Thomas Gleixner wrote: > From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> > > The usage of in_interrupt) in driver code is phased out. > > The iwlwifi_dbg tracepoint records in_interrupt() seperately, but that's > superfluous because the trace header already records all kind of state and > context information like hardirq status, softirq status, preemption count > etc. > > Aside of that the recording of in_interrupt() as boolean does not allow to > distinguish between the possible contexts (hard interrupt, soft interrupt, > bottom half disabled) while the trace header gives precise information. > > Remove the duplicate information from the tracepoint and fixup the caller. > > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> > Signed-off-by: Thomas Gleixner <tglx@linutronix.de> > Cc: Johannes Berg <johannes.berg@intel.com> > Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com> > Cc: Luca Coelho <luciano.coelho@intel.com> > Cc: Intel Linux Wireless <linuxwifi@intel.com> > Cc: Kalle Valo <kvalo@codeaurora.org> > Cc: "David S. Miller" <davem@davemloft.net> > Cc: Jakub Kicinski <kuba@kernel.org> > Cc: linux-wireless@vger.kernel.org > Cc: netdev@vger.kernel.org Acked-by: Luca Coelho <luca@coelho.fi> -- Luca.
On Sun, Sep 27 2020 at 13:57, David Miller wrote: > From: Thomas Gleixner <tglx@linutronix.de> > Date: Sun, 27 Sep 2020 21:48:46 +0200 > >> in the discussion about preempt count consistency accross kernel configurations: > > Please respin this against net-next, some of the patches in here are already > in net-next (the wireless debug macro one) and even after that the series > doesn't build: Will do. > drivers/net/ethernet/cisco/enic/enic_main.c: In function ‘enic_reset’: > drivers/net/ethernet/cisco/enic/enic_main.c:2315:2: error: implicit declaration of function ‘enic_set_api_state’; did you mean ‘enic_set_api_busy’? [-Werror=implicit-function-declaration] > 2315 | enic_set_api_state(enic, true); > | ^~~~~~~~~~~~~~~~~~ > | enic_set_api_busy > At top level: > drivers/net/ethernet/cisco/enic/enic_main.c:2298:13: warning: ‘enic_set_api_busy’ defined but not used [-Wunused-function] > 2298 | static void enic_set_api_busy(struct enic *enic, bool busy) > | ^~~~~~~~~~~~~~~~~ Duh, not sure how I managed that. Sorry. will fix and rebase. Thanks, tglx
On 9/27/20 12:48 PM, Thomas Gleixner wrote: > From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> > > in_interrupt() is ill defined and does not provide what the name > suggests. The usage especially in driver code is deprecated and a tree wide > effort to clean up and consolidate the (ab)usage of in_interrupt() and > related checks is happening. > > In this case the check covers only parts of the contexts in which these > functions cannot be called. It fails to detect preemption or interrupt > disabled invocations. > > As the functions which are invoked from ionic_adminq_post() and > ionic_dev_cmd_wait() contain a broad variety of checks (always enabled or > debug option dependent) which cover all invalid conditions already, there > is no point in having inconsistent warnings in those drivers. > > Just remove them. > > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> > Signed-off-by: Thomas Gleixner <tglx@linutronix.de> > Cc: Shannon Nelson <snelson@pensando.io> > Cc: Pensando Drivers <drivers@pensando.io> > Cc: "David S. Miller" <davem@davemloft.net> > Cc: Jakub Kicinski <kuba@kernel.org> > Cc: netdev@vger.kernel.org Thanks. Acked-by: Shannon Nelson <snelson@pensando.io> > --- > drivers/net/ethernet/pensando/ionic/ionic_main.c | 4 ---- > 1 file changed, 4 deletions(-) > > --- a/drivers/net/ethernet/pensando/ionic/ionic_main.c > +++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c > @@ -248,8 +248,6 @@ static int ionic_adminq_post(struct ioni > struct ionic_queue *adminq; > int err = 0; > > - WARN_ON(in_interrupt()); > - > if (!lif->adminqcq) > return -EIO; > > @@ -346,8 +344,6 @@ int ionic_dev_cmd_wait(struct ionic *ion > int done; > int err; > > - WARN_ON(in_interrupt()); > - > /* Wait for dev cmd to complete, retrying if we get EAGAIN, > * but don't wait any longer than max_seconds. > */ >