Received: by 10.223.185.116 with SMTP id b49csp1072573wrg; Sat, 3 Mar 2018 14:47:23 -0800 (PST) X-Google-Smtp-Source: AG47ELvgSD53lKVZ84GzrSfGnjZgVTi02AYzpFvDhIRJABOIj6iojwi3H8oUWmSQSo7xOhuBMO5j X-Received: by 2002:a17:902:1c5:: with SMTP id b63-v6mr9032820plb.311.1520117243443; Sat, 03 Mar 2018 14:47:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520117243; cv=none; d=google.com; s=arc-20160816; b=IMhhWdTde6zBRxzrRFKRwX2mRhrdt00PcgsoeBOEkX2g3uNeMMsbZkQobBm+5BXvZC GO2gPCKE962RESetgp+t/63VXV+OBcvRoo4J05kaag/0ruarnQxoHlQQaaNsSFuXsCb0 4F26ATKUB8Jlw81w4tXOwWu07RiX1Q69vm9OrnvNsDGaIWg5J+A8pxWm2m5nVHFY+plp ZP8MAw24Da7L1GoYUyHcNHZhCMuRCaYhmpU81WQzhxSa/kC+WtTXzsGhGOfhM32PI4+r KoRFg+RpiYvmWM49crcvZ1etuc/ttyTy+Oq/LzM7//xcJivH3oLGxDIdI5Khe8FiCaig bEcA== 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=doT4pykSCHf7XM/Jgq4jgwFQnZgCB6WxTV8YFACM3yU=; b=osM/2ViXC+7pbiMLbekWfAHFr9579Jtc/uRe6jakB1GP2F5Bi+dQkpSqPCb4CS5NAR GZ0R9+Ybu+E01I5oI54crUdDurXhF+916ZMTUW3a6PMg7ZpcBbPXKtl0909GfY038L0l Vaw7AsqmtgL/V627XboTpdka+8idnOFJW7MgL/EGGWu9xqjZusXcqDbS1Vycd+iHWANd t9bY0jwY1mawrEsZ0DNfO/3VWL7GT7zrqAcc4YDsie/rgPugYrbOyF5bCE0f/sxZ2NQB AjSoW2dPtGmDbcnb+bwrckNO7Ux7axQaHyGZkxJ3kUiVCW2ev23hjGF2ATx3IL6mn7LE 9q6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=CZTgDN84; 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 k4-v6si2562924pll.99.2018.03.03.14.47.08; Sat, 03 Mar 2018 14:47:23 -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=CZTgDN84; 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 S935500AbeCCWqL (ORCPT + 99 others); Sat, 3 Mar 2018 17:46:11 -0500 Received: from mail-co1nam03on0134.outbound.protection.outlook.com ([104.47.40.134]:59904 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935561AbeCCWl4 (ORCPT ); Sat, 3 Mar 2018 17:41:56 -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=doT4pykSCHf7XM/Jgq4jgwFQnZgCB6WxTV8YFACM3yU=; b=CZTgDN84kgUd1+RA/fd5vgFAjfSdtLD8SeuZ9lF9tbiXD7Hx3rVAC4Bo+92y30pSi4uW4AyJgxJgjPFxS+xq4JiI+FpsKW2hwi3ZJatL2h61adcd16mUImwqf4thnOGn+xQ4a1M6za5EzNLbCH6WHjla8U4UAW4MUm1x8gkmdOU= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2PR2101MB1018.namprd21.prod.outlook.com (52.132.146.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.7; Sat, 3 Mar 2018 22:41:54 +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:41:54 +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 3.18 48/63] sched: Stop resched_cpu() from sending IPIs to offline CPUs Thread-Topic: [PATCH AUTOSEL for 3.18 48/63] sched: Stop resched_cpu() from sending IPIs to offline CPUs Thread-Index: AQHTsz+tHYnQqNO8QkO3qa5+ckEpeg== Date: Sat, 3 Mar 2018 22:33:39 +0000 Message-ID: <20180303223228.27323-48-alexander.levin@microsoft.com> References: <20180303223228.27323-1-alexander.levin@microsoft.com> In-Reply-To: <20180303223228.27323-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;MW2PR2101MB1018;7:ufJ1gJzxX9oxEUUmp0hVcCVFdqo8sZWCGCuDMkg6EoBghmQqjOwiA/NP22gNgOrKjlIDvedBUe4m5+GB+qpHAeAYusuEnmf1MHz1oEUeyK79Ae6th1qxISkPt5DcfIwAfd5Kq8/p7d6hoSwbLxxQI5Q27DxzP1l8BzO+MXyiPjW0U+dk8Bj7P85JYL1KQUYfeKAIiMGX1Mv8v1wSocxWdv8tlBp6yehvIeZnKDFNst+if867Rl1xJsJ4yBllYsHj x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: ba2bc6aa-5ec2-4a67-4da8-08d58157f6f0 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603307)(7193020);SRVR:MW2PR2101MB1018; x-ms-traffictypediagnostic: MW2PR2101MB1018: 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:MW2PR2101MB1018;BCL:0;PCL:0;RULEID:;SRVR:MW2PR2101MB1018; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(376002)(39860400002)(39380400002)(366004)(346002)(199004)(189003)(26005)(25786009)(3280700002)(10290500003)(4326008)(107886003)(81156014)(5660300001)(8676002)(6512007)(2950100002)(59450400001)(305945005)(97736004)(186003)(54906003)(6436002)(7736002)(72206003)(76176011)(6506007)(106356001)(110136005)(575784001)(86362001)(102836004)(6486002)(66066001)(36756003)(6116002)(3846002)(14454004)(6666003)(105586002)(99286004)(478600001)(1076002)(3660700001)(2906002)(10090500001)(86612001)(5250100002)(81166006)(6346003)(2900100001)(68736007)(2501003)(8936002)(316002)(53936002)(22452003)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MW2PR2101MB1018;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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: M/0KwJLosOltCXFr8s4NoQYh6QMcBt/m/qxTtvKmD6xMT6FVrkBB60hZVdqwqxlNjMdgSVhgmHOqRfmvPtQjzpsHuNkrAGQfr39QV7MrmK1lG0m4O1I2vFSgYx3xZwtR/2GtpLIe7TaYi44Jb9Qk/PZgel/wU7DvYz6AJCNeRQA= 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: ba2bc6aa-5ec2-4a67-4da8-08d58157f6f0 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:33:39.7479 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR2101MB1018 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 5c64c714ad08..3ff883ec2e52 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -633,7 +633,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