From nobody Fri Apr 3 06:41:45 2026 Received: from mail-yx1-f43.google.com (mail-yx1-f43.google.com [74.125.224.43]) (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 8BB383FB064 for ; Mon, 9 Mar 2026 17:56:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773078964; cv=none; b=NMNTu4Uejo3J8KYw+WLvqvHyLLXRpWfCpl3PKKkezvh25khsO9MEB0TcrYStKk6+XUQtvsXK/NklxSwy1oqIM9TEJLMFHOY3xTWel4UNbHvymSBKGpCXiR67FZe02+WtcJI83qaxatT29jt3Mi4gnqcFWN0PrCcuYvShGfkljJY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773078964; c=relaxed/simple; bh=9uNtpknv29cmQteZhSGGznRmJ73KHryeX5TUxc7eu8Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pOCElQI4f/uMUetANDcUaqZMNfth60Si1QwTZht7Sz+Pc8oa1zEp6J5yHCfGYW2bYi0gZU00RTd4TIXIGBLm4DTgRc4z5QpCRQ4n9aF9Jcw4A5aUw7bfKhLFkEPeiKVpcWrheLGwgXmM9P4Ewm0V1xsZLiKZzXjdGBah4FxHpKI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ncsu.edu; spf=pass smtp.mailfrom=ncsu.edu; dkim=pass (2048-bit key) header.d=ncsu.edu header.i=@ncsu.edu header.b=ONcZWxa6; arc=none smtp.client-ip=74.125.224.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ncsu.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ncsu.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ncsu.edu header.i=@ncsu.edu header.b="ONcZWxa6" Received: by mail-yx1-f43.google.com with SMTP id 956f58d0204a3-64ae2ce2fe1so11016420d50.1 for ; Mon, 09 Mar 2026 10:56:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ncsu.edu; s=google; t=1773078959; x=1773683759; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=S7oosy5/acey/h5OCheMNJ9lzD2RKykZWn+tBKBfRfY=; b=ONcZWxa6FsK3tMxk99UDimwn5IByxqxiUlAgd55fWChkCAlnRNfkuD9kMhovTF/hY/ I3w+UcVv5dtEhhpw3r66WHe2S8r87M1gPErcHlP18xcVXj09IYPIJStECEFkiKhi8G6N 5b0O8uidN7H3qG4IvlDiLI/DNxPdDMQp9XufLr73r+Eixb1SuyOgH0dpnMer7FdbXaoQ 9LK5DhyZ98zlRDUldI7BG22nHolw0i3KW68tA+b7VcumrjsRsnGK7oBBmFwarbV3J6QX LDLXZFY4Nl+NVzqZ8rBgxSEZvQLqFzmfBvcTSfYBARjdmtvMqgvFIm+w5ZrEfO024p04 SCmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773078959; x=1773683759; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=S7oosy5/acey/h5OCheMNJ9lzD2RKykZWn+tBKBfRfY=; b=j7epUg04y/M1MO0do1aBLdDD829tLwCUoEQ8aB64KJ0ObS2qyN3foJxVtY2lb3O6d1 +k0ntOBn1ihHESzbLSKl0Rsa1y2OJXgMx3SNEVD1hf64DrId7WDUEKIwIUdl42U/wKus rtQW6Dzr6YEzMxBKgpipJx9UFi3o7iRZv0Fdph4x2zlYks4AHkQqFlIPkGgyLyJmWFR4 b2IwgMja6UMgunJMVxE2RE3SOrMPKa00ddYdd8Dm1E29Rs6bc+yNIJszKpf6yFI/Zis9 hrHl44VNhrtmmcaCQcx4MRliUSN4OXPUzsvlGhCe+wXZGCEE9Ya3FNhaZwWRzJ7GsxrF mQBw== X-Forwarded-Encrypted: i=1; AJvYcCVvI3i97ELJDDCBrkaKQlTBLE2AzaRnBfeAlFvAy6To9IX15sLa1AvN/Br0Zz+kU3A9PqtGiF2hCQ+ayOM=@vger.kernel.org X-Gm-Message-State: AOJu0Yy2vLjU5FbQPF224g/pQGDvbDjxmv8yqi+H01fkEChZXlvp9d/M q2B0zczRT96hhkRoOMkscSTd/Jtw48KGb6zDZInQICLDNZNM3L24fN6+DbVg1vjhew== X-Gm-Gg: ATEYQzzYxZbUUZ1XpwWpk92lrD4YQ//XfhugpfJfthyYrZ1yTIht+ZZr5dMSRWEeL0j c+OuShlWbb5SyUEl3kXnInxOwfdRaZzNn7baRQc2Ee6/zORUuEY8ISgTpXh1YcGfSJ1S4eyje7J rhJdaShi4IusFbQuOBaAIEw0OyGTqdso2+O+tOEH9PhybPapd3wnMgMvCtZ1v/7eUhVb2t+ekg5 7zMBLQrhW21qeD6eWiqV0CptMo5iK/UWkY1pZ+nCPp2J7aKYyQ88qpEd5umdfUbBk27uedyabNJ CdoLEzfPoFAyGgDhehM/ZoxKyU1hRtriPqboZggyAZbsyf5uBDavn9rx+Y2X47Ol2L3VtHxvRKl cwTQg89yOniopx3Cgke3uXbNalpg7fPyzzv2eNqk0tMYW0+eL96TmoHhU7FNXgUWkIhLMBeB2lc 6ScXHr8WrzBWRd+TK0q1PF7KTtkrJwc1XWE8u40zt2ID2yuBeV4QNb+0F/ X-Received: by 2002:a05:690e:118a:b0:64a:d80f:5cf with SMTP id 956f58d0204a3-64d141120b3mr11987752d50.25.1773078959162; Mon, 09 Mar 2026 10:55:59 -0700 (PDT) Received: from um773-cachyos.sd.ncsu.edu ([152.7.255.206]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-64d176e70e7sm4992535d50.20.2026.03.09.10.55.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 10:55:58 -0700 (PDT) From: Zecheng Li To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim Cc: Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Zecheng Li , xliuprof@google.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 07/11] perf annotate-data: Handle global variable access with const register Date: Mon, 9 Mar 2026 13:55:20 -0400 Message-ID: <20260309175546.916039-8-zli94@ncsu.edu> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260309175546.916039-1-zli94@ncsu.edu> References: <20260309175546.916039-1-zli94@ncsu.edu> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When a register holds a constant value (TSR_KIND_CONST) and is used with a negative offset, treat it as a potential global variable access instead of falling through to CFA (frame) handling. This fixes cases like array indexing with computed offsets: movzbl -0x7d72725a(%rax), %eax # array[%rax] Where %rax contains a computed index and the negative offset points to a global array. Previously this fell through to the CFA path which doesn't handle global variables, resulting in "no type information". The fix redirects such accesses to check_kernel which calls get_global_var_type() to resolve the type from the global variable cache. This is only done for kernel DSOs since the pattern relies on kernel-specific global variable resolution. We could also treat registers with integer types to the global variable path, but this requires more changes. Signed-off-by: Zecheng Li --- tools/perf/util/annotate-data.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/perf/util/annotate-data.c b/tools/perf/util/annotate-dat= a.c index 301f73ea8275..50c82c91f828 100644 --- a/tools/perf/util/annotate-data.c +++ b/tools/perf/util/annotate-data.c @@ -1229,6 +1229,11 @@ static enum type_match_result check_matching_type(st= ruct type_state *state, return PERF_TMR_BAIL_OUT; } =20 + if (state->regs[reg].kind =3D=3D TSR_KIND_CONST && + dso__kernel(map__dso(dloc->ms->map))) { + if (dloc->op->offset < 0 && reg !=3D state->stack_reg && reg !=3D dloc->= fbreg) + goto check_kernel; + } check_non_register: if (reg =3D=3D dloc->fbreg || reg =3D=3D state->stack_reg) { struct type_state_stack *stack; --=20 2.53.0