2002-10-04 14:42:20

by Martin Schwidefsky

[permalink] [raw]
Subject: [PATCH] 2.5.40 s390.

Hi Linus,
the 27th patch has joint the patch set for s/390. Minimum set for something
useful is again the first 7 patches.

The list of patches and some comments:

01: arch/s390 and arch/s390x part of the minimal patch to get the kernel
compiled again (without any device drivers).
02: include/asm-s390 and include/asm-s390x part of the minimal patch.
03: drivers/s390 part of the minimal patch.
04: Add new system calls.
05: Get the bloody ibm partition code to work.
06: I removed some unnecessary config options and restructured the
configuration menu a bit.
07: Fixes and more cleanup for the dasd driver. Thanks to Al Viro we
got rid of the ugly things in the dasd driver. The only big thing
left is big minors. In preparation we removed kdev_t where possible.
08: Fixes for the xpram driver.
09: Get rid of some of the bottom halves in the s/390 device drivers. Yet
to be are ctrlchar, tape, 3270 and lcs.
10: A bug fix for the (unused) option ALIGN_CS == 1.
11: Latest 31 bit emulation fixes.
12: Unify the two linker scripts and let the preprocessor deal with
CONFIG_SHARED_KERNEL.
13: Add preemption support. It still complains about about "scheduling
while atomic" though.
14: Inline all tcpip checksum functions and optimize xchg.
15: Make use of the diag 0x44 in 64 bit spinlock code. The diag 0x44 yields
a virtual cpu under VM and LPAR is the lock is taken.
16: I removed the dependency on the boot cpu in the timer interrupt.
This makes it easier with the timer patch and with switching
cpus on and off.
17: Some code beautification.
18: Optimization for loading/storing of fpu registers. Got rid
of another stupid file in arch/s390/kernel.
19: Make ptrace readable.
20: Add signal quiesce support to shut down the system on demand.
21: Fix and simplify synchronous i/o functions.
22: Simplify s390_process_IRQ.
23: Do the right thing if channel paths are not available.
24: Reworked boot sequence.
25: Remove s390 specific init call from init/main.c. 24 and 25 are related.
26: /proc/interrupts does not make sense on s390. There are
65536 i/o and 65536 external interrupts. We do not really
want to have a file with #cpus * 128K zeros.
27: Get rid of the bottom half in the helper functions for console control
characters. Fixes a race condition as well and the ctrlchar code looks
nicer now.

blue skies,
Martin.



2002-10-04 18:16:06

by Alexander Viro

[permalink] [raw]
Subject: Re: [PATCH] 2.5.40 s390.



On Fri, 4 Oct 2002, Martin Schwidefsky wrote:

> Hi Linus,
> the 27th patch has joint the patch set for s/390. Minimum set for something
> useful is again the first 7 patches.
>
> The list of patches and some comments:
>
> 07: Fixes and more cleanup for the dasd driver. Thanks to Al Viro we
> got rid of the ugly things in the dasd driver. The only big thing
> left is big minors. In preparation we removed kdev_t where possible.

* please switch to use of alloc_disk()/put_disk()
* don't bother with disk->part allocation - it's done by add_disk()
* ditto for freeing it (del_gendisk())
* dasd_partition_to_kdev_t() - please use ->gdp->{major,first_minor}
* s/bdevname(d_device->bdev)/d_device->gdp->disk_name/
* lose ->bdev

Note that we are getting bdev->bd_disk and disk->private pretty soon, so
we'll have very easy way to do your devmap by bdev stuff.

Anther thing: tapeblock.c and friends.
<rant>
In ~ 2.5.16 blksize_size[] had been removed. Tape-related code
in s390 was using it, but that was fairly easy to get rid of. Now, in
2.5.21 somebody (presumably architecture maintainers) had submitted a
patch that
* reverted all compile fixes, etc. that had happened in 2.5
* reintroduced use of (long-dead) blksize_size[]
^#$^%@!
Folks, if you do something like that, at least check the bloody changelog...
</rant>

2002-10-07 07:32:50

by Martin Schwidefsky

[permalink] [raw]
Subject: Re: [PATCH] 2.5.40 s390.


Hi Al,

> * please switch to use of alloc_disk()/put_disk()
> * don't bother with disk->part allocation - it's done by add_disk()
> * ditto for freeing it (del_gendisk())
> * dasd_partition_to_kdev_t() - please use ->gdp->{major,first_minor}
> * s/bdevname(d_device->bdev)/d_device->gdp->disk_name/
> * lose ->bdev
I'll do that.

> Note that we are getting bdev->bd_disk and disk->private pretty soon, so
> we'll have very easy way to do your devmap by bdev stuff.
Thats good to hear. One of the reasons for me to split of dasd_devmap.c
was to have the code concerned about minors and friends in on place.
That makes it easy to get rid of it.

> Anther thing: tapeblock.c and friends.
> <rant>
> In ~ 2.5.16 blksize_size[] had been removed. Tape-related code
> in s390 was using it, but that was fairly easy to get rid of. Now, in
> 2.5.21 somebody (presumably architecture maintainers) had submitted a
> patch that
> * reverted all compile fixes, etc. that had happened in 2.5
> * reintroduced use of (long-dead) blksize_size[]
> ^#$^%@!
> Folks, if you do something like that, at least check the bloody changelog...
> </rant>

Oh, that must have been me then. Sorry about that. But there is a reason
for my obvious desinterest in the tape device driver. I'm just rewriting
it completely. So don't bother with the old one.

blue skies,
Martin

Linux/390 Design & Development, IBM Deutschland Entwicklung GmbH
Sch?naicherstr. 220, D-71032 B?blingen, Telefon: 49 - (0)7031 - 16-2247
E-Mail: [email protected]


2002-10-07 11:20:22

by Martin Schwidefsky

[permalink] [raw]
Subject: Re: [PATCH] 2.5.40 s390.

Hi Al,
> > * please switch to use of alloc_disk()/put_disk()
> > * don't bother with disk->part allocation - it's done by add_disk()
> > * ditto for freeing it (del_gendisk())
> > * dasd_partition_to_kdev_t() - please use ->gdp->{major,first_minor}
> > * s/bdevname(d_device->bdev)/d_device->gdp->disk_name/
> > * lose ->bdev
> I'll do that.

Done.

blue skies,
Martin

ChangeLog:

Get rid of name and bdev in dasd_device_t structure.

diff -urN linux-2.5/drivers/s390/block/dasd.c linux-2.5-s390/drivers/s390/block/dasd.c
--- linux-2.5/drivers/s390/block/dasd.c Mon Oct 7 11:21:49 2002
+++ linux-2.5-s390/drivers/s390/block/dasd.c Mon Oct 7 11:13:48 2002
@@ -236,7 +236,7 @@
}

/* Allocate gendisk structure for device. */
- gdp = dasd_gendisk_alloc(device->name, devmap->devindex);
+ gdp = dasd_gendisk_alloc(devmap->devindex);
if (IS_ERR(gdp)) {
free_page((unsigned long) device->erp_mem);
free_pages((unsigned long) device->ccw_mem, 1);
@@ -294,10 +294,6 @@
return -ENODEV;
minor = devmap->devindex % DASD_PER_MAJOR;

- /* Set bdev and the device name. */
- device->bdev = bdget(MKDEV(major, minor << DASD_PARTN_BITS));
- strcpy(device->name, device->gdp->disk_name);
-
/* Find a discipline for the device. */
rc = dasd_find_disc(device);
if (rc)
@@ -341,8 +337,8 @@
device->state = DASD_STATE_NEW;

/* Forget the block device */
- bdev = device->bdev;
- device->bdev = NULL;
+ bdev = bdget(MKDEV(device->gdp->major, device->gdp->first_minor));
+ bdput(bdev);
bdput(bdev);
}

@@ -355,7 +351,7 @@
int rc;

/* register 'device' debug area, used for all DBF_DEV_XXX calls */
- device->debug_area = debug_register(device->name, 0, 2,
+ device->debug_area = debug_register(device->gdp->disk_name, 0, 2,
8 * sizeof (long));
debug_register_view(device->debug_area, &debug_sprintf_view);
debug_set_level(device->debug_area, DBF_ERR);
@@ -436,7 +432,7 @@
static inline kdev_t
dasd_partition_to_kdev_t(dasd_device_t *device, unsigned int partition)
{
- return to_kdev_t(device->bdev->bd_dev+partition);
+ return mk_kdev(device->gdp->major, device->gdp->first_minor+partition);
}


@@ -453,6 +449,7 @@
if (devmap->features & DASD_FEATURE_READONLY) {
for (i = 0; i < (1 << DASD_PARTN_BITS); i++)
set_device_ro(dasd_partition_to_kdev_t(device, i), 1);
+ device->ro_flag = 1;
DEV_MESSAGE (KERN_WARNING, device, "%s",
"setting read-only mode ");
}
@@ -1582,17 +1579,12 @@
static inline void
__dasd_process_blk_queue(dasd_device_t * device)
{
- struct block_device *bdev;
request_queue_t *queue;
struct list_head *l;
struct request *req;
dasd_ccw_req_t *cqr;
int nr_queued;

- /* No bdev, no queue. */
- bdev = device->bdev;
- if (!bdev)
- return;
queue = device->request_queue;
/* No queue ? Then there is nothing to do. */
if (queue == NULL)
@@ -1619,7 +1611,7 @@
!blk_queue_empty(queue) &&
nr_queued < DASD_CHANQ_MAX_SIZE) {
req = elv_next_request(queue);
- if (bdev_read_only(bdev) && rq_data_dir(req) == WRITE) {
+ if (device->ro_flag && rq_data_dir(req) == WRITE) {
DBF_EVENT(DBF_ERR,
"(%04x) Rejecting write request %p",
device->devinfo.devno, req);
diff -urN linux-2.5/drivers/s390/block/dasd_genhd.c linux-2.5-s390/drivers/s390/block/dasd_genhd.c
--- linux-2.5/drivers/s390/block/dasd_genhd.c Mon Oct 7 11:21:49 2002
+++ linux-2.5-s390/drivers/s390/block/dasd_genhd.c Mon Oct 7 11:13:48 2002
@@ -162,7 +162,7 @@
* Allocate gendisk structure for devindex.
*/
struct gendisk *
-dasd_gendisk_alloc(char *device_name, int devindex)
+dasd_gendisk_alloc(int devindex)
{
struct list_head *l;
struct major_info *mi;
@@ -195,7 +195,7 @@
return ERR_PTR(-ENOMEM);

/* Initialize gendisk structure. */
- memcpy(gdp->disk_name, device_name, 16); /* huh? -- AV */
+ memset(gdp, 0, sizeof(struct gendisk));
gdp->major = mi->major;
gdp->first_minor = index << DASD_PARTN_BITS;
gdp->minor_shift = DASD_PARTN_BITS;
@@ -207,15 +207,16 @@
* dasdaa - dasdzz : 676 devices, added up = 702
* dasdaaa - dasdzzz : 17576 devices, added up = 18278
*/
- len = sprintf(device_name, "dasd");
+ len = sprintf(gdp->disk_name, "dasd");
if (devindex > 25) {
if (devindex > 701)
- len += sprintf(device_name + len, "%c",
+ len += sprintf(gdp->disk_name + len, "%c",
'a' + (((devindex - 702) / 676) % 26));
- len += sprintf(device_name + len, "%c",
+ len += sprintf(gdp->disk_name + len, "%c",
'a' + (((devindex - 26) / 26) % 26));
}
- len += sprintf(device_name + len, "%c", 'a' + (devindex % 26));
+ len += sprintf(gdp->disk_name + len, "%c", 'a' + (devindex % 26));
+
return gdp;
}

diff -urN linux-2.5/drivers/s390/block/dasd_int.h linux-2.5-s390/drivers/s390/block/dasd_int.h
--- linux-2.5/drivers/s390/block/dasd_int.h Mon Oct 7 11:21:49 2002
+++ linux-2.5-s390/drivers/s390/block/dasd_int.h Mon Oct 7 11:13:48 2002
@@ -140,7 +140,7 @@
#define DEV_MESSAGE(d_loglevel,d_device,d_string,d_args...)\
do { \
printk(d_loglevel PRINTK_HEADER " %s,%04x@%02x: " \
- d_string "\n", bdevname(d_device->bdev), \
+ d_string "\n", d_device->gdp->disk_name, \
d_device->devinfo.devno, d_device->devinfo.irq, \
d_args); \
DBF_DEV_EVENT(DBF_ALERT, d_device, d_string, d_args); \
@@ -258,8 +258,6 @@

typedef struct dasd_device_t {
/* Block device stuff. */
- char name[16]; /* The device name in /dev. */
- struct block_device *bdev;
struct gendisk *gdp;
devfs_handle_t devfs_entry;
request_queue_t *request_queue;
@@ -267,6 +265,7 @@
unsigned long blocks; /* size of volume in blocks */
unsigned int bp_block; /* bytes per block */
unsigned int s2b_shift; /* log2 (bp_block/512) */
+ int ro_flag; /* read-only flag */

/* Device discipline stuff. */
dasd_discipline_t *discipline;
@@ -479,7 +478,7 @@
void dasd_gendisk_exit(void);
int dasd_gendisk_major_index(int);
int dasd_gendisk_index_major(int);
-struct gendisk *dasd_gendisk_alloc(char *, int);
+struct gendisk *dasd_gendisk_alloc(int);
void dasd_setup_partitions(dasd_device_t *);
void dasd_destroy_partitions(dasd_device_t *);

diff -urN linux-2.5/drivers/s390/block/dasd_ioctl.c linux-2.5-s390/drivers/s390/block/dasd_ioctl.c
--- linux-2.5/drivers/s390/block/dasd_ioctl.c Mon Oct 7 11:21:34 2002
+++ linux-2.5-s390/drivers/s390/block/dasd_ioctl.c Mon Oct 7 11:13:48 2002
@@ -464,6 +464,7 @@
devmap->features &= ~DASD_FEATURE_READONLY;
for (i = 0; i < (1 << DASD_PARTN_BITS); i++)
set_device_ro(to_kdev_t(bdev->bd_dev + i), intval);
+ device->ro_flag = intval;
dasd_put_device(devmap);
return 0;
}
diff -urN linux-2.5/drivers/s390/block/dasd_proc.c linux-2.5-s390/drivers/s390/block/dasd_proc.c
--- linux-2.5/drivers/s390/block/dasd_proc.c Mon Oct 7 11:21:34 2002
+++ linux-2.5-s390/drivers/s390/block/dasd_proc.c Mon Oct 7 11:13:48 2002
@@ -154,7 +154,6 @@
{
dasd_device_t *device;
char *substr;
- int major, minor;
int len;

device = dasd_get_device(devmap);
@@ -168,11 +167,10 @@
else
len += sprintf(str + len, "(none)");
/* Print kdev. */
- major = MAJOR(device->bdev->bd_dev);
- minor = MINOR(device->bdev->bd_dev);
- len += sprintf(str + len, " at (%3d:%3d)", major, minor);
+ len += sprintf(str + len, " at (%3d:%3d)",
+ device->gdp->major, device->gdp->first_minor);
/* Print device name. */
- len += sprintf(str + len, " is %-7s", device->name);
+ len += sprintf(str + len, " is %-7s", device->gdp->disk_name);
/* Print devices features. */
substr = (devmap->features & DASD_FEATURE_READONLY) ? "(ro)" : " ";
len += sprintf(str + len, "%4s: ", substr);