From patchwork Wed Nov 30 15:47:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 27864 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1006518wrr; Wed, 30 Nov 2022 07:56:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf46vU/dFi76STkx7rmJI94BamnW5NL9wbnd7UB8mMQmTfCbySCNesSSLUHbF+fVkK38tPVj X-Received: by 2002:aa7:cb96:0:b0:461:bacd:c85d with SMTP id r22-20020aa7cb96000000b00461bacdc85dmr13848655edt.278.1669823790680; Wed, 30 Nov 2022 07:56:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669823790; cv=none; d=google.com; s=arc-20160816; b=vFSDlYIDwZh7sCfWLhGQWT4LkhVJurjXM5ia4JkUXeajaTg9Q5CA1JHnHMQydH1v+f 8khTPuIuybBM53Gtoh1FlmwddDxJvq6jUD0TD2o7he4Tezj1hrz6Avdd643M4CPszQtT w92SSQmw4S0UoCwQjJklMoy38W/fNREeIBpT03Jg59J3UW5eIxo97fzLEJsFM0wV0W70 xJvUVNg/NffpmAgGzdxzoSnKhwtR1KUy/9TtUuWEC6xJZFMoWJT8obRxWxKQ98Xhtoqe 4EdMVXi6Sh4TrN0wCwJS8cK5PpVKCWjJ0wVwvmaEaxhPJTR5JOSI2593vIzY27f+wCkx Iijw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=PpwU6lO07Wd5+RTLzDaFrlMeJKtxn3n7JzQ4dKSGqkc=; b=CIOzXzJyP0fncjjpBxCUvSnN+4bhQqnDSWhpKaAW4T+QTenddRQLqLGxiyqYzYGWzM aQAnfNfDnTS1KBiPjXxVKr276IRsAoXMjDjw3zKFEyDMMuLUgY+SzQFAeHcEP1yOEAkY L9Ik/s2Y94+9wYmgfKw5NPsuSFiWaLiMhSD23vKmQbawqYLoDBp8PAw8Tjpdc1StKXoU kATlv7zmWG4zKMEPxoORLjIZnOVAb1e9X0rrCmAnCIGr5TfYHG1WkMfHeJhprO3TOi4R huso+tnzDwM3DE4uhk99opf1CKRm+3n2Qa1aBxxKrAA3tvgopDaJJD9lkgEQl+D23Tiu VeCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=f6hF3vFs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw1-20020a1709066a0100b0078d770f363fsi1524491ejc.471.2022.11.30.07.56.06; Wed, 30 Nov 2022 07:56:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=f6hF3vFs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S230072AbiK3PsB (ORCPT + 99 others); Wed, 30 Nov 2022 10:48:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230030AbiK3Pr5 (ORCPT ); Wed, 30 Nov 2022 10:47:57 -0500 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6457A218A9 for ; Wed, 30 Nov 2022 07:47:46 -0800 (PST) Received: by mail-ej1-x629.google.com with SMTP id o13so3870882ejm.1 for ; Wed, 30 Nov 2022 07:47:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=PpwU6lO07Wd5+RTLzDaFrlMeJKtxn3n7JzQ4dKSGqkc=; b=f6hF3vFsxSnGCy9wCKWuHFT0WJZyRYdEltOsfQYOfxdVzNYA56H5+kI6SDsG8Jv8iP xpMthqB2d9L+tvEU+8mmi4lIjO4ZSwm3TkU6BjYGKxkfEgyV/Y1KWwmQJzZXLLRuOccr jLgTTdIqz4gsM+g+psj9xMSLrrxOY19iAPPkc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PpwU6lO07Wd5+RTLzDaFrlMeJKtxn3n7JzQ4dKSGqkc=; b=UMLqy1rAuCknLQD4ivzIniInZHj2W/aYeTYFO1P+UIe8eOqNGYkqEpVM2poG3XeX/m iC0itU8qgncUjPoANUJHyeTu1nIHhJbF2Kx1rFejorEBmDu0sW1gGOZ5BED+PU2EOMcg 71GL552W18GMDLa0BTUVrsPWz+MY/09QWhbSoiIU+ueNPHPCuUx6VfdQd7D/rjbxjkcr FLbZ+R5/+3J7OdC8G+17VtprGCMyWAL9/bDPeZ563WJLZRiPouj0v2nUsJIwOJNwpvRw Opk8BMV02knx73Gi8nPpa1nvMrUJJfk3i1cgH0uejLagEIyctnbF3vUU3WypmYUGB+ha YJPQ== X-Gm-Message-State: ANoB5pkHQveuAZUgm5kyqDnwpxqp1JUrM50Gpc9zHznl0trCNHd6FoYM kxqEiO2Nhm8X2JzgUgHoMpHRZQ== X-Received: by 2002:a17:906:7d50:b0:79e:4880:dd83 with SMTP id l16-20020a1709067d5000b0079e4880dd83mr42393283ejp.166.1669823264990; Wed, 30 Nov 2022 07:47:44 -0800 (PST) Received: from alco.roam.corp.google.com ([2620:0:1059:10:5b33:e3f2:6a0b:dcdd]) by smtp.gmail.com with ESMTPSA id j9-20020a17090623e900b007bf24b8f80csm775075ejg.63.2022.11.30.07.47.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 07:47:44 -0800 (PST) From: Ricardo Ribalda Date: Wed, 30 Nov 2022 16:47:15 +0100 Subject: [PATCH v6 1/2] kexec: Introduce kexec_with_frozen_processes MIME-Version: 1.0 Message-Id: <20221127-snd-freeze-v6-1-3e90553f64a5@chromium.org> References: <20221127-snd-freeze-v6-0-3e90553f64a5@chromium.org> In-Reply-To: <20221127-snd-freeze-v6-0-3e90553f64a5@chromium.org> To: Chromeos Kdump , Liam Girdwood , Pierre-Louis Bossart , Eric Biederman , Daniel Baluta , Mark Brown , Bard Liao , Jaroslav Kysela , Kai Vehmanen , Ranjani Sridharan , Peter Ujfalusi , Takashi Iwai , Steven Rostedt Cc: Ricardo Ribalda , stable@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, kexec@lists.infradead.org, sound-open-firmware@alsa-project.org X-Mailer: b4 0.11.0-dev-696ae X-Developer-Signature: v=1; a=openpgp-sha256; l=1871; i=ribalda@chromium.org; h=from:subject:message-id; bh=8KNJHp4bIWX3457t5aVwfPrimmRsszM5ZU7XjdRn1bo=; b=owEBbQKS/ZANAwAKAdE30T7POsSIAcsmYgBjh3sY6zR75vurA7LbZ/y+DlMy3+LOHJvYsQBT5ZNe OrXrGryJAjMEAAEKAB0WIQREDzjr+/4oCDLSsx7RN9E+zzrEiAUCY4d7GAAKCRDRN9E+zzrEiGE7D/ 42IsMvDeI6JrkcVeMw7Hlfq60ybXBrbBYP6z6lfI2McsZDckIPRHulAy1YaBGvwleMujpo8QR/zGrv mQVQYgRmSc/2j1YZq+QAOeY3qRY0FBGqtTaoHMfhOUkHVWWxYzK1oltg2HO43+cIyylRYtSCfOLY5Y w53p26AsgVTDQ4fxK/O8jrjIkW13Jbt5WH3L37A+QIIs+kYAXvmpPtzhP9EHsAb6rSD641jnBqRWBN gbRcoyer/rWDxvP3MvKiV4I9ZNjo3aikeI+quK7XKCDXM1cQrDeDfqCfASH4iKEcwlNvutYUARz8Cn T6Cz2A8fhHfYiC2zgz9H7jkg6DbSnFtm2Qug08WDdUHpVlsEuv/RjNNNkVM3OZ2IucOUqqCnIgXyxv t0Q1FJf6kMOV7Ro0xS3QAYlKrKX/3qKHTvhHpzzJjTl3dGv+MDaTKiJ1gS2SEQlpTNiyMoZ9GPlHMK CQ/VXwvDyESv6ppBKX/2vD5RkxySkE9xFNbVCW8EhvZPTgBpROM1bBm0AMhea5nSN5WlHi43N35JXE JWQV0jbgACSFhMdc1LxqiQhXKKpZNV2M7draG29cUlIVxJ5ofMLzLBFWk4AykI+eXVMeXzrY515t8R 5B0mNX5S0bm/nLJ9+PeTGx6CTZ2XUspcyg7KtBfwXj1O/SeVQeoo5rmGgVEg== X-Developer-Key: i=ribalda@chromium.org; a=openpgp; fpr=9EC3BB66E2FC129A6F90B39556A0D81F9F782DA9 X-Spam-Status: No, score=-2.1 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750937151255047647?= X-GMAIL-MSGID: =?utf-8?q?1750937151255047647?= Drivers running .shutdown() might want to wait for userspace to complete before exiting. If userspace is frozen and we are running kexec they will stall the computer. Add a way for them to figure out if they should just skip waiting for userspace. Signed-off-by: Ricardo Ribalda --- include/linux/kexec.h | 3 +++ kernel/kexec_core.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 41a686996aaa..c22711e0f7b5 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -426,6 +426,8 @@ extern int kexec_load_disabled; /* flag to track if kexec reboot is in progress */ extern bool kexec_in_progress; +bool kexec_with_frozen_processes(void); + int crash_shrink_memory(unsigned long new_size); ssize_t crash_get_memory_size(void); @@ -507,6 +509,7 @@ static inline void __crash_kexec(struct pt_regs *regs) { } static inline void crash_kexec(struct pt_regs *regs) { } static inline int kexec_should_crash(struct task_struct *p) { return 0; } static inline int kexec_crash_loaded(void) { return 0; } +static inline bool kexec_with_frozen_processes(void) { return false; } #define kexec_in_progress false #endif /* CONFIG_KEXEC_CORE */ diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c index ca2743f9c634..8bc8257ee7ca 100644 --- a/kernel/kexec_core.c +++ b/kernel/kexec_core.c @@ -54,6 +54,11 @@ note_buf_t __percpu *crash_notes; /* Flag to indicate we are going to kexec a new kernel */ bool kexec_in_progress = false; +bool kexec_with_frozen_processes(void) +{ + return kexec_in_progress && pm_freezing; +} +EXPORT_SYMBOL(kexec_with_frozen_processes); /* Location of the reserved area for the crash kernel */ struct resource crashk_res = { From patchwork Wed Nov 30 15:47:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 27863 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1006455wrr; Wed, 30 Nov 2022 07:56:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf5gytYeJ/WHpzzB6DffBIizmeJRnngV0pIEV3nGlugsofjBoPhtKlM6ylRIRqTTFrJ6AUwJ X-Received: by 2002:a17:902:b707:b0:189:5f3c:fb25 with SMTP id d7-20020a170902b70700b001895f3cfb25mr30854649pls.123.1669823781997; Wed, 30 Nov 2022 07:56:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669823781; cv=none; d=google.com; s=arc-20160816; b=GTm0BEupCvjb24vAUjdXQLeNJXrdSoZ3adhyU6h1ScgWK+oaAFMp1FhzYogB5I/7sK DzDEl/cqojZu11gyYtWmtCOZdm1frcEp6NKRJXjzM+3nxQCqAXIIaKo+HYwcFSvNLkQI r6Sa7YnqUid60pAicEY+4r5A6/SppyYm0YZzsOzxy6vz9lecA+IdN4a0fqVDsYwDK77T gDymt8Qy1Hw2eFbqr0JeX8VH1jtvlEQGKiYzDigUClYoaF05kijz73FZCNW2q/Ja+VcV kpTjNaOVEALG8i1l5gAzG74hmdO2nOe9R8JVrkfB9PzrhRb/+nryrf06lJ/Ee2J2E5iV 0ycw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=/fLIsVAH72GYN4wSnEbMTMIto1VdntwqvQJh4XKX1N8=; b=j1ocSwttHtuWi0V1xV7AIZdx1ZRE9IyBpcqDwAg5wLS2mghBa16EVU7PEBE9smLSZJ PynCMVb5MMBaANE1+57jiekifvTUidOAlNlFkOaIxAYzOGaFVnvpz58t/2UGTZ+WJdUv Tpb8rwv/alSo/cDw5BoO5mVBB+uIvVMmbv2xSLYrXIGvqTreaCT55rEcKZ+nspCEGOlW Ms1onr+v0rXSsz5dRrVseYOkZk5mw5udIxK/oLF13SzE2+ORQ1JLqzgoo8n5reuvLGHk XLi7hL7I36MUu94X4+/XLmLy1bbOvL8ViofoWGliUesXQ1V1y9lbS8HStuItlvVloqi/ ET2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="RLfl+m/7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cj15-20020a056a00298f00b0056c2e395593si1973505pfb.167.2022.11.30.07.56.08; Wed, 30 Nov 2022 07:56:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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="RLfl+m/7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S230078AbiK3PsF (ORCPT + 99 others); Wed, 30 Nov 2022 10:48:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230041AbiK3Pr6 (ORCPT ); Wed, 30 Nov 2022 10:47:58 -0500 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3BBF275EA for ; Wed, 30 Nov 2022 07:47:47 -0800 (PST) Received: by mail-ed1-x530.google.com with SMTP id b8so24571690edf.11 for ; Wed, 30 Nov 2022 07:47:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=/fLIsVAH72GYN4wSnEbMTMIto1VdntwqvQJh4XKX1N8=; b=RLfl+m/7E/E0w+XzZDQvyhYuzJclHPZLb/xSf+gTZ1X7y2BNXGynHFx0l2nbPf2//u QVuR8KoO0bXq/0ozfPU06OZ1ONR6QEfqUq2KJ24AvftES2ghu4Sqfn2ST/mcihAn89Nw DoGH5G8fkqo6dsa7Pf7WSY5UXM7UtHAfjZSvY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/fLIsVAH72GYN4wSnEbMTMIto1VdntwqvQJh4XKX1N8=; b=fPghldJak9amZSqymKVcOf2eFY62Frzuz9zw8R3sf989XOQYuxbeHe8gNq4DQ8SWMF qtpS9zKeY1DxPQqqqn0HZ6A4jdMCJBkxMLqEfBZYG4sYakHvcSQk5RkHSnQHGZdPpeBX NYLWPiYsjCf5l50M8GZSRQNO0cVXyf0+vKdLLsGf467viUJu3cS/HttLxw/Lj3z/qR3i +JdrAegR9MOBY3/eMAf9iFCVI9WwTK+ccjcN/x8gSh3lB53Rj6jhuTNrGd48+U89SmbR ew1/gxNjGtU0aL0vaTRmGJmIRvODnG2rTBe79hU7SD3p3kpoAFQyhhiB76/gNL4ixCxR SywQ== X-Gm-Message-State: ANoB5pmnF+oBSRqHsJnhNILYMGaBojygLnd4tTYMCAX5PXNQ3Qc84+OS LPgvdP7qztFHbcimrfMVC3JQlg== X-Received: by 2002:a05:6402:1f85:b0:462:2410:9720 with SMTP id c5-20020a0564021f8500b0046224109720mr12193484edc.84.1669823266173; Wed, 30 Nov 2022 07:47:46 -0800 (PST) Received: from alco.roam.corp.google.com ([2620:0:1059:10:5b33:e3f2:6a0b:dcdd]) by smtp.gmail.com with ESMTPSA id j9-20020a17090623e900b007bf24b8f80csm775075ejg.63.2022.11.30.07.47.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 07:47:45 -0800 (PST) From: Ricardo Ribalda Date: Wed, 30 Nov 2022 16:47:16 +0100 Subject: [PATCH v6 2/2] ASoC: SOF: Fix deadlock when shutdown a frozen userspace MIME-Version: 1.0 Message-Id: <20221127-snd-freeze-v6-2-3e90553f64a5@chromium.org> References: <20221127-snd-freeze-v6-0-3e90553f64a5@chromium.org> In-Reply-To: <20221127-snd-freeze-v6-0-3e90553f64a5@chromium.org> To: Chromeos Kdump , Liam Girdwood , Pierre-Louis Bossart , Eric Biederman , Daniel Baluta , Mark Brown , Bard Liao , Jaroslav Kysela , Kai Vehmanen , Ranjani Sridharan , Peter Ujfalusi , Takashi Iwai , Steven Rostedt Cc: Ricardo Ribalda , stable@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, kexec@lists.infradead.org, sound-open-firmware@alsa-project.org X-Mailer: b4 0.11.0-dev-696ae X-Developer-Signature: v=1; a=openpgp-sha256; l=2174; i=ribalda@chromium.org; h=from:subject:message-id; bh=z1BRJ78WvLmPHnisXXoQjw9rs0LQQZ8YHVqPdLBDGn8=; b=owEBbQKS/ZANAwAKAdE30T7POsSIAcsmYgBjh3scbdrJzfpRqMNqZtaSFQjjhLnKBxlJMQeOOkOM m5234GiJAjMEAAEKAB0WIQREDzjr+/4oCDLSsx7RN9E+zzrEiAUCY4d7HAAKCRDRN9E+zzrEiN/ID/ 9+jG5ZH/OSbpevz4Xx7ZmZUrjhaPMR5rVP35OfUsqfj/ADrCAhJC2vlwQpcs2lie7FAUKfb1BM4VWQ 7EozfqEAJPYlbN6HiKf8Xidp9z8sW4/g/0gSEQ60cMBSEnM8UlVrqt2eFXi4ARZeoUzjr58IEXMjVu Rr37vapYJMliIJKpJ8oI3Bn8vwDFjC1hLjhEb5ZgTCIESl+/ZZb+jfCIlS2qytNrH4zjpoX5Hk8QZR GiiHXMQVXR/ynfZbB8tJI7mn024lZ/0OWniech+uJArvwaJxOM5zt5kxzweiQ9QH/L6IwPwzhfSYJV i2rmkKdEI1PYKK1MbUH0ep2XRYWO/B8w8MHBLK6JsqA8fSwJ+5YRMAnN96rHs7hUD6+J8P7rPrkkO0 cIpHzcnsBkm8JJTTLEkkQI8gzeNzRjjW8yNlqoFnQnR7wi+wgcKAGzESkwWWysMGq7kvLU7+Q6Bwn6 T9c+1s/pVqGANlQ4BuVOKgO1pgLNzRqfef1yz7c53cJ+VBHCGYGOZDIc29r/tH+Cep1mpSbhJSA2vj IGcfgZhuOGIhR9dctOZ/M8+g2BC5LwhhncH5hK6xPdecknFPpzElV3oXw8U8w9FLa/Bhgje6cPjGmS Phput94//O2tfEsQ92F9dOxUP5sj5cBNz6LJljSdByoRowt/YVTcfvnHkNkw== X-Developer-Key: i=ribalda@chromium.org; a=openpgp; fpr=9EC3BB66E2FC129A6F90B39556A0D81F9F782DA9 X-Spam-Status: No, score=-2.1 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=ham 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750937141941041443?= X-GMAIL-MSGID: =?utf-8?q?1750937141941041443?= During kexec(), the userspace is frozen. Therefore we cannot wait for it to complete. Avoid running snd_sof_machine_unregister during shutdown. This fixes: [ 84.943749] Freezing user space processes ... (elapsed 0.111 seconds) done. [ 246.784446] INFO: task kexec-lite:5123 blocked for more than 122 seconds. [ 246.819035] Call Trace: [ 246.821782] [ 246.824186] __schedule+0x5f9/0x1263 [ 246.828231] schedule+0x87/0xc5 [ 246.831779] snd_card_disconnect_sync+0xb5/0x127 ... [ 246.889249] snd_sof_device_shutdown+0xb4/0x150 [ 246.899317] pci_device_shutdown+0x37/0x61 [ 246.903990] device_shutdown+0x14c/0x1d6 [ 246.908391] kernel_kexec+0x45/0xb9 And: [ 246.893222] INFO: task kexec-lite:4891 blocked for more than 122 seconds. [ 246.927709] Call Trace: [ 246.930461] [ 246.932819] __schedule+0x5f9/0x1263 [ 246.936855] ? fsnotify_grab_connector+0x5c/0x70 [ 246.942045] schedule+0x87/0xc5 [ 246.945567] schedule_timeout+0x49/0xf3 [ 246.949877] wait_for_completion+0x86/0xe8 [ 246.954463] snd_card_free+0x68/0x89 ... [ 247.001080] platform_device_unregister+0x12/0x35 Cc: stable@vger.kernel.org Fixes: 83bfc7e793b5 ("ASoC: SOF: core: unregister clients and machine drivers in .shutdown") Signed-off-by: Ricardo Ribalda --- sound/soc/sof/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c index 3e6141d03770..4301f347bb90 100644 --- a/sound/soc/sof/core.c +++ b/sound/soc/sof/core.c @@ -9,6 +9,7 @@ // #include +#include #include #include #include @@ -484,7 +485,8 @@ int snd_sof_device_shutdown(struct device *dev) * make sure clients and machine driver(s) are unregistered to force * all userspace devices to be closed prior to the DSP shutdown sequence */ - sof_unregister_clients(sdev); + if (!kexec_with_frozen_processes()) + sof_unregister_clients(sdev); snd_sof_machine_unregister(sdev, pdata);