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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4EDBC4332F for ; Mon, 15 Nov 2021 15:30:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D02E5611BF for ; Mon, 15 Nov 2021 15:30:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230101AbhKOPdq (ORCPT ); Mon, 15 Nov 2021 10:33:46 -0500 Received: from foss.arm.com ([217.140.110.172]:56642 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236522AbhKOPc7 (ORCPT ); Mon, 15 Nov 2021 10:32:59 -0500 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 6EF1C6D; Mon, 15 Nov 2021 07:30:02 -0800 (PST) Received: from e113632-lin (e113632-lin.cambridge.arm.com [10.1.196.57]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 557F03F766; Mon, 15 Nov 2021 07:30:00 -0800 (PST) From: Valentin Schneider To: Michael Ellerman , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linuxppc-dev@lists.ozlabs.org, linux-kbuild@vger.kernel.org Cc: Peter Zijlstra , Ingo Molnar , Frederic Weisbecker , Mike Galbraith , Marco Elver , Dmitry Vyukov , Benjamin Herrenschmidt , Paul Mackerras , Steven Rostedt , Masahiro Yamada , Michal Marek , Nick Desaulniers Subject: Re: [PATCH v2 3/5] powerpc: Use preemption model accessors In-Reply-To: <87o86rmgu8.fsf@mpe.ellerman.id.au> References: <20211110202448.4054153-1-valentin.schneider@arm.com> <20211110202448.4054153-4-valentin.schneider@arm.com> <87o86rmgu8.fsf@mpe.ellerman.id.au> Date: Mon, 15 Nov 2021 15:29:53 +0000 Message-ID: <87lf1pqvwu.mognet@arm.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Doh, thought I had sent this one out already... On 11/11/21 15:55, Michael Ellerman wrote: > Valentin Schneider writes: >> Per PREEMPT_DYNAMIC, checking CONFIG_PREEMPT doesn't tell you the actual >> preemption model of the live kernel. Use the newly-introduced accessors >> instead. >> >> sched_init() -> preempt_dynamic_init() happens way before IRQs are set up, >> so this should be fine. > > Despite the name interrupt_exit_kernel_prepare() is called before IRQs > are setup, traps and page faults are "interrupts" here. > > So I'm not sure about adding that call there, because it will trigger a > WARN if called early in boot, which will trigger a trap and depending on > the context we may not survive. > > I'd be happier if we can make it a build-time check. > This can't be done at build-time for PREEMPT_DYNAMIC, but that can be punted off to whoever will implement ppc support for that :-) AFAICT if this can't use preempt_dynamic_mode (due to how "late" it is setup), the preempt_schedule_irq() needs to go and ppc needs to use irqentry_exit() / irqentry_exit_cond_resched(). I dropped that for v2. > cheers > 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2507C433F5 for ; Mon, 15 Nov 2021 15:30:36 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4AE6F61B50 for ; Mon, 15 Nov 2021 15:30:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4AE6F61B50 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4HtCnQ4lQ9z3bXR for ; Tue, 16 Nov 2021 02:30:34 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=arm.com (client-ip=217.140.110.172; helo=foss.arm.com; envelope-from=valentin.schneider@arm.com; receiver=) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lists.ozlabs.org (Postfix) with ESMTP id 4HtCmt5lrZz2x9Z for ; Tue, 16 Nov 2021 02:30:04 +1100 (AEDT) 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 6EF1C6D; Mon, 15 Nov 2021 07:30:02 -0800 (PST) Received: from e113632-lin (e113632-lin.cambridge.arm.com [10.1.196.57]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 557F03F766; Mon, 15 Nov 2021 07:30:00 -0800 (PST) From: Valentin Schneider To: Michael Ellerman , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linuxppc-dev@lists.ozlabs.org, linux-kbuild@vger.kernel.org Subject: Re: [PATCH v2 3/5] powerpc: Use preemption model accessors In-Reply-To: <87o86rmgu8.fsf@mpe.ellerman.id.au> References: <20211110202448.4054153-1-valentin.schneider@arm.com> <20211110202448.4054153-4-valentin.schneider@arm.com> <87o86rmgu8.fsf@mpe.ellerman.id.au> Date: Mon, 15 Nov 2021 15:29:53 +0000 Message-ID: <87lf1pqvwu.mognet@arm.com> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marco Elver , Michal Marek , Peter Zijlstra , Frederic Weisbecker , Mike Galbraith , Nick Desaulniers , Steven Rostedt , Paul Mackerras , Masahiro Yamada , Ingo Molnar , Dmitry Vyukov Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Doh, thought I had sent this one out already... On 11/11/21 15:55, Michael Ellerman wrote: > Valentin Schneider writes: >> Per PREEMPT_DYNAMIC, checking CONFIG_PREEMPT doesn't tell you the actual >> preemption model of the live kernel. Use the newly-introduced accessors >> instead. >> >> sched_init() -> preempt_dynamic_init() happens way before IRQs are set up, >> so this should be fine. > > Despite the name interrupt_exit_kernel_prepare() is called before IRQs > are setup, traps and page faults are "interrupts" here. > > So I'm not sure about adding that call there, because it will trigger a > WARN if called early in boot, which will trigger a trap and depending on > the context we may not survive. > > I'd be happier if we can make it a build-time check. > This can't be done at build-time for PREEMPT_DYNAMIC, but that can be punted off to whoever will implement ppc support for that :-) AFAICT if this can't use preempt_dynamic_mode (due to how "late" it is setup), the preempt_schedule_irq() needs to go and ppc needs to use irqentry_exit() / irqentry_exit_cond_resched(). I dropped that for v2. > cheers >