Skip to contentSkip to conversation

s390: multiple subchannel sets support.

PATCH Greg Smith 2 participants 5 messages Feb 25, 2006 – Mar 14, 2006

Subsystems (2)
lore
Share & tools
lore

Greg Smith

author
#0 lore raw

Running linux-2.6.16-rc4 on the hercules s390x emulator we noticed a boatload of program checks on the stsch instruction, 192K to be exact. Hercules does not support multiple subchannel sets at this time. However, __init_channel_subsystem does not recognize the -EIO return code from css_alloc_subchannel.

Further investigation shows that this would have been avoided if the response code from the chsc instruction was properly handled. In this case chsc_enable_facility should have returned -EINVAL causing init_channel_subsystem to set max_ssid to zero. But the response code 0x0002 (invalid request) is not checked and chsc_enable_facility returns 0 causing max_ssid to be set to __MAX_SSID.

I have verified that on a real machine that does not support multiple channel sets (a 9672) the CHSC_SDA_OC_MSS chsc request gets response code 0x0002. The emulator also sets the response code to 0x0002.

Users of the emulator can do `pgmtrace -15' to supress the 3.7 million or so lines it spits out ;-)

Greg Smith

drivers/s390/cio/css.c renamed from drivers/s390/cio/css.c.orig +3 -0
@@ -409,6 +409,9 @@
 		/* -ENXIO: no more subchannels. */
 		case -ENXIO:
 			return ret;
+		/* -EIO: this subchannel set not supported. */
+		case -EIO:
+			return ret;
 		default:
 			return 0;
 		}
drivers/s390/cio/chsc.c renamed from drivers/s390/cio/chsc.c.orig +1 -0
@@ -1115,6 +1115,7 @@
 		goto out;
 	}
 	switch (sda_area->response.code) {
+	case 0x0002: /* invalid request */
 	case 0x0003: /* invalid request block */
 	case 0x0007:
 		ret = -EINVAL;
#1 lore raw
Quoted 2 lines · On Sat, 25 Feb 2006 06:12:02 -0500 Greg Smith <[email protected]> wrote:

However, __init_channel_subsystem does not recognize the -EIO return code from css_alloc_subchannel.

Good catch.

Quoted 3 lines

I have verified that on a real machine that does not support multiple channel sets (a 9672) the CHSC_SDA_OC_MSS chsc request gets response code 0x0002. The emulator also sets the response code to 0x0002.

The architecture seems to disagree somewhat :) (and I also got a different response code on the non-MSS capable HW I tested on). On further looking at the code, the check leaves room for improvement anyway... I'd prefer the following patch:

s390: Improve response code handling in chsc_enable_facility().

Rather than checking for some known failures, check positively for the success response code 0x0001 and return -EIO for unrecognized failure response codes.

 chsc.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/s390/cio/chsc.c +5 -0
index 8cf9905..f4183d6 100644
@@ -1115,6 +1115,9 @@ chsc_enable_facility(int operation_code)
 		goto out;
 	}
 	switch (sda_area->response.code) {
+	case 0x0001: /* everything ok */
+		ret = 0;
+		break;
 	case 0x0003: /* invalid request block */
 	case 0x0007:
 		ret = -EINVAL;
@@ -1123,6 +1126,8 @@ chsc_enable_facility(int operation_code)
 	case 0x0101: /* facility not provided */
 		ret = -EOPNOTSUPP;
 		break;
+	default: /* something went wrong */
+		ret = -EIO;
 	}
  out:
 	free_page((unsigned long)sda_area);
author
#2 lore raw
Quoted 1 line · Cornelia Huck

The architecture seems to disagree somewhat :)

You mean you all got doc?? What kind of hackers R u guys ;-)

Quoted 1 line

anyway... I'd prefer the following patch:

Works for me (tm)

Quoted 26 lines

s390: Improve response code handling in chsc_enable_facility().

Rather than checking for some known failures, check positively for the success response code 0x0001 and return -EIO for unrecognized failure response codes.

 chsc.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/s390/cio/chsc.c +3 -0
index 8cf9905..f4183d6 100644
@@ -1115,6 +1115,9 @@ chsc_enable_facility(int operation_code)
 		goto out;
 	}
 	switch (sda_area->response.code) {
+	case 0x0001: /* everything ok */
+		ret = 0;
+		break;
 	case 0x0003: /* invalid request block */
 	case 0x0007:
 		ret = -EINVAL;

drivers/s390/cio/chsc.c chsc_enable_facility(int operation_code) · line 1133

Quoted 8 lines
drivers/s390/cio/chsc.c +2 -0
@@ -1123,6 +1126,8 @@ chsc_enable_facility(int operation_code)
 	case 0x0101: /* facility not provided */
 		ret = -EOPNOTSUPP;
 		break;
+	default: /* something went wrong */
+		ret = -EIO;
 	}
  out:
 	free_page((unsigned long)sda_area);

Many thanks,
Greg Smith

author
#3 lore raw
In reply to Cornelia Huck
Quoted 7 lines · Cornelia Huck
Quoted 2 lines · On Sat, 25 Feb 2006 06:12:02 -0500 Greg Smith <[email protected]> wrote:

However, __init_channel_subsystem does not recognize the -EIO return code from css_alloc_subchannel.

Good catch.

It seems this patch got dropped (it was in addition to the `s390:
improve response code handling in chsc_enable_facility()' patch).

Greg Smith

drivers/s390/cio/css.c +3 -0
diff -u -r a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
@@ -409,6 +409,9 @@
 		/* -ENXIO: no more subchannels. */
 		case -ENXIO:
 			return ret;
+		/* -EIO: this subchannel set not supported. */
+		case -EIO:
+			return ret;
 		default:
 			return 0;
 		}
Acked-by
#4 lore raw
Quoted 2 lines · On Mon, 13 Mar 2006 17:18:28 -0500 Greg Smith <[email protected]> wrote:

It seems this patch got dropped (it was in addition to the `s390:
improve response code handling in chsc_enable_facility()' patch).

Whoops. This should get merged as well to avoid unneccessary checks.

Quoted 15 lines

diff -u -r a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c

drivers/s390/cio/css.c +3 -0
@@ -409,6 +409,9 @@
 		/* -ENXIO: no more subchannels. */
 		case -ENXIO:
 			return ret;
+		/* -EIO: this subchannel set not supported. */
+		case -EIO:
+			return ret;
 		default:
 			return 0;
 		}