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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09938C25B74 for ; Sun, 2 Jun 2024 21:08:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 69D826B00B8; Sun, 2 Jun 2024 17:08:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 64D0F6B00C7; Sun, 2 Jun 2024 17:08:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4C6BF6B00C8; Sun, 2 Jun 2024 17:08:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 2E46D6B00C7 for ; Sun, 2 Jun 2024 17:08:16 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id ADC5E140452 for ; Sun, 2 Jun 2024 21:08:15 +0000 (UTC) X-FDA: 82187186550.09.E72D07C Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf12.hostedemail.com (Postfix) with ESMTP id 354434001A for ; Sun, 2 Jun 2024 21:08:12 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=xAoIyPs2; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=aSXhDgJ9; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=xAoIyPs2; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=aSXhDgJ9; dmarc=none; spf=pass (imf12.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.130 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717362493; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=tQZEL/vbM6wKuOYcR4luQQldeA8eAyr6eXnPVohUWho=; b=k0DRwQahbbRWwikT6Ido1CVRkZcEoQLt+llbebgkuSP9R/Qnm6kztSCSHqobLF1Tz49baR qWDbnqSzy5RdWNzeYlOEeZfNZXrILKLsyle0IGkW7PhX6dZgOvm2uGqS4iEpS5pPBtw7XN WG1YmuNBAsgNJ/Ayr1DfGZGLAiGo/eY= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=xAoIyPs2; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=aSXhDgJ9; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=xAoIyPs2; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=aSXhDgJ9; dmarc=none; spf=pass (imf12.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.130 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717362493; a=rsa-sha256; cv=none; b=SFJDGyn6urT7Ye8+u664NVVvMaObTJ9AlVoba0ZDVQtUOI+hbD+/zH+kZkLTgePO/EUim3 ccKbtXg3jSt/xTuIDT1esAd7lE6TTSzuxmloBxa8cB1HJptP+3iSrh/E1gtD8qE6aC1XZ7 OuZIhU+UqtLeA8PnADO3jXBDnhsKq5Y= Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 2501022134; Sun, 2 Jun 2024 21:08:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1717362491; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=tQZEL/vbM6wKuOYcR4luQQldeA8eAyr6eXnPVohUWho=; b=xAoIyPs2nTlPuXCvTy9BLDzkeK3XIxu4KrdpEnjl8vEwe1c5tZwUZwxCH9m1GJS3l8kOEo q6cU7KRkvTGXBdt/ZklFK4Y/pIKfOXxsRxWGpFj5LYVdvOUaJpsqyDz6m+mVa3Dyc6pJUO NMEI8sToe2CKOO3/KmRsV2aQCeEaKYc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1717362491; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=tQZEL/vbM6wKuOYcR4luQQldeA8eAyr6eXnPVohUWho=; b=aSXhDgJ9nCrdqhhFTzYHoMz8jOuP0qkmQxZazYXkE/ROGrigeg61nXgB+kMyfXujAaFchM piBSnd/cL+qA+FAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1717362491; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=tQZEL/vbM6wKuOYcR4luQQldeA8eAyr6eXnPVohUWho=; b=xAoIyPs2nTlPuXCvTy9BLDzkeK3XIxu4KrdpEnjl8vEwe1c5tZwUZwxCH9m1GJS3l8kOEo q6cU7KRkvTGXBdt/ZklFK4Y/pIKfOXxsRxWGpFj5LYVdvOUaJpsqyDz6m+mVa3Dyc6pJUO NMEI8sToe2CKOO3/KmRsV2aQCeEaKYc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1717362491; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=tQZEL/vbM6wKuOYcR4luQQldeA8eAyr6eXnPVohUWho=; b=aSXhDgJ9nCrdqhhFTzYHoMz8jOuP0qkmQxZazYXkE/ROGrigeg61nXgB+kMyfXujAaFchM piBSnd/cL+qA+FAA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id ECED713A97; Sun, 2 Jun 2024 21:08:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id ZW4ROTrfXGbvOQAAD6G6ig (envelope-from ); Sun, 02 Jun 2024 21:08:10 +0000 Message-ID: Date: Sun, 2 Jun 2024 23:08:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RFC 0/4] static key support for error injection functions To: David Rientjes Cc: Akinobu Mita , Christoph Lameter , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , "Naveen N. Rao" , Anil S Keshavamurthy , "David S. Miller" , Masami Hiramatsu , Steven Rostedt , Mark Rutland , Jiri Olsa , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-kernel@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org, linux-trace-kernel@vger.kernel.org References: <20240531-fault-injection-statickeys-v1-0-a513fd0a9614@suse.cz> <71ebaa45-dbd0-b39d-4b33-88da3f497297@google.com> Content-Language: en-US From: Vlastimil Babka Autocrypt: addr=vbabka@suse.cz; keydata= xsFNBFZdmxYBEADsw/SiUSjB0dM+vSh95UkgcHjzEVBlby/Fg+g42O7LAEkCYXi/vvq31JTB KxRWDHX0R2tgpFDXHnzZcQywawu8eSq0LxzxFNYMvtB7sV1pxYwej2qx9B75qW2plBs+7+YB 87tMFA+u+L4Z5xAzIimfLD5EKC56kJ1CsXlM8S/LHcmdD9Ctkn3trYDNnat0eoAcfPIP2OZ+ 9oe9IF/R28zmh0ifLXyJQQz5ofdj4bPf8ecEW0rhcqHfTD8k4yK0xxt3xW+6Exqp9n9bydiy tcSAw/TahjW6yrA+6JhSBv1v2tIm+itQc073zjSX8OFL51qQVzRFr7H2UQG33lw2QrvHRXqD Ot7ViKam7v0Ho9wEWiQOOZlHItOOXFphWb2yq3nzrKe45oWoSgkxKb97MVsQ+q2SYjJRBBH4 8qKhphADYxkIP6yut/eaj9ImvRUZZRi0DTc8xfnvHGTjKbJzC2xpFcY0DQbZzuwsIZ8OPJCc LM4S7mT25NE5kUTG/TKQCk922vRdGVMoLA7dIQrgXnRXtyT61sg8PG4wcfOnuWf8577aXP1x 6mzw3/jh3F+oSBHb/GcLC7mvWreJifUL2gEdssGfXhGWBo6zLS3qhgtwjay0Jl+kza1lo+Cv BB2T79D4WGdDuVa4eOrQ02TxqGN7G0Biz5ZLRSFzQSQwLn8fbwARAQABzSBWbGFzdGltaWwg QmFia2EgPHZiYWJrYUBzdXNlLmN6PsLBlAQTAQoAPgIbAwULCQgHAwUVCgkICwUWAgMBAAIe AQIXgBYhBKlA1DSZLC6OmRA9UCJPp+fMgqZkBQJkBREIBQkRadznAAoJECJPp+fMgqZkNxIQ ALZRqwdUGzqL2aeSavbum/VF/+td+nZfuH0xeWiO2w8mG0+nPd5j9ujYeHcUP1edE7uQrjOC Gs9sm8+W1xYnbClMJTsXiAV88D2btFUdU1mCXURAL9wWZ8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YzMY9TWpA8psFTKTUIIQmx2scYsRBUwm5VI EurRWKqENcDRjyo+ol59j0FViYysjQQeobXBDDE31t5SBg++veI6tXfpco/UiKEsDswL1WAr tEAZaruo7254TyH+gydURl2wJuzo/aZ7Y7PpqaODbYv727Dvm5eX64HCyyAH0s6sOCyGF5/p eIhrOn24oBf67KtdAN3H9JoFNUVTYJc1VJU3R1JtVdgwEdr+NEciEfYl0O19VpLE/PZxP4wX PWnhf5WjdoNI1Xec+RcJ5p/pSel0jnvBX8L2cmniYnmI883NhtGZsEWj++wyKiS4NranDFlA HdDM3b4lUth1pTtABKQ1YuTvehj7EfoWD3bv9kuGZGPrAeFNiHPdOT7DaXKeHpW9homgtBxj 8aX/UkSvEGJKUEbFL9cVa5tzyialGkSiZJNkWgeHe+jEcfRT6pJZOJidSCdzvJpbdJmm+eED w9XOLH1IIWh7RURU7G1iOfEfmImFeC3cbbS73LQEFGe1urxvIH5K/7vX+FkNcr9ujwWuPE9b 1C2o4i/yZPLXIVy387EjA6GZMqvQUFuSTs/GeBcv0NjIQi8867H3uLjz+mQy63fAitsDwLmR EP+ylKVEKb0Q2A== In-Reply-To: <71ebaa45-dbd0-b39d-4b33-88da3f497297@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Action: no action X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 354434001A X-Stat-Signature: fw7xka8f51tpo6cpp9ubfbrekwgzbrwk X-HE-Tag: 1717362492-992882 X-HE-Meta: U2FsdGVkX1/tPgOyrmhfbAwtQlNWQm/OlbU1IC0JktRYgOCD5UPW3YXTbfJ2mNB28IZ2QXQlDPc5+UjcBCSYFTHqFkf1EMh32QAnrYgz1MwWFSOMVoyBPFc5DoXq189mQAZVtaRfAUkOKe0CaiVxuAAoDDPTJHkbF9l9AVDcHdLCaa6rLYGtBGqZPVzVvInLibSX/itTV1q/DNZWADC4kmCU+ovLZH9D3MiN5LiIJBPGP8XIBNuV6OeL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sONCiLEKZi3SGdGR+c6wlQWOC6VUrQYvtTawYsJxY79584JO1zXgHGaPNAUyIm68pnD9gwLJATQPXHigzFu9fqEHE2CW+vbWKJNzju8E= 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: List-Subscribe: List-Unsubscribe: On 6/2/24 10:47 PM, David Rientjes wrote: > On Fri, 31 May 2024, Vlastimil Babka wrote: > >> Patches 3 and 4 implement the static keys for the two mm fault injection >> sites in slab and page allocators. For a quick demonstration I've run a >> VM and the simple test from [1] that stresses the slab allocator and got >> this time before the series: >> >> real 0m8.349s >> user 0m0.694s >> sys 0m7.648s >> >> with perf showing >> >> 0.61% nonexistent [kernel.kallsyms] [k] should_failslab.constprop.0 >> 0.00% nonexistent [kernel.kallsyms] [k] should_fail_alloc_page ▒ >> >> And after the series >> >> real 0m7.924s >> user 0m0.727s >> sys 0m7.191s >> >> and the functions gone from perf report. >> > > Impressive results that will no doubt be a win for kernels that enable > these options. Oh, I should have been more clear about it. This was done with both of these options disabled. It's measuring just removing the overhead of calling the empty noninline function, otherwise the difference would be larger. CPU mitigations (defaults) were enabled though, which affects the cost of function calls (this was in KVM guest on Ryzen 2700). > Both CONFIG_FAILSLAB and CONFIG_FAIL_PAGE_ALLOC go out of their way to > have no overhead, both in performance and kernel text overhead, when the > .config options are disabled. Except the unavoidable function call overhead since commits 4f6923fbb352 and af3b854492f3. > Do we have any insight into the distros or users that enable either of > these options and are expecting optimal performance? I would have assumed > that while CONFIG_FAULT_INJECTION may be enabled that any users who would > care deeply about this would have disabled both of these debug options. Eliminating the empty function call overhead, which is currently not possible to configure out in any way, was my primary goal. For our distro we disable the options and they are enabled only in a debug kernel option. So the additional benefit of the static key is we could enable them with no cost, and have them available for when needed, without the need to change kernel. This is great for debugging functionality in general (debug_pagealloc, page_owner), maybe this would be less likely to be useful, but one never knows. >> There might be other such fault injection callsites in hotpaths of other >> subsystems but I didn't search for them at this point. >> >> [1] https://lore.kernel.org/all/6d5bb852-8703-4abf-a52b-90816bccbd7f@suse.cz/ >> [2] https://lore.kernel.org/all/3j5d3p22ssv7xoaghzraa7crcfih3h2qqjlhmjppbp6f42pg2t@kg7qoicog5ye/ >> >> Signed-off-by: Vlastimil Babka >> --- >> Vlastimil Babka (4): >> fault-inject: add support for static keys around fault injection sites >> error-injection: support static keys around injectable functions >> mm, slab: add static key for should_failslab() >> mm, page_alloc: add static key for should_fail_alloc_page() >> >> include/asm-generic/error-injection.h | 13 ++++++++++- >> include/asm-generic/vmlinux.lds.h | 2 +- >> include/linux/error-injection.h | 9 +++++--- >> include/linux/fault-inject.h | 7 +++++- >> kernel/fail_function.c | 22 +++++++++++++++--- >> lib/error-inject.c | 6 ++++- >> lib/fault-inject.c | 43 ++++++++++++++++++++++++++++++++++- >> mm/fail_page_alloc.c | 3 ++- >> mm/failslab.c | 2 +- >> mm/internal.h | 2 ++ >> mm/page_alloc.c | 11 ++++++--- >> mm/slab.h | 3 +++ >> mm/slub.c | 10 +++++--- >> 13 files changed, 114 insertions(+), 19 deletions(-) >> --- >> base-commit: 1613e604df0cd359cf2a7fbd9be7a0bcfacfabd0 >> change-id: 20240530-fault-injection-statickeys-66b7222e91b7 >> >> Best regards, >> -- >> Vlastimil Babka >> >>