From: Yeoreum Yun <yeoreum.yun@arm.com>
To: Mark Brown <broonie@kernel.org>
Cc: catalin.marinas@arm.com, pcc@google.com, will@kernel.org,
anshuman.khandual@arm.com, joey.gouly@arm.com,
yury.khrustalev@arm.com, maz@kernel.org, oliver.upton@linux.dev,
frederic@kernel.org, shmeerali.kolothum.thodi@huawei.com,
akpm@linux-foundation.org, surenb@google.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH v5 5/6] kselftest/arm64/mte: refactor check_mmap_option test
Date: Wed, 11 Jun 2025 10:34:49 +0100 [thread overview]
Message-ID: <aElNuX+ddy0xcBUj@e129823.arm.com> (raw)
In-Reply-To: <69778d2c-3ace-4fbe-a55f-297e280f8761@sirena.org.uk>
Hi Mark,
>
> > Before add mtefar testcase on check_mmap_option.c,
> > refactor check_mmap_option.
>
> Please describe the intended refactoring here.
>
> > +#define CHECK_ANON_MEM 0
> > +#define CHECK_FILE_MEM 1
> > +#define CHECK_CLEAR_PROT_MTE 2
> > +
>
> Perhaps use enums for this sort of thing?
Thank. I'll changed to enum.
>
> > +{
> > + static char test_name[TEST_NAME_MAX];
> > + const char* check_type_str;
>
> Coding style would usually be
>
> const char *check_type_str;
>
Sorry for my typo... :(
> > + snprintf(test_name, TEST_NAME_MAX,
> > + "Check %s with %s mapping, %s mode, %s memory and %s\n",
> > + check_type_str, mapping_str, sync_str, mem_type_str, tag_check_str);
>
> sizeof(test_name).
Okay.
>
> > evaluate_test(check_anonymous_memory_mapping(USE_MMAP, MTE_SYNC_ERR, MAP_PRIVATE, TAG_CHECK_OFF),
> > - "Check anonymous memory with private mapping, sync error mode, mmap memory and tag check off\n");
> > + format_test_name(CHECK_ANON_MEM, USE_MMAP, MTE_SYNC_ERR, MAP_PRIVATE, TAG_CHECK_OFF));
>
> Looking at this I can't help but think that the more common pattern for
> test programs where we have an array of test parameters that we loop
> through might make sense:
>
> for (i = 0; i < ARRAY_SIZE(test_cases); i++) {
> format_test_name(test_cases[i]);
>
> switch (test_cases[i].test_type) {
> case CHECK_ANON_MEM:
> check_anonymous_memory_mapping(USE_MMAP, ...);
>
> That seems a bit more legible and maintainable.
>
> > mte_disable_pstate_tco();
>
> The management of this could be added as a parameter in the test struct.
I see, I'll repsin and send it again.
Thanks!
--
Sincerely,
Yeoreum Yun
next prev parent reply other threads:[~2025-06-11 14:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-10 15:01 [PATCH v5 0/6] support FEAT_MTE_TAGGED_FAR feature Yeoreum Yun
2025-06-10 15:01 ` [PATCH v5 1/6] arm64/cpufeature: add " Yeoreum Yun
2025-06-10 15:01 ` [PATCH v5 2/6] arm64: report address tag when FEAT_MTE_TAGGED_FAR is supported Yeoreum Yun
2025-06-10 15:01 ` [PATCH v5 3/6] tools/kselftest: add MTE_FAR hwcap test Yeoreum Yun
2025-06-10 15:01 ` [PATCH v5 4/6] kselftest/arm64/mte: preparation for mtefar test Yeoreum Yun
2025-06-10 15:21 ` Mark Brown
2025-06-10 15:38 ` Yeoreum Yun
2025-06-10 15:01 ` [PATCH v5 5/6] kselftest/arm64/mte: refactor check_mmap_option test Yeoreum Yun
2025-06-10 15:38 ` Mark Brown
2025-06-11 9:34 ` Yeoreum Yun [this message]
2025-06-10 15:01 ` [PATCH v5 6/6] kselftest/arm64/mte: add mtefar test on check_mmap_option Yeoreum Yun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aElNuX+ddy0xcBUj@e129823.arm.com \
--to=yeoreum.yun@arm.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=frederic@kernel.org \
--cc=joey.gouly@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=pcc@google.com \
--cc=shmeerali.kolothum.thodi@huawei.com \
--cc=surenb@google.com \
--cc=will@kernel.org \
--cc=yury.khrustalev@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).