hercules-390 / hyperion

Hercules 390
Other
252 stars 70 forks source link

Channel Error: CCW requested CC+CD flags but only passed CD flag to device routine. #12

Closed rwoodpd closed 10 years ago

rwoodpd commented 10 years ago

There is a bug in ckddasd.c. There is code in function chkdasd_execute_ccw that checks the CCW flag for bit CCW_FLAGS_CC, but that bit is turned off in channel.c after saving it in dev->chained (DEVBLK structure).

  This ends up causing an I-O error, mostly it seems for extended VSAM data sets.    I changed the code and rebuilt it on my machine, and it is now working.

         around line 3318

/* Command reject if any command is chained from this command / if (flags & CCW_FLAGS_CC) { ckd_build_sense (dev, SENSE_CR, 0, 0, FORMAT_0, MESSAGE_2); unitstat = CSW_CE | CSW_DE | CSW_UC; break; }

 should be

/* Command reject if any command is chained from this command / if (dev->chained & CCW_FLAGS_CC) { ckd_build_sense (dev, SENSE_CR, 0, 0, FORMAT_0, MESSAGE_2); unitstat = CSW_CE | CSW_DE | CSW_UC; break; }

          around line 6050

 /* Command reject with incomplete domain if CCWs remain
       but command chaining is not specified */
    if (dev->ckdlcount > 0 && (flags & CCW_FLAGS_CC) == 0 &&
        code != 0x02)
    {       
        ckd_build_sense (dev, SENSE_CR | SENSE_OC, 0, 0, 0, 0);
        *unitstat = CSW_CE | CSW_DE | CSW_UC;
    }

 should be

/* Command reject with incomplete domain if CCWs remain but command chaining is not specified / if (dev->ckdlcount > 0 && (dev->chained & CCW_FLAGS_CC) == 0 && code != 0x02) {
ckd_build_sense (dev, SENSE_CR | SENSE_OC, 0, 0, 0, 0);
unitstat = CSW_CE | CSW_DE | CSW_UC; }

Bob Wood rwoodpd@gmail.com

Fish-Git commented 10 years ago

Can you provide the JCL and the Hercules log output with CCW tracing enabled for the job you ran that illustrates the failure?

I would like to be able to reproduce the problem and verify for myself your fix is good before committing it to the repository.

Thanks!

rwoodpd commented 10 years ago

I can do that. Do you have DB2 available? You will need something that accesses extended vsam to recreate it. I was using the DB2 bootstrap utility DSNJU003. If need be, I can send you an xmitted load library with that module in it (it runs stand alone).

Fish-Git commented 10 years ago

Upon his request I have assigned this issue to "dasdman". Please work with him on this issue. Thank you.

dasdman commented 10 years ago

Not a device error, but an error in processing the CCW flags in the channel code in that the CC flag is not passed to the device when CD is specified.

Fix in process.

dasdman commented 10 years ago

Fix posted as "Finish Issue-12-Channel-CD-not-CC+CD-to-device" and "Correct channel error in processing the CCW flags; CC incorrectly suppressed and not passed to the device when CD is specified" (SHA 3bed998870c58514113356c41377e43bfa073fbb and 0c3da7858a7cda4a81d96477156598a614564256).

ivan-w commented 10 years ago

I'm not sure I understand this patch !

From what I see :

A CCW with CC+CD set in the first CCW and CC+CD clear in the next CCW will indicate to the driver that CC is set (while it isn't)

CC is only valid (or rather recognized) on a CCW which hasn't the CD bit set.

The POP is clear on this :

When both command and data chaining are specified, the first CCW associated with the operation specifies the operation to be performed, and the last CCW specifies whether another operation follows.

(Page 15-35 of SA22-7832-03)

Le 02/08/2014 07:25, dasdman a écrit :

Fix posted as "Finish Issue-12-Channel-CD-not-CC+CD-to-device" and "Correct channel error in processing the CCW flags; CC incorrectly suppressed and not passed to the device when CD is specified" (SHA 3bed998 https://github.com/hercules-390/hyperion/commit/3bed998870c58514113356c41377e43bfa073fbb and 0c3da78 https://github.com/hercules-390/hyperion/commit/0c3da7858a7cda4a81d96477156598a614564256).

— Reply to this email directly or view it on GitHub https://github.com/hercules-390/hyperion/issues/12#issuecomment-50954432.

dasdman commented 10 years ago

Welcome to the world of compatibility and nuance in the world of the principles of operation.

A rather lengthy CCW trace (not included in the comments) plus the channel OEMI manuals and signal sequencing charts for the 360 and 370 had to be reviewed. The code I originally put together took the literal meaning of the paragraph from the principles of operation and the perceived effective mode of operation. This does not cover the actual coding and operation of the DASD LR and LRE CCW codes and management. The key is that the signal for CC, when specified, is to be passed via the channel regardless of the CD setting. The channel is not to presume that this is a case in which CC may be suppressed. What the principles is clear on is the effective operation, not what is passed by the channel to the CU and device.

A preliminary copy of the fix was also tested by the originator of the issue.

Fish-Git commented 10 years ago

Fixed by commit 0c3da7858a7cda4a81d96477156598a614564256