rpms/kernel/devel config-generic, 1.84, 1.85 kernel.spec, 1.517, 1.518 linux-2.6-firewire-git-pending.patch, 1.19, 1.20

Jarod Wilson (jwilson) fedora-extras-commits at redhat.com
Thu Mar 20 21:25:59 UTC 2008


Author: jwilson

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv29301

Modified Files:
	config-generic kernel.spec 
	linux-2.6-firewire-git-pending.patch 
Log Message:
* Thu Mar 20 2008 Jarod Wilson <jwilson at redhat.com>
- Updated firewire debugging patch with added logging of interrupt
  event codes and cancelled AT packets



Index: config-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/config-generic,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -r1.84 -r1.85
--- config-generic	19 Mar 2008 03:28:03 -0000	1.84
+++ config-generic	20 Mar 2008 21:24:54 -0000	1.85
@@ -643,6 +643,7 @@
 CONFIG_FIREWIRE=m
 CONFIG_FIREWIRE_OHCI=m
 CONFIG_FIREWIRE_SBP2=m
+CONFIG_FIREWIRE_OHCI_DEBUG=y
 # CONFIG_FIREWIRE_OHCI_REMOTE_DMA is not set
 
 #


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.517
retrieving revision 1.518
diff -u -r1.517 -r1.518
--- kernel.spec	20 Mar 2008 19:46:01 -0000	1.517
+++ kernel.spec	20 Mar 2008 21:24:54 -0000	1.518
@@ -1722,6 +1722,10 @@
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL} -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.conf %{with_xen} xen
 
 %changelog
+* Thu Mar 20 2008 Jarod Wilson <jwilson at redhat.com>
+- Updated firewire debugging patch with added logging of interrupt
+  event codes and cancelled AT packets
+
 * Thu Mar 20 2008 David Woodhouse <dwmw2 at redhat.com>
 - Enable MPC5200 support again for Efika
 

linux-2.6-firewire-git-pending.patch:

Index: linux-2.6-firewire-git-pending.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-firewire-git-pending.patch,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- linux-2.6-firewire-git-pending.patch	17 Mar 2008 02:55:44 -0000	1.19
+++ linux-2.6-firewire-git-pending.patch	20 Mar 2008 21:24:54 -0000	1.20
@@ -394,41 +394,98 @@
 
 
 
-Date: Mon, 10 Mar 2008 23:28:07 +0100 (CET)
+Date: Sun, 16 Mar 2008 00:56:41 +0100 (CET)
 From: Stefan Richter <stefanr at s5r6.in-berlin.de>
-Subject: [PATCH update] firewire: debug AT, AR, and selfID-complete events
-To: Jarod Wilson <jwilson at redhat.com>
-cc: linux1394-devel at lists.sourceforge.net,
- linux-kernel at vger.kernel.org
-
-On 10 Mar, Jarod Wilson wrote:
-> My vote would be to include this sort of thing with a run-time option to 
-> enable the extra spew, since its a perfectly accepted standard for other 
-> drivers. It ought to be extremely useful in determining whats going wrong 
-> with end-user setups, particularly in cases where we can't reproduce the 
-> problem (typically for lack of having the specific hardware in-house).
+Subject: [PATCH] firewire: fix panic in handle_at_packet
+To: linux1394-devel at lists.sourceforge.net
+cc: linux-kernel at vger.kernel.org,
+ Johannes Berg <johannes at sipsolutions.net>,
+ Jarod Wilson <jwilson at redhat.com>
+
+This fixes a use-after-free bug in the handling of split transactions.
+The AT DMA handler of the request was occasionally executed after the
+AR DMA handler of the response.  The AT DMA handler then accessed an
+already freed packet.
+
+Reported by Johannes Berg <johannes at sipsolutions.net>.
+http://bugzilla.kernel.org/show_bug.cgi?id=9617
 
+Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+Signed-off-by: Jarod Wilson <jwilson at redhat.com>
+---
+ drivers/firewire/fw-transaction.c |    6 ++++++
+ 1 file changed, 6 insertions(+)
 
+Index: linux/drivers/firewire/fw-transaction.c
+===================================================================
+--- linux.orig/drivers/firewire/fw-transaction.c
++++ linux/drivers/firewire/fw-transaction.c
+@@ -737,6 +737,12 @@ fw_core_handle_response(struct fw_card *
+ 		break;
+ 	}
+ 
++	/*
++	 * The response handler may be executed while the request handler
++	 * is still pending.  Cancel the request handler.
++	 */
++	card->driver->cancel_packet(card, &t->packet);
++
+ 	t->callback(card, rcode, data, data_length, t->callback_data);
+ }
+ EXPORT_SYMBOL(fw_core_handle_response);
+
+-- 
+Stefan Richter
+-=====-==--- --== =----
+http://arcgraph.de/sr/
+
+
+
+Date: Thu, 20 Mar 2008 22:04:36 +0100 (CET)
 From: Stefan Richter <stefanr at s5r6.in-berlin.de>
-Subject: firewire: debug AT, AR, and selfID-complete events
+Subject: [PATCH] firewire: debug interrupt events
+To: linux1394-devel at lists.sourceforge.net
+cc: linux-kernel at vger.kernel.org,
+ Jarod Wilson <jwilson at redhat.com>
 
 This adds debug printks for asynchronous transmission and reception and
 for self ID reception.  They can be enabled at module load time, and at
 runtime via /sys/module/firewire_ohci/parameters/debug.
 
-This code inflates firewire-ohci.ko by 6 kB = 24% on x86-64 and
-by 4 kB = 20% on i686.
-
-Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
 Signed-off-by: Jarod Wilson <jwilson at redhat.com>
----
 
-Update:  Converted into runtime option, shortened some strings, added
-payload dump of quadlet transactions and of selfID generation.
+Also added:  Logging of interrupt event codes and of cancelled AT
+packets.
 
- drivers/firewire/fw-ohci.c |  139 +++++++++++++++++++++++++++++++++++++
- 1 file changed, 139 insertions(+)
+The code now depends on a Kconfig variable.  This makes it easier to
+build firewire-ohci without the feature or to make it an option in the
+future.  The variable is currently hidden and always on.
+
+This feature inflates firewire-ohci.ko by 7 kB = 27% on x86-64 and by
+4 kB = 23% on i686.
+
+Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+---
+ drivers/firewire/Kconfig   |    5 +
+ drivers/firewire/fw-ohci.c |  182 +++++++++++++++++++++++++++++++++++++
+ 2 files changed, 187 insertions(+)
 
+Index: linux/drivers/firewire/Kconfig
+===================================================================
+--- linux.orig/drivers/firewire/Kconfig
++++ linux/drivers/firewire/Kconfig
+@@ -54,6 +54,11 @@ config FIREWIRE_OHCI
+ 	  directive, use "install modulename /bin/true" for the modules to be
+ 	  blacklisted.
+ 
++config FIREWIRE_OHCI_DEBUG
++	bool
++	depends on FIREWIRE_OHCI
++	default y
++
+ config FIREWIRE_SBP2
+ 	tristate "Support for storage devices (SBP-2 protocol driver)"
+ 	depends on FIREWIRE && SCSI
 Index: linux/drivers/firewire/fw-ohci.c
 ===================================================================
 --- linux.orig/drivers/firewire/fw-ohci.c
@@ -441,27 +498,87 @@
  #include <linux/pci.h>
  #include <linux/spinlock.h>
  
-@@ -40,6 +41,16 @@
- #include "fw-ohci.h"
- #include "fw-transaction.h"
+@@ -237,6 +238,179 @@ static inline struct fw_ohci *fw_ohci(st
  
-+#define OHCI_PARAM_DEBUG_SELFIDS     1
-+#define OHCI_PARAM_DEBUG_AT_AR       2
+ static char ohci_driver_name[] = KBUILD_MODNAME;
+ 
++#ifdef CONFIG_FIREWIRE_OHCI_DEBUG
++
++#define OHCI_PARAM_DEBUG_IRQS		1
++#define OHCI_PARAM_DEBUG_SELFIDS	2
++#define OHCI_PARAM_DEBUG_AT_AR		4
 +
 +static int param_debug;
 +module_param_named(debug, param_debug, int, 0644);
 +MODULE_PARM_DESC(debug, "Verbose logging (default = 0"
++	", IRQs = "		__stringify(OHCI_PARAM_DEBUG_IRQS)
 +	", self-IDs = "		__stringify(OHCI_PARAM_DEBUG_SELFIDS)
-+	", AT and AR events = "	__stringify(OHCI_PARAM_DEBUG_AT_AR)
-+	", or a combination)");
++	", AT/AR events = "	__stringify(OHCI_PARAM_DEBUG_AT_AR)
++	", or a combination, or all = -1)");
++
++static void log_irqs(u32 evt)
++{
++	if (likely(!(param_debug & OHCI_PARAM_DEBUG_IRQS)))
++		return;
++
++	printk(KERN_DEBUG KBUILD_MODNAME ": IRQ %08x%s%s%s%s%s%s%s%s%s%s%s\n",
++	       evt,
++	       evt & OHCI1394_selfIDComplete	? " selfID"		: "",
++	       evt & OHCI1394_RQPkt		? " AR_req"		: "",
++	       evt & OHCI1394_RSPkt		? " AR_resp"		: "",
++	       evt & OHCI1394_reqTxComplete	? " AT_req"		: "",
++	       evt & OHCI1394_respTxComplete	? " AT_resp"		: "",
++	       evt & OHCI1394_isochRx		? " IR"			: "",
++	       evt & OHCI1394_isochTx		? " IT"			: "",
++	       evt & OHCI1394_postedWriteErr	? " postedWriteErr"	: "",
++	       evt & OHCI1394_cycleTooLong	? " cycleTooLong"	: "",
++	       evt & OHCI1394_cycle64Seconds	? " cycle64Seconds"	: "",
++	       evt & ~(OHCI1394_selfIDComplete | OHCI1394_RQPkt |
++		       OHCI1394_RSPkt | OHCI1394_reqTxComplete |
++		       OHCI1394_respTxComplete | OHCI1394_isochRx |
++		       OHCI1394_isochTx | OHCI1394_postedWriteErr |
++		       OHCI1394_cycleTooLong | OHCI1394_cycle64Seconds)
++						? " ?"			: "");
++}
++
++static const char *speed[] = {
++	[0] = "S100", [1] = "S200", [2] = "S400",    [3] = "beta",
++};
++static const char *power[] = {
++	[0] = "+0W",  [1] = "+15W", [2] = "+30W",    [3] = "+45W",
++	[4] = "-3W",  [5] = " ?W",  [6] = "-3..-6W", [7] = "-3..-10W",
++};
++static const char port[] = { '.', '-', 'p', 'c', };
++
++static char _p(u32 *s, int shift)
++{
++	return port[*s >> shift & 3];
++}
++
++static void log_selfids(int generation, int self_id_count, u32 *s)
++{
++	if (likely(!(param_debug & OHCI_PARAM_DEBUG_SELFIDS)))
++		return;
++
++	printk(KERN_DEBUG KBUILD_MODNAME ": %d selfIDs, generation %d\n",
++	       self_id_count, generation);
++
++	for (; self_id_count--; ++s)
++		if ((*s & 1 << 23) == 0)
++			printk(KERN_DEBUG "selfID 0: %08x, phy %d [%c%c%c] "
++			       "%s gc=%d %s %s%s%s\n",
++			       *s, *s >> 24 & 63, _p(s, 6), _p(s, 4), _p(s, 2),
++			       speed[*s >> 14 & 3], *s >> 16 & 63,
++			       power[*s >> 8 & 7], *s >> 22 & 1 ? "L" : "",
++			       *s >> 11 & 1 ? "c" : "", *s & 2 ? "i" : "");
++		else
++			printk(KERN_DEBUG "selfID n: %08x, phy %d "
++			       "[%c%c%c%c%c%c%c%c]\n",
++			       *s, *s >> 24 & 63,
++			       _p(s, 16), _p(s, 14), _p(s, 12), _p(s, 10),
++			       _p(s,  8), _p(s,  6), _p(s,  4), _p(s,  2));
++}
 +
- #define DESCRIPTOR_OUTPUT_MORE		0
- #define DESCRIPTOR_OUTPUT_LAST		(1 << 12)
- #define DESCRIPTOR_INPUT_MORE		(2 << 12)
-@@ -316,6 +327,88 @@ static int ar_context_add_page(struct ar
- 	return 0;
- }
- 
 +static const char *evts[] = {
 +	[0x00] = "evt_no_status",	[0x01] = "-reserved-",
 +	[0x02] = "evt_long_packet",	[0x03] = "evt_missing_ack",
@@ -479,6 +596,7 @@
 +	[0x1a] = "-reserved-",		[0x1b] = "ack_tardy",
 +	[0x1c] = "-reserved-",		[0x1d] = "ack_data_error",
 +	[0x1e] = "ack_type_error",	[0x1f] = "-reserved-",
++	[0x20] = "pending/cancelled",
 +};
 +static const char *tcodes[] = {
 +	[0x0] = "QW req",		[0x1] = "BW req",
@@ -495,12 +613,17 @@
 +	[0x2] = "self-id packet",	[0x3] = "-reserved-",
 +};
 +
-+static void debug_ar_at_event(char dir, int speed, u32 *header, int evt)
++static void log_ar_at_event(char dir, int speed, u32 *header, int evt)
 +{
 +	int tcode = header[0] >> 4 & 0xf;
 +	char specific[12];
 +
-+	evt &= 0x1f;
++	if (likely(!(param_debug & OHCI_PARAM_DEBUG_AT_AR)))
++		return;
++
++	if (unlikely(evt >= ARRAY_SIZE(evts)))
++			evt = 0x1f;
++
 +	if (header[0] == ~header[1]) {
 +		printk(KERN_DEBUG "A%c %s, %s, %08x\n",
 +		       dir, evts[evt], phys[header[0] >> 30 & 0x3],
@@ -544,135 +667,64 @@
 +	}
 +}
 +
- #if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32)
- #define cond_le32_to_cpu(v) \
- 	(ohci->old_uninorth ? (__force __u32)(v) : le32_to_cpu(v))
-@@ -376,6 +469,9 @@ static __le32 *handle_ar_packet(struct a
++#else
++
++#define log_irqs(evt)
++#define log_selfids(generation, self_id_count, sid)
++#define log_ar_at_event(dir, speed, header, evt)
++
++#endif /* CONFIG_FIREWIRE_OHCI_DEBUG */
++
+ static inline void reg_write(const struct fw_ohci *ohci, int offset, u32 data)
+ {
+ 	writel(data, ohci->registers + offset);
+@@ -368,6 +542,8 @@ static __le32 *handle_ar_packet(struct a
  	p.timestamp  = status & 0xffff;
  	p.generation = ohci->request_generation;
  
-+	if (unlikely(param_debug & OHCI_PARAM_DEBUG_AT_AR))
-+		debug_ar_at_event('R', p.speed, p.header, status >> 16 & 0x1f);
++	log_ar_at_event('R', p.speed, p.header, status >> 16 & 0x1f);
 +
  	/*
  	 * The OHCI bus reset handler synthesizes a phy packet with
  	 * the new generation number when a bus reset happens (see
-@@ -824,6 +920,9 @@ static int handle_at_packet(struct conte
+@@ -816,6 +992,8 @@ static int handle_at_packet(struct conte
  	evt = le16_to_cpu(last->transfer_status) & 0x1f;
  	packet->timestamp = le16_to_cpu(last->res_count);
  
-+	if (unlikely(param_debug & OHCI_PARAM_DEBUG_AT_AR))
-+		debug_ar_at_event('T', packet->speed, packet->header, evt);
++	log_ar_at_event('T', packet->speed, packet->header, evt);
 +
  	switch (evt) {
  	case OHCI1394_evt_timeout:
  		/* Async response transmit timed out. */
-@@ -1005,6 +1104,43 @@ at_context_transmit(struct context *ctx,
- 
- }
- 
-+static const char *speed[] = {
-+	[0] = "S100", [1] = "S200", [2] = "S400",    [3] = "beta",
-+};
-+static const char *power[] = {
-+	[0] = "+0W",  [1] = "+15W", [2] = "+30W",    [3] = "+45W",
-+	[4] = "-3W",  [5] = " ?W",  [6] = "-3..-6W", [7] = "-3..-10W",
-+};
-+static const char port[] = { '.', '-', 'p', 'c', };
-+
-+static char _p(u32 *s, int shift)
-+{
-+	return port[*s >> shift & 3];
-+}
-+
-+static void debug_selfids(int generation, int self_id_count, u32 *s)
-+{
-+	printk(KERN_DEBUG KBUILD_MODNAME ": %d selfIDs, generation %d\n",
-+	       self_id_count, generation);
-+
-+	for (; self_id_count--; ++s)
-+		if ((*s & 1 << 23) == 0)
-+			printk(KERN_DEBUG "selfID 0: %08x, phy %d [%c%c%c] "
-+			       "%s gc=%d %s %s%s%s%s\n",
-+			       *s, *s >> 24 & 63, _p(s, 6), _p(s, 4), _p(s, 2),
-+			       speed[*s >> 14 & 3], *s >> 16 & 63,
-+			       power[*s >> 8 & 7], *s >> 22 & 1 ? "L" : "",
-+			       *s >> 11 & 1 ? "c" : "", *s & 2 ? "i" : "",
-+			       *s & 1 ? "..." : "");
-+		else
-+			printk(KERN_DEBUG "selfID n: %08x, phy %d "
-+			       "[%c%c%c%c%c%c%c%c]%s\n",
-+			       *s, *s >> 24 & 63,
-+			       _p(s, 16), _p(s, 14), _p(s, 12), _p(s, 10),
-+			       _p(s,  8), _p(s,  6), _p(s,  4), _p(s,  2),
-+			       *s & 1 ? "..." : "");
-+}
-+
- static void bus_reset_tasklet(unsigned long data)
- {
- 	struct fw_ohci *ohci = (struct fw_ohci *)data;
-@@ -1115,6 +1251,9 @@ static void bus_reset_tasklet(unsigned l
+@@ -1117,6 +1295,8 @@ static void bus_reset_tasklet(unsigned l
  		dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,
  				  free_rom, free_rom_bus);
  
-+	if (unlikely(param_debug & OHCI_PARAM_DEBUG_SELFIDS))
-+		debug_selfids(generation, self_id_count, ohci->self_id_buffer);
++	log_selfids(generation, self_id_count, ohci->self_id_buffer);
 +
  	fw_core_handle_bus_reset(&ohci->card, ohci->node_id, generation,
  				 self_id_count, ohci->self_id_buffer);
  }
-
-
--- 
-Stefan Richter
--=====-==--- --== -=-=-
-http://arcgraph.de/sr/
-
-
-
-Date: Sun, 16 Mar 2008 00:56:41 +0100 (CET)
-From: Stefan Richter <stefanr at s5r6.in-berlin.de>
-Subject: [PATCH] firewire: fix panic in handle_at_packet
-To: linux1394-devel at lists.sourceforge.net
-cc: linux-kernel at vger.kernel.org,
- Johannes Berg <johannes at sipsolutions.net>,
- Jarod Wilson <jwilson at redhat.com>
-
-This fixes a use-after-free bug in the handling of split transactions.
-The AT DMA handler of the request was occasionally executed after the
-AR DMA handler of the response.  The AT DMA handler then accessed an
-already freed packet.
-
-Reported by Johannes Berg <johannes at sipsolutions.net>.
-http://bugzilla.kernel.org/show_bug.cgi?id=9617
-
-Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
-Signed-off-by: Jarod Wilson <jwilson at redhat.com>
----
- drivers/firewire/fw-transaction.c |    6 ++++++
- 1 file changed, 6 insertions(+)
-
-Index: linux/drivers/firewire/fw-transaction.c
-===================================================================
---- linux.orig/drivers/firewire/fw-transaction.c
-+++ linux/drivers/firewire/fw-transaction.c
-@@ -737,6 +737,12 @@ fw_core_handle_response(struct fw_card *
- 		break;
- 	}
+@@ -1133,6 +1313,7 @@ static irqreturn_t irq_handler(int irq, 
+ 		return IRQ_NONE;
  
-+	/*
-+	 * The response handler may be executed while the request handler
-+	 * is still pending.  Cancel the request handler.
-+	 */
-+	card->driver->cancel_packet(card, &t->packet);
-+
- 	t->callback(card, rcode, data, data_length, t->callback_data);
- }
- EXPORT_SYMBOL(fw_core_handle_response);
+ 	reg_write(ohci, OHCI1394_IntEventClear, event);
++	log_irqs(event);
+ 
+ 	if (event & OHCI1394_selfIDComplete)
+ 		tasklet_schedule(&ohci->bus_reset_tasklet);
+@@ -1435,6 +1616,7 @@ static int ohci_cancel_packet(struct fw_
+ 	if (packet->ack != 0)
+ 		goto out;
+ 
++	log_ar_at_event('T', packet->speed, packet->header, 0x20);
+ 	driver_data->packet = NULL;
+ 	packet->ack = RCODE_CANCELLED;
+ 	packet->callback(packet, &ohci->card, packet->ack);
 
 -- 
 Stefan Richter
--=====-==--- --== =----
+-=====-==--- --== =-=--
 http://arcgraph.de/sr/
 
 




More information about the fedora-extras-commits mailing list