From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 7B206224F6 for ; Wed, 18 Dec 2024 20:57:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734555462; cv=none; b=VRLdFVPbc0cokH3D0yC6TXD/2eu+SDtospprkjupnIS5MLq0juptoPrxAZTZ7b/QKkprcr4TNcANLl4G8fCXSuIiEaWFf0ou38mobcwEYJ/3CY3mdBb/1a1GOHEtq/HMRIbTUysK2D4eFtx7naPluvp4An+A/qMAVPZjRzs/+X8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734555462; c=relaxed/simple; bh=8H3wMQ/MbfGoC09L1FK6owB/PgM/HCZEYV5FlSKzB9k=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=A0ObmZxUKUii9PSUiHK3OEHm4/Klp1txKnNpFzLyygTclprOTJImy/5OFb9AKBSTD74j6nYGHKdFlSiXzJmUqUoQME7Irhsz7UJUcYBbzkD2Zz+nmd/RDtOfDRyO+hQWLnDtI6anWmdD7hF1VPEPMuFwXai8kB9us8JwUrTuL5w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=aUsulFri; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="aUsulFri" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-2166022c5caso944305ad.2 for ; Wed, 18 Dec 2024 12:57:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1734555460; x=1735160260; 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=DnlzBZ1bNkNrCyadScSxNwpP2f0bFLt+gzSGc7X//Xk=; b=aUsulFriOiUJHlAIMnRUPoQ+THfbjjbAh35BHX5+D288HYeeU1MOk1t8G89qb90YQI t3Q4bkmhJtuBlOZgzUhODG+21ZAzgwEnzgyOoIuM1B3c47wqUH7rfI0PCCLYlPLSuLJF 5dDjQsP3VAY+a+vLV/4KXm2+cpLceLZHTunP3d5tXBrnXkHyYZctm5IGk0AKdNpCfRGy R6jOIDf1nyleZlb4dkaEeUeO0DwZCVQ0Ya30mjKB75vUNCGEaSlAXciHgVHCKEjON+7h mwZuQYJPZg8XVMuq0rG8/lfQPzYzeeWkDqHLmGo2/ZhlCQPFAa0kKuG3i88tZMxNceR7 ui+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734555460; x=1735160260; 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=DnlzBZ1bNkNrCyadScSxNwpP2f0bFLt+gzSGc7X//Xk=; b=aUUs7Smm0cHyvr1dn2zrjRj2Q+Zb9ratF7ZYNlFhjkr0HIclG9R5Am9m1GJQXXwonf kU+KZAujB++SfWVS8cVUQqOWSqOvMn0dRwkYKiQ/n+Qrxieae85TFXVyCHSy3rLfdIjb XbJd3XoWbut03//uv8h7O6eppd/hCvfERad4G3QZMEEfC3GhpjEp3WhO5412IiaO0qWP 2wOickXw9evuJj+8bEcXlpx9Q+vXouBWHc4nwRYo5wZhfJcUyBmT++qLp29l7iKchuNi Hwk6nmfX0xQRL4eOZsB0iidAiwssf2jvmmKz0jqqKtwY2VA5gIi9UoXqdyD9EnyLrjYD 3c/w== X-Forwarded-Encrypted: i=1; AJvYcCXtvje0jaJxPTA9mnGqDpo3399ZfNw0mBq1UOKr8Py8vLwOs4wuZ/vehdz2vinAR2o9W0vF1//ih9Odp30=@vger.kernel.org X-Gm-Message-State: AOJu0Ywqe4iHq8IrZUUOjBjlaNJnKb93DOsiGAw5rtPmyfBt+VjViW3N 8l3dbo4loJzSB7IELKIHXBns92yXSL8uXO1NwN4kFB7UOjtMAm3W4UqItJH3O0k= X-Gm-Gg: ASbGncs4a7x0hA4pVzO0k1YhuOeT7L1KRYG4NqK4UklbyLkmKzT6YDG/FIYeYkhrjhI U7wytYojN2dqirmmXNnDT/SVM3p3KqMUlltV4T/JCZInyvqAvp0PxOi3Vy2Agb7bEDDepImSj0I Xq8QPBFbR5btbaOXEnUkpvRZxw/YxSaJsL1cC/xhbLJtLrzT4T+/Dcb4CfZ83Qnnn7mLwqCL6XV r6xqHzsYSWGpp/cl6OuuL3XnHvi0wr6NiFvNnC6aCAz99c= X-Google-Smtp-Source: AGHT+IFbrr3Ugx9sJuxckBLXykfeFQB9mdy4wgUJpUjJFCoKZYBQ4+1F1qUWmiA9nhDeXvGo84jWaQ== X-Received: by 2002:a17:902:e741:b0:216:386e:dbc with SMTP id d9443c01a7336-218d6fdfd08mr57672385ad.13.1734555459502; Wed, 18 Dec 2024 12:57:39 -0800 (PST) Received: from ghost ([50.145.13.30]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1e5437asm80558955ad.162.2024.12.18.12.57.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 12:57:38 -0800 (PST) Date: Wed, 18 Dec 2024 12:57:36 -0800 From: Charlie Jenkins To: Arnaldo Carvalho de Melo Cc: Ian Rogers , Peter Zijlstra , Ingo Molnar , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v2] tools: perf: tests: Fix code reading for riscv Message-ID: References: <20241217-perf_fix_riscv_obj_reading-v2-1-58f81b7b4c7d@rivosinc.com> 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Dec 18, 2024 at 03:41:32PM -0300, Arnaldo Carvalho de Melo wrote: > On Tue, Dec 17, 2024 at 04:30:15PM -0800, Charlie Jenkins wrote: > > On Tue, Dec 17, 2024 at 04:18:32PM -0800, Ian Rogers wrote: > > > On Tue, Dec 17, 2024 at 3:52 PM Charlie Jenkins wrote: > > > > After binutils commit e43d876 which was first included in binutils 2.41, > > > > riscv no longer supports dumping in the middle of instructions. Increase > > > > the objdump window by 2-bytes to ensure that any instruction that sits > > > > on the boundary of the specified stop-address is not cut in half. > > > > > Signed-off-by: Charlie Jenkins > > > > Reviewed-by: Ian Rogers > > > > > A binutils patch has been sent as well to fix this in objdump [1]. > > > > > Link: https://sourceware.org/pipermail/binutils/2024-December/138139.html [1] > > > > > Changes in v2: > > > > - Do objdump version detection at runtime (Ian) > > > > - Link to v1: https://lore.kernel.org/r/20241216-perf_fix_riscv_obj_reading-v1-0-b75962660a9b@rivosinc.com > > > > > --- a/tools/perf/tests/code-reading.c > > > > @@ -183,9 +244,30 @@ static int read_via_objdump(const char *filename, u64 addr, void *buf, > > > > const char *fmt; > > > > FILE *f; > > > > int ret; > > > > + u64 stop_address = addr + len; > > > > + > > > > + if (IS_ENABLED(__riscv)) { > > > > Not sure if there is a consistency issue here. Elsewhere we're just > > > using ifdef, such as: > > > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/util/include/dwarf-regs.h?h=perf-tools-next#n69 > > > I don't have any strong feelings about that. I can change it to be an > > ifdef. On other lists I have been told to use IS_ENABLED whenever > > possible, but it's only a small difference. > > Can't we just use uname here? > > So that we don't use kconfig.h since its not used in tools/perf/ and > makes it looks like perf is in lockstep with the kernel source tree > version it was compiled from? > > $ git grep kconfig.h tools/perf/ > $ > > BTW, what would happen if I collected a perf.data file on x86_64 and > would read it in a RiscV machine with such a objdump version? The same > problem? Yes that's a good point, we should be detecting riscv at runtime too. - Charlie > > - Arnaldo