All of lore.kernel.org
 help / color / mirror / Atom feed
* + lib-swiotlbc-fix-strange-panic-message-selection-logic-when-swiotlb-fills-up.patch added to -mm tree
@ 2009-08-20 23:27 akpm
  2009-08-21 11:07 ` [tip:core/iommu] lib/swiotlb.c: Fix strange panic message selection logic when swiotlb fills up tip-bot for Casey Dahlin
  0 siblings, 1 reply; 2+ messages in thread
From: akpm @ 2009-08-20 23:27 UTC (permalink / raw)
  To: mm-commits; +Cc: cdahlin, beckyb, fujita.tomonori, mingo


The patch titled
     lib/swiotlb.c: fix strange panic message selection logic when swiotlb fills up
has been added to the -mm tree.  Its filename is
     lib-swiotlbc-fix-strange-panic-message-selection-logic-when-swiotlb-fills-up.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: lib/swiotlb.c: fix strange panic message selection logic when swiotlb fills up
From: Casey Dahlin <cdahlin@redhat.com>

swiotlb_full in lib/swiotlb.c throws one of two panic messages based on
whether the direction of transfer is from the device or to the device. 
The logic around this is somewhat weird in the case of bidirectional
transfers.  It appears to want to throw both in succession, but since its
a panic only the first makes it.

This patch adds a third, separate error for DMA_BIDIRECTIONAL to make
things a bit clearer.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 lib/swiotlb.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff -puN lib/swiotlb.c~lib-swiotlbc-fix-strange-panic-message-selection-logic-when-swiotlb-fills-up lib/swiotlb.c
--- a/lib/swiotlb.c~lib-swiotlbc-fix-strange-panic-message-selection-logic-when-swiotlb-fills-up
+++ a/lib/swiotlb.c
@@ -581,12 +581,15 @@ swiotlb_full(struct device *dev, size_t 
 	printk(KERN_ERR "DMA: Out of SW-IOMMU space for %zu bytes at "
 	       "device %s\n", size, dev ? dev_name(dev) : "?");
 
-	if (size > io_tlb_overflow && do_panic) {
-		if (dir == DMA_FROM_DEVICE || dir == DMA_BIDIRECTIONAL)
-			panic("DMA: Memory would be corrupted\n");
-		if (dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL)
-			panic("DMA: Random memory would be DMAed\n");
-	}
+	if (size <= io_tlb_overflow || !do_panic)
+		return;
+
+	if (dir == DMA_BIDIRECTIONAL)
+		panic("DMA: Random memory could be corrupted or DMAed\n");
+	if (dir == DMA_FROM_DEVICE)
+		panic("DMA: Memory would be corrupted\n");
+	if (dir == DMA_TO_DEVICE)
+		panic("DMA: Random memory would be DMAed\n");
 }
 
 /*
_

Patches currently in -mm which might be from cdahlin@redhat.com are

lib-swiotlbc-fix-strange-panic-message-selection-logic-when-swiotlb-fills-up.patch
lib-swiotlbc-fix-strange-panic-message-selection-logic-when-swiotlb-fills-up-fix.patch


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [tip:core/iommu] lib/swiotlb.c: Fix strange panic message selection logic when swiotlb fills up
  2009-08-20 23:27 + lib-swiotlbc-fix-strange-panic-message-selection-logic-when-swiotlb-fills-up.patch added to -mm tree akpm
@ 2009-08-21 11:07 ` tip-bot for Casey Dahlin
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Casey Dahlin @ 2009-08-21 11:07 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, cdahlin, fujita.tomonori, akpm, tglx,
	beckyb, mingo

Commit-ID:  c7084b35eb1a4d3353a501508baf9d3d82822c93
Gitweb:     http://git.kernel.org/tip/c7084b35eb1a4d3353a501508baf9d3d82822c93
Author:     Casey Dahlin <cdahlin@redhat.com>
AuthorDate: Thu, 20 Aug 2009 16:27:56 -0700
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 21 Aug 2009 10:36:03 +0200

lib/swiotlb.c: Fix strange panic message selection logic when swiotlb fills up

swiotlb_full() in lib/swiotlb.c throws one of two panic messages
based on whether the direction of transfer is from the device
or to the device. The logic around this is somewhat weird in
the case of bidirectional transfers. It appears to want to
throw both in succession, but since its a panic only the first
makes it.

This patch adds a third, separate error for DMA_BIDIRECTIONAL
to make things a bit clearer.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Becky Bruce <beckyb@kernel.crashing.org>
[ further fixed the error message ]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <200908202327.n7KNRuqK001504@imap1.linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 lib/swiotlb.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 9e2fe3e..ac25cd2 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -581,12 +581,15 @@ swiotlb_full(struct device *dev, size_t size, int dir, int do_panic)
 	printk(KERN_ERR "DMA: Out of SW-IOMMU space for %zu bytes at "
 	       "device %s\n", size, dev ? dev_name(dev) : "?");
 
-	if (size > io_tlb_overflow && do_panic) {
-		if (dir == DMA_FROM_DEVICE || dir == DMA_BIDIRECTIONAL)
-			panic("DMA: Memory would be corrupted\n");
-		if (dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL)
-			panic("DMA: Random memory would be DMAed\n");
-	}
+	if (size <= io_tlb_overflow || !do_panic)
+		return;
+
+	if (dir == DMA_BIDIRECTIONAL)
+		panic("DMA: Random memory could be DMA accessed\n");
+	if (dir == DMA_FROM_DEVICE)
+		panic("DMA: Random memory could be DMA written\n");
+	if (dir == DMA_TO_DEVICE)
+		panic("DMA: Random memory could be DMA read\n");
 }
 
 /*

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-08-21 11:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-20 23:27 + lib-swiotlbc-fix-strange-panic-message-selection-logic-when-swiotlb-fills-up.patch added to -mm tree akpm
2009-08-21 11:07 ` [tip:core/iommu] lib/swiotlb.c: Fix strange panic message selection logic when swiotlb fills up tip-bot for Casey Dahlin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.