Received: by 10.223.185.116 with SMTP id b49csp1083085wrg; Sat, 3 Mar 2018 15:04:38 -0800 (PST) X-Google-Smtp-Source: AG47ELuPwpXh7433grw9O9vQZvqj0si2IdZtXzXMUfmP8Qy+QpwCTfHL9q7l4086PhJnY3URA03V X-Received: by 10.98.34.75 with SMTP id i72mr10231331pfi.165.1520118278091; Sat, 03 Mar 2018 15:04:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520118278; cv=none; d=google.com; s=arc-20160816; b=qrReYX4rwCuiI6hNMTn/HUJaU8AyxEvXYi+hvaQp2X1gdJ/OABTWD27j7z1pmFtXZv CliBWTQoYZVxZzsW/7VrDJaXJNwsQj/B0brOGqv4i57q/j/V4qdSa3g3I0QyIrpAobTs PRe9jbg/D5dmO78o/MOcELarVObw7z8+HGBmcg81pahx+SuOQwB3eixVYqE70MmILtM8 B//dopYOB+cvpej7/jET4b21qD9VjuQHQIirdtUz2z1gZr3O+AsISXrGYvG308WFl3j6 nLfJSostQoLAFWEETMUyICZnO93xJeLrZ5XYYGW6Bkhcmh2hhB1ZoTXIOLQ7y7xnOugc 0rBQ== 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=DF8NRvoa0fRLIJ8LjmmE5lMrbZPAxieiU9PotjgmEYk=; b=zx+eIkMvWygrLv5Chi7KoDJVoJkUOpNRfdNoeoWHU33sC0M0DASB+NNMgVBfPWh61d A6hWRjBHkABxjJxJuLoYEJNGpAOqzg73QD9tGPraEeR4gFXoAKpRxk32dlS1XQW0doOK HPJrQAtKJbyjZzUS4YpH7F8HxEP42axNQ9MhCabDFOiA5yosOoACaGl/9JQ/HMgmLplC IzJ17PsnD/QEjzIVKSctyda3FrsIJqV0EReZV35Sq0f//3zVyuGgwFPgA9b5YSMKJtKZ 1PER2bb4yfXLlukpwEyYZp90F6q4APA/uCt5Qs8yW97bBD3qG+EKQq215QR1hsVJvB4r dGEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=iNOU+W19; 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 x77si6169872pgx.159.2018.03.03.15.04.23; Sat, 03 Mar 2018 15:04:38 -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=iNOU+W19; 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 S934691AbeCCXDj (ORCPT + 99 others); Sat, 3 Mar 2018 18:03:39 -0500 Received: from mail-bl2nam02on0118.outbound.protection.outlook.com ([104.47.38.118]:13952 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935227AbeCCWkQ (ORCPT ); Sat, 3 Mar 2018 17:40:16 -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=DF8NRvoa0fRLIJ8LjmmE5lMrbZPAxieiU9PotjgmEYk=; b=iNOU+W19Xx5luVIVQa/Wd7Jlrh/VC8wDdcLQJkYb0IMDPYDTSU8N6YV61t8HZzAsoyY5Mbqnp6IAdpoV84vBzxvvs0OcJDkIvFWQuJoCvwAD4DTEQJDGe41YEVgvykIih6eTW5KDGPaoeOxQXFquDSKztRaxNlEpQ3fEdFWZVXM= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2PR2101MB0939.namprd21.prod.outlook.com (52.132.146.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.5; Sat, 3 Mar 2018 22:40:11 +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:40:11 +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.4 089/115] sched: Stop resched_cpu() from sending IPIs to offline CPUs Thread-Topic: [PATCH AUTOSEL for 4.4 089/115] sched: Stop resched_cpu() from sending IPIs to offline CPUs Thread-Index: AQHTsz9nT3uXC/R6/U2MY7ELD5NOgA== Date: Sat, 3 Mar 2018 22:31:42 +0000 Message-ID: <20180303223010.27106-89-alexander.levin@microsoft.com> References: <20180303223010.27106-1-alexander.levin@microsoft.com> In-Reply-To: <20180303223010.27106-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;MW2PR2101MB0939;7:IyPjz0CsKGBufvzQEMGI80TgSY6yQncLorrGI+Q4FEEyOhDGUqpA8dUZlO34QEa/yoBm2/qSCT9VFJksmRIfRGC21YyLNRHJEW6Q01icFhvXhdZ8ZmAHnWk+UUXz5NydUDxc4gb2AWwi2Hr4ib0UO8qgz2lqTTOCmu0hB/oqB2KNZPEfqN+Xr1zvUDGiFAklorR747sMYZXrMJQgsFqriQWx777hUgNnZrTQBdcU8Gy8XK84m++YyZUHkaoJ/Rto x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 280d9fb5-374b-46b5-25af-08d58157b995 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603307)(7193020);SRVR:MW2PR2101MB0939; x-ms-traffictypediagnostic: MW2PR2101MB0939: 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)(3231220)(944501244)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(61426038)(61427038)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011);SRVR:MW2PR2101MB0939;BCL:0;PCL:0;RULEID:;SRVR:MW2PR2101MB0939; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(346002)(366004)(376002)(39380400002)(39860400002)(189003)(199004)(86612001)(76176011)(478600001)(81166006)(81156014)(72206003)(5660300001)(8936002)(25786009)(59450400001)(26005)(6506007)(102836004)(316002)(22452003)(6486002)(8676002)(14454004)(4326008)(6436002)(107886003)(10090500001)(6512007)(53936002)(36756003)(10290500003)(86362001)(575784001)(2900100001)(3660700001)(305945005)(2950100002)(5250100002)(99286004)(3280700002)(97736004)(54906003)(110136005)(6666003)(2501003)(186003)(106356001)(7736002)(66066001)(3846002)(2906002)(6116002)(105586002)(68736007)(1076002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MW2PR2101MB0939;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: YaTAnE/WZbibfzZUhcpyDxquwkJYfVHzOfyTQjIvAtX3x9BJlBwtMdK4Yiyp0NZ2eKO20iGZlfzj90xSFyMiJv2lZjniucVnkmvM63ogl3OZ2gqxhM8Cjfg6yL5ukcznrRfNwKdPws8gB6m7CPq+BDzU0Adt01aJA5XuEKFyTN0= 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: 280d9fb5-374b-46b5-25af-08d58157b995 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:31:42.9333 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR2101MB0939 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 c5b1c62623cf..65ed3501c2ca 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -601,7 +601,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