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 X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 129EAC4743D for ; Fri, 4 Jun 2021 16:55:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 DAA46613B4 for ; Fri, 4 Jun 2021 16:55:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DAA46613B4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6zcFJah7o0ZDUgtcJrxOGphwsIDug5JzMD4j0KKK1Ts=; b=IEajxYbNggJkTp tnDXo3TnS55fJW3rMkRQWkU8bFUYN1TycQRE5Iqra+6KrlOfL5FA0bKKhum8z7P864qNUz+YkJ9Nz KqOmASVfl4VZ1k6ogz7NgjOPoNvbQc/vl62rv/VS39H3mKdEe/TfejJ/ijkdKFouBzdPR3+RYb+VS QIAcyXnh+wzANOZQsEllMlShlzEuHK3hll5Fy7YNVjx/ES6T5u/IK0BO0PA6a/FqbV7TUtNlugIsR 5NokZedgD18Rnwu4jZE5g3TU6lATCe3xet+Yh4V6sW31MA9pJyTLbN0XyY7PjYlG/FxNAP+ClL+i2 a52SBT2h+6bjavx+wBHg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lpD5F-00ET5z-Jn; Fri, 04 Jun 2021 16:54:09 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lpD5B-00ET4o-A9 for linux-arm-kernel@lists.infradead.org; Fri, 04 Jun 2021 16:54:06 +0000 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 0B8A11063; Fri, 4 Jun 2021 09:54:04 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.6.137]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D155D3F73D; Fri, 4 Jun 2021 09:54:02 -0700 (PDT) Date: Fri, 4 Jun 2021 17:54:00 +0100 From: Mark Rutland To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, james.morse@arm.com, joey.gouly@arm.com, maz@kernel.org Subject: Re: [PATCH v3 05/20] arm64: entry: move preempt logic to C Message-ID: <20210604165400.GF69333@C02TD0UTHF1T.local> References: <20210525183302.56293-1-mark.rutland@arm.com> <20210525183302.56293-6-mark.rutland@arm.com> <20210604154310.GD2793@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210604154310.GD2793@willie-the-truck> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210604_095405_425520_049D001F X-CRM114-Status: GOOD ( 27.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Jun 04, 2021 at 04:43:10PM +0100, Will Deacon wrote: > On Tue, May 25, 2021 at 07:32:47PM +0100, Mark Rutland wrote: > > Currently portions of our preempt logic are written in C while other > > parts are written in assembly. There's no reason any of this needs to > > live in assembly, so let's move the rest of the lgoic to C. At the same > > time, let's make the comment a bit clearer. > > > > Other than the increased lockdep coverage there should be no functional > > change as a result of this patch. > > > > Signed-off-by: Mark Rutland > > Reviewed-by: Joey Gouly > > Cc: Catalin Marinas > > Cc: James Morse > > Cc: Marc Zyngier > > Cc: Will Deacon > > --- > > arch/arm64/kernel/entry-common.c | 12 ++++++++++++ > > arch/arm64/kernel/entry.S | 13 ------------- > > 2 files changed, 12 insertions(+), 13 deletions(-) > > > > diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c > > index 1fe60578e556..dbe0bb09fe86 100644 > > --- a/arch/arm64/kernel/entry-common.c > > +++ b/arch/arm64/kernel/entry-common.c > > @@ -121,6 +121,18 @@ asmlinkage void __sched arm64_preempt_schedule_irq(void) > > { > > lockdep_assert_irqs_disabled(); > > > > + if (preempt_count() != 0) > > + return; > > Careful, I don't think this is quite the same: preempt_count() just looks at > the 32-bit count portion of the preempt-structure, I thought I had carefully checked that, since it actually reads the u64 field in the union, but I missed that it got truncated to int. Placement aside, when I do add this, I'll make that: | READ_ONCE(current_thread_info()->preempt_count) > whereas the old code only > bothers calling into the scheduler if we actually need to reschedule: > > > diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S > > index 656f3129bfef..8c7ddd651756 100644 > > --- a/arch/arm64/kernel/entry.S > > +++ b/arch/arm64/kernel/entry.S > > @@ -561,20 +561,7 @@ tsk .req x28 // current thread_info > > irq_handler \handler > > > > #ifdef CONFIG_PREEMPTION > > - ldr x24, [tsk, #TSK_TI_PREEMPT] // get preempt count > > It would be nice if we could keep this check on the fast path. Sure; I can leave this here for now. I'll fold it into el1_interrupt() when this path is converted to C later in the series. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel