Received: by 2002:a05:6a10:5594:0:0:0:0 with SMTP id ee20csp313627pxb; Mon, 25 Apr 2022 10:26:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjHIRU5mTvTI4jKN1vc7p4WzOWi2OZSx03sD+9KcKehLC6gpY3exsVwQeyjlxWYCb6vBkL X-Received: by 2002:a17:90a:b106:b0:1d9:7cde:7914 with SMTP id z6-20020a17090ab10600b001d97cde7914mr5866268pjq.56.1650907576806; Mon, 25 Apr 2022 10:26:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650907576; cv=none; d=google.com; s=arc-20160816; b=IWGz/UAFYtiTDUaAZQ2VLuj73tI8yIzRwCwSep7BAu0Ip7KtecpNFxUfFiYMCvF576 kHwkPNSqPRqQFho2bB7yjS/HFLl3AGarlGckfKETf2csKdJ2NKGnX7Zmi+DfnJOWz3N5 9bXd0j/jyCxEJ9Aac3WXa0wDJHc1yDRA467lJ6Jf2g2qgdZrT52lqd1m2yVbfcYhsO6n lW7Gp0CqH+IDzs/HjBYepV/PScGRvdEqZhGtLHCXmnKMAJta3Uc4cPFQUIhycJDpviLn EMP9ftWA0wmQo/DtolwsLWUt6giQB2umwpvFX0WXEiCt0n2Ml2+AO+zm2qojayuQHaQE FKUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=HU3UDCc+mIqj0/fp/LE7q8+k94zCe9E1Hd4WYWfxitY=; b=IUrkmCqQqqBqJTVLPlO3P/xOZHDTcqIYkbcq3Vg60UBRvg5Bsd64DMQ49Y3FvAzXlY jQbq9KWi1Huc8kAK+F9SR5f7QDUH1HAc3TQfQflW8rhDJZD27oIAjtzeToAyTz/ZSGPH g1YytnFPAX7wLyz4XK+gCZsiPPZzoDRqi1Q9FouvtGKrn+Viesx7qcBSuPAl/fopWU8h NE8ihLVUKpgHORnFRda/MBCjFdpzFiYwgjfQw/+LtyAIgwZA2F7V5jGesx1FImY3dYqN XiwnxM6w+NdabbWCMrfINo+6e5Dls7udqp8z05sPRHAQlVc6vZBziokfNWQ6LahCmyFd f/vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jgVuez9s; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p4-20020a170902a40400b00153b2d16407si7536458plq.15.2022.04.25.10.25.34; Mon, 25 Apr 2022 10:26:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jgVuez9s; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243607AbiDYQak (ORCPT + 67 others); Mon, 25 Apr 2022 12:30:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243639AbiDYQad (ORCPT ); Mon, 25 Apr 2022 12:30:33 -0400 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFD5E1FCC5 for ; Mon, 25 Apr 2022 09:26:21 -0700 (PDT) Received: by mail-io1-xd30.google.com with SMTP id y85so16446462iof.3 for ; Mon, 25 Apr 2022 09:26:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HU3UDCc+mIqj0/fp/LE7q8+k94zCe9E1Hd4WYWfxitY=; b=jgVuez9s1TQ+m/thsk1SoF2n6jLIvdnsC+TSdm3h/UY7rFdEYPJpCUNBVO2xL/L8jG aB7dtnOWSlvzIAOeliZvm4CWNAi6M63Vf9FjYAtC07CvNJ1CgJbByEgsttFCt4oufUTR CSQaLZMqVA9o2+L7pmQW/PpRncduTaBQ5lGRc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HU3UDCc+mIqj0/fp/LE7q8+k94zCe9E1Hd4WYWfxitY=; b=cveALUx20D1UE/Y4uz9w69B6o+pCDuWqI5HvsRNhxxGFB05BpzfRXKRbzbuKDCIS9B jb+cTnJVUL/ndtRvVX8t3H8CKkwiymBwDsG5rwt7GCKOfeEouxwvZ/V31nYdGL97M9Ll xtlB9KwdeIyF5jwz5j4H+tsQvdjeXkiZyJ91So5/sKKweP+P6shs65Zp0k/X2netmRU9 nvcM9Ws7u00vpJwrqaVHyZk6xWv0HRa8yD1xV3WJBPRXnkzjxbPsWxA/u7+x+K9XgYYG DWZjJKGvoJ88ZElBvFznYxgtlsKwcYm7YI3GG78rP03RCiFz3Qb5kOML+trY+4yc7MKy br9Q== X-Gm-Message-State: AOAM532Bj+bG1hGa1YQhJ6JlBPD/ekgyfysMi7qALimzQTMKwTB3U3wk ZCDi8eqwByf3YTNUtezmr+/DbSGMMPglFiTad9OxEg== X-Received: by 2002:a05:6638:617:b0:32a:de4f:7772 with SMTP id g23-20020a056638061700b0032ade4f7772mr4070395jar.155.1650903981260; Mon, 25 Apr 2022 09:26:21 -0700 (PDT) MIME-Version: 1.0 References: <20220425021442.1.I650b809482e1af8d0156ed88b5dc2677a0711d46@changeid> <87czh5k7ua.fsf@kernel.org> In-Reply-To: <87czh5k7ua.fsf@kernel.org> From: Abhishek Kumar Date: Mon, 25 Apr 2022 09:26:09 -0700 Message-ID: Subject: Re: [PATCH] ath10k: skip ath10k_halt during suspend for driver state RESTARTING To: Kalle Valo Cc: linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, briannorris@chromium.org, ath10k@lists.infradead.org, netdev@vger.kernel.org, Wen Gong , "David S. Miller" , Jakub Kicinski , Paolo Abeni Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Thanks Kalle for having a look and adding this on behalf of me. Here is the Tested-on tag, Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00288-QCARMSWPZ-1 Thanks Abhishek On Sun, Apr 24, 2022 at 11:14 PM Kalle Valo wrote: > > Abhishek Kumar writes: > > > Double free crash is observed when FW recovery(caused by wmi > > timeout/crash) is followed by immediate suspend event. The FW recovery > > is triggered by ath10k_core_restart() which calls driver clean up via > > ath10k_halt(). When the suspend event occurs between the FW recovery, > > the restart worker thread is put into frozen state until suspend completes. > > The suspend event triggers ath10k_stop() which again triggers ath10k_halt() > > The double invocation of ath10k_halt() causes ath10k_htt_rx_free() to be > > called twice(Note: ath10k_htt_rx_alloc was not called by restart worker > > thread because of its frozen state), causing the crash. > > > > To fix this, during the suspend flow, skip call to ath10k_halt() in > > ath10k_stop() when the current driver state is ATH10K_STATE_RESTARTING. > > Also, for driver state ATH10K_STATE_RESTARTING, call > > ath10k_wait_for_suspend() in ath10k_stop(). This is because call to > > ath10k_wait_for_suspend() is skipped later in > > [ath10k_halt() > ath10k_core_stop()] for the driver state > > ATH10K_STATE_RESTARTING. > > > > The frozen restart worker thread will be cancelled during resume when the > > device comes out of suspend. > > > > Below is the crash stack for reference: > > > > [ 428.469167] ------------[ cut here ]------------ > > [ 428.469180] kernel BUG at mm/slub.c:4150! > > [ 428.469193] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI > > [ 428.469219] Workqueue: events_unbound async_run_entry_fn > > [ 428.469230] RIP: 0010:kfree+0x319/0x31b > > [ 428.469241] RSP: 0018:ffffa1fac015fc30 EFLAGS: 00010246 > > [ 428.469247] RAX: ffffedb10419d108 RBX: ffff8c05262b0000 > > [ 428.469252] RDX: ffff8c04a8c07000 RSI: 0000000000000000 > > [ 428.469256] RBP: ffffa1fac015fc78 R08: 0000000000000000 > > [ 428.469276] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > > [ 428.469285] Call Trace: > > [ 428.469295] ? dma_free_attrs+0x5f/0x7d > > [ 428.469320] ath10k_core_stop+0x5b/0x6f > > [ 428.469336] ath10k_halt+0x126/0x177 > > [ 428.469352] ath10k_stop+0x41/0x7e > > [ 428.469387] drv_stop+0x88/0x10e > > [ 428.469410] __ieee80211_suspend+0x297/0x411 > > [ 428.469441] rdev_suspend+0x6e/0xd0 > > [ 428.469462] wiphy_suspend+0xb1/0x105 > > [ 428.469483] ? name_show+0x2d/0x2d > > [ 428.469490] dpm_run_callback+0x8c/0x126 > > [ 428.469511] ? name_show+0x2d/0x2d > > [ 428.469517] __device_suspend+0x2e7/0x41b > > [ 428.469523] async_suspend+0x1f/0x93 > > [ 428.469529] async_run_entry_fn+0x3d/0xd1 > > [ 428.469535] process_one_work+0x1b1/0x329 > > [ 428.469541] worker_thread+0x213/0x372 > > [ 428.469547] kthread+0x150/0x15f > > [ 428.469552] ? pr_cont_work+0x58/0x58 > > [ 428.469558] ? kthread_blkcg+0x31/0x31 > > > > Signed-off-by: Abhishek Kumar > > Co-developed-by: Wen Gong > > Signed-off-by: Wen Gong > > Tested-on tag missing, but I can add it if you provide it. > > https://wireless.wiki.kernel.org/en/users/drivers/ath10k/submittingpatches#tested-on_tag > > -- > https://patchwork.kernel.org/project/linux-wireless/list/ > > https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches