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 96380C43334 for ; Sun, 26 Jun 2022 20:52:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1BCAD8E0002; Sun, 26 Jun 2022 16:52:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 16CBF8E0001; Sun, 26 Jun 2022 16:52:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 034838E0002; Sun, 26 Jun 2022 16:52:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id EA39B8E0001 for ; Sun, 26 Jun 2022 16:52:00 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id B162C120DAD for ; Sun, 26 Jun 2022 20:52:00 +0000 (UTC) X-FDA: 79621584000.29.86F9390 Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) by imf14.hostedemail.com (Postfix) with ESMTP id 5643E100013 for ; Sun, 26 Jun 2022 20:52:00 +0000 (UTC) Received: by mail-qv1-f47.google.com with SMTP id u14so9640009qvv.2 for ; Sun, 26 Jun 2022 13:52:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=0uMJf4FJG/5wuR5sGkF8+rRgoUV4V+m2L2oEIirjeF8=; b=SKI1T/TZ191ugcTzlr53quPp0usXsnPGme2ITPQplFyNs5QQ6Wa3ttioJeMUtV0wBY RJT7Qn6mMyi3+QZ+q5TvcJBb5aEemux4u0+kwYFYHmCZb3WopQrN1UxbnR/6eXUPYzpR 5CKVYPs38K4NQxhj2z3eiAoeAfHleFPWtG0FjTPDdF+G6mW4KL2j+h9pIjykZ0cauwns vTjEq86u9NpTh/Xem6IcE5ML1my0X8std/QeU1U8EovJyukiyCadPWADP8aAMhyvnl4S fg10GYyjCP+L/EyvqArtGapezu9XOG81BHOyBvT2Ta/hM6waPUorVEt5wQLy9D2OWrKC 1GVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0uMJf4FJG/5wuR5sGkF8+rRgoUV4V+m2L2oEIirjeF8=; b=ZBDHXOAX4ymsnwdhnorL+K7x+nup8nTnutD4CPtUQn6q1QXrtDRIZWNaA35c/kQjnj Zml6CnpSrykf7vefFPIj5zF7IIdKdu1uO7unIxBFFbCC4uAmDer/XbggCF//JbEV+KMm SXZww8yJ8HtdzvEgSoob+72/uFVNCQ72pi/IdW6IIUE2mP40lGcKufaecWv/cxGqy7BO eW1BzKxTOnlhz5zRK9jlipWe8MU0svhc9Dj46LhsxVTvNYwmOltOhaWW4HzU/70k2XaV PA6SmsreZ4QdBgyjDbIjJsWrydpXzRbl760t0n0AqZS7KDrnR4kja10CKXsaedEq4pY7 B7SQ== X-Gm-Message-State: AJIora+GCyeHMRsbv1z5iWJ72AJcHBOk1pzmzpb9HL0Nq8fVkeBRO7/W VrtPTxJuFLMvM7marwV2Qw== X-Google-Smtp-Source: AGRyM1s0/7XqSbpTLPbt4CnLr4T/V3zTpGusZFFoFg9i+FFHWwKSNLcYjUDpNMwqcGFidyAiKaYu0Q== X-Received: by 2002:a05:6214:76a:b0:470:b527:a3f8 with SMTP id f10-20020a056214076a00b00470b527a3f8mr4021308qvz.110.1656276719619; Sun, 26 Jun 2022 13:51:59 -0700 (PDT) Received: from localhost (c-73-219-103-14.hsd1.vt.comcast.net. [73.219.103.14]) by smtp.gmail.com with ESMTPSA id j9-20020a05620a410900b006a740bb8578sm7402075qko.83.2022.06.26.13.51.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jun 2022 13:51:58 -0700 (PDT) Date: Sun, 26 Jun 2022 16:51:58 -0400 From: Kent Overstreet To: Joe Perches Cc: Linus Torvalds , Andrew Morton , David Laight , Petr Mladek , Steven Rostedt , Sergey Senozhatsky , Rasmus Villemoes , Matthew Wilcox , Miguel Ojeda , Andy Shevchenko , LKML , linux-mm Subject: Re: [RFC[ Alloc in vsprintf Message-ID: <20220626205158.bqeyetui3cromscp@moria.home.lan> References: <20220620004233.3805-1-kent.overstreet@gmail.com> <0a5901f8460f452a89c9b0cda32fb833@AcuMS.aculab.com> <20220620150514.3tjy5dv7pv5frcwd@moria.home.lan> <53d77ae6101a0f24cfb694174d4c7699424c57e8.camel@perches.com> <20220621005752.ohiq5besmy3r5rjo@moria.home.lan> <355e912490dbaef8fe4e12df0201c3f5b439565d.camel@perches.com> <93ab94ec92497af13c563c52fc7e1f7f81dac333.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <93ab94ec92497af13c563c52fc7e1f7f81dac333.camel@perches.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656276720; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=0uMJf4FJG/5wuR5sGkF8+rRgoUV4V+m2L2oEIirjeF8=; b=IYA5pP+4dA9BP1gkflkFvr8RKwEkxwKUUVYPOTNnMK1EVLgAXnj09UIviFFMgytoujl4RB n/3Zwa5Ym7vNAToFQ5z3QJwGzGkFCZpkSRucVcGpHUBZsOnktfeLSoB+QVJHzIARUkM4ZI fHDlFeid3PVZtmMiWtwYh9Fx3nFYtbE= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="SKI1T/TZ"; spf=pass (imf14.hostedemail.com: domain of kent.overstreet@gmail.com designates 209.85.219.47 as permitted sender) smtp.mailfrom=kent.overstreet@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656276720; a=rsa-sha256; cv=none; b=Zs+td6oHbOawyG29LRdlk7VYyC3mg3fRMT8dpP0GB0FtAAQptjgeG0AkoGra5ll6Y8U8x7 zL4DWohvf+9Lni+OQbPcoUSFycZ54gtLKkMX6wusvDwoLk54Rcilrwpiu6wqwK2xaZsw1d auAwWADu5BPHzlDJrk5Z3FVomJQEU+c= Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="SKI1T/TZ"; spf=pass (imf14.hostedemail.com: domain of kent.overstreet@gmail.com designates 209.85.219.47 as permitted sender) smtp.mailfrom=kent.overstreet@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-Rspamd-Server: rspam06 X-Stat-Signature: hfqahpsiffke3d3igzsfm7mnxbc6yzx8 X-Rspamd-Queue-Id: 5643E100013 X-HE-Tag: 1656276720-7414 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 Sun, Jun 26, 2022 at 01:39:01PM -0700, Joe Perches wrote: > On Sun, 2022-06-26 at 13:19 -0700, Linus Torvalds wrote: > > On Sun, Jun 26, 2022 at 12:53 PM Joe Perches wrote: > > > > > > In a reply to the printbufs thread, I wrote a proposal to use an > > > alloc to reduce stack in vsprintf when CONFIG_KALLSYMS is enabled. > > > > > > No one has replied to this but I think it's somewhat sensible. > > > > I think that's a bad idea. > > Somewhat sensible not sensible... > > > Those things are *literally* called from panic situations, which may > > be while holding core memory allocation locks, or similar. > > True, and special_hex_number was used on alloc failure. > > > Now, you are correct that the stack buffer is annoying. But I think > > the proper way to fix that is to say "we already *have* the target > > buffer, let's use it". > > OK, and that's true for all the temp stack buffers in every %p. Serious question: why are you trying to half-ass just _one_ of these functions when I've been working on solving stack allocations in all of them? I've already killed every single stack buffer in the last patch series that was posted except for symbol_string(). I would welcome the help if you wanted to tackle that one. It's not completely trivial because while kallsyms_expand_symbol() can be trivially converted to printbufs - it just outputs one char at a time, so that becomes prt_char() - it's not a output-once-and-done algorithm: cleanup_symbol_name() then goes back over the output buffer and modifies it in place (ew), because of weird clang things that it's got #ifdefs for. Specifically, it's truncating the output at the first period (easy to convert; just stop when we see a period) but then it truncates at the last $ - why? do we have symbols when building with gcc that legitimately have dollar signs in them? One would hope we could drop the #ifdefs but that needs to be checked. That's as far as I got looking at it just now. It will be some time before I have time to do it properly and run tests and research what I'm doing (because I am completely buried in bcachefs bugs to work through at the moment, and getting sucked into working on test automation _again_ when I have a million more valuable things I could be working on because the test infrastructure story for the kernel is still a shitshow, but that's another rant). Anayways, I'm trying to take the time to do this stuff right, but there's a _lot_ of work involved, so if you want to help out instead of just slag what I'm doing... well, it'd be nice... Cheers, Kent