alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: "Hans Hu(SH-RD)" <HansHu@zhaoxin.com>
To: 'Takashi Iwai' <tiwai@suse.de>
Cc: "Tony W. Wang(BJ-RD)" <TonyWWang@zhaoxin.com>,
	"'alsa-devel@alsa-project.org'" <alsa-devel@alsa-project.org>,
	"Tim Guo(BJ-RD)" <TimGuo@zhaoxin.com>,
	"Annie Liu(BJ-RD)" <AnnieLiu@zhaoxin.com>
Subject: 答复:  A bug about cache inconsistency report
Date: Tue, 7 Aug 2018 10:59:04 +0000	[thread overview]
Message-ID: <e9ee508d2db4499387d1a2d175ca269d@zhaoxin.com> (raw)
In-Reply-To: <s5hmuty5y0l.wl-tiwai@suse.de>

> >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.
>
> To fake SG-buffer, I did this test: restore all the codes to the original, then added some codes in snd_malloc_sgbuf_pages() like below, the result is badly niose.

>Not really what I meant.  Rather something like below (totally untested).

[Hans :] I know what you mean now and complete code like below, but the result is still noise.


Thanks,

Hans
---

diff --git a/sound/core/sgbuf.c b/sound/core/sgbuf.c index 84fffabdd129..643f6cb2048c 100644
--- a/sound/core/sgbuf.c
+++ b/sound/core/sgbuf.c
@@ -68,7 +68,7 @@ void *snd_malloc_sgbuf_pages(struct device *device,
      size_t *res_size)
 {
 struct snd_sg_buf *sgbuf;
-unsigned int i, pages, chunk, maxpages;
+unsigned int i, pages, chunk;
 struct snd_dma_buffer tmpb;
 struct snd_sg_page *table;
 struct page **pgtable;
@@ -90,38 +90,18 @@ void *snd_malloc_sgbuf_pages(struct device *device,
 goto _failed;
 sgbuf->page_table = pgtable;

-/* allocate pages */
-maxpages = MAX_ALLOC_PAGES;
-while (pages > 0) {
-chunk = pages;
-/* don't be too eager to take a huge chunk */
-if (chunk > maxpages)
-chunk = maxpages;
-chunk <<= PAGE_SHIFT;
-if (snd_dma_alloc_pages_fallback(SNDRV_DMA_TYPE_DEV, device,
- chunk, &tmpb) < 0) {
-if (!sgbuf->pages)
-goto _failed;
-if (!res_size)
-goto _failed;
-size = sgbuf->pages * PAGE_SIZE;
-break;
-}
-chunk = tmpb.bytes >> PAGE_SHIFT;
-for (i = 0; i < chunk; i++) {
-table->buf = tmpb.area;
-table->addr = tmpb.addr;
-if (!i)
-table->addr |= chunk; /* mark head */
-table++;
-*pgtable++ = virt_to_page(tmpb.area);
-tmpb.area += PAGE_SIZE;
-tmpb.addr += PAGE_SIZE;
-}
-sgbuf->pages += chunk;
-pages -= chunk;
-if (chunk < maxpages)
-maxpages = chunk;
+if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, device, size, &tmpb) < 0)
+goto _failed;
+chunk = tmpb.bytes >> PAGE_SHIFT;
+for (i = 0; i < pages; i++) {
+table->buf = tmpb.area;
+table->addr = tmpb.addr;
+if (!i)
+table->addr |= pages; /* mark head */
+table++;
+*pgtable++ = virt_to_page(tmpb.area);
+tmpb.area += PAGE_SIZE;
+tmpb.addr += PAGE_SIZE;
+sgbuf->pages += chunk;
 }

 sgbuf->size = size;


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

  reply	other threads:[~2018-08-07 10:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-07  9:00 A bug about cache inconsistency report Hans Hu(SH-RD)
2018-08-07  9:25 ` Takashi Iwai
2018-08-07 10:59   ` Hans Hu(SH-RD) [this message]
2018-08-07 12:00     ` 答复: " Takashi Iwai
2018-08-08  9:54       ` 答复: " Hans Hu(SH-RD)
2018-08-08 10:04         ` Takashi Iwai
2018-08-08 10:44           ` 答复: " Hans Hu(SH-RD)
2018-08-08 11:02             ` Takashi Iwai
  -- strict thread matches above, loose matches on Subject: below --
2018-08-08 11:07 Hans Hu(SH-RD)
2018-08-10 15:15 ` Takashi Iwai
2018-08-13  6:06   ` 答复: " Hans Hu(SH-RD)
2018-08-02  8:22 Hans Hu(SH-RD)
2018-08-02  8:50 ` Takashi Iwai
2018-08-02 10:56   ` 答复: " Hans Hu(SH-RD)
2018-08-02 11:52     ` Takashi Iwai
2018-07-31 10:52 Hans Hu(SH-RD)
2018-07-31 11:59 ` Takashi Iwai
     [not found]   ` <05a9e8e374994ada9d195b7cc6a08d07@zhaoxin.com>
2018-07-31 13:55     ` 答复: " Takashi Iwai

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=e9ee508d2db4499387d1a2d175ca269d@zhaoxin.com \
    --to=hanshu@zhaoxin.com \
    --cc=AnnieLiu@zhaoxin.com \
    --cc=TimGuo@zhaoxin.com \
    --cc=TonyWWang@zhaoxin.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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).