Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1389645pxa; Thu, 20 Aug 2020 10:01:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRiCNu5jgQmdg5DX+fy2kr1u0XoFl0TU1AeT9nZP9pYE0kC+hHPv/quO2+Ui52DzUN4kdW X-Received: by 2002:a50:e70e:: with SMTP id a14mr3697323edn.93.1597942910485; Thu, 20 Aug 2020 10:01:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597942910; cv=none; d=google.com; s=arc-20160816; b=QOdJemBT/xp+o4CsycrT89rWfG8KQkjXmuWYYFf2rx/kM/3t8yM2F0HNkHTkxNCm56 fKsBiRY2amQHrH48Mh2SRo6sIsHqAtQ6h7ECv7mQtVL0zQe4snbrkcTdQdS43EIDv4Vt fMmrYZcy9GlrqK2h1BtjbVp5PsPEy4t9fQ/eNqOGS9TFig4IaHipRISnTmYUARbsuW7z XAmpgkfvdc+FRvKMeRICd7LaHxtDfZF8cdQ2TONdhuWGMCk0rmF35HbzJhrdH3xicJG1 tKhB28aNo/kooce9EH5xkw/pxpqJT0X/MCyLnyD6JxPtp2q66nHmsWiPX3s0qHNpo/o5 nUcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ielpATpoxC175HlYVPaZRtGDG6wSM3NX2rG0U8KO0UY=; b=ebfWiD1soiiSQ9HRZ5w3Nw9i/91aRyr44sDXQ2yZAP0Zz4BuIf0u/0bAoZJpLGuiAS Yzlf3XMPOyBsDnY19yLJllXj+aQyrR9cxS9L4v39jaaPzKgceECO20pz0IJYaBTHcIya CfFKBXp9dcO6X54BuOTts0VK10KP55kt+CzSizOyC9cZ3vZOmdZEf9Mftqre9Izo3v4o HrBkaddedPokTRjQqBgyqSK2HS/LAsf8v1s80vc4leHoRCJTkAmblb9gonhFp93U+XN0 drBicWIzYk+d9biA3ZZv1Fh04NKsIWkEwKihAk592+97gnDfcnFbh5PjQshuTHazolAd EKvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OFGFrB6v; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g13si1685061edf.308.2020.08.20.10.01.15; Thu, 20 Aug 2020 10:01:50 -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=pass header.i=@gmail.com header.s=20161025 header.b=OFGFrB6v; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729169AbgHTRAz (ORCPT + 99 others); Thu, 20 Aug 2020 13:00:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726983AbgHTRAm (ORCPT ); Thu, 20 Aug 2020 13:00:42 -0400 Received: from mail-yb1-xb43.google.com (mail-yb1-xb43.google.com [IPv6:2607:f8b0:4864:20::b43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6824DC061385 for ; Thu, 20 Aug 2020 10:00:41 -0700 (PDT) Received: by mail-yb1-xb43.google.com with SMTP id e14so1492382ybf.4 for ; Thu, 20 Aug 2020 10:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ielpATpoxC175HlYVPaZRtGDG6wSM3NX2rG0U8KO0UY=; b=OFGFrB6vca/XtMglGGZg2XKNmwxfBv0Mn1uwyAtX1jQ31VEUPu+aUij6QbloZhxh1J SIjYaXz0jrbJZd7XZN8iZhPJIfS0IVJ9/O2u2tk7LFon+SwPs/OD2L+8435k0JECCJn0 B4trMKLLoBa4CELX4Cj2KlW3qF2SjU/ZP6s15rqDbJixNY4Sdl2pMkxBbFYAHZ1tnu6E EeAefEkbZhzsVZBbTk7pm9xwiIaHNoDSpAwkVleud7YLNlsqg6Fw/NIN8BODYAQFnphl BwA40Ls+MDXuoJIUJzorWmEHAIqvjk/PrAT79/2jdOfVxxenLaPgcz+ymJTSQeiltgW3 OsiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ielpATpoxC175HlYVPaZRtGDG6wSM3NX2rG0U8KO0UY=; b=fO4i8O1/6hqKTeKjGwD/FPxEVUE/SNOUIgQN7m66sD0dG1Q8+ZKWNav1S+ChHBE0On SvdPTyG/c8j2meuVrTKzo4gWSczquN+H9qFCdZU2idKouFIo3TqipjfrelbddtmFboaF lB1/zV0cSf9dCQjHGb8hs7CB4YasworTwLcc7xinfgXPgIVgL/ER/EPgCNjmEVTVmhm6 Dej4tYU6Aak3TkeqKVSe1fPQCgfgO+k4sUcFbPq6Uhm0N7RkYFn+4yrYHWzuWazkJZWa w5BQo3es5BJIN2ZGAXEzCJT8ITlcTIM2a+NI4G+ohsQUkNa49DDKnm+aLHBg4FaYin7f gAYA== X-Gm-Message-State: AOAM530jtA8PiqjE+3I0FQKGwhtcEMMj7xBo7yE5lKYPxNZMv2/O+9SP JkP/e+rJcYOPK4b9RDFoIx6kQZdOHJ4+nzajAWU= X-Received: by 2002:a25:1943:: with SMTP id 64mr6213588ybz.14.1597942840261; Thu, 20 Aug 2020 10:00:40 -0700 (PDT) MIME-Version: 1.0 References: <20200214035555.24762-1-wgong@codeaurora.org> <878se9iup3.fsf@codeaurora.org> In-Reply-To: From: Krishna Chaitanya Date: Thu, 20 Aug 2020 22:30:28 +0530 Message-ID: Subject: Re: [RFC] ath10k: change to do napi_enable and napi_disable when insmod and rmmod for sdio To: Ben Greear Cc: Wen Gong , Kalle Valo , linux-wireless , ath10k Content-Type: text/plain; charset="UTF-8" Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Thu, Aug 20, 2020 at 10:02 PM Ben Greear wrote: > > On 8/20/20 9:08 AM, Krishna Chaitanya wrote: > > On Thu, Aug 20, 2020 at 8:07 PM Wen Gong wrote: > >> > >> On 2020-08-20 18:52, Krishna Chaitanya wrote: > >>> On Thu, Aug 20, 2020 at 3:45 PM Wen Gong wrote: > >>>> > >>>> On 2020-08-20 17:19, Krishna Chaitanya wrote: > >> ... > >>>>>> I'm not really convinced that this is the right fix, but I'm no NAPI > >>>>>> expert. Can anyone else help? > >>>>> Calling napi_disable() twice can lead to hangs, but moving NAPI from > >>>>> start/stop to > >>>>> the probe isn't the right approach as the datapath is tied to > >>>>> start/stop. > >>>>> > >>>>> Maybe check the state of NAPI before disable? > >>>>> > >>>>> if (test_bit(NAPI_STATE_SCHED, &ar->napi.napi.state)) > >>>>> napi_disable(&ar->napi) > >>>>> or maintain napi_state like this > >>>>> https://patchwork.kernel.org/patch/10249365/ > >>>> it is better to use above link's patch. > >>>> napi.state is controlled by napi API, it is better ath10k not know it. > >>> Sure, but IMHO just canceling the async rx work should solve the issue. > >> Oh no, canceling the async rx work will not solve this issue, rx worker > >> ath10k_rx_indication_async_work call napi_schedule, after napi_complete, > >> the NAPI_STATE_SCHED will clear. > >> The issue of this patch is because 2 thread called to hif_stop and > >> NAPI_STATE_SCHED not clear. > > That fix is still valid and good to have. > > > > ndev_stop being called twice is typical scenarios (stop vs rmmod), so > > just checking the netdev_flags for IFF_UP and returning from hif_Stop > > should suffice, no? > > My approach to fix this problem was to add a boolean in ath10k as to whether > it had napi enabled or not, and then check that before trying to enable/disable > it again. Seems to work fine, and cleaner in my mind than checking internal > napi flags. A much simpler approach is just to check for IFF_UP and skip NAPI (and others) in the hif_stop no? (provided proper RTNL locking is done if hif_stop is being called internally as well).