Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1417306pxa; Thu, 20 Aug 2020 10:42:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMC80Tu21lTxSdL93K3ur4YU2j7xNGi8sV6ODO/3KFFfojUulk38hXWDEcTz41ZZhftyS9 X-Received: by 2002:a17:906:2b57:: with SMTP id b23mr4268143ejg.26.1597945374444; Thu, 20 Aug 2020 10:42:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597945374; cv=none; d=google.com; s=arc-20160816; b=msgRxQlT437iMW7KFD91ctjGVgW1yjsH/raKvUuELSdQpKxSWoNri2NXp9LxXgj1+u dbD5B9m/Cz4Hbdcf2o1UDoUVjd1SfBzd1+MY/4WHMspG+ONziwEdT72U+P2IutD+luFc jK6uM+xKjyi1S7TcWk4yDIq710U3Kwq4FbTVkncjtGHj79jqq7ryFGRtm0vL5phXBRFK ZSFFFsEsyoobtp1fUtPXA9EhT+QXg2JkVJtjejH76ZMxS8iNs/gsvQXH6HwVXNpl2cFe xhf3qZVXGwzgzRm3SQSNem5uGWhXj9zYwoepzJQ8eaPJ2HRYusbGdAXFrhsoLoNxO/uO i6Ug== 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=KyX3R1AKP6JirtUc1Xq7LP0pQ3j6g8z4OI4gzACWuuM=; b=HeGaL6ZGcfYcHmVboh/nRjZkt6iTWG3Gmapr1U6Xj6sD/lbcFjHQery6ats7VxaWzB glcj5qSj0hpCIYG4EY6DzO51QsL6k36LOusqIbYPIv04vsIkjtDHikCAIfAbFg3LsW+1 TsSh/48db5VuqL+MqsIpll87IbRAf+3Flc/GjWUtkvVyVdZHMllREusYXrH9HZaod1NB UVZXhyckqA6JTP4fORnLb3Lt15MJ9jGc1BKSL6AcF1gd1AOGZnOTCYkVMyfkv4Utb855 oy93rl3rYX/cI8ceYhI2MbJmabrljSrMDY6DRvXyAfp2cz3RxLWn+bn35mGFwJMblX1W zLAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lf9B50+C; 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 g18si1605844ejb.224.2020.08.20.10.42.13; Thu, 20 Aug 2020 10:42:54 -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=lf9B50+C; 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 S1726870AbgHTRmA (ORCPT + 99 others); Thu, 20 Aug 2020 13:42:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728044AbgHTRlo (ORCPT ); Thu, 20 Aug 2020 13:41:44 -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 14CB0C061386 for ; Thu, 20 Aug 2020 10:41:43 -0700 (PDT) Received: by mail-yb1-xb43.google.com with SMTP id q16so1555557ybk.6 for ; Thu, 20 Aug 2020 10:41:43 -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=KyX3R1AKP6JirtUc1Xq7LP0pQ3j6g8z4OI4gzACWuuM=; b=lf9B50+C2qeZdZvA8Jx/CU3xIilL3xpMaMLYrlej5+qzVyvN0MTTXPtdXlX+A9OCkO X9t1hJ7OcTmXYFNXOAr5OBSa+2eLqH6AZ9Jy4maqdEP5PO5ww7A2lMPTzkzz2Pdq0ddl wQ0LIYP13yVhwhfVaYUOcFd4vzxhQrPiW3LtbbU1oYIpiWC+okKnt8kQHKPoXQuj9gug c7K+v+hvjzLZal2zl3SacaXEgHo6P+YroTgwD8vcCu52DuakaTOLvQulQWQYA6uDnQT8 z3aAt8Dej+0tpvU2hcb5rRsqWaKgG8H18XmPKCqObBRSM/jfAXhdTLQXJtACp9I28IZO 3ASg== 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=KyX3R1AKP6JirtUc1Xq7LP0pQ3j6g8z4OI4gzACWuuM=; b=jLwexKJz1/K/lFERSftg57ZrB8dDvH1b8u/Hk8QNeqbxbV2WktPZc0i2qv5pCrsAfc ZG4qH/zHOOakOHHAXJ96nM4W8HWEb4RjzbfAbSP92rqsHERFrMQ66sUay3qNVq8FreIs MSzobQZ6etzdU0ozr2aKmsDkfhG8eDNqnhefTEqOiKtxFx81pusqzKx9QKhLTBStD2Ir A+lnh7lsLOzmA5IGvIkDHyPd3hBBnv/s7GNY2JgjUiM9B41eJ+Z4ic+xnmSaezPQ+Q2G MHvIE+YG9yIty5SwR783ewJi/0rJfBdE2JQsi4PQefj9YuKQDuEm4yhAut+v4kC5H18o Y0fQ== X-Gm-Message-State: AOAM530zZUoqyM01yNghCAH41s+5QO7JPOw4dd9BNtQqzH8C0nKbNhYD Ax/88aAajNKAE2cdgfsBayOfbSBc2MZzPUow8XHA+mAf X-Received: by 2002:a25:d387:: with SMTP id e129mr6570128ybf.370.1597945302213; Thu, 20 Aug 2020 10:41:42 -0700 (PDT) MIME-Version: 1.0 References: <20200214035555.24762-1-wgong@codeaurora.org> <878se9iup3.fsf@codeaurora.org> <47c1b1e0-afc4-b9b4-5fc0-4636d8b3b981@candelatech.com> In-Reply-To: <47c1b1e0-afc4-b9b4-5fc0-4636d8b3b981@candelatech.com> From: Krishna Chaitanya Date: Thu, 20 Aug 2020 23:11:30 +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:38 PM Ben Greear wrote: > > On 8/20/20 10:00 AM, Krishna Chaitanya wrote: > > 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). > > > > I'm not sure, but I think the driver should be internally consistent and not > spend a lot of time trying to guess about interactions with objects higher > in the stack. Fair enough, the network interface state is a basic thing controlled by the driver, so, should be okay to use. Anyways, the in-driver approach has more control. > > Here is my original patch to fix this, it is not complex. > > https://patchwork.kernel.org/patch/10249363/ Sure, I have shared your patch above :).