Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2368690iog; Sun, 26 Jun 2022 14:03:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v5Q+PaSeVccFa7PhWQlyN46Zy5nCfiH71fTio8N0QrLWnjXyglwKKiA7eSgBp2/meAbvwc X-Received: by 2002:a17:907:3f02:b0:6f3:5c42:321a with SMTP id hq2-20020a1709073f0200b006f35c42321amr9411859ejc.521.1656277387355; Sun, 26 Jun 2022 14:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656277387; cv=none; d=google.com; s=arc-20160816; b=cgo9L5PHXMsWp388B5Ba89dxYA1rQQ4L0+WEBEGrJm2vCy0WtBKmLirhG6mW/tupyU nqDitooqDOSB0gMbGPSxOqHr4gH3uD9imM+mNZqaomwe3OPzKt2Q4jRfaf1Ld6nCKQUN TNyRZybNpbrY5vMVZWLAULt9Un0z7HiORvImVSL7Rl1wgwtJ1FxtbLm3CKwzvS9UAxfZ zvl70RRvjgNn3W/0XN1Rt87L3NL0zwjpLDmSGQKKH5Ky0T0apF0u6dsBh9MtlKy1N2PX 0nMHHvIfW8jT6J+AHOuUV1Zf/7W1kp8nmE19wVqSxlhOHUgGOlZEGaQDfPoJWHY++ZL9 UiFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0uMJf4FJG/5wuR5sGkF8+rRgoUV4V+m2L2oEIirjeF8=; b=O8l/XwXqROzsA8N7jKN5TgeZrYtDh9XazCM71AYZhy3ZV4a/kVkt0IVF++tfS9KUWK arH81DqFQzKmFoIYUlu1Y6FwffIdtpA+IkP/FryDS9g82Y4ZVu+IY+qc7GlYiw8nJy8v xkTM0A0/Wh0PHJ7EkUflY07Jno9r/DteWVFFNRC7EeV9sOifAthxY8tWJf5jccn758AW QGiQ7gnQ1IOJkJZek/UVwU/BcsFAvuq97sIx/1WVdHcUEn1f34XpLjVrKZP4QKskMzqx LUeyctb8qFbXmeyXMylaDl5m4DMwyowERbdzpiUgj9K0YcgLpF30wcS8cIH40SGZVcqB 8deA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="SKI1T/TZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du20-20020a17090772d400b007269f720fb5si2183854ejc.530.2022.06.26.14.02.41; Sun, 26 Jun 2022 14:03:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="SKI1T/TZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231767AbiFZUwD (ORCPT + 99 others); Sun, 26 Jun 2022 16:52:03 -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-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> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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