alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Cezary Rojewski <cezary.rojewski@intel.com>,
	Kai Vehmanen <kai.vehmanen@linux.intel.com>,
	Jie Yang <yang.jie@linux.intel.com>,
	linux-kernel@vger.kernel.org, Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Mark Brown <broonie@kernel.org>,
	alsa-devel@alsa-project.org,
	Bard Liao <yung-chuan.liao@linux.intel.com>
Subject: Re: [PATCH] ASoC: Intel: Handle device properties with software node API
Date: Mon, 12 Apr 2021 15:36:20 -0500	[thread overview]
Message-ID: <39e2ab87-3b70-8659-6282-5b03d30f901b@linux.intel.com> (raw)
In-Reply-To: <YFm0u9k/DNy5URsR@kuha.fi.intel.com>

Hi Heikki,

>>> diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
>>> index 06df2d46d910b..4a9817a95928c 100644
>>> --- a/sound/soc/intel/boards/bytcht_es8316.c
>>> +++ b/sound/soc/intel/boards/bytcht_es8316.c
>>> @@ -544,7 +544,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
>>>    		props[cnt++] = PROPERTY_ENTRY_BOOL("everest,jack-detect-inverted");
>>>    	if (cnt) {
>>> -		ret = device_add_properties(codec_dev, props);
>>> +		ret = device_create_managed_software_node(codec_dev, props, NULL);
>>
>> I don't think this is correct. This is using the codec_dev device, but this
>> property is created in the machine driver - different device. I think the
>> proper fix is to remove the property in the machine driver .remove()
>> callback, as done below for the SoundWire case, and not to rely on devm_
>> with the wrong device.
>>
>> there was a thread between July and October on this in
>> https://github.com/thesofproject/linux/pull/2306/
>>
>> It seems that we need to restart this work.
>>
>> Heikki, do you mind if I take your patches (keeping you as the author) and
>> rework+test them with the SOF tree + CI ?
> 
> OK by me (though, I'm not sure about the author part after that).

I took the code and split it in two for BYT/CHT (modified to remove 
devm_) and SoundWire parts (added as is).

https://github.com/thesofproject/linux/pull/2810

Both cases result in a refcount error on device_remove_sof when removing 
the platform device. I don't understand the code well enough to figure 
out what happens, but it's likely a case of the software node being 
removed twice?

kernel: [  872.695132] refcount_t: underflow; use-after-free.
kernel: [  872.695153] WARNING: CPU: 7 PID: 16086 at lib/refcount.c:28 
refcount_warn_saturate+0xa6/0xf0

<snip>

kernel: [  872.695222] CPU: 7 PID: 16086 Comm: rmmod Not tainted 
5.12.0-rc4-pr2810-5522-default #439c50f6
kernel: [  872.695225] Hardware name: Intel Corporation Tiger Lake 
Client Platform/TigerLake U DDR4 SODIMM RVP, BIOS 
TGLSFWI1.R00.3264.A00.2006251828 06/25/2020
kernel: [  872.695226] RIP: 0010:refcount_warn_saturate+0xa6/0xf0

< snip>

kernel: [  872.695244] Call Trace:
kernel: [  872.695248]  sof_sdw_rt711_exit+0x2d/0x40 [snd_soc_sof_sdw]
kernel: [  872.695253]  mc_remove+0xa8/0xe0 [snd_soc_sof_sdw]
kernel: [  872.695256]  ? rt711_rtd_init+0x170/0x170 [snd_soc_sof_sdw]
kernel: [  872.695259]  platform_remove+0x1a/0x40
kernel: [  872.695264]  device_release_driver_internal+0xf1/0x1d0
kernel: [  872.695267]  bus_remove_device+0xed/0x160
kernel: [  872.695269]  device_del+0x187/0x3e0
kernel: [  872.695272]  platform_device_del.part.0+0xe/0x60
kernel: [  872.695274]  platform_device_unregister+0x17/0x30
kernel: [  872.695277]  snd_sof_device_remove+0x53/0xf0 [snd_sof]
kernel: [  872.695283]  sof_pci_remove+0x15/0x40 [snd_sof_pci]
kernel: [  872.695286]  pci_device_remove+0x36/0xa0
kernel: [  872.695290]  device_release_driver_internal+0xf1/0x1d0
kernel: [  872.695292]  driver_detach+0x42/0x90
kernel: [  872.695294]  bus_remove_driver+0x56/0xd0
kernel: [  872.695296]  pci_unregister_driver+0x36/0x80
kernel: [  872.695299]  __x64_sys_delete_module+0x18f/0x250


  reply	other threads:[~2021-04-12 20:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 11:06 [PATCH] ASoC: Intel: Handle device properties with software node API Heikki Krogerus
2021-03-22 15:02 ` Pierre-Louis Bossart
2021-03-23  9:28   ` Heikki Krogerus
2021-04-12 20:36     ` Pierre-Louis Bossart [this message]
2021-04-13 12:20       ` Heikki Krogerus
2021-04-13 14:05         ` Heikki Krogerus
2021-04-13 15:47           ` Pierre-Louis Bossart
2021-04-14  7:43             ` Heikki Krogerus
2021-07-16 18:43 ` Pierre-Louis Bossart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=39e2ab87-3b70-8659-6282-5b03d30f901b@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=hdegoede@redhat.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tiwai@suse.com \
    --cc=yang.jie@linux.intel.com \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).