Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Donet Tom <donettom@linux.ibm.com>
To: Pankaj Raghav <p.raghav@samsung.com>
Cc: akpm@linux-foundation.org, david@redhat.com,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-mm@kvack.org, ritesh.list@gmail.com, rppt@kernel.org,
	shuah@kernel.org, songmuchun@bytedance.com,
	tonyb@cybernetics.com, willy@infradead.org
Subject: Re: [PATCH] selftest: mm: Test if hugepage does not get leaked during __bio_release_pages()
Date: Thu, 6 Jun 2024 19:28:30 +0530	[thread overview]
Message-ID: <d0938d2d-dcb9-43c4-b5a3-2fad9de161b8@linux.ibm.com> (raw)
In-Reply-To: <20240606131436.592793-1-p.raghav@samsung.com>


On 6/6/24 18:44, Pankaj Raghav wrote:
>> +void run_dio_using_hugetlb(unsigned int start_off, unsigned int end_off)
>> +{
>> +	int fd;
>> +	char *buffer =  NULL;
>> +	char *orig_buffer = NULL;
>> +	size_t h_pagesize = 0;
>> +	size_t writesize;
>> +	int free_hpage_b = 0;
>> +	int free_hpage_a = 0;
>> +
>> +	writesize = end_off - start_off;
>> +
>> +	/* Get the default huge page size */
>> +	h_pagesize = default_huge_page_size();
>> +	if (!h_pagesize)
>> +		ksft_exit_fail_msg("Unable to determine huge page size\n");
>> +
>> +	/* Open the file to DIO */
>> +	fd = open("/tmp", O_TMPFILE | O_RDWR | O_DIRECT);
> I encountered a build error as follows in NixOS:
>
> In file included from /nix/store/fwh4fxd747m0py3ib3s5abamia9nrf90-glibc-2.39-52-dev/include/fcntl.h:342,
>                   from hugetlb_dio.c:15:
> In function ‘open’,
>      inlined from ‘run_dio_using_hugetlb’ at hugetlb_dio.c:41:7:
> /nix/store/fwh4fxd747m0py3ib3s5abamia9nrf90-glibc-2.39-52-dev/include/bits/fcntl2.h:50:11: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments
>     50 |           __open_missing_mode ();
>
>
> I saw a commit that fixed similar issues with open syscall before:
> 8b65ef5ad486 ("selftests/mm: Fix build with _FORTIFY_SOURCE")
>
> So something like this should fix the issue?
>
> -       fd = open("/tmp", O_TMPFILE | O_RDWR | O_DIRECT);
> +       fd = open("/tmp", O_TMPFILE | O_RDWR | O_DIRECT, 0664);

Thank you Pankaj.

I am able to reproduce this error with "-D_FORTIFY_SOURCE=2 -O2".  I will post v3 with this fix.

-donet


>
>> +	if (fd < 0)
>> +		ksft_exit_fail_msg("Error opening file");
>> +

  reply	other threads:[~2024-06-06 13:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-04 13:28 [PATCH v2] selftest: mm: Test if hugepage does not get leaked during __bio_release_pages() Donet Tom
2024-06-06 13:14 ` [PATCH] " Pankaj Raghav
2024-06-06 13:58   ` Donet Tom [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-05-23  6:39 Donet Tom
2024-05-23 19:13 ` Andrew Morton
2024-05-23 20:40   ` David Hildenbrand
2024-05-24  2:57     ` Andrew Morton
2024-05-24  6:21       ` David Hildenbrand
2024-05-24  6:43         ` Ritesh Harjani
2024-05-24  7:01           ` David Hildenbrand
2024-05-24  9:31             ` Donet Tom
2024-05-24 15:20               ` David Hildenbrand
2024-05-24  6:53     ` Ritesh Harjani
2024-05-24 20:12       ` Andrew Morton
2024-05-24 18:13 ` Muhammad Usama Anjum
2024-05-25 15:40   ` Donet Tom

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=d0938d2d-dcb9-43c4-b5a3-2fad9de161b8@linux.ibm.com \
    --to=donettom@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=p.raghav@samsung.com \
    --cc=ritesh.list@gmail.com \
    --cc=rppt@kernel.org \
    --cc=shuah@kernel.org \
    --cc=songmuchun@bytedance.com \
    --cc=tonyb@cybernetics.com \
    --cc=willy@infradead.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