Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1098364pxa; Thu, 20 Aug 2020 02:22:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNQT8gamczyRLFzK25kDhQ6EFbsS3fVnrXJ+EqcIs+wdHfuhCOmFFqdGXxi8EoFLx4dO9B X-Received: by 2002:a17:906:413:: with SMTP id d19mr2427116eja.523.1597915337298; Thu, 20 Aug 2020 02:22:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597915337; cv=none; d=google.com; s=arc-20160816; b=oaQ/QoloTzSfzoFd1LzrYnT3YITnMyh6vftpK83BHNDBu7WKpnz8ADbrbcLeErZQwc 6S47ytQm4OSRZ+IjfoN81eU0xee46bIMVdq/86iJgEnjp/nPpADvcxuPeqVOrjRESwVn fm5qLhNi+Om7yVZ3YVk/HH8YG6ncqcjqA3jddKICgGyaW3zEb9pNtsMeHN6B18fsfPpX abIt+XMZMxVvsIQfQ5cQDFZ7GPPjThxoi0xL0t5aqzSQ60bnsBCWdmJ+xPg5Vnd3Nqja 17QJD8xnuWWBEWJOHZ5cMFbAH26A1FSnCyaJOONVgckkG3KGFz6oU5/UcCdXznV8W6Kh cVrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=uHIyqsq5NP71jxpWiW9fsYcrjpHYF1rvE2aWVNxyr4w=; b=Lvgtrm4vqrgL7HYZt8CitJb8iieMn+aGY5ekYq5eDePib8r87gMCD1+AMWJyB3p9QD S4wScZ4U/7J4vR3YsAPmsXr7CMIMqslqbKaR97CQlE0f+4BkBOhJ38PLasV6poOa1BGl 9Y3zor0UQSQ0f9ozrSTDJijkYejc7vHlxhwbWW/Ma5zD7hozVrlyQkVDANVbVxy8Pag3 OElaU0nWHMmpdoqsVFxGw8zMAOeQf34JEUwNz9WmufJ/dXYgiwqlXX1MqSOUCnSt+xAN CrxG85aYiY99qLqZ7wSzx88rxIAjoM2fhunjHqaVhLEC5UdEdEBcQgT0zPP7sSjGVV2g 2/9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=bAJf4Tto; 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 s14si839816eju.89.2020.08.20.02.21.37; Thu, 20 Aug 2020 02:22:17 -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=@mg.codeaurora.org header.s=smtp header.b=bAJf4Tto; 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 S1726925AbgHTJTL (ORCPT + 99 others); Thu, 20 Aug 2020 05:19:11 -0400 Received: from mail29.static.mailgun.info ([104.130.122.29]:45748 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726870AbgHTJSo (ORCPT ); Thu, 20 Aug 2020 05:18:44 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1597915124; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=uHIyqsq5NP71jxpWiW9fsYcrjpHYF1rvE2aWVNxyr4w=; b=bAJf4Tto88H1BmpsQ8B7Pdkz3h429tws4UII8HhPkN8qHhCHay6p/pWKfxVs2RgnJ5P4jc0l avBlvfCFEJTUdSp/ejPyAp/YNnzDifdWvh3XGywPHAKXBWzArUwO64ylI+ZbnGdyByL5Wzw3 5FwG00vROGuzDqXbmj2V6Upetx0= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-west-2.postgun.com with SMTP id 5f3e3fe3e8bbfbec1018953a (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 20 Aug 2020 09:18:27 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id E7F32C43391; Thu, 20 Aug 2020 09:18:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: wgong) by smtp.codeaurora.org (Postfix) with ESMTPSA id 78ACFC433CA; Thu, 20 Aug 2020 09:18:26 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 20 Aug 2020 17:18:26 +0800 From: Wen Gong To: Kalle Valo Cc: ath10k@lists.infradead.org, linux-wireless@vger.kernel.org Subject: Re: [PATCH v4 1/2] ath10k: add refcount for ath10k_core_restart In-Reply-To: <87imdlkuw8.fsf@codeaurora.org> References: <20200108031957.22308-1-wgong@codeaurora.org> <20200108031957.22308-2-wgong@codeaurora.org> <87imdlkuw8.fsf@codeaurora.org> Message-ID: <725b4377f63c76627e1e68604323cb74@codeaurora.org> X-Sender: wgong@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 2020-08-15 01:19, Kalle Valo wrote: ... > > I have been thinking a different approach for this. I think another > option is to have a function like this: > > ath10k_core_firmware_crashed() > { > queue_work(ar->workqueue, &ar->restart_work); > } > > In patch 1 we would convert all existing callers to call that > function instead of queue_work() directly. > > In patch 2 we would add a new flag to enum ath10k_dev_flags, or maybe > should actually use existing ATH10K_FLAG_CRASH_FLUSH? Don't know yet > which one is better. Now the function would do: I thinks we can use test_and_set_bit for atomic operation athough it is same with restart_count. and add a new flag, ATH10K_FLAG_CRASH_FLUSH is used for flush, if still use ATH10K_FLAG_CRASH_FLUSH, it should change clear_bit of it from ath10k_core_start to ath10k_reconfig_complete,because ieee80211_reconfig(called by ieee80211_restart_work) of mac80211 do many things and drv_start is 1st thing and drv_reconfig_complete is last thing, drv_reconfig_complete done means the restart finished. I will send patch v5 with above changes if not other advise. > > ath10k_core_firmware_crashed() > { > if (test_bit(flag)) > return > > set_bit(flag) > queue_work(ar->workqueue, &ar->restart_work); > } > > That way restart_work queue would be called only one time. > > Though I'm not sure how ATH10K_STATE_WEDGED would behave after this > change, it might get broken. Ah, actually I think even this patch > breaks > the WEDGED state. This firmware restart is tricky, difficult to say > what > is the best approach. Michal, are you reading? :) Any ideas? > > And after looking more about this patch I don't see the need for the > new > ar->restart_count atomic variable. Checking for ATH10K_FLAG_CRASH_FLUSH > would do the same thing AFAICS. > > And related to this, (in a separate patch) I think we should utilise > ATH10K_FLAG_CRASH_FLUSH more. For example in ath10k_wmi_cmd_send() to > not even try to send a WMI command if the flag is set. Basically all > hardware access should be disabled except what is needed to restart the > firmware.