From patchwork Mon Jul 18 19:28:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12921667 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 67278C43334 for ; Mon, 18 Jul 2022 19:29:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7CDA694000B; Mon, 18 Jul 2022 15:28:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 77EAB940007; Mon, 18 Jul 2022 15:28:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5AAC594000B; Mon, 18 Jul 2022 15:28:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 4D456940007 for ; Mon, 18 Jul 2022 15:28:58 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 299E9343C3 for ; Mon, 18 Jul 2022 19:28:58 +0000 (UTC) X-FDA: 79701208356.17.DCC41F9 Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) by imf15.hostedemail.com (Postfix) with ESMTP id C450CA006E for ; Mon, 18 Jul 2022 19:28:57 +0000 (UTC) Received: by mail-qk1-f177.google.com with SMTP id g1so8763624qki.7 for ; Mon, 18 Jul 2022 12:28:57 -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=RIK4clDwX1oEMjN7pszaNKOSN2c//m8ehQ85KvlfQJc=; b=lNlO9SN3GGquIrZKMvt9zNOWmROiQ7UKGluxoJ/6490SfH4l3ZFvvrQ5XQ1qO64f2W p+I82uCQ8ZvuMZH+fAnQobCtCoq0Pxx28ZFgroRR13TygKFuozWxlJ/fBsXMsFi7JF8j LslOfWo/Dy/F6Ir4B6EskXMCoRMKBE9TwZvII3lNY3HkD0b5xpWqgQo6jfTqyMEE9GjF krBbndqao3O5qYyeZ+ps1kb1QUfD4EBcW10RtUjMZnVw3PPOlBGTUXkNXWRiSQp+594Y nQRk9aoZ3fTiFdlQFLY2WCbpyvmZnPd+Gmd7tWwjC5cucyR0Eq7BkmeA3NQwpHGdiKoM 400g== 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=RIK4clDwX1oEMjN7pszaNKOSN2c//m8ehQ85KvlfQJc=; b=X3/eUQ5+UIQ1yMTCyQUoLvoNEjOSokgpdaLz34EkpfXkh80Dg68aRbRF/0L/7MUxJn dWXwTpvqyuOTp+Dvl+8QkJECncd2Ubn/KDML8+JVH9v/VV/8zPenK1TzcyGrIQKeBHi/ X3U7YMh/z9uepL3pXpTx9VsJOuc7Wt2NRDGffMBcZBDZClCI+mhPoAEv/YkluLgv+wC/ pQMA4KkmVLj9LhbDEyLbDSxWavPicOlpQhj4Y8OTVvg6RO5AfCU6JlRz7ClSgv1j26/1 Cw9+A64k/BVaRuehKwjnH/yb17H0Vl8i4WM51346bkPEKKHk3tYeg9Ez2kC63RnfrBCY yPcw== X-Gm-Message-State: AJIora/5PiEz3Ft5251Dm3t9Cbhkj8tB7jKODZUhZTRZgxbTUltTa+42 HhpzJRnxWUgG/MDaFH3e0Tc= X-Google-Smtp-Source: AGRyM1tudjg+bwULkYNm5Rqfm5wd3D6Bva3YUzb4kaoYEWEhL+2Z1rueeD9ZkF0QCclQf/uBzBI+zw== X-Received: by 2002:a05:620a:4725:b0:6b5:f6a9:950e with SMTP id bs37-20020a05620a472500b006b5f6a9950emr2013188qkb.464.1658172536990; Mon, 18 Jul 2022 12:28:56 -0700 (PDT) Received: from localhost ([2601:4c1:c100:1230:ab01:d009:465a:5ab1]) by smtp.gmail.com with ESMTPSA id dm53-20020a05620a1d7500b006b4880b08a9sm12668183qkb.88.2022.07.18.12.28.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 12:28:56 -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 09/16] irq: don't copy cpu affinity mask if source is equal to destination Date: Mon, 18 Jul 2022 12:28:37 -0700 Message-Id: <20220718192844.1805158-10-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=1658172537; a=rsa-sha256; cv=none; b=lhoAp1YH11xgzTOMh+guDIzppqfqn5KJrCnW+AMzTt0ajMbeCCdhl26CvnJ0+KRYpBx142 Rm2k1Lo5HnBIqESLKsd/mtBg9R040nSlVTu05bLv1dweGOJPkPqlU4Wk401FkUs4RQotT8 P1B0Op9l2kMMgVqeOU1l3fuiqXRJ++8= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=lNlO9SN3; spf=pass (imf15.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.222.177 as permitted sender) smtp.mailfrom=yury.norov@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658172537; 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=RIK4clDwX1oEMjN7pszaNKOSN2c//m8ehQ85KvlfQJc=; b=5ttIPVmghdim8s81/IWP7+4YkiW8rrsGGf1k3KFaBNY/0C3dsQvuiyXAOWbYZYBUjSrHIh 8HzT1wS1gpOWJY1BXtEmAf9TQA2OXyKcdVhf2Ao/b3YlzOdxMBnTIcCqkPOUh+0OEB79kk dxx/zS3jX14DMarI4zL8E7YBFBFdETE= X-Rspamd-Queue-Id: C450CA006E Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=lNlO9SN3; spf=pass (imf15.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.222.177 as permitted sender) smtp.mailfrom=yury.norov@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam05 X-Rspam-User: X-Stat-Signature: poh4igixf8jnkmrhyydizsio5qmdg19u X-HE-Tag: 1658172537-650544 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: irq_do_set_affinity() may be called with mask == irq_data_to_desc()->irq_common_data.affinity Copying in that case is useless. Caught with CONFIG_DEBUG_BITMAP: [ 1.089177] __bitmap_check_params+0x144/0x250 [ 1.089238] irq_do_set_affinity+0x120/0x470 [ 1.089298] irq_startup+0x140/0x16c [ 1.089350] __setup_irq+0x668/0x760 [ 1.089402] request_threaded_irq+0xe8/0x1b0 [ 1.089474] vp_find_vqs_msix+0x270/0x410 [ 1.089532] vp_find_vqs+0x48/0x1b4 [ 1.089584] vp_modern_find_vqs+0x1c/0x70 [ 1.089641] init_vq+0x2dc/0x34c [ 1.089690] virtblk_probe+0xdc/0x710 [ 1.089745] virtio_dev_probe+0x19c/0x270 [ 1.089802] really_probe.part.0+0x9c/0x2ac [ 1.089863] __driver_probe_device+0x98/0x144 [ 1.089923] driver_probe_device+0xac/0x140 [ 1.089985] __driver_attach+0xf8/0x1a0 [ 1.090047] bus_for_each_dev+0x70/0xd0 [ 1.090101] driver_attach+0x24/0x30 [ 1.090153] bus_add_driver+0x150/0x200 [ 1.090208] driver_register+0x78/0x130 [ 1.090266] register_virtio_driver+0x28/0x40 [ 1.090329] virtio_blk_init+0x68/0xa4 [ 1.090400] do_one_initcall+0x50/0x1c0 [ 1.090471] kernel_init_freeable+0x208/0x28c [ 1.090538] kernel_init+0x28/0x13c [ 1.090590] ret_from_fork+0x10/0x20 [ 1.090642] ---[ end trace 0000000000000000 ]--- [ 1.090705] b1: ffff2ec742b85e18 [ 1.090710] b2: ffff2ec742b85e18 [ 1.090715] b3: 0 [ 1.090719] nbits: 256 [ 1.090723] start: 0 [ 1.090727] off: 0 Signed-off-by: Yury Norov --- kernel/irq/manage.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 8c396319d5ac..f9c1b21584ec 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -284,7 +284,8 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask, switch (ret) { case IRQ_SET_MASK_OK: case IRQ_SET_MASK_OK_DONE: - cpumask_copy(desc->irq_common_data.affinity, mask); + if (desc->irq_common_data.affinity != mask) + cpumask_copy(desc->irq_common_data.affinity, mask); fallthrough; case IRQ_SET_MASK_OK_NOCOPY: irq_validate_effective_affinity(data);