From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5581C433F5 for ; Mon, 28 Mar 2022 09:42:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239905AbiC1JoH (ORCPT ); Mon, 28 Mar 2022 05:44:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236481AbiC1JoG (ORCPT ); Mon, 28 Mar 2022 05:44:06 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A4A213D70 for ; Mon, 28 Mar 2022 02:42:26 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id F0F7C1F37E; Mon, 28 Mar 2022 09:42:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1648460544; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=eyZHCLcDXUocIP7B9068DqUmGsCqxCWgYBfUqpGMV4M=; b=l1x6a8AXvpzECyFAUUkAvo1jgfUEVVkx/d0Cw/z0l4tCcFealKe1F7CEcZTBYuO7g44ug9 QWXuxHHT6338JCP6uPZmKFTwo0jjxEo+poZintAyoa1igfRqoG1wtWLByOkzpey4BDGXfI hRcvM522HH1PCg0bBqWZzthdMYN77uk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1648460544; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=eyZHCLcDXUocIP7B9068DqUmGsCqxCWgYBfUqpGMV4M=; b=YyUoxwGjsI/wnUtraHI5WUQZtWLOrFPP4g5LZ3ui+UoBGgye5lw+Oki2no7e27R8pgymt+ OIIvo4bB0JLPdpAw== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id D3EDFA3B89; Mon, 28 Mar 2022 09:42:24 +0000 (UTC) Date: Mon, 28 Mar 2022 11:42:24 +0200 Message-ID: From: Takashi Iwai To: Mohan Kumar Cc: , , , , , , , Subject: Re: [PATCH] ALSA: hda: Avoid unsol event during RPM suspending In-Reply-To: <20220328091411.31488-1-mkumard@nvidia.com> References: <20220328091411.31488-1-mkumard@nvidia.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 28 Mar 2022 11:14:11 +0200, Mohan Kumar wrote: > > There is a corner case with unsol event handling during codec runtime > suspending state. When the codec runtime suspend call initiated, the > codec->in_pm atomic variable would be 0, currently the codec runtime > suspend function calls snd_hdac_enter_pm() which will just increments > the codec->in_pm atomic variable. Consider unsol event happened just > after this step and before snd_hdac_leave_pm() in the codec runtime > suspend function. The snd_hdac_power_up_pm() in the unsol event > flow in hdmi_present_sense_via_verbs() function would just increment > the codec->in_pm atomic variable without calling pm_runtime_get_sync > function. > > As codec runtime suspend flow is already in progress and in parallel > unsol event is also accessing the codec verbs, as soon as codec > suspend flow completes and clocks are switched off before completing > the unsol event handling as both functions doesn't wait for each other. > This will result in below errors > > [ 589.428020] tegra-hda 3510000.hda: azx_get_response timeout, switching > to polling mode: last cmd=0x505f2f57 > [ 589.428344] tegra-hda 3510000.hda: spurious response 0x80000074:0x5, > last cmd=0x505f2f57 > [ 589.428547] tegra-hda 3510000.hda: spurious response 0x80000065:0x5, > last cmd=0x505f2f57 > > To avoid this, the unsol event flow should not perform any codec verb > related operations during RPM_SUSPENDING state. > > Signed-off-by: Mohan Kumar Thanks, that's a hairy problem... The logic sounds good, but can we check the PM state before calling snd_hda_power_up_pm()? Takashi