From patchwork Mon Jul 18 19:28:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12921672 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 91F6DCCA479 for ; Mon, 18 Jul 2022 19:29:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B2B12940010; Mon, 18 Jul 2022 15:29:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A638F94000D; Mon, 18 Jul 2022 15:29:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 92C94940010; Mon, 18 Jul 2022 15:29:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 82C8194000D for ; Mon, 18 Jul 2022 15:29:03 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 57050345BA for ; Mon, 18 Jul 2022 19:29:03 +0000 (UTC) X-FDA: 79701208566.17.4AEC22A Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) by imf11.hostedemail.com (Postfix) with ESMTP id F17F74008D for ; Mon, 18 Jul 2022 19:29:02 +0000 (UTC) Received: by mail-qt1-f176.google.com with SMTP id c20so9503904qtw.8 for ; Mon, 18 Jul 2022 12:29:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=nMdR+AEtByh2Sj3uhRet9r/mYlLTue7hiNXqJ4zPF7A=; b=ThZjcWWpivQL4LIMCYMLUyqh5o5kXMqBz+8OT2okIYTlrj/edxwBb2dbQa9UPOmtF6 4kSD+ZK2zlONe0lcAJjESBk9Nh+IMF2AWtzKWASNF/7e6AOQFfgrht6kvwCXXaBw+ZJ/ TuekgFubFOIx/+8XhYbzZTP0R9y2FHpWi0c1TNSBFoZBSAURAUsk02B8TI4+roOQrfEb rqvV8Zlz0kLm2wnKF7Eb5xNF8jQ/LSP7mPfSKTCz8rO9Som4BkQVoJkslp7Xj+XOaxbI /IAz4pqpN4giyGSLVmRa+JZ33lWzIiVJrwXSuZTIP487wCG2DZbEQ+zSsLJzYmv+Cs+/ XhuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nMdR+AEtByh2Sj3uhRet9r/mYlLTue7hiNXqJ4zPF7A=; b=NjXr34DFNKAfxeYuK5iRmKKIuALDT4pAFy+iqC9KXrHf6yHDVAwdgIVWHS5CGwcr26 AptswGqvyT657ZLZIA0VsPW9qS5rx3WZuH3MRyV3Eo5kHbCV2c7QiQ1Wbv8mwZ8VDg8p wynAVdtWKBGmFoH6pCXSVDiAYUZfAwvobihRDKP4H2I+TokBeZkvDiN7T6QCpROyvkXY OtzQke1JAVe1oa7gMCcm4yRxK/pZbOHPyqv2RGg+TfGiOd4pi3hoqwObTXIn6frDBrqB fM3UI/jQ7qnAuem3YZwuFzAhDfbCbrRsFPAdpxazmCGCOYuIjZq4HmylsFajC1c3RM7k 5ydA== X-Gm-Message-State: AJIora+stj2Fl5pgJBjDjmLXX62PyVFZY5cucfckGZ2PrWqy5AVcUDh4 uDIbPcFe+07PHQ04C32cvGM= X-Google-Smtp-Source: AGRyM1vJb89RwvBBeMzFkakUtULOUGREDepYG3L9kNDYRN+9fj+cWruAf8vfYMA3CaqjYR907kc98w== X-Received: by 2002:a05:622a:213:b0:31e:c569:220e with SMTP id b19-20020a05622a021300b0031ec569220emr22576563qtx.436.1658172542486; Mon, 18 Jul 2022 12:29:02 -0700 (PDT) Received: from localhost ([2601:4c1:c100:1230:ab01:d009:465a:5ab1]) by smtp.gmail.com with ESMTPSA id n18-20020a05620a295200b006b5e45ff82csm5125690qkp.93.2022.07.18.12.29.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 12:29:02 -0700 (PDT) From: Yury Norov To: linux-kernel@vger.kernel.org, Alexander Lobakin , Alexei Starovoitov , Alexey Klimov , Andrew Morton , Andrii Nakryiko , Andy Shevchenko , Ben Segall , Christoph Lameter , Dan Williams , Daniel Borkmann , Daniel Bristot de Oliveira , Dennis Zhou , Dietmar Eggemann , Eric Dumazet , Frederic Weisbecker , Guenter Roeck , Ingo Molnar , Isabella Basso , John Fastabend , Josh Poimboeuf , Juergen Gross , Juri Lelli , KP Singh , Kees Cook , Martin KaFai Lau , Mel Gorman , Miroslav Benes , Nathan Chancellor , "Paul E . McKenney" , Peter Zijlstra , Randy Dunlap , Rasmus Villemoes , Sebastian Andrzej Siewior , Song Liu , Steven Rostedt , Tejun Heo , Thomas Gleixner , Valentin Schneider , Vincent Guittot , Vlastimil Babka , Yonghong Song , Yury Norov , linux-mm@kvack.org, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH 13/16] time: optimize tick_setup_device() Date: Mon, 18 Jul 2022 12:28:41 -0700 Message-Id: <20220718192844.1805158-14-yury.norov@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220718192844.1805158-1-yury.norov@gmail.com> References: <20220718192844.1805158-1-yury.norov@gmail.com> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658172543; a=rsa-sha256; cv=none; b=acZXecXph9qxAitEbDyGHfh/ZurUMybyChD4soyvSmOyFdDqgkxwP1y0OplRsWCFqFsKN+ v+ggrqLBP7V2u+01Y+q3Ixc+4QHG+cKo8XN0k6p1hU6sZAzoWSn/0bhITJjnvIDOS+xGiK Dk20yvqrJ1Xw32vF/+drPAhAb0c2sMA= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ThZjcWWp; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.160.176 as permitted sender) smtp.mailfrom=yury.norov@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658172543; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=nMdR+AEtByh2Sj3uhRet9r/mYlLTue7hiNXqJ4zPF7A=; b=vG4smF5pukacwmNeGUQLRAtv1YTJ8GCsN4/u3jbo3UKQFCe2yYeoE5BNprNwlJl4t8ln3C zYvaSsCqhOSJbgsBBPuU//rSb4VPD8Al3Dv4BGlY5fyt//17sEnLzWHtrjrb7FwS7vHeDP TXWL/u0xiXSuR21Ryn9WNno8Oi2UhkY= X-Rspam-User: Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ThZjcWWp; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.160.176 as permitted sender) smtp.mailfrom=yury.norov@gmail.com X-Rspamd-Queue-Id: F17F74008D X-Rspamd-Server: rspam12 X-Stat-Signature: ktpwcgp3qder3b86ajys3ng5iseqy5rr X-HE-Tag: 1658172542-526222 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: tick_setup_device() calls cpumask_equal(newdev->cpumask, cpumask) even if newdev->cpumask == cpumask. Fix it. Caught with CONFIG_DEBUG_BITMAP: [ 0.070960] Call trace: [ 0.070974] __bitmap_check_params+0x144/0x250 [ 0.071008] tick_setup_device+0x70/0x1a0 [ 0.071040] tick_check_new_device+0xc0/0x110 [ 0.071066] clockevents_register_device+0x74/0x1c0 [ 0.071090] clockevents_config_and_register+0x2c/0x3c [ 0.071114] arch_timer_starting_cpu+0x170/0x470 [ 0.071147] cpuhp_invoke_callback+0x104/0x20c [ 0.071180] cpuhp_invoke_callback_range+0x70/0xf0 [ 0.071205] notify_cpu_starting+0xac/0xcc [ 0.071229] secondary_start_kernel+0xe4/0x154 [ 0.071259] __secondary_switched+0xa0/0xa4 [ 0.071297] ---[ end trace 0000000000000000 ]--- [ 0.071328] b1: ffffa1f27323b890 [ 0.071339] b2: ffffa1f27323b890 [ 0.071348] b3: 0 [ 0.071356] nbits: 256 [ 0.071366] start: 0 [ 0.071374] off: 0 [ 0.071383] Bitmap: parameters check failed [ 0.071390] include/linux/bitmap.h [419]: bitmap_equal Signed-off-by: Yury Norov --- kernel/time/tick-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 7205f76f8d10..7b2da8ef09ef 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -255,7 +255,7 @@ static void tick_setup_device(struct tick_device *td, * When the device is not per cpu, pin the interrupt to the * current cpu: */ - if (!cpumask_equal(newdev->cpumask, cpumask)) + if (newdev->cpumask != cpumask && !cpumask_equal(newdev->cpumask, cpumask)) irq_set_affinity(newdev->irq, cpumask); /*