From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C19C1C433E0 for ; Fri, 19 Mar 2021 10:46:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2690A64F53 for ; Fri, 19 Mar 2021 10:46:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2690A64F53 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 98F086B006E; Fri, 19 Mar 2021 06:46:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9669C6B0074; Fri, 19 Mar 2021 06:46:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 855386B0075; Fri, 19 Mar 2021 06:46:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0067.hostedemail.com [216.40.44.67]) by kanga.kvack.org (Postfix) with ESMTP id 69A1B6B006E for ; Fri, 19 Mar 2021 06:46:23 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 1AF2A18029D86 for ; Fri, 19 Mar 2021 10:46:23 +0000 (UTC) X-FDA: 77936294646.03.447863E Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf24.hostedemail.com (Postfix) with ESMTP id 91D45A0009EB for ; Fri, 19 Mar 2021 10:46:22 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 709A4ACC6; Fri, 19 Mar 2021 10:46:21 +0000 (UTC) Subject: Re: [PATCH 1/2] selftests: add a kselftest for SLUB debugging functionality To: Marco Elver , glittao@gmail.com Cc: cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, shuah@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org References: <20210316124118.6874-1-glittao@gmail.com> From: Vlastimil Babka Message-ID: <3ba2228a-1442-40b4-578f-f693d9a054e7@suse.cz> Date: Fri, 19 Mar 2021 11:46:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Stat-Signature: 53x37zugbubtky1714qkqr78qcoaswt1 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 91D45A0009EB Received-SPF: none (suse.cz>: No applicable sender policy available) receiver=imf24; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: none/none X-HE-Tag: 1616150782-381479 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 3/18/21 12:47 PM, Marco Elver wrote: > On Tue, Mar 16, 2021 at 01:41PM +0100, glittao@gmail.com wrote: >> From: Oliver Glitta >> >> SLUB has resiliency_test() function which is hidden behind #ifdef >> SLUB_RESILIENCY_TEST that is not part of Kconfig, so nobody >> runs it. Kselftest should proper replacement for it. >> >> Try changing byte in redzone after allocation and changing >> pointer to next free node, first byte, 50th byte and redzone >> byte. Check if validation finds errors. >> >> There are several differences from the original resiliency test: >> Tests create own caches with known state instead of corrupting >> shared kmalloc caches. >> >> The corruption of freepointer uses correct offset, the original >> resiliency test got broken with freepointer changes. >> >> Scratch changing random byte test, because it does not have >> meaning in this form where we need deterministic results. >> >> Add new option CONFIG_TEST_SLUB in Kconfig. >> >> Add parameter to function validate_slab_cache() to return >> number of errors in cache. >> >> Signed-off-by: Oliver Glitta > > No objection per-se, but have you considered a KUnit-based test instead? To be honest, we didn't realize about that option. > There is no user space portion required to run this test, and a pure > in-kernel KUnit test would be cleaner. Various boiler-plate below, > including pr_err()s, the kselftest script etc. would simply not be > necessary. > > This is only a suggestion, but just want to make sure you've considered > the option and weighed its pros/cons. Thanks for the suggestion. But I hope we would expand the tests later to e.g. check the contents of various SLUB related sysfs files or even write to them, and for that goal kselftest seems to be a better starting place? Vlastimil