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

s390/zcrypt: introduce dynamic debugging for AP and zcrypt code

This patch replaces all the s390 debug feature calls with
debug level by dynamic debug calls pr_debug. These calls
are much more flexible and each single invocation can get
enabled/disabled at runtime wheres the s390 debug feature
debug calls have only one knob - enable or disable all in
one bunch. The benefit is especially significant with
high frequency called functions like the AP bus scan. In
most debugging scenarios you don't want and need them, but
sometimes it is crucial to know exactly when and how long
the AP bus scan took.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

authored by

Harald Freudenberger and committed by
Heiko Carstens
08b2c370 88e4c0da

+89 -85
+20 -18
drivers/s390/crypto/ap_bus.c
··· 826 826 drvres = to_ap_drv(dev->driver)->flags 827 827 & AP_DRIVER_FLAG_DEFAULT; 828 828 if (!!devres != !!drvres) { 829 - AP_DBF_DBG("%s reprobing queue=%02x.%04x\n", 830 - __func__, card, queue); 829 + pr_debug("%s reprobing queue=%02x.%04x\n", 830 + __func__, card, queue); 831 831 rc = device_reprobe(dev); 832 832 if (rc) 833 833 AP_DBF_WARN("%s reprobing queue=%02x.%04x failed\n", ··· 1030 1030 */ 1031 1031 void ap_bus_cfg_chg(void) 1032 1032 { 1033 - AP_DBF_DBG("%s config change, forcing bus rescan\n", __func__); 1033 + pr_debug("%s config change, forcing bus rescan\n", __func__); 1034 1034 1035 1035 ap_bus_force_rescan(); 1036 1036 } ··· 1888 1888 aq->last_err_rc = AP_RESPONSE_CHECKSTOPPED; 1889 1889 } 1890 1890 spin_unlock_bh(&aq->lock); 1891 - AP_DBF_DBG("%s(%d,%d) queue dev checkstop on\n", 1892 - __func__, ac->id, dom); 1891 + pr_debug("%s(%d,%d) queue dev checkstop on\n", 1892 + __func__, ac->id, dom); 1893 1893 /* 'receive' pending messages with -EAGAIN */ 1894 1894 ap_flush_queue(aq); 1895 1895 goto put_dev_and_continue; ··· 1899 1899 if (aq->dev_state > AP_DEV_STATE_UNINITIATED) 1900 1900 _ap_queue_init_state(aq); 1901 1901 spin_unlock_bh(&aq->lock); 1902 - AP_DBF_DBG("%s(%d,%d) queue dev checkstop off\n", 1903 - __func__, ac->id, dom); 1902 + pr_debug("%s(%d,%d) queue dev checkstop off\n", 1903 + __func__, ac->id, dom); 1904 1904 goto put_dev_and_continue; 1905 1905 } 1906 1906 /* config state change */ ··· 1912 1912 aq->last_err_rc = AP_RESPONSE_DECONFIGURED; 1913 1913 } 1914 1914 spin_unlock_bh(&aq->lock); 1915 - AP_DBF_DBG("%s(%d,%d) queue dev config off\n", 1916 - __func__, ac->id, dom); 1915 + pr_debug("%s(%d,%d) queue dev config off\n", 1916 + __func__, ac->id, dom); 1917 1917 ap_send_config_uevent(&aq->ap_dev, aq->config); 1918 1918 /* 'receive' pending messages with -EAGAIN */ 1919 1919 ap_flush_queue(aq); ··· 1924 1924 if (aq->dev_state > AP_DEV_STATE_UNINITIATED) 1925 1925 _ap_queue_init_state(aq); 1926 1926 spin_unlock_bh(&aq->lock); 1927 - AP_DBF_DBG("%s(%d,%d) queue dev config on\n", 1928 - __func__, ac->id, dom); 1927 + pr_debug("%s(%d,%d) queue dev config on\n", 1928 + __func__, ac->id, dom); 1929 1929 ap_send_config_uevent(&aq->ap_dev, aq->config); 1930 1930 goto put_dev_and_continue; 1931 1931 } ··· 1997 1997 ap_scan_rm_card_dev_and_queue_devs(ac); 1998 1998 put_device(dev); 1999 1999 } else { 2000 - AP_DBF_DBG("%s(%d) no type info (no APQN found), ignored\n", 2001 - __func__, ap); 2000 + pr_debug("%s(%d) no type info (no APQN found), ignored\n", 2001 + __func__, ap); 2002 2002 } 2003 2003 return; 2004 2004 } ··· 2010 2010 ap_scan_rm_card_dev_and_queue_devs(ac); 2011 2011 put_device(dev); 2012 2012 } else { 2013 - AP_DBF_DBG("%s(%d) no valid type (0) info, ignored\n", 2014 - __func__, ap); 2013 + pr_debug("%s(%d) no valid type (0) info, ignored\n", 2014 + __func__, ap); 2015 2015 } 2016 2016 return; 2017 2017 } ··· 2144 2144 { 2145 2145 int ap, config_changed = 0; 2146 2146 2147 + pr_debug(">%s\n", __func__); 2148 + 2147 2149 /* config change notify */ 2148 2150 config_changed = ap_get_configuration(); 2149 2151 if (config_changed) 2150 2152 notify_config_changed(); 2151 2153 ap_select_domain(); 2152 - 2153 - AP_DBF_DBG("%s running\n", __func__); 2154 2154 2155 2155 /* loop over all possible adapters */ 2156 2156 for (ap = 0; ap <= ap_max_adapter_id; ap++) ··· 2174 2174 } 2175 2175 2176 2176 if (atomic64_inc_return(&ap_scan_bus_count) == 1) { 2177 - AP_DBF_DBG("%s init scan complete\n", __func__); 2177 + pr_debug("%s init scan complete\n", __func__); 2178 2178 ap_send_init_scan_done_uevent(); 2179 2179 ap_check_bindings_complete(); 2180 2180 } 2181 2181 2182 2182 mod_timer(&ap_config_timer, jiffies + ap_config_time * HZ); 2183 + 2184 + pr_debug("<%s\n", __func__); 2183 2185 } 2184 2186 2185 2187 static void ap_config_timeout(struct timer_list *unused)
-2
drivers/s390/crypto/ap_debug.h
··· 26 26 debug_sprintf_event(ap_dbf_info, DBF_WARN, ##__VA_ARGS__) 27 27 #define AP_DBF_INFO(...) \ 28 28 debug_sprintf_event(ap_dbf_info, DBF_INFO, ##__VA_ARGS__) 29 - #define AP_DBF_DBG(...) \ 30 - debug_sprintf_event(ap_dbf_info, DBF_DEBUG, ##__VA_ARGS__) 31 29 32 30 extern debug_info_t *ap_dbf_info; 33 31
+15 -12
drivers/s390/crypto/ap_queue.c
··· 169 169 aq->queue_count = 0; 170 170 list_splice_init(&aq->pendingq, &aq->requestq); 171 171 aq->requestq_count += aq->pendingq_count; 172 + pr_debug("%s queue 0x%02x.%04x rescheduled %d reqs (new req %d)\n", 173 + __func__, AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid), 174 + aq->pendingq_count, aq->requestq_count); 172 175 aq->pendingq_count = 0; 173 176 break; 174 177 default: ··· 449 446 case AP_BS_Q_USABLE: 450 447 /* association is through */ 451 448 aq->sm_state = AP_SM_STATE_IDLE; 452 - AP_DBF_DBG("%s queue 0x%02x.%04x associated with %u\n", 453 - __func__, AP_QID_CARD(aq->qid), 454 - AP_QID_QUEUE(aq->qid), aq->assoc_idx); 449 + pr_debug("%s queue 0x%02x.%04x associated with %u\n", 450 + __func__, AP_QID_CARD(aq->qid), 451 + AP_QID_QUEUE(aq->qid), aq->assoc_idx); 455 452 return AP_SM_WAIT_NONE; 456 453 case AP_BS_Q_USABLE_NO_SECURE_KEY: 457 454 /* association still pending */ ··· 693 690 694 691 status = ap_test_queue(aq->qid, 1, &hwinfo); 695 692 if (status.response_code > AP_RESPONSE_BUSY) { 696 - AP_DBF_DBG("%s RC 0x%02x on tapq(0x%02x.%04x)\n", 697 - __func__, status.response_code, 698 - AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); 693 + pr_debug("%s RC 0x%02x on tapq(0x%02x.%04x)\n", 694 + __func__, status.response_code, 695 + AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); 699 696 return -EIO; 700 697 } 701 698 ··· 849 846 850 847 status = ap_test_queue(aq->qid, 1, &hwinfo); 851 848 if (status.response_code > AP_RESPONSE_BUSY) { 852 - AP_DBF_DBG("%s RC 0x%02x on tapq(0x%02x.%04x)\n", 853 - __func__, status.response_code, 854 - AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); 849 + pr_debug("%s RC 0x%02x on tapq(0x%02x.%04x)\n", 850 + __func__, status.response_code, 851 + AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); 855 852 return -EIO; 856 853 } 857 854 ··· 977 974 978 975 status = ap_test_queue(aq->qid, 1, &hwinfo); 979 976 if (status.response_code > AP_RESPONSE_BUSY) { 980 - AP_DBF_DBG("%s RC 0x%02x on tapq(0x%02x.%04x)\n", 981 - __func__, status.response_code, 982 - AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); 977 + pr_debug("%s RC 0x%02x on tapq(0x%02x.%04x)\n", 978 + __func__, status.response_code, 979 + AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid)); 983 980 return -EIO; 984 981 } 985 982
+23 -23
drivers/s390/crypto/zcrypt_api.c
··· 12 12 * Multiple device nodes: Harald Freudenberger <freude@linux.ibm.com> 13 13 */ 14 14 15 + #define KMSG_COMPONENT "zcrypt" 16 + #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt 17 + 15 18 #include <linux/module.h> 16 19 #include <linux/init.h> 17 20 #include <linux/interrupt.h> ··· 718 715 spin_unlock(&zcrypt_list_lock); 719 716 720 717 if (!pref_zq) { 721 - ZCRYPT_DBF_DBG("%s no matching queue found => ENODEV\n", 722 - __func__); 718 + pr_debug("%s no matching queue found => ENODEV\n", __func__); 723 719 rc = -ENODEV; 724 720 goto out; 725 721 } ··· 822 820 spin_unlock(&zcrypt_list_lock); 823 821 824 822 if (!pref_zq) { 825 - ZCRYPT_DBF_DBG("%s no matching queue found => ENODEV\n", 826 - __func__); 823 + pr_debug("%s no matching queue found => ENODEV\n", __func__); 827 824 rc = -ENODEV; 828 825 goto out; 829 826 } ··· 941 940 spin_unlock(&zcrypt_list_lock); 942 941 943 942 if (!pref_zq) { 944 - ZCRYPT_DBF_DBG("%s no match for address %02x.%04x => ENODEV\n", 945 - __func__, xcrb->user_defined, *domain); 943 + pr_debug("%s no match for address %02x.%04x => ENODEV\n", 944 + __func__, xcrb->user_defined, *domain); 946 945 rc = -ENODEV; 947 946 goto out; 948 947 } ··· 1114 1113 1115 1114 if (!pref_zq) { 1116 1115 if (targets && target_num == 1) { 1117 - ZCRYPT_DBF_DBG("%s no match for address %02x.%04x => ENODEV\n", 1118 - __func__, (int)targets->ap_id, 1119 - (int)targets->dom_id); 1116 + pr_debug("%s no match for address %02x.%04x => ENODEV\n", 1117 + __func__, (int)targets->ap_id, 1118 + (int)targets->dom_id); 1120 1119 } else if (targets) { 1121 - ZCRYPT_DBF_DBG("%s no match for %d target addrs => ENODEV\n", 1122 - __func__, (int)target_num); 1120 + pr_debug("%s no match for %d target addrs => ENODEV\n", 1121 + __func__, (int)target_num); 1123 1122 } else { 1124 - ZCRYPT_DBF_DBG("%s no match for address ff.ffff => ENODEV\n", 1125 - __func__); 1123 + pr_debug("%s no match for address ff.ffff => ENODEV\n", 1124 + __func__); 1126 1125 } 1127 1126 rc = -ENODEV; 1128 1127 goto out_free; ··· 1200 1199 spin_unlock(&zcrypt_list_lock); 1201 1200 1202 1201 if (!pref_zq) { 1203 - ZCRYPT_DBF_DBG("%s no matching queue found => ENODEV\n", 1204 - __func__); 1202 + pr_debug("%s no matching queue found => ENODEV\n", __func__); 1205 1203 rc = -ENODEV; 1206 1204 goto out; 1207 1205 } ··· 1444 1444 if (rc == -EAGAIN && tr.again_counter >= TRACK_AGAIN_MAX) 1445 1445 rc = -EIO; 1446 1446 if (rc) { 1447 - ZCRYPT_DBF_DBG("ioctl ICARSAMODEXPO rc=%d\n", rc); 1447 + pr_debug("ioctl ICARSAMODEXPO rc=%d\n", rc); 1448 1448 return rc; 1449 1449 } 1450 1450 return put_user(mex.outputdatalength, &umex->outputdatalength); ··· 1476 1476 if (rc == -EAGAIN && tr.again_counter >= TRACK_AGAIN_MAX) 1477 1477 rc = -EIO; 1478 1478 if (rc) { 1479 - ZCRYPT_DBF_DBG("ioctl ICARSACRT rc=%d\n", rc); 1479 + pr_debug("ioctl ICARSACRT rc=%d\n", rc); 1480 1480 return rc; 1481 1481 } 1482 1482 return put_user(crt.outputdatalength, &ucrt->outputdatalength); ··· 1508 1508 if (rc == -EAGAIN && tr.again_counter >= TRACK_AGAIN_MAX) 1509 1509 rc = -EIO; 1510 1510 if (rc) 1511 - ZCRYPT_DBF_DBG("ioctl ZSENDCPRB rc=%d status=0x%x\n", 1512 - rc, xcrb.status); 1511 + pr_debug("ioctl ZSENDCPRB rc=%d status=0x%x\n", 1512 + rc, xcrb.status); 1513 1513 if (copy_to_user(uxcrb, &xcrb, sizeof(xcrb))) 1514 1514 return -EFAULT; 1515 1515 return rc; ··· 1541 1541 if (rc == -EAGAIN && tr.again_counter >= TRACK_AGAIN_MAX) 1542 1542 rc = -EIO; 1543 1543 if (rc) 1544 - ZCRYPT_DBF_DBG("ioctl ZSENDEP11CPRB rc=%d\n", rc); 1544 + pr_debug("ioctl ZSENDEP11CPRB rc=%d\n", rc); 1545 1545 if (copy_to_user(uxcrb, &xcrb, sizeof(xcrb))) 1546 1546 return -EFAULT; 1547 1547 return rc; ··· 1670 1670 } 1671 1671 /* unknown ioctl number */ 1672 1672 default: 1673 - ZCRYPT_DBF_DBG("unknown ioctl 0x%08x\n", cmd); 1673 + pr_debug("unknown ioctl 0x%08x\n", cmd); 1674 1674 return -ENOIOCTLCMD; 1675 1675 } 1676 1676 } ··· 2014 2014 break; 2015 2015 default: 2016 2016 /* other failure */ 2017 - ZCRYPT_DBF_DBG("%s ap_wait_init_apqn_bindings_complete()=%d\n", 2018 - __func__, rc); 2017 + pr_debug("%s ap_wait_init_apqn_bindings_complete()=%d\n", 2018 + __func__, rc); 2019 2019 break; 2020 2020 } 2021 2021 break;
-2
drivers/s390/crypto/zcrypt_debug.h
··· 27 27 debug_sprintf_event(zcrypt_dbf_info, DBF_WARN, ##__VA_ARGS__) 28 28 #define ZCRYPT_DBF_INFO(...) \ 29 29 debug_sprintf_event(zcrypt_dbf_info, DBF_INFO, ##__VA_ARGS__) 30 - #define ZCRYPT_DBF_DBG(...) \ 31 - debug_sprintf_event(zcrypt_dbf_info, DBF_DEBUG, ##__VA_ARGS__) 32 30 33 31 extern debug_info_t *zcrypt_dbf_info; 34 32
+7 -7
drivers/s390/crypto/zcrypt_msgtype50.c
··· 427 427 len = t80h->len; 428 428 if (len > reply->bufsize || len > msg->bufsize || 429 429 len != reply->len) { 430 - ZCRYPT_DBF_DBG("%s len mismatch => EMSGSIZE\n", __func__); 430 + pr_debug("%s len mismatch => EMSGSIZE\n", __func__); 431 431 msg->rc = -EMSGSIZE; 432 432 goto out; 433 433 } ··· 487 487 out: 488 488 ap_msg->private = NULL; 489 489 if (rc) 490 - ZCRYPT_DBF_DBG("%s send me cprb at dev=%02x.%04x rc=%d\n", 491 - __func__, AP_QID_CARD(zq->queue->qid), 492 - AP_QID_QUEUE(zq->queue->qid), rc); 490 + pr_debug("%s send me cprb at dev=%02x.%04x rc=%d\n", 491 + __func__, AP_QID_CARD(zq->queue->qid), 492 + AP_QID_QUEUE(zq->queue->qid), rc); 493 493 return rc; 494 494 } 495 495 ··· 537 537 out: 538 538 ap_msg->private = NULL; 539 539 if (rc) 540 - ZCRYPT_DBF_DBG("%s send crt cprb at dev=%02x.%04x rc=%d\n", 541 - __func__, AP_QID_CARD(zq->queue->qid), 542 - AP_QID_QUEUE(zq->queue->qid), rc); 540 + pr_debug("%s send crt cprb at dev=%02x.%04x rc=%d\n", 541 + __func__, AP_QID_CARD(zq->queue->qid), 542 + AP_QID_QUEUE(zq->queue->qid), rc); 543 543 return rc; 544 544 } 545 545
+24 -21
drivers/s390/crypto/zcrypt_msgtype6.c
··· 437 437 ap_msg->flags |= AP_MSG_FLAG_ADMIN; 438 438 break; 439 439 default: 440 - ZCRYPT_DBF_DBG("%s unknown CPRB minor version '%c%c'\n", 441 - __func__, msg->cprbx.func_id[0], 442 - msg->cprbx.func_id[1]); 440 + pr_debug("%s unknown CPRB minor version '%c%c'\n", 441 + __func__, msg->cprbx.func_id[0], 442 + msg->cprbx.func_id[1]); 443 443 } 444 444 445 445 /* copy data block */ ··· 629 629 630 630 /* Copy CPRB to user */ 631 631 if (xcrb->reply_control_blk_length < msg->fmt2.count1) { 632 - ZCRYPT_DBF_DBG("%s reply_control_blk_length %u < required %u => EMSGSIZE\n", 633 - __func__, xcrb->reply_control_blk_length, 634 - msg->fmt2.count1); 632 + pr_debug("%s reply_control_blk_length %u < required %u => EMSGSIZE\n", 633 + __func__, xcrb->reply_control_blk_length, 634 + msg->fmt2.count1); 635 635 return -EMSGSIZE; 636 636 } 637 637 if (z_copy_to_user(userspace, xcrb->reply_control_blk_addr, ··· 642 642 /* Copy data buffer to user */ 643 643 if (msg->fmt2.count2) { 644 644 if (xcrb->reply_data_length < msg->fmt2.count2) { 645 - ZCRYPT_DBF_DBG("%s reply_data_length %u < required %u => EMSGSIZE\n", 646 - __func__, xcrb->reply_data_length, 647 - msg->fmt2.count2); 645 + pr_debug("%s reply_data_length %u < required %u => EMSGSIZE\n", 646 + __func__, xcrb->reply_data_length, 647 + msg->fmt2.count2); 648 648 return -EMSGSIZE; 649 649 } 650 650 if (z_copy_to_user(userspace, xcrb->reply_data_addr, ··· 673 673 char *data = reply->msg; 674 674 675 675 if (xcrb->resp_len < msg->fmt2.count1) { 676 - ZCRYPT_DBF_DBG("%s resp_len %u < required %u => EMSGSIZE\n", 677 - __func__, (unsigned int)xcrb->resp_len, 678 - msg->fmt2.count1); 676 + pr_debug("%s resp_len %u < required %u => EMSGSIZE\n", 677 + __func__, (unsigned int)xcrb->resp_len, 678 + msg->fmt2.count1); 679 679 return -EMSGSIZE; 680 680 } 681 681 ··· 875 875 len = sizeof(struct type86x_reply) + t86r->length; 876 876 if (len > reply->bufsize || len > msg->bufsize || 877 877 len != reply->len) { 878 - ZCRYPT_DBF_DBG("%s len mismatch => EMSGSIZE\n", __func__); 878 + pr_debug("%s len mismatch => EMSGSIZE\n", 879 + __func__); 879 880 msg->rc = -EMSGSIZE; 880 881 goto out; 881 882 } ··· 890 889 len = t86r->fmt2.offset1 + t86r->fmt2.count1; 891 890 if (len > reply->bufsize || len > msg->bufsize || 892 891 len != reply->len) { 893 - ZCRYPT_DBF_DBG("%s len mismatch => EMSGSIZE\n", __func__); 892 + pr_debug("%s len mismatch => EMSGSIZE\n", 893 + __func__); 894 894 msg->rc = -EMSGSIZE; 895 895 goto out; 896 896 } ··· 941 939 len = t86r->fmt2.offset1 + t86r->fmt2.count1; 942 940 if (len > reply->bufsize || len > msg->bufsize || 943 941 len != reply->len) { 944 - ZCRYPT_DBF_DBG("%s len mismatch => EMSGSIZE\n", __func__); 942 + pr_debug("%s len mismatch => EMSGSIZE\n", 943 + __func__); 945 944 msg->rc = -EMSGSIZE; 946 945 goto out; 947 946 } ··· 1154 1151 1155 1152 out: 1156 1153 if (rc) 1157 - ZCRYPT_DBF_DBG("%s send cprb at dev=%02x.%04x rc=%d\n", 1158 - __func__, AP_QID_CARD(zq->queue->qid), 1159 - AP_QID_QUEUE(zq->queue->qid), rc); 1154 + pr_debug("%s send cprb at dev=%02x.%04x rc=%d\n", 1155 + __func__, AP_QID_CARD(zq->queue->qid), 1156 + AP_QID_QUEUE(zq->queue->qid), rc); 1160 1157 return rc; 1161 1158 } 1162 1159 ··· 1277 1274 1278 1275 out: 1279 1276 if (rc) 1280 - ZCRYPT_DBF_DBG("%s send cprb at dev=%02x.%04x rc=%d\n", 1281 - __func__, AP_QID_CARD(zq->queue->qid), 1282 - AP_QID_QUEUE(zq->queue->qid), rc); 1277 + pr_debug("%s send cprb at dev=%02x.%04x rc=%d\n", 1278 + __func__, AP_QID_CARD(zq->queue->qid), 1279 + AP_QID_QUEUE(zq->queue->qid), rc); 1283 1280 return rc; 1284 1281 } 1285 1282