From nobody Fri Apr 3 01:48:27 2026 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (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 680A3212F98 for ; Mon, 16 Feb 2026 09:01:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771232511; cv=none; b=uUmdtZY6B05H3lpFeIFFRJfkcPwEEIosnwgRxFHFotXDh3VHPRo/FcQsDmGLDe0enxsvW6mijEB1fvNUWnS3+dg/F8CslG285WP0/VMIr4v3dZ+j83DTQMdQpdNyCRLZg8tJ8k4+1aWysP38/UPCFV2+fEWIUIXQ8BIoUN5qQcA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771232511; c=relaxed/simple; bh=JkPMAavzwLTFq8prvcAV3K72XwnVPZLy6KPEo0Issqs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X3DuMNBPrsQomc/PNtwmbDzJAbtxuYk3QAYQ/ZFwcEhFlY5UO2RYQHv+61J5PhnhqGhw4GQcRPfLHaFzn21BNNtPe3kHNHjLCHGS6Twn8U6QwZyxOsi8QzpTO87XY4cxbXAuxvoBhqXFC21f3/0avJ/AxFuljSjVKW9sG37SrGA= 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=GaDvnxHP; arc=none smtp.client-ip=209.85.167.50 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="GaDvnxHP" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-59de0b7c28aso3099439e87.1 for ; Mon, 16 Feb 2026 01:01:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771232508; x=1771837308; 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=RwldnQ5cJQ78NY64Pq9I1WXhiqI+ltEK3WKmy0FwY+4=; b=GaDvnxHPtavHerKwQ142m5wazvlFvAr797kt8QXX7ApPd2aQ+7U0hVW4KeWM8no7Ya QYNVHsWKHcBfXZPi+WXTulIwdWzhR1LYxn5AyHoZPJEmAKvF9jFjjLBsR/0271NrOmZi kq1kmmCILpeAjuQ4OuRunO7oLJZGxEaBZH0JTywVV3bNwc2La3hTZOnDyxW+1SQ7w6hS 1l1IuvfGd4L5hm20vcs3KFE2ELJOLN7kCEEyAyrdfcNagFJmB9UEVekAQGIwpUGpeHOV 2XC8sjrQHz4qyQV57F+SPNrQeD8xZoV3rT3vWGOVzGDsDvUxV3EdIvsBAectjIIbVV9b ygOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771232508; x=1771837308; 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=RwldnQ5cJQ78NY64Pq9I1WXhiqI+ltEK3WKmy0FwY+4=; b=DFMnvB9Zj57nrJj6YVii2Y31kj36EzidBHtiHZJYVomq9LgTIVthkgPIf1Iwy505EC uujRAhCYfd3rAWgXlHH/oZHpd3TKrmq3wkyJAVdw13HKN+HgQ2WsFhl1M1teYQz1Fwt4 Pho9TqzfncJV01YP3nws1dr8QLGgl9cbh0BO4b96FjQmPIxERx/A+/Ma9weygDDV0QHx BrZTw62MzOcHpuMCVPQyAf6pMT42hzzd3tRrE4670yDZsNZ3RLzKEdPZnY3sRXBaGj24 A64viNY1BdBiudIDeIcQ4lj5JeOYVRvgv6b5jwyValrXkKXpOgw3QNM1AQv8JgkzuvHC TzmA== X-Forwarded-Encrypted: i=1; AJvYcCUcuCY8SrFadLEqmy2fMnSML2ounvGeFn7EuD33Jpl/FuPfFuWnTfyH3KfkEI/ic6w1NnGHkG1y7PKvJR4=@vger.kernel.org X-Gm-Message-State: AOJu0YzzB31yq+Iiz9iDcEojNQek/RCG6WPLpB66C8r2QGzo70xe7llo Z87l0Q4MVZ2a/w3f4E/FQlJkETDnwTYnyGX6iE09xFi0Qn6t9EPaTksU X-Gm-Gg: AZuq6aLbfd+N9R8Nw5eqIr0hKCHJOZfOMFtvXIu9zSAri03Xy/iSnmt3DBTp7tTCF7j L5xfMXSsd0DhyqqZ8w11IJ9oZr82F7bn8K4GFMedF8SLZaODxBcP2WRAh3YHo9o9d6iEkaLQwtV q2CACTXpLKt0l2PdMWOCaQLyVAjgv43sKvLfsgIx8TMWM6yj+uUI1U8e+mTAYZuZzV0ano7CCEP 5IdnNSEEBHY2sf6vo7Mqz6AJ428OH0mKaA0Yqkfbo0ZUNKdYKb8ZBLVo4xsZealAg8seZndFcOI YMEt/swe1b5lS0/+7XWSOc4EmdpGVHy74IYO2WALCxZy6HXmjUjZ/+kIbmghvaWh6bya2XCnI3O l5txgKfDIMx7K9cuVXfcWKeXa3soSXNHuSSCu3Rk61GHHzK4/7IsE1rGPDmZSDJcBRODX5gmiJg dWDRfCAunrUqlz7VmS/iY5uNJVHLGnQjw3QA== X-Received: by 2002:a05:6512:1113:b0:59f:70ea:29eb with SMTP id 2adb3069b0e04-59f70ea2b81mr1424942e87.26.1771232507336; Mon, 16 Feb 2026 01:01:47 -0800 (PST) Received: from localhost ([188.234.148.119]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-59e5f56fe99sm3141647e87.36.2026.02.16.01.01.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Feb 2026 01:01:46 -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 v2] rv: Fix multiple definition of __pcpu_unique_da_mon_this Date: Mon, 16 Feb 2026 14:01:41 +0500 Message-ID: <20260216090141.757726-1-mikhail.v.gavrilov@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <628790bb5ee45c8968550a54388862f020d014ff.camel@redhat.com> References: <628790bb5ee45c8968550a54388862f020d014ff.camel@redhat.com> 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. The requirement for this variable to be unique although static exists for modules on specific architectures (alpha) and if the kernel is built with CONFIG_DEBUG_FORCE_WEAK_PER_CPU (e.g. Fedora's debug kernel). 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") Reviewed-by: Gabriele Monaco Signed-off-by: Mikhail Gavrilov --- include/rv/da_monitor.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/include/rv/da_monitor.h b/include/rv/da_monitor.h index db11d41bb438..7511f5464c48 100644 --- a/include/rv/da_monitor.h +++ b/include/rv/da_monitor.h @@ -20,6 +20,12 @@ #include #include =20 +/* + * Per-cpu variables require a unique name although static in some + * configurations (e.g. CONFIG_DEBUG_FORCE_WEAK_PER_CPU or alpha modules). + */ +#define DA_MON_NAME CONCATENATE(da_mon_, MONITOR_NAME) + static struct rv_monitor rv_this; =20 static void react(enum states curr_state, enum events event) @@ -183,14 +189,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 +229,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 +248,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