Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1396490pxa; Thu, 20 Aug 2020 10:10:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2JLKZ2pBRl0x0KwJDSrfAEjhq2IaOUiYXMLjKIcCbNEsDxAs4/HrknxDzcJHLvasHaw7q X-Received: by 2002:aa7:ce90:: with SMTP id y16mr3938607edv.325.1597943414840; Thu, 20 Aug 2020 10:10:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597943414; cv=none; d=google.com; s=arc-20160816; b=uU4UK5zvor+hDrQRbXxl+VD3nBKxtsxiFc0ZDCYO6IRR4mHxR/ch+9df5Sn7FaoWoR KhXvRsuCV/wzHhzJeE9Br/wHwPqFInXBSp4ZcA04Yahhl+Gap3ZUZeFyPraHdZFlU7ZE cxknOBd1hflOVsyI3CP8SC7l+M0RYmamimFScIW36jFKVpibiSbWf6Mgaub2e98IrCp/ aJL3ma81mlzxBy4bbdsnly3Kxbu1dV4HwacBTADtdfspcnidtHPUDVJMzDVKHSjoxTup C919uobBjSVBLfQbp6AErx+q257hNA6Qc8f+xZfEU+xHNp8d2XpVAPnmfNzydE9VgihX nfeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature:dkim-filter; bh=G7rjArcnbttwLRt2NrH1A+E4s6Bi/lgs9ryCY6GG5+g=; b=TT1+jrFphvygjNJAqHc15XAPJAqrxOym28b1kGETHS2AulZi7/NMOu7XD9EYcXzVdP 6nld/tdg2bZw3W+SEJL6fM00lpg1Tm/QlsH8//6j0N4CDQP9OGcK8bKphDbNU1NjUXYb H1DVN22nZMU8Gw6RMVTn0BKi6A+ESel/+OM1rUbqV0KrBuiNgfAtwtlPVDK87GYGbefZ KUkikX1JJlMqiiH87LHSJfk3N/zJNKTiZf4Zbe+iOBcrNtpvFcMGqW5uaakmegzVbdqM HG5xADOg8GldabuLowMfoZhbhoD/6jU4dSFneFqquPcFT2M3za2pHSpGA05SsPXX8z6B eoHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@candelatech.com header.s=default header.b=HBmBmrCQ; 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=NONE dis=NONE) header.from=candelatech.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w12si1569523ejy.64.2020.08.20.10.09.43; Thu, 20 Aug 2020 10:10:14 -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=@candelatech.com header.s=default header.b=HBmBmrCQ; 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=NONE dis=NONE) header.from=candelatech.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730455AbgHTRJA (ORCPT + 99 others); Thu, 20 Aug 2020 13:09:00 -0400 Received: from mail2.candelatech.com ([208.74.158.173]:39906 "EHLO mail3.candelatech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730451AbgHTRIS (ORCPT ); Thu, 20 Aug 2020 13:08:18 -0400 Received: from [192.168.254.6] (unknown [50.34.202.127]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail3.candelatech.com (Postfix) with ESMTPSA id A3F4613C2B5; Thu, 20 Aug 2020 10:07:38 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com A3F4613C2B5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1597943259; bh=wkAV876t07mYfRLDUwuAEK1iF3lsl/qchb9/S3pHcZ0=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=HBmBmrCQb8qzz4ibY6SRmpS4vKvYSOuLminxoZhgCERu/CprzRc3QZniAre41fqEU T1aLILzRDsaAzNFoPwue+EvLeZ03Edty7QZGEKLyEG7CA678+QTReUvQcwDfV3gofq LQz7Nxxge5IuqRjfkJs7gNzVCJPc9h6WOxU/pAFk= Subject: Re: [RFC] ath10k: change to do napi_enable and napi_disable when insmod and rmmod for sdio To: Krishna Chaitanya Cc: Wen Gong , Kalle Valo , linux-wireless , ath10k References: <20200214035555.24762-1-wgong@codeaurora.org> <878se9iup3.fsf@codeaurora.org> From: Ben Greear Organization: Candela Technologies Message-ID: <47c1b1e0-afc4-b9b4-5fc0-4636d8b3b981@candelatech.com> Date: Thu, 20 Aug 2020 10:07:38 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-MW Content-Transfer-Encoding: 7bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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. Here is my original patch to fix this, it is not complex. https://patchwork.kernel.org/patch/10249363/ Thanks, Ben -- Ben Greear Candela Technologies Inc http://www.candelatech.com