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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D79CC2BD09 for ; Thu, 27 Jun 2024 19:25:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1695F6B0095; Thu, 27 Jun 2024 15:25:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F3116B009A; Thu, 27 Jun 2024 15:25:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EADB96B009D; Thu, 27 Jun 2024 15:25:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id C99596B0095 for ; Thu, 27 Jun 2024 15:25:19 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 6C291120AA4 for ; Thu, 27 Jun 2024 19:25:19 +0000 (UTC) X-FDA: 82277647158.04.F62DE87 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by imf30.hostedemail.com (Postfix) with ESMTP id 9B0E080028 for ; Thu, 27 Jun 2024 19:25:17 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=g03jX30J; spf=pass (imf30.hostedemail.com: domain of lstoakes@gmail.com designates 209.85.128.47 as permitted sender) smtp.mailfrom=lstoakes@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719516308; a=rsa-sha256; cv=none; b=O+bDpPuAwJeEHtFh2xKeUPJ69tt3ySBT58nivGS1nvvZnqJcoNnS38PWnB7pUt877UythM J6tKThXH0RD/3/rj3YqQT36a4zs5Z/psPe0csLJSLeezof8avezabPmMv/FL/GDCTLYPda reeG5/bFnoNT0bxPJ3OeNO92HXTQVkU= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=g03jX30J; spf=pass (imf30.hostedemail.com: domain of lstoakes@gmail.com designates 209.85.128.47 as permitted sender) smtp.mailfrom=lstoakes@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719516308; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=COhz4tg2KtsEzBCamCfVgtcE+Zvi+N4NuLxIdJtDu0o=; b=VwuN5c+a2MxWgdmOYxMZOk7djjTl221Phbow+vmA70874hkKopCKKAHhHB57ZcXd/agu36 a/98BMBXLyJFQvHxTT/6Rg5/BJFgHC6fMp0H0K2g1PBvKx7RppjSZWWd/P2YdHMca0l1O/ hq3AFUYJb6nN0SfKoYGZJ+b65lb+cdU= Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-42567ddf099so5359435e9.3 for ; Thu, 27 Jun 2024 12:25:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719516316; x=1720121116; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=COhz4tg2KtsEzBCamCfVgtcE+Zvi+N4NuLxIdJtDu0o=; b=g03jX30J9XUz/1+OA+bpJIePc9PPIIKxOpbFYe9M1byf90tr6kvtxsbE4/Yth7cXiN vd/UOcfO1LlkwWAIQU5yVP5disR3HkZirik2pIlONOkNdTabm77ZiHKwSaFpe1PWQ/uq Z68CEfADVfowQt/y4C49hhq0sEmvHA5zTtEveHW38eqr6jXRH9qFi9ChZPU4Tvcth8gw vZV1A//kHlvjDBK5SU28q0mlSIDCGNoCXbdLprF6EsKZoaPyez9Bxvr4LiYsLF433k8+ AMr9SYTO0dP72ExP4cdG3gHCzoQEGWtt3o6Q29ABjYqaG0WZ/Jq1Yuqpwaw3nqIzFFuT RfSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719516316; x=1720121116; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=COhz4tg2KtsEzBCamCfVgtcE+Zvi+N4NuLxIdJtDu0o=; b=jG6u8e3Ott9eDjCB3/cHVTa8UN2Bxct7tyQRYnDkif/p4LSGD+wyll/284V4gs674U IJ9CsNFzz34TAqLtC0aZDWzuuQQAerjh8/hcIBReBQglO80lOXg0cgeA+RBprHrNOm9e dIomt/jFWL+rh593ghr9G03v4oHb6PHFLzTBZKe1/Mq2Tn0O7qAO1qkHwhTsBk0xJEqL 8XRTUcaeUCpfVT6PlSI0PVu0r0ZWPgChJfsOZebhv/oSKdok6r2aHqVSSey61EQsJXAM SMF3gP5bAqhxXXGRXrItzdFrRtdeUpopVaM3FNZ3Tk0V3igPfwC2sjdkCSc3z5/euUbO ckcQ== X-Forwarded-Encrypted: i=1; AJvYcCXKV1sU1TxsCZwb3ZmuoMCa3SWDc49f9IqlAk7DWmA7tr47Tfk7cEezr9Fzhbl1fHuBG2sNTBWH3Wob1k7UrC1wKx8= X-Gm-Message-State: AOJu0YwqjeMHuRPQK4u0VjYJe1yY3MdYowR1K4Nh9sNLdHR9J9hnC3cc I3QavINkAxB7cWUlNkVEj7e8oOsIfkYA5XwjTJ8lVIXtM6cZ3avq X-Google-Smtp-Source: AGHT+IFDXPm4ymu9TNEODvqhbtxriYnqeeKhMAoT3n1QEaPteD3l+1IFMmU6U/hKYHoC5Ei0o8joog== X-Received: by 2002:a05:600c:888:b0:424:a779:b5c1 with SMTP id 5b1f17b1804b1-424a779b687mr51397195e9.20.1719516315712; Thu, 27 Jun 2024 12:25:15 -0700 (PDT) Received: from localhost ([2a00:23cc:d20f:ba01:bb66:f8b2:a0e8:6447]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b09a828sm4889945e9.37.2024.06.27.12.25.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 12:25:14 -0700 (PDT) Date: Thu, 27 Jun 2024 20:25:13 +0100 From: Lorenzo Stoakes To: "Liam R. Howlett" , Andrew Morton , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Vlastimil Babka , Matthew Wilcox , Alexander Viro , Christian Brauner , Jan Kara , Eric Biederman , Kees Cook , Suren Baghdasaryan Subject: Re: [RFC PATCH 7/7] tools: add skeleton code for userland testing of VMA logic Message-ID: <6bd118dd-de4b-4ccd-bdbe-f8c45e8ea783@lucifer.local> References: <22777632a0ed9d2dadbc8d7f0689d65281af0f50.1719481836.git.lstoakes@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: t7tiayyg4bexkue4iinrr4o4jn9i5had X-Rspamd-Queue-Id: 9B0E080028 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1719516317-495088 X-HE-Meta: U2FsdGVkX1+QXFaOaPJpp4YNvs0GJqZBmBo/bj6V9VeBLeuRzWBUwEj4zEsw5HWgrPWGFj9qOdXR+K3DeMdR4KBihEbyOqjgEfrim4ustKlttTQJcJGY0CFZZJT0aAKLSEgPlfaB6KexlvWZ5uVnqvz6UlZw1vIg12pb+gq0e/A9s/FRtrYyMwmbvGB3VZE2cUzH1a1yf5x+zfkyRUzsedXUzLZjodGtcNA4ioJYLtRgSvZrE7fw+I5tQXMEhGHJC/JSN867hmGotFqR+YwPeoJ7QZ4RA1fUusVRbGFXYXApOcEfAJu0Q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: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, Jun 27, 2024 at 01:20:30PM -0400, Liam R. Howlett wrote: [snip] > > + > > +clean: > > + $(RM) $(TARGETS) *.o radix-tree.c idr.c generated/map-shift.h generated/bit-length.h > > This needs to clean out vma.c to avoid stale testing. > > But, none of this is needed. > > What we can do instead is add the correct header guards to the > mm/vma_internal.h file, change the tools/testing/vma/vma_internal.h > header guards to be the same (ie: remove TESTING_ from the existing > ones), then we can include vma_internal.h into vma_stub.c prior to > including "../../../mm/vma.c", and we don't need to copy the file. > > Essentially use the #ifdef guards to replace the header by ordering the > local header for inclusion prior to the c file. Ack this is a good idea, will do in v2. > > > > diff --git a/tools/testing/vma/errors.txt b/tools/testing/vma/errors.txt > > new file mode 100644 > > index 000000000000..e69de29bb2d1 > > diff --git a/tools/testing/vma/generated/autoconf.h b/tools/testing/vma/generated/autoconf.h > > new file mode 100644 > > index 000000000000..92dc474c349b > > --- /dev/null > > +++ b/tools/testing/vma/generated/autoconf.h > > @@ -0,0 +1,2 @@ > > +#include "bit-length.h" > > +#define CONFIG_XARRAY_MULTI 1 > > diff --git a/tools/testing/vma/linux/atomic.h b/tools/testing/vma/linux/atomic.h > > new file mode 100644 > > index 000000000000..298b0fb7aab2 > > --- /dev/null > > +++ b/tools/testing/vma/linux/atomic.h > > This should have header guards as well. Yup, the reason I kept it like this is because existing linux/*.h headers in shared/linux didn't have header guards and I wanted to keep things in line with that... will change. > > > @@ -0,0 +1,19 @@ > > +#ifndef atomic_t > > +#define atomic_t int32_t > > +#endif > > + > > +#ifndef atomic_inc > > +#define atomic_inc(x) uatomic_inc(x) > > +#endif > > + > > +#ifndef atomic_read > > +#define atomic_read(x) uatomic_read(x) > > +#endif > > + > > +#ifndef atomic_set > > +#define atomic_set(x, y) do {} while (0) > > +#endif > > + > > +#ifndef U8_MAX > > +#define U8_MAX UCHAR_MAX > > +#endif > > diff --git a/tools/testing/vma/linux/mmzone.h b/tools/testing/vma/linux/mmzone.h > > new file mode 100644 > > index 000000000000..71546e15bdd3 > > --- /dev/null > > +++ b/tools/testing/vma/linux/mmzone.h > > @@ -0,0 +1,37 @@ > > +/* SPDX-License-Identifier: GPL-2.0 */ > > +#ifndef _TOOLS_MMZONE_H > > +#define _TOOLS_MMZONE_H > > It might be best to use the same guards here to avoid mmzone.h from > getting pulled in. You mean the actual [root]/include/linux/mmzone.h ? Just deploying the same header guard trick as mentioned above re: vma_internal.h? [snip] > > new file mode 100644 > > index 000000000000..b29eeb0daf31 > > --- /dev/null > > +++ b/tools/testing/vma/main.c > > If you employ the use of header guards, we can rename main.c to vma.c > and produce the executable "vma" instead of "main". Sure, will do. > > > @@ -0,0 +1,161 @@ > > +/* SPDX-License-Identifier: GPL-2.0 */ > > + > > +#include > > +#include > > +#include > > + > > +#include "maple-shared.h" > > +#include "vma_internal.h" > > +#include "vma.h" > > You can directly include "../../../mm/vma.h" here and remove the vma.h > file you have in this directory. This was, I think, to keep to a convention, but you're right I don't think there's any reason to do this, will change. [snip] > > +int main(void) > > +{ > > + maple_tree_init(); > > + > > + test_simple_merge(); > > + test_simple_modify(); > > + test_simple_expand(); > > + test_simple_shrink(); > > + > > + return EXIT_SUCCESS; > > +} > > It would be nice to have some output stating the number of tests > passed/failed. Ack, will add. > > > diff --git a/tools/testing/vma/vma.h b/tools/testing/vma/vma.h > > new file mode 100644 > > index 000000000000..87a6cb222b63 > > --- /dev/null > > +++ b/tools/testing/vma/vma.h > > @@ -0,0 +1,3 @@ > > +/* SPDX-License-Identifier: GPL-2.0+ */ > > + > > +#include "../../../mm/vma.h" > > I'd rather just drop this file and have this line in main.c (or vma.c if > you decide to rename it). Ack, will do. [snip]