[alsa-devel] 答复: A bug about cache inconsistency report

Hans Hu(SH-RD) HansHu at zhaoxin.com
Thu Aug 2 12:56:30 CEST 2018


1. noise relate test:
When I annotate the return after set_pages_array_wc, then set_memory_wc works, noise disappear
static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on)
{
...
set_pages_array_wb(sgbuf->page_table, sgbuf->pages);
//return;
}
#endif
...
}

2. change *_SG relate test:
Just followed your proposal
-snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
+snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,

Oops details:  ubuntu16.04, kernel = 4.8.1, 8086:8D20
[  239.287557] snd_hda_codec_realtek hdaudioC0D0: ALC1150: SKU not ready 0x00000000
[  239.288057] snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC1150: line_outs=3 (0x14/0x15/0x16/0x0/0x0) type:line
[  239.288058] snd_hda_codec_realtek hdaudioC0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[  239.288058] snd_hda_codec_realtek hdaudioC0D0:    hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
[  239.288059] snd_hda_codec_realtek hdaudioC0D0:    mono: mono_out=0x0
[  239.288060] snd_hda_codec_realtek hdaudioC0D0:    dig-out=0x11/0x1e
[  239.288060] snd_hda_codec_realtek hdaudioC0D0:    inputs:
[  239.288062] snd_hda_codec_realtek hdaudioC0D0:      Front Mic=0x19
[  239.288062] snd_hda_codec_realtek hdaudioC0D0:      Rear Mic=0x18
[  239.288063] snd_hda_codec_realtek hdaudioC0D0:      Line=0x1a
[  239.299500] input: HDA Intel PCH Front Mic as /devices/pci0000:00/0000:00:1b.0/sound/card0/input19
[  239.299542] input: HDA Intel PCH Rear Mic as /devices/pci0000:00/0000:00:1b.0/sound/card0/input20
[  239.299618] input: HDA Intel PCH Line as /devices/pci0000:00/0000:00:1b.0/sound/card0/input21
[  239.299675] input: HDA Intel PCH Line Out Front as /devices/pci0000:00/0000:00:1b.0/sound/card0/input22
[  239.299729] input: HDA Intel PCH Line Out Surround as /devices/pci0000:00/0000:00:1b.0/sound/card0/input23
[  239.299798] input: HDA Intel PCH Line Out CLFE as /devices/pci0000:00/0000:00:1b.0/sound/card0/input24
[  239.300010] input: HDA Intel PCH Front Headphone as /devices/pci0000:00/0000:00:1b.0/sound/card0/input25
[  239.485322] BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
[  239.485326] IP: [<ffffffffc0496629>] setup_bdle.isra.4+0x79/0x120 [snd_hda_core]
[  239.485334] PGD fd7a92067 PUD fbb54a067 PMD 0
[  239.485336] Oops: 0000 [#1] SMP
[  239.485339] Modules linked in: snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel(E) snd_hda_codec(E) snd_hda_core snd_hwdep snd_pcm snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq snd_seq_device snd_timer snd soundcore ccm arc4 mt7601u mac80211 cfg80211 joydev input_leds hid_generic uas usbhid usb_storage hid nls_iso8859_1 eeepc_wmi intel_rapl asus_wmi sparse_keymap video edac_core x86_pkg_temp_thermal intel_powerclamp coretemp kvm irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel aes_x86_64 lrw glue_helper mei_me ablk_helper cryptd mei intel_cstate intel_rapl_perf shpchp serio_raw lpc_ich mac_hid parport_pc ppdev lp parport autofs4 psmouse e1000e mxm_wmi r8169 ahci ptp libahci pps_core mii fjes wmi [last unloaded: soundcore]
[  239.485365] CPU: 3 PID: 13872 Comm: pulseaudio Tainted: G            E   4.8.1 #2
[  239.485366] Hardware name: ASUS All Series/SABERTOOTH X99, BIOS 3402 08/18/2016
[  239.485367] task: ffff8f9db7bbd700 task.stack: ffff8f9dc7e7c000
[  239.485368] RIP: 0010:[<ffffffffc0496629>]  [<ffffffffc0496629>] setup_bdle.isra.4+0x79/0x120 [snd_hda_core]
[  239.485371] RSP: 0018:ffff8f9dc7e7fc00  EFLAGS: 00010246
[  239.485372] RAX: 0000000000000000 RBX: 0000000000000004 RCX: 0000000000000000
[  239.485373] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff8f9dc09c44f0
[  239.485374] RBP: ffff8f9dc7e7fc50 R08: 0000000000000000 R09: 0000000000000004
[  239.485375] R10: 0000000000000005 R11: ffff8f9db6c19b80 R12: ffff8f9dcd25004c
[  239.485375] R13: ffff8f9dc09c44f0 R14: ffff8f9dd7acc000 R15: 0000000000000000
[  239.485377] FS:  00007fa88e446880(0000) GS:ffff8f9e3fcc0000(0000) knlGS:0000000000000000
[  239.485378] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  239.485378] CR2: 0000000000000010 CR3: 0000000fb6d00000 CR4: 00000000003406e0
[  239.485379] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  239.485380] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[  239.485381] Stack:
[  239.485382]  ffff8f9dc7e7fc88 0000ac44c7e7fc01 fffffff00000ac44 ffff8f9df7303000
[  239.485383]  00000000baaaef4e ffff8f9dc09c3000 0000000000001138 ffff8f9df7303000
[  239.485385]  ffff8f9dcd250000 ffff8f9dc09c4400 ffff8f9dc7e7fcc0 ffffffffc04968f0
[  239.485387] Call Trace:
[  239.485390]  [<ffffffffc04968f0>] snd_hdac_stream_setup_periods+0x220/0x240 [snd_hda_core]
[  239.485395]  [<ffffffffbaaa485a>] ? notifier_call_chain+0x4a/0x70
[  239.485398]  [<ffffffffc049698f>] snd_hdac_stream_set_params+0x7f/0xc0 [snd_hda_core]
[  239.485405]  [<ffffffffc04b27cc>] azx_pcm_prepare+0xcc/0x1d0 [snd_hda_codec]
[  239.485412]  [<ffffffffc0280817>] snd_pcm_do_prepare+0x17/0x30 [snd_pcm]
[  239.485415]  [<ffffffffc028047f>] snd_pcm_action_single+0x2f/0x70 [snd_pcm]
[  239.485417]  [<ffffffffc0280528>] snd_pcm_action_nonatomic+0x68/0x70 [snd_pcm]
[  239.485420]  [<ffffffffc0283694>] snd_pcm_common_ioctl1+0x784/0xc20 [snd_pcm]
[  239.485423]  [<ffffffffbac54136>] ? __mnt_want_write+0x56/0x60
[  239.485426]  [<ffffffffbac4e2b9>] ? file_update_time+0xc9/0x110
[  239.485428]  [<ffffffffc0283f06>] snd_pcm_capture_ioctl1+0x136/0x260 [snd_pcm]
[  239.485431]  [<ffffffffc02840c8>] snd_pcm_capture_ioctl+0x28/0x40 [snd_pcm]
[  239.485433]  [<ffffffffbac45cb1>] do_vfs_ioctl+0xa1/0x5e0
[  239.485436]  [<ffffffffbaa6b2b2>] ? __do_page_fault+0x202/0x4d0
[  239.485438]  [<ffffffffbac46269>] SyS_ioctl+0x79/0x90
[  239.485441]  [<ffffffffbb279176>] entry_SYSCALL_64_fastpath+0x1e/0xa8
[  239.485442] Code: ff 00 00 00 0f 87 ab 00 00 00 49 8b 55 28 49 63 c7 44 89 f9 48 c1 e8 0c 81 e1 ff 0f 00 00 4c 89 ef 48 c1 e0 04 44 89 fe 89 4d d4 <48> 03 42 10 48 63 d1 48 8b 40 08 48 25 00 f0 ff ff 48 01 d0 89
[  239.485459] RIP  [<ffffffffc0496629>] setup_bdle.isra.4+0x79/0x120 [snd_hda_core]
[  239.485462]  RSP <ffff8f9dc7e7fc00>
[  239.485463] CR2: 0000000000000010
[  239.485464] ---[ end trace 1fc145537f028cee ]---

-----邮件原件-----
发件人: Takashi Iwai [mailto:tiwai at suse.de]
发送时间: 02 August 2018 16:50
收件人: Hans Hu(SH-RD) <HansHu at zhaoxin.com>
抄送: 'alsa-devel at alsa-project.org' <alsa-devel at alsa-project.org>
主题: Re: [alsa-devel] A bug about cache inconsistency report

On Thu, 02 Aug 2018 10:22:29 +0200,
Hans Hu(SH-RD) wrote:
>
> 1. noise relate test:
> 8086:1C20   noise ;
> 8086:A170   ok;
> 8086:8D20   ok;
> Seems this issue related to the HDA Card version

If so, it's not about the HD-audio controller.
Rather it may come from the codec or its setup.

> 2. change *_SG relate test:
> Both above platform report Oops

What did you change exactly and what Oops did you get?
Too little information for a proper analysis...


Takashi

>
> Thanks
> Hans
>
> -----邮件原件-----
> 发件人: Takashi Iwai [mailto:tiwai at suse.de]
> 发送时间: 01 August 2018 12:45
> 收件人: Hans Hu(SH-RD) <HansHu at zhaoxin.com>
> 抄送: 'alsa-devel at alsa-project.org' <alsa-devel at alsa-project.org>
> 主题: Re: [alsa-devel] A bug about cache inconsistency report
>
> On Wed, 01 Aug 2018 04:05:18 +0200,
> Hans Hu(SH-RD) wrote:
> >
> > I did more test base on different Intel platform, and result is the same.
>
> Which platform did you test exactly?
>
> > Maybe I made some mistake? Can you do the test in yours  platform?
>
> The negative test result implies that the analysis isn't right.
> Actually I haven't seen that problem on my test machines.
>
> BTW, please avoid top-posting.
>
>
> thanks,
>
> Takashi
>
> >
> > Thank you!
> > Hans
> >
> > -----邮件原件-----
> > 发件人: Takashi Iwai [mailto:tiwai at suse.de]
> > 发送时间: 31 July 2018 21:55
> > 收件人: Hans Hu(SH-RD) <HansHu at zhaoxin.com>
> > 抄送: 'alsa-devel at alsa-project.org' <alsa-devel at alsa-project.org>
> > 主题: Re: 答复: [alsa-devel] A bug about cache inconsistency report
> >
> > On Tue, 31 Jul 2018 15:51:06 +0200,
> > Hans Hu(SH-RD) wrote:
> > >
> > > I did the test and Oops report when install driver( both snoop and
> > > non-snoop mode)
> >
> > I don't understand.  Did my one-liner change the behavior or not?
> >
> >
> > thanks,
> >
> > Takashi
> >
> > >
> > > -----邮件原件-----
> > > 发件人: Takashi Iwai [mailto:tiwai at suse.de]
> > > 发送时间: 31 July 2018 19:59
> > > 收件人: Hans Hu(SH-RD) <HansHu at zhaoxin.com>
> > > 抄送: 'alsa-devel at alsa-project.org' <alsa-devel at alsa-project.org>
> > > 主题: Re: [alsa-devel] A bug about cache inconsistency report
> > >
> > > On Tue, 31 Jul 2018 12:52:04 +0200, Hans Hu(SH-RD) wrote:
> > > >
> > > > Hi All,
> > > >
> > > >                Try send an email.
> > > >
> > > >                Appearance:
> > > > when use non-snoop + ioctl path combination, an issue occurs:
> > > > usage: aplay -D plughw:0,0 44100_S16_LE_2c.wav Ubuntu, it
> > > > performance intermittently noise;
> > > >
> > > > Root case:
> > > >                Function set_pages_array_wc marked the PTE of the original address; Function set_memory_wc marked the PTE both original and after vmaped address.
> > > > [cid:image002.png at 01D428FF.92621520]
> > > > However, cache or not in transmission process is based on the PTE of the later, and the set_pages_array_wc did't mark it, so a cache inconsistency issue occurs.
> > > >
> > > >                Related bug:
> > > >                SHA1 ID: 9ddf1aeb2134e72275c97a2c6ff2e3eb04f2f27a
> > >
> > > OK, so did you confirm that dropping the SG buffer support "fixes" the noise problem on your system?  The easiest test would be like:
> > >
> > > --- a/sound/pci/hda/hda_controller.c
> > > +++ b/sound/pci/hda/hda_controller.c
> > > @@ -770,7 +770,7 @@ int snd_hda_attach_pcm_stream(struct hda_bus
> > > *_bus, struct hda_codec *codec,  size =
> > > CONFIG_SND_HDA_PREALLOC_SIZE
> > > * 1024;  if (size > MAX_PREALLOC_SIZE)  size = MAX_PREALLOC_SIZE;
> > > -snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
> > > +snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
> > >        chip->card->dev,
> > >        size, MAX_PREALLOC_SIZE);
> > >  return 0;
> > >
> > >
> > > thanks,
> > >
> > > Takashi
> > >
> > >
> > > 保密声明:
> > > 本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
> > > CONFIDENTIAL NOTE:
> > > This email contains confidential or legally privileged information and is for the sole use of its intended recipient. Any unauthorized review, use, copying or forwarding of this email or the content of this email is strictly prohibited.
> >
> >
> > 保密声明:
> > 本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
> > CONFIDENTIAL NOTE:
> > This email contains confidential or legally privileged information and is for the sole use of its intended recipient. Any unauthorized review, use, copying or forwarding of this email or the content of this email is strictly prohibited.
>
>
> 保密声明:
> 本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
> CONFIDENTIAL NOTE:
> This email contains confidential or legally privileged information and is for the sole use of its intended recipient. Any unauthorized review, use, copying or forwarding of this email or the content of this email is strictly prohibited.


保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information and is for the sole use of its intended recipient. Any unauthorized review, use, copying or forwarding of this email or the content of this email is strictly prohibited.


More information about the Alsa-devel mailing list