Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp166781rdh; Tue, 13 Feb 2024 12:51:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW3ikVJTas/XNLZi2JvFy/ZPscWTWVuzOjcjRzPBD/SPQTNzUhNlDu3NKYIuMwSJNs7FWRsdgzX3Km59r3gruUxmcMEMfR/aIJerLb2JA== X-Google-Smtp-Source: AGHT+IEFf3EEd4YyV4WZh3OEK0LKw7Wsqsqxebv48eiD8sFX0aYiJUzpP/QbGglBn8YwN0LPfvUQ X-Received: by 2002:a17:90a:db09:b0:297:1389:7a19 with SMTP id g9-20020a17090adb0900b0029713897a19mr661397pjv.2.1707857507656; Tue, 13 Feb 2024 12:51:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707857507; cv=pass; d=google.com; s=arc-20160816; b=Bhav1MAcxBKjJYhXvDD/WvQISfaH11OFF5HTA6Ax3zo/UBEIay0kVJb9PoLNoAeOUR Tw23WnSayp8tycgIarueq/gavAkdfaX9SLu5a01pKyBQgZ+lg+Mjn5xgi8QwIOkXEUz3 l5idQncsFRUPnIrpFoQswK7yHX/ueJKUtuAtQt4NhAkq3mbH7KZuUqWQNZtIL4CFLsHT ut17XoHlfhkeGTxM6diI/2uwpHGTV8yOYxkVxtQXiv4bS5shcdINud+ZbXTFft0Mc6Rf exp5ZEjglNCzcPB5cZtCukVPyhPVs0fJiKG+QCZ9P3N7gfRqABB0QBiS44YPsGwNE6p8 LGgA== ARC-Message-Signature: i=2; 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=kk69mqixr5rgZLV3jfqoyCvrjAgw2huV7BhX+Dxq9Wk=; fh=MC9H93Lfpnlx9BNqMJHgx7Ztf4WymxV4lZxe5Cef5M8=; b=XRofQv2GDofjB9MvwA5kmT4QlN5fDtLSPkPiCS9EpB0zb7K93E6UjYK0oj5Qd2Vo57 E4FxqKgOZDotK8Eq/XyPIyJD8DSA7BOZPjfYS2LczI8fDNN2EzIHF2VimO2KBzabKA++ mQGz7UQRFL9iy2zIgO9Nn9GwGsQ8AP5NpNT1az44XEzKUU2EfwhlP675DNzr/ComO6Cl Xe3fm59U5TsrYjq3bhDKMBMWbqCLMgMmccjQgwgo3+Itz4HubUUPg60gl89UefgLLyXg +zpgIMlPCxOWtuMgXFmEBu47GT49V+lTA5MYnUtZAM6NjGgJpI2/fbwbqMbaGx7x3rgK JTQw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-64232-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64232-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCWw/X0QQrJ9+Ski+Y/6Xn5roZiIT3kHLFD+C77UJd1b605xe6n2JcPCZn5ftaXetHvLgsKYKEQUoQBVEUg/hS2G9OOUJ8g7VVhqyI+oIg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id kk18-20020a17090b4a1200b00298bc48bb73si1041387pjb.22.2024.02.13.12.51.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 12:51:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64232-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; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-64232-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64232-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 4E6A3281415 for ; Tue, 13 Feb 2024 20:51:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6B51D612FD; Tue, 13 Feb 2024 20:51:41 +0000 (UTC) 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 E570D3D988; Tue, 13 Feb 2024 20:51:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707857501; cv=none; b=K3wZmcQrJEsvj+o+Yil6oQ0SG/HARI6apr4y/Gl5Ow7dcMDa/W6krt5Zw49Ji98e2hxpUq3ph8Zb/KhxGDcDwo1QCw1f7jKbwIda84Qf/Z8KU8ehdhQXKk4OmLKd7Je1cjaqeX95FN0wGbmemDWegovRWK8lo5Sxpi7EG18EBG8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707857501; c=relaxed/simple; bh=M9O07Jm/SQoYeOcQw7VLNbboHFFM9jagKb4A0aHLZWc=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=buvb4++cIan8m2SyGbdt+bFxPBSKDjlSKvAmJgE083gZy4QE6FTuXjhVAXR6wDkJ1HrgOkmDAJiNyB117ggRXXZZJwbl538F1Dn+CPmh3GQbov4KfS47uC0GOQsL9/6Su01vIkC24fXXO64r7ou+35+7MlREeg1D9tSeqyyOox4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97ADFC433F1; Tue, 13 Feb 2024 20:51:39 +0000 (UTC) Date: Tue, 13 Feb 2024 15:53:09 -0500 From: Steven Rostedt To: Vincent Donnefort Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, mathieu.desnoyers@efficios.com, kernel-team@android.com Subject: Re: [PATCH v17 2/6] ring-buffer: Introducing ring-buffer mapping functions Message-ID: <20240213155309.01c7c2b2@gandalf.local.home> In-Reply-To: <20240213114945.3528801-3-vdonnefort@google.com> References: <20240213114945.3528801-1-vdonnefort@google.com> <20240213114945.3528801-3-vdonnefort@google.com> 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=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, 13 Feb 2024 11:49:41 +0000 Vincent Donnefort wrote: Did you test with lockdep? > +static int __rb_inc_dec_mapped(struct trace_buffer *buffer, > + struct ring_buffer_per_cpu *cpu_buffer, > + bool inc) > +{ > + unsigned long flags; > + > + lockdep_assert_held(cpu_buffer->mapping_lock); /work/git/linux-trace.git/kernel/trace/ring_buffer.c: In function =E2=80=98= __rb_inc_dec_mapped=E2=80=99: /work/git/linux-trace.git/include/linux/lockdep.h:234:61: error: invalid ty= pe argument of =E2=80=98->=E2=80=99 (have =E2=80=98struct mutex=E2=80=99) 234 | #define lockdep_is_held(lock) lock_is_held(&(lock)->dep_m= ap) | ^~ /work/git/linux-trace.git/include/asm-generic/bug.h:123:32: note: in defini= tion of macro =E2=80=98WARN_ON=E2=80=99 123 | int __ret_warn_on =3D !!(condition); = \ | ^~~~~~~~~ /work/git/linux-trace.git/include/linux/lockdep.h:267:9: note: in expansion= of macro =E2=80=98lockdep_assert=E2=80=99 267 | lockdep_assert(lockdep_is_held(l) !=3D LOCK_STATE_NOT_HELD) | ^~~~~~~~~~~~~~ /work/git/linux-trace.git/include/linux/lockdep.h:267:24: note: in expansio= n of macro =E2=80=98lockdep_is_held=E2=80=99 267 | lockdep_assert(lockdep_is_held(l) !=3D LOCK_STATE_NOT_HELD) | ^~~~~~~~~~~~~~~ /work/git/linux-trace.git/kernel/trace/ring_buffer.c:6167:9: note: in expan= sion of macro =E2=80=98lockdep_assert_held=E2=80=99 6167 | lockdep_assert_held(cpu_buffer->mapping_lock); | ^~~~~~~~~~~~~~~~~~~ I believe that is supposed to be: lockdep_assert_held(&cpu_buffer->mapping_lock); -- Steve > + > + if (inc && cpu_buffer->mapped =3D=3D UINT_MAX) > + return -EBUSY; > + > + if (WARN_ON(!inc && cpu_buffer->mapped =3D=3D 0)) > + return -EINVAL; > + > + mutex_lock(&buffer->mutex); > + raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags); > + > + if (inc) > + cpu_buffer->mapped++; > + else > + cpu_buffer->mapped--; > + > + raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); > + mutex_unlock(&buffer->mutex); > + > + return 0; > +}