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=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 8733DC433EF for ; Tue, 7 Sep 2021 15:24:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6D7016112F for ; Tue, 7 Sep 2021 15:24:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345188AbhIGPZr (ORCPT ); Tue, 7 Sep 2021 11:25:47 -0400 Received: from home.keithp.com ([63.227.221.253]:52898 "EHLO elaine.keithp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344974AbhIGPZq (ORCPT ); Tue, 7 Sep 2021 11:25:46 -0400 Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id 9E6CB3F30862; Tue, 7 Sep 2021 08:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1631028255; bh=t7VcNGzEjGyV50+1Ty0iiMDwzQyzAK8kFK85FlnpD+A=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=dDN+Ipk0CqpqNc1QWuC89K5w37dnf4YFJhi/Sf5i+tMFyUHhfWTjfFSdkW/9v0hfD 7/QkMU5Gn+CSLCOS1MIOHtBFjJWErPmm2hAeevhTBqiveNSZLuKcbng2q5st+uZiV/ 4UCVNT3Lj2p12ezWFGYFqcGhyB8K83ebqeVm+cMjafma4rslTJN5w9n5ltYJpvyGdx jVsTbTUCks0GlPA7IVgc8xCmmXJUEXCmHTrfDZUlc7lhBrLOlbIxFxLpGVCLQ9u8ik Wt9Y8AyjWBXj1bRGmB1vmq38e3/kombzcKoULWBvBjaki10res0ssh2rpMpuVg5yxv 1a9+QFsQVhbcQ== X-Virus-Scanned: Debian amavisd-new at keithp.com Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id SnOz81A0WPec; Tue, 7 Sep 2021 08:24:15 -0700 (PDT) Received: from keithp.com (168-103-156-98.tukw.qwest.net [168.103.156.98]) by elaine.keithp.com (Postfix) with ESMTPSA id 0E7C03F30861; Tue, 7 Sep 2021 08:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1631028255; bh=t7VcNGzEjGyV50+1Ty0iiMDwzQyzAK8kFK85FlnpD+A=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=dDN+Ipk0CqpqNc1QWuC89K5w37dnf4YFJhi/Sf5i+tMFyUHhfWTjfFSdkW/9v0hfD 7/QkMU5Gn+CSLCOS1MIOHtBFjJWErPmm2hAeevhTBqiveNSZLuKcbng2q5st+uZiV/ 4UCVNT3Lj2p12ezWFGYFqcGhyB8K83ebqeVm+cMjafma4rslTJN5w9n5ltYJpvyGdx jVsTbTUCks0GlPA7IVgc8xCmmXJUEXCmHTrfDZUlc7lhBrLOlbIxFxLpGVCLQ9u8ik Wt9Y8AyjWBXj1bRGmB1vmq38e3/kombzcKoULWBvBjaki10res0ssh2rpMpuVg5yxv 1a9+QFsQVhbcQ== Received: by keithp.com (Postfix, from userid 1000) id 41E161E6011A; Tue, 7 Sep 2021 08:24:37 -0700 (PDT) From: Keith Packard To: Ard Biesheuvel Cc: Linux Kernel Mailing List , Abbott Liu , Alexander Sverdlin , Andrew Morton , Anshuman Khandual , Arnd Bergmann , Bjorn Andersson , Florian Fainelli , Geert Uytterhoeven , Hartley Sweeten , Jens Axboe , Jian Cai , Joe Perches , Kees Cook , Krzysztof Kozlowski , Linus Walleij , Linux ARM , Manivannan Sadhasivam , Marc Zyngier , Masahiro Yamada , Miguel Ojeda , Mike Rapoport , Nathan Chancellor , Nick Desaulniers , Nicolas Pitre , Rob Herring , Russell King , Thomas Gleixner , Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , Valentin Schneider , Viresh Kumar , "Wolfram Sang (Renesas)" , YiFei Zhu Subject: Re: [PATCH 2/3] ARM: Move thread_info into task_struct (v7 only) In-Reply-To: References: <20210902155429.3987201-1-keithp@keithp.com> <20210904060908.1310204-1-keithp@keithp.com> <20210904060908.1310204-3-keithp@keithp.com> <8735qifcy6.fsf@keithp.com> Date: Tue, 07 Sep 2021 08:24:36 -0700 Message-ID: <874kawcssr.fsf@keithp.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Ard Biesheuvel writes: > Sure, so it is precisely for that reason that it is better to isolate > changes that can be isolated. I'll go ahead and split this apart then; that is how I did development, after all. > All the time. 'current' essentially never changes value from the POV > of code running in task context, so there is usually no reason to care > about preemption/migration when referring to it. Using per-CPU > variables is what creates the problem here. Thanks for helping me -- I just got the wrong model stuck in my head over the weekend somehow. If I do have this figured out, we should be able to stick the per_cpu_offset value in thread_info and use TPIDRPRW to hold 'current' as code using per_cpu_offset should already be disabling preemption. That should be an easier change than putting a kernel pointer in a user-visible register. > Given that we are already relying on the MP extensions for this > anyway, I personally think that using another thread ID register to > carry 'current' is a reasonable approach as well, since it would also > allow us to get per-task stack protector support into the compiler. > But I would like to hear from some other folks on cc as well. That would be awesome; I assume that doesn't require leaving per_cpu_offset in a thread ID register? In any case, I'll give my plan a try, and then see about trying your plan as well so I can compare the complexity of the two solutions. =2D-=20 =2Dkeith --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEw4O3eCVWE9/bQJ2R2yIaaQAAABEFAmE3hDQACgkQ2yIaaQAA ABHLnA//Sc5ObmHK4dcNs4U8k7OGPZwDv30LRorWZBK/HsQq3sJ+uMLoZIbzbI9m 2vKnCfMq6iBV9AONCNHly8yKdIasV/a5my0OoJlo8O+W5eOSw8MvXLVqonAVNdtd dHe8kuzxZDOfKIsyRzmKE8r+di9USUsRonzTHqjkMIxBXee6jmGnf4hE326ljKjy dDxouABLVvStdNuB4mM6u/hRs327LSAvqzLjr6qNxi1ueUj1MdDryzieNpAD4HEQ 1jE7a/Tl5ZYf2xe2dUwPlvpem475PDxC3OqF4xRPzkNqgVs+S1OUuCsOn4aIcmdp EC0GThXyZ02nsS8bJpyRNdBbUWoTUpNBYEF3Eg8X/u8ZIXpcgIBVXcnGmcmeNh+r AjM3e0b1Oet3uI5GJLbbJVj/DoZsIYPOHK14xNZAWc+kiVJ+g8pZs6Js0g82sX3g vqa8uxdSQTrfFM1yKczqQU7FoNzVTHooqPQ26qUISG44zvL9Isj47XsQwki0YcYh MhwB/CsZQDobhk2xAiZFd0+IOU1QL7zmcn6YUtvz2zn23n7O52DdSm6hINE6yZDK 8rBRuc3kM1pczrn80qrP9WVEiK32VrwdVogIG5A2Wt1S74T8KIkDE4H7fx2vlkIl HfSbc2g063aHdheaVwR7M+mWoGI8RczaJkdQEbvT4p8Awn/esiA= =shtJ -----END PGP SIGNATURE----- --=-=-=-- 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=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 7607EC433EF for ; Tue, 7 Sep 2021 15:26:40 +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 405C56101C for ; Tue, 7 Sep 2021 15:26:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 405C56101C Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=keithp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=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-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Nwa1oZCBYRjoSbkgaoYTRP2WpxN/3QGbc7666Vj4si0=; b=x8Bsu+7eUBvNGJCUkTXY/BiaKq Ps5feDthUt5mWHe86qO5xg3VA+N4OWkqVvl6EO6NMNXhu38Vk+o5FO0yUfZrdYxfTrhXkEyRJ0zyP 1M6B6lKef9pCw+aY6I/B7lmoJQX1fWktqhRVEsVSXtGX4ZhIRoQaoA6dpypIAov4iQQbN6PRa18L6 UStenHBkJ3CkjEzK4Ii53DO4N0IDWozKG3nofJrNHLm6jIGmzbt/D3aA8xc9WrJRZXaDLFPLN3swU Qv7I6rf8jFDBHw8go8qJC8o8DJXCA31c2DUFgK6lsRpg1U4r1VQxWg0rAPpoCvDRaVvpmzRFldglI N0UBNJVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mNcxq-0042zb-Ly; Tue, 07 Sep 2021 15:24:46 +0000 Received: from home.keithp.com ([63.227.221.253] helo=elaine.keithp.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mNcxm-0042yB-QP for linux-arm-kernel@lists.infradead.org; Tue, 07 Sep 2021 15:24:44 +0000 Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id 9E6CB3F30862; Tue, 7 Sep 2021 08:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1631028255; bh=t7VcNGzEjGyV50+1Ty0iiMDwzQyzAK8kFK85FlnpD+A=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=dDN+Ipk0CqpqNc1QWuC89K5w37dnf4YFJhi/Sf5i+tMFyUHhfWTjfFSdkW/9v0hfD 7/QkMU5Gn+CSLCOS1MIOHtBFjJWErPmm2hAeevhTBqiveNSZLuKcbng2q5st+uZiV/ 4UCVNT3Lj2p12ezWFGYFqcGhyB8K83ebqeVm+cMjafma4rslTJN5w9n5ltYJpvyGdx jVsTbTUCks0GlPA7IVgc8xCmmXJUEXCmHTrfDZUlc7lhBrLOlbIxFxLpGVCLQ9u8ik Wt9Y8AyjWBXj1bRGmB1vmq38e3/kombzcKoULWBvBjaki10res0ssh2rpMpuVg5yxv 1a9+QFsQVhbcQ== X-Virus-Scanned: Debian amavisd-new at keithp.com Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id SnOz81A0WPec; Tue, 7 Sep 2021 08:24:15 -0700 (PDT) Received: from keithp.com (168-103-156-98.tukw.qwest.net [168.103.156.98]) by elaine.keithp.com (Postfix) with ESMTPSA id 0E7C03F30861; Tue, 7 Sep 2021 08:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1631028255; bh=t7VcNGzEjGyV50+1Ty0iiMDwzQyzAK8kFK85FlnpD+A=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=dDN+Ipk0CqpqNc1QWuC89K5w37dnf4YFJhi/Sf5i+tMFyUHhfWTjfFSdkW/9v0hfD 7/QkMU5Gn+CSLCOS1MIOHtBFjJWErPmm2hAeevhTBqiveNSZLuKcbng2q5st+uZiV/ 4UCVNT3Lj2p12ezWFGYFqcGhyB8K83ebqeVm+cMjafma4rslTJN5w9n5ltYJpvyGdx jVsTbTUCks0GlPA7IVgc8xCmmXJUEXCmHTrfDZUlc7lhBrLOlbIxFxLpGVCLQ9u8ik Wt9Y8AyjWBXj1bRGmB1vmq38e3/kombzcKoULWBvBjaki10res0ssh2rpMpuVg5yxv 1a9+QFsQVhbcQ== Received: by keithp.com (Postfix, from userid 1000) id 41E161E6011A; Tue, 7 Sep 2021 08:24:37 -0700 (PDT) From: Keith Packard To: Ard Biesheuvel Cc: Linux Kernel Mailing List , Abbott Liu , Alexander Sverdlin , Andrew Morton , Anshuman Khandual , Arnd Bergmann , Bjorn Andersson , Florian Fainelli , Geert Uytterhoeven , Hartley Sweeten , Jens Axboe , Jian Cai , Joe Perches , Kees Cook , Krzysztof Kozlowski , Linus Walleij , Linux ARM , Manivannan Sadhasivam , Marc Zyngier , Masahiro Yamada , Miguel Ojeda , Mike Rapoport , Nathan Chancellor , Nick Desaulniers , Nicolas Pitre , Rob Herring , Russell King , Thomas Gleixner , Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , Valentin Schneider , Viresh Kumar , "Wolfram Sang (Renesas)" , YiFei Zhu Subject: Re: [PATCH 2/3] ARM: Move thread_info into task_struct (v7 only) In-Reply-To: References: <20210902155429.3987201-1-keithp@keithp.com> <20210904060908.1310204-1-keithp@keithp.com> <20210904060908.1310204-3-keithp@keithp.com> <8735qifcy6.fsf@keithp.com> Date: Tue, 07 Sep 2021 08:24:36 -0700 Message-ID: <874kawcssr.fsf@keithp.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210907_082442_952107_3FD44BC9 X-CRM114-Status: GOOD ( 23.78 ) 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: multipart/mixed; boundary="===============4343223760197247969==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============4343223760197247969== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Ard Biesheuvel writes: > Sure, so it is precisely for that reason that it is better to isolate > changes that can be isolated. I'll go ahead and split this apart then; that is how I did development, after all. > All the time. 'current' essentially never changes value from the POV > of code running in task context, so there is usually no reason to care > about preemption/migration when referring to it. Using per-CPU > variables is what creates the problem here. Thanks for helping me -- I just got the wrong model stuck in my head over the weekend somehow. If I do have this figured out, we should be able to stick the per_cpu_offset value in thread_info and use TPIDRPRW to hold 'current' as code using per_cpu_offset should already be disabling preemption. That should be an easier change than putting a kernel pointer in a user-visible register. > Given that we are already relying on the MP extensions for this > anyway, I personally think that using another thread ID register to > carry 'current' is a reasonable approach as well, since it would also > allow us to get per-task stack protector support into the compiler. > But I would like to hear from some other folks on cc as well. That would be awesome; I assume that doesn't require leaving per_cpu_offset in a thread ID register? In any case, I'll give my plan a try, and then see about trying your plan as well so I can compare the complexity of the two solutions. =2D-=20 =2Dkeith --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEw4O3eCVWE9/bQJ2R2yIaaQAAABEFAmE3hDQACgkQ2yIaaQAA ABHLnA//Sc5ObmHK4dcNs4U8k7OGPZwDv30LRorWZBK/HsQq3sJ+uMLoZIbzbI9m 2vKnCfMq6iBV9AONCNHly8yKdIasV/a5my0OoJlo8O+W5eOSw8MvXLVqonAVNdtd dHe8kuzxZDOfKIsyRzmKE8r+di9USUsRonzTHqjkMIxBXee6jmGnf4hE326ljKjy dDxouABLVvStdNuB4mM6u/hRs327LSAvqzLjr6qNxi1ueUj1MdDryzieNpAD4HEQ 1jE7a/Tl5ZYf2xe2dUwPlvpem475PDxC3OqF4xRPzkNqgVs+S1OUuCsOn4aIcmdp EC0GThXyZ02nsS8bJpyRNdBbUWoTUpNBYEF3Eg8X/u8ZIXpcgIBVXcnGmcmeNh+r AjM3e0b1Oet3uI5GJLbbJVj/DoZsIYPOHK14xNZAWc+kiVJ+g8pZs6Js0g82sX3g vqa8uxdSQTrfFM1yKczqQU7FoNzVTHooqPQ26qUISG44zvL9Isj47XsQwki0YcYh MhwB/CsZQDobhk2xAiZFd0+IOU1QL7zmcn6YUtvz2zn23n7O52DdSm6hINE6yZDK 8rBRuc3kM1pczrn80qrP9WVEiK32VrwdVogIG5A2Wt1S74T8KIkDE4H7fx2vlkIl HfSbc2g063aHdheaVwR7M+mWoGI8RczaJkdQEbvT4p8Awn/esiA= =shtJ -----END PGP SIGNATURE----- --=-=-=-- --===============4343223760197247969== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============4343223760197247969==--