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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0D07C43334 for ; Sun, 26 Jun 2022 20:52:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231921AbiFZUwE (ORCPT ); Sun, 26 Jun 2022 16:52:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230477AbiFZUwB (ORCPT ); Sun, 26 Jun 2022 16:52:01 -0400 Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 782F81175 for ; Sun, 26 Jun 2022 13:52:00 -0700 (PDT) Received: by mail-qv1-xf35.google.com with SMTP id 89so12382451qvc.0 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=HLP987+YjN5u3mkD3y8dTHTY4P7kFKcKL8x2E8xjW8LGH8f2b1Aex939vD5DacS4E2 C93ChpYfGmhp9vyIylxxA6sC3vb2RbwZcZ9bgqCMbE7ZNtPHnCh8reYw5027ZMyljn2n s3zV0dZxz0xhyPfCxJAKQF294EsQJPdNQqmjEPymF5mDXEOHwgTWwmyo58KhQqCL/qX1 NpHmoIe4CJKgQK1eQOLmnSd19F8WQMlia6rn1Wy/4Xppes5uN6GI2vLCwOGtkHW7mTKe +wnLRnbpIQ2CDE0VRA3aVUmTywZTtUxxcFFD+yHl9FMTCFC+n/o8LQ6xtW/sNptCzG2I SydA== X-Gm-Message-State: AJIora+wrFxT/a18fqWmibYj4qZV6mlDQnUPwPW7NfdwiE6E3mHEKP1x AD75+aNJYrfk/C3JL0kVuuMp0uFPTawhfPw5Wg== 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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