rpms/kernel/devel kernel-2.6.spec, 1.1490, 1.1491 linux-2.6-usbmon-deficiency-workaround.patch, 1.1, 1.2
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Thu Aug 18 05:35:52 UTC 2005
- Previous message (by thread): rpms/kernel/devel kernel-2.6.spec, 1.1489, 1.1490 linux-2.6-modules-ignore-whitespace.patch, 1.1, 1.2
- Next message (by thread): rpms/kernel/devel linux-2.6.12-pmac-sound-oops.patch, 1.1, 1.2 linux-2.6.12-serial-of.patch, 1.1, 1.2 linux-2.6.13-audit-git.patch, 1.1, 1.2 kernel-2.6.spec, 1.1491, 1.1492 linux-2.6.11-kallsyms-extra-text.patch, 1.1, NONE linux-2.6.11-mac-mini-sound.patch, 1.1, NONE linux-2.6.11-pmac-ide-sleep.patch, 1.1, NONE linux-2.6.11-pmac-volume-save.patch, 1.1, NONE linux-2.6.11-ppc32-750-erratum-fix.patch, 1.2, NONE linux-2.6.11-ppc32-pbook-clock-spreading.patch, 1.1, NONE linux-2.6.11-ppc32-pmac-sleep-fix.patch, 1.3, NONE linux-2.6.12rc-ppc32-clockspreading-fix.patch, 1.1, NONE linux-2.6.8-ppc64-netboot.patch, 1.2, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: davej
Update of /cvs/dist/rpms/kernel/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv6945
Modified Files:
kernel-2.6.spec linux-2.6-usbmon-deficiency-workaround.patch
Log Message:
Better workaround for the usbmon DMA deficiency.
Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/kernel-2.6.spec,v
retrieving revision 1.1490
retrieving revision 1.1491
diff -u -r1.1490 -r1.1491
--- kernel-2.6.spec 18 Aug 2005 05:30:52 -0000 1.1490
+++ kernel-2.6.spec 18 Aug 2005 05:35:48 -0000 1.1491
@@ -1183,6 +1183,7 @@
* Thu Aug 18 2005 Dave Jones <davej at redhat.com>
- 2.6.13-rc6-git9
- Fix up the 'last item on the boot cmdline gets eaten' bug.
+- Better workaround for the usbmon DMA deficiency.
* Tue Aug 16 2005 Dave Jones <davej at redhat.com>
- 2.6.13-rc6-git8
linux-2.6-usbmon-deficiency-workaround.patch:
Makefile | 2 +-
mon_dma.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
mon_text.c | 35 +++++++++++++++++------------------
usb_mon.h | 4 ++++
4 files changed, 77 insertions(+), 19 deletions(-)
Index: linux-2.6-usbmon-deficiency-workaround.patch
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/linux-2.6-usbmon-deficiency-workaround.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- linux-2.6-usbmon-deficiency-workaround.patch 12 Jul 2005 21:24:39 -0000 1.1
+++ linux-2.6-usbmon-deficiency-workaround.patch 18 Aug 2005 05:35:48 -0000 1.2
@@ -1,38 +1,149 @@
-We have usbmon enabled now and it's good, but usb-storage moved away
-from under me a little bit. It now maps everything for DMA beforehand,
-which makes usbmon to miss the SCSI commands and replies.
-
-I am going to address this problem in usbmon, where it belongs, but
-it requires some work which is not done.
-
-What do you think about carrying the attached patch for a few months
-(I hope to turn around sooner, but you know how that works!)
+I came around with the usbmon fix (although it's for i386 only at this
+time - I would gladly take a patch for x86_64). So, would you please
+drop the workaround in usb-storage, patch 1402, and apply the attached
+instead?
-- Pete
-diff -urp -X dontdiff linux-2.6.12/drivers/usb/storage/transport.c linux-2.6.12-lem/drivers/usb/storage/transport.c
---- linux-2.6.12/drivers/usb/storage/transport.c 2005-06-21 12:58:48.000000000 -0700
-+++ linux-2.6.12-lem/drivers/usb/storage/transport.c 2005-07-06 14:00:30.000000000 -0700
-@@ -948,8 +948,9 @@ int usb_stor_Bulk_max_lun(struct us_data
+diff -urpN -X dontdiff linux-2.6.13-rc6/drivers/usb/mon/Makefile linux-2.6.13-rc6-lem/drivers/usb/mon/Makefile
+--- linux-2.6.13-rc6/drivers/usb/mon/Makefile 2005-08-14 20:57:43.000000000 -0700
++++ linux-2.6.13-rc6-lem/drivers/usb/mon/Makefile 2005-08-15 11:25:32.000000000 -0700
+@@ -2,7 +2,7 @@
+ # Makefile for USB Core files and filesystem
+ #
- int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us)
+-usbmon-objs := mon_main.o mon_stat.o mon_text.o
++usbmon-objs := mon_main.o mon_stat.o mon_text.o mon_dma.o
+
+ # This does not use CONFIG_USB_MON because we want this to use a tristate.
+ obj-$(CONFIG_USB) += usbmon.o
+diff -urpN -X dontdiff linux-2.6.13-rc6/drivers/usb/mon/mon_dma.c linux-2.6.13-rc6-lem/drivers/usb/mon/mon_dma.c
+--- linux-2.6.13-rc6/drivers/usb/mon/mon_dma.c 1969-12-31 16:00:00.000000000 -0800
++++ linux-2.6.13-rc6-lem/drivers/usb/mon/mon_dma.c 2005-08-15 16:11:51.000000000 -0700
+@@ -0,0 +1,55 @@
++/*
++ * The USB Monitor, inspired by Dave Harding's USBMon.
++ *
++ * mon_dma.c: Library which snoops on DMA areas.
++ *
++ * Copyright (C) 2005 Pete Zaitcev (zaitcev at redhat.com)
++ */
++#include <linux/kernel.h>
++#include <linux/list.h>
++#include <linux/highmem.h>
++#include <asm/page.h>
++
++#include <linux/usb.h> /* Only needed for declarations in usb_mon.h */
++#include "usb_mon.h"
++
++#ifdef __i386__ /* CONFIG_ARCH_I386 does not exit */
++#define MON_HAS_UNMAP 1
++
++#define phys_to_page(phys) pfn_to_page((phys) >> PAGE_SHIFT)
++
++char mon_dmapeek(unsigned char *dst, dma_addr_t dma_addr, int len)
++{
++ struct page *pg;
++ unsigned long flags;
++ unsigned char *map;
++ unsigned char *ptr;
++
++ /*
++ * On i386, a DMA handle is the "physical" address of a page.
++ * In other words, the bus address is equal to physical address.
++ * There is no IOMMU.
++ */
++ pg = phys_to_page(dma_addr);
++
++ /*
++ * We are called from hardware IRQs in case of callbacks.
++ * But we can be called from softirq or process context in case
++ * of submissions. In such case, we need to protect KM_IRQ0.
++ */
++ local_irq_save(flags);
++ map = kmap_atomic(pg, KM_IRQ0);
++ ptr = map + (dma_addr & (PAGE_SIZE-1));
++ memcpy(dst, ptr, len);
++ kunmap_atomic(map, KM_IRQ0);
++ local_irq_restore(flags);
++ return 0;
++}
++#endif /* __i386__ */
++
++#ifndef MON_HAS_UNMAP
++char mon_dmapeek(unsigned char *dst, dma_addr_t dma_addr, int len)
++{
++ return 'D';
++}
++#endif
+diff -urpN -X dontdiff linux-2.6.13-rc6/drivers/usb/mon/mon_text.c linux-2.6.13-rc6-lem/drivers/usb/mon/mon_text.c
+--- linux-2.6.13-rc6/drivers/usb/mon/mon_text.c 2005-08-14 20:57:43.000000000 -0700
++++ linux-2.6.13-rc6-lem/drivers/usb/mon/mon_text.c 2005-08-15 11:44:13.000000000 -0700
+@@ -91,25 +91,11 @@ static inline char mon_text_get_data(str
+ int len, char ev_type)
{
-- struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;
-- struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap *) us->iobuf;
-+ /* Offset into iobuf a little in order to defeat pre-set DMA */
-+ struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) (us->iobuf + 4);
-+ struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap *) (us->iobuf + 4);
- unsigned int transfer_length = srb->request_bufflen;
- unsigned int residue;
- int result;
-@@ -960,7 +961,7 @@ int usb_stor_Bulk_transport(struct scsi_
- /* Take care of BULK32 devices; set extra byte to 0 */
- if ( unlikely(us->flags & US_FL_BULK32)) {
- cbwlen = 32;
-- us->iobuf[31] = 0;
-+ ((unsigned char *)bcb)[31] = 0;
+ int pipe = urb->pipe;
+- unsigned char *data;
+-
+- /*
+- * The check to see if it's safe to poke at data has an enormous
+- * number of corner cases, but it seems that the following is
+- * more or less safe.
+- *
+- * We do not even try to look transfer_buffer, because it can
+- * contain non-NULL garbage in case the upper level promised to
+- * set DMA for the HCD.
+- */
+- if (urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP)
+- return 'D';
+
+ if (len <= 0)
+ return 'L';
+-
+- if ((data = urb->transfer_buffer) == NULL)
+- return 'Z'; /* '0' would be not as pretty. */
++ if (len >= DATA_MAX)
++ len = DATA_MAX;
+
+ /*
+ * Bulk is easy to shortcut reliably.
+@@ -126,8 +112,21 @@ static inline char mon_text_get_data(str
+ }
}
- /* set up the command wrapper */
+- if (len >= DATA_MAX)
+- len = DATA_MAX;
++ /*
++ * The check to see if it's safe to poke at data has an enormous
++ * number of corner cases, but it seems that the following is
++ * more or less safe.
++ *
++ * We do not even try to look transfer_buffer, because it can
++ * contain non-NULL garbage in case the upper level promised to
++ * set DMA for the HCD.
++ */
++ if (urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP)
++ return mon_dmapeek(ep->data, urb->transfer_dma, len);
++
++ if (urb->transfer_buffer == NULL)
++ return 'Z'; /* '0' would be not as pretty. */
++
+ memcpy(ep->data, urb->transfer_buffer, len);
+ return 0;
+ }
+diff -urpN -X dontdiff linux-2.6.13-rc6/drivers/usb/mon/usb_mon.h linux-2.6.13-rc6-lem/drivers/usb/mon/usb_mon.h
+--- linux-2.6.13-rc6/drivers/usb/mon/usb_mon.h 2005-06-17 12:48:29.000000000 -0700
++++ linux-2.6.13-rc6-lem/drivers/usb/mon/usb_mon.h 2005-08-15 16:12:42.000000000 -0700
+@@ -43,6 +45,10 @@ struct mon_reader {
+ void mon_reader_add(struct mon_bus *mbus, struct mon_reader *r);
+ void mon_reader_del(struct mon_bus *mbus, struct mon_reader *r);
+
++/*
++ */
++extern char mon_dmapeek(unsigned char *dst, dma_addr_t dma_addr, int len);
++
+ extern struct semaphore mon_lock;
+
+ extern struct file_operations mon_fops_text;
- Previous message (by thread): rpms/kernel/devel kernel-2.6.spec, 1.1489, 1.1490 linux-2.6-modules-ignore-whitespace.patch, 1.1, 1.2
- Next message (by thread): rpms/kernel/devel linux-2.6.12-pmac-sound-oops.patch, 1.1, 1.2 linux-2.6.12-serial-of.patch, 1.1, 1.2 linux-2.6.13-audit-git.patch, 1.1, 1.2 kernel-2.6.spec, 1.1491, 1.1492 linux-2.6.11-kallsyms-extra-text.patch, 1.1, NONE linux-2.6.11-mac-mini-sound.patch, 1.1, NONE linux-2.6.11-pmac-ide-sleep.patch, 1.1, NONE linux-2.6.11-pmac-volume-save.patch, 1.1, NONE linux-2.6.11-ppc32-750-erratum-fix.patch, 1.2, NONE linux-2.6.11-ppc32-pbook-clock-spreading.patch, 1.1, NONE linux-2.6.11-ppc32-pmac-sleep-fix.patch, 1.3, NONE linux-2.6.12rc-ppc32-clockspreading-fix.patch, 1.1, NONE linux-2.6.8-ppc64-netboot.patch, 1.2, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-cvs-commits
mailing list