public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: 김기오 <gioh.kim@lge.com>
To: "'Alan Stern'" <stern@rowland.harvard.edu>
Cc: <linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	"'Mark Salter'" <msalter@redhat.com>, <namhyung.kim@lge.com>,
	"Minchan Kim" <minchan.kim@lge.com>,
	"'Chanho Min'" <chanho.min@lge.com>,
	"'Jong-Sung Kim'" <neidhard.kim@lge.com>
Subject: [PATCH] [RFC] EHCI: add to memory barrier to updating hw_next
Date: Wed, 17 Jul 2013 14:03:36 +0900	[thread overview]
Message-ID: <000001ce82aa$feac9ee0$fc05dca0$@lge.com> (raw)

Hi,

I have a missing urb completion problem on ARMv7 based platform.

I thought the above problem was caused by coherent memory between the
EHCI device and CPU so I tryied to allocates device type memory
for EHCI via dma_declare_coherent_memory at machine initialization step
so that EHCI always allocates from those device type memory.
It seems to solve the issue because I didn't see any problem.

But I am not sure it is acceptable solution. So I applied the patch
https://lkml.org/lkml/2011/8/31/344.
But it could not solve the problem so that I added another wmb()
as my patch, and now my platform works fine.

I am not sure what's the exact problem and what wmb I added could solve
but I just think the problem is related to store buffer flush of hw_next.
Anyway, important thing is that it fixed my problem so I expect
you expert guys could find what I am missing and a right solution.
IMHO, the patch might miss updating hw_next pointer.
Am I correct?

I understand the wmb() is just memory barrier, not write-buffer flush.
But it is true that wmb() can flush write buffer in ARM.
Anyhow I think that memory type, "normal memory, non-cacheable", may
have a problem for some devices that needs device type memory.

I cannot get conclusion from the discussion at
https://lkml.org/lkml/2011/8/31/344.
Which can I do for my platform, wmb() or dma_coherent_write_sync()?

Signed-off-by: Gioh Kim <gioh.kim@lge.com>
---
 drivers/usb/host/ehci-q.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index d34b399..779d9e8 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -501,6 +501,7 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
                        last = list_entry (qtd->qtd_list.prev,
                                        struct ehci_qtd, qtd_list);
                        last->hw_next = qtd->hw_next;
+                       wmb();
                }

                /* remove qtd; it's recycled after possible urb completion */
--
1.7.9.5


             reply	other threads:[~2013-07-17  5:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-17  5:03 김기오 [this message]
2013-07-17  8:51 ` [PATCH] [RFC] EHCI: add to memory barrier to updating hw_next Ming Lei
2013-07-18  1:30   ` Gioh Kim
2013-07-18 10:07     ` Ming Lei
2013-07-18 14:08       ` Alan Stern
2013-07-19  3:50         ` Ming Lei
2013-07-19 10:45         ` Gioh Kim
2013-07-19 15:26           ` Alan Stern

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='000001ce82aa$feac9ee0$fc05dca0$@lge.com' \
    --to=gioh.kim@lge.com \
    --cc=chanho.min@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=minchan.kim@lge.com \
    --cc=msalter@redhat.com \
    --cc=namhyung.kim@lge.com \
    --cc=neidhard.kim@lge.com \
    --cc=stern@rowland.harvard.edu \
    /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