From patchwork Tue May 7 02:29:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13656169 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 44033C25B5F for ; Tue, 7 May 2024 02:29:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 76DD76B007B; Mon, 6 May 2024 22:29:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 71D896B0082; Mon, 6 May 2024 22:29:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 596B86B0083; Mon, 6 May 2024 22:29:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 3C8016B007B for ; Mon, 6 May 2024 22:29:52 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id BEF15C055C for ; Tue, 7 May 2024 02:29:51 +0000 (UTC) X-FDA: 82090019382.17.DDEA4D1 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2078.outbound.protection.outlook.com [40.107.220.78]) by imf13.hostedemail.com (Postfix) with ESMTP id C8F9420002 for ; Tue, 7 May 2024 02:29:48 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=E6N2iGA3; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf13.hostedemail.com: domain of jhubbard@nvidia.com designates 40.107.220.78 as permitted sender) smtp.mailfrom=jhubbard@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715048989; 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=qGGj2aazpVHVj2n5fnqoj1QVO9AwzTD7xPqUsAEEeQU=; b=YmnzF1PX5Gj3ZC6MeFpfhr1v0omteBIyh2f4k759gaietxrn+XqyzQDZZBKLi2nCJvzp0F JstYirU1gXQwIJ6jYh8OSgAsE+wR2A39ux519vLuzX+IgaPWAAGJ/MGokRo7TgJ1YcZRzN fXd0qgzH07ZHT/DVe8DtnzDJylgfgxA= ARC-Authentication-Results: i=2; imf13.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=E6N2iGA3; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf13.hostedemail.com: domain of jhubbard@nvidia.com designates 40.107.220.78 as permitted sender) smtp.mailfrom=jhubbard@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1715048989; a=rsa-sha256; cv=pass; b=CKUwUeW+mHhVlCPwk3nPnE704nNs8PtWvw2Mp5opfqNDqiK8EXzjeZQjfAKXuoafaOpCbT 2aZbrTJUr98n6uK20BkVuVXkRYnZ9jOwxUDPKcs7hiSm51RnhNz8l50rSaHaAYpmdZiQ6k rJCt4nf59GD7z1O6wxQFk7uCWC7aFXU= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rlom7QOVfNNOKHiLbweKNVttKlpYgdyfAl/eSG7cSh33nqa3wSF23CvEsO3HxihHYv4kVZ6CpXLcjQKQgbOTeDKw0lJyhTuD9ohEV5GtRGODOmhQ70mioOym6YK1FJtbINlRCk1IcjS9/EKlsnJptI2AzqDL/DKTDf0GlUaUaIA+eHzo4cmHHOWglrLvNhu0TKuZOiyGce1/0e+gzOj82t9g9VDT8LLY1nV3r4s8SznewkFTmJ4tvN4yv4VtN7LCzu4of67YB/7r3MPupNNM9OTzPtzyjrDwnGGfC3xLCQtBm8WHG9SptI6F1qUS5zMmPjGABduWUCb/X6yBTs6d5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qGGj2aazpVHVj2n5fnqoj1QVO9AwzTD7xPqUsAEEeQU=; b=ksaozMKwNagjMwG/tdhLBcgjryPZ15I6ozGaV9Cq6qn8ZesOJss1ve+tRt/E4DO43CJDXM3j0736w6dl6Bvkti5DzgA3h6j4NmfkQ59qJSijMmMmGYGh6o1Nqhhh8sENyplDN38oxvOLzLxQW4Gfb6i8s8Nyb1oVfUN1/S1lbR+vw70/Bw6S9vjrA1fKO8gjVITreQOWSV8F9tBN7sthcRPWRV0dENgkANlLkCND9YDs++y9CRhKZ4HoY0rDHfTjo5MlnuQd7JqA1lqFfhXulgbT8xanWiNy6g35futn68VhEbmEA/S0nrtAz5HNgfG/KWYbBbowv1uEGW/cr4WpPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qGGj2aazpVHVj2n5fnqoj1QVO9AwzTD7xPqUsAEEeQU=; b=E6N2iGA3WjAgHwj4fHaMHDIbehP7oMFuJxdYs1Jj+qF7laofw2tyw8l/ockQ+m06Rkpo5zi8X6xL4w6BbIdti8J7LJeOQZdlQcDlbWCStKmFf/dwOGZ6AkcqOa78EzAmFyPI1WAYxt4R+fA9lwENxKM5QkkpX7qCKD8A9gaXa/qpK6Ox4gh2rSo/hSegmAeM+sWFxcKria7o15ulN984fxbQckeYDaUJN9m8h9OxbK6YdZRjb0ouHPNtGqcYjMSP/AGxbA/PFIPou8PaG/5Nuia9JLQEycWDz6zFXZ8xKeTOM6W5lsuf/O4ShCju7ysDTwDALifStXE8Geip3DTsYg== Received: from DM6PR12MB4140.namprd12.prod.outlook.com (2603:10b6:5:221::13) by SN7PR12MB7022.namprd12.prod.outlook.com (2603:10b6:806:261::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Tue, 7 May 2024 02:29:44 +0000 Received: from DM6PR12MB4140.namprd12.prod.outlook.com ([fe80::5b0:8154:dfef:2cac]) by DM6PR12MB4140.namprd12.prod.outlook.com ([fe80::5b0:8154:dfef:2cac%3]) with mapi id 15.20.7544.041; Tue, 7 May 2024 02:29:44 +0000 From: John Hubbard To: Andy Lutomirski Cc: Dave Hansen , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H . Peter Anvin" , LKML , linux-mm@kvack.org, John Hubbard Subject: [PATCH] x86/fault: speed up uffd-unit-test by 10x: rate-limit "MCE: Killing" logs Date: Mon, 6 May 2024 19:29:39 -0700 Message-ID: <20240507022939.236896-1-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.0 X-NVConfidentiality: public X-ClientProxiedBy: BYAPR03CA0024.namprd03.prod.outlook.com (2603:10b6:a02:a8::37) To DM6PR12MB4140.namprd12.prod.outlook.com (2603:10b6:5:221::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR12MB4140:EE_|SN7PR12MB7022:EE_ X-MS-Office365-Filtering-Correlation-Id: 61b320d6-d61b-4a41-12a0-08dc6e3d8e82 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|376005|7416005|1800799015; X-Microsoft-Antispam-Message-Info: JPn2N5eYHKioKaCOlWQPjZ5PrlN4W96RdUbs2piHBVpl6k1yFjAyX0jqAEMQYsJPADMWKdMJ2zZo58xGUtqC/JxvMBRecxNbuBabpaFTGY0+f3My1Lix4cIFu/SIHxmnxGwM+kV5mLHKZ88m3sDRoVq2lwNu5+5XhMHmIIwglWBNY2de1dD/Bf3eFT8yAjZgMBeqJ0duYkGrGrp5HTGoN7sdoQ54VgVEfMC/JYcI7afCkArGNQDFSa3B6eoDY42SLWfa/ZraPPzjUj6byc/lShtA1TCEBdt+w60jZudAxLukerjWt2sY8JrdLqeGye8d6UkrntsBzut1yKU39a4Eqmhl1IyRrwsCOVP5P0gMgRYK1bfwoVSyzLq2jf18j3G80DYqe0y9sa/Q0wRbkPIoGVe4dGqSwzGcqVANb0beeY/uI8biNfBgIKn07nM1JTfgiC+Ork3nOwIRRZLD/WZvpDbMT2Fp5UM1w/w80QEN5aJSrvz/CNpdGBkAddw5//RtGWS894T1+6KIRqIg/wI8w5tU36IkIv5NEgartP54Gb+kRcxVovzF4dVXQyg9KkStSIeUkTGKMOcKvEXxOmpAx95tl95vaauwe4VOl27s/EgNoYw0ZxeBGKUyOkfMQ+GiUeZtrw5BD7egBX1BveAX4z/Gzbu4mq2BqWtLpRTrGzf2FTb0Wp5dFihMGQJ7LOPTWUnCBZg9upU7uT89qYYFmRc9Gkw5Be+J9xAoTWla8HgX8AO86ZG+GXn4lVesb831hbEwhd5n1m7xDz9giIj8Pi1lurDzvPt6/f/rPyLsULxbzY9VMQOkrWInieJ6KF1/jsJ75gALM0LIKf7o9M9ebQO/5e8z8hyokSABbMYFuBB8zintK8VidGpM/oHR7w5qkk+5vy4LNNBSgyu4iZMfrp/sgxZImfIbUiH221lBAUFwRnv/h27beGxbGFQgEt3zQLt7Uci7D7vMnUalmJzgqWMjSiYDi9FbJOt20QzshRPfq9hkCjVZwVS8+JV2ZmQDyntjwAryFrCT66OU28IEtHQsHXUyTbKHTB/8VHbgt6m/+EPlQ67hLVAte/IlpUZWSmjxCBcjqjNjSylqJ1AYPbfm2RmuovyioCxSV55iyrmaOhZrERyI1clbKoOIEG8ImSAWp9O3NrRpGABrd15aVz1plFvVgO3hG/2r/58eXix2MdgqZLJbm9WjbPhUi3lE8GLfuDPFar0DSCsKAvkZDTSicQWRbmNNZYkBOJ/PkVbWyl9wS5vvKp9japs5wOw+tVQq5CvCibMPCNhU9F2kTg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB4140.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(376005)(7416005)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: o9ezY0XY/DIKEVAhBcNeVkVM27juuJAz3OnvziRLAnyC4w6BCcS7+Uwgx9pmgE8Ix0Y5INzBtY3JRnrKrAdteKZbtS9qehIZ2mlj2Wi8ZY28Wtv6eTpl6jCOfmnWqRb0gkXCQma3wqu961Aync+NX1chXjpKk0uYdi7z9Be6D8fBL8cXIgbQmaTpphhx0VPe/4GggLnrVJ39uoWWm+y7dIywTeaPnAtT6mmBFi3RBNu1g9xUvxHhIo1/hubxsuUQdQ5NbOt5jeH/NKByA+pg7TOV/Bqz5MyVUdey1VnRwZw49CAaCjRBMK0YGV9tJQCdHfwO4MY8N0ldl2E56oKniZNA4oh/DbdfWfV9UT++HsNlRPmzwQ8v8dA3WXQ4zGFwNalrjcJTKC5uJnVbaG9TUTJWne5yK3Cc/RaWI0UcSxcrCYu7J+p4mzXPwx47OUcVdROyEPmBzIYzpXBkSEWoSh72D6GSqt2CRQg9HHwH1CVerFMcGaBOuc2823cbm7Xkb7B3JH/+M5vwCu1mRkGe8N8Lrrd91b4diYiQhI2270ESjC0rvGyW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network-Message-Id: 61b320d6-d61b-4a41-12a0-08dc6e3d8e82 X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB4140.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2024 02:29:44.3862 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oTtwXzF8bFHelC7iE+CYM243Kw7JRNkl6SV4OPpaJ+Mwz3zrXw59u/zbqxyCMXcTMSn9sNb5rua8/bUuJ/Naxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7022 X-Stat-Signature: d8zkqpsuxbhuyn3hkcwxh8p58e31rjow X-Rspamd-Queue-Id: C8F9420002 X-Rspamd-Server: rspam10 X-Rspam-User: X-HE-Tag: 1715048988-427470 X-HE-Meta: U2FsdGVkX1+mN/+kjNkDPXvvTMu7VJuOmu8Yw7NGK/xgWCQmtojZWnOeWcq2FnxWC5UQgMis8S+mS2TclZmQ+kC8RD4MTiGkHU28+zS2sDnFyhb8q146DZYaVEwlCyQIxa3/Pkf7iJHgYuSzc2sZUkRzo2Z9EildiXwmlqfWrynR9Nt22qUB4FSuoS5n0HHBUPiUJa04kV4qNIhIWbR6i7QwQjeyAs1kNUAV7S0uoDbDbHLdkLZ64tnesXbTfxUubM5EP8Cy0UQDVcnvz+Bh1xYI5wVaQIz1mXt9meVcLMcgBIKtoaiWFyxpHPF5H6QQ2zdcmJqsu6E96HURZTrasWsECwoNaf0YUDUcj8JqUiv0T0u/g7Ae1H6IWKPmpT8i/j+WBp4IfW670yftXaoevrKCd8E0qbIx18XsbVZfIml2dIETxcEMRjQ+BSstajYnuvLuBcanBHrpYAERk9gVsY/0q+IMv9q1rQuG5gu8wye7vAEOWQmJvtQQpriz5JO5i85vHOpXUs1YhONd5cL/5htcXOtQhRUP5WizG2GMaqk23H1QhDCZRwfDVcYd5cHAA5luoU3IWgsAzO9vg1Ib5a+1fnLBx2ISFNZVejO24a7h/2ycQ49BzYzvpcVinpcVOiZISrMFDGFo6QrZP7vePDSebjYwhHzJegGWcvnYL6NQox5AsbWXYCDDvh4smUTEZlyeh1t8Z29nPNsugXu5BgWXZCXOCR0lXMQgibu7x6LGHRQH+rn3Z06GubnNM/upqkAu7/Zl2KD2EWONQFoIZJeEwASjQ75mY8v6WY7IpndWQninokZMzdVPEEKkIbAUIaiBWmws5Q24WJVRoXnjzmpiP3OqDm4Xh223qv0amee7ag2il7SkiaWPIqn9AUtnhv9nbw+Fe+Bwu2540pN9mt49WP8X3qA+CiZE4dJ9+ILRnFGK0UXLED/kxU4UxA+gqfMLPV34Sev/XdfRT0E 6eZIyGD5 Tl2Jy5ETC9V0ZfKru2uYSA9NWEOwDT/Lpu/IH1G27FZC/PpjDoHykdt3g8mXIWsL4Aj7ndIFJBpk/QHRd8WSd6yWWwDLsdHTkhnD0mcljn18+/1zVcBkpfmIJMn+T5/a3Rlu9QmolT19r8+XIQL9DggzFiSoS4w5apNwQLpCG+I2NlzwG84aI9zcKDbVR0W7NuRdUIfPDyQiw5fJ4af3hNDCRTJMoZLsxo6Wc 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: List-Subscribe: List-Unsubscribe: If a system experiences a lot of memory failures, then any associated printk() output really needs to be rate-limited. I noticed this while running selftests/mm/uffd-unit-tests, which logs 12,305 lines of output, adding (on my system) an extra 97 seconds of runtime due to printk time. The test normally only takes about 10 seconds, and the enclosing set of mm selftests normally takes 305 seconds, so the additional 97 seconds really hurts. Generating lots of memory poisoning events seems like a valid use case, by which I mean that this is not just a testing artifact. And that's why the fix applies to the code that directly generates the output, rather than the selftest that triggers it. With this patch, all but 10 lines are suppressed, thus speeding up that particular selftest by 90% (runtime drops from 107 seconds, to 10.6 seconds). Signed-off-by: John Hubbard Acked-by: David Hildenbrand Acked-by: Axel Rasmussen --- arch/x86/mm/fault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: dccb07f2914cdab2ac3a5b6c98406f765acab803 prerequisite-patch-id: b901ece2a5b78503e2fb5480f20e304d36a0ea27 diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index bba4e020dd64..e4f3c7721f45 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -928,7 +928,7 @@ do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address, struct task_struct *tsk = current; unsigned lsb = 0; - pr_err( + pr_err_ratelimited( "MCE: Killing %s:%d due to hardware memory corruption fault at %lx\n", tsk->comm, tsk->pid, address); if (fault & VM_FAULT_HWPOISON_LARGE)