* [PATCH] selftests: arm64: Fix redundancy of a testcase
@ 2024-06-05 11:54 Dev Jain
2024-06-05 12:00 ` Mark Brown
2024-06-12 16:08 ` Catalin Marinas
0 siblings, 2 replies; 4+ messages in thread
From: Dev Jain @ 2024-06-05 11:54 UTC (permalink / raw)
To: linux-arm-kernel, catalin.marinas, will, shuah, linux-kselftest
Cc: linux-kernel, broonie, suzuki.poulose, Anshuman.Khandual,
Dev Jain
Currently, we are writing the same value as we read, into the TLS
register; hence, we cannot confirm updation of the register, making the
testcase "verify_tpidr_one" redundant. Fix this; while at it, do a style
change.
Signed-off-by: Dev Jain <dev.jain@arm.com>
---
tools/testing/selftests/arm64/abi/ptrace.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/arm64/abi/ptrace.c b/tools/testing/selftests/arm64/abi/ptrace.c
index abe4d58d731d..c105703442f9 100644
--- a/tools/testing/selftests/arm64/abi/ptrace.c
+++ b/tools/testing/selftests/arm64/abi/ptrace.c
@@ -47,7 +47,7 @@ static void test_tpidr(pid_t child)
/* ...write a new value.. */
write_iov.iov_len = sizeof(uint64_t);
- write_val[0] = read_val[0]++;
+ write_val[0] = read_val[0] + 1;
ret = ptrace(PTRACE_SETREGSET, child, NT_ARM_TLS, &write_iov);
ksft_test_result(ret == 0, "write_tpidr_one\n");
@@ -108,7 +108,7 @@ static void test_tpidr(pid_t child)
/* Writing only TPIDR... */
write_iov.iov_len = sizeof(uint64_t);
memcpy(write_val, read_val, sizeof(read_val));
- write_val[0] += 1;
+ ++write_val[0];
ret = ptrace(PTRACE_SETREGSET, child, NT_ARM_TLS, &write_iov);
if (ret == 0) {
--
2.39.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests: arm64: Fix redundancy of a testcase
2024-06-05 11:54 [PATCH] selftests: arm64: Fix redundancy of a testcase Dev Jain
@ 2024-06-05 12:00 ` Mark Brown
2024-06-05 12:26 ` Dev Jain
2024-06-12 16:08 ` Catalin Marinas
1 sibling, 1 reply; 4+ messages in thread
From: Mark Brown @ 2024-06-05 12:00 UTC (permalink / raw)
To: Dev Jain
Cc: linux-arm-kernel, catalin.marinas, will, shuah, linux-kselftest,
linux-kernel, suzuki.poulose, Anshuman.Khandual
[-- Attachment #1: Type: text/plain, Size: 965 bytes --]
On Wed, Jun 05, 2024 at 05:24:48PM +0530, Dev Jain wrote:
> Currently, we are writing the same value as we read, into the TLS
> register; hence, we cannot confirm updation of the register, making the
> testcase "verify_tpidr_one" redundant. Fix this; while at it, do a style
> change.
Please don't combine unrelated changes into a single patch.
> /* ...write a new value.. */
> write_iov.iov_len = sizeof(uint64_t);
> - write_val[0] = read_val[0]++;
> + write_val[0] = read_val[0] + 1;
> ret = ptrace(PTRACE_SETREGSET, child, NT_ARM_TLS, &write_iov);
> ksft_test_result(ret == 0, "write_tpidr_one\n");
This is a good fix:
Reviewed-by: Mark Brown <broonie@kernel.org>
> @@ -108,7 +108,7 @@ static void test_tpidr(pid_t child)
> /* Writing only TPIDR... */
> write_iov.iov_len = sizeof(uint64_t);
> memcpy(write_val, read_val, sizeof(read_val));
> - write_val[0] += 1;
> + ++write_val[0];
I'm less convinced that this is a good style change.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests: arm64: Fix redundancy of a testcase
2024-06-05 12:00 ` Mark Brown
@ 2024-06-05 12:26 ` Dev Jain
0 siblings, 0 replies; 4+ messages in thread
From: Dev Jain @ 2024-06-05 12:26 UTC (permalink / raw)
To: Mark Brown
Cc: linux-arm-kernel, catalin.marinas, will, shuah, linux-kselftest,
linux-kernel, suzuki.poulose, Anshuman.Khandual
On 6/5/24 17:30, Mark Brown wrote:
> On Wed, Jun 05, 2024 at 05:24:48PM +0530, Dev Jain wrote:
>> Currently, we are writing the same value as we read, into the TLS
>> register; hence, we cannot confirm updation of the register, making the
>> testcase "verify_tpidr_one" redundant. Fix this; while at it, do a style
>> change.
> Please don't combine unrelated changes into a single patch.
I shall take care of that in the future.
>
>> /* ...write a new value.. */
>> write_iov.iov_len = sizeof(uint64_t);
>> - write_val[0] = read_val[0]++;
>> + write_val[0] = read_val[0] + 1;
>> ret = ptrace(PTRACE_SETREGSET, child, NT_ARM_TLS, &write_iov);
>> ksft_test_result(ret == 0, "write_tpidr_one\n");
> This is a good fix:
>
> Reviewed-by: Mark Brown <broonie@kernel.org>
Thanks!
>
>> @@ -108,7 +108,7 @@ static void test_tpidr(pid_t child)
>> /* Writing only TPIDR... */
>> write_iov.iov_len = sizeof(uint64_t);
>> memcpy(write_val, read_val, sizeof(read_val));
>> - write_val[0] += 1;
>> + ++write_val[0];
> I'm less convinced that this is a good style change.
Well, what I have seen usually is, when we add 1, we
use prefix/postfix increment, and do a "+=" when it
is not 1. But, I get your point: such style may confuse
people into thinking that we are doing an index/pointer
increment, since that is the usual usecase for this.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests: arm64: Fix redundancy of a testcase
2024-06-05 11:54 [PATCH] selftests: arm64: Fix redundancy of a testcase Dev Jain
2024-06-05 12:00 ` Mark Brown
@ 2024-06-12 16:08 ` Catalin Marinas
1 sibling, 0 replies; 4+ messages in thread
From: Catalin Marinas @ 2024-06-12 16:08 UTC (permalink / raw)
To: linux-arm-kernel, will, shuah, linux-kselftest, Dev Jain
Cc: linux-kernel, broonie, suzuki.poulose, Anshuman.Khandual
On Wed, 05 Jun 2024 17:24:48 +0530, Dev Jain wrote:
> Currently, we are writing the same value as we read, into the TLS
> register; hence, we cannot confirm updation of the register, making the
> testcase "verify_tpidr_one" redundant. Fix this; while at it, do a style
> change.
>
>
Applied to arm64 (for-next/kselftest), thanks! I removed the increment
style change.
[1/1] selftests: arm64: Fix redundancy of a testcase
https://git.kernel.org/arm64/c/031d1f20d5db
--
Catalin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-12 16:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-05 11:54 [PATCH] selftests: arm64: Fix redundancy of a testcase Dev Jain
2024-06-05 12:00 ` Mark Brown
2024-06-05 12:26 ` Dev Jain
2024-06-12 16:08 ` Catalin Marinas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox