Commit 9575bf265711cabe7147a68003a56a9f19f034da

Authored by Horst Hummel
Committed by Martin Schwidefsky
1 parent 85eca85039

[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>

Showing 5 changed files with 64 additions and 22 deletions Side-by-side Diff

drivers/s390/block/dasd.c
... ... @@ -1050,10 +1050,10 @@
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;
drivers/s390/block/dasd_3990_erp.c
... ... @@ -2641,14 +2641,12 @@
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  
... ... @@ -2658,7 +2656,6 @@
2658 2656 temp_erp->refers);
2659 2657 }
2660 2658 }
2661   -#endif /* ERP_DEBUG */
2662 2659  
2663 2660 /* double-check if current erp/cqr was successfull */
2664 2661 if ((cqr->irb.scsw.cstat == 0x00) &&
... ... @@ -2695,11 +2692,10 @@
2695 2692 erp = dasd_3990_erp_handle_match_erp(cqr, erp);
2696 2693 }
2697 2694  
2698   -#ifdef ERP_DEBUG
2699   - /* print current erp_chain */
2700   - DEV_MESSAGE(KERN_ERR, device, "%s", "ERP chain at END of ERP-ACTION");
2701   - {
2702   - struct dasd_ccw_req *temp_erp = NULL;
  2695 + if (device->features & DASD_FEATURE_ERPLOG) {
  2696 + /* print current erp_chain */
  2697 + DEV_MESSAGE(KERN_ERR, device, "%s",
  2698 + "ERP chain at END of ERP-ACTION");
2703 2699 for (temp_erp = erp;
2704 2700 temp_erp != NULL; temp_erp = temp_erp->refers) {
2705 2701  
... ... @@ -2709,7 +2705,6 @@
2709 2705 temp_erp->refers);
2710 2706 }
2711 2707 }
2712   -#endif /* ERP_DEBUG */
2713 2708  
2714 2709 if (erp->status == DASD_CQR_FAILED)
2715 2710 dasd_log_ccw(erp, 1, cpa);
drivers/s390/block/dasd_devmap.c
... ... @@ -202,6 +202,8 @@
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, "
208 210  
... ... @@ -709,7 +711,53 @@
709 711 }
710 712  
711 713 static DEVICE_ATTR(readonly, 0644, dasd_ro_show, dasd_ro_store);
  714 +/*
  715 + * erplog controls the logging of ERP related data
  716 + * (e.g. failing channel programs).
  717 + */
  718 +static ssize_t
  719 +dasd_erplog_show(struct device *dev, struct device_attribute *attr, char *buf)
  720 +{
  721 + struct dasd_devmap *devmap;
  722 + int erplog;
712 723  
  724 + devmap = dasd_find_busid(dev->bus_id);
  725 + if (!IS_ERR(devmap))
  726 + erplog = (devmap->features & DASD_FEATURE_ERPLOG) != 0;
  727 + else
  728 + erplog = (DASD_FEATURE_DEFAULT & DASD_FEATURE_ERPLOG) != 0;
  729 + return snprintf(buf, PAGE_SIZE, erplog ? "1\n" : "0\n");
  730 +}
  731 +
  732 +static ssize_t
  733 +dasd_erplog_store(struct device *dev, struct device_attribute *attr,
  734 + const char *buf, size_t count)
  735 +{
  736 + struct dasd_devmap *devmap;
  737 + int val;
  738 + char *endp;
  739 +
  740 + devmap = dasd_devmap_from_cdev(to_ccwdev(dev));
  741 + if (IS_ERR(devmap))
  742 + return PTR_ERR(devmap);
  743 +
  744 + val = simple_strtoul(buf, &endp, 0);
  745 + if (((endp + 1) < (buf + count)) || (val > 1))
  746 + return -EINVAL;
  747 +
  748 + spin_lock(&dasd_devmap_lock);
  749 + if (val)
  750 + devmap->features |= DASD_FEATURE_ERPLOG;
  751 + else
  752 + devmap->features &= ~DASD_FEATURE_ERPLOG;
  753 + if (devmap->device)
  754 + devmap->device->features = devmap->features;
  755 + spin_unlock(&dasd_devmap_lock);
  756 + return count;
  757 +}
  758 +
  759 +static DEVICE_ATTR(erplog, 0644, dasd_erplog_show, dasd_erplog_store);
  760 +
713 761 /*
714 762 * use_diag controls whether the driver should use diag rather than ssch
715 763 * to talk to the device
... ... @@ -896,6 +944,7 @@
896 944 &dev_attr_uid.attr,
897 945 &dev_attr_use_diag.attr,
898 946 &dev_attr_eer_enabled.attr,
  947 + &dev_attr_erplog.attr,
899 948 NULL,
900 949 };
901 950  
drivers/s390/block/dasd_int.h
... ... @@ -13,10 +13,6 @@
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)
include/asm-s390/dasd.h
... ... @@ -69,11 +69,13 @@
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