Skip to contentSkip to conversation

A bug about cache inconsistency report

DISCUSSION Hans Hu(SH-RD) 2 participants 7 messages Aug 2, 2018 – Aug 6, 2018 1 message not in the archive Sound

lore
Share & tools
lore
#0 lore raw

1. noise relate test:

8086:1C20   noise ;
8086:A170   ok;
8086:8D20   ok;

Seems this issue related to the HDA Card version

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

Thanks
Hans

-----邮件原件-----
发件人: Takashi Iwai [mailto:[email protected]]
发送时间: 01 August 2018 12:45
收件人: Hans Hu(SH-RD) <[email protected]>
抄送: '[email protected]' <[email protected]> 主题: Re: [alsa-devel] A bug about cache inconsistency report

Quoted 2 lines · Hans Hu(SH-RD)

I did more test base on different Intel platform, and result is the same.

Which platform did you test exactly?

Quoted 1 line

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

Quoted 71 lines

Thank you!
Hans

-----邮件原件-----
发件人: Takashi Iwai [mailto:[email protected]]
发送时间: 31 July 2018 21:55
收件人: Hans Hu(SH-RD) <[email protected]>
抄送: '[email protected]' <[email protected]> 主题: Re: 答复: [alsa-devel] A bug about cache inconsistency report

Quoted 3 lines · Hans Hu(SH-RD)

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

Quoted 47 lines

-----邮件原件-----
发件人: Takashi Iwai [mailto:[email protected]]
发送时间: 31 July 2018 19:59
收件人: Hans Hu(SH-RD) <[email protected]>
抄送: '[email protected]' <[email protected]> 主题: Re: [alsa-devel] A bug about cache inconsistency report

Quoted 10 lines · Hans Hu(SH-RD)

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;

Quoted 7 lines

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:[email protected]]
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:

sound/pci/hda/hda_controller.c +1 -1
@@ -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

Quoted 10 lines
Quoted 4 lines

保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
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.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#1 lore raw
Quoted 6 lines · Hans Hu(SH-RD)

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.

Quoted 2 lines

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

Quoted 113 lines

Thanks
Hans

-----邮件原件-----
发件人: Takashi Iwai [mailto:[email protected]]
发送时间: 01 August 2018 12:45
收件人: Hans Hu(SH-RD) <[email protected]>
抄送: '[email protected]' <[email protected]> 主题: Re: [alsa-devel] A bug about cache inconsistency report

Quoted 2 lines · Hans Hu(SH-RD)

I did more test base on different Intel platform, and result is the same.

Which platform did you test exactly?

Quoted 1 line

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

Quoted 71 lines

Thank you!
Hans

-----邮件原件-----
发件人: Takashi Iwai [mailto:[email protected]]
发送时间: 31 July 2018 21:55
收件人: Hans Hu(SH-RD) <[email protected]>
抄送: '[email protected]' <[email protected]> 主题: Re: 答复: [alsa-devel] A bug about cache inconsistency report

Quoted 3 lines · Hans Hu(SH-RD)

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

Quoted 47 lines

-----邮件原件-----
发件人: Takashi Iwai [mailto:[email protected]]
发送时间: 31 July 2018 19:59
收件人: Hans Hu(SH-RD) <[email protected]>
抄送: '[email protected]' <[email protected]> 主题: Re: [alsa-devel] A bug about cache inconsistency report

Quoted 10 lines · Hans Hu(SH-RD)

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;

Quoted 7 lines

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:[email protected]]
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:

sound/pci/hda/hda_controller.c +1 -1
@@ -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

Quoted 10 lines
Quoted 4 lines

保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
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.

Quoted 4 lines

保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
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.

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#2 lore raw

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:[email protected]]
发送时间: 02 August 2018 16:50
收件人: Hans Hu(SH-RD) <[email protected]>
抄送: '[email protected]' <[email protected]> 主题: Re: [alsa-devel] A bug about cache inconsistency report

Quoted 6 lines · Hans Hu(SH-RD)

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.

Quoted 2 lines

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

Quoted 113 lines

Thanks
Hans

-----邮件原件-----
发件人: Takashi Iwai [mailto:[email protected]]
发送时间: 01 August 2018 12:45
收件人: Hans Hu(SH-RD) <[email protected]>
抄送: '[email protected]' <[email protected]> 主题: Re: [alsa-devel] A bug about cache inconsistency report

Quoted 2 lines · Hans Hu(SH-RD)

I did more test base on different Intel platform, and result is the same.

Which platform did you test exactly?

Quoted 1 line

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

Quoted 71 lines

Thank you!
Hans

-----邮件原件-----
发件人: Takashi Iwai [mailto:[email protected]]
发送时间: 31 July 2018 21:55
收件人: Hans Hu(SH-RD) <[email protected]>
抄送: '[email protected]' <[email protected]> 主题: Re: 答复: [alsa-devel] A bug about cache inconsistency report

Quoted 3 lines · Hans Hu(SH-RD)

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

Quoted 47 lines

-----邮件原件-----
发件人: Takashi Iwai [mailto:[email protected]]
发送时间: 31 July 2018 19:59
收件人: Hans Hu(SH-RD) <[email protected]>
抄送: '[email protected]' <[email protected]> 主题: Re: [alsa-devel] A bug about cache inconsistency report

Quoted 10 lines · Hans Hu(SH-RD)

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;

Quoted 7 lines

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:[email protected]]
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:

sound/pci/hda/hda_controller.c +0 -0
@@ -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;

sound/pci/hda/hda_controller.c +1 -1
-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

Quoted 10 lines
Quoted 4 lines

保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
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.

Quoted 4 lines

保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
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.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#3 lore raw
Quoted 10 lines · Hans Hu(SH-RD)

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

set_memory_uc() performs __pa() for the given address, and in this case, it's vmapped address. Something bogus in your test, I'm afraid.

And moreover, all Intel chipsets do work with snooping well, AFAIK.

Review

Quoted 6 lines

}

2. change *_SG relate test:
Just followed your proposal

(quoted diff) +1 -1
-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,

OK, you need one more oneliner:

sound/pci/hda/hda_controller.c +1 -1
index a12e594d4e3b..2eaed4956e7f 100644
@@ -707,7 +707,7 @@ static const struct snd_pcm_ops azx_pcm_ops = {
 	.pointer = azx_pcm_pointer,
 	.get_time_info =  azx_get_time_info,
 	.mmap = azx_pcm_mmap,
-	.page = snd_pcm_sgbuf_ops_page,
+	// .page = snd_pcm_sgbuf_ops_page,
 };
 
 static void azx_pcm_free(struct snd_pcm *pcm)

And, again, please avoid top-posting.

Takashi

#5 lore raw
In reply to a message not in the archive
Quoted 9 lines · Hans Hu(SH-RD)
Quoted 8 lines

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

Quoted 3 lines
Quoted 1 line

set_memory_uc() performs __pa() for the given address, and in this case, it's vmapped address. Something bogus in your test, I'm afraid.

[Hans:] I know __pa() handle the vmapped address is wrong, that why I don't know how to fix the problem, I try this because I see kernel older than 3.7.6. [bogus? pretending to be real or genuine?] no no no, but the noise problem machine(8086:1c20) in another city, I will make sure it again.

I meant about the reliability of the test result. Or whether we're heading to a wrong fish.

In anyway, which kernel version are you testing? And exactly what is your problem? Which machine, which hardware setup (codec, etc) and which output, and how is the sound backend (PulseAudio or direct ALSA write)?

Quoted 2 lines
Quoted 1 line

And moreover, all Intel chipsets do work with snooping well, AFAIK.

[Hans:] yes, all Intel chipsets do work with snooping well here too. And the problem case here is "non-snoop"+"aplay -D plughw:*.*"+"44.1k 16bit"+"8086:1c20", I will see if I can find more machine do the test.

Ah, so you explicitly test with non-snoop mode for this chipset? For what purpose...?

Quoted 18 lines
Quoted 17 lines

2. change *_SG relate test:
Just followed your proposal

(quoted diff) +1 -1
-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,

OK, you need one more oneliner:

sound/pci/hda/hda_controller.c +1 -1
@@ -707,7 +707,7 @@ static const struct snd_pcm_ops azx_pcm_ops = {
 .pointer = azx_pcm_pointer,
 .get_time_info =  azx_get_time_info,
 .mmap = azx_pcm_mmap,
-.page = snd_pcm_sgbuf_ops_page,
+// .page = snd_pcm_sgbuf_ops_page,
 };
Quoted 2 lines

sound/pci/hda/hda_controller.c static const struct snd_pcm_ops azx_pcm_ops = { · line 712

Quoted 1 line
sound/pci/hda/hda_controller.c +0 -0
 static void azx_pcm_free(struct snd_pcm *pcm)

[Hans :] I did this, and the Oops report as the same.

My bad, there are other SG-buffer codes in sound/hda/*, too.

So scratch these two oneliners. The only thing you'd need is the big-hammer change (again oneliner :)

sound/core/Kconfig +1 -1
@@ -181,7 +181,7 @@ config SND_VMASTER
 	bool
 
 config SND_DMA_SGBUF
-	def_bool y
+	def_bool n
 	depends on X86
 
 source "sound/core/seq/Kconfig"
Quoted 2 lines
Quoted 1 line

And, again, please avoid top-posting.

[Hans :] sorry, I didn't understand at first. My mailbox is Outlook, am I right now?

Yes, looks better now.

thanks,

Takashi

#6 lore raw

-----邮件原件-----
发件人: Takashi Iwai [mailto:[email protected]]
发送时间: 02 August 2018 22:36
收件人: Hans Hu(SH-RD) <[email protected]>
抄送: '[email protected]' <[email protected]> 主题: Re: 答复: 答复: [alsa-devel] A bug about cache inconsistency report

Quoted 9 lines · Hans Hu(SH-RD)
Quoted 8 lines

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

Quoted 6 lines
Quoted 1 line

set_memory_uc() performs __pa() for the given address, and in this case, it's vmapped address. Something bogus in your test, I'm afraid.

[Hans:] I know __pa() handle the vmapped address is wrong, that why I don't know how to fix the problem, I try this because I see kernel older than 3.7.6. [bogus? pretending to be real or genuine?] no no no, but the noise problem machine(8086:1c20) in another city, I will make sure it again.

I meant about the reliability of the test result. Or whether we're heading to a wrong fish.
In anyway, which kernel version are you testing? And exactly what is your problem? Which machine, which hardware setup (codec, etc) and which output, and how is the sound backend (PulseAudio or direct ALSA write)?

[Hans:] OS: Ubuntu 17.10 + 4.13.0-21-generic (or any one after 3.7.6).
HW: mother board is Dell 042P49, HDA controller is 8086:1c20, codec is cx20641. Output and sound backend: Except the command below, anything other is default setting.

Problem(what I have done and found): When system setup, I add "modprobe snd-had-intel.snoop=0" in grub, after setup, execute command "aplay -D plughw:0,0 44.1k_16b_2c.wav", then I hear music with noise. The reason cause this is the buffer address should been mark as WC type and the __mark_pages_wc was patched for this, but if define CONFIG_SND_DMA_SGBUF, the actual marked address is the address before vmapped(0xffff88*...*), however the address used in snd_pcm_lib_write_transfer() is the address after vmapped(0xffffc9*...*), so the mark didn't work and cache inconsistency occur(noise).

Quoted 4 lines
Quoted 1 line

And moreover, all Intel chipsets do work with snooping well, AFAIK.

[Hans:] yes, all Intel chipsets do work with snooping well here too. And the problem case here is "non-snoop"+"aplay -D plughw:*.*"+"44.1k 16bit"+"8086:1c20", I will see if I can find more machine do the test. Ah, so you explicitly test with non-snoop mode for this chipset?
For what purpose...?

[Hans:] Yes, I've been testing a HDA controller recently(predecessor is VIA), it has the same problem. I want to figure out if it is hardware's problem or not.

[Hans:] I did the same test on another platform(8086:A170), it do work with non-snoop well. In addition, I did such a change, oneliner, the purpose is to mark nothing, and it still do work with non-snoop well, this supposed to be right?

--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
#ifdef CONFIG_X86
static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on) {
int pages;
+return;

Quoted 36 lines
Quoted 13 lines

2. change *_SG relate test:
Just followed your proposal

(quoted diff) +1 -1
-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,

OK, you need one more oneliner:

(quoted diff) +0 -0

b/sound/pci/hda/hda_controller.c index a12e594d4e3b..2eaed4956e7f 100644

sound/pci/hda/hda_controller.c static const struct snd_pcm_ops azx_pcm_ops = { · line 712

Quoted 7 lines
sound/pci/hda/hda_controller.c +1 -1
@@ -707,7 +707,7 @@ static const struct snd_pcm_ops azx_pcm_ops = {
 .pointer = azx_pcm_pointer,
 .get_time_info =  azx_get_time_info,  >.mmap = azx_pcm_mmap,
-.page = snd_pcm_sgbuf_ops_page,
+// .page = snd_pcm_sgbuf_ops_page,
 };
 
 static void azx_pcm_free(struct snd_pcm *pcm)

[Hans :] I did this, and the Oops report as the same.

My bad, there are other SG-buffer codes in sound/hda/*, too.

So scratch these two oneliners. The only thing you'd need is the big-hammer change (again oneliner :)

sound/core/Kconfig +0 -0
@@ -181,7 +181,7 @@ config SND_VMASTER

bool

config SND_DMA_SGBUF

sound/core/Kconfig +1 -1
-def_bool y
+def_bool n

depends on X86

Quoted 1 line

source "sound/core/seq/Kconfig"

[Hans :] If this, All the platform are all right.

Thank you,

Hans

保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
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.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#7 lore raw
Quoted 25 lines · Hans Hu(SH-RD)

-----邮件原件-----
发件人: Takashi Iwai [mailto:[email protected]]
发送时间: 02 August 2018 22:36
收件人: Hans Hu(SH-RD) <[email protected]>
抄送: '[email protected]' <[email protected]> 主题: Re: 答复: 答复: [alsa-devel] A bug about cache inconsistency report

Quoted 12 lines · Hans Hu(SH-RD)
Quoted 10 lines

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

set_memory_uc() performs __pa() for the given address, and in this case, it's vmapped address. Something bogus in your test, I'm afraid.

[Hans:] I know __pa() handle the vmapped address is wrong, that why I don't know how to fix the problem, I try this because I see kernel older than 3.7.6. [bogus? pretending to be real or genuine?] no no no, but the noise problem machine(8086:1c20) in another city, I will make sure it again.

Quoted 8 lines
Quoted 2 lines

I meant about the reliability of the test result. Or whether we're heading to a wrong fish.
In anyway, which kernel version are you testing? And exactly what is your problem? Which machine, which hardware setup (codec, etc) and which output, and how is the sound backend (PulseAudio or direct ALSA write)?

[Hans:] OS: Ubuntu 17.10 + 4.13.0-21-generic (or any one after 3.7.6).
HW: mother board is Dell 042P49, HDA controller is 8086:1c20, codec is cx20641. Output and sound backend: Except the command below, anything other is default setting.

Problem(what I have done and found): When system setup, I add "modprobe snd-had-intel.snoop=0" in grub, after setup, execute command "aplay -D plughw:0,0 44.1k_16b_2c.wav", then I hear music with noise. The reason cause this is the buffer address should been mark as WC type and the __mark_pages_wc was patched for this, but if define CONFIG_SND_DMA_SGBUF, the actual marked address is the address before vmapped(0xffff88*...*), however the address used in snd_pcm_lib_write_transfer() is the address after vmapped(0xffffc9*...*), so the mark didn't work and cache inconsistency occur(noise).

Well, basically the vmapped address isn't used *at all* on the HD-audio controller hardware. The SG buffer addresses are passed on BDL of the chip, but the vmapped address is used only in PCM core for some data manipulation. And this is purely software stuff, hence it shouldn't matter there whether it's in snoop mode or not. The snoop mode difference appears mainly when accessed via mmap from user-space directly to kernel-space.

That said, I guess your suspect heading to a wrong direction.

Quoted 11 lines
Quoted 4 lines
Quoted 1 line

And moreover, all Intel chipsets do work with snooping well, AFAIK.

[Hans:] yes, all Intel chipsets do work with snooping well here too. And the problem case here is "non-snoop"+"aplay -D plughw:*.*"+"44.1k 16bit"+"8086:1c20", I will see if I can find more machine do the test. Ah, so you explicitly test with non-snoop mode for this chipset?
For what purpose...?

[Hans:] Yes, I've been testing a HDA controller recently(predecessor is VIA), it has the same problem. I want to figure out if it is hardware's problem or not.

[Hans:] I did the same test on another platform(8086:A170), it do work with non-snoop well. In addition, I did such a change, oneliner, the purpose is to mark nothing, and it still do work with non-snoop well, this supposed to be right?

sound/pci/hda/hda_intel.c +0 -0
Quoted 5 lines

#ifdef CONFIG_X86
static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on) {
int pages;
+return;

This is essentially other way round; it skips the non-cache setup.

Quoted 31 lines
Quoted 31 lines
Quoted 13 lines

2. change *_SG relate test:
Just followed your proposal

(quoted diff) +1 -1
-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,

OK, you need one more oneliner:

(quoted diff) +0 -0

b/sound/pci/hda/hda_controller.c index a12e594d4e3b..2eaed4956e7f 100644

sound/pci/hda/hda_controller.c static const struct snd_pcm_ops azx_pcm_ops = { · line 712

Quoted 7 lines
sound/pci/hda/hda_controller.c +1 -1
@@ -707,7 +707,7 @@ static const struct snd_pcm_ops azx_pcm_ops = {
 .pointer = azx_pcm_pointer,
 .get_time_info =  azx_get_time_info,  >.mmap = azx_pcm_mmap,
-.page = snd_pcm_sgbuf_ops_page,
+// .page = snd_pcm_sgbuf_ops_page,
 };
 
 static void azx_pcm_free(struct snd_pcm *pcm)

[Hans :] I did this, and the Oops report as the same.

My bad, there are other SG-buffer codes in sound/hda/*, too.

So scratch these two oneliners. The only thing you'd need is the big-hammer change (again oneliner :)

sound/core/Kconfig +0 -0
@@ -181,7 +181,7 @@ config SND_VMASTER

bool

Quoted 8 lines
Quoted 6 lines

config SND_DMA_SGBUF

sound/core/Kconfig +1 -1
-def_bool y
+def_bool n

depends on X86

source "sound/core/seq/Kconfig"

[Hans :] If this, All the platform are all right.

Then the next step would be to fake sg-buffer from this straight buffer. Revert the above, and modify sgbuf.c to the following:
- Allocate a large continuous buffer
- Assign each page in this large buffer

If this still works, it's not about vmap, but it just means that the physically ordered pages do matter -- implicitly showing that the snooping behavior isn't properly turned on / off on the controller.

Takashi

Quoted 9 lines

Thank you,

Hans

保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
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.

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel