Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp522339ybl; Fri, 10 Jan 2020 02:30:10 -0800 (PST) X-Google-Smtp-Source: APXvYqwtIA3XlWS0nhHaisBAUiV75GIG+7BaJ23MzCEYm3FNk/7yk07k9lqk9xVSqskd9D8m0P76 X-Received: by 2002:a54:4e08:: with SMTP id a8mr1678934oiy.77.1578652210756; Fri, 10 Jan 2020 02:30:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578652210; cv=none; d=google.com; s=arc-20160816; b=wCumBi8ghWQhuYweyrFa8U6KhQ+EVziPBlh7gUgqGO4WPeH2uOvmyAPoiZ0RLkXH+n 4LSQq/g+WERewjLsyk3owTawf7Xr3fwwd4b+HrEj5R74plALk9DbwvykyIuzFOlbLOlG 2xpxadA+CnlGXDDCFIuRWA/37nMeUqIx4oH6rp4NsgqxnlySmXP0OPj41l2JyPlGxMq6 aLFUyvkH/lQd4LqV8fNaEpoJ+x4VLC7u6j/SFkz/CvXvkUp6/S5dHfeUFzyKLZNJ/b5o jQs6DvI1eWX9WriR8pcpBnPW8hxFI8omOFyvUTZZqJLGzdMSydSVFEl0WYajh21sPaUR 8lfg== 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=IytsLbM1pR0Qzs157gZv5EoAroYoP4LB4watZpuwJso=; b=nEGvbtLWL6PObbIqxJn3BtbETQdbewksgt9S0asVjALFGonDssCjJxTiAAEtcusSVQ Kmfd9/0IvKFW+VWPiJXnGev8a/r5B/0Ur40tiunjY7fUQ0AWlSGEF1lhHZstJ0iS6Sh5 bzDiiwW5y0RAkVVwXnfT5v+5TiFy/Wb0ggO7My8Agb6sEWaIKCWdKOSiupDW8Dj7RSOb GdQTldwqnImcHlT9Nay+ZqfRHSOqZuTl6sKYv0BkdvXxerum/10PPyP9j1SWhd4D3uIg 6Tp/3JUi9dLXbEPDYcrhwrrglVHwaUDnD1jVGZ4yXc1/CpZzkaXo1lSxSo8tCAlcEcLm 9xpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=JrFHgdSF; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l16si965647otj.59.2020.01.10.02.29.49; Fri, 10 Jan 2020 02:30:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=JrFHgdSF; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727366AbgAJK3i (ORCPT + 99 others); Fri, 10 Jan 2020 05:29:38 -0500 Received: from mail26.static.mailgun.info ([104.130.122.26]:42074 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727339AbgAJK3h (ORCPT ); Fri, 10 Jan 2020 05:29:37 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1578652177; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=IytsLbM1pR0Qzs157gZv5EoAroYoP4LB4watZpuwJso=; b=JrFHgdSFAyGQHrPd8F/BVK76f2Mb/GZYG50RPpOlm6sQgfqi03hfZNJ+SaxpAoX4/bEwm3Ro MsoszPob5W5SHsFpCPSLPgFSFVY9O+qHJ2kT/dWu7IXFUhaLxHnZLBBl3M2Nnssou9d/5B0w +zAwbHe1L5T7Zlhmo9I959h6qPQ= X-Mailgun-Sending-Ip: 104.130.122.26 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 mxa.mailgun.org with ESMTP id 5e185210.7f29dee6b228-smtp-out-n02; Fri, 10 Jan 2020 10:29:36 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 1313FC433A2; Fri, 10 Jan 2020 10:29:35 +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 93091C433CB; Fri, 10 Jan 2020 10:29:34 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 10 Jan 2020 18:29:34 +0800 From: Wen Gong To: Justin Capella Cc: ath10k , linux-wireless@vger.kernel.org Subject: Re: [PATCH v4 1/2] ath10k: add refcount for ath10k_core_restart In-Reply-To: References: <20200108031957.22308-1-wgong@codeaurora.org> <20200108031957.22308-2-wgong@codeaurora.org> Message-ID: <55ab2d64e78d51a9da587f276899e08b@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-01-08 20:02, Justin Capella wrote: > I think this might break the "wedged" state. > > Would simply not taking action unless STATE ON avoid the problems with > multiple calls to _restart? ie: > ath10k_core_restart is one part of the recovery process, after ath10k_core_restart, it has other things do in mac80211/ath10k..., it need to make sure all the recovery finished(ath10k_reconfig_complete), then the next recovery can start from ath10k_core_restart. so it can not simply change like below. > diff --git a/drivers/net/wireless/ath/ath10k/core.c > b/drivers/net/wireless/ath/ath10k/core.c > index 5ec16ce19b69..a6c11b2bc97c 100644 > --- a/drivers/net/wireless/ath/ath10k/core.c > +++ b/drivers/net/wireless/ath/ath10k/core.c > @@ -2198,11 +2198,8 @@ static int ath10k_init_hw_params(struct ath10k > *ar) > return 0; > } > > -static void ath10k_core_restart(struct work_struct *work) > +static void inline _ath10k_core_restart(struct ath10k *ar) > { > - struct ath10k *ar = container_of(work, struct ath10k, restart_work); > - int ret; > - > set_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags); > > /* Place a barrier to make sure the compiler doesn't reorder > @@ -2232,14 +2229,28 @@ static void ath10k_core_restart(struct > work_struct *work) > */ > cancel_work_sync(&ar->set_coverage_class_work); > > + ath10k_halt(ar); > + ath10k_scan_finish(ar); > + ieee80211_restart_hw(ar->hw); > + > + ret = ath10k_coredump_submit(ar); > + if (ret) > + ath10k_warn(ar, "failed to send firmware crash dump via devcoredump: > %d", ret); > + > + complete(&ar->driver_recovery); > +} > + > +static void ath10k_core_restart(struct work_struct *work) > +{ > + struct ath10k *ar = container_of(work, struct ath10k, restart_work); > + int ret; > + > mutex_lock(&ar->conf_mutex); > > switch (ar->state) { > case ATH10K_STATE_ON: > ar->state = ATH10K_STATE_RESTARTING; > - ath10k_halt(ar); > - ath10k_scan_finish(ar); > - ieee80211_restart_hw(ar->hw); > + _ath10k_core_restart(ar); > break; > case ATH10K_STATE_OFF: > /* this can happen if driver is being unloaded > @@ -2262,13 +2273,6 @@ static void ath10k_core_restart(struct > work_struct *work) > } > > mutex_unlock(&ar->conf_mutex); > - > - ret = ath10k_coredump_submit(ar); > - if (ret) > - ath10k_warn(ar, "failed to send firmware crash dump via devcoredump: > %d", > - ret); > - > - complete(&ar->driver_recovery); > } > > static void ath10k_core_set_coverage_class_work(struct work_struct > *work) > > On Tue, Jan 7, 2020 at 7:20 PM Wen Gong wrote: