From: Andrea Arcangeli
As far as the rmap code is concerned, UFFDIO_REMAP only alters the
page->mapping and page->index. It does it while holding the page
lock. However folio_referenced() is doing rmap walks without taking the
folio lock first, so folio_lock_anon_vma_read() must be updated to
re-
Add a test for new UFFDIO_REMAP ioctl which uses uffd to remaps source
into destination buffer while checking the contents of both after
remapping. After the operation the content of the destination buffer
should match the original source buffer's content while the source
buffer should be zeroed.
From: Andrea Arcangeli
This implements the uABI of UFFDIO_REMAP.
Notably one mode bitflag is also forwarded (and in turn known) by the
lowlevel remap_pages method.
Signed-off-by: Andrea Arcangeli
Signed-off-by: Suren Baghdasaryan
---
Changes since v1:
- add mmget_not_zero in userfaultfd_remap
This patch series introduces UFFDIO_REMAP feature to userfaultfd, which
has long been implemented and maintained by Andrea in his local tree [1],
but was not upstreamed due to lack of use cases where this approach would
be better than allocating a new page and copying the contents.
UFFDIO_COPY per
To avoid the failure of alloc, we could check the return value of
kmalloc() and kzalloc().
Signed-off-by: Ma Ke
---
lib/list-test.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/list-test.c b/lib/list-test.c
index 0cc27de9cec8..a0b478042477 100644
--- a/lib/list-te
On Fri, Sep 22, 2023 at 4:40 AM Ma Ke wrote:
>
> To avoid the failure of alloc, we could check the return value of
> kmalloc() and kzalloc().
Thanks, that's a good point, some suggestions below.
And also a question for David Gow whenever he sees this.
>
> Signed-off-by: Ma Ke
> ---
> lib/list-
On 9/19/2023 05:33, Swapnil Sapkal wrote:
In selftests/amd-pstate, tbench and gitsource microbenchmarks are used to
compare the performance with different governors. In Current
implementation relative path to run `amd_pstate_tracer.py`
broken. Fixed this by using absolute paths.
Also selftests/am
In the ZA and ZT test programs we explicitly validate that PSTATE.ZA is as
expected on each loop but we do not do the equivalent for our streaming
SVE test, add a check that we are still in streaming mode on every loop
in case that goes wrong.
Signed-off-by: Mark Brown
---
tools/testing/selftest
On Thu, Sep 21, 2023 at 01:14:43PM +0300, Nikolay Aleksandrov wrote:
> On 9/21/23 10:23, Johannes Nixdorf wrote:
> > On Wed, Sep 20, 2023 at 01:46:02PM +0300, Nikolay Aleksandrov wrote:
> > > On 9/19/23 11:12, Johannes Nixdorf wrote:
> > > > Set any new attributes added to br_policy to be parsed st
To avoid the failure of alloc, we could check the return value of
kmalloc() and kzalloc().
Signed-off-by: Ma Ke
---
lib/list-test.c | 9 +
1 file changed, 9 insertions(+)
diff --git a/lib/list-test.c b/lib/list-test.c
index 0cc27de9cec8..70e898976dbf 100644
--- a/lib/list-test.c
+++ b/l
Add kunit tests to benchmark 256MiB copies to a KVEC iterator, a BVEC
iterator, an XARRAY iterator and to a loop that allocates 256-page BVECs
and fills them in (similar to a maximal bio struct being set up).
Signed-off-by: David Howells
cc: Christoph Hellwig
cc: Christian Brauner
cc: Jens Axbo
Add a kunit test to benchmark an xarray containing 256MiB of data getting
decanted into 256-page BVEC iterators that get copied from - modelling
bufferage being drawn from the pagecache and batched up for I/O.
Signed-off-by: David Howells
cc: Christoph Hellwig
cc: Christian Brauner
cc: Jens Axb
Add kunit tests to benchmark 256MiB copies to a UBUF iterator and an IOVEC
iterator. This attaches a userspace VM with a mapped file in it
temporarily to the test thread.
Signed-off-by: David Howells
cc: Andrew Morton
cc: Christoph Hellwig
cc: Christian Brauner
cc: Jens Axboe
cc: Al Viro
cc
Consolidate some of the repeated code snippets into helper functions to
reduce the line count.
Signed-off-by: David Howells
cc: Christoph Hellwig
cc: Christian Brauner
cc: Jens Axboe
cc: Al Viro
cc: David Hildenbrand
cc: John Hubbard
cc: Brendan Higgins
cc: David Gow
cc: linux-kselftest@v
Add extraction kunit tests for ITER_UBUF- and ITER_IOVEC-type iterators.
This attaches a userspace VM with a mapped file in it temporarily to the
test thread.
[!] Note that this requires the kernel thread running the test to obtain
and deploy an mm_struct so that a user-side buffer can be created
Consolidate the test vector struct in the kunit tests so that the bvec
pattern check helpers can share with the kvec check helpers.
Signed-off-by: David Howells
cc: Christoph Hellwig
cc: Christian Brauner
cc: Jens Axboe
cc: Al Viro
cc: David Hildenbrand
cc: John Hubbard
cc: Brendan Higgins
Add copy kunit tests for ITER_UBUF- and ITER_IOVEC-type iterators. This
attaches a userspace VM with a mapped file in it temporarily to the test
thread.
Signed-off-by: David Howells
cc: Andrew Morton
cc: Christoph Hellwig
cc: Christian Brauner
cc: Jens Axboe
cc: Al Viro
cc: Matthew Wilcox
Create a function to set up a userspace VM for the kunit testing thread and
set up a buffer within it such that ITER_UBUF and ITER_IOVEC tests can be
performed.
Note that this requires current->mm to point to a sufficiently set up
mm_struct. This is done by partially mirroring what execve does.
Fix some checkpatch complaints in the new iov_iter kunit tests:
(1) Some lines had eight spaces instead of a tab at the start.
(2) Checkpatch doesn't like (void*)(unsigned long)0xnULL, so switch to
using POISON_POINTER_DELTA plus an offset instead.
Reported-by: Johannes Thumshirn
Sig
Make the BVEC-testing functions use the consolidated pattern checking
functions to reduce the amount of duplicated code.
Signed-off-by: David Howells
cc: Christoph Hellwig
cc: Christian Brauner
cc: Jens Axboe
cc: Al Viro
cc: David Hildenbrand
cc: John Hubbard
cc: Brendan Higgins
cc: David
Hi Jens,
Can you consider taking this through the block tree?
These patches make some changes to the kunit tests previously added for
iov_iter testing, in particular adding testing of UBUF/IOVEC iterators and
some benchmarking:
(1) Clean up a couple of checkpatch style complaints.
(2) Consoli
On Fri, 22 Sep 2023, Maciej Wieczor-Retman wrote:
> Writing bitmasks to the schemata can fail when the bitmask doesn't
> adhere to constraints defined by what a particular CPU supports.
> Some example of constraints are max length or having contiguous bits.
> The driver should properly return erro
On 2023-09-21 17:44, Jason Gunthorpe wrote:
On Thu, Sep 21, 2023 at 08:12:03PM +0800, Baolu Lu wrote:
On 2023/9/21 15:51, Yi Liu wrote:
diff --git a/include/uapi/linux/iommufd.h b/include/uapi/linux/iommufd.h
index 4a7c5c8fdbb4..3c8660fe9bb1 100644
--- a/include/uapi/linux/iommufd.h
+++ b/inclu
A long unsigned int variable is passed to the ksft_print_msg() and the
format specifier used expects a variable of type int.
Change the format specifier to match the passed variable.
Reviewed-by: Ilpo Järvinen
Signed-off-by: Maciej Wieczor-Retman
---
Changelog v3:
- Add Reviewed-by tag. (Ilpo)
The mm selftest uses the printf attribute in its full form. Since the
header file that uses it also includes kselftests.h it can use the macro
defined there.
Use __printf() included with kselftests.h instead of the full attribute.
Fix a wrong format specifier in ksft_print_msg().
Signed-off-by:
The __printf() macro is used in many tools in the linux kernel to
validate the format specifiers in functions that use printf. The kvm
selftest uses it without putting it in a macro definition while it
also imports the kselftests.h header.
Use __printf() from kselftests.h instead of the full attri
The format specifier inside ksft printing function expects a long
unsigned int but the passed variable is of unsigned int type.
Fix the format specifier so it matches the passed variable.
Reviewed-by: Ilpo Järvinen
Signed-off-by: Maciej Wieczor-Retman
---
Changelog v2:
- Add Reviewed-by tag (Il
Ksft_print_msg() inside test_openat2_flags() uses the wrong format
specifier for printing test.how->flags variable.
Change the format specifier to %llX so it matches the printed variable.
Reviewed-by: Ilpo Järvinen
Signed-off-by: Maciej Wieczor-Retman
---
Changelog v2:
- Add Reviewed-by tag (Il
Many calls to ksft print functions have format strings that don't match
with other passed arguments. One call expects a string but doesn't
provide any argument after the format string.
Fix format specifiers so they match the passed variables.
Add a missing variable to ksft_test_result_pass() insi
The format specifier in printf() call expects long int variables and
received long long int.
Change format specifiers to long long int so they match passed
variables.
Acked-by: Nhat Pham
Signed-off-by: Maciej Wieczor-Retman
---
Changelog v2:
- Add Acked-by tag (Nhat)
tools/testing/selftests/c
Kselftest header defines multiple variadic functions that use printf
along with other logic.
There is no format checking for the variadic functions that use
printing inside kselftest.h. Because of this the compiler won't
be able to catch instances of mismatched printf formats and debugging
tests m
Kselftest.h declares many variadic functions that can print some
formatted message while also executing selftest logic. These
declarations don't have any compiler mechanism to verify if passed
arguments are valid in comparison with format specifiers used in
printf() calls.
Attribute addition can m
Writing bitmasks to the schemata can fail when the bitmask doesn't
adhere to constraints defined by what a particular CPU supports.
Some example of constraints are max length or having contiguous bits.
The driver should properly return errors when any rule concerning
bitmask format is broken.
Resc
resctrlfs.c contains mostly functions that interact in some way with
resctrl FS entries while functions inside resctrl_val.c deal with
measurements and benchmarking.
run_benchmark() is located in resctrlfs.c even though it's purpose
is not interacting with the resctrl FS but to execute cache check
Write_schemata() uses fprintf() to write a bitmask into a schemata file
inside resctrl FS. It checks fprintf() return value but it doesn't check
fclose() return value. Error codes from fprintf() such as write errors,
are buffered and flushed back to the user only after fclose() is executed
which me
On Fri, 22 Sept 2023 at 15:11, 'Jinjie Ruan' via KUnit Development
wrote:
>
> If the outer layer for loop is iterated more than once and it fails not
> in the first iteration, the filtered_suite and filtered_suite->test_cases
> allocated in the last kunit_filter_attr_tests() in last inner for loop
On Fri, 22 Sept 2023 at 15:11, 'Jinjie Ruan' via KUnit Development
wrote:
>
> modprobe cpumask_kunit and rmmod cpumask_kunit, kmemleak detect
> a suspected memory leak as below.
>
> If kunit_filter_suites() in kunit_module_init() succeeds, the
> suite_set.start will not be NULL and the kunit_free_
On Fri, 22 Sept 2023 at 15:11, 'Jinjie Ruan' via KUnit Development
wrote:
>
> If the outer layer for loop is iterated more than once and it fails not
> in the first iteration, the copy pointer has been moved. So it should free
> the original copy's backup copy_start.
>
> Fixes: abbf73816b6f ("kuni
On Fri, 22 Sept 2023 at 15:11, 'Jinjie Ruan' via KUnit Development
wrote:
>
> When CONFIG_KUNIT_ALL_TESTS=y, making CONFIG_DEBUG_KMEMLEAK=y and
> CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN=y, the below memory leak is detected.
>
> If kunit_filter_suites() succeeds, not only copy but also filtered_suite
> and
On 2023/9/22 15:34, David Gow wrote:
> On Thu, 21 Sept 2023 at 09:41, 'Jinjie Ruan' via KUnit Development
> wrote:
>>
>> When CONFIG_KUNIT_ALL_TESTS=y, making CONFIG_DEBUG_KMEMLEAK=y and
>> CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN=y, the below memory leak is detected.
>>
>> If kunit_filter_suites() succ
On Thu, 21 Sept 2023 at 09:41, 'Jinjie Ruan' via KUnit Development
wrote:
>
> When CONFIG_KUNIT_ALL_TESTS=y, making CONFIG_DEBUG_KMEMLEAK=y and
> CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN=y, the below memory leak is detected.
>
> If kunit_filter_suites() succeeds, not only copy but also filtered_suite
> and
On Thu, 21 Sept 2023 at 09:41, 'Jinjie Ruan' via KUnit Development
wrote:
>
> If the outer layer for loop is iterated more than once and it fails not
> in the first iteration, the filtered_suite and filtered_suite->test_cases
> allocated in the last kunit_filter_attr_tests() in last inner for loop
On Thu, 21 Sept 2023 at 09:41, 'Jinjie Ruan' via KUnit Development
wrote:
>
> If the outer layer for loop is iterated more than once and it fails not
> in the first iteration, the copy pointer has been moved. So it should free
> the original copy's backup copy_start.
>
> Fixes: abbf73816b6f ("kuni
On Thu, 21 Sept 2023 at 09:41, 'Jinjie Ruan' via KUnit Development
wrote:
>
> modprobe cpumask_kunit and rmmod cpumask_kunit, kmemleak detect
> a suspected memory leak as below.
>
> If kunit_filter_suites() in kunit_module_init() succeeds, the
> suite_set.start will not be NULL and the kunit_free_
On Thu, 21 Sept 2023 at 16:18, Ma Ke wrote:
>
> To avoid the failure of alloc, we could check the return value of
> kmalloc() and kzalloc().
>
> Signed-off-by: Ma Ke
> ---
Fair enough, though I'd want the test to fail in this case (or, at the
very least, be skipped).
Could we use KUNIT_ASSERT_N
When CONFIG_KUNIT_ALL_TESTS=y, making CONFIG_DEBUG_KMEMLEAK=y and
CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN=y, the below memory leak is detected.
If kunit_filter_suites() succeeds, not only copy but also filtered_suite
and filtered_suite->test_cases should be freed.
So as Rae suggested, to avoid the suite
If the outer layer for loop is iterated more than once and it fails not
in the first iteration, the filtered_suite and filtered_suite->test_cases
allocated in the last kunit_filter_attr_tests() in last inner for loop
is leaked.
So add a new free_filtered_suite err label and free the filtered_suite
If the outer layer for loop is iterated more than once and it fails not
in the first iteration, the copy pointer has been moved. So it should free
the original copy's backup copy_start.
Fixes: abbf73816b6f ("kunit: fix possible memory leak in kunit_filter_suites()")
Signed-off-by: Jinjie Ruan
Rev
The test_cases is not freed in kunit_free_suite_set().
And the copy pointer may be moved in kunit_filter_suites().
The filtered_suite and filtered_suite->test_cases allocated in the last
kunit_filter_attr_tests() in last inner for loop may be leaked if
kunit_filter_suites() fails.
If kunit_filte
modprobe cpumask_kunit and rmmod cpumask_kunit, kmemleak detect
a suspected memory leak as below.
If kunit_filter_suites() in kunit_module_init() succeeds, the
suite_set.start will not be NULL and the kunit_free_suite_set() in
kunit_module_exit() should free all the memory which has not
been freed
50 matches
Mail list logo