Received: by 10.223.185.116 with SMTP id b49csp1067746wrg; Sat, 3 Mar 2018 14:38:01 -0800 (PST) X-Google-Smtp-Source: AG47ELughiYh08vrBTZ0eUZr3L+vfu1UcqS1pkjkC6CTggPeT7TMNte+gfUOYN6lb2mFxSr8mzB9 X-Received: by 2002:a17:902:b690:: with SMTP id c16-v6mr9019136pls.264.1520116680958; Sat, 03 Mar 2018 14:38:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520116680; cv=none; d=google.com; s=arc-20160816; b=gnULC4IdDSKaGIbIjCzBvpMC73guPZdTIcgT5LlRQREpVeZPlGhoXA7wUqGkKiRJ7p gn2saFjmp7fB8aU0BfonPLb0pjQEYulSa9ytjtyyG8MIX169Z8RYmHcB41F1hnKedQoa FnqWcxxPY/g1pRhf8sPO5cqQYb+lMh/6TBs4mkZibRcSlj/p3DN6Hk0U3zopEHSCuhtk Z/y/EonejqVIlSIsujIcrTctllx/WCl/mzvyi5xADaQJm172Jkd1EEbHY8MmuYBrXC4Z TTACCG2K87JV3Vo1lSiGnwz/RptB0zej/5R5Omkfm98C15+KLWVd0svjXXvZAIqNfIG7 lpkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=muPHumTOnFbupVcVZV76XwGFBXlHnzx9PMV7QC9TZXE=; b=FxMWFEMNjuf789PsRHa+jXK2SL897CQxrvi2eHIdOOsI8YQzzBfbBSrRoCZRzEDp1M 9lMyMc9Yt9MjTXy3U+gO21YHqM34bE14jfPZIHxHcZvABjjxE8JI6sLkNGkMfFx60z8M idH4m6tOpaWctRUSiY8Knh/Kmyn4/5BocARbVcps5UQwt3eRqtpSornk+hoemkWMiCNH HWpoJcICstKxRSyDzaVqClMvut6SMU3Ye4UuvhC0rLqz5SEaS/mLl1NKW/44ySM2suQ/ 9I7iGkoL1gMld2uMOXqAV0iyk1CAi9XsaqW/VHK8vJQA+BYaG31txw/LcGVjql42zmuI cOSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Pc0BZW6y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q16si6126693pgc.610.2018.03.03.14.37.47; Sat, 03 Mar 2018 14:38:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Pc0BZW6y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934566AbeCCWgU (ORCPT + 99 others); Sat, 3 Mar 2018 17:36:20 -0500 Received: from mail-by2nam03on0118.outbound.protection.outlook.com ([104.47.42.118]:7707 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934536AbeCCWgN (ORCPT ); Sat, 3 Mar 2018 17:36:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=muPHumTOnFbupVcVZV76XwGFBXlHnzx9PMV7QC9TZXE=; b=Pc0BZW6y3QQDu2LnV2/eCcd1hx9NWhX2Ol+oXL4p5iiKL/AFdjZzPQo44FUUOZsm85crm8xp2DMQ3S8/wdF7474ZmOtOYYS9jhvP2u/AlaCLPQbfAazOEacK3cWFGz6jQalhKQZXPTyy2alWSBMP9LpflY4GlWM5xZlJDf60oh4= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2PR2101MB1020.namprd21.prod.outlook.com (52.132.148.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.1; Sat, 3 Mar 2018 22:36:08 +0000 Received: from MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0]) by MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0%3]) with mapi id 15.20.0567.006; Sat, 3 Mar 2018 22:36:08 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: "Paul E. McKenney" , Ingo Molnar , Peter Zijlstra , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 178/219] sched: Stop resched_cpu() from sending IPIs to offline CPUs Thread-Topic: [PATCH AUTOSEL for 4.9 178/219] sched: Stop resched_cpu() from sending IPIs to offline CPUs Thread-Index: AQHTsz8ffXy+ZLZuw0+nAEWVMNJBaA== Date: Sat, 3 Mar 2018 22:29:41 +0000 Message-ID: <20180303222716.26640-178-alexander.levin@microsoft.com> References: <20180303222716.26640-1-alexander.levin@microsoft.com> In-Reply-To: <20180303222716.26640-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MW2PR2101MB1020;7:0HXQI8pWwcrSKbTP/jdWXyPnJmrlqT4eyQ9Nd5xwZIqrw2wIquS8jHWWkLfH8V8fMRklSJjUq+too7t2PYSa8d+KuHoHUs+YXbwy+V6aBr37FuVezbyonT6mDklI5GWekGBEySNop+qnKK4OqdaU1RVsLftg4bYcP7SPMZtHHoKqf+K3QuStagg9xX4jIkD+HEZYvH06NcFQ4Eksq1kVpBe4uSivokjoYf7m+TpdlMVmteIapHyJ9sVEiox1LfVO x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 7f54bfe9-dace-4c3d-c637-08d58157287f x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603307)(7193020);SRVR:MW2PR2101MB1020; x-ms-traffictypediagnostic: MW2PR2101MB1020: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(209352067349851)(104084551191319); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231220)(944501244)(52105095)(3002001)(6055026)(61426038)(61427038)(6041288)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:MW2PR2101MB1020;BCL:0;PCL:0;RULEID:;SRVR:MW2PR2101MB1020; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(396003)(366004)(346002)(376002)(39860400002)(199004)(189003)(6436002)(5250100002)(99286004)(3846002)(6116002)(8936002)(22452003)(86612001)(86362001)(575784001)(4326008)(10090500001)(68736007)(6512007)(7736002)(97736004)(25786009)(76176011)(1076002)(6486002)(2501003)(66066001)(36756003)(107886003)(2950100002)(8676002)(305945005)(5660300001)(105586002)(53936002)(6666003)(3280700002)(81166006)(6506007)(106356001)(2906002)(81156014)(316002)(478600001)(72206003)(10290500003)(2900100001)(54906003)(110136005)(59450400001)(186003)(102836004)(26005)(14454004)(3660700001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MW2PR2101MB1020;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: TC2L3WEbozeZVCGmImssxwUgBnYayoonCts6gMnVCUlIpmD8KcKPpsohpAASeyPjToPqz4b52o6GoztzTZFZE2GgLNoHZHYxqnDaT/GHFDweVF7ey+I82jlr2wuG7MOLs2wd8CHvp9rzl0weVBMnnZAYPXxGqVhYgAhHQEBfMVA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f54bfe9-dace-4c3d-c637-08d58157287f X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:29:41.0257 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR2101MB1020 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Paul E. McKenney" [ Upstream commit a0982dfa03efca6c239c52cabebcea4afb93ea6b ] The rcutorture test suite occasionally provokes a splat due to invoking resched_cpu() on an offline CPU: WARNING: CPU: 2 PID: 8 at /home/paulmck/public_git/linux-rcu/arch/x86/kerne= l/smp.c:128 native_smp_send_reschedule+0x37/0x40 Modules linked in: CPU: 2 PID: 8 Comm: rcu_preempt Not tainted 4.14.0-rc4+ #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1u= buntu1 04/01/2014 task: ffff902ede9daf00 task.stack: ffff96c50010c000 RIP: 0010:native_smp_send_reschedule+0x37/0x40 RSP: 0018:ffff96c50010fdb8 EFLAGS: 00010096 RAX: 000000000000002e RBX: ffff902edaab4680 RCX: 0000000000000003 RDX: 0000000080000003 RSI: 0000000000000000 RDI: 00000000ffffffff RBP: ffff96c50010fdb8 R08: 0000000000000000 R09: 0000000000000001 R10: 0000000000000000 R11: 00000000299f36ae R12: 0000000000000001 R13: ffffffff9de64240 R14: 0000000000000001 R15: ffffffff9de64240 FS: 0000000000000000(0000) GS:ffff902edfc80000(0000) knlGS:000000000000000= 0 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000f7d4c642 CR3: 000000001e0e2000 CR4: 00000000000006e0 Call Trace: resched_curr+0x8f/0x1c0 resched_cpu+0x2c/0x40 rcu_implicit_dynticks_qs+0x152/0x220 force_qs_rnp+0x147/0x1d0 ? sync_rcu_exp_select_cpus+0x450/0x450 rcu_gp_kthread+0x5a9/0x950 kthread+0x142/0x180 ? force_qs_rnp+0x1d0/0x1d0 ? kthread_create_on_node+0x40/0x40 ret_from_fork+0x27/0x40 Code: 14 01 0f 92 c0 84 c0 74 14 48 8b 05 14 4f f4 00 be fd 00 00 00 ff 90 = a0 00 00 00 5d c3 89 fe 48 c7 c7 38 89 ca 9d e8 e5 56 08 00 <0f> ff 5d c3 0= f 1f 44 00 00 8b 05 52 9e 37 02 85 c0 75 38 55 48 ---[ end trace 26df9e5df4bba4ac ]--- This splat cannot be generated by expedited grace periods because they always invoke resched_cpu() on the current CPU, which is good because expedited grace periods require that resched_cpu() unconditionally succeed. However, other parts of RCU can tolerate resched_cpu() acting as a no-op, at least as long as it doesn't happen too often. This commit therefore makes resched_cpu() invoke resched_curr() only if the CPU is either online or is the current CPU. Signed-off-by: Paul E. McKenney Cc: Ingo Molnar Cc: Peter Zijlstra Signed-off-by: Sasha Levin --- kernel/sched/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index bce3a7ad4253..291ea6fa7ee6 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -508,7 +508,8 @@ void resched_cpu(int cpu) unsigned long flags; =20 raw_spin_lock_irqsave(&rq->lock, flags); - resched_curr(rq); + if (cpu_online(cpu) || cpu =3D=3D smp_processor_id()) + resched_curr(rq); raw_spin_unlock_irqrestore(&rq->lock, flags); } =20 --=20 2.14.1