linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: Dev Jain <dev.jain@arm.com>, akpm@linux-foundation.org, shuah@kernel.org
Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>,
	kernel@collabora.com, linux-mm@kvack.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Anshuman.Khandual@arm.com
Subject: Re: [PATCH] selftests/mm: virtual_address_range: Switch to ksft_exit_fail_msg
Date: Thu, 14 Mar 2024 17:33:13 +0500	[thread overview]
Message-ID: <403e7704-5d87-43c5-b48d-3faca2a9727a@collabora.com> (raw)
In-Reply-To: <20240314122250.68534-1-dev.jain@arm.com>

Thanks for the patch. The patch should have been sent to a separate new thread.

On 3/14/24 5:22 PM, Dev Jain wrote:
> mmap() must not succeed in validate_lower_address_hint(), for if it does, it
> is a bug in mmap() itself. Reflect this behaviour with ksft_exit_fail_msg().
> While at it, do some formatting changes.
> 
> Signed-off-by: Dev Jain <dev.jain@arm.com>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>

> ---
>  tools/testing/selftests/mm/virtual_address_range.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/testing/selftests/mm/virtual_address_range.c b/tools/testing/selftests/mm/virtual_address_range.c
> index 7bcf8d48256a..426ddfc345fb 100644
> --- a/tools/testing/selftests/mm/virtual_address_range.c
> +++ b/tools/testing/selftests/mm/virtual_address_range.c
> @@ -85,7 +85,7 @@ static int validate_lower_address_hint(void)
>  	char *ptr;
>  
>  	ptr = mmap((void *) (1UL << 45), MAP_CHUNK_SIZE, PROT_READ |
> -			PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> +		   PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
>  
>  	if (ptr == MAP_FAILED)
>  		return 0;
> @@ -105,13 +105,11 @@ int main(int argc, char *argv[])
>  
>  	for (i = 0; i < NR_CHUNKS_LOW; i++) {
>  		ptr[i] = mmap(NULL, MAP_CHUNK_SIZE, PROT_READ | PROT_WRITE,
> -					MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> +			      MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
>  
>  		if (ptr[i] == MAP_FAILED) {
> -			if (validate_lower_address_hint()) {
> -				ksft_test_result_skip("Memory constraint not fulfilled\n");
> -				ksft_finished();
> -			}
> +			if (validate_lower_address_hint())
> +				ksft_exit_fail_msg("mmap unexpectedly succeeded with hint\n");
>  			break;
>  		}
>  
> @@ -127,7 +125,7 @@ int main(int argc, char *argv[])
>  	for (i = 0; i < NR_CHUNKS_HIGH; i++) {
>  		hint = hind_addr();
>  		hptr[i] = mmap(hint, MAP_CHUNK_SIZE, PROT_READ | PROT_WRITE,
> -					MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> +			       MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
>  
>  		if (hptr[i] == MAP_FAILED)
>  			break;

-- 
BR,
Muhammad Usama Anjum


      reply	other threads:[~2024-03-14 12:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02 11:31 [PATCH v2 00/12] conform tests to TAP format output Muhammad Usama Anjum
2024-02-02 11:31 ` [PATCH v2 01/12] selftests/mm: map_fixed_noreplace: conform test " Muhammad Usama Anjum
2024-02-02 11:31 ` [PATCH v2 02/12] selftests/mm: map_hugetlb: " Muhammad Usama Anjum
2024-02-02 11:31 ` [PATCH v2 03/12] selftests/mm: map_populate: " Muhammad Usama Anjum
2024-02-02 11:31 ` [PATCH v2 04/12] selftests/mm: mlock-random-test: " Muhammad Usama Anjum
2024-02-02 11:31 ` [PATCH v2 05/12] selftests/mm: mlock2-tests: " Muhammad Usama Anjum
2024-02-02 11:31 ` [PATCH v2 06/12] selftests/mm: mrelease_test: " Muhammad Usama Anjum
2024-02-02 11:31 ` [PATCH v2 07/12] selftests/mm: mremap_dontunmap: " Muhammad Usama Anjum
2024-02-02 11:31 ` [PATCH v2 08/12] selftests/mm: split_huge_page_test: " Muhammad Usama Anjum
2024-02-02 11:31 ` [PATCH v2 09/12] selftests/mm: thp_settings: conform " Muhammad Usama Anjum
2024-02-14 17:19   ` Ryan Roberts
2024-02-14 18:00     ` Ryan Roberts
2024-02-15  4:59     ` Muhammad Usama Anjum
2024-02-02 11:31 ` [PATCH v2 10/12] selftests/mm: thuge-gen: " Muhammad Usama Anjum
2024-02-02 11:31 ` [PATCH v2 11/12] selftests/mm: transhuge-stress: " Muhammad Usama Anjum
2024-02-02 11:31 ` [PATCH v2 12/12] selftests/mm: virtual_address_range: " Muhammad Usama Anjum
2024-03-14  5:00   ` Dev Jain
2024-03-14  8:46     ` Muhammad Usama Anjum
2024-03-14 12:22       ` [PATCH] selftests/mm: virtual_address_range: Switch to ksft_exit_fail_msg Dev Jain
2024-03-14 12:33         ` Muhammad Usama Anjum [this message]

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=403e7704-5d87-43c5-b48d-3faca2a9727a@collabora.com \
    --to=usama.anjum@collabora.com \
    --cc=Anshuman.Khandual@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=dev.jain@arm.com \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shuah@kernel.org \
    /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