Received: by 10.223.164.202 with SMTP id h10csp1214196wrb; Wed, 15 Nov 2017 15:24:31 -0800 (PST) X-Google-Smtp-Source: AGs4zMY0Vz9Q64veq1LM7r3/L0eMktbkR/YFPMxdZAAGYeJhSjylNoENSL4MmGDzC2biipJlqXHP X-Received: by 10.99.113.72 with SMTP id b8mr17523403pgn.42.1510788271735; Wed, 15 Nov 2017 15:24:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510788271; cv=none; d=google.com; s=arc-20160816; b=GlK+GNbUaGjnePpEJIadDKm3zrfGiTPagtHrn/jed9vVnfATB28c53UXyr39MzkNJf vkHjHxOy9KFfUgDgqM5n63+tuo3WGcMjikwGGbY9buPVT8nRLAQOOdzljg3G+wDxPe+R tu1TkS8Lpv9wK/HnDlcUBol0nfwNOB3biNzFcL93gcRGGA2KZPZLlCMwjvQPMwG0JVvI HiWNcUplxHLhYt2iqOQrpOEGXBZod+7yjWPMMnTmwBMfON2BMOrYdzfrKSXMikPoQnmr g3V/OwCMSSLn6Ba2Yh8RSoeTVrXRPhMxgddF/4XdH9pwA2oJExj5VuuWDctdN8mj7TAO zw1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:user-agent:content-disposition:mime-version :reply-to:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=ULmsuudxFiR1rxosQEwxXWaO423fFkWOsvniZQY/Blc=; b=i85cLmToC/62gEKtkyvJvE9I5B5MxPhCROWrRPE3Ly2Te0VU/wYBSZDRRW0tyhxzkK D8ty3PaIGBh3lvK+krVJL8yyCBcdIzSojCK93KerXl7bCNgblO8+Otm7MDw28Ln5BO5q S+RI9SJotp7B1r344RE3c8JCJGZORsWPv63UDj1BNGl7seoWHqE4r6fScdWd6s8gDNb0 i37QVZXcINQIkv6bNkwSr96Lpz3B5Mm95qwgJcGsExHtVykLK2xfuv3J7wTYFVvOuEy1 HudmSdY5OAAOXzaBGbcw1rBxFexveMqNLFJbtNUFpa/AIj3yb2TB6dhg9E6MrSgRJXQs NSbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@concurrentrt.onmicrosoft.com header.s=selector1-concurrentrt-com02e header.b=Stlr2Vxj; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y2si18293917pgo.89.2017.11.15.15.24.19; Wed, 15 Nov 2017 15:24:31 -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=@concurrentrt.onmicrosoft.com header.s=selector1-concurrentrt-com02e header.b=Stlr2Vxj; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759135AbdKOT0E (ORCPT + 89 others); Wed, 15 Nov 2017 14:26:04 -0500 Received: from mail-co1nam03on0105.outbound.protection.outlook.com ([104.47.40.105]:63784 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1759020AbdKOTZr (ORCPT ); Wed, 15 Nov 2017 14:25:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=concurrentrt.onmicrosoft.com; s=selector1-concurrentrt-com02e; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ULmsuudxFiR1rxosQEwxXWaO423fFkWOsvniZQY/Blc=; b=Stlr2VxjBN3BzkYAsOZtAeECQterfefRwejjfSPCq1M5Oaq8NRzO/K4tGa57zfV920wMKHWIhXwAOlhvT/bSpuKzPLrjvTU+3R1d1Zqq16IOSr7tYz00tpMSVLk9NqUTy42qi8D7wE6QyJoB/hIOLPPiWb8dmGvUoLw/lTJkOxw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Joe.Korty@concurrent-rt.com; Received: from zipoli.concurrent-rt.com (12.220.59.2) by BN6PR11MB1476.namprd11.prod.outlook.com (10.172.21.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.239.5; Wed, 15 Nov 2017 19:25:43 +0000 Date: Wed, 15 Nov 2017 14:25:29 -0500 From: joe.korty@concurrent-rt.com To: Thomas Gleixner , Peter Zijlstra , Steven Rostedt Cc: Linux Kernel Mailing List Subject: [PATCH] 4.4.86-rt99: fix sync breakage between nr_cpus_allowed and cpus_allowed Message-ID: <20171115192529.GA14158@zipoli.concurrent-rt.com> Reply-To: "Joe Korty" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.8.3 (2017-05-23) X-Originating-IP: [12.220.59.2] X-ClientProxiedBy: MWHPR10CA0051.namprd10.prod.outlook.com (10.169.238.13) To BN6PR11MB1476.namprd11.prod.outlook.com (10.172.21.140) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: db62a58b-80ab-46c5-b087-08d52c5eaa99 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603258);SRVR:BN6PR11MB1476; X-Microsoft-Exchange-Diagnostics: 1;BN6PR11MB1476;3:P9j1LdbLyhOEGEZtLc2ssStRyRx36tG8PcTjyI4Zo1kY+8uWqoETEnc8ayd1C6FcrGjFhMl9PubdZjiavvcLGeXrrjyot3UDGSZGPdyfWwpzCzDEsza/wboa24dYlMlIwbTbovRGkIoFUqWkYwtoyw9HOCInU+z/2ITMxCDDxXzFmGWB5ba1DT/PEd7tm/6zzHz4a5j6u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WH4nRJmubn9cDkNeJO3nDrWAhhHG7K1UaNiM5hbWC2az9R4lN7q/Oz1ia6M44XzrXaCh4TFjPGw5VsRcJ+7pg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3231022)(10201501046)(3002001)(93006095)(93001095)(100000703101)(100105400095)(6041248)(20161123564025)(20161123562025)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BN6PR11MB1476;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BN6PR11MB1476; X-Forefront-PRVS: 0492FD61DD X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(376002)(346002)(39830400002)(189002)(5423002)(199003)(85782001)(478600001)(8936002)(81156014)(81166006)(8676002)(50466002)(25786009)(43066004)(83506002)(86362001)(53416004)(2906002)(6666003)(3846002)(1076002)(6116002)(23726003)(316002)(189998001)(106356001)(53936002)(105586002)(55016002)(5660300001)(305945005)(7736002)(69596002)(72206003)(16526018)(68736007)(97736004)(4326008)(16586007)(110136005)(33656002)(50986999)(58126008)(47776003)(9686003)(66066001)(101416001)(54356999)(18370500001)(85772001);DIR:OUT;SFP:1102;SCL:1;SRVR:BN6PR11MB1476;H:zipoli.concurrent-rt.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: concurrent-rt.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN6PR11MB1476;23:pjhtGCVyzLgN1qcWBedqKJcsn9EeO7AdRBxwebUX4?= =?us-ascii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llYVBuwdnDck?= =?us-ascii?Q?tHpIiinv0288Rq+C7D4qgp/qpuAEFMW5Lt6IzN4icPWgOLkRn3+bkxPpInjq?= =?us-ascii?Q?Yq93ZaRFhoaDF7/QCq4WYnqjPF0ohOuupIma7Z+PzWQBX9cgxiOdcPDhArcA?= =?us-ascii?Q?Let2MM46OKH1RK41Xuy32IpvMxmuEVs8g+eMPQyrn+UicGcIz8ImGRXP7Std?= =?us-ascii?Q?+XwUDj6d4sKZyeyMXroSvlPtPBi2SrEOi8TpVTZbIb7mWJ4diutlmQ/yoVmf?= =?us-ascii?Q?E3YVG8ikD+nYddwcVy+xijyEBKj2hZ9Qg63?= X-Microsoft-Exchange-Diagnostics: 1;BN6PR11MB1476;6:I0El+SVfBbrktRfWQm1nLrwdaAXrohBpTNzSkN2/8Z4zLdX/X88F66Swr0hcng+AFd1r5VBSGRdYZPCNM62NKYGZAaeDXNWypXq/18njtBIX8otGN9OudAQLD2D5WeyGS0fsbxFA41JIJ1bdKag+JgfsJ9k1sX2Elu+RYK9J9+CKpPueFK4neKkH4gcICwftYU5JceW6hcM05egWbygNb+VAArS3IxH3pS7Sdd+hmzD/oApqRg7BiVf2uTeWygrRUCACtVG3gxBXcpNO/Qvo7Uks0ffvDROePIfCrgGhV6o7g0OY57AigdGPyaph90vQRNp3U2vpqI9FtfM0Muls02P9rvGteQtD52MOqzPOa+o=;5:wd2AQ183QFpG8X3TAciW/J1TIBBcDeFPa2PvCuZz0OKeq8AzyoATQWY2TCMpntetDP4Fb0R2IhqINRRCT8wqdIr/qHZL7hytdKouPVwAr7n5m0I8j80yykf+RqPjM15KjlLfeLu4/l571/0xvUdEf2s54ztRxMCDCOA0Xw72fLM=;24:y7JMiqmIwFmNv15ZWK1S16kurCxcDjViESq2qEYRzzdlznFz8hef1GqLdcu49j/fuVrJOSTR3nuy1acivZL8qCJxWK7A5aijkczcY5S37P0=;7:URz4ZFIq1R1TytOT1Bua/v3N05to79GJ5dZizQeb3u1dSJHH57vqsr/z7spBx658yT/T0VbNg9WlM1PEAynWG9XmfcCpNcQO8qCAWIQlvTzkjPAKFpoX7xXio7yCVC11NZUWrzj5Hg+tk5WoxxQHhNbiRkEJrM3knD1tDVdZZ3nGYpoLvmQl7GtXlxu0FJSYCgz1yqVPnG1y4FAPx0cQmjRzuFa8SCYngYqCFnBpvMalJ7KPnZC56smpHbMsnPLv SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: concurrent-rt.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2017 19:25:43.2758 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: db62a58b-80ab-46c5-b087-08d52c5eaa99 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 38747689-e6b0-4933-86c0-1116ee3ef93e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1476 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4.86-rt99's patch 0037-Intrduce-migrate_disable-cpu_light.patch introduces a place where a task's cpus_allowed mask is updated without a corresponding update to nr_cpus_allowed. This path is executed when task affinity is changed while migrate_disabled() is true. As there is no code present to set nr_cpus_allowed when the migrate_disable state is dropped, the scheduler at that point on may make incorrect scheduling decisions for this task. My testing consists of temporarily adding a if (tsk_nr_cpus_allowed(p) == cpumask_weight(tsk_cpus_allowed(p)) printk_ratelimited(...) stmt to schedule() and running a simple affinity rotation program I wrote, one that rotates the threads of stress(1). While rotating, I got the expected kernel error messages. With this patch applied the messages disappeared. Signed-off-by: Joe Korty Index: b/kernel/sched/core.c =================================================================== --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1220,6 +1220,7 @@ void do_set_cpus_allowed(struct task_str lockdep_assert_held(&p->pi_lock); if (__migrate_disabled(p)) { + p->nr_cpus_allowed = cpumask_weight(new_mask); cpumask_copy(&p->cpus_allowed, new_mask); return; } From 1585451998885630718@xxx Thu Nov 30 01:20:51 +0000 2017 X-GM-THRID: 1585436972156040679 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread