Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4500234pxb; Sun, 14 Feb 2021 12:47:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJx3VGBXxyhw+KaAivS9kI2+28M085Wi+nwqvToYG10jXGSTepHa+EAP8qLhb99O8zfEJZSn X-Received: by 2002:aa7:c58e:: with SMTP id g14mr12686141edq.362.1613335629393; Sun, 14 Feb 2021 12:47:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613335629; cv=none; d=google.com; s=arc-20160816; b=0gceN45aFFHJSO1PHcF65TTrUeG80IQ0e6n/m60X63JGs2vm42Jtuhk9yPrdbYAUhL azvXwwkBlHvOvNexPTYrz9uwWi2x4OjRUXEOhlDZ0UpslzIUjIJlGEJNLz1x91kdopYt i+c6/K18gk/9SZ3PqIJpLJGxjyVrLrsZ/E35eyU2dBWxhN927AWSLCDNRNGDA8oKSrdX q5lkM0XvvcExH481wHObYpgOuubcFQb1lR3dBxYiywkr3UmHAeX21FtKtzazZZ78iNzb zdrxnyt2wpJhu/o6BsgxB9bL6nLnwRbBfwHg4w/MhVZbKRux0im95HleT77nPpE+9HkO JfoA== 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=KDcTJbYVBqjxtWBYJMrAm8lX3M9uPlglIDxfV1YFvj8=; b=STIKbCoQ2qZUQ2DF20S9ER7f3q6HJbdK1f+sYFTivQ0JGaRhxnnNUs0uo4WbIikTLK RjjKa2gU2LXwehTObgM1OX5/QZjdOvYQMrBvVzanLRDuYxB7hYdiyPZbIEctkQpiHqI2 +GN8iqBhhQXRuEJ/9Z9GSPXhtB3XWmSj9OtZvSPBdedTe6agfKaqhpZ34hBJz6yPJwXj y6hkxF26/QXaI8uibGQMs5p+eiCGExaef/Emf/YzxUyE0s5lTMfcHQ6KJxNyCSlYiI4o Bsyvv2jks7hyx5vqYgqRhMjcVQUd/xR4+I/yI/Qic+97OQvAIbwU1byEg8Owq8lzcnp4 Nqcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JZhXGU7P; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p12si6295348ejm.633.2021.02.14.12.46.47; Sun, 14 Feb 2021 12:47:09 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=JZhXGU7P; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229960AbhBNUme (ORCPT + 99 others); Sun, 14 Feb 2021 15:42:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229881AbhBNUmN (ORCPT ); Sun, 14 Feb 2021 15:42:13 -0500 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7904C061574; Sun, 14 Feb 2021 12:41:29 -0800 (PST) Received: by mail-ed1-x535.google.com with SMTP id v9so1494864edw.8; Sun, 14 Feb 2021 12:41:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=KDcTJbYVBqjxtWBYJMrAm8lX3M9uPlglIDxfV1YFvj8=; b=JZhXGU7P/V1+TT/yLZELapCCPW4GQMsCAHhqsmDr+uHyw7GjSd81Rd8W96blnCNozm V1FDtM5ZkM+aRAvAyEHyNllsrlKIVu2UPQUpmVjUyQsrgWLKduKLUf4S2UPK92Fasqo1 wV02AoChHhlYWVkGQ4UKt3lMp/D8yisjxIrEls6JEB1yJhuA6b0gV5zxEwDOb4IQubp9 /lFfYzhv6oUGfVApr2O516sTUQr81FvfKdsZdhao4VMM6x8ayCg4lLs+i2mJaZDBdHWw sZguvPKpV8poFLNSitfO2p1D+jxW2aJEEa0uShXmxcbR5qJTJVkIjpe3qHkw2w+3rB1e ppzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=KDcTJbYVBqjxtWBYJMrAm8lX3M9uPlglIDxfV1YFvj8=; b=b/f0YWB3AP8SiUsiL69idgRsK+e8vi9sdnlNqRUInaMFPdavHpVMjWwTPrlWTHxKCg PNV/sbEqCxVS8eDu93/kMBEPdmls8fJy4Nkg0IyyPHL0OmvnqiJ9w5rI5SfYaQJxzQ7+ Z21QTg6h/vPVjD9Ndl1ezeyEto0Uw2EG+j/vRQx+k92EGZu3r9Z/cAEYUiixsgke65KD SfWw460ZKOCzgaxCCC7hHlqwi7kHHFmJUOarEhxi8s3M4Q9aO2qcWE0LXMSSTEa7xPol 44/8QGN9trCi4yFNc9ckRW3HrFNnv44+SApeOn0HqAWGtPr4w/3216C/U+Q1yutOZCEp emhQ== X-Gm-Message-State: AOAM5332OiflNyBKjJkRll+fc3tEXU/UMPSLf6UE7LVIWerwbQwH1lxC +ra7aU3Qu9YXyC41UDQ+v5HzipO5+Ko= X-Received: by 2002:a05:6402:558:: with SMTP id i24mr12807371edx.190.1613335288737; Sun, 14 Feb 2021 12:41:28 -0800 (PST) Received: from mail ([2a02:a03f:b7fe:f700:8c5d:a37a:9f02:aeed]) by smtp.gmail.com with ESMTPSA id z13sm8876848edc.73.2021.02.14.12.41.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Feb 2021 12:41:28 -0800 (PST) Date: Sun, 14 Feb 2021 21:41:27 +0100 From: Luc Van Oostenryck To: Linus Torvalds Cc: Ramsay Jones , Greg Kroah-Hartman , Linux Kernel Mailing List , linux-usb@vger.kernel.org, Guido =?utf-8?Q?G=C3=BCnther?= , Sparse Mailing-list Subject: Re: [PATCH v2 2/4] usb: typec: tps6598x: Add trace event for status register Message-ID: <20210214204127.ezrlr4u76onqcxl7@mail> References: <651ac50b9ff6ed3db8cab9f176514900f6a02a0c.1613131413.git.agx@sigxcpu.org> <20210213031237.GP219708@shao2-debian> <6a8eb07f-16d5-f461-cf0b-6c4aaf93b014@ramsayjones.plus.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 14, 2021 at 11:00:48AM -0800, Linus Torvalds wrote: > On Sun, Feb 14, 2021 at 10:42 AM Ramsay Jones > wrote: > > > > > > > > I looked around but didn't find any hints how to fix this. Any pointers > > > I missed (added the sparse list to cc:)? > > > > This is a limitation of sparse; when using the 'stringize' pre-processor > > operator #, the maximum size of the resulting string is about 8k (if I > > remember correctly). > > Well, yes and no. > > The C89 standard actually says that a string literal can be at most > 509 characters to be portable. C99 increased it to 4095 characters. > > Sparse makes the limit higher, and the limit could easily be expanded > way past 8kB - but the point is that large string literals are > actually not guaranteed to be valid C. > > So honestly, it really sounds like that TRACE_EVENT() thing is doing > something it shouldn't be doing. In itself, it's OKish but it does a lot of macro expansions and most arguments are macros of macros of ... but the problem seems to be limited to TP_printk(). In the current case, the offender is the string 'print_fmt_tps6598x_status' which is just under 26K long especially because it expand TPS6598X_STATUS_FLAGS_MASK but also because the arguments use FIELD_GET() and thus __BF_FIELD_CHECK(). > > I don't think there's any fundamental limit why sparse does 8kB as a > limit (just a few random buffers). Making sparse accept larger ones > should be as simple as just increasing MAX_STRING, but I really don't > think the kernel should encourage that kind of excessive string sizes. Like you noted, there are just a few cases in the kernel and IIRC there is or was one case in it too. I would tend to increase MAX_STRING to something like 32 or 64K, in order to keep it reasonable but let sparse to continue its processing, but add a warning when the string/token is bigger than the current 8K. -- Luc