Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4869588pxb; Mon, 15 Feb 2021 03:34:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxH00ssJp3jiBV9fpW9iMLp58Mmqg5re80rTB6tWIwxcATTbVUy7uFSHqzK+d5MOzqY6UNK X-Received: by 2002:a05:6402:1711:: with SMTP id y17mr14847078edu.72.1613388844573; Mon, 15 Feb 2021 03:34:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613388844; cv=none; d=google.com; s=arc-20160816; b=X7Pga/iXpxgXEIA5HEIuvd38NDa9HamDbTwNW7wgSR7GwbMV6TPlY9+24541llCSRr IxS65WNhOACI0qDvm0vadhUnWHh31UzEzcVuxii6+/fl3Isx11rk+i9Dt8zgWd+iHT39 Bm3WT/uHI2f4GDSFzPG5JPwvYllgHZWaUqOZP6sbS/RvG/JlTd9RMmQmulHEcGGHIAIj JM3GiSmdJQ9brP61pPyHJd+oqi97eM94osmRFfZTNn8d2NeWwEC1ZPBw8IjOL+NgSxsN N+z56UsQe/7MKyDAsBv8Z6UvGfnNdRoLpUJWCdHGkCHnhFjZ+ExmKZPK+F12knxZua8F zmAw== 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; bh=kAKMNBgMKUY/53qhpQPG2M8mureClInH2SFsS8/a74E=; b=z7LR4XChFVX9QuaK/sVxudMwKLJsOKYxMVqrrbIu4MCwGVwWz2wD5a92wmh9F5dxSy al77tR7cJV2Er7/p6uG3AQj6WXWY5AT+YAlnwRTWyX3nu1JCUhDyEcibgm4dsJ0A9RMB XCdlR7jGWpcCg9nnE+Lg1Zj/B/U3AkerxyImLD5axI6Zhe0d0hcwd5roAwH0i0Hh35u6 0HZK/xaBAVRVIMXw91NytiIE3DB9YiadnZ6L2IFB/D4NSuDQu58UK06YahcKhxh+iZ2m PqpupYV85/fKumlykp+jz4Wj1/Acyg2IifUyTJ1BKhQS7duuLOXNaBcJZpF1F+kCJbUT KxFw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k7si11443651ejb.442.2021.02.15.03.33.41; Mon, 15 Feb 2021 03:34:04 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229916AbhBOLc5 (ORCPT + 99 others); Mon, 15 Feb 2021 06:32:57 -0500 Received: from honk.sigxcpu.org ([24.134.29.49]:50534 "EHLO honk.sigxcpu.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229805AbhBOLcu (ORCPT ); Mon, 15 Feb 2021 06:32:50 -0500 Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id 28D97FB03; Mon, 15 Feb 2021 12:32:08 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JGyDCSRY25EI; Mon, 15 Feb 2021 12:32:06 +0100 (CET) Date: Mon, 15 Feb 2021 12:32:05 +0100 From: Guido =?iso-8859-1?Q?G=FCnther?= To: Luc Van Oostenryck Cc: Linus Torvalds , Ramsay Jones , Greg Kroah-Hartman , Linux Kernel Mailing List , linux-usb@vger.kernel.org, Sparse Mailing-list Subject: Re: [PATCH v2 2/4] usb: typec: tps6598x: Add trace event for status register Message-ID: References: <651ac50b9ff6ed3db8cab9f176514900f6a02a0c.1613131413.git.agx@sigxcpu.org> <20210213031237.GP219708@shao2-debian> <6a8eb07f-16d5-f461-cf0b-6c4aaf93b014@ramsayjones.plus.com> <20210214204127.ezrlr4u76onqcxl7@mail> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210214204127.ezrlr4u76onqcxl7@mail> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Sun, Feb 14, 2021 at 09:41:27PM +0100, Luc Van Oostenryck wrote: > 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(). That was a great hint! Using a custom FIELD_GET() that drops the __BF_FIELD_CHECK() makes things fit. Cheers, -- Guido > > > > 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 >