Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp266928rdh; Wed, 7 Feb 2024 04:24:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IEoH4koyRLPuhu0x7rbK4Kygqfgs4+a3thlFxUapFX/gk7Gmbo+huf3rzCHHLIfyHJWw/wO X-Received: by 2002:ac8:4299:0:b0:42a:acea:a1ea with SMTP id o25-20020ac84299000000b0042aaceaa1eamr5069488qtl.37.1707308649231; Wed, 07 Feb 2024 04:24:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707308649; cv=pass; d=google.com; s=arc-20160816; b=qninKk/Cm3tPs3/TRLJnYYbAfGAwjcLXB1gednj8KE08TpWjn0F9nHm+pcHFo6qzII dCWmDn8oxDAdY5opLGJ9YalkiWGPeN/JeFiaCh88/qRfPWxzXPsS7YAqurFChNnCHgSs WCUCsRWOjOJJGGSkefjtMAqcpQ8G6lNt3zSawWypbhYd8FWR+wHGWgoiBZrDspoT9qkR I/MQP5WxokWIR0Jm2Oi+S7ZvuxS1V4nf0C/Rqmkxhbw5td95XXq6nTey5MqhHHFDIpmn adXpy7UiFXTq/O87ZAfNxU0Z6R1h0s+jzN58qhv/S1VGjBI3ryXKKrUlO4nVnOfh542s siqw== 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=gGNHy3Np2Wthip7j68+V5PoLrZP956Be3BkosifME7k=; fh=UjNGLacNPW8WYZ3eWFDysqEIR1x4X3z8oyVgO4EVizw=; b=drkvuY7fE0sRYjFqf62UF7iZ7hArSQxW1n2n7vpHYvVC5J7GuYvSkJWVo0M2j+Sgv7 P68wPzUFU0vQYfrrgcUdL0TyfR4sJsBBQLJOz60ismeyDCA59V8Y7yq3L3ygNR6wug6U Ms55iWkTmKnKtx6rZz8f7wSLefvJgbUUGjaedIaWumWP1v626k9M5UVJsHiUq5NYuMzA b7CbkfPZtV7xFDtaNxp+l/obkLdAwCOlTJY4nXS00easUKWtO42A3MTTvZklDuJHIHL2 +NeeQLqSgetxX51omlmkS5jGFeGNi4PrQfz7CzE8skAyVP5tdY/I3ClriWhX4FfHGLtA 0Hcw==; dara=google.com 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-56478-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56478-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com X-Forwarded-Encrypted: i=2; AJvYcCXdt9hpNWbM92X1QoMP0TXibJ4SeduRGNzlyNgG2sZ0iOdOTr6giNuOTbPkXdGsZrCZrjpR/62h+5MWCMA7MPGJZlrkYoGC9ATTbCMsjg== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id r18-20020ac85c92000000b0042c279c390bsi984746qta.458.2024.02.07.04.24.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 04:24:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56478-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; 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-56478-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56478-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 029AC1C2497A for ; Wed, 7 Feb 2024 12:24:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EE33C59B7F; Wed, 7 Feb 2024 12:24:02 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 84F161B803 for ; Wed, 7 Feb 2024 12:24:00 +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=1707308642; cv=none; b=BNrFEjRBmskFF/Oqjqm2NOkuBtRycac/NbjjaVx0sr7AvOnBOiyYQ6Hq+GSOLKtxqlOL1sZznRwkxA7U7PbP8lerSQq8SkzAkm82KrUr6WykrHUm/SN2MCh1+qlSGFi2ltP0omChY8QKwx5oDll58EMgNc2ZG4FC4OUdHVisAgY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707308642; c=relaxed/simple; bh=WZoRpB52zZ7l1NyOfQgJEXEwZ+ms0vzx/IXhARDbYA0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OIKLBdKHgaug2uVh9HdTGGHvUvZi+Xwq+Yy3QjjqqDd5DU/HL27v2BTxsWtxqoRDlO2tFFWA1DnLwJv+frxGK/z/viiV6PnpSTWJM3zCinskFCIBAvvh01YnhSDuKtG42tKdMZ5cdB9GEdxLzedrsJi1zNAEl1kKHryp58a5ShA= 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 133801FB; Wed, 7 Feb 2024 04:24:42 -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 978193F5A1; Wed, 7 Feb 2024 04:23:58 -0800 (PST) Date: Wed, 7 Feb 2024 12:23:56 +0000 From: Dave Martin To: Mark Brown Cc: Will Deacon , Catalin Marinas , Oleg Nesterov , Al Viro , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Doug Anderson Subject: Re: [PATCH] arm64/sve: Lower the maximum allocation for the SVE ptrace regset Message-ID: References: <20240203-arm64-sve-ptrace-regset-size-v1-1-2c3ba1386b9e@kernel.org> 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: On Mon, Feb 05, 2024 at 05:41:47PM +0000, Mark Brown wrote: > On Mon, Feb 05, 2024 at 05:11:59PM +0000, Dave Martin wrote: > > On Sat, Feb 03, 2024 at 12:16:49PM +0000, Mark Brown wrote: > > > > We could also teach the ptrace core about runtime discoverable regset sizes > > > but that would be a more invasive change and this is being observed in > > > practical systems. > > > This is not hard at all: see > > 27e64b4be4b8 ("regset: Add support for dynamically sized regsets") > > > But since this is precisely what was ripped out, I guess adding it back > > may be controversial (?) > > Also just that people might want to backport and while it's not super > *hard* I tend to prefer to do something as minimal as possible as a fix, > the less we do the less the chances that we mess up. Totally agree with that: the core code has now gone in another direction, so we should consider that a done deal. I'm just using the old patch as an illustration of the (low) level of complexity. > > > We should probably also use the actual architectural limit for the > > > bitmasks we use in the VL enumeration code, though that's both a little > > > bit more involved and less immediately a problem. > > > Since these masks are 64 bytes each and rarely accessed, it seemed > > pointless complexity to make them resizeable... > > I was suggesting making them use the architectural maximum rather than > making them dynamic. > > > > +#define ARCH_SVE_VQ_MAX 16 > > > #define SME_VQ_MAX 16 > > > Ack, though part of the reason for not doing this was to discourage > > people from allocating statically sized buffers in general. > > I was going to do a patch adding a comment to the header noting that > this is not actually the architectural maximum since at present it's > a bit of a landmine, people who have some idea of the architecture > likely have a rough idea what sort of allocation size is needed for the > maximum SVE state and are likely to not double check the value provided > (I think that's what happened with the refactoring to remove the dynamic > sizing). A comment in the header is still very missable but it'd be > something. > > > If the kernel is now juggling two #defines for the maximum vector size, > > this feels like it may seed bitrot... > > Ideally we'd just not have the existing define externally but it's there > and it's been used. To clarify, is this intended as a temporary band-aid against silly behaviour while a cleaner solution is found, or a permanent limitation? We'd need to change various things if the architectural max VL actually grew, so no forward-portability is lost immediately if the kernel adopts 16 internally, but I'm still a little concerned that people may poke about in the kernel code as a reference and this will muddy the waters regarding how to do the right thing in userspace (I know people shouldn't, but...) [...] Cheers ---Dave