Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp47069pxf; Wed, 24 Mar 2021 20:32:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhTafWbC9YJWAJjBjMvSjhVUw6Xt11xolKP+X5DLG06wprVnXqF7foYy4zhQSEtg60mucb X-Received: by 2002:aa7:d813:: with SMTP id v19mr6770171edq.213.1616643147538; Wed, 24 Mar 2021 20:32:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616643147; cv=none; d=google.com; s=arc-20160816; b=oSGI/Io7C+jf18nWPvU0o89OGtaPqpwzXyg9IRw7lS/wMPxHF6GKK8JI6VnKRtdbBL Tq4fiTjdJogaAsgR7YwDiGsleWv72TVDU+uTsxE036UbFJJd8c+/APYY/jvQRz0OoHqL rUChsoyrUUYApV1xHP7GrQ0pMu7w9rKwDYVkq7i0JgE2o7l1UBQT+E/FfNPf3QWo9i6+ y2fxzqcnURSIrwyOC6cNSr2h86mvGBDkKh0FxYCcazvMtnTXrmvBP4VRNoiUMLiF6Gmu cCk7vvA2RFUJFSVTs68SdeieEoqNagTNzp3y8Ux9LYuxNFsLJ7ZKrYTeHLBdbXDwPEsx uECA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:date:to:cc:from:subject :references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=+1Ub9YvCJNkNw1vJdoc4OZ2njoC+Z+ZNVpn0PB64BJM=; b=AjeufzIRyhcpfo20NZQt+udOTWwSbpR/oKlLGUolZXAVOfJhfC48dpTX8bEOGfbT73 kBurAvewBSA1WxtdYCiH22yHSjXecDeTCGSX1Cp2LSSyqxep2H1LgMimXSIaNGvAUC4y AdpaeMwS4KUjI52hz78kogC07cDzPzl6fFd4ojG3bhT3Z1xm8zRYEoDKSOTGqOAN7WWr 6akSUYY4VDRaJfDqwjPnDeRyQg8X32A1gX4GsuMHjod8nzycON4UihYV7IWLvqV12Uvt CwBJHOpAdjsjNRyO/u+qjFuxjg/TlIvE9QfeHHzOy6lmv5pLnIQUkRgM5GWjoDEZ3rVE KX4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="TO/EZzd4"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g25si3161284eds.27.2021.03.24.20.32.05; Wed, 24 Mar 2021 20:32:27 -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; dkim=pass header.i=@chromium.org header.s=google header.b="TO/EZzd4"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235212AbhCXW3P (ORCPT + 99 others); Wed, 24 Mar 2021 18:29:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230005AbhCXW2q (ORCPT ); Wed, 24 Mar 2021 18:28:46 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FD5CC06174A for ; Wed, 24 Mar 2021 15:28:46 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id c204so18578065pfc.4 for ; Wed, 24 Mar 2021 15:28:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:content-transfer-encoding:in-reply-to:references :subject:from:cc:to:date:message-id:user-agent; bh=+1Ub9YvCJNkNw1vJdoc4OZ2njoC+Z+ZNVpn0PB64BJM=; b=TO/EZzd4fgWNl/zTpxUTiTLbIP71i4Gswkw+BfmyHNHw8UxdlRVNoOhoE+2arp4gDp /k2tSwtt+5mFFYe5z9K8b6tPrx0n5Z589OgZk8Sizx9rgiwNoHfyJG0uVLswsX6ruHfu rqpfBU0V873XdWmnTONw2KCbMdXr+IHLEwXpU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:content-transfer-encoding :in-reply-to:references:subject:from:cc:to:date:message-id :user-agent; bh=+1Ub9YvCJNkNw1vJdoc4OZ2njoC+Z+ZNVpn0PB64BJM=; b=ts+weMqxTMcar7fdQgPyDZ46cCBiNbmZHnGLPijaZTF7SHLXECmgo4QlsIEZ6AWQPj YNUlPqweeUGL6FZ8gneG0Iy1764cjMz+GFfn8k2zwRkpF8d3LnJWpaSZj2GOQ23HF4qJ hQ0ofXo6XrG00tMjnKgr/f8fTkF+CSn/aGqrc3orXoadJdfvRi4UH/eRnEvP50VnCjv5 Upfz54lxWRYkcuPbqW1/Gn2aIB8sEV1zrgI4FeRBgvft/FV380sh9MYyBzZ8L2X2fn+9 vhVBpGhpnu7WzK2h3/HNxOWuiSj+g1nTBcWaRDd0TgrkSdIkqnVlgkv5gEvNRJZa3Uie VQng== X-Gm-Message-State: AOAM530hjRGx0nyhv5f4BNZjqV6b8S4oRsOnyxiC4+Ej6dENTo5jaRVU EpXfo5mYTppnGh2kfSVWYd7nj0FO1e7CwA== X-Received: by 2002:a63:5807:: with SMTP id m7mr4773070pgb.73.1616624925456; Wed, 24 Mar 2021 15:28:45 -0700 (PDT) Received: from chromium.org ([2620:15c:202:201:84ac:62f7:16a8:ccc7]) by smtp.gmail.com with ESMTPSA id t16sm3518554pfc.204.2021.03.24.15.28.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 15:28:44 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <2785cae4-20be-85b5-7838-9a6dbd2baf72@rasmusvillemoes.dk> References: <20210324020443.1815557-1-swboyd@chromium.org> <20210324020443.1815557-5-swboyd@chromium.org> <6dfb8ca2-20f3-e58a-ad6b-db6a6472afe0@rasmusvillemoes.dk> <161661308874.3012082.15483899786731677633@swboyd.mtv.corp.google.com> <2785cae4-20be-85b5-7838-9a6dbd2baf72@rasmusvillemoes.dk> Subject: Re: [PATCH v2 04/12] module: Add printk format to add module build ID to stacktraces From: Stephen Boyd Cc: linux-kernel@vger.kernel.org, Jiri Olsa , Alexei Starovoitov , Jessica Yu , Evan Green , Hsin-Yi Wang , Petr Mladek , Steven Rostedt , Sergey Senozhatsky , Andy Shevchenko , linux-doc@vger.kernel.org, Matthew Wilcox To: Andrew Morton , Rasmus Villemoes Date: Wed, 24 Mar 2021 15:28:43 -0700 Message-ID: <161662492346.3012082.17886011577458863951@swboyd.mtv.corp.google.com> User-Agent: alot/0.9.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Rasmus Villemoes (2021-03-24 15:21:34) > On 24/03/2021 20.11, Stephen Boyd wrote: > > Quoting Rasmus Villemoes (2021-03-24 02:57:13) >=20 > >> > >> Is there any reason you didn't just make b an optional flag that could > >> be specified with or without R? I suppose the parsing is more difficult > >> with several orthogonal flags (see escaped_string()), but it's a little > >> easier to understand. Dunno, it's not like we're gonna think of 10 oth= er > >> things that could be printed for a symbol, so perhaps it's fine. > >> > >=20 > > I think I follow. So %pSb or %pSRb? If it's easier to understand then > > sure. I was trying to avoid checking another character beyond fmt[1] but > > it should be fine if fmt[1] is already 'R'. > >=20 >=20 > I don't know. On the one hand, it seems sensible to allow such "flag" > modifiers to appear independently and in any order. Because what if some > day we think of some other property of the symbol we might want to > provide access to via a "z" flag; when to allow all combinations of the > R, b and z functionality we'd have to use four more random letters to > stand for various combinations of those flags. On the other hand, > vsprintf.c is already a complete wild west of odd conventions for > %p, and it's not like symbol_string() gets extended every other > release, and I can certainly understand the desire to keep the parsing > of fmt minimal. So 'r' to mean 'Rb' is ok by me if you prefer that. I'm inclined to use %pSb and %pSRb. The code looks to simpler and I suppose we can worry about different ordering/combination problems if it comes to it. ---8<--- diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 41ddc353ebb8..0e94cba5ba20 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -968,6 +968,8 @@ char *symbol_string(char *buf, char *end, void *ptr, #ifdef CONFIG_KALLSYMS if (*fmt =3D=3D 'B') sprint_backtrace(sym, value); + else if (*fmt =3D=3D 'S' && (fmt[1] =3D=3D 'b' || (fmt[1] =3D=3D 'R= ' && fmt[2] =3D=3D 'b'))) + sprint_symbol_stacktrace(sym, value); else if (*fmt !=3D 's') sprint_symbol(sym, value); else