Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753712AbbHZPzh (ORCPT ); Wed, 26 Aug 2015 11:55:37 -0400 Received: from mail-db3on0071.outbound.protection.outlook.com ([157.55.234.71]:30336 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751690AbbHZPze (ORCPT ); Wed, 26 Aug 2015 11:55:34 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=cmetcalf@ezchip.com; Subject: Re: [PATCH v5 2/6] cpu_isolated: add initial support To: Frederic Weisbecker References: <1438112980-9981-1-git-send-email-cmetcalf@ezchip.com> <1438112980-9981-3-git-send-email-cmetcalf@ezchip.com> <20150812160020.GG21542@lerouge> <55CB8ED1.6030806@ezchip.com> <20150826152651.GA11992@lerouge> CC: Gilad Ben Yossef , Steven Rostedt , Ingo Molnar , Peter Zijlstra , Andrew Morton , Rik van Riel , Tejun Heo , Thomas Gleixner , "Paul E. McKenney" , Christoph Lameter , Viresh Kumar , Catalin Marinas , Will Deacon , , , From: Chris Metcalf Message-ID: <55DDE162.1060804@ezchip.com> Date: Wed, 26 Aug 2015 11:55:14 -0400 User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20150826152651.GA11992@lerouge> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [12.216.194.146] X-ClientProxiedBy: CY1PR14CA0051.namprd14.prod.outlook.com (25.164.65.147) To AM2PR02MB0770.eurprd02.prod.outlook.com (25.163.146.155) X-Microsoft-Exchange-Diagnostics: 1;AM2PR02MB0770;2:2pYoh/28Usook0G9zGOOd5unLtSbFI6CsQkHDyveugqTCdyCqod32ZJOyhlX2NHqxfUa5cGvOmUKruAZwrjY1fzzM9SO02jZ34JQ/pz5sCLhq/v0v8HMIkXc6mSPmjIzEtecAPbMETxmNjs4YfQfFxGUgl+rEasyRTY+kzMrpV0=;3:83FCbas+hk6QZns9sumsRDyZz/uxVFZwVutf0cbERZBNtYJcy01eCsKqYCUddeVVcUOh4poCtNvyyBNwc8XtgEGXvQu2xTpcRDRlUlIJX0pXLjzNvIIADRzwqlmLKewDZ0qkBjMlom9NtZjvzA1tcg==;25:VZLhGWViepPewETFez2tALIK0fxQtMzLj7py3Iamn76YqwHdQFCo+CBuSdrCFp2YtvutwcHI2bdKyaOHXjEJnOuXfePOOVDjik1s/vMrlQTn1gGhku3RRMjQ0ghAG39HKLDlPR+jsomKPRT9pkOuUUYylWF1gft4iyEXmc9UA8dJBY3gSgQr7+b+96XzDsxnApSB+tU0vBVRAi9B+4Hh5UnIZJsXEOI+KoR669AH93ZUHX4IXusZo5///tSaZRB0;20:gl3Q634fbC4WMlCyRYMxgaqE4UYfL4dRjJzm2Y7glYdLnArKeKWdP5z2skFloumpbQ0+7guNpxWXTaNmoEyZC6+lYDR6vqH16bFNjksM2kmoUluGR+NV+OHDJQv34AtKj0k3cJHZzxvqFhVFiB78RpAPfJAQ04+3HmWNPStWPNE= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM2PR02MB0770; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(8121501046)(3002001);SRVR:AM2PR02MB0770;BCL:0;PCL:0;RULEID:;SRVR:AM2PR02MB0770; X-Microsoft-Exchange-Diagnostics: 1;AM2PR02MB0770;4:GFc47j5L2mOeMbC9AyCMRUWOfLytbIwpy9waD+3G7Vp30PE+MiCZFOJ18aL/QrrfQUNxXxHYQKXQ8zY3WED0srPzXFzO/T3WpBOtj9as27BRLXpX0EMwIdLtQkz8QeOl5uAJtTkMnBoyGxS5c5xOEMpybfQSzDZhi2U/Yv0mCOJ7i2YLIgFuQS/x2zsMMUjY3FRx9VxKMGpNb98WiOSqPU9QRk4OhLeD7z2K3uTT+EuZH1wQRPyqqkjUtwqG4q7eVACrWn6yGln4K+hXEo8G8RoDO2WL5BoWtHgJlr2Z1v9bg5dpHJ2uTjnqWCOYo6b4 X-Forefront-PRVS: 0680FADD48 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(6009001)(479174004)(199003)(377454003)(24454002)(189002)(110136002)(122386002)(83506001)(76176999)(54356999)(50986999)(93886004)(46102003)(97736004)(5001830100001)(189998001)(40100003)(5001860100001)(50466002)(5001960100002)(5007970100001)(87266999)(33656002)(64126003)(5004730100002)(36756003)(86362001)(23746002)(59896002)(87976001)(105586002)(4001540100001)(106356001)(1411001)(4001350100001)(64706001)(42186005)(65816999)(65806001)(65956001)(66066001)(47776003)(101416001)(15975445007)(68736005)(2950100001)(81156007)(80316001)(77096005)(77156002)(62966003)(19580395003)(92566002)(18886065003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM2PR02MB0770;H:[10.7.0.41];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;AM2PR02MB0770;23:1qXysoClpDCN9UzmTkGfiqYhKnGq2MB+gteZg?= =?Windows-1252?Q?YMh92RYig+it5+VvYGyoOR0+NIf6DDua/osCCrQUk+FdiuhA/rubOXLA?= =?Windows-1252?Q?XMStKk7wTpq4U4lJCRnv7TRlIPkcHIAax1UQS0i+fcZ000uQtkYQCnL/?= =?Windows-1252?Q?95Cx0WdmkDobS2revFIUI4xRw6+JjahK0HAhQUKYa6CE13T7MNMqKK7E?= =?Windows-1252?Q?t/LOnB1FfdmMy9yexVWIraqVH+pQ8qULBxGEVH9gT55s7gDSXxecivMs?= =?Windows-1252?Q?VS08+2CayUw4NPYcWIF3Wsx4T6dpVlvWj4WfFq3voiH72nX/Z5EflN04?= =?Windows-1252?Q?6mMuRql9si/y5IG6SRx3Aoh2fZp6lZeGPOeDRd2gTKhqyB2bAY1yNoQH?= =?Windows-1252?Q?3TyzaEujSf1b6RsD5Zhcug0b9OR9TkT7YboR2+LWRqKf9TJ7VYulOugo?= =?Windows-1252?Q?b5tmoUz7bH4uifhEYH9eFsgsgH8HDzR/FCBw1afYMc9UaVOVUja1uLtX?= =?Windows-1252?Q?m5jQY4ykPdA0PlIvjoxVSosJuV0mpelVl+Aa8nD+d4l4esPY055RBxSf?= =?Windows-1252?Q?fJdCzfht2SOBGZET6RNxC1tNaEqoctBP1Oi9NA9aexs6iwAD3OvI/RNA?= =?Windows-1252?Q?QYjRQRwNz06/CM9b6/b8iNRTAK9mj068Ycbpx7IJrVm4SIy2eZhDYxGH?= =?Windows-1252?Q?ho9rpYV1/rRU1jedFDbdNLVe8cVz/eU1v0eCYQJCzlUKdzHpg7W015eP?= =?Windows-1252?Q?73asg1b5t06lRt3oyYhQZ0yMQSpCMgYgpSPYObbbX++aQaBiUrvtj2X+?= =?Windows-1252?Q?C3mJ0BxCPkmLy/EV+R3s3zVJ9XcjQNwaO27Ghj052rVgM+1KqIydUkf5?= =?Windows-1252?Q?hisyl0U0hKW2tC73kyyGAp8q/Z91cE4w7WYozwT1ImKdPriGByrsaO9I?= =?Windows-1252?Q?PzNj6fvtAW6SthTLdQgy3J605xFfbDWCffP3TgRjqjZbjYVFNQ15pfTc?= =?Windows-1252?Q?ZLgouKj8azlXvbkyrzXqHefC7Whzq1VnLyHgrLcLLRgZS/7vyioQSAZ5?= =?Windows-1252?Q?GPhlN5qWFQt75+PzTmROnpynZgfAZR+37tfiDwZVJiHIIImSBDHNBcH3?= =?Windows-1252?Q?jx8Ej+aa5xSNgqfTYM08uLWKChk30AxdmJWN+Dc/gqAfVQdOQ8hKWrXX?= =?Windows-1252?Q?LtC8/pDWFNQ91yIBugk4W1kyLsU3pXIKbAuTcw2aXwESCapLXeDwd5Gl?= =?Windows-1252?Q?mYnnPzvyewb9nlRE7Pr7ECPISZdXtb5dnUFSOd1I5cIQx3J1cchtfGzg?= =?Windows-1252?Q?vRIiKe5a8ir9RGA3V5sPbDYX3Jv97DAFpvS0e3+tlOeRH1yrHoZqStRN?= =?Windows-1252?Q?aD/5diGeUUIq2qpfLjosm+L0qczajhXYHuEPI5K9Jxg/0fs7Mh30jo8x?= =?Windows-1252?Q?KEP1JCDr8zqB7qkAQgaP5aYdmtmEipaqdfk+PsNW7Uy3TklU/R9onpwV?= =?Windows-1252?Q?6rXBw+GLprPQFfTeojqrRvxU1CAaYAEYkUON03U2aDLjpt/jPbzhm4Gb?= =?Windows-1252?Q?II8BG4LVg7dy7CHLKDuArs0JHyuyuefVjgB?= X-Microsoft-Exchange-Diagnostics: 1;AM2PR02MB0770;5:3hHpayxlMRZSqWG66I7CJu0RZwKChW6wOFmQmay9kJ1WOh2wTKE40Vefr5eIEef6YxxhBmiy3+07ggLqT/4UY+dXRqpiX8mdLfjljXDLXuz/WfMkM2paQ4T0/RKRrywrl8KUp901VZwlwLmJ3oxxcA==;24:h2moBAAJKCCQyqiR6hIbbc4h5szX4fOFDhhE3CupPBgIk5cv084Gv4sqso+BgemqJmO9dU+2Vwlk8Voc9rtxY96YNWsysFcp7n2UllUZA1w=;20:3xoEuhMfLrKpnZrFKshPpmhA0uWspSHL0vhj0RjidN4ows9LZvnnkRFrXhPEVkPjIvaxvAuT4n1s7NJnoVErtw== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2015 15:55:27.5725 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM2PR02MB0770 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2234 Lines: 50 On 08/26/2015 11:26 AM, Frederic Weisbecker wrote: > On Wed, Aug 12, 2015 at 02:22:09PM -0400, Chris Metcalf wrote: >> On 08/12/2015 12:00 PM, Frederic Weisbecker wrote: >>>> +#ifdef CONFIG_CPU_ISOLATED >>>> +void cpu_isolated_wait(void) >>>> +{ >>>> + set_current_state(TASK_INTERRUPTIBLE); >>>> + _cpu_idle(); >>>> + set_current_state(TASK_RUNNING); >>>> +} >>> I'm still uncomfortable with that. A wake up model could work? >> I don't know exactly what you have in mind. The theory is that >> at this point we're ready to return to user space and we're just >> waiting for a timer tick that is guaranteed to arrive, since there >> is something pending for the timer. > Hmm, ok I'm going to discuss that in the new version. One worry is that > it gets racy and we sleep there for ever. > >> And, this is an arch-specific method anyway; the generic method >> is actually checking to see if a signal has been delivered, >> scheduling is needed, etc., each time around the loop, so if >> you're not sure your architecture will do the right thing, just >> don't provide a method that idles while waiting. For tilegx I'm >> sure it works correctly, so I'm OK providing that method. > Yes but we do busy waiting on all other archs then. And since we can wait > for a while there, it doesn't look sane. We can wait for a while (potentially multiple ticks), which is certainly a long time, but that's what the user asked for. Since we're checking signals and scheduling in the busy loop, we definitely won't get into some nasty unkillable state, which would be the real worst-case. I think the question is, could a process just get stuck there somehow in the normal course of events, where there is a future event on the tick_cpu_device, but no interrupt is enabled that will eventually deal with it? This seems like it would be a pretty fundamental timekeeping bug, so my assumption here is that can't happen, but maybe...? -- Chris Metcalf, EZChip Semiconductor http://www.ezchip.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/