Skip to contentSkip to conversation

Removed "task_size" element from thread_struct - it is now constant

PATCH New Tony Luck 3 participants 3 messages May 1, 2012 – May 4, 2012 SCSI

lore
Share & tools
lore

Tony Luck

author
#0 lore raw

PATCH 1/1 Removed "task_size" element from thread_struct - it is now constant

When the 32-bit compat code was deleted, we should also have removed the task_size element from the thread structure - threads can only be 64-bit now, so no need to keep track of how much virtual address space each task can have ... everyone gets 0xa000000000000000.

---
 arch/ia64/include/asm/processor.h |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
arch/ia64/include/asm/processor.h +1 -4
index 483f6c6..a1e7022 100644
@@ -34,8 +34,7 @@
  * each (assuming 8KB page size), for a total of 8TB of user virtual
  * address space.
  */
-#define TASK_SIZE_OF(tsk)	((tsk)->thread.task_size)
-#define TASK_SIZE       	TASK_SIZE_OF(current)
+#define TASK_SIZE       	DEFAULT_TASK_SIZE
 
 /*
  * This decides where the kernel will search for a free chunk of vm
@@ -280,7 +279,6 @@ struct thread_struct {
 	__u8 pad[3];
 	__u64 ksp;			/* kernel stack pointer */
 	__u64 map_base;			/* base address for get_unmapped_area() */
-	__u64 task_size;		/* limit for task size */
 	__u64 rbs_bot;			/* the base address for the RBS */
 	int last_fph_cpu;		/* CPU that may hold the contents of f32-f127 */
 
@@ -303,7 +301,6 @@ struct thread_struct {
 	.ksp =		0,					\
 	.map_base =	DEFAULT_MAP_BASE,			\
 	.rbs_bot =	STACK_TOP - DEFAULT_USER_STACK_SIZE,	\
-	.task_size =	DEFAULT_TASK_SIZE,			\
 	.last_fph_cpu =  -1,					\
 	INIT_THREAD_PM						\
 	.dbr =		{0, },					\
Signature · 1 line
1.7.9.rc2.1.g69204
#1 lore raw

PATCH 1/1 simscsi breakage in __scsi_alloc_queue()

With the current mainline we end up oopsing in __scsi_alloc_queue(), since host->dma_dev is left NULL. I'm not sure if this is the right fix, but it gives the behaviour equivalent to what we used to have before commit 6f381fa344911d5a234b13574433cf23036f9467 ([SCSI] scsi_lib: use correct DMA device in __scsi_alloc_queue). And with that applied the damn thing appears to work correctly...

Current mainline barfs on dma_set_seg_boundary(dev, shost->dma_boundary), since dev ends up being NULL. AFAICS, the same problem affects any driver that does scsi_add_host(host, NULL) and there are other such beasts as well, so they probably also need fixing...

Again, I'm not sure that this is the right way to deal with that and I'd prefer to have it reviewed by SCSI folks before it goes into the tree.

---

arch/ia64/hp/sim/simscsi.c +2 -1
index 331de72..fe2b4d0 100644
@@ -13,6 +13,7 @@
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/timer.h>
+#include <linux/platform_device.h>
 #include <asm/irq.h>
 #include "hpsim_ssc.h"
 
@@ -358,7 +359,7 @@ simscsi_init(void)
 	if (!host)
 		return -ENOMEM;
 
-	error = scsi_add_host(host, NULL);
+	error = scsi_add_host_with_dma(host, NULL, &platform_bus);
 	if (error)
 		goto free_host;
 	scsi_scan_host(host);
#2 lore raw

Re: [PATCH] simscsi breakage in __scsi_alloc_queue()

Quoted 30 lines · Al Viro

With the current mainline we end up oopsing in __scsi_alloc_queue(), since host->dma_dev is left NULL. I'm not sure if this is the right fix, but it gives the behaviour equivalent to what we used to have before commit 6f381fa344911d5a234b13574433cf23036f9467 ([SCSI] scsi_lib: use correct DMA device in __scsi_alloc_queue). And with that applied the damn thing appears to work correctly...

Current mainline barfs on dma_set_seg_boundary(dev, shost->dma_boundary), since dev ends up being NULL. AFAICS, the same problem affects any driver that does scsi_add_host(host, NULL) and there are other such beasts as well, so they probably also need fixing...

Again, I'm not sure that this is the right way to deal with that and I'd prefer to have it reviewed by SCSI folks before it goes into the tree.

---

arch/ia64/hp/sim/simscsi.c +1 -0
index 331de72..fe2b4d0 100644
@@ -13,6 +13,7 @@
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/timer.h>
+#include <linux/platform_device.h>
 #include <asm/irq.h>
 #include "hpsim_ssc.h"
 

arch/ia64/hp/sim/simscsi.c simscsi_init(void) · line 362

Quoted 5 lines
arch/ia64/hp/sim/simscsi.c +1 -1
@@ -358,7 +359,7 @@ simscsi_init(void)
 	if (!host)
 		return -ENOMEM;
 
-	error = scsi_add_host(host, NULL);
+	error = scsi_add_host_with_dma(host, NULL, &platform_bus);

It's the right fix, but it's not general enough. This should make sure none of the legacy bus devices oops:

James

---

drivers/scsi/hosts.c +3 -0
index 351dc0b..a3a056a 100644
@@ -218,6 +218,9 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
 
 	if (!shost->shost_gendev.parent)
 		shost->shost_gendev.parent = dev ? dev : &platform_bus;
+	if (!dma_dev)
+		dma_dev = shost->shost_gendev.parent;
+
 	shost->dma_dev = dma_dev;
 
 	error = device_add(&shost->shost_gendev);