From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 191ECC4332F for ; Thu, 9 Nov 2023 11:00:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9ECF4440147; Thu, 9 Nov 2023 06:00:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 99D5B8D0073; Thu, 9 Nov 2023 06:00:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 88B9E440147; Thu, 9 Nov 2023 06:00:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 7AED28D0073 for ; Thu, 9 Nov 2023 06:00:52 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 47DF680E73 for ; Thu, 9 Nov 2023 11:00:52 +0000 (UTC) X-FDA: 81438123144.27.F0D536B Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf03.hostedemail.com (Postfix) with ESMTP id 8A0872001C for ; Thu, 9 Nov 2023 11:00:50 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of mark.rutland@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=mark.rutland@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1699527650; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Nvc0D91Yp29JE0gywi5Msvz4fJ8Gfh6WZ9l/TEmwB/c=; b=rWNPcU2A0BF3W6kT+fc/kbr9WjTcvvHs+4CD04UElpgeYp1E+V/8yzgUxda01wSwhVJT8v 8ACfuZTvNagG5vupGIOFHLDkp1tY4as6+JiEytp7Ui6uFopESxfdASTjmeBckhZ5tXSKvZ bPd8lqwfXLls/SL/ASG2uY1BypQ9H58= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1699527650; a=rsa-sha256; cv=none; b=KnVHAu2pOq90Ii3TQdQnwAchJYAJszv9s8yOaWjfcNarA/qdXvyb5Rm0FCtmIrK8RJiZ60 ZmCamFylEm928nmUo1NMHWAFHpBv08KhkgzbU5AFeARC5vp0bLhfBS7SbeZ+tvAulgsopy xPY5xSAQgwvE/lTRo1mUUcnuq4/nAb8= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of mark.rutland@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=mark.rutland@arm.com; dmarc=pass (policy=none) header.from=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E4B7512FC; Thu, 9 Nov 2023 03:01:33 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.37.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 544683F64C; Thu, 9 Nov 2023 03:00:44 -0800 (PST) Date: Thu, 9 Nov 2023 11:00:38 +0000 From: Mark Rutland To: Ankur Arora Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, peterz@infradead.org, torvalds@linux-foundation.org, paulmck@kernel.org, linux-mm@kvack.org, x86@kernel.org, akpm@linux-foundation.org, luto@kernel.org, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, willy@infradead.org, mgorman@suse.de, jon.grimm@amd.com, bharata@amd.com, raghavendra.kt@amd.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, jgross@suse.com, andrew.cooper3@citrix.com, mingo@kernel.org, bristot@kernel.org, mathieu.desnoyers@efficios.com, geert@linux-m68k.org, glaubitz@physik.fu-berlin.de, anton.ivanov@cambridgegreys.com, mattst88@gmail.com, krypton@ulrich-teichert.org, rostedt@goodmis.org, David.Laight@aculab.com, richard@nod.at, mjguzik@gmail.com Subject: Re: [RFC PATCH 00/86] Make the kernel preemptible Message-ID: References: <20231107215742.363031-1-ankur.a.arora@oracle.com> <87o7g3epcu.fsf@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87o7g3epcu.fsf@oracle.com> X-Stat-Signature: pwjdad5ozq74co7qdci49c7q9cg64r6c X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 8A0872001C X-Rspam-User: X-HE-Tag: 1699527650-34126 X-HE-Meta: U2FsdGVkX1+Oc/UDRRvmOtHkGE9CpllWlReh5QRlPqfZdVXfvp/E8OcaNF/PobEh9piA1ra7lidpLJDoJ2BsqCZu5rr2m7EB/MwdUO83Bx2xyyehSNQ70wp3ZqCKFMkMBYP23j+yKsh1MEK+OC08OOcn2VBOXSxYBu8sEn0L6tksqKqR7Lx4sd04MaGOINb4qQAei4vpliHxESLh5ne7sHL8lTGaJlTbG4HPWrLkm3hmdRm18ugnjcdwASFoHMaiG3J8GDbma2z5m6R232mfNwxR3pSjiv7Z+1ViYWGYZR5wChztT9KXmjDVVyh45azFoCqCR89XiBnylAv30VpiY1E7b+ujIfwwawIhJKmbHvllY0GZ3T22dgutRZQJVuTVnauQjaHqxqxvZ0lHLS1lbfEoR3fyCpe8QtYGRj8u8A2Kf8A9OLS63c/6u/ywobw2XqsXqepoJ1peLRxao3sZD3HskmiqtNJjAVe45EuEZeqOMv9z6L5ENsx/GF7jU+pQ8RKRPD/1z5H74PBUdD2WOMktz7MRrkgoxJo3izX0dsBFNxrQCmQ+h4gnuiQ77RgUpdybxXfu5yYI9nmVPzUX1aNfCTljiEL6BOULaJCJbXj8jRcekLNh/Cfb5uirCeQANZ2XfLeOV9DHPYN5eUjBI4jD2szfSglFIMTUYwB06TnysSDyoJ4tASb5uYMSkl/oIX8lOK/Fy32iFRoN2gPfDlQ/F/BAyfAe/jfMrdyHKUyV1GAOe5u+82U5ukdZq1xoJEI8NOCS3xT8KnCG5D1NXMajHkdfyV260EFLBJa+NiLUAZs726G78Jqj65bnpPFkdQQ5D6Vo8WSzBwDXaWbQyDxKV1KKF21MFxvgp+4yW4/GFyzWGjRLw37tY9x5hjADebqInBkLBoGX6Jn7/j2a1MjGs3XEH6AMj2BxY3LU0g5yBW48+ak2Qgp3Kj0VI94n6TEFVRzY82Zmgftt2xj yAl1jq8P iJqRAFm/VXDhzGWffo7S7z+arV7Q0LpTUoC3ySstFxopoBN4QYpx0XH7ytl8GsPHm1uJgaS50q8isr757QvhL2n0mVJyUXyoh1lCW4d9bAUrP84/Fl9TkSxgZOpriPM9WxXYNLBMrM16xzp5Xsw1krqlHxzT31UVL9T4294l9MWkmsiFUiDxCK5CMjU8eB3aXDLFv7MOa49kU7lS92JjxHlkwYtmb4eu9ntAw X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Nov 08, 2023 at 04:34:41PM -0800, Ankur Arora wrote: > Mark Rutland writes: > > > On Tue, Nov 07, 2023 at 01:56:46PM -0800, Ankur Arora wrote: > >> What's broken: > >> - ARCH_NO_PREEMPT (See patch-45 "preempt: ARCH_NO_PREEMPT only preempts > >> lazily") > >> - Non-x86 architectures. It's trivial to support other archs (only need > >> to add TIF_NEED_RESCHED_LAZY) but wanted to hold off until I got some > >> comments on the series. > >> (From some testing on arm64, didn't find any surprises.) > > > > When you say "testing on arm64, didn't find any surprises", I assume you mean > > with an additional patch adding TIF_NEED_RESCHED_LAZY? > > Yeah. And, handling that in the user exit path. > > > Note that since arm64 doesn't use the generic entry code, that also requires > > changes to arm64_preempt_schedule_irq() in arch/arm64/kernel/entry-common.c, to > > handle TIF_NEED_RESCHED_LAZY. > > So, the intent (which got muddied due to this overly large series) > was to delay handling TIF_NEED_RESCHED_LAZY until we are about to > return to user. Ah, I missed that detail -- thanks for clarifying! > I think arm64_preempt_schedule_irq() should only handle TIF_NEED_RESCHED > and the _TIF_NEED_RESCHED_LAZY should be handled via _TIF_WORK_MASK > and do_notify_resume(). Digging a bit more, I think that should still work. One slight clarification: arm64_preempt_schedule_irq() doesn't look at TIF_NEED_RESCHED today, as it relies on the scheduler IPI calling preempt_fold_need_resched() to propogate TIF_NEED_RESCHED into PREEMPT_NEED_RESCHED. That should still work since this series makes preempt_fold_need_resched() check tif_need_resched(RESCHED_eager). I was a bit cnofused because in the generic entry code, irqentry_exit_cond_resched() explicitly checks for TIF_NEED_RESCHED, and I'm not sure why it does that rather than relying on the scheduler IPI as above. > (The design is much clearer in Thomas' PoC: > https://lore.kernel.org/lkml/87jzshhexi.ffs@tglx/) > > >> - ftrace support for need-resched-lazy is incomplete > > > > What exactly do we need for ftrace here? > > Only support for TIF_NEED_RESCHED_LAZY which should be complete. > That comment was based on a misreading of the code. Cool; thanks! Mark.