You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG][TGL][SDW][CI]Msg NACK received, trf on Slave 1 failed #2534
@aiChaoSONG there's nothing we can do without the full dmesg. Can this be extracted?
An NAK usually means the bus is not functional at all and devices receive data that's not correct (e.g. with a parity error)
@aiChaoSONG it does not appear to be the 'same story'. I see in daily test 706 that all SoundWire platforms pass except the Volteer platform for the suspend-resume case.
@plbossart This may be related to MAX98373 codec, as we discussed in PRC bug scrub.
There is one of the two amps that appears to lose sync, but that shouldn't be fatal. I added traces in #2559, I think we need to have a better diagnosis, it's not just the codec but the bus management that seems problematic.
@plbossart@RanderWang From the dmesg on daily report 727, it looks like someone tried to access sdw bus 0 Slave 1 before it is enumerated. Question is who/where did it? The other interesting thing is sdw bus 0 Slave 1 is rt5682, not max98373 and rt5682 is the only codec on sdw bus 0.
dmesg
kernel: [ 8706.640056] intel-sdw intel-sdw.1: intel_resume: pm_runtime status was suspended, forcing active
kernel: [ 8706.640215] max98373 sdw:1:19f:8373:0:7: sdw_modify_slave_status: initializing completion for Slave 1
kernel: [ 8706.640217] max98373 sdw:1:19f:8373:0:3: sdw_modify_slave_status: initializing completion for Slave 2
kernel: [ 8706.640326] cdns_fill_msg_resp: 13 callbacks suppressed
kernel: [ 8706.640329] intel-sdw intel-sdw.0: Msg Ack not received
kernel: [ 8706.640329] cdns_fill_msg_resp: 3 callbacks suppressed
kernel: [ 8706.640330] intel-sdw intel-sdw.0: Msg ignored for Slave 1
kernel: [ 8706.640387] intel-sdw intel-sdw.0: Msg Ack not received
kernel: [ 8706.640388] intel-sdw intel-sdw.0: Msg ignored for Slave 1
kernel: [ 8706.640415] sof-audio-pci 0000:00:1f.3: ipc rx: 0x90020000: GLB_TRACE_MSG
kernel: [ 8706.640424] sof-audio-pci 0000:00:1f.3: ipc rx done: 0x90020000: GLB_TRACE_MSG
kernel: [ 8706.640433] intel-sdw intel-sdw.0: Msg Ack not received
kernel: [ 8706.640433] intel-sdw intel-sdw.0: Msg ignored for Slave 1
kernel: [ 8706.640492] intel-sdw intel-sdw.0: Msg Ack not received
kernel: [ 8706.640493] intel-sdw intel-sdw.0: Msg ignored for Slave 1
kernel: [ 8706.640554] intel-sdw intel-sdw.0: Msg Ack not received
kernel: [ 8706.640555] intel-sdw intel-sdw.0: Msg ignored for Slave 1
kernel: [ 8706.640617] intel-sdw intel-sdw.0: Msg Ack not received
kernel: [ 8706.640619] intel-sdw intel-sdw.0: Msg ignored for Slave 1
kernel: [ 8706.640683] intel-sdw intel-sdw.0: Msg Ack not received
kernel: [ 8706.640685] intel-sdw intel-sdw.0: Msg ignored for Slave 1
kernel: [ 8706.640748] intel-sdw intel-sdw.0: Msg Ack not received
kernel: [ 8706.640750] intel-sdw intel-sdw.0: Msg ignored for Slave 1
kernel: [ 8706.640808] intel-sdw intel-sdw.0: Msg Ack not received
kernel: [ 8706.640809] intel-sdw intel-sdw.0: Msg ignored for Slave 1
kernel: [ 8706.640909] intel-sdw intel-sdw.0: Msg Ack not received
kernel: [ 8706.640911] intel-sdw intel-sdw.0: Msg NACK received
kernel: [ 8706.640912] intel-sdw intel-sdw.0: Msg NACKed for Slave 1
kernel: [ 8706.640913] soundwire sdw-master-0: trf on Slave 1 failed:-5
kernel: [ 8706.640934] intel-sdw intel-sdw.0: Slave status change
kernel: [ 8706.640942] soundwire sdw-master-0: Slave attached, programming device number
kernel: [ 8706.640970] intel-sdw intel-sdw.0: Msg ignored for Slave 1
kernel: [ 8706.641193] intel-sdw intel-sdw.1: Slave status change
kernel: [ 8706.641196] soundwire sdw-master-1: Slave attached, programming device number
kernel: [ 8706.641200] soundwire sdw-master-0: No more devices to enumerate
kernel: [ 8706.641226] intel-sdw intel-sdw.0: Slave status change
kernel: [ 8706.641360] soundwire sdw-master-1: SDW Slave Addr: 27019f837300
kernel: [ 8706.641364] soundwire sdw-master-1: SDW Slave class_id 0, part_id 8373, mfg_id 19f, unique_id 7, version 2
kernel: [ 8706.641364] soundwire sdw-master-1: Slave already registered, reusing dev_num:1
kernel: [ 8706.641381] intel-sdw intel-sdw.0: Slave status change
kernel: [ 8706.641385] soundwire sdw-master-0: Slave attached, programming device number
kernel: [ 8706.641606] soundwire sdw-master-1: SDW Slave Addr: 23019f837300
kernel: [ 8706.641607] soundwire sdw-master-1: SDW Slave class_id 0, part_id 8373, mfg_id 19f, unique_id 3, version 2
kernel: [ 8706.641607] soundwire sdw-master-1: Slave already registered, reusing dev_num:2
kernel: [ 8706.641653] soundwire sdw-master-0: SDW Slave Addr: 20025d568200
kernel: [ 8706.641654] soundwire sdw-master-0: SDW Slave class_id 0, part_id 5682, mfg_id 25d, unique_id 0, version 2
kernel: [ 8706.641655] soundwire sdw-master-0: Slave already registered, reusing dev_num:1
kernel: [ 8706.641816] soundwire sdw-master-1: No more devices to enumerate
kernel: [ 8706.641836] intel-sdw intel-sdw.1: Slave status change
kernel: [ 8706.641840] max98373 sdw:1:19f:8373:0:7: sdw_modify_slave_status: signaling completion for Slave 1
kernel: [ 8706.641962] max98373 sdw:1:19f:8373:0:3: sdw_modify_slave_status: signaling completion for Slave 2
kernel: [ 8706.642013] soundwire sdw-master-0: No more devices to enumerate
kernel: [ 8706.642040] intel-sdw intel-sdw.0: Slave status change
kernel: [ 8706.642065] rt5682 sdw:0:25d:5682:0: sdw_modify_slave_status: signaling completion for Slave 1
kernel: [ 8706.687923] intel-sdw intel-sdw.0: Slave status change
kernel: [ 8706.688311] intel-sdw intel-sdw.0: Slave status change
@bardliao in this case there's a NAK while trying to read rt5682 devID registers, but that's not a problem. The device will be enumerated later.
This is relatively strange to me that we have issues for either rt5682 (NAK) or max98373 (bus clash or parity issues), that's inconsistent.
I thought about this, but on my DUT the parity error was primarily from rt5682-sdw & dint observe with max98373-sdw, so ignored.
The rt5682 already has the SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY quirk, so if you get a parity error from that device, it's a real one - not a fake issue after a hardware reset.
I don't know if the max98373 has the same issue, it's be surprising given that these codecs have nothing in common.
Note that I didn't reproduce the issue with above log and I removed some irrelevant log.
What I see from the log is that rt5682_resume is invoked before Slave attached, programming device number. And we call regcache_sync(rt5682->regmap) in rt5682_resume(). In other words, the driver tries to do IO transfer before the Slave is enumerated which looks wrong to me. We usually get Msg ignored for Slave 1 for this, but for some reason we get NAK occasionally. Maybe the NAK error happens if we try to access the Slave while it is during the attach process. So, IMHO, we should prevent any function from accessing sdw Slave before it is assigned a device number. And we can check if it can fix the NAK issue.
Great @bardliao ! it is caused by ASoC resume function. I tried to reproduce this bug to get call stack to find who write register but I can't reproduce it. You show the simplest way to find hint. We all ignore the "intel-sdw intel-sdw.0: Msg ignored for Slave 1". I learned so much from you finding. Thanks !
And if it is dev_dbg instead of dev_dbg_ratelimited in cdns_fill_msg, we should get a batch of ignore message. So dev_dbg_ratelimited sometimes hide bugs.
the SoundWire card is instantiated with a platform device, which is a child of the PCI device. The platform driver (machine driver) relies on the classic snd_soc_pm_ops. When the card resumes, it will call a workqueue which will resume the components, and for rt5682 the component driver exposes the rt5682_resume function.
The rt5682 device is a child of the PCI device, and it has its own resume function.
So I guess what happens is that when the card resumes, the component resume may happen before the device resume.
I think the only way to fix this is to take an explicit reference with pm_runtime_get_sync() so that the component resume only happens after the device resume is complete.
Activity
plbossart commentedon Oct 26, 2020
@aiChaoSONG there's nothing we can do without the full dmesg. Can this be extracted?
An NAK usually means the bus is not functional at all and devices receive data that's not correct (e.g. with a parity error)
aiChaoSONG commentedon Oct 27, 2020
@plbossart #2522, #2533 and this issue is from the same report. Please check #2522 to read the whole story.
keyonjie commentedon Nov 2, 2020
@naveen-manohar FYI.
plbossart commentedon Nov 10, 2020
@aiChaoSONG it does not appear to be the 'same story'. I see in daily test 706 that all SoundWire platforms pass except the Volteer platform for the suspend-resume case.
aiChaoSONG commentedon Nov 11, 2020
@plbossart This may be related to MAX98373 codec, as we discussed in PRC bug scrub.
plbossart commentedon Nov 11, 2020
There is one of the two amps that appears to lose sync, but that shouldn't be fatal. I added traces in #2559, I think we need to have a better diagnosis, it's not just the codec but the bus management that seems problematic.
bardliao commentedon Nov 13, 2020
@plbossart @RanderWang From the dmesg on daily report 727, it looks like someone tried to access sdw bus 0 Slave 1 before it is enumerated. Question is who/where did it? The other interesting thing is sdw bus 0 Slave 1 is rt5682, not max98373 and rt5682 is the only codec on sdw bus 0.
dmesg
plbossart commentedon Nov 13, 2020
@bardliao in this case there's a NAK while trying to read rt5682 devID registers, but that's not a problem. The device will be enumerated later.
This is relatively strange to me that we have issues for either rt5682 (NAK) or max98373 (bus clash or parity issues), that's inconsistent.
5 remaining items
plbossart commentedon Nov 17, 2020
The rt5682 already has the SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY quirk, so if you get a parity error from that device, it's a real one - not a fake issue after a hardware reset.
I don't know if the max98373 has the same issue, it's be surprising given that these codecs have nothing in common.
RanderWang commentedon Nov 18, 2020
reproduced with daily build 11/06. It seems be difficult to reproduce NAck with latest driver. And 5682 was enumerated later.
bardliao commentedon Nov 19, 2020
addr 3008 is RT5682_SDW_CMD which is used by rt5682_sdw_read() and rt5682_sdw_write(). After adding some more trace, I got
Note that I didn't reproduce the issue with above log and I removed some irrelevant log.
What I see from the log is that rt5682_resume is invoked before
Slave attached, programming device number. And we callregcache_sync(rt5682->regmap)in rt5682_resume(). In other words, the driver tries to do IO transfer before the Slave is enumerated which looks wrong to me. We usually getMsg ignored for Slave 1for this, but for some reason we get NAK occasionally. Maybe the NAK error happens if we try to access the Slave while it is during the attach process. So, IMHO, we should prevent any function from accessing sdw Slave before it is assigned a device number. And we can check if it can fix the NAK issue.RanderWang commentedon Nov 19, 2020
Great @bardliao ! it is caused by ASoC resume function. I tried to reproduce this bug to get call stack to find who write register but I can't reproduce it. You show the simplest way to find hint. We all ignore the "intel-sdw intel-sdw.0: Msg ignored for Slave 1". I learned so much from you finding. Thanks !
RanderWang commentedon Nov 19, 2020
And if it is dev_dbg instead of dev_dbg_ratelimited in cdns_fill_msg, we should get a batch of ignore message. So dev_dbg_ratelimited sometimes hide bugs.
plbossart commentedon Nov 19, 2020
Nice progress @bardliao, but I am confused. Why is the rt5682_resume() function used?
it should be
rt5682_dev_resume(struct device *dev)
linux/sound/soc/codecs/rt5682-sdw.c
Line 732 in cfa9a86
plbossart commentedon Nov 19, 2020
I think I know what's happening...
the SoundWire card is instantiated with a platform device, which is a child of the PCI device. The platform driver (machine driver) relies on the classic snd_soc_pm_ops. When the card resumes, it will call a workqueue which will resume the components, and for rt5682 the component driver exposes the rt5682_resume function.
The rt5682 device is a child of the PCI device, and it has its own resume function.
So I guess what happens is that when the card resumes, the component resume may happen before the device resume.
I think the only way to fix this is to take an explicit reference with pm_runtime_get_sync() so that the component resume only happens after the device resume is complete.
aiChaoSONG commentedon Nov 23, 2020
Not reproduced on: 2020/11/23 UTC+8
bardliao commentedon Nov 23, 2020
I checked all Realtek sdw codecs and max89373 and it seems snd_soc_pm_ops is not used on those codec drivers.
plbossart commentedon Dec 11, 2020
Fixed by #2567