From nobody Fri Apr 3 01:48:26 2026 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (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 15ECC230BEC for ; Mon, 16 Feb 2026 07:47:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771228059; cv=none; b=pTLbEWJhBcxfQglsXAb9i3Zopw6TO9KXNvVf7UH7h1JhBZf8dUcyKDydC2pbGh1jSYv4zda0en++o6wycCaN1nPYllIFsF9N1DQ8fY4huI8N1wPeLKl27eg/KeJokR/IV2NzexfokuPRDLC42PSboaZ7fK3FTQAKrMckq0vVNXc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771228059; c=relaxed/simple; bh=Z4QDTJNEDvGpW1kJiYtBNO27/JzZiYoj3e5OHA7c9sY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=U/Cg3drV5N2b2DnUFV4/EVe9ZTkmx74y0CwENtB22BGNPpxwZlbJCqIej5uGrE9ehvYQP6Uru0vnxLEUfhI2jswwQKFZpKbF7rOV0F/xWqRYAsPv9ABI48mrUn6adFrAIEkjy5VukAGGEFXRdynXsRDyvRJJb9YcYjF35CWfZk0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=E//y5Ot5; arc=none smtp.client-ip=209.85.167.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="E//y5Ot5" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-59e4993e00aso2385537e87.3 for ; Sun, 15 Feb 2026 23:47:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771228056; x=1771832856; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=OliZMof4JGqGAI7mR9RpknyBqlfF2jHZ//xx+NGaeTI=; b=E//y5Ot53wsJ7BP2d+NdMlXjVyrmNV6FuCdLdDH2/wZ13V8dSgoiPbk/LXtzEzYxr3 SPlSr09+M61sqBhdDZI3Qsa5alBXHKP3emEDJyJA9pt274tBA4ZjCMDk25r1sHCtmhIR CKOBtxZBQMcGlQV81fzQgkgNvrFPRoTl4jxgbsjmxdbEhRujfEu9J0L7rhH9L8cxJz2G bBs1FxutepKMuLiuUUXSfC/NQNLHrEOtVIa3EMZgngtwszMw5n0rX0ntdGgapmH/SROY fJYWdWtnwJarUIOj41Iddvu51Fvjjjs61rxE7o3dP+tAcbLnXKM3C3PrYfFQg0/iWG+U 8xzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771228056; x=1771832856; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=OliZMof4JGqGAI7mR9RpknyBqlfF2jHZ//xx+NGaeTI=; b=fUu80FoIPf3FHglM+TEXLuN6qDa1gI/MrS3r5Oll25xzuQjkRGP00ZDzvHMWnnMlT+ gkgcWbXBh7od25I3LRZkHCvlIB4bWNAjFMTiM0/mmA89fV7rVHFqtEDmkwD5x+6JivmD RMaC6eRG/dKT2W4ufaFz07jeDjh7VayNHRDw5A+IXkoIjLYDF02Vb1MK+qI8x5D8/gPT jnQrzkfL65w/MJz2gr5SxvrnKYZ0kJZsYmxtKL21goErs9OVG2+ygVUPehWJl/r0uY1w FdXslStjJiGZqvIMRegcGtux5NVuMe/0VGr0iuSLasXHCiz5QEt1LQYPeILvCZIV1Xce 7c4Q== X-Forwarded-Encrypted: i=1; AJvYcCXwrp40DFnw3G3+vHdOcYPc2AOEvMmahR2f9SrjfJjhu+Ybc1025y1Qt05BHL8XWjB8LrON/qiXVe3XOns=@vger.kernel.org X-Gm-Message-State: AOJu0YwiV6YOMJ9yChQ158HUPw9+SWDOopiKnLJD9AFbBu0wVS2rc1Ss U45llQpn7MPwMDOVDiHa7evokw1V24uLsU+eMCblt3ktkEo0DeRurZ3v X-Gm-Gg: AZuq6aKHNHl9KrVjyjOkFd+k2J3430YGF/YbtMypvTMU2LImPjbLYV9TRmcueOrMHei BlXresp1rJ4j1aKlGZxl17/AUtCCf25HiP5l1h2pz5jv6HMezbXpL0nK3JMl2Fu2hNV/E2CB7il dbZKI6kdW3a5o+Zsbxu4ej0M5F2pGGlQtlxP2LVJeQTmA6/wLQxJ6JeYJY3jngMTnNcw6ASPhMO f4op5UVeKFdy/wEMIUiIXS1JAZIC54v3U2y6NogiXulb3GyJKJiUBTfPYtnVAg1KiLcr7J2dd4R sY9FGKdoW5InQCVBz5sSmVgbOk85NhQ3uj/B6RygW9zsgBMQHvRGuXcWIsemK5fe6C/Q8I9L8EC Etnw7C7A1/XiIEuSqbXx/VKBZ1NlgZtNAskITh1T96+ZlBxWmN5wbM66NluHf0hTMW8m8o99tLt 9mhqMzwTqUnfoX1JHhNXlyXnoBu8HqqQksuw== X-Received: by 2002:a05:6512:3406:b0:59f:6be2:28fd with SMTP id 2adb3069b0e04-59f6be22de4mr2902968e87.27.1771228055904; Sun, 15 Feb 2026 23:47:35 -0800 (PST) Received: from localhost ([188.234.148.119]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-59e5f5635ddsm2984958e87.12.2026.02.15.23.47.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Feb 2026 23:47:35 -0800 (PST) From: Mikhail Gavrilov To: Gabriele Monaco , Daniel Bristot de Oliveira , Steven Rostedt Cc: Nam Cao , linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, Mikhail Gavrilov Subject: [PATCH] rv: Fix multiple definition of __pcpu_unique_da_mon_this Date: Mon, 16 Feb 2026 12:47:27 +0500 Message-ID: <20260216074727.741822-1-mikhail.v.gavrilov@gmail.com> X-Mailer: git-send-email 2.53.0 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" The refactoring in commit 30984ccf31b7 ("rv: Refactor da_monitor to minimise macros") replaced per-monitor unique variable names (da_mon_##name) with a fixed name (da_mon_this). While this works for 'static' variables (each translation unit gets its own copy), DEFINE_PER_CPU internally generates a non-static dummy variable __pcpu_unique_ for each per-cpu definition. When multiple per-cpu monitors (e.g. sco and sts) are built-in simultaneously, they all produce the same __pcpu_unique_da_mon_this symbol, causing a link error: ld: kernel/trace/rv/monitors/sts/sts.o: multiple definition of `__pcpu_unique_da_mon_this'; kernel/trace/rv/monitors/sco/sco.o: first defined here Fix this by introducing a DA_MON_NAME macro that expands to a per-monitor unique name (da_mon_) via the existing CONCATENATE helper. This restores the uniqueness that was present before the refactoring. Fixes: 30984ccf31b7 ("rv: Refactor da_monitor to minimise macros") Signed-off-by: Mikhail Gavrilov Reviewed-by: Gabriele Monaco --- include/rv/da_monitor.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/rv/da_monitor.h b/include/rv/da_monitor.h index db11d41bb438..f6da07863ed8 100644 --- a/include/rv/da_monitor.h +++ b/include/rv/da_monitor.h @@ -19,6 +19,7 @@ #include #include #include +#define DA_MON_NAME CONCATENATE(da_mon_, MONITOR_NAME) =20 static struct rv_monitor rv_this; =20 @@ -183,14 +184,14 @@ static inline bool da_event(struct da_monitor *da_mon= , struct task_struct *tsk, /* * global monitor (a single variable) */ -static struct da_monitor da_mon_this; +static struct da_monitor DA_MON_NAME; =20 /* * da_get_monitor - return the global monitor address */ static struct da_monitor *da_get_monitor(void) { - return &da_mon_this; + return &DA_MON_NAME; } =20 /* @@ -223,14 +224,14 @@ static inline void da_monitor_destroy(void) { } /* * per-cpu monitor variables */ -static DEFINE_PER_CPU(struct da_monitor, da_mon_this); +static DEFINE_PER_CPU(struct da_monitor, DA_MON_NAME); =20 /* * da_get_monitor - return current CPU monitor address */ static struct da_monitor *da_get_monitor(void) { - return this_cpu_ptr(&da_mon_this); + return this_cpu_ptr(&DA_MON_NAME); } =20 /* @@ -242,7 +243,7 @@ static void da_monitor_reset_all(void) int cpu; =20 for_each_cpu(cpu, cpu_online_mask) { - da_mon =3D per_cpu_ptr(&da_mon_this, cpu); + da_mon =3D per_cpu_ptr(&DA_MON_NAME, cpu); da_monitor_reset(da_mon); } } --=20 2.53.0