Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp636397rdb; Tue, 23 Jan 2024 09:56:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IHB+DECUT2ldfy7tG2AyQkHmLUIlkW4HkMgKsnzaqYHAoT8JvZDHhyQjQEtzshgGuou8Bze X-Received: by 2002:a05:6a00:ad1:b0:6da:e711:7836 with SMTP id c17-20020a056a000ad100b006dae7117836mr4106979pfl.54.1706032594004; Tue, 23 Jan 2024 09:56:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706032593; cv=pass; d=google.com; s=arc-20160816; b=A46l6lb1PI5Bh+L2KQOob+g1xeCA1tiugh5OB2CtRf7Lb7aiHHMCSlJoW2oH67WfQE JYXzeja6uwLsO817+WxcyQqFV78ZB7zGFPNbhAzLRpwsKAbU4yfLWIlUI/HcDnLm5goT eFrK3vBUeB0IC1QuEiDpZVc/elY/8USC5gDVVVBJPzT0iBgsXei67ImICFBXgCcQovBi BX5flzw3JMCt6mDicVQDhOYVHVBsFwcwFKKALZwXehys1FH1hm3YGFg8AgdX+ePAhQvT syujuAekK6xus/4P39ZUAgyiX6TJbcsWxpmtXKKo51H1G8yUfDJvkhBUaNQF30ftdkzv XdWg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=lTKUPMcGwrQs4zFRBwDyeLA9YnAEPlhbPU6gLY0U7UA=; fh=uYUdXSypgvEjVdoPV0cPDvuseGbP+aWlrBghwZwQ+i0=; b=vt98d1tVO1MWHnWLokOas/vGFSWKF2sRMJ0hQAYm5l7TVbIL18BkIAMfAuIOAa9fkA ltZQlfZSi5jven77+kkjPj2pPggHfM67N7s3GSkjLgFivi7o8c4cVnU30YwZv/Oj71Sm uMyWpjxK53Z1ys4DMhHE++V0LvDvFYlZPDWhzQEVoml1BXUlP3/TTnLa1a/svTH/keU5 Z14dMCopDCpftyY8Ylnb5ue2esRfNfIzW5thDJsIIwm4JhcoFc+1Zep1uXr5AY+WYMDE OYE0VbixWw+ws/AdAc3KDa3x92aRkho0FkMBj46t9U2HdjUGu+21JSENe/AvscSAnuDx VCyA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-35827-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35827-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id f1-20020a63dc41000000b005be3683ec6asi10218016pgj.184.2024.01.23.09.56.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 09:56:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35827-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-35827-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35827-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 26D5928A737 for ; Tue, 23 Jan 2024 17:54:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4CD657F7F9; Tue, 23 Jan 2024 17:54:24 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8D9FA664C4; Tue, 23 Jan 2024 17:54:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706032463; cv=none; b=OPVPTHt3yGJ6I27o4bLwq2AHppUtvRGv5SM350gqClFGgul89EBhT1DpbQ2QbrQxF6RvfRRiAD09c5bK+VEElHVMp2r2eWm6YFfXqtkrQwr5kVWHue9dUUlPNXeE1bM8cX64u6zt90UDXFCZbOpkTfVWgMUjtyXOd5heOb+tXTQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706032463; c=relaxed/simple; bh=EmbDpOX7soO/jTlAEEcGlSi8sSSt71tWrUUfP+zx2vY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MpEn8/YQJK6edYnNTtN5yIi15ThvFbkQnGlMLQH4zwB3GrLCNsf8d4/8iNh4pnvxAwZIXXykmhXCBy+i4qTriLEj6Tl2bQkgSZgID5hC6NhC3y5qsQB+NFOfs7mP6CvUTYI/J6PBy8WW6ZtPy827naBavUO4p9gjpai6MVdaV+k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 312061FB; Tue, 23 Jan 2024 09:55:06 -0800 (PST) Received: from e133380.arm.com (e133380.arm.com [10.1.197.58]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CD4B73F762; Tue, 23 Jan 2024 09:54:19 -0800 (PST) Date: Tue, 23 Jan 2024 17:54:17 +0000 From: Dave Martin To: Mark Brown Cc: Catalin Marinas , Will Deacon , Jonathan Corbet , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Edmund Grimley-Evans Subject: Re: [PATCH 1/4] arm64/sve: Remove bitrotted comment about syscall behaviour Message-ID: References: <20240122-arm64-sve-sme-doc-v1-0-3d492e45265b@kernel.org> <20240122-arm64-sve-sme-doc-v1-1-3d492e45265b@kernel.org> <991d84b4-e184-4fd6-900f-601f8c31d518@sirena.org.uk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <991d84b4-e184-4fd6-900f-601f8c31d518@sirena.org.uk> On Tue, Jan 23, 2024 at 05:31:58PM +0000, Mark Brown wrote: > On Tue, Jan 23, 2024 at 03:44:23PM +0000, Dave Martin wrote: > > On Mon, Jan 22, 2024 at 08:41:51PM +0000, Mark Brown wrote: > > > When we documented that we always clear state not shared with FPSIMD we > > > Where / when? > > In the document that is being modified when it was written. Ah, right, I see this: d09ee410a3c3 ("arm64/sve: Document our actual ABI for clearing registers on syscall") where the zeroing is made explicit. > > > > -* In practice the affected registers/bits will be preserved or will be replaced > > > - with zeros on return from a syscall, but userspace should not make > > > - assumptions about this. The kernel behaviour may vary on a case-by-case > > > - basis. > > > This was originally an intentionally conservative statement, to allow > > the kernel the flexibility to relax the register zeroing behaviour in > > the future. It would have permitted not always disabling a task's SVE > > across a syscall, for example. There were some concerns about security > > and testability that meant that we didn't use this flexibility to begin > > with. > > > If we are making an irrevocable commitment not to use this flexibility > > ever, then this comment can go, but if we're not totally sure then I > > think it would be harmless to keep it (?) > > I think everyone except for Catalin had felt that the original > discussion had concluded that there was a commitment to always clear the > non-shared bits and was disappointed to learn that the documentation > said otherwise. When I tried to take advantage of this as part of > optimising the system call overhead for SVE there were eventually > complaints. > > > (Feel free to point me to the relevant past discussion that I may have > > missed.) > > See the discussion on my syscall optimisation series: > > https://lore.kernel.org/all/20220620124158.482039-8-broonie@kernel.org/ I think my excuse would be that this was consciously left unresolved when SVE originally went upstream: the kernel played safe by always zeroing the bits, while userspace was told not to rely on this always happening in future. If the decision has effectively now been made to close the door permanently those optimisations, then I guess it makes sense to clean up the documentation to be as consistent as possible. I still feel that it is iffy practice for userspace to rely on the extra bits being zeroed -- I think the architecture hides this guarantee anyway whenever you go through a function call confirming to the regular procedure call standard (including the syscall wrappers). But there may not be a lot of point trying to put people off if we can't force them not to rely on it. Cheers ---Dave