From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D096AC77B6C for ; Thu, 13 Apr 2023 10:09:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4FD6F6B0072; Thu, 13 Apr 2023 06:09:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4ADBD6B0074; Thu, 13 Apr 2023 06:09:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 37520900002; Thu, 13 Apr 2023 06:09:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 265666B0072 for ; Thu, 13 Apr 2023 06:09:28 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B2D3C160337 for ; Thu, 13 Apr 2023 10:09:27 +0000 (UTC) X-FDA: 80675945574.16.8E9B4F6 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by imf26.hostedemail.com (Postfix) with ESMTP id A3E04140003 for ; Thu, 13 Apr 2023 10:09:24 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=F0Ml3lRr; dmarc=pass (policy=none) header.from=quicinc.com; spf=pass (imf26.hostedemail.com: domain of quic_pkondeti@quicinc.com designates 205.220.180.131 as permitted sender) smtp.mailfrom=quic_pkondeti@quicinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681380564; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=VXmvsb+hnxaTo9wc9S7lxkclisncj9vjgTNoeT5eZbg=; b=VZgmsXACpz6bGDr+JNWXTRPW+JW+LxkUCYGt4x47mbrARn5o0linKUa5ROmRzj7rC33ygt zc5CK20C89/LRzR9w+NsJ+JLKqaJWQ1IzttfIOQvbqW4ccpEpfT3kmSL59OpX7ij1C7DOQ 0cj+xHuHF27vWYTppY4CBp3ApN019sg= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=F0Ml3lRr; dmarc=pass (policy=none) header.from=quicinc.com; spf=pass (imf26.hostedemail.com: domain of quic_pkondeti@quicinc.com designates 205.220.180.131 as permitted sender) smtp.mailfrom=quic_pkondeti@quicinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681380564; a=rsa-sha256; cv=none; b=TBAqN55iBSWnFQX0Vbt31THfvZaVO9VccSjys0yvj1XSgzLGvzo8YDpqb11SacjhpQq9by 36B7K8QJpBRhzv9qTOPcS05ZsWYjzszlN8akdh8Conmw0DqIDtLAXqWKUO6UBYweYT0FdS n9cxspmuv786ikxX/9yTGlXuFZiMSLU= Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33D8Q7BQ003975; Thu, 13 Apr 2023 10:09:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=VXmvsb+hnxaTo9wc9S7lxkclisncj9vjgTNoeT5eZbg=; b=F0Ml3lRrtwMbQBDbSUzIG6crD7h/pQZW5fLbb+omaOI+PMXSeszL8c6/eyG2ZCnKKJDx w8VDYMCmqL4UPH6LkAMnAMS6A1uL3Jnr2vD2skXZTfcIp23+cPqcqu6qKoBDDtfu19VW fXMvVqbpaHtUooD5Fo/x3KMA0OIexFuScyPzl2VqqV7iljdF9dtipNJvIBbY8uq/NlG0 sbac69U+A9xdUNhBOHJD5ATbwMOFX8ntji2kfnA7J2k4abG+EKXnyav53B5nouzyHEmw rZ6Gx3/wIzyJZHIY4mhulISdH8BTrGh8UQmHVhzHvA591/9oESZ54oPjkeWtGfhe2Q/D jg== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3px5pks4h5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Apr 2023 10:09:17 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 33DA9FrV020429 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Apr 2023 10:09:15 GMT Received: from quicinc.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Thu, 13 Apr 2023 03:09:10 -0700 From: Pavankumar Kondeti To: Marco Elver , Dmitry Vyukov , "Petr Mladek" , Sergey Senozhatsky , Steven Rostedt , John Ogness , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Vincenzo Frascino , "Andrew Morton" CC: , , , Pavankumar Kondeti Subject: [PATCH] printk: Export console trace point for kcsan/kasan/kfence/kmsan Date: Thu, 13 Apr 2023 15:38:59 +0530 Message-ID: <20230413100859.1492323-1-quic_pkondeti@quicinc.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: t97JO5bgO05dqWQcoE3wtonyMnjCzuS8 X-Proofpoint-GUID: t97JO5bgO05dqWQcoE3wtonyMnjCzuS8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-13_06,2023-04-12_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 malwarescore=0 impostorscore=0 mlxscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1011 mlxlogscore=944 bulkscore=0 priorityscore=1501 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304130091 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: A3E04140003 X-Stat-Signature: gisakhrduhknk36aafxxfm3ui899b44k X-HE-Tag: 1681380564-978319 X-HE-Meta: U2FsdGVkX18CTsO/ruamxh8miVksXyXy+EGJ36LnSEl5CsdQ4CGzup7+c11RScAoMVrTBC61ILU/7RwUCBBXNWfQEdgjwzY2ZhpKhs9p3GMBlybqbbDu6vNrsYfy5PsCbD+Rk930COB6wN0Xpij13BKeradU3QItZW/VDKCwYlRqHLrILpY6rPK2PadptFUZKe2KdbSTLhyhLpGJ4kcqdZ04hFG0BWpi12XlKiqcjGjXat1A+WlQdKIKjM7DOYQ09rPlF+QdcJWxS7j/hLHJv9tX8qNGh1pfzq5v7+u/C8Pyg5YchZ0FBZkWOJY68cUkRROCeGK/CzAWthKICuPGXz7F/oJl5hgwaBgGet/kp2jsVPCzJWrFiO6Zoh16yjo81lJ5Vl5Ni18Y1Oz/zhdlmXIGUnu2iz69zNNYNyx20YILEyjknJK7goKUoGd5ZCq1rCadfzu3/X7/kqL7Xz+4Jyv0vt0R+9jkURW7hEawWbVWz42eDb3K6/5MTqfXxzGdtK7Fqn2hP/BAlUY/Z+ju2mIggm7SByBDMrcmJ+DYuIgGe/+Y9iFvWCcNeSCNoiAr44YPsw3SKZ28q9x93aSH8ByT+hxBY8RgkLGAnKt758u31c7uuEx5m/PZANzWpwTADXuvKMWddgapL8HYhlwnIxW0Vdvp7QykY4qI1UW38ZlxCWqDYMyOvulaS8f+tzidSfD8O2rY+0qj1vtreHf0SKe1w+W35/d8vSvjbKbVXyWFvn2veBBnWexfTBSVN7Rb94C6EChD6KtO+HT1BvP9s+peIU2boGSxAM8lbB7Mda+VNuZ0uBjvqlgtJzqSiTldsTDtTCmsxZuMMJWuezu1qjJoIzfcuPw33hINgGmnRD8/d3GG4GQuqa9xMt6/EAveGPvgnZN/fZvBtOuL3R3b97eFfoL6yW5NyhO5xEUIpDGQcCoDIxQdoA4bzm/uctSgGR8DKyLoaifzLenwhkb 4Rj48flk 20da9glKGoxr684C2/bnvzY9XceyIlKfRrdVfpo3GK8YvxCdV4B3OWkNtnJaRkupNrvvavtcdmj94cDQl8jEldjHITmgvDF7ZO7/dUQ7ZZNvcWXLztjAt19JmQRH9DfHVNacUS9uNtAxiefMDogYZXh5P+Ga5Pi80BbMcpYwzfsJSjkyc3v8W+CegJc2hRpARfA2n5aesbIXpPz3ntBrN5M9C3IMe3M4tmysDWK/7hQn9OE4IWuANuontrIyQLvCp/A1ctUisKAuFUkxmmx0oNLfhUUu9StiNq1pDUkWqbl1k1eZawG1MM28b7j58OAz1uYRTispBb27VBcU4ZIBUqEFobQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The console tracepoint is used by kcsan/kasan/kfence/kmsan test modules. Since this tracepoint is not exported, these modules iterate over all available tracepoints to find the console trace point. Export the trace point so that it can be directly used. Signed-off-by: Pavankumar Kondeti --- kernel/kcsan/kcsan_test.c | 20 ++++++-------------- kernel/printk/printk.c | 2 ++ mm/kasan/kasan_test.c | 22 ++-------------------- mm/kfence/kfence_test.c | 22 ++-------------------- mm/kmsan/kmsan_test.c | 22 ++-------------------- 5 files changed, 14 insertions(+), 74 deletions(-) diff --git a/kernel/kcsan/kcsan_test.c b/kernel/kcsan/kcsan_test.c index a60c561724be..0ddbdab5903d 100644 --- a/kernel/kcsan/kcsan_test.c +++ b/kernel/kcsan/kcsan_test.c @@ -1572,34 +1572,26 @@ static void test_exit(struct kunit *test) } __no_kcsan -static void register_tracepoints(struct tracepoint *tp, void *ignore) +static void register_tracepoints(void) { - check_trace_callback_type_console(probe_console); - if (!strcmp(tp->name, "console")) - WARN_ON(tracepoint_probe_register(tp, probe_console, NULL)); + register_trace_console(probe_console, NULL); } __no_kcsan -static void unregister_tracepoints(struct tracepoint *tp, void *ignore) +static void unregister_tracepoints(void) { - if (!strcmp(tp->name, "console")) - tracepoint_probe_unregister(tp, probe_console, NULL); + unregister_trace_console(probe_console, NULL); } static int kcsan_suite_init(struct kunit_suite *suite) { - /* - * Because we want to be able to build the test as a module, we need to - * iterate through all known tracepoints, since the static registration - * won't work here. - */ - for_each_kernel_tracepoint(register_tracepoints, NULL); + register_tracepoints(); return 0; } static void kcsan_suite_exit(struct kunit_suite *suite) { - for_each_kernel_tracepoint(unregister_tracepoints, NULL); + unregister_tracepoints(); tracepoint_synchronize_unregister(); } diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index a5ed2e53547c..8bb9e8752d65 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -71,6 +71,8 @@ EXPORT_SYMBOL_GPL(console_printk); atomic_t ignore_console_lock_warning __read_mostly = ATOMIC_INIT(0); EXPORT_SYMBOL(ignore_console_lock_warning); +EXPORT_TRACEPOINT_SYMBOL_GPL(console); + /* * Low level drivers may need that to know if they can schedule in * their unblank() callback or not. So let's export it. diff --git a/mm/kasan/kasan_test.c b/mm/kasan/kasan_test.c index 74cd80c12b25..edf3158fc075 100644 --- a/mm/kasan/kasan_test.c +++ b/mm/kasan/kasan_test.c @@ -56,19 +56,6 @@ static void probe_console(void *ignore, const char *buf, size_t len) WRITE_ONCE(test_status.async_fault, true); } -static void register_tracepoints(struct tracepoint *tp, void *ignore) -{ - check_trace_callback_type_console(probe_console); - if (!strcmp(tp->name, "console")) - WARN_ON(tracepoint_probe_register(tp, probe_console, NULL)); -} - -static void unregister_tracepoints(struct tracepoint *tp, void *ignore) -{ - if (!strcmp(tp->name, "console")) - tracepoint_probe_unregister(tp, probe_console, NULL); -} - static int kasan_suite_init(struct kunit_suite *suite) { if (!kasan_enabled()) { @@ -86,12 +73,7 @@ static int kasan_suite_init(struct kunit_suite *suite) */ multishot = kasan_save_enable_multi_shot(); - /* - * Because we want to be able to build the test as a module, we need to - * iterate through all known tracepoints, since the static registration - * won't work here. - */ - for_each_kernel_tracepoint(register_tracepoints, NULL); + register_trace_console(probe_console, NULL); return 0; } @@ -99,7 +81,7 @@ static void kasan_suite_exit(struct kunit_suite *suite) { kasan_kunit_test_suite_end(); kasan_restore_multi_shot(multishot); - for_each_kernel_tracepoint(unregister_tracepoints, NULL); + unregister_trace_console(probe_console, NULL); tracepoint_synchronize_unregister(); } diff --git a/mm/kfence/kfence_test.c b/mm/kfence/kfence_test.c index b5d66a69200d..6aee19a79236 100644 --- a/mm/kfence/kfence_test.c +++ b/mm/kfence/kfence_test.c @@ -825,33 +825,15 @@ static void test_exit(struct kunit *test) test_cache_destroy(); } -static void register_tracepoints(struct tracepoint *tp, void *ignore) -{ - check_trace_callback_type_console(probe_console); - if (!strcmp(tp->name, "console")) - WARN_ON(tracepoint_probe_register(tp, probe_console, NULL)); -} - -static void unregister_tracepoints(struct tracepoint *tp, void *ignore) -{ - if (!strcmp(tp->name, "console")) - tracepoint_probe_unregister(tp, probe_console, NULL); -} - static int kfence_suite_init(struct kunit_suite *suite) { - /* - * Because we want to be able to build the test as a module, we need to - * iterate through all known tracepoints, since the static registration - * won't work here. - */ - for_each_kernel_tracepoint(register_tracepoints, NULL); + register_trace_console(probe_console, NULL); return 0; } static void kfence_suite_exit(struct kunit_suite *suite) { - for_each_kernel_tracepoint(unregister_tracepoints, NULL); + unregister_trace_console(probe_console, NULL); tracepoint_synchronize_unregister(); } diff --git a/mm/kmsan/kmsan_test.c b/mm/kmsan/kmsan_test.c index 088e21a48dc4..06e18f76c641 100644 --- a/mm/kmsan/kmsan_test.c +++ b/mm/kmsan/kmsan_test.c @@ -541,33 +541,15 @@ static void test_exit(struct kunit *test) { } -static void register_tracepoints(struct tracepoint *tp, void *ignore) -{ - check_trace_callback_type_console(probe_console); - if (!strcmp(tp->name, "console")) - WARN_ON(tracepoint_probe_register(tp, probe_console, NULL)); -} - -static void unregister_tracepoints(struct tracepoint *tp, void *ignore) -{ - if (!strcmp(tp->name, "console")) - tracepoint_probe_unregister(tp, probe_console, NULL); -} - static int kmsan_suite_init(struct kunit_suite *suite) { - /* - * Because we want to be able to build the test as a module, we need to - * iterate through all known tracepoints, since the static registration - * won't work here. - */ - for_each_kernel_tracepoint(register_tracepoints, NULL); + register_trace_console(probe_console, NULL); return 0; } static void kmsan_suite_exit(struct kunit_suite *suite) { - for_each_kernel_tracepoint(unregister_tracepoints, NULL); + unregister_trace_console(probe_console, NULL); tracepoint_synchronize_unregister(); } -- 2.25.1