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.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 F2B9AC433B4 for ; Tue, 18 May 2021 09:47:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD51A61396 for ; Tue, 18 May 2021 09:47:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242731AbhERJs4 (ORCPT ); Tue, 18 May 2021 05:48:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:49438 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241211AbhERJsz (ORCPT ); Tue, 18 May 2021 05:48:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9300961364; Tue, 18 May 2021 09:47:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621331257; bh=+aD6s2CW64ddOEmGtbEeJlNomwFr3AXy1aAqW/dipgs=; h=From:To:Cc:Subject:Date:From; b=IYUwwCHhX1Vf8oYpxNpGf6++BqWm/NS7uPnVByLvNooP/itpOe8BH3CNlb2E/8xix 6CNlnWRAebrcFkubh/0Tg4elcqAcDFHvEE6e77DRh5+e/TlF3SEdelPBLew/iOTQSu n6K45hDso4SuXq8lhctYBxP1qx90eAi9LKd2W5SMNVYsfaHOG2O9H0NQDR7NI51OCg ujbtekWjzE6jD2AVEZd7zqYhdB7zKEGAxReOFNe9kPxIdxXJhYaqg4EsqkE3j9BQje Vh3nQe5lxuAd2nfDPPpU/iAOZAJ09v/wh8fPDI6pFt6u0d4yWoKw86zVw6XEv/dkJD mfVIa+IaPqUlw== From: Will Deacon To: linux-arm-kernel@lists.infradead.org Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Will Deacon , Catalin Marinas , Marc Zyngier , Greg Kroah-Hartman , Peter Zijlstra , Morten Rasmussen , Qais Yousef , Suren Baghdasaryan , Quentin Perret , Tejun Heo , Li Zefan , Johannes Weiner , Ingo Molnar , Juri Lelli , Vincent Guittot , "Rafael J. Wysocki" , kernel-team@android.com Subject: [PATCH v6 00/21] Add support for 32-bit tasks on asymmetric AArch32 systems Date: Tue, 18 May 2021 10:47:04 +0100 Message-Id: <20210518094725.7701-1-will@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi folks, This is the long-awaited v6 of these patches which I last posted at the end of last year: v1: https://lore.kernel.org/r/20201027215118.27003-1-will@kernel.org v2: https://lore.kernel.org/r/20201109213023.15092-1-will@kernel.org v3: https://lore.kernel.org/r/20201113093720.21106-1-will@kernel.org v4: https://lore.kernel.org/r/20201124155039.13804-1-will@kernel.org v5: https://lore.kernel.org/r/20201208132835.6151-1-will@kernel.org There was also a nice LWN writeup in case you've forgotten what this is about: https://lwn.net/Articles/838339/ It's taken me a while to get a v6 of this together, partly due to addressing the review feedback on v5, but also because this has now seen testing on real hardware which threw up some surprises in suspend/resume, SCHED_DEADLINE and compat hwcap reporting. Thanks to Quentin for helping me to debug those issues. The aim of this series is to allow 32-bit ARM applications to run on arm64 SoCs where not all of the CPUs support the 32-bit instruction set. Unfortunately, such SoCs are real and will continue to be productised over the next few years at least. I can assure you that I'm not just doing this for fun. Changes in v6 include: * Save/restore the affinity mask across execve() to 32-bit and back to 64-bit again. * Allow 32-bit deadline tasks, but skip straight to fallback path when determining new affinity mask on execve(). * Fixed resume-from-suspend path when the resuming CPU is 64-bit-only by deferring wake-ups for 32-bit tasks until the secondary CPUs are back online. * Bug fixes (compat hwcaps, memory leak, cpuset fallback path). * Documentation for arm64. It's in the divisive .rst format, but please take a look anyway! I'm pretty happy with this now and it seems to do the right thing, although the new patches in this revision would certainly benefit from review. Series based on v5.13-rc1. Cheers, Will Cc: Catalin Marinas Cc: Marc Zyngier Cc: Greg Kroah-Hartman Cc: Peter Zijlstra Cc: Morten Rasmussen Cc: Qais Yousef Cc: Suren Baghdasaryan Cc: Quentin Perret Cc: Tejun Heo Cc: Li Zefan Cc: Johannes Weiner Cc: Ingo Molnar Cc: Juri Lelli Cc: Vincent Guittot Cc: "Rafael J. Wysocki" Cc: kernel-team@android.com --->8 Will Deacon (21): arm64: cpuinfo: Split AArch32 registers out into a separate struct arm64: Allow mismatched 32-bit EL0 support KVM: arm64: Kill 32-bit vCPUs on systems with mismatched EL0 support arm64: Kill 32-bit applications scheduled on 64-bit-only CPUs arm64: Advertise CPUs capable of running 32-bit applications in sysfs sched: Introduce task_cpu_possible_mask() to limit fallback rq selection cpuset: Don't use the cpu_possible_mask as a last resort for cgroup v1 cpuset: Honour task_cpu_possible_mask() in guarantee_online_cpus() sched: Reject CPU affinity changes based on task_cpu_possible_mask() sched: Introduce task_struct::user_cpus_ptr to track requested affinity sched: Split the guts of sched_setaffinity() into a helper function sched: Allow task CPU affinity to be restricted on asymmetric systems sched: Admit forcefully-affined tasks into SCHED_DEADLINE freezer: Add frozen_or_skipped() helper function sched: Defer wakeup in ttwu() for unschedulable frozen tasks arm64: Implement task_cpu_possible_mask() arm64: exec: Adjust affinity for compat tasks with mismatched 32-bit EL0 arm64: Prevent offlining first CPU with 32-bit EL0 on mismatched system arm64: Hook up cmdline parameter to allow mismatched 32-bit EL0 arm64: Remove logic to kill 32-bit tasks on 64-bit-only cores Documentation: arm64: describe asymmetric 32-bit support .../ABI/testing/sysfs-devices-system-cpu | 9 + .../admin-guide/kernel-parameters.txt | 11 + Documentation/arm64/asymmetric-32bit.rst | 149 ++++++++ Documentation/arm64/index.rst | 1 + arch/arm64/include/asm/cpu.h | 44 +-- arch/arm64/include/asm/cpucaps.h | 3 +- arch/arm64/include/asm/cpufeature.h | 8 +- arch/arm64/include/asm/mmu_context.h | 13 + arch/arm64/kernel/cpufeature.c | 227 +++++++++--- arch/arm64/kernel/cpuinfo.c | 53 +-- arch/arm64/kernel/process.c | 21 +- arch/arm64/kvm/arm.c | 11 +- include/linux/cpuset.h | 3 +- include/linux/freezer.h | 6 + include/linux/mmu_context.h | 8 + include/linux/sched.h | 15 + init/init_task.c | 1 + kernel/cgroup/cpuset.c | 45 ++- kernel/fork.c | 2 + kernel/freezer.c | 10 +- kernel/hung_task.c | 4 +- kernel/sched/core.c | 323 ++++++++++++++---- kernel/sched/sched.h | 1 + 23 files changed, 781 insertions(+), 187 deletions(-) create mode 100644 Documentation/arm64/asymmetric-32bit.rst -- 2.31.1.751.gd2f1c929bd-goog 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=-12.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 408D7C433B4 for ; Tue, 18 May 2021 09:50:48 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 BB3F8613E3 for ; Tue, 18 May 2021 09:50:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB3F8613E3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=sDHDK8T+AolFRsaK3sDpAeQX+9EWPYrAoh+6wrThfPA=; b=S88eDNziw0lT2xptUmaq46gcWa o0ACcS1UHtFI5z4piu+0w84Mw5OxNKrPP721CevSdEFSeUUG/L7xtGvaTjOArMjY7nkabYoh7OVys D9SJWTAc5suXw6qTQLBv2gqFAFe/EJkXhNkNRDXIb7280s4O9OjLjXeMbI3qCSSjqOfQvxLojA/vD GbFjGrVB1bOiHqRBiQEsvX/Gh+qicsAZKClMhzu6mhx4wkVSJPMr4ATV0yNWWGPB/uJAqT8PasfRe 9GXpiH+9nYyZoRQnkX04SrF+Kq2pUhJM5RT8SWjuJ+HW1hga/W16/umPfagRbOkyaT005yTgu5nRF MNh4avDg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liwLE-000E1d-4p; Tue, 18 May 2021 09:48:46 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liwKD-000Djq-Ks for linux-arm-kernel@desiato.infradead.org; Tue, 18 May 2021 09:47:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=xWWe5V4uC8Q0+fIO9eGq7n+QpTVNhbxJ4xWT+usKjWI=; b=3g2WEDvAEctAC1FnIhSaC9oDz4 Z1DdKZyd/OFppTP41wfZ1r4CuI8NK3u+6Qf9CLFUF8SZOL7myxb6dybip09RmBw1YggccpLPatJwR wqP0jZevgbRysv0WP3zaJGicoj89jzbFvrsbBruJfP7i+Kw+MkpQMLIsbT3njzU5JFrNXCXfdC5zb MVyiX/mH5B0Nee7Gw6RHaXrDv6X0A7rvFAZ3ItYR2hA7wBQDA50yu/wUvjIarBawHZsqXrFwdvb0q T5p5J+o3KOB9wYLheK1XhTs66r7MafwJ9UVCAZyp1XjtA7htGeXpc2a3lTqgqaVQ8iqyJ3+/d9DqX /5iale2A==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liwKA-00EWYe-6B for linux-arm-kernel@lists.infradead.org; Tue, 18 May 2021 09:47:39 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9300961364; Tue, 18 May 2021 09:47:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621331257; bh=+aD6s2CW64ddOEmGtbEeJlNomwFr3AXy1aAqW/dipgs=; h=From:To:Cc:Subject:Date:From; b=IYUwwCHhX1Vf8oYpxNpGf6++BqWm/NS7uPnVByLvNooP/itpOe8BH3CNlb2E/8xix 6CNlnWRAebrcFkubh/0Tg4elcqAcDFHvEE6e77DRh5+e/TlF3SEdelPBLew/iOTQSu n6K45hDso4SuXq8lhctYBxP1qx90eAi9LKd2W5SMNVYsfaHOG2O9H0NQDR7NI51OCg ujbtekWjzE6jD2AVEZd7zqYhdB7zKEGAxReOFNe9kPxIdxXJhYaqg4EsqkE3j9BQje Vh3nQe5lxuAd2nfDPPpU/iAOZAJ09v/wh8fPDI6pFt6u0d4yWoKw86zVw6XEv/dkJD mfVIa+IaPqUlw== From: Will Deacon To: linux-arm-kernel@lists.infradead.org Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Will Deacon , Catalin Marinas , Marc Zyngier , Greg Kroah-Hartman , Peter Zijlstra , Morten Rasmussen , Qais Yousef , Suren Baghdasaryan , Quentin Perret , Tejun Heo , Li Zefan , Johannes Weiner , Ingo Molnar , Juri Lelli , Vincent Guittot , "Rafael J. Wysocki" , kernel-team@android.com Subject: [PATCH v6 00/21] Add support for 32-bit tasks on asymmetric AArch32 systems Date: Tue, 18 May 2021 10:47:04 +0100 Message-Id: <20210518094725.7701-1-will@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210518_024738_287851_EEDE68E7 X-CRM114-Status: GOOD ( 20.57 ) 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 Hi folks, This is the long-awaited v6 of these patches which I last posted at the end of last year: v1: https://lore.kernel.org/r/20201027215118.27003-1-will@kernel.org v2: https://lore.kernel.org/r/20201109213023.15092-1-will@kernel.org v3: https://lore.kernel.org/r/20201113093720.21106-1-will@kernel.org v4: https://lore.kernel.org/r/20201124155039.13804-1-will@kernel.org v5: https://lore.kernel.org/r/20201208132835.6151-1-will@kernel.org There was also a nice LWN writeup in case you've forgotten what this is about: https://lwn.net/Articles/838339/ It's taken me a while to get a v6 of this together, partly due to addressing the review feedback on v5, but also because this has now seen testing on real hardware which threw up some surprises in suspend/resume, SCHED_DEADLINE and compat hwcap reporting. Thanks to Quentin for helping me to debug those issues. The aim of this series is to allow 32-bit ARM applications to run on arm64 SoCs where not all of the CPUs support the 32-bit instruction set. Unfortunately, such SoCs are real and will continue to be productised over the next few years at least. I can assure you that I'm not just doing this for fun. Changes in v6 include: * Save/restore the affinity mask across execve() to 32-bit and back to 64-bit again. * Allow 32-bit deadline tasks, but skip straight to fallback path when determining new affinity mask on execve(). * Fixed resume-from-suspend path when the resuming CPU is 64-bit-only by deferring wake-ups for 32-bit tasks until the secondary CPUs are back online. * Bug fixes (compat hwcaps, memory leak, cpuset fallback path). * Documentation for arm64. It's in the divisive .rst format, but please take a look anyway! I'm pretty happy with this now and it seems to do the right thing, although the new patches in this revision would certainly benefit from review. Series based on v5.13-rc1. Cheers, Will Cc: Catalin Marinas Cc: Marc Zyngier Cc: Greg Kroah-Hartman Cc: Peter Zijlstra Cc: Morten Rasmussen Cc: Qais Yousef Cc: Suren Baghdasaryan Cc: Quentin Perret Cc: Tejun Heo Cc: Li Zefan Cc: Johannes Weiner Cc: Ingo Molnar Cc: Juri Lelli Cc: Vincent Guittot Cc: "Rafael J. Wysocki" Cc: kernel-team@android.com --->8 Will Deacon (21): arm64: cpuinfo: Split AArch32 registers out into a separate struct arm64: Allow mismatched 32-bit EL0 support KVM: arm64: Kill 32-bit vCPUs on systems with mismatched EL0 support arm64: Kill 32-bit applications scheduled on 64-bit-only CPUs arm64: Advertise CPUs capable of running 32-bit applications in sysfs sched: Introduce task_cpu_possible_mask() to limit fallback rq selection cpuset: Don't use the cpu_possible_mask as a last resort for cgroup v1 cpuset: Honour task_cpu_possible_mask() in guarantee_online_cpus() sched: Reject CPU affinity changes based on task_cpu_possible_mask() sched: Introduce task_struct::user_cpus_ptr to track requested affinity sched: Split the guts of sched_setaffinity() into a helper function sched: Allow task CPU affinity to be restricted on asymmetric systems sched: Admit forcefully-affined tasks into SCHED_DEADLINE freezer: Add frozen_or_skipped() helper function sched: Defer wakeup in ttwu() for unschedulable frozen tasks arm64: Implement task_cpu_possible_mask() arm64: exec: Adjust affinity for compat tasks with mismatched 32-bit EL0 arm64: Prevent offlining first CPU with 32-bit EL0 on mismatched system arm64: Hook up cmdline parameter to allow mismatched 32-bit EL0 arm64: Remove logic to kill 32-bit tasks on 64-bit-only cores Documentation: arm64: describe asymmetric 32-bit support .../ABI/testing/sysfs-devices-system-cpu | 9 + .../admin-guide/kernel-parameters.txt | 11 + Documentation/arm64/asymmetric-32bit.rst | 149 ++++++++ Documentation/arm64/index.rst | 1 + arch/arm64/include/asm/cpu.h | 44 +-- arch/arm64/include/asm/cpucaps.h | 3 +- arch/arm64/include/asm/cpufeature.h | 8 +- arch/arm64/include/asm/mmu_context.h | 13 + arch/arm64/kernel/cpufeature.c | 227 +++++++++--- arch/arm64/kernel/cpuinfo.c | 53 +-- arch/arm64/kernel/process.c | 21 +- arch/arm64/kvm/arm.c | 11 +- include/linux/cpuset.h | 3 +- include/linux/freezer.h | 6 + include/linux/mmu_context.h | 8 + include/linux/sched.h | 15 + init/init_task.c | 1 + kernel/cgroup/cpuset.c | 45 ++- kernel/fork.c | 2 + kernel/freezer.c | 10 +- kernel/hung_task.c | 4 +- kernel/sched/core.c | 323 ++++++++++++++---- kernel/sched/sched.h | 1 + 23 files changed, 781 insertions(+), 187 deletions(-) create mode 100644 Documentation/arm64/asymmetric-32bit.rst -- 2.31.1.751.gd2f1c929bd-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel