Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2445952rbb; Wed, 28 Feb 2024 01:56:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWokIzVd0tOnKirj0ZFuKxqapjLxszn2RQqncwHqvYLt6QJ3+yTI3TE7Hv4OwBUpZ1ApqORFZ09PBjjft7QmKT0+50QPzfuhes1SVVD/w== X-Google-Smtp-Source: AGHT+IH7wZLARMN64w/0qRV9n0O33e1cYv0GLbSWqEPU5cqbL2xXUqAjYPCcrxngNr2XiGfEHNyA X-Received: by 2002:a05:6214:5090:b0:690:1704:6261 with SMTP id kk16-20020a056214509000b0069017046261mr5565842qvb.43.1709114164485; Wed, 28 Feb 2024 01:56:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709114164; cv=pass; d=google.com; s=arc-20160816; b=ZqFkDZeM2YZLzni4bLenjvKUyd3f3tWxsgi19TmvTwbqgT/9DQA8Qu6lWJarjeaJhB vynvRoFg/xAkgi1BFk9QICkvnZiD+zmE4SArqaxRjhwxxKgiWoXQSWWuICcPBKZ719wA tYsNqKrC9R0DKvNBpHScuaNLjx8g99kIpIxPRV0cEX12R2wnp7U3YZqvVucg+MzraRrx 2y4H5b/4y12WeqDIW5+qhZ+bWiU06n6qEJIHN7p4zmeD8wS5pYekScBse5x7+IXUsXge TLBwxKXyTj6OjpQuBRg0DI385FsyS+fOIJ2PoUriy9JvUwTkYxq0VDV8Fg6/zud30aWz oczA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=uBNtmpWHwk23veRV9DRLTSwz8gtd1U5j/H2m71ZLWRY=; fh=jPIakfFkvpOGfLnbO1atcFfN29z97ybFgKhb7cIG8iM=; b=bgDWkqIkG9bnJ9g0Fcn/IwffnNo5Ue7Fu8/AL21kFPSnJhUXhQm1IOsTFCVQZit3vP gU2cK169ksVQdiH0QnsSPtUe2wLxhbAs8UFCWv0tIVQqitVwKXguSZ8yygLIz/ne8c3o cZlCLQKFK3IGLn+MRJ+PinFjm+uvs8TDUUjU1laH/efXZqgpnFtSybMQD7iE4u7GbIiO ecg0yejROXu5V5pBFWG2rkpAVwZYkB9R82QfC8I/NZrzBKUKfpvNbBGDcSysaaTpQQWN ceS9Wl0CYgdcBQQ9ObCpMMfDplDLQp+G1V0GVyhymgqAm/Li3jI/4RlYovr6MrrZd6G3 9leg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=TCcMxJss; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-84796-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84796-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id gm12-20020a056214268c00b0068fe843bc61si9348367qvb.80.2024.02.28.01.56.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 01:56:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84796-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=TCcMxJss; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-84796-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84796-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 97B9A1C24227 for ; Wed, 28 Feb 2024 09:55:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2517736129; Wed, 28 Feb 2024 09:55:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="TCcMxJss" Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 994CB2E859 for ; Wed, 28 Feb 2024 09:55:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709114148; cv=none; b=FBEF3ZQb3j/I1J/VsVNZ4JJtxIY9MT+R4U5XfCcliYcr0bz829z/L4BuXaFaadnoB/5rRaySUSqIxOJ0oBzXFgkxoemWchHQZhaW5LhMaMSSD6+EIs1d2DqUqbexDJjTPH6kR2S3rLUs+tOQd/TppVWyINQUkLU1f3haE07Ojgs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709114148; c=relaxed/simple; bh=9q6oppYW6Sx1xCipRYioovq/te3WS0mFoUe1jHuAcxA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sMcx4HrWhjU6lYriIOyKze0OqVn8M9KdcwfxoaGv6pTOZoVeYO/z5iIriCAGHsocZc1JqUciYvmvPg3VFGLyTiPSXhy0RMcDe2nRq+DfcffDJCx8WzuW+wTBaGG1akrgwdEZxkoOSKJUMfCJBvBmOyPlGRlDV3EKdjGs/GleuEU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=TCcMxJss; arc=none smtp.client-ip=209.85.208.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-563bb51c36eso5983325a12.2 for ; Wed, 28 Feb 2024 01:55:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1709114144; x=1709718944; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=uBNtmpWHwk23veRV9DRLTSwz8gtd1U5j/H2m71ZLWRY=; b=TCcMxJss2TB7BX2uaGDGxUxsHQUJaNeCFlShnR54jCLmhmx66HyNhEFxRcrOkK+8CI sWwxJnWVSUlFiR7QKTnWcijmHClo4JsVD0CxIieUyKIve6GDVeQVCVRlboWa3X5wBKMO Rp6pH5zQDqLjFgwxe58buSsHD59evL0fXcx1c08RNB5BW/rU33PBv9E7odw2jELGorr1 L3dB3F2aSI3N3Zoi/WJdl0KbIcN4LTS1bDdjs5NSVb1QncdIuYJP6SDEN/c8saebnrmk +72yOn6h8VzV4XLrMe1JZgl2cV/wJWMEa0xqVjixW0hqTuS93WHkEUaQb8A2RXlUP7MF ifOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709114144; x=1709718944; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uBNtmpWHwk23veRV9DRLTSwz8gtd1U5j/H2m71ZLWRY=; b=kNAorgRjpuDpMHYoXB1y9lNXHgb5B8Wan7N6jPnxBwbs+uVU0AyLGisKZpC5YyRUrv ifKM/XpcdKYkw1Hl1sojsIY/CKzIIx97cDLmydvIMynaOeY05VomY3fWxlxy3GiBIAxI 2GqHe5i+AUWNMpNG4D3TzkUhqS/Dc3/O4c6dgdRdUoFDp2R9a9PXSGcvkoEAGRw0cQp3 3Bt4K3e1yNxSnunMPEZ4Ji9Y6g1vO1u0gANGdYewq4VZ1srLLbkzPt9Q7UvlXUh22S1u qzoPda+IULL0rok/+Onv2m+zuEU3TkyDnAu0kkRZ7jce20ipdF3YIXPG8MjEY9pdupkg ooMg== X-Forwarded-Encrypted: i=1; AJvYcCXKo1dNCjsMx3GbEINlslnV7iMsHu1Z5AK7BKVFayKcs++d2c2ItLhjPgpNcIBf+QqEV0XoGJt7KaE34vD+33Pq5xqqjVU5//WWstKw X-Gm-Message-State: AOJu0Yzpj6ZqTNJy9bEKviu76Ajmoe7avs/MeSIPaPvnx56MuIIfBqoa 9HLQtKdJUIq0uSVADotRKzOamX48EhF8GX/H2nCwf0UXEiuzv490Sg4d1vZ2Vt0= X-Received: by 2002:a17:906:35cf:b0:a44:46a:27bf with SMTP id p15-20020a17090635cf00b00a44046a27bfmr572076ejb.16.1709114144028; Wed, 28 Feb 2024 01:55:44 -0800 (PST) Received: from alley ([176.114.240.50]) by smtp.gmail.com with ESMTPSA id c12-20020a17090603cc00b00a433f470cf1sm1668440eja.138.2024.02.28.01.55.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 01:55:43 -0800 (PST) Date: Wed, 28 Feb 2024 10:55:42 +0100 From: Petr Mladek To: Rasmus Villemoes Cc: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , Jani Nikula , Rodrigo Vivi , intel-gfx@lists.freedesktop.org, Steven Rostedt , Andy Shevchenko , Sergey Senozhatsky , Matthew Wilcox , linux-kernel@vger.kernel.org Subject: Re: [PATCH 01/12] drm/i915: Indicate which pipe failed the fastset check overall Message-ID: References: <20240215164055.30585-1-ville.syrjala@linux.intel.com> <20240215164055.30585-2-ville.syrjala@linux.intel.com> <87bk83mfwp.fsf@intel.com> <1013ff2d-76b2-41f9-a5d4-39a567a3b0cc@rasmusvillemoes.dk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed 2024-02-28 09:32:37, Rasmus Villemoes wrote: > On 27/02/2024 19.32, Ville Syrj?l? wrote: > > On Tue, Feb 27, 2024 at 10:38:10AM +0100, Rasmus Villemoes wrote: > >> On 26/02/2024 15.57, Jani Nikula wrote: > So if we really want to go down this road, I think it should be > something like %pX{drm:whatever}, with core printf just looking up the > token "drm" in a run-time list of registered callbacks (because I don't > want vsprintf.c filled with random subsystems' formatting code), and > that single callback would then be handed a pointer to the rest of the > format string (i.e. the "whatever}..."), the pointer argument from the > varargs, and the buf,end pair. But then we're back to trusting that > callback (which might of course multiplex based on the "whatever" part) > to behave correctly. And then we might as well avoid the string parsing > and just do the "callback + pointer" in one struct (passed as pointer to > compound literal), which also avoids the tricky "what to do about module > unload versus unregistering of callbacks" etc. Mathew Wilcox had the idea to introduce a structure: struct printf_state { char *buf; char *end; void *ptr; }; Where *ptr would point to some data which should be printed, same as wee pass to the %pbla now. Then allow to implement: char *my_func(struct printf_state *ps, void *ptr); and use it as: printk("%pX(%p)\n", my_func, ptr); One problem here is type checking of the data passed via *ptr but we already have the same problem now. Another problem is how to make sure that the function is safe. A solution might be to implement an API for appending characters, strings, numbers, ... Similar to seq_buf() API. AFAIK, the result was to actually use the existing seq_buf API to format the string. AFAIK, it motivated: + commit 96928d9032a7c34f1 ("seq_buf: Add seq_buf_do_printk() helper") and probably also + commit d0ed46b60396cfa7 ("tracing: Move readpos from seq_buf to trace_seq") and also this one is pretty useful: + commit dcc4e5728eeaeda8 ("seq_buf: Introduce DECLARE_SEQ_BUF and seq_buf_str()") And it motivated: + commit dcc4e5728eeaeda84878ca0 ("seq_buf: Introduce DECLARE_SEQ_BUF and seq_buf_str()") Best Regards, Petr