Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3187554pxk; Mon, 28 Sep 2020 10:26:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbRZj5UrBjKQE2L1sh4BNUu6h+nrnPm2sF8x/pC2YfjpBnFyNWCyVOH+Bq8dEgDvCALdww X-Received: by 2002:aa7:d4d0:: with SMTP id t16mr2963030edr.83.1601313989258; Mon, 28 Sep 2020 10:26:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601313989; cv=none; d=google.com; s=arc-20160816; b=jxO1io328YTBa2maWgepobDAgD0WSNO5cIUusGLmHPBLrM8Kme7wU8TvhLQUawu34r Mj9NgWVgmbeYo1yRIfJTa8D1rWh1o2lhwt2gCB+GAcXsgraUgayL2WnfdHs0pApCflsT sD6JvckfDfNTbA7qzYAEbwR0L6/7JsUPw9Nu1h6TQ6sGGHzdiyEObKwxPJkCTo/u2rxI EOvXP6vw2WhEWxqOP8uYg5/OopXVtah3EWrzoq3Mk/zR4sNpkBZbTR7I5H+ESsaghadH ko+zuVc1VFOLmlZW9VXo9v8w+CDIIeBkl5r8Xo27tAe/RbFCbvIRxiaWPwCw5d1SNZfb qXbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=dXB5sy6RuZTJPqx7JJLXNWe1a908CXA07ElMJ2w7R68=; b=KfMmB2VcG5UljuppvNNiOLLvrPvcWhJ1TZlUEDwJNEs4fSn9malRgct3rTewtOG0Ef c2W7k/5cS/YsI2C20xCph382KwYJrTV/j/UojB41sd18KCUb83hyoctGCdBx9OzH1MlS nc8uZ0x/vT36LPLJEaxJGG1xJiO+NNrfCLa50aVtoWQmnvThAkTo2xLdlhQHcjHqnazA O6uWwMjb3diu5CmyTeTZ3az6LhfehNut5fJ4fuKX8p8drEUSv9IzuQiVR+ynyz6fC+yu g/cnJXyK8a3OEKSvaPv2aPfIRyrjN2e/vQRrbkAnOUVWNd3eHU/W0UEBnAWozm8aN165 NFlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@pensando.io header.s=google header.b=sJXRxO3V; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f14si1021882edt.186.2020.09.28.10.25.59; Mon, 28 Sep 2020 10:26:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@pensando.io header.s=google header.b=sJXRxO3V; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726693AbgI1RY4 (ORCPT + 99 others); Mon, 28 Sep 2020 13:24:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726670AbgI1RYx (ORCPT ); Mon, 28 Sep 2020 13:24:53 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27C81C0613CF for ; Mon, 28 Sep 2020 10:24:52 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id q123so1679350pfb.0 for ; Mon, 28 Sep 2020 10:24:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=dXB5sy6RuZTJPqx7JJLXNWe1a908CXA07ElMJ2w7R68=; b=sJXRxO3VX4I/D6OKhoVkZO/piViwl1rsupkYazfFzknNozgI8OsHjhRNoJktdix5sL XUePafekvxNj5dX2ZMNgPcxdgvjKnkbGxEJHb5M7MD6jsXR24Z16f7Q8EMF5gSrpcqV3 6mdJsMem+f4C7b9Iy8bk9humZkeCkuU0VDUAFi3VrIZ1AvBJykcO3j/m813G3+0PUELA 8jig6g1XAuBTfOqXNacgr0soT1uIdlZZ/QhywRu6HBMy1Ncr+lfoiCUVKIuNsV2E8yzC 6Etpltkq/5EZsG8x+m98hzY644sBlZD9g9rlktFFEXZxJkhYAnrqwKkSvnbtDB8ytbwH WhHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=dXB5sy6RuZTJPqx7JJLXNWe1a908CXA07ElMJ2w7R68=; b=RGDC5jE/RViGZjrZfNw6/QcwTIGje42QDRpNxjLUy7IVTfBXt+3vPiNBSSAhHBTzo9 5pHa5YS42TR6QFEM8aSE+Qx62okQwy96R1OOcOfaqsy58CJzc9JVTZt0B397XYyo3Hdm j9KyeqSlDGSF8KfGkIYgZfGer+Kq8nl0ld6AKx7nHQPtQnmmvVJ44LfqLiuHRqistgH+ 0BbOErT/sJeoAQIDm+V1fGcsYRDqYZyKsA1Rq8HFe/tGALMcc6UiTZrln1CbvQgGE345 UDzY3NnUlxIs4vgd/1K0T52+kyeScncr/PssujgoreD8+Rqo12l54cAJqqjBWadH6A+K kdZQ== X-Gm-Message-State: AOAM530gF1HQx2jRSTaDLsEYbv6P8PWro0vpHsU6wNGQz2MZpUgMHouY kN36SbsnKgy1XeTw8xGaCrp9Tg== X-Received: by 2002:a63:784:: with SMTP id 126mr121408pgh.428.1601313891289; Mon, 28 Sep 2020 10:24:51 -0700 (PDT) Received: from Shannons-MacBook-Pro.local (static-50-53-47-17.bvtn.or.frontiernet.net. [50.53.47.17]) by smtp.gmail.com with ESMTPSA id u71sm2511314pfc.43.2020.09.28.10.24.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Sep 2020 10:24:50 -0700 (PDT) Subject: Re: [patch 11/35] net: ionic: Replace in_interrupt() usage. To: Thomas Gleixner , LKML Cc: Peter Zijlstra , Linus Torvalds , Paul McKenney , Matthew Wilcox , Sebastian Andrzej Siewior , Pensando Drivers , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, Christian Benvenuti , Govindarajulu Varadarajan <_govind@gmx.com>, Jonathan Corbet , Mauro Carvalho Chehab , linux-doc@vger.kernel.org, Luc Van Oostenryck , Jay Cliburn , Chris Snook , Vishal Kulkarni , Jeff Kirsher , intel-wired-lan@lists.osuosl.org, Andrew Lunn , Heiner Kallweit , Russell King , Thomas Bogendoerfer , Solarflare linux maintainers , Edward Cree , Martin Habets , Jon Mason , Daniel Drake , Ulrich Kunitz , Kalle Valo , linux-wireless@vger.kernel.org, linux-usb@vger.kernel.org, Greg Kroah-Hartman , Arend van Spriel , Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , brcm80211-dev-list.pdl@broadcom.com, brcm80211-dev-list@cypress.com, Stanislav Yakovlev , Stanislaw Gruszka , Johannes Berg , Emmanuel Grumbach , Luca Coelho , Intel Linux Wireless , Jouni Malinen , Amitkumar Karwar , Ganapathi Bhat , Xinming Hu , libertas-dev@lists.infradead.org, Pascal Terjan , Ping-Ke Shih References: <20200927194846.045411263@linutronix.de> <20200927194920.918550822@linutronix.de> From: Shannon Nelson Message-ID: <5e4c3201-9d90-65b1-5c13-e2381445be1d@pensando.io> Date: Mon, 28 Sep 2020 10:24:47 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20200927194920.918550822@linutronix.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 9/27/20 12:48 PM, Thomas Gleixner wrote: > From: Sebastian Andrzej Siewior > > The in_interrupt() usage in this driver tries to figure out which context > may sleep and which context may not sleep. in_interrupt() is not really > suitable as it misses both preemption disabled and interrupt disabled > invocations from task context. > > Conditionals like that in driver code are frowned upon in general because > invocations of functions from invalid contexts might not be detected > as the conditional papers over it. > > ionic_lif_addr() can be called from: > > 1) ->ndo_set_rx_mode() which is under netif_addr_lock_bh()) so it must not > sleep. > > 2) Init and setup functions which are in fully preemptible task context. > > _ionic_lif_rx_mode() has only one call path with BH disabled. > > ionic_link_status_check_request() has two call paths: > > 1) NAPI which obviously cannot sleep > > 2) Setup which is again fully preemptible task context > > Add 'can_sleep' arguments to the affected functions and let the callers > provide the context instead of letting the functions deduce it. > > Signed-off-by: Sebastian Andrzej Siewior > Signed-off-by: Thomas Gleixner > Cc: Shannon Nelson > Cc: Pensando Drivers > Cc: "David S. Miller" > Cc: Jakub Kicinski > Cc: netdev@vger.kernel.org Acked-by: Shannon Nelson > --- > > While reviewing the callpaths, a couple of things were observed which could > be improved: > > - ionic_lif_deferred_work() can iterate over the list. There is no need > to schedule the work item after each iteration I think the original writer's intent was to avoid monopolizing the work thread for very long on any one cycle, with the thought that we'd be making more use of this than we currently are.  I'll address this. > > - ionic_link_status_check_request() could have ionic_deferred_work within > ionic_lif(). This would avoid memory allocation from NAPI. More > important, once IONIC_LIF_F_LINK_CHECK_REQUESTED is set and that alloc > fails, the link check never happens. Thanks, I'll fix up that error condition. > > - ionic_lif_handle_fw_down() sets IONIC_LIF_F_FW_RESET. Invokes then > ionic_lif_deinit() which only invokes cancel_work_sync() if > IONIC_LIF_F_FW_RESET is not set. I think the logic is wrong here as > the work must always be cancled. Also the list with ionic_deferred > work items needs a clean up. I'll look at that, thanks. sln