From: Li Li
Add "transaction_report" to the binderfs feature list, to help userspace
determine if the "BINDER_CMD_REPORT" generic netlink api is supported by
the binder driver.
Signed-off-by: Li Li
Signed-off-by: Carlos Llamas
---
drivers/android/binderfs.c
From: Li Li
Add "transaction_report" to the binderfs feature list, to help userspace
determine if the "BINDER_CMD_REPORT" generic netlink api is supported by
the binder driver.
Signed-off-by: Li Li
Signed-off-by: Carlos Llamas
---
drivers/android/binderfs.c
From: Li Li
Add "transaction_report" to the binderfs feature list, to help userspace
determine if the "BINDER_CMD_REPORT" generic netlink api is supported by
the binder driver.
Signed-off-by: Li Li
Signed-off-by: Carlos Llamas
---
drivers/android/binderfs.c
> defined when we're building the module?
Right, IS_ENABLED() is the "short-hand" for ...
#if defined(CONFIG_x) || defined(CONFIG_x_MODULE)
... which is what we need here.
--
Carlos Llamas
+ int i;
> +
> + for (i = 0; i < BUFFER_NUM; i++) {
> + last_offset = offset;
> + offset = end_offset[i];
> + front_sizes[i] = offset - last_offset;
> + back_sizes[BUFFER_NUM - i - 1] = front_sizes[i];
> + }
> + /*
> + * Buffers share the first or last few pages.
> + * Only BUFFER_NUM - 1 buffer sizes are adjustable since
> + * we need one giant buffer before getting to the last page.
> + */
> + back_sizes[0] += alloc->buffer_size - end_offset[BUFFER_NUM - 1];
> + permute_frees(test, alloc, front_sizes, seq, 0,
> + end_offset[BUFFER_NUM - 1]);
> + permute_frees(test, alloc, back_sizes, seq, 0, alloc->buffer_size);
> +}
> +
> +static void gen_buf_offsets(struct kunit *test, struct binder_alloc *alloc,
> + size_t *end_offset, int index)
> +{
> + size_t end, prev;
> + int align;
> +
> + if (index == BUFFER_NUM) {
> + gen_buf_sizes(test, alloc, end_offset);
> + return;
> + }
> + prev = index == 0 ? 0 : end_offset[index - 1];
> + end = prev;
> +
> + BUILD_BUG_ON(BUFFER_MIN_SIZE * BUFFER_NUM >= PAGE_SIZE);
> +
> + for (align = SAME_PAGE_UNALIGNED; align < LOOP_END; align++) {
> + if (align % 2)
> + end = ALIGN(end, PAGE_SIZE);
> + else
> + end += BUFFER_MIN_SIZE;
> + end_offset[index] = end;
> + gen_buf_offsets(test, alloc, end_offset, index + 1);
> + }
> +}
> +
> struct binder_alloc_test {
> struct binder_alloc alloc;
> struct list_lru binder_test_freelist;
> @@ -56,6 +315,25 @@ static void binder_alloc_test_mmap(struct kunit *test)
> KUNIT_EXPECT_TRUE(test, list_is_last(&buf->entry, &alloc->buffers));
> }
>
> +/**
> + * binder_alloc_exhaustive_test() - Exhaustively test alloc and free of
> buffer pages.
> + * @test: The test context object.
> + *
> + * Allocate BUFFER_NUM buffers to cover all page alignment cases,
> + * then free them in all orders possible. Check that pages are
> + * correctly allocated, put onto lru when buffers are freed, and
> + * are freed when binder_alloc_free_page() is called.
> + */
> +static void binder_alloc_exhaustive_test(struct kunit *test)
> +{
> + struct binder_alloc_test *priv = test->priv;
> + size_t end_offset[BUFFER_NUM];
> +
> + gen_buf_offsets(test, &priv->alloc, end_offset, 0);
> +
> + KUNIT_EXPECT_EQ(test, binder_alloc_test_failures, 0);
> +}
> +
> /* = End test cases = */
>
> static void binder_alloc_test_vma_close(struct vm_area_struct *vma)
> @@ -149,6 +427,7 @@ static void binder_alloc_test_exit(struct kunit *test)
> static struct kunit_case binder_alloc_test_cases[] = {
> KUNIT_CASE(binder_alloc_test_init_freelist),
> KUNIT_CASE(binder_alloc_test_mmap),
> + KUNIT_CASE(binder_alloc_exhaustive_test),
> {}
> };
>
> --
> 2.50.0.727.gbf7dc18ff4-goog
>
LGTM!
Acked-by: Carlos Llamas
would have 750,000 entries.
> This change structures the recursive calls into meaningful test cases so
> that failures are easier to interpret.
>
> Signed-off-by: Tiffany Yang
> ---
Great job here. Thanks!
Acked-by: Carlos Llamas
iv->mmap_uaddr) {
> + kunit_err(test, "Could not map the test's transaction
> memory\n");
> + return -ENOMEM;
> + }
> +
> + return 0;
> +}
> +
> +static void binder_alloc_test_exit(struct kunit *test)
> +{
> + struct binder_alloc_test *priv = test->priv;
> +
> + /* Close the backing file to make sure binder_alloc_vma_close runs */
> + if (!IS_ERR_OR_NULL(priv->filp))
> + fput(priv->filp);
> +
> + if (priv->alloc.mm)
> + binder_alloc_deferred_release(&priv->alloc);
> +
> + /* Make sure freelist is empty */
> + KUNIT_EXPECT_EQ(test, list_lru_count(&priv->binder_test_freelist), 0);
> + list_lru_destroy(&priv->binder_test_freelist);
> +}
> +
> +static struct kunit_case binder_alloc_test_cases[] = {
> + KUNIT_CASE(binder_alloc_test_init_freelist),
> + KUNIT_CASE(binder_alloc_test_mmap),
> + {}
> +};
> +
> +static struct kunit_suite binder_alloc_test_suite = {
> + .name = "binder_alloc",
> + .test_cases = binder_alloc_test_cases,
> + .init = binder_alloc_test_init,
> + .exit = binder_alloc_test_exit,
> +};
> +
> +kunit_test_suite(binder_alloc_test_suite);
> +
> +MODULE_AUTHOR("Tiffany Yang ");
> +MODULE_DESCRIPTION("Binder Alloc KUnit tests");
> +MODULE_LICENSE("GPL");
> --
> 2.50.0.727.gbf7dc18ff4-goog
>
Aside from the missing Copyright, feel free to add:
Acked-by: Carlos Llamas
ew mm if it doesn't already exist. */
> -static int kunit_attach_mm(void)
> +int kunit_attach_mm(void)
> {
> struct mm_struct *mm;
>
> @@ -49,6 +48,7 @@ static int kunit_attach_mm(void)
>
> return 0;
> }
> +EXPORT_SYMBOL_GPL(kunit_attach_mm);
>
> static int kunit_vm_mmap_init(struct kunit_resource *res, void *context)
> {
> --
> 2.50.0.727.gbf7dc18ff4-goog
>
LGTM!
Reviewed-by: Carlos Llamas
nit in a subsequent patch in this series.
>
> Signed-off-by: Tiffany Yang
> ---
LGTM!
Acked-by: Carlos Llamas
(end - 1) / PAGE_SIZE; i++) {
> if (list_empty(page_to_lru(alloc->pages[i]))) {
> pr_err_size_seq(sizes, seq);
> pr_err("expect lru but is %s at page index %d\n",
> --
> 2.50.0.727.gbf7dc18ff4-goog
>
LGTM!
Acked-by: Carlos Llamas
option to describe the
internal use of the macro instead of the _REAL suffix.
Other than that, this patch looks good to me:
Reviewed-by: Carlos Llamas
e_mod->mod;
| ^~~
Fixes: 9183c3f9ed71 ("static_call: Add inline static call infrastructure")
Reported-by: kernelci.org bot
Signed-off-by: Carlos Llamas
---
kernel/static_call.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/static_call.c b/ker
12 matches
Mail list logo