Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754757AbbEKUNj (ORCPT ); Mon, 11 May 2015 16:13:39 -0400 Received: from mail-db3on0073.outbound.protection.outlook.com ([157.55.234.73]:43904 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752352AbbEKUNg (ORCPT ); Mon, 11 May 2015 16:13:36 -0400 Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; Message-ID: <55510D5C.60605@ezchip.com> Date: Mon, 11 May 2015 16:13:16 -0400 From: Chris Metcalf User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Mike Galbraith CC: Gilad Ben Yossef , Steven Rostedt , Ingo Molnar , Peter Zijlstra , Andrew Morton , "Rik van Riel" , Tejun Heo , Frederic Weisbecker , "Paul E. McKenney" , Christoph Lameter , Subject: Re: [PATCH 3/6] dataplane nohz: run softirqs synchronously on user entry References: <1431107927-13998-1-git-send-email-cmetcalf@ezchip.com> <1431107927-13998-4-git-send-email-cmetcalf@ezchip.com> <1431155043.3209.125.camel@gmail.com> In-Reply-To: <1431155043.3209.125.camel@gmail.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [12.216.194.146] X-ClientProxiedBy: BY1PR0201CA0037.namprd02.prod.outlook.com (25.160.191.175) To AM2PR02MB0769.eurprd02.prod.outlook.com (25.163.146.154) X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM2PR02MB0769;UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM2PR02MB0436; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:AM2PR02MB0769;BCL:0;PCL:0;RULEID:;SRVR:AM2PR02MB0769; X-Forefront-PRVS: 05739BA1B5 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(6009001)(377424004)(377454003)(479174004)(24454002)(189998001)(76176999)(50986999)(66066001)(64126003)(110136002)(65956001)(46102003)(122386002)(19580395003)(2950100001)(54356999)(92566002)(42186005)(5001960100002)(86362001)(47776003)(65806001)(77156002)(40100003)(65816999)(83506001)(62966003)(50466002)(15975445007)(77096005)(4001350100001)(36756003)(23676002)(1411001)(33656002)(87976001)(18886065003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM2PR02MB0769;H:[10.7.0.41];FPR:;SPF:None;MLV:sfv;LANG:en; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2015 20:13:30.2362 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM2PR02MB0769 X-OriginatorOrg: ezchip.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3062 Lines: 60 On 05/09/2015 03:04 AM, Mike Galbraith wrote: > On Fri, 2015-05-08 at 13:58 -0400, Chris Metcalf wrote: >> For tasks which have elected dataplane functionality, we run >> any pending softirqs for the core before returning to userspace, >> rather than ever scheduling ksoftirqd to run. The problem we >> fix is that by allowing another task to run on the core, we >> guarantee more interrupts in the future to the dataplane task, >> which is exactly what dataplane mode is required to prevent. > If ksoftirqd were rt class I realize I actually don't know if this is true or not. Is ksoftirqd rt class? If not, it does seem pretty plausible that it should be... > softirqs would be gone when the soloist gets > the CPU back and heads to userspace. Being a soloist, it has no use for > a priority, so why can't it just let ksoftirqd run if it raises the > occasional softirq? Meeting a contended lock while processing it will > wreck the soloist regardless of who does that processing. The thing you want to avoid is having two processes both runnable at once, since then the "quiesce" mode can't make forward progress and basically spins in cpu_idle() until ksoftirqd can come in. Alas, my recollection of the precise failure mode is somewhat dimmed; my commit notes from a year ago (for a variant of the patch I'm upstreaming now): - Trying to return to userspace with pending softirqs is not currently allowed. Prior to this patch, when this happened we would just wait in cpu_idle. Instead, what we now do is directly run any pending softirqs, then go back and retry the path where we return to userspace. - Raising softirqs (in this case for hrtimer support) could cause the ksoftirqd daemon to be woken on a core. This is bad because on a dataplane core, a QUIESCE process will then block until the ksoftirqd runs, and the system sometimes seems to flag that soft irqs are available but not schedule the timer to arrange for a context switch to ksoftirqd. To handle this, we avoid bailing out in __do_softirq() when we've been working for a while, if we're on a dataplane core, and just keep working until done. Similarly, on a dataplane core running a userspace task, we don't wake ksoftirqd when we are raising a softirq, even if we're not in an interrupt context where it will run promptly, since a non-interrupt context will also run promptly. I'm happy to drop this patch entirely from the series for now, and if ksoftirqd shows up as a problem going forward, we can address it as necessary at that time. What do you think? -- 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/