Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp9384421rwp; Thu, 20 Jul 2023 04:17:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlE+kbqm+HAQOC0tNzbLafPlQnpSk8Yg43DmFz1V0xAusVeUmfRup7oPc7Uph61/1FKqkfYh X-Received: by 2002:a17:902:b095:b0:1b8:b3dc:bf82 with SMTP id p21-20020a170902b09500b001b8b3dcbf82mr4454416plr.69.1689851846292; Thu, 20 Jul 2023 04:17:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689851846; cv=none; d=google.com; s=arc-20160816; b=OJYhvXYhIfwPRwyvyNQnlaUQ+LqUwNO6LZ+JkzXkXpYe1sm+4x6htClGpQvqpwu+Gb w+/964gp5Q4DhRTKH1MYknrVikJ533haphRoJ1r+otyVVVdjenPoXoZFUYHcRy2TJvif ZxxarRWUHb0o9p3DyQ19WvcuQi52KKk5IYZxE3886DtR/eTbvcoxWyIuKcez2uSZcRPC O8SSbX5kGY+DcmxBvhuxSBwXh5UtcKA+VhNy5sHcBEHRNLSPbNwtDGAv6QPD67yULI6V TgoXdAyPO9wx3ULIy1xf1ze0jj4LYlknDgYeLjpAoKu5AC/A35dW/VrRRuthFw/LubhJ 86Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=13Mgcvi+6HYyz+zCweJGFwgh1suN9dvzSUhhjYcSMdg=; fh=1ei93vRHg2a4tOjcFnsADpmGEhAh36OgZx7IEzdBZvM=; b=mTky/s+W0WHs8sN/+XEpLTZbtDKEDeJJ8cZiExRsSx3KCwp9w79rCVJaNqTCHL+XIE cOBHxsHXxn8/VnqTTdwLIXdDZ0hgadpfFarGgpauYjs+92+ThS3ajaKjGdM+jdOmRVW1 OuETwTLWp9XN8YqpyYvvDOptUrMZxwCrjE9OiDLjGWJXlXmpM6O5WdHR176ytibAlBd1 KTL/gILCQqlFxbffd8fdZBLGi0JnsfWxV/EnBoP16/SNvq+ie7/zMU7cYxNiTFOgbNJc 1tEi2lOylqxdUOpBu0dxhs+j0Iu6hOLmQmT4O4J7/IQfAs/0vrUkpJdDRdEHKAeZDC7M SOfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X2kSefCs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l19-20020a170902f69300b001b8971cb96asi697757plg.601.2023.07.20.04.17.14; Thu, 20 Jul 2023 04:17:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X2kSefCs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231230AbjGTKwr (ORCPT + 99 others); Thu, 20 Jul 2023 06:52:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230218AbjGTKwo (ORCPT ); Thu, 20 Jul 2023 06:52:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A53A2173A; Thu, 20 Jul 2023 03:52:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 35CFA61A04; Thu, 20 Jul 2023 10:52:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 053B3C433C8; Thu, 20 Jul 2023 10:52:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689850361; bh=PiRPsNTu3ZoxabFGwoYJ4bs4XlF9WqCHpONj7mkDnk8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=X2kSefCsQUr6rv7Myphpg5jQl+JDzG9RNrwiQWlrGbNOWMqhge0LNb/s/yo4kA/d7 vQl+7zWRcyUzfZzxlnUyCBmJGH+8QIO1K9H3S0gRUfSdtnxp1dpqHEXR4wksJbyCFG nUFlC8RsVGkMl1J7l/k6sa7PzQSH/ydMk42obYYYrs6Wbdxikzu186hE0wpsZjkZwX JG9HfU3rzvh7xVWJAFQYBtHMT8afV3bksmMojC7nF+QXMpA7HhOJRi+bwGysZjdVc3 KDcQXIL1uPdd6ekjKDhNL8SY18kX1xMnHdGEpL7jaubKiOOOoBRdSX5KRddhNXendO KweixedEavBsQ== Date: Thu, 20 Jul 2023 11:52:36 +0100 From: Will Deacon To: Mark Brown Cc: Catalin Marinas , Shuah Khan , David Spickett , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH 1/3] arm64/fpsimd: Ensure SME storage is allocated after SVE VL changes Message-ID: <20230720105235.GD11034@willie-the-truck> References: <20230713-arm64-fix-sve-sme-vl-change-v1-0-129dd8611413@kernel.org> <20230713-arm64-fix-sve-sme-vl-change-v1-1-129dd8611413@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230713-arm64-fix-sve-sme-vl-change-v1-1-129dd8611413@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 13, 2023 at 09:06:04PM +0100, Mark Brown wrote: > When we reconfigure the SVE vector length we discard the backing storage > for the SVE vectors and then reallocate on next SVE use, leaving the SME > specific state alone. This means that we do not enable SME traps if they > were already disabled. That means that userspace code can enter streaming > mode without trapping, putting the task in a state where if we try to save > the state of the task we will fault. > > Since the ABI does not specify that changing the SVE vector length disturbs > SME state, and since SVE code may not be aware of SME code in the process, > we shouldn't simply discard any ZA state. Instead immediately reallocate > the storage for SVE if SME is active, and disable SME if we change the SVE > vector length while there is no SME state active. What is the advantage of keep the old behaviour in this case? In other words, if it's acceptable to reallocate the state when SME is active, why not just reallocate in all cases? Will