From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 CC36A1F63DF for ; Fri, 17 Jan 2025 05:08:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737090498; cv=none; b=Xs+cpi9lE5nyez3hr5oACj9amWbeeyfVVj4aVbPj2q5mu/9RFRwuXFjGMJTI8D+skkJNLwOnAXUr4S6U1nN2KlFb7xC2VSSsz8p4+H4niGXhTKJfce87qYOiBLG11WzOCAUKbmxjtxRP8w22JOakBb0//ozWb93kY3MDsVgDh3A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737090498; c=relaxed/simple; bh=n46p1I2zGdJqlRmcdLauRrquMFZUxRJodDoS2Wk/cnE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KviT+YUXOgQZHc0k17YC93uB5jo9Zlk1JC0CApePKOqyz8fccvP6D4zIzbegU0l0ioSiBHJPlmdZuVBSbhw4PM2DkBVK+1gDP+whqglBspmEfA6oAFONjbfjBPw3tZHsyOpTys3EkUkbsPi/pnORFZZ3bS/aBNB8P5s/0iAryZQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=m672Zxnr; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="m672Zxnr" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-385e3621518so759127f8f.1 for ; Thu, 16 Jan 2025 21:08:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737090494; x=1737695294; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=eujaH9TaJbnjVBMtyQlKAWDn4xa179ZR19x+bFJDdEk=; b=m672ZxnrlaHV3iiF0TuSf6i7LgSImuuFuqQlTewRNCpk5QDMvTL/1wjXV531OYBGAe pP/8zqQMbhgLyIKilrPbzBo0s7JJ0yRSzEKjenw6lePMdpVRpygUXpgE14iYqvn07NFi jqoxKINji1wGlMhMK3DEBLnxPHDJdgCWlI0iL3dVLexmHBCEU0tSk92HwmSHWBOO4bDD W4ilUJlN8Gflbbuo2YrjNmfULfwbEYkU5muCbjqCCWp41BSos8CqIopE/J4qQqNTORyw C/7OgA/X0KFjzjJ3Z8v9Ox5/7G7mkfbN44+Hhp1Mggwg2thevHIh4eFXKZN8WMG+csuA m6iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737090494; x=1737695294; h=in-reply-to: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=eujaH9TaJbnjVBMtyQlKAWDn4xa179ZR19x+bFJDdEk=; b=MfZl2fAvj91e51B7LRPCNK3fjiwiK4mi6Y17hJO1qGVfTfZS1ssYCLYggYkCuF7wRL Ab1rkOtbOePgRcaKZFSJEMarhFNnr6bnyA9OntwDv3V716uSnswwLxnMA7VvLHGZawdN ppuor8gqDZzk4bRBS60pAfV9XrTsZk7HgqW5vtZy1kdTURDabjmPSEKyswzjXpbeqUjB nMi4gjgfirh3RS09MzSQiuDudJot4NxiTYC8bLkDyZcm0kaPf4NJ70ENYfowRKY/IYgw Wr+vCFRhuwkACQCLBZBksioM9oWHsWXiQLVP6YoKjmH6N7OGoxID/qH2h9nKzl/P3jpu wQBQ== X-Forwarded-Encrypted: i=1; AJvYcCXnCsCLJEnep50cQLgdmkKq7RXxLxaiN5DGoaZn7zPmI+KgwTNMRiYWLkDByigbA4p1LSnTu98dsYEyo08=@vger.kernel.org X-Gm-Message-State: AOJu0YwL1M0J5o+q3D8ANjB8QdqF5SHQyvV9jGLEx54h63OQriqDvsrk TnE7I/GusxWJzaZi2QT8O9zz8aPqGtVMWsXwzGuXDAKnfXhI42/XbNbEsTOTCrg= X-Gm-Gg: ASbGnctVvIUOJSnMPenz6+7CqeikccHbyO0kDfcQE9Fgg4/z77X3q2aTpld7+oP/fKz zfA7h0UmKygC0JzIE2x+PkGa3Zckm1lJrqgdBYVAYdE/JZi6rBiQZMmVcZBsjC/X8W9MkEA+sOd mf2JtETAfM27efBS0qo6aFX2ZFvMx+tfE3zyCTSPcs03fUJWPQc8CY5byejAT6AmpC3H7/uxMaB SsmyGN3FzKBdGktY/Y+JI1nrQHJARxkmZH+ZFVUFm6DMaymstZnzdze/rzb4A== X-Google-Smtp-Source: AGHT+IHllMRes8QADHP3xRRzfM0TQxggjj9PY2lflO/adJfq4rL5IpsLrXZE7CCVQomE7PJCMMbvdA== X-Received: by 2002:adf:e905:0:b0:385:f0dc:c9fd with SMTP id ffacd0b85a97d-38bf5673c35mr707737f8f.27.1737090494197; Thu, 16 Jan 2025 21:08:14 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38bf327df12sm1492547f8f.92.2025.01.16.21.08.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 21:08:13 -0800 (PST) Date: Fri, 17 Jan 2025 08:08:10 +0300 From: Dan Carpenter To: Steven Rostedt Cc: Costa Shulyupin , Daniel Bristot de Oliveira , John Kacur , "Luis Claudio R. Goncalves" , Eder Zulian , Tomas Glozar , Gabriele Monaco , linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4] tools/rtla: Add osnoise_trace_is_off() Message-ID: <435c4d70-3a7a-41d2-b49a-9de7cdb77c14@stanley.mountain> References: <20250115180055.2136815-1-costa.shul@redhat.com> <099e9ae9-5d36-46bb-8790-1b6a33dc1448@stanley.mountain> <20250116193432.716db3a2@gandalf.local.home> 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-Disposition: inline In-Reply-To: <20250116193432.716db3a2@gandalf.local.home> On Thu, Jan 16, 2025 at 07:34:32PM -0500, Steven Rostedt wrote: > On Wed, 15 Jan 2025 21:40:40 +0300 > Dan Carpenter wrote: > > > On Wed, Jan 15, 2025 at 07:58:30PM +0200, Costa Shulyupin wrote: > > > The original code accidentally works because offset of > > > `record->trace` is zero. > > > > It doesn't "accidentally work". The people who write this kind of > > code 100% understand what they are doing. They don't see it as > > anything complicated. > > I'm taking this patch but I replaced the change log with the following text: > > tools/rtla: Add osnoise_trace_is_off() > > All of the users of trace_is_off() passes in &record->trace as the second > parameter, where record is a pointer to a struct osnoise_tool. This record > could be NULL and there is a hidden dependency that the trace field is the > first field to allow &record->trace to work with a NULL record pointer. > > In order to make this code a bit more robust, as record shouldn't be > dereferenced if it is NULL, even if the code does work, create a new > function called osnoise_trace_is_off() that takes the pointer to a > struct osnoise_tool as its second parameter. This way it can properly test > if it is NULL before it dereferences it. > > The old function trace_is_off() is removed and the function > osnoise_trace_is_off() is added into osnoise.c which is what the > struct osnoise_tool is associated with. Thanks! regards, dan carpenter