Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1283906pxf; Fri, 19 Mar 2021 03:48:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbze9HoixT3H24J5n0vCVRVytUj8rGz8F0DajLGRe83yEfbsatMud4eCf7yVybopstSFbn X-Received: by 2002:aa7:da14:: with SMTP id r20mr8609155eds.181.1616150897102; Fri, 19 Mar 2021 03:48:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616150897; cv=none; d=google.com; s=arc-20160816; b=PYQB0nx0algOkfkNK/jwGQMHo62FqvX9U+8+fjI4aIvMud8t31gNkfFpkv1g02eNKS ceSlZ/1AJr6Vjmm611kuQuzwrWDnuPiFxe8lllN6dHJE3B4qA5++CMJo28l0ny6R5+DG 7Opp8YpvRKYNbke/ldq8TqPtzU0HRGdODbewYXjfDt9096ERpxrHF1DFyL7igC8OVk07 8pUYewQLHPSyMnME+fSZWTJcvX0i5tGTO5bt3phOCdNMobi6KsIIl6DoDUR8uumT1A5W Mf9okGBDKkhf4jY0RgOQqJOfjTUlYEHIc116/h2S05JbJ3YoUQ8KS2NDUn+ucs0irX1G HX/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=IiKmGq5ALKJOviqtefiE+iL58bDCX3b1yPQQUIE8CZI=; b=ZZ/4WzdHRqERh0h0dlt5jovF3mZa40CDkMV+WLqTgUz2/Hwi/smcxbWV0zcPvJ0khb VCddna5Adx5rwurNRc5KNmV5voeXuzf6+ApPed+YRzcjPlw6Ubed5gIGmz4oRegjk/fL HECs4qZH12IeuZO5/sBg9WZ4i9hiRZp7h2m7Drg+EYpXxyz5NB89RqtZfgIARkZK1c3A AWbKj2gBN47FWloEoRx6iLP3UTxLJB2fxSmz9pu/JeagFOZZBv8oKqvWPZ2vYvxiytl1 9istZNDznivlnjWZXOs9MkF83FABt7qfE/nV96TJ4IcnSwGhriNJalBoF2c6fXwFmjKN 2Z0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f16si3838027edy.444.2021.03.19.03.47.53; Fri, 19 Mar 2021 03:48:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229725AbhCSKqs (ORCPT + 99 others); Fri, 19 Mar 2021 06:46:48 -0400 Received: from mx2.suse.de ([195.135.220.15]:42822 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbhCSKqW (ORCPT ); Fri, 19 Mar 2021 06:46:22 -0400 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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