[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdX84nfXui5a1rfCjF8CM4ifKTDnz3fQK4dkpJnfEeu-9Q@mail.gmail.com>
Date: Sun, 10 Sep 2017 13:48:04 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Sherry Yang <sherryy@...roid.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
tkjos@...gle.com, maco@...gle.com,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Arve Hjønnevåg <arve@...roid.com>,
Riley Andrews <riandrews@...roid.com>,
"open list:ANDROID DRIVERS" <devel@...verdev.osuosl.org>
Subject: Re: [PATCH 2/5] android: binder: Add allocator selftest
Hi Sherry,
On Wed, Aug 16, 2017 at 2:25 AM, Sherry Yang <sherryy@...roid.com> wrote:
> binder_alloc_selftest tests that alloc_new_buf handles page allocation and
> deallocation properly when allocate and free buffers. The test allocates 5
> buffers of various sizes to cover all possible page alignment cases, and
> frees the buffers using a list of exhaustive freeing order.
>
> Test: boot the device with ANDROID_BINDER_IPC_SELFTEST config option
> enabled. Allocator selftest passes.
>
> Change-Id: I9064f60c85b1e0389c88e927e2b147ec92cae0d1
> Signed-off-by: Sherry Yang <sherryy@...roid.com>
> ---
> drivers/android/Kconfig | 10 ++
> drivers/android/Makefile | 1 +
> drivers/android/binder.c | 2 +
> drivers/android/binder_alloc.h | 5 +
> drivers/android/binder_alloc_selftest.c | 271 ++++++++++++++++++++++++++++++++
> 5 files changed, 289 insertions(+)
> create mode 100644 drivers/android/binder_alloc_selftest.c
>
> diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig
> index 832e885349b1..0f295704abd4 100644
> --- a/drivers/android/Kconfig
> +++ b/drivers/android/Kconfig
> @@ -44,6 +44,16 @@ config ANDROID_BINDER_IPC_32BIT
>
> Note that enabling this will break newer Android user-space.
>
> +config ANDROID_BINDER_IPC_SELFTEST
> + bool "Android Binder IPC Driver Selftest"
What about making this tristate...
> + depends on ANDROID_BINDER_IPC
> + ---help---
> + This feature allows binder selftest to run.
> +
> + Binder selftest checks the allocation and free of binder buffers
> + exhaustively with combinations of various buffer sizes and
> + alignments.
> +
> endif # if ANDROID
>
> endmenu
> diff --git a/drivers/android/Makefile b/drivers/android/Makefile
> index 4b7c726bb560..a01254c43ee3 100644
> --- a/drivers/android/Makefile
> +++ b/drivers/android/Makefile
> @@ -1,3 +1,4 @@
> ccflags-y += -I$(src) # needed for trace events
>
> obj-$(CONFIG_ANDROID_BINDER_IPC) += binder.o binder_alloc.o
> +obj-$(CONFIG_ANDROID_BINDER_IPC_SELFTEST) += binder_alloc_selftest.o
> diff --git a/drivers/android/binder.c b/drivers/android/binder.c
> index 9f95d7093f32..b31e64c6f666 100644
> --- a/drivers/android/binder.c
> +++ b/drivers/android/binder.c
> @@ -4225,6 +4225,8 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
> /*pr_info("binder_ioctl: %d:%d %x %lx\n",
> proc->pid, current->pid, cmd, arg);*/
>
> + binder_selftest_alloc(&proc->alloc);
... and calling the selftest function from module_init() in
drivers/android/binder_alloc_selftest.c?
That way the test can either run builtin during starup, or during module load,
like most other selftests?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists