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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 F1E24C433ED for ; Tue, 18 May 2021 10:08:45 +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 836DA61185 for ; Tue, 18 May 2021 10:08:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 836DA61185 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:References:In-Reply-To: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:List-Owner; bh=rxFmdFHVatO5c1VVmoORm4Jy4UmWStTjuk+K+0NHlR8=; b=pL1N8rJfzHTRzvBRX5mlt2qcp 3YaX5tk955lCbK6wgU+yqoNG5RMeaH7ru/boI4pyHEQ83rv6CVeB+3CbwIhO/wN64uv6WCVIBxlPU Vbt6Db43Eb7EurBVQpRkwNL1fLWCX4MgJe+GzK6SGAW4Lg9AKEzHMjaD76hq/1JHQx1T179aP8gTD eGsiAA+KsdmBUgfiEk8tknsq/kOt8bejykAJ/K2AQdi5YoAWKn0LJdmdWGH45BnBlT7UAxoQs2JU+ /gJ9aqC8h5SSbiaXEo/OwuE1NsT9mYCKbwNMQLV+VnjlKUAunpAlqE4mKCqWOdTSkWE9h7PZYeMRh ZumxEZGCA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liwcv-000HQd-23; Tue, 18 May 2021 10:07:01 +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 1liwLB-000E2E-77 for linux-arm-kernel@desiato.infradead.org; Tue, 18 May 2021 09:48: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:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=21zMtIdWAx7slZJEppOPAVloi7y0XLQyP0p6eiABDQg=; b=CXRNCwRHY0cBDp4o/QD8cIuLuf lO3n+WkJZ/dZyU0jNc3c0Z+HzSHc71OMwo1YPDgqlvPHa4E+x4Qjf6Ywf6XWTVHOf3GLY31GZ/rQT 2xjqOT+nbGrVXPlpNL59Z9a+i6OTaz3649bFQs3vfpkcHYyKuGreqnOmH0DXshuuz7jOZ3b7QSkpf G0ODR0mPqqnTsFQikZajlyiCcby1Z1B4SC8eut97wM874DRDBQxGxcUsLSKT3tR7vXmz9636Rye5j LISzifru8W+mrKCUfSfCiS6gWLvmd/1GNGRpyYUqXE4XEhwGCi1ocLJ4APQAdyTz8jNtzTvsB2agS zCvQE8tA==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liwL8-00EWmU-Kd for linux-arm-kernel@lists.infradead.org; Tue, 18 May 2021 09:48:39 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3E50961400; Tue, 18 May 2021 09:48:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621331318; bh=R9BW6P5F0BMcxqhawbpZj55WsxoJwynPUjScPCDvTIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DHYBKJslYl+OETsyFh81LkpiXQ1cFVBDLzO/naT40uQr2B1dNxMIsDbm5QRs9oU2Z S704c6CqM37DEqMAX0U1NLMEWmSGkBhw5PpD5NpFNbIGNQ3riHGvsT8egS7XIvaRYc ddfJGNtVY1A3jNpKyKyqog2WD5Q8DJX9RdW2aVHD2GoCAvv+3AA1rEkASemwoWStaC STSqemDuneUVF9rEaqO9Azitdtec7reffxVPEc8srAEWY16QDZHqSLl5ly02jgPuPx I/jsjzw8Vp6IGqYqyJGRJLNXDL35IPBuaz+TLXET7FpPkHE7OAVtibCRod2500RmUR LwPBykiMdhBBQ== 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 17/21] arm64: exec: Adjust affinity for compat tasks with mismatched 32-bit EL0 Date: Tue, 18 May 2021 10:47:21 +0100 Message-Id: <20210518094725.7701-18-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210518094725.7701-1-will@kernel.org> References: <20210518094725.7701-1-will@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210518_024838_714955_C669A5C2 X-CRM114-Status: GOOD ( 14.80 ) 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 When exec'ing a 32-bit task on a system with mismatched support for 32-bit EL0, try to ensure that it starts life on a CPU that can actually run it. Similarly, when exec'ing a 64-bit task on such a system, try to restore the old affinity mask if it was previously restricted. Reviewed-by: Quentin Perret Signed-off-by: Will Deacon --- arch/arm64/kernel/process.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index f4a91bf1ce0c..8e0da06c4e77 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -647,8 +647,22 @@ void arch_setup_new_exec(void) if (is_compat_task()) { mmflags = MMCF_AARCH32; - if (static_branch_unlikely(&arm64_mismatched_32bit_el0)) + + /* + * Restrict the CPU affinity mask for a 32-bit task so that + * it contains only 32-bit-capable CPUs. + * + * From the perspective of the task, this looks similar to + * what would happen if the 64-bit-only CPUs were hot-unplugged + * at the point of execve(), although we try a bit harder to + * honour the cpuset hierarchy. + */ + if (static_branch_unlikely(&arm64_mismatched_32bit_el0)) { + force_compatible_cpus_allowed_ptr(current); set_tsk_thread_flag(current, TIF_NOTIFY_RESUME); + } + } else if (static_branch_unlikely(&arm64_mismatched_32bit_el0)) { + relax_compatible_cpus_allowed_ptr(current); } current->mm->context.flags = mmflags; -- 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