Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7881018rdb; Thu, 4 Jan 2024 10:27:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IFq6DlQwap2aBF9Iiv0KytE6ghfs2/wD42Kh6herFu3ff+QDRucJH2U9wvxkJhi5UwzVNat X-Received: by 2002:a17:902:6841:b0:1d4:e1d6:3657 with SMTP id f1-20020a170902684100b001d4e1d63657mr573770pln.2.1704392873054; Thu, 04 Jan 2024 10:27:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704392873; cv=none; d=google.com; s=arc-20160816; b=pzRxO8d/hlWEEko77D4siDls5cko3jRlUHL0w/Z08g8qStzOgfaYhs0/Qng/Yk/gYp dKlN5diccoZzK9V/M/03uBpltF2BNakNnGWbNM6giQ0XOMoESHWfgASpePcN5+1yGWaC plGYGvAyQOAVKKMYmZMykI2qCmv9PtVl9G5veya3AuxF9h28vmFbAldr84rqulzsDmbw E5CUhp9N9bkXX/HVrWNT0BSpjjX5pDpZKYn9WVHaaoKlKchDncdE/HZ6qm4W427zx4iu Z/KXK3jU63teIfkk8gTw/pECfSw6Tetc21N5lolohChi0I7qWglFHARyqKbPmXooDQQV MEzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=+Vu/XUPzn3TGuSLksrGOmns2BD+WyoI/yy0ghGlkLR4=; fh=H7rhZUnZ+NlyyU7vxDXWwpu6VPK6D0cjPor36M8Xy6o=; b=zJRdsfdJKbaNKwazR9Xur8jbNk3jBeMKbKbHa6ZzTZ48GJiTMQx/KvQ26fsIRyHhG8 s8zITd9JdwdRfzmkJCETTugA/qj8F7B7ovpSFu/83tk28ggW54Kq6P+g62uhp2ifZHvf 7hyF2XkBhxRb1rHCgCqoThRnPuL0bAV36c0ZejpDA1GmJt88c/MQfHi/FGbGCttiIkd+ GFcU9IgUpIW/zRWsTwn5I+PQJLuy/My/LI1tdeqCyb0FBxO7JxHFhKye++i9T5+PPqE4 VJvl/qlj4hT58aRqINJD6fEA8bv5IkqJ848JZzjy2ThnhGsuJhDgQetg6lO662NTsbc8 VSpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-17091-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17091-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k1-20020a170902c40100b001d4273c04desi21492052plk.459.2024.01.04.10.27.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 10:27:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17091-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-17091-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17091-linux.lists.archive=gmail.com@vger.kernel.org" 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id CED822851E6 for ; Thu, 4 Jan 2024 18:27:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8226A28E09; Thu, 4 Jan 2024 18:27:47 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 14C9728DDA; Thu, 4 Jan 2024 18:27:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D712CC433C8; Thu, 4 Jan 2024 18:27:44 +0000 (UTC) Date: Thu, 4 Jan 2024 13:28:50 -0500 From: Steven Rostedt To: Vincent Donnefort Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v9 1/2] ring-buffer: Introducing ring-buffer mapping functions Message-ID: <20240104132850.061620d7@gandalf.local.home> In-Reply-To: <20231221125813.673293a2@gandalf.local.home> References: <20231221173523.3015715-1-vdonnefort@google.com> <20231221173523.3015715-2-vdonnefort@google.com> <20231221125813.673293a2@gandalf.local.home> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 21 Dec 2023 12:58:13 -0500 Steven Rostedt wrote: > On Thu, 21 Dec 2023 17:35:22 +0000 > Vincent Donnefort wrote: > > > @@ -5999,6 +6078,307 @@ int ring_buffer_subbuf_order_set(struct trace_buffer *buffer, int order) > > } > > EXPORT_SYMBOL_GPL(ring_buffer_subbuf_order_set); > > > > The kernel developers have agreed to allow loop variables to be declared in > loops. This will simplify these macros: > > > > > +#define subbuf_page(off, start) \ > > + virt_to_page((void *)(start + (off << PAGE_SHIFT))) > > + > > +#define foreach_subbuf_page(off, sub_order, start, page) \ > > + for (off = 0, page = subbuf_page(0, start); \ > > + off < (1 << sub_order); \ > > + off++, page = subbuf_page(off, start)) > > #define foreach_subbuf_page(sub_order, start, page) \ > for (int __off = 0, page = subbuf_page(0, (start)); \ > __off < (1 << (sub_order)); \ > __off++, page = subbuf_page(__off, (start))) So it seems that you can't declare "int __off" with page there, but we could have: #define foreach_subbuf_page(sub_order, start, page) \ page = subbuf_page(0, (start)); \ for (int __off = 0; __off < (1 << (sub_order)); \ __off++, page = subbuf_page(__off, (start))) And that would work. -- Steve