From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (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 876F219E96B for ; Wed, 18 Dec 2024 12:04:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734523448; cv=none; b=rGhNBPt4rzbEz4Taj/1B0kT6Ye1NYO4HTgNIDRL2aezMnKyo5qYFQ+k/KyhvknbgiR6fNMialpiRS7oX9ZPQsgirEtLrJpKCVuXD/I5szSpPb8cBxOgx041F1CWZn4TnvHe9FCOvyF9tUrFh33hmBJN1UimtBOv75SaVxOqprfk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734523448; c=relaxed/simple; bh=S1dZ7REYJvvKLV4kXaRfkTSGb+kFtWJjWR5CNqP70fE=; h=Message-ID:Date:MIME-Version:Subject:To:References:Cc:From: In-Reply-To:Content-Type; b=FlqsFF7aVt38U85rS7lG6klflPUZvURU2nLzvbmt7mhRTXZeTY3L6M4n0wuYmfd3Cqzz4KGrcQMD3JSFx3ig2hW9kAksdl/FH/VibISnwD6+2eS+JCWZHvKhwuZSPtvqLeLFDp3QK/R3XZJ1WMPlBih/+DW0s9UZXrOpGxB09FQ= 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=SoWvV6a1; arc=none smtp.client-ip=209.85.218.48 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="SoWvV6a1" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a9e44654ae3so988302466b.1 for ; Wed, 18 Dec 2024 04:04:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734523445; x=1735128245; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:cc:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=3KtNhOq23ExUq/9KecQTGduTg9YM5UXK2XCKNylBnoc=; b=SoWvV6a16Zn+r7qPywgbkWc9D2/GgmCygRBmTZBdsSG0EeGalTJDEhNT1UEnav1mKb Bif+80+RJJR7o4LyaUNLJ9DT1sLuCMRywfWuek1su+W64GGMzP+mYl6y7gPUIE3jrmcy SnZlab2+ITVTRklEbBZ1y+Qr6VBKYX2kINsK+3u/4T1brW/CAYl7vC9AyNBsySVQTueu qog+uLcFJpNkPdiiIB5s3rGSzYlwWJijZnf57oVah6VfTPfyYjq+oYD6DAX5xHKsVlI/ tcq/xdR9OaWdjznYLTvLDCKu6bRYRRoTNKhVatZLidEiFL96ObgZsb/eiAvuea3YVGJr 6FgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734523445; x=1735128245; h=content-transfer-encoding:in-reply-to:from:cc:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3KtNhOq23ExUq/9KecQTGduTg9YM5UXK2XCKNylBnoc=; b=wQTilWhIfBZEpE6+RiyKGQUPHooIZgQggz7KQrXkDzLj9RHQGbQoQqtdWMuCN/4S8X YOudBkPYwY4s2RA6u4rLvHewfueh8/h0Ql0a1SQTGuoNErx3yMmftH3U1KZUb0yB0/P5 bHMq+FYnaFKDEkaL3vb1/fGVhhlTpwJzcBaSlurFqkHI8vfXOlgou26bUa1iwZPRrGmp q2fXjqoDxRlL4Dr6wCO7LS1bhgAyDaYJcNMtsSjyOktsbiSE2qYqFrqk5a5C/10q+c0E Styae7RJ16suI5z19+b7pGiW+LbiBTJQdeJpJ+TNCw/wBd8DxHilr0qfjHRXMlQFZGtu PqiA== X-Forwarded-Encrypted: i=1; AJvYcCXeJYPXsNa9NU5GLsFFi8J3qmcv6Vr1sXQpqIu9XH8AWv9qdX4WcpJqpMSGUxs4n42LLYxasrMFXHyweWw=@vger.kernel.org X-Gm-Message-State: AOJu0YwgmOzslOUoMGp0MlaYgtPBnI0E3LheqyAF7nnAaSYjYZ8GKsuy h+0bpOdQ6AbYRh1bnobMWsyrx4s3v6iEcpKDXtJ6BBmyhUr9sIwUm/RU7FwIeIM= X-Gm-Gg: ASbGncsw9H7Q+/XIGdkPokTMJ/4Ls4SUT20kkAMXfMvKqB5UcCEScRT0hEfARjtgfUW WULKKcO5vfpxhzAAFNbYbtn3D+TADBeNOIP+Lbq4OxlZRUQB+yGRefLKy6zLjTJsZzjK0wbI9kb WqsltGW5THsejKBZqADfGIeZp5zwN5rTUi5kWWMaslfMVz1CVbrwZMSUHt3mgzWV+hcn6c3iAyQ nYaZT/rpDCtEu0Ovg1WpVyU9VdZGy3g9Fpd2CmG0pRTi0r55XSkme41DDI4eOfrmA4= X-Google-Smtp-Source: AGHT+IEIploq19qvtSVx5i1P6HWfUUlzgeSE4IAvQCe4cHTY3KR53cmUJ0tS0/78VyTR917XQYwDIA== X-Received: by 2002:a17:907:7801:b0:aa6:7ec4:8bac with SMTP id a640c23a62f3a-aabf474fa3amr201644266b.17.1734523444882; Wed, 18 Dec 2024 04:04:04 -0800 (PST) Received: from [192.168.68.163] ([145.224.66.247]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aab963b2672sm544593566b.177.2024.12.18.04.04.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Dec 2024 04:04:04 -0800 (PST) Message-ID: <855f50a5-f397-4a08-8298-78bd040e5328@linaro.org> Date: Wed, 18 Dec 2024 12:04:02 +0000 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 v3 1/5] perf cpumap: If the die_id is missing use socket/physical_package_id To: Ian Rogers References: <20241216232459.427642-1-irogers@google.com> <20241216232459.427642-2-irogers@google.com> Content-Language: en-US Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Kan Liang , Sun Haiyong , Yanteng Si , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org From: James Clark In-Reply-To: <20241216232459.427642-2-irogers@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 16/12/2024 11:24 pm, Ian Rogers wrote: > An error value for a missing die_id may be written into things like > the cpu_topology_map. As the topology needs to be fully written out, > including the die_id, to allow perf.data file features to be aligned > we can't allow error values to be written out. Instead base the > missing die_id value off of the socket/physical_package_id assuming > they correlate 1:1. > > Signed-off-by: Ian Rogers > --- > tools/perf/util/cpumap.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c > index 27094211edd8..d362272f8466 100644 > --- a/tools/perf/util/cpumap.c > +++ b/tools/perf/util/cpumap.c > @@ -283,7 +283,8 @@ int cpu__get_die_id(struct perf_cpu cpu) > { > int value, ret = cpu__get_topology_int(cpu.cpu, "die_id", &value); > > - return ret ?: value; > + /* If die_id is missing fallback on using the socket/physical_package_id. */ > + return ret || value < 0 ? cpu__get_socket_id(cpu) : value; > } > > struct aggr_cpu_id aggr_cpu_id__die(struct perf_cpu cpu, void *data) Hi Ian, I sent a fix for the same or a similar problem here [1]. For this one I'm not sure why we'd want to use the socket ID for die when it's always been 0 for not present. I wonder if this change is mingling two things: fixing the negative error value appearing and replacing die with socket ID. Personally I would prefer to keep the 0 to fix the error value, that way nobody gets surprised by the change. Also it looks like cpu__get_cluster_id() can suffer from the same issue, and if we do it this way we should drop these as they aren't valid anymore: /* There is no die_id on legacy system. */ if (die < 0) die = 0; And last minor comment this could do with a fixes: 05be17eed774 [1]: https://lore.kernel.org/linux-perf-users/20241218115552.912517-1-james.clark@linaro.org/T/#u