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=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 BD9A9C4338F for ; Wed, 28 Jul 2021 13:48:46 +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 870C860F45 for ; Wed, 28 Jul 2021 13:48:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 870C860F45 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=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:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GTQ4a3mhTNFyivh3DpmxUt1cQxG8aATLZl7NEQQi6cU=; b=qCXPbAGPmcsrQO I4qrDPAt0vW6Hnba5b+vTA8acwaSwax1JC2w3Q7I0AT0hnHO80WFR6LJ3YvWHrNLuq86maejkFBh6 b5PyxUkxuqJsiJoS3R9svKT+qADBtV+vyCu+GhcTlrgj43/kIOxu8gp3kMyhk1fUqWJS88rT58iBx Ivp0VaiABeAnC3HTQ/WimsavyXQaoqX/2ubqVC8Cn9JdWcuK2Ii0yn/rfXUMPHj6XOqbhsCAjfz2g Cj77Imtv7ff5HSxroGXXRcGpCOwSfwZl9BF5GZplJmjW/qa3rM38RK0DTqQDAYi4MyPJDRWqGoon0 QUq03sG+qnphoO5dRw3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8jsQ-000pDA-Pg; Wed, 28 Jul 2021 13:45:38 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8jsL-000pCF-PB for linux-arm-kernel@lists.infradead.org; Wed, 28 Jul 2021 13:45:35 +0000 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 55FA831B; Wed, 28 Jul 2021 06:45:28 -0700 (PDT) Received: from arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6C9FE3F70D; Wed, 28 Jul 2021 06:45:27 -0700 (PDT) Date: Wed, 28 Jul 2021 14:44:07 +0100 From: Dave Martin To: Mark Brown Cc: Catalin Marinas , Will Deacon , Shuah Khan , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v1 3/3] kselftest/arm64: Add tests for SVE vector configuration Message-ID: <20210728134405.GF1724@arm.com> References: <20210727180649.12943-1-broonie@kernel.org> <20210727180649.12943-4-broonie@kernel.org> <20210728094158.GC1724@arm.com> <20210728125918.GD4670@sirena.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210728125918.GD4670@sirena.org.uk> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210728_064533_960427_CBC3155B X-CRM114-Status: GOOD ( 44.31 ) 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 Wed, Jul 28, 2021 at 01:59:18PM +0100, Mark Brown wrote: > On Wed, Jul 28, 2021 at 10:41:58AM +0100, Dave Martin wrote: > > On Tue, Jul 27, 2021 at 07:06:49PM +0100, Mark Brown wrote: > > > > We provide interfaces for configuring the SVE vector length seen by > > > processes using prctl and also via /proc for configuring the default > > > values. Provide tests that exercise all these interfaces and verify that > > > they take effect as expected, though at present no test fully enumerates > > > all the possible vector lengths. > > > Does "at present" mean that this test doesn't do it either? > > > (It doesn't seem to try every VL, unless I've missed something? Is this > > planned?) > > Nothing currently does it, and nor does this patch. Planned is a strong > term but yes, ideally we should probe all the VLs. > > > > +#include > > > +#include > > > +#include > > > > Not used? ^ > > We call exit() which is declared in stdlib.h. Ignore me, I confused exit() with _exit(). > > > +#define MIN_VL 16 > > > has SVE_MIN_VL. Maybe we can use that everywhere > > these days? > > I partly wanted the vector type neutral name, and I'm considering > modifying the sysfs ABI file to define 0 as a valid vector length for > consistency with accepting -1 as the maximum since SME doesn't have any > architected guarantees as to which particular vector lengths are defined. I see what you mean, but it is more than mere coincidence that this is the same value as SVE_MIN_VL. You could view SVE as defining the base architecture which SME then extends. Perhaps #define ARCH_MIN_VL SVE_MIN_VL /* architectural minimim VL */ would be neutral enough. Anyway, I won't lose sleep over it. > > > +/* Verify that we can write a minimum value and have it take effect */ > > > +void proc_write_min(struct vec_data *data) > > > Could be proc_write_check_min() (though the "check" is a bit more > > redundant here; from "write" it's clear that this function actually > > does something nontrivial). > > TBH I'm not sure people will be excssively confused by the idea that a > test would validate the values it was trying to read or write were > accurate. It's not 100% clear that this is a test until one has read all the way to the end of the file. But now that I understand the pattern here I wouldn't be too concerned, and the comment accurately describes what the function does. > > > > +/* Can we read back a VL from prctl? */ > > > > It's certainly possible. > > The comment is describing what the test is verifying. Ignore that, I somehow read the comment as something like [TODO] Can we read back a VL via ptrace? which is not what the comment says. > > Since this would test different kernel paths from getting the child > > itself to do RVDL / PR_SVE_GET_VL, it would be a different test though. > > I think this diff is still good, but beefing up the ptrace tests to do > > the appropriate checks would be good too (if we don't have that already). > > Yes, the ptrace stuff could have a bit more coverage. > > > > + proc_write_min, > > > + proc_write_max, > > > Can we also check what happens when writing unsupported values here? > > We could. > > > If this patch is more about establishing the framework, these could be > > TODOs for now. > > It definitely feels like something we can do incrementally. Is it worth committing a TODO list somewhere? There's always the possibility that someone else gets interested and contributes some tests for us; otherwise, at least it makes it harder to forget them. > > Can we be a good citizen and restore sve_default_vector_length to its > > original value? > > We do that in the tests that fiddle with the default vector length, it > seems useful to keep it at a value different from min and max as much as > possible to increase the chance that we notice a failure to set things. Ah right, I hadn't understood that proc_read_default() reads the default and then the subsequent tests write it back. This might be a bit clearer if the setup code was clearly separate from the tests, but so long as the ordering requirements are clearly documented that seems reasonably OK. In: > +test_type tests[] = { > + /* > + * The default/min/max tests must be first to provide data for > + * other tests. > + */ > + proc_read_default, > + proc_write_min, > + proc_write_max, can you also comment that proc_read_default needs to come first among these? > + > + prctl_get, > + prctl_set, > + prctl_set_no_child, > + prctl_set_for_child, > + prctl_set_onexec, > +}; [...] Cheers ---Dave _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel