Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp356224rdb; Mon, 29 Jan 2024 04:37:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IHdDLUgwvtjSV89ZO6ZQwxVbJOsLe/ZWkX74sKlA2hBHy/2z0z7Oa6cHh/ur26/7KKqz5KH X-Received: by 2002:ac8:5b8f:0:b0:42a:5f43:347f with SMTP id a15-20020ac85b8f000000b0042a5f43347fmr6706700qta.94.1706531877950; Mon, 29 Jan 2024 04:37:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706531877; cv=pass; d=google.com; s=arc-20160816; b=aEnMkaPPy5OxrfmXsEhmryO8Rna/Cz+WuqK+E9Z94yNyPzpihU13NhZcAyz1OOrHL5 9+f+qhnjvnois+tWfpfLX0I8zAa8k5CfQfyqQRMVki3Gv5IYGmaRwSlIKchutTd/w9IP 1Us/5PFEhltBS11V82tQYyQuJp1mTRiQjQsAWkp/2pJn8Jre7fFYecnmLHntj2bLkSZn wZrTNkx90MONdIBWoBvt46VCRQeO4xL90YIpfvb5pKR2jSBqq3uP0LkjPPolqY0tgn9i l2fwtvjMV9hwSttcXcriJjBamgyXNEU6Ee4zbtmfq1s4/r52dOrsMpy9N7VfJ2zduL0A mRsA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=E20ljoxsFmC9OjWcrOT5PYxf5yi1ZSxFrX5OnrOJQR0=; fh=t8QAp9JBuJx0YJjiSCjPMndViTEv39wvAGlYoLOBky0=; b=bW5nTi0nXVNhvpByiRygbVxIf0LMhCArLFf5C6hLb7n/bpuV3rKnQlVnPPV5Q3AQp6 U3L/9hX4cOmGTDMSwLRY8eyOR4Y3tkXQR9YfHhfeAHH8bJFSc21f7EyZFaWsF7NiMVnp JlPecZMSfjG/zlwe+tgONvun3MQrW/Ac5haM5wvAEH3orLpHkc57j6A0gv54DWPY+4Jk LLkEP4c3tdFaiksCM6dzaBoyEBK9EFrQImjvHZhuIvVbX5Ku8Zs8OBx7OH+mduuEofoc 1/L3yrYAOG2Mb6kedoQQoMLOxiYXFr2ldfY1vzgDD6aaPQFAv06kov0JUckBjsh9gNxB 7Bqw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-wireless+bounces-2668-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2668-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCW3kX2nnGTzS7f/1WX680I26FBTCFoC/0XGmD9J1aDokeWEIB7Fo65r+b+SByjivazULjzZYQPx0/uSQ0YiUDkKC/mc1cZnACNtbw9NFg== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id s10-20020ac85cca000000b0042aa841ad39si1391436qta.511.2024.01.29.04.37.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 04:37:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-2668-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-wireless+bounces-2668-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2668-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B2E061C21988 for ; Mon, 29 Jan 2024 12:37:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B476560EE5; Mon, 29 Jan 2024 12:37:55 +0000 (UTC) X-Original-To: linux-wireless@vger.kernel.org Received: from mail-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 271C160EDA; Mon, 29 Jan 2024 12:37:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706531875; cv=none; b=skUSP5RNzhBusRJ8Gvgizymj+sSZL9motDDHAD5xBcRYsnyy9ahz/g4QRXf8oOq1l/YiECyxj9ztCkOujya61NE6CDyjUq7k6op0bIuKpzn/1UD2FBAUz1ZyaM3tuKhIhMK5rMS+f+6JCbV6bfJoT9+07dIIvQcSoNoEa86o3EY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706531875; c=relaxed/simple; bh=E20ljoxsFmC9OjWcrOT5PYxf5yi1ZSxFrX5OnrOJQR0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ftqAlj02tdm0gfMrL/8L8fW0OD4qVgD+iq0WGjSxlOyzyPNJ0Vv6B0r4T3PkyIvwQfPN9slh1Plt0g15JTp0ft3qlPwqZ0nv6calHKI/AFmWGl3GPEa2ukvCBcZxhfWRgjUmMZqi3dnqyhcKVgroG/QBKFtTXmIF3VfYCfxDqaw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.161.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-5958d3f2d8aso336866eaf.1; Mon, 29 Jan 2024 04:37:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706531873; x=1707136673; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E20ljoxsFmC9OjWcrOT5PYxf5yi1ZSxFrX5OnrOJQR0=; b=X27/zzsFx/mj5JWsrVR7baN7kVjO/KHSec6eeJL4XA9XXRGSca4jDRVWKVrOpO9BAt 25igCkM0Z6PJQvkLOjXdab67xp5KyF7offzaXaSmYBnZs2aCbfKfXHs6wPVPYshAoHGx pLU3qwYR6rYeencomw9Ldc8u9ZowXGIXRqxLXB+fMDV6JXtEw7nEWSpMZvKXx4E8cuX5 WAULMKsbHJUIRJ8BJKivNwP1W47DNT+PcVkAHjcCgujVtRfnTisDcpYZJQ/rDFY3I3c9 GMuSorqo47p2lg2836v5e0yTgHE6dNrIJK6jQmDpYWx/9jZNr3jlV6lIYKsVLp4Mhplz fXLA== X-Gm-Message-State: AOJu0YxsVa48crIo1DJmIDR5A7F0SVQWOTgEOxqtmOxNZbFKOpQdOtll zuM+ji3jN3lrelSAEneefdK0goGouKuVMcf9S2XdAoZ4bnp+w8OvYK+H3GOnrISkfA3n+CJ15d1 gpTjUmxTRc7NHfRJKGyh1ZFn13ew= X-Received: by 2002:a4a:c48a:0:b0:599:fbcc:1c75 with SMTP id f10-20020a4ac48a000000b00599fbcc1c75mr6123515ooq.0.1706531873159; Mon, 29 Jan 2024 04:37:53 -0800 (PST) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <21cd2098-97e1-4947-a5bb-a97582902ead@quicinc.com> <20240129123112.GA22617@thinkpad> In-Reply-To: <20240129123112.GA22617@thinkpad> From: "Rafael J. Wysocki" Date: Mon, 29 Jan 2024 13:37:41 +0100 Message-ID: Subject: Re: ath11k resume fails due to kernel blocks probing MHI virtual devices To: Manivannan Sadhasivam Cc: "Rafael J. Wysocki" , Baochen Qiang , pavel@ucw.cz, "Kalle Valo (QUIC)" , Jeff Johnson , linux-pm@vger.kernel.org, "kernel@quicinc.com" , linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jan 29, 2024 at 1:31=E2=80=AFPM Manivannan Sadhasivam wrote: > > On Mon, Jan 29, 2024 at 01:22:27PM +0100, Rafael J. Wysocki wrote: > > On Mon, Jan 29, 2024 at 11:10=E2=80=AFAM Baochen Qiang wrote: > > > > > > Hi Rafael and Pavel, > > > > > > Currently I am facing an ath11k (a kernel WLAN driver) resume issue > > > related with kernel PM framework and MHI module. > > > > > > Before introducing the issue details, I'd like to summarize how ath11= k > > > interacts with MHI stack to download WLAN firmware to hardware target= : > > > 1. when booting/restarting, ath11k powers on MHI module and waits for > > > MHI channels to be ready. > > > 2. When power on, MHI stack creates some virtual MHI devices, which > > > represents MHI hardware channels, and adds them to MHI bus. This > > > triggers MHI client driver, named QRTR, to get matched and probe thos= e > > > MHI devices. In probe, QRTR initializes MHI channels and finally move > > > them to ready state. > > > 3. Once MHI channels ready, ath11k downloads WLAN firmware to hardwar= e > > > target, then WLAN is working. > > > > > > Such an flow works well in general, but introduces issues in hibernat= ion > > > cycle: when preparing for hibernation, ath11k powers down MHI, this > > > results in MHI devices being destroyed thus QRTR resets MHI channels. > > > When resuming back from hibernation, ath11k powers on MHI and waits f= or > > > MHI channels to be ready in its resume callback. As said above, MHI > > > creates and adds MHI devices to MHI bus, but they can't be probed at > > > that time because device probe is prohibited in device_block_probing(= ), > > > finally this results in ath11k resume timeout. > > > > > > Now there is an potential fix to this issue which would needs changes= in > > > MHI stack, i.e., don't destroy MHI devices while hibernating. > > > > Exactly. > > > > During hibernation, the power to ath11k could be lost and in that case, t= here > will be no channels available from the device. So keeping the "struct dev= " when > there is no real device attached to the system, goes against the driver m= odel > IMO since we would be messing with the refcount. But this is system hibernation or suspend and the reason for the power loss is quite different from device removal at run time. The device is going to be back during resume (or at least it is not expected to go away in the meantime), so it is pointless to destroy its representation in memory. > For instance in the case of USB, if the device get's unplugged, would it = make > sense to keep the "struct dev" for the device in kernel in a hope that it= would > come back again? At run time - no, during system suspend - yes. It is not even recommended to free IRQs during system suspend. > The driver model as I understood is, once the actual physical device gets > removed, the refcount for "struct dev" should be decremented and it shoul= d be > destroyed. Not really. Thanks!