Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp139484lqs; Mon, 4 Mar 2024 18:48:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVUIXoe4uO4baGbbU7/4Qlge8Gx9/bZVcNkFAmp8UgB6aPxbcqZ5wN/ot0Po8JFrOySLUENLiGbmRtrMcJXUtuSmSQ2wvdcaTQPrNrP1Q== X-Google-Smtp-Source: AGHT+IFlGt0N3odZLIbCMUpbc8mCcddMVWlI5s2EQGBFrpFLhfJ6W4Ufy+ac4i6yCwYrDnX+ycnc X-Received: by 2002:a05:622a:1104:b0:42e:f733:669d with SMTP id e4-20020a05622a110400b0042ef733669dmr859350qty.58.1709606927138; Mon, 04 Mar 2024 18:48:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709606927; cv=pass; d=google.com; s=arc-20160816; b=DmpIE8GQH0PZTGJZ4AJhhqrqX8NmaQszmrS2JqjR6F0gTdYvXJFizGARzDBbOoCzep MdE3ehJg3z1lB4GfEud+NC1bFMgoxvoPY58123EnBSErIeLbiuizeoIf5gFnKF0B8Ty3 ypER38dyfUwYCNiPsdzJQX0USVqx2OWzraL1qbkFDbc3Jcgianbr7yd3GwW7/2qd2anc uJgBWdtO+LIrVVgZbbbRuzalHjQl/+apu8toFXSSni+xODWb3BEER+o7vW72Ds+K4E1s y/UTR5dfzUPwa72Op7dWwRqA9EBy2x59MmDGMYEzmiL9rKvU1kvy3Xyv0yJIXLxF8ZiE WQQA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=XO9Az4H1KGTp7CdOqviEvXYR6giJZFO1gOYO9SmloT4=; fh=uuHaOYjP8DrNWms6G8ace3ZMXqRYZY5l1dJVn5wQeS8=; b=VdtciDsVpdxp2BOHjLSy93bW7YqMfZ64vTBRubb09BugBDCjUX0zkiGw+xCyhoxn1I +B6Wob6N3TUnTFB8s9ZQeZViqX97+gUPRWdjUY1OM2KwZCea7ZeK0AjUVtcdBaGxec6J FJ+lXR/1HG0x6ago5Tb+FaEH726idQy5FywOahnd6CpOQIaHmR55M0UAsU8cog66GIin +LaDwePtEz3rfcYPATurKeJFqpQpxA06r1XKW+jl/WO1qwsmUH3McJ6ayUtbHhJ0Oawn M7ryJn/eLbZZN1wshaoTWJJtzhKODsE9mJ74OAS5QqFmztxyCtaKfxhUK81ttIMhKotk ErYg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b="Y/KPDcFv"; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-91579-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91579-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v11-20020a05622a014b00b0042ef7b62cb5si2323846qtw.166.2024.03.04.18.48.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 18:48:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91579-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=@efficios.com header.s=smtpout1 header.b="Y/KPDcFv"; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-91579-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91579-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.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 D8D021C2114D for ; Tue, 5 Mar 2024 02:48:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6B90D28E23; Tue, 5 Mar 2024 02:48:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="Y/KPDcFv" Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86B9E4C94; Tue, 5 Mar 2024 02:48:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=167.114.26.122 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709606920; cv=none; b=Z1Dk8l94bxOzmOLReCoS0oyVIIi3k7p6t+0JBb7qE9pk1QWp5+W4bI2369mZSEq2eA5hPlPglZ0sYWQMcfEYW19M95x/cNH+wInc1iexo30zW1cq38Sx7rQLO0cTM1xhU/pkGTLhaMI1SEOdNV5util+BV9ZoFoP9Dez2NiezXo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709606920; c=relaxed/simple; bh=GAWZ8UNjl6s+DAbSwGc+vclJVErm7Zx0BP2duUjGpzQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Kc4wQvkblvUky5ODjOmzm+9XPo52NFkyiACwKWxYpU0YQD8TzmdWvEhAsHulLyi/wbuFd5uJV57S0H+MLmjuDnFAiDKjmx/W47wOkepFbXWj64OtHYeJhIV8AuYnaC4F8YswgHSvsLTU+PGhSTiEgRBl5xCQZ0WU/g0HsVNeZM0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b=Y/KPDcFv; arc=none smtp.client-ip=167.114.26.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1709606917; bh=GAWZ8UNjl6s+DAbSwGc+vclJVErm7Zx0BP2duUjGpzQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Y/KPDcFvoghRdYr9T34mxYQHUW6r1saV2X1r9NgrpnqkmLuspKIyPoDO2lmiEqTSJ GjJwojFsKRqNbP7E4ZTAbBpb8JFZN96Qr1Usrqweru4pmnd9WodRs9lp2ocDJc8Cg9 dLq7t8gVU/FdqLsukS3RNpC7C4bRc9/WUHswfOi0qhkElaeT2zpuRc2rFebIyngXZ5 BUzN2YnPPDeUZ6k3SvVsJ1rySWoYGbuAoJFdmC4ZKrpTJeFdDDPty9Y+PLhjbjMJmB 2YRx7GPPnqXmfgG0SaqIGLfjN1kHmilth+3vE37wx86zLSlVe3T26dySy2RKxeQNEj uC+Gyk75K8qAg== Received: from [IPV6:2606:6d00:100:4000:cacb:9855:de1f:ded2] (unknown [IPv6:2606:6d00:100:4000:cacb:9855:de1f:ded2]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4Tpg45376nzfMy; Mon, 4 Mar 2024 21:48:37 -0500 (EST) Message-ID: Date: Mon, 4 Mar 2024 21:48:44 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] tracing: Have trace_marker writes be just half of TRACE_SEQ_SIZE Content-Language: en-US To: Steven Rostedt Cc: LKML , Linux Trace Kernel , Masami Hiramatsu , Linus Torvalds , Sachin Sant References: <20240304192710.4c99677c@gandalf.local.home> <469d31a7-f358-4547-bb17-0979b3515924@efficios.com> <20240304203516.45b7a551@gandalf.local.home> <20240304204119.7503ab0b@gandalf.local.home> <91f27ba1-15a4-402d-8301-e2b9d23f64b0@efficios.com> <20240304205943.081bea96@gandalf.local.home> <20240304213538.13fe1f3b@gandalf.local.home> <20240304213750.1baef01d@gandalf.local.home> From: Mathieu Desnoyers In-Reply-To: <20240304213750.1baef01d@gandalf.local.home> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024-03-04 21:37, Steven Rostedt wrote: > On Mon, 4 Mar 2024 21:35:38 -0500 > Steven Rostedt wrote: > >>> And it's not for debugging, it's for validation of assumptions >>> made about an upper bound limit defined for a compile-time >>> check, so as the code evolves issues are caught early. >> >> validating is debugging. > > Did Linus put you up to this? To test me to see if I'm learning how to say "No" ;-) No, he did not. I genuinely think that validating size limits like this either at compile time or, when they can vary at runtime like in this case, with a dynamic check, decreases the cognitive load on the reviewers. We can then assume that whatever limit was put in place is actually enforced and not just wishful thinking. If the "header" size upper bound is not validated at runtime, there is not much point in adding the BUILD_BUG_ON() based on that value in the first place, and you should then just add a runtime check that you don't overflow the output buffer before writing the output to it. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com