Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3444395ybi; Tue, 18 Jun 2019 00:34:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqyzWcw9F7fQahpTlbmHfDZ4nyful+01uzyH2101pWB2UQE5hzjdvIIwmrDD4g6aDHWwiYeF X-Received: by 2002:a17:902:8609:: with SMTP id f9mr104367196plo.252.1560843256268; Tue, 18 Jun 2019 00:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560843256; cv=none; d=google.com; s=arc-20160816; b=x+Rd90Fpeo8qaON1IHHd8XabCTlwRhjtEw/gPVo9p5Uxd+U3fWVXrK55seJ8TNaInz Eotxw20PUL44yAbzLdUrZ1kIDLcG/oL+NE1KgZYVaL31OANsVUISQPnD8MWK4VlDX7g7 nA4Jx7P5WnhJA2FUh3N4W5snZlDqruwESQBzhPP7UA7UolzgTU4+0ZmyZLaHF548vJZH 6z4TQRpzC2eLTqYPrt9qzjk/Ddr/PuLaHvo8InwZNvyF55OJTcc+v1dW+KTw9QeAqE+k 4mOs28S8j6qbVy+gyEbwqbQFLxW3PcOmgTYxOhSlJerkh9oob6XZ9tHFQNdmUsW8N8pz jKRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date; bh=Yxf/zzxKbeefjyOa4suDYwbHSLVplJ02XwEaAcgQ7Qo=; b=b+O4nem8YH2RKKGZ8uQ5bRbw7kfO8GSEAuAv4j+3SMGH38ETFlUfAigqKFqj5AsC6x 8vE98qdbsiziCMTDXgMvMBdVKGu2imIQPYJ1W+8+v5CVWtGibvZKQw4rLBUDjbVPwSTe hVWBsMMLz3h3leQ+4apPY9nJkAbbLafHaAtuwOpS+XGe9iyGvLaLahamAYwwuwd6vSw1 SbFsn6TVrTGfcETFMD6FCZA5QlRxTAETjxEjDG/R8tiAz1wr0y6s0ZrMdZVfcgi5hTf0 MTtwUi6Q7XecdAiMwmB8BIEJAg2/pwmQvvHL7PhHxPJWvmxs1GkcDEruXHExDz2N54rX chTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 w6si1645701pjr.100.2019.06.18.00.34.00; Tue, 18 Jun 2019 00:34:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729045AbfFRHdu (ORCPT + 99 others); Tue, 18 Jun 2019 03:33:50 -0400 Received: from mx2.suse.de ([195.135.220.15]:54674 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725919AbfFRHdt (ORCPT ); Tue, 18 Jun 2019 03:33:49 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 473D9AE24; Tue, 18 Jun 2019 05:16:28 +0000 (UTC) Date: Tue, 18 Jun 2019 07:16:28 +0200 Message-ID: From: Takashi Iwai To: Ranjani Sridharan Cc: alsa-devel@alsa-project.org, =?UTF-8?B?IkFtYWRldXN6IFPFgmF3acWEc2tp?= =?UTF-8?B?Ig==?= , Liam Girdwood , Cezary Rojewski , Mark Brown , Pierre-Louis Bossart , Jie Yang , linux-kernel@vger.kernel.org Subject: Re: [alsa-devel] [PATCH v2 09/11] ASoC: Intel: hdac_hdmi: Set ops to NULL on remove In-Reply-To: <1fd4af8e1b4bad5eda6f1e2f747b7988c74408fb.camel@linux.intel.com> References: <20190617113644.25621-1-amadeuszx.slawinski@linux.intel.com> <20190617113644.25621-10-amadeuszx.slawinski@linux.intel.com> <75be86354032f4886cbaf7d430de2aa89eaab573.camel@linux.intel.com> <1fd4af8e1b4bad5eda6f1e2f747b7988c74408fb.camel@linux.intel.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=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 18 Jun 2019 06:19:15 +0200, Ranjani Sridharan wrote: > > On Mon, 2019-06-17 at 23:36 +0200, Takashi Iwai wrote: > > On Mon, 17 Jun 2019 22:51:42 +0200, > > Ranjani Sridharan wrote: > > > > > > On Mon, 2019-06-17 at 13:36 +0200, Amadeusz Sławiński wrote: > > > > When we unload Skylake driver we may end up calling > > > > hdac_component_master_unbind(), it uses acomp->audio_ops, which > > > > we > > > > set > > > > in hdmi_codec_probe(), so we need to set it to NULL in > > > > hdmi_codec_remove(), > > > > otherwise we will dereference no longer existing pointer. > > > > > > Hi Amadeusz, > > > > > > It looks like the audio_ops should be deleted > > > snd_hdac_acomp_exit(). > > > > It's a different one. The codec driver registers / de-registers the > > notifier at its probe/remove, while the controller driver takes care > > of snd_hdac_acomp_init(). snd_hdac_acomp_exit() is usually not > > needed > > to be called explicitly, as it's managed via devres. > > Makes sense, thanks Takashi. But I am still wondering why we havent > seen this issue with SOF yet. We run the module unload/reload stress > test as well and havent seen this yet. Usually this isn't a problem as the controller is removed at first. But if the codec is unbound at first by some reason, it can be a problem without unregistering, I guess. Takashi > > Thanks, > Ranjani > > > > > > Takashi > > > > > Also, this doesnt seem to be the case with when the SOF driver is > > > removed. > > > Could you please give a bit more context on what error you see when > > > this happens? > > > > > > Thanks, > > > Ranjani > > > > > > > > Signed-off-by: Amadeusz Sławiński < > > > > amadeuszx.slawinski@linux.intel.com> > > > > --- > > > > sound/soc/codecs/hdac_hdmi.c | 6 ++++++ > > > > 1 file changed, 6 insertions(+) > > > > > > > > diff --git a/sound/soc/codecs/hdac_hdmi.c > > > > b/sound/soc/codecs/hdac_hdmi.c > > > > index 911bb6e2a1ac..9ee1bff548d8 100644 > > > > --- a/sound/soc/codecs/hdac_hdmi.c > > > > +++ b/sound/soc/codecs/hdac_hdmi.c > > > > @@ -1890,6 +1890,12 @@ static void hdmi_codec_remove(struct > > > > snd_soc_component *component) > > > > { > > > > struct hdac_hdmi_priv *hdmi = > > > > snd_soc_component_get_drvdata(component); > > > > struct hdac_device *hdev = hdmi->hdev; > > > > + int ret; > > > > + > > > > + ret = snd_hdac_acomp_register_notifier(hdev->bus, NULL); > > > > + if (ret < 0) > > > > + dev_err(&hdev->dev, "notifier unregister failed: err: > > > > %d\n", > > > > + ret); > > > > > > > > pm_runtime_disable(&hdev->dev); > > > > } > > > > > > >