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=-13.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 80D0BC47097 for ; Thu, 3 Jun 2021 09:45:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 668FA613DE for ; Thu, 3 Jun 2021 09:45:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229661AbhFCJrB (ORCPT ); Thu, 3 Jun 2021 05:47:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:57288 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbhFCJq7 (ORCPT ); Thu, 3 Jun 2021 05:46:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622713515; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9K77UXySynClHeo9ATtGF2XuH4wNTDBsul1muCAvTwM=; b=I27E6utm7Uv3QzjlaRw+R4K8y1f9ZmG/Zdlm0IIWZbngzCEn7d/HgBz/8hvN/jsAIzf53P hYS6K/y3Qst4Jc5/wOqMf7nZwQH4ODN30f9wR3PojGguTX7N2L/GFyx4N7y7+YOK+OmI4b ucvzTYLpZh74Vu0cu9MNW2Ya8Ty3i2w= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-434-6YxmiKD8Olyn2IFsOSGqtA-1; Thu, 03 Jun 2021 05:45:14 -0400 X-MC-Unique: 6YxmiKD8Olyn2IFsOSGqtA-1 Received: by mail-ej1-f70.google.com with SMTP id z1-20020a1709068141b02903cd421d7803so1741175ejw.22 for ; Thu, 03 Jun 2021 02:45:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=9K77UXySynClHeo9ATtGF2XuH4wNTDBsul1muCAvTwM=; b=ZoK2PU0GLnW7F5Go8w8Vrbn/egGGoX9uvJuKLylCmRd119MuC4bHzxdL+XugulQ9ub eznoUvB2CA0JQ0t7KPvZog0FOx1vLgGj8xIezSdFzQY7sFgooFur3OxqysvZjnA67HIu hQpujqDlCf0x0/nkzPgQoznUb7c8+D9xKbIHpCxZoGZz7m9zL0Sd2OOKD/USaRclqr9q zhLrPrHUiBQWyMsdSBfvcJbOz7yqCK6pgvVnafGqZn3a4A8X1jNaqdvFvvKLFned1tr7 kF8VzAeezddRS8ojrgedGmeOt4GMTdSJY0tlRF8WNgbRBCGBIHA4VCLPICP2Ufltb6CX lyqg== X-Gm-Message-State: AOAM531lWeklnOAG0K58YHXhS6NSuRdkNhgcLG391JDp5ufV9/og7T7r ZV4E6JdSAINiQBBFJpmAEWLahVl4nvBwr2eFXZLfaz6KiOTQD+OF2Mzsi/F/vfEryDGEBUsiCLB wQdrdzi+Ej751/OLw+U268Bx+ X-Received: by 2002:a50:fe18:: with SMTP id f24mr3271452edt.271.1622713513002; Thu, 03 Jun 2021 02:45:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyurhkoltCn+jnF+TGZdGnn0Y3agunqtJr98jiLXvymFlzFLbc5tnTmdM8vnVODgLTt86X0kQ== X-Received: by 2002:a50:fe18:: with SMTP id f24mr3271436edt.271.1622713512810; Thu, 03 Jun 2021 02:45:12 -0700 (PDT) Received: from x1.bristot.me (host-79-24-6-4.retail.telecomitalia.it. [79.24.6.4]) by smtp.gmail.com with ESMTPSA id w14sm1495617edj.6.2021.06.03.02.45.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Jun 2021 02:45:12 -0700 (PDT) Subject: Re: [PATCH v8 14/19] arm64: exec: Adjust affinity for compat tasks with mismatched 32-bit EL0 To: Will Deacon , linux-arm-kernel@lists.infradead.org Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Catalin Marinas , Marc Zyngier , Greg Kroah-Hartman , Peter Zijlstra , Morten Rasmussen , Qais Yousef , Suren Baghdasaryan , Quentin Perret , Tejun Heo , Johannes Weiner , Ingo Molnar , Juri Lelli , Vincent Guittot , "Rafael J. Wysocki" , Dietmar Eggemann , Valentin Schneider , kernel-team@android.com References: <20210602164719.31777-1-will@kernel.org> <20210602164719.31777-15-will@kernel.org> From: Daniel Bristot de Oliveira Message-ID: <6594fc22-e99e-ee5e-c3ea-fb522e510b46@redhat.com> Date: Thu, 3 Jun 2021 11:45:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210602164719.31777-15-will@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/2/21 6:47 PM, Will Deacon wrote: > 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 > --- [...] > > +#ifdef CONFIG_COMPAT > +int compat_elf_check_arch(const struct elf32_hdr *hdr) > +{ > + if (!system_supports_32bit_el0()) > + return false; > + > + if ((hdr)->e_machine != EM_ARM) > + return false; > + > + if (!((hdr)->e_flags & EF_ARM_EABI_MASK)) > + return false; > + > + /* > + * Prevent execve() of a 32-bit program from a deadline task > + * if the restricted affinity mask would be inadmissible on an > + * asymmetric system. > + */ > + return !static_branch_unlikely(&arm64_mismatched_32bit_el0) || > + task_cpus_dl_admissible(current, system_32bit_el0_cpumask()); > +} > +#endif >From the DL perspective: Reviewed-by: Daniel Bristot de Oliveira Thanks! -- Daniel 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=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 996FDC47096 for ; Thu, 3 Jun 2021 09:47:09 +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 69E0D613C9 for ; Thu, 3 Jun 2021 09:47:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 69E0D613C9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.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:Date: Message-ID:From:References:Cc:To:Subject:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=KqEbodUsFe64c5CIjL/MDgVMTFLa1zvS/dFu8xAN7sw=; b=GeL+SXcZbOoP91/0Ugm6mZ33NO 6HMDZX3j8gzObClBtzG6PFZjnEZ1a0/pL2T6pyJQ7l4tuIO21eyJPym/eOaXArg0kWIPWpvelZw4D ldzUCDmJzRbq/p8ejzdcXecQLk4ibppsj3ulg6vLyqwmTUYnimC4AA9YLi8/vu6TahGpoBRQgY8un WqWUGa3CZ2q2KOx1WXuoTxwIj4vU7xxoYEQAGei12TWcppO9fxkshSb1ZcMFDwsYnm1zc4jor2kph /WzeVny6RmduI6b7UUMZdCkiDDX2N1yypxpvkQHZfLbtVCFUdJAn3Mynv9AY9CqqtZBA4uji9IlwB sjonVrZg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lojuh-007uHq-Ka; Thu, 03 Jun 2021 09:45:19 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lojue-007uGu-Uc for linux-arm-kernel@lists.infradead.org; Thu, 03 Jun 2021 09:45:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622713515; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9K77UXySynClHeo9ATtGF2XuH4wNTDBsul1muCAvTwM=; b=I27E6utm7Uv3QzjlaRw+R4K8y1f9ZmG/Zdlm0IIWZbngzCEn7d/HgBz/8hvN/jsAIzf53P hYS6K/y3Qst4Jc5/wOqMf7nZwQH4ODN30f9wR3PojGguTX7N2L/GFyx4N7y7+YOK+OmI4b ucvzTYLpZh74Vu0cu9MNW2Ya8Ty3i2w= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-434--l_ruUPVPRGxAL4juN-WAg-1; Thu, 03 Jun 2021 05:45:14 -0400 X-MC-Unique: -l_ruUPVPRGxAL4juN-WAg-1 Received: by mail-ed1-f70.google.com with SMTP id s20-20020a0564025214b029038752a2d8f3so2986483edd.2 for ; Thu, 03 Jun 2021 02:45:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=9K77UXySynClHeo9ATtGF2XuH4wNTDBsul1muCAvTwM=; b=QT9KUHGt8eTr9oZOgH+UGv3Ds3PGkwctQ6b9JzbUrK7aYijwlH3Aqnrra3MfK6r3zU 3ouGVdt4FL8DEZ86BuBXGeOWY02NZ5B1AgDv6m/m2iG5UbDa4oqDmXkWp52QBRs15coJ oes0BQQEjunpPR5dXp8S4Af5zBrWTPZ8p3MA+WnAWZuX9ropgumN4CdVbNkMc/RzFa0W FTLxrxk9TMXMu9gWF+O2/oQ1ksZOu1m/ffvuuPKqDRBl8rsWiJ3pHA4RKmxQgRA1/Pgz +WnnBTNd4bJA7w2dTnlKWb/ehhTQBbyUcwWWbnEvGBRlVXRb67YaQcyDi42f04jJCLyR i7pQ== X-Gm-Message-State: AOAM533eJ3uD1Boold5jqSTG9MHsfpKr8NJ4g8ob/CPIjqzHdYVh+3xC SpYH0TaqEBcg3rzGjuXHuMYpOfmALesGcf+s/J+t7akPk6vsL09SlgVczFF8pmcWP8uWBQHUy/O Pjyu9qvyYuZxyOm3RBejBTrNpxxZL0OWP8Sg= X-Received: by 2002:a50:fe18:: with SMTP id f24mr3271454edt.271.1622713513003; Thu, 03 Jun 2021 02:45:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyurhkoltCn+jnF+TGZdGnn0Y3agunqtJr98jiLXvymFlzFLbc5tnTmdM8vnVODgLTt86X0kQ== X-Received: by 2002:a50:fe18:: with SMTP id f24mr3271436edt.271.1622713512810; Thu, 03 Jun 2021 02:45:12 -0700 (PDT) Received: from x1.bristot.me (host-79-24-6-4.retail.telecomitalia.it. [79.24.6.4]) by smtp.gmail.com with ESMTPSA id w14sm1495617edj.6.2021.06.03.02.45.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Jun 2021 02:45:12 -0700 (PDT) Subject: Re: [PATCH v8 14/19] arm64: exec: Adjust affinity for compat tasks with mismatched 32-bit EL0 To: Will Deacon , linux-arm-kernel@lists.infradead.org Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Catalin Marinas , Marc Zyngier , Greg Kroah-Hartman , Peter Zijlstra , Morten Rasmussen , Qais Yousef , Suren Baghdasaryan , Quentin Perret , Tejun Heo , Johannes Weiner , Ingo Molnar , Juri Lelli , Vincent Guittot , "Rafael J. Wysocki" , Dietmar Eggemann , Valentin Schneider , kernel-team@android.com References: <20210602164719.31777-1-will@kernel.org> <20210602164719.31777-15-will@kernel.org> From: Daniel Bristot de Oliveira Message-ID: <6594fc22-e99e-ee5e-c3ea-fb522e510b46@redhat.com> Date: Thu, 3 Jun 2021 11:45:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210602164719.31777-15-will@kernel.org> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=bristot@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210603_024517_102321_437FE471 X-CRM114-Status: GOOD ( 19.08 ) 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 6/2/21 6:47 PM, Will Deacon wrote: > 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 > --- [...] > > +#ifdef CONFIG_COMPAT > +int compat_elf_check_arch(const struct elf32_hdr *hdr) > +{ > + if (!system_supports_32bit_el0()) > + return false; > + > + if ((hdr)->e_machine != EM_ARM) > + return false; > + > + if (!((hdr)->e_flags & EF_ARM_EABI_MASK)) > + return false; > + > + /* > + * Prevent execve() of a 32-bit program from a deadline task > + * if the restricted affinity mask would be inadmissible on an > + * asymmetric system. > + */ > + return !static_branch_unlikely(&arm64_mismatched_32bit_el0) || > + task_cpus_dl_admissible(current, system_32bit_el0_cpumask()); > +} > +#endif >From the DL perspective: Reviewed-by: Daniel Bristot de Oliveira Thanks! -- Daniel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel