Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[S390] New DASD feature for ERP related logging

It is now possible to enable/disable ERP related logging without re-compile
and re-ipl. A additional sysfs-attribute 'erplog' allows to switch the
logging non-interruptive.

Signed-off-by: Horst Hummel <horst.hummel@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Horst Hummel and committed by
Martin Schwidefsky
9575bf26 85eca850

+64 -22
+4 -4
drivers/s390/block/dasd.c
··· 1050 1050 } 1051 1051 } else { /* error */ 1052 1052 memcpy(&cqr->irb, irb, sizeof (struct irb)); 1053 - #ifdef ERP_DEBUG 1054 - /* dump sense data */ 1055 - dasd_log_sense(cqr, irb); 1056 - #endif 1053 + if (device->features & DASD_FEATURE_ERPLOG) { 1054 + /* dump sense data */ 1055 + dasd_log_sense(cqr, irb); 1056 + } 1057 1057 switch (era) { 1058 1058 case dasd_era_fatal: 1059 1059 cqr->status = DASD_CQR_FAILED;
+9 -14
drivers/s390/block/dasd_3990_erp.c
··· 2641 2641 struct dasd_ccw_req *erp = NULL; 2642 2642 struct dasd_device *device = cqr->device; 2643 2643 __u32 cpa = cqr->irb.scsw.cpa; 2644 + struct dasd_ccw_req *temp_erp = NULL; 2644 2645 2645 - #ifdef ERP_DEBUG 2646 - /* print current erp_chain */ 2647 - DEV_MESSAGE(KERN_ERR, device, "%s", 2648 - "ERP chain at BEGINNING of ERP-ACTION"); 2649 - { 2650 - struct dasd_ccw_req *temp_erp = NULL; 2651 - 2646 + if (device->features & DASD_FEATURE_ERPLOG) { 2647 + /* print current erp_chain */ 2648 + DEV_MESSAGE(KERN_ERR, device, "%s", 2649 + "ERP chain at BEGINNING of ERP-ACTION"); 2652 2650 for (temp_erp = cqr; 2653 2651 temp_erp != NULL; temp_erp = temp_erp->refers) { 2654 2652 ··· 2656 2658 temp_erp->refers); 2657 2659 } 2658 2660 } 2659 - #endif /* ERP_DEBUG */ 2660 2661 2661 2662 /* double-check if current erp/cqr was successfull */ 2662 2663 if ((cqr->irb.scsw.cstat == 0x00) && ··· 2692 2695 erp = dasd_3990_erp_handle_match_erp(cqr, erp); 2693 2696 } 2694 2697 2695 - #ifdef ERP_DEBUG 2696 - /* print current erp_chain */ 2697 - DEV_MESSAGE(KERN_ERR, device, "%s", "ERP chain at END of ERP-ACTION"); 2698 - { 2699 - struct dasd_ccw_req *temp_erp = NULL; 2698 + if (device->features & DASD_FEATURE_ERPLOG) { 2699 + /* print current erp_chain */ 2700 + DEV_MESSAGE(KERN_ERR, device, "%s", 2701 + "ERP chain at END of ERP-ACTION"); 2700 2702 for (temp_erp = erp; 2701 2703 temp_erp != NULL; temp_erp = temp_erp->refers) { 2702 2704 ··· 2705 2709 temp_erp->refers); 2706 2710 } 2707 2711 } 2708 - #endif /* ERP_DEBUG */ 2709 2712 2710 2713 if (erp->status == DASD_CQR_FAILED) 2711 2714 dasd_log_ccw(erp, 1, cpa);
+49
drivers/s390/block/dasd_devmap.c
··· 202 202 features |= DASD_FEATURE_READONLY; 203 203 else if (len == 4 && !strncmp(str, "diag", 4)) 204 204 features |= DASD_FEATURE_USEDIAG; 205 + else if (len == 6 && !strncmp(str, "erplog", 6)) 206 + features |= DASD_FEATURE_ERPLOG; 205 207 else { 206 208 MESSAGE(KERN_WARNING, 207 209 "unsupported feature: %*s, " ··· 711 709 } 712 710 713 711 static DEVICE_ATTR(readonly, 0644, dasd_ro_show, dasd_ro_store); 712 + /* 713 + * erplog controls the logging of ERP related data 714 + * (e.g. failing channel programs). 715 + */ 716 + static ssize_t 717 + dasd_erplog_show(struct device *dev, struct device_attribute *attr, char *buf) 718 + { 719 + struct dasd_devmap *devmap; 720 + int erplog; 721 + 722 + devmap = dasd_find_busid(dev->bus_id); 723 + if (!IS_ERR(devmap)) 724 + erplog = (devmap->features & DASD_FEATURE_ERPLOG) != 0; 725 + else 726 + erplog = (DASD_FEATURE_DEFAULT & DASD_FEATURE_ERPLOG) != 0; 727 + return snprintf(buf, PAGE_SIZE, erplog ? "1\n" : "0\n"); 728 + } 729 + 730 + static ssize_t 731 + dasd_erplog_store(struct device *dev, struct device_attribute *attr, 732 + const char *buf, size_t count) 733 + { 734 + struct dasd_devmap *devmap; 735 + int val; 736 + char *endp; 737 + 738 + devmap = dasd_devmap_from_cdev(to_ccwdev(dev)); 739 + if (IS_ERR(devmap)) 740 + return PTR_ERR(devmap); 741 + 742 + val = simple_strtoul(buf, &endp, 0); 743 + if (((endp + 1) < (buf + count)) || (val > 1)) 744 + return -EINVAL; 745 + 746 + spin_lock(&dasd_devmap_lock); 747 + if (val) 748 + devmap->features |= DASD_FEATURE_ERPLOG; 749 + else 750 + devmap->features &= ~DASD_FEATURE_ERPLOG; 751 + if (devmap->device) 752 + devmap->device->features = devmap->features; 753 + spin_unlock(&dasd_devmap_lock); 754 + return count; 755 + } 756 + 757 + static DEVICE_ATTR(erplog, 0644, dasd_erplog_show, dasd_erplog_store); 714 758 715 759 /* 716 760 * use_diag controls whether the driver should use diag rather than ssch ··· 944 896 &dev_attr_uid.attr, 945 897 &dev_attr_use_diag.attr, 946 898 &dev_attr_eer_enabled.attr, 899 + &dev_attr_erplog.attr, 947 900 NULL, 948 901 }; 949 902
-4
drivers/s390/block/dasd_int.h
··· 13 13 14 14 #ifdef __KERNEL__ 15 15 16 - /* erp debugging in dasd.c and dasd_3990_erp.c */ 17 - #define ERP_DEBUG 18 - 19 - 20 16 /* we keep old device allocation scheme; IOW, minors are still in 0..255 */ 21 17 #define DASD_PER_MAJOR (1U << (MINORBITS - DASD_PARTN_BITS)) 22 18 #define DASD_PARTN_MASK ((1 << DASD_PARTN_BITS) - 1)
+2
include/asm-s390/dasd.h
··· 69 69 * 0x01: readonly (ro) 70 70 * 0x02: use diag discipline (diag) 71 71 * 0x04: set the device initially online (internal use only) 72 + * 0x08: enable ERP related logging 72 73 */ 73 74 #define DASD_FEATURE_DEFAULT 0x00 74 75 #define DASD_FEATURE_READONLY 0x01 75 76 #define DASD_FEATURE_USEDIAG 0x02 76 77 #define DASD_FEATURE_INITIAL_ONLINE 0x04 78 + #define DASD_FEATURE_ERPLOG 0x08 77 79 78 80 #define DASD_PARTN_BITS 2 79 81