Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp84749lqp; Thu, 4 Apr 2024 07:43:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXIAWRfH4syMz+oK3nKKc+YDK/StEaxncO2nSDyP83eQjqjcuLjRkNIgVKcJsYju1XYkVOKkkZaredJbYyW7dql+U9dd1FXiLnYXj2yAg== X-Google-Smtp-Source: AGHT+IHmMC1+MVgx/3G+2aSFx+UXLr5GykiwURLaqxXbLDsefN96EsZfh4rF/kKMLTo1iuWFrjBk X-Received: by 2002:a05:6870:41d1:b0:22e:9b70:7949 with SMTP id z17-20020a05687041d100b0022e9b707949mr2906965oac.9.1712241784930; Thu, 04 Apr 2024 07:43:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712241784; cv=pass; d=google.com; s=arc-20160816; b=NoK0grvuj3z2QOEN2O6erWcIONI17mXMo+poi61tBLjJ+QDQsuNTa2veWt6rHDQFWK XEQttloeQ9j3MORTo10FcwHbT/r+So7moRoFNkDBx4EE9EN8u2xih+FTVADYno6nDH/h bv5/fBCw4W9oCNplK05WOPcJBSy2XjzSQk4n1thWPxB2nZlgWruY265VIgDDbweYGTaC ooxkd6B2EgNfG+IVRpd5kRCcQA2xf+UqmB1NaTuOuGZAJ/BKPCLDAdd16rTnt1H1/ZAo H3biF2OJGe7xduwjh1+NGgEsmO4uCdizl+kuXeQ5E19vohxRfROgc6Tl2F/ostcloQAf /9aQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=7D3JU+W2ZThhxENkFnOKanLxJxN9HSyjIsx2EIsO4IA=; fh=gtFm9ZY9VosVgH56vXae8jBEE/xPII18WkoUQJhYe0o=; b=1EdIcCmVl1F1vdo85LxhZ5vbo5gXEWUxCLZ/TGLveVGhvtizJGm7sUz9Myi0No9ers 3OcWgUVqLz0Zcj2tMz1bOMgVGWdLgn9jCRaAprtHoLAwc3VdMJi4ncCmwbta+d1JDTda Hu8C9OZ7xbTIEPARcQ+++Lb61DQfSDyXWojAjB3sPEc3y2zHkNTOe4+56JLW07eRn1/5 kmWihthkdXuZO6vLqQOqn7nr8IVKc2xXaA1922brH0gpW2PrOyy6MVsLu8sZBrtc1fmY E1iWNTSIp9fcr8J6zE4VJ4NfnOYaUpR8VPv0llJjSl1Uez7F2y97z5GcSZ9I5so3rzdw 7Ncg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@iogearbox.net header.s=default2302 header.b=rWyvnw6o; arc=pass (i=1 spf=pass spfdomain=iogearbox.net dkim=pass dkdomain=iogearbox.net dmarc=pass fromdomain=iogearbox.net); spf=pass (google.com: domain of linux-kernel+bounces-131615-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131615-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=iogearbox.net Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b2-20020a655cc2000000b005d8b7c3a019si15081749pgt.856.2024.04.04.07.43.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 07:43:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131615-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@iogearbox.net header.s=default2302 header.b=rWyvnw6o; arc=pass (i=1 spf=pass spfdomain=iogearbox.net dkim=pass dkdomain=iogearbox.net dmarc=pass fromdomain=iogearbox.net); spf=pass (google.com: domain of linux-kernel+bounces-131615-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131615-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=iogearbox.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C10C1B2A0F7 for ; Thu, 4 Apr 2024 14:29:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 08B04129E7A; Thu, 4 Apr 2024 14:29:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=iogearbox.net header.i=@iogearbox.net header.b="rWyvnw6o" Received: from www62.your-server.de (www62.your-server.de [213.133.104.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F5DA1CD03; Thu, 4 Apr 2024 14:29:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.133.104.62 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712240976; cv=none; b=cz6tAw+8CIz1dEDlUxNxr4e80DAQtAPvgc2zR3vi3Xt3UGOBWBy6idG/UIOgxXpkSi7gzWZ/4qgBAzxdwvpDoI6BY+MSCmvhkmv+7CwTj2Fdk0dyM6b3oBtp58lIYgpr6MBYGpFqCCcWh49eBJ+vyRzQWDAwASnAoxxRLpnV1ZU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712240976; c=relaxed/simple; bh=gSn2QxVUMSt6DtUuen8wT0y+Bz6MyT//GDU+6tlw5Jw=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=J9I1LRVzxgEPeAOSdwfVlAv0bSHoya5bgtWRHn0LlOwiilj5pQqXiYjFgYxDru2wg7R4X6gSEA8XOWXbmzkBsyPgPq1mA4aUtFSghMz1AHweGC2PJjod8CU+tGGF0WQkL8ewxWjO0EFSrEiUPu36eDgsVLv1UXC7Lx0cT/JwjrA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=iogearbox.net; spf=pass smtp.mailfrom=iogearbox.net; dkim=pass (2048-bit key) header.d=iogearbox.net header.i=@iogearbox.net header.b=rWyvnw6o; arc=none smtp.client-ip=213.133.104.62 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=iogearbox.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iogearbox.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=iogearbox.net; s=default2302; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=7D3JU+W2ZThhxENkFnOKanLxJxN9HSyjIsx2EIsO4IA=; b=rWyvnw6ozyjMfjRrqxeJvcmS+9 SJtdQQO9qriT2svBzvuzSz+U9GhbieFs2BBn1coYpVmyDwOLy5z89qy/RYqoAKUtQVKQLnZy4AaS5 fUWolnL61rL3FbILCxSBglw5Vi560+EArKbSNMYTj9bzx7wrXFtm5pzEr9PAVuF5UkBewq3BwGGDJ 6UnGvZ04OsfROjXYcB3q/X8rbC+oGNtMajbwWQo04iZmwyWi4j9Ai+JZiHbxh/rNDVvn36V5XIvmy wgyeldplqNbIUcxDE0Z6z97MR1Otq+fp340zNbv/qyeEDjNPDeycCZ2FWsyd/RE6GCjdHO8/HXT5H tQeq4enw==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www62.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rsO4y-00023V-E3; Thu, 04 Apr 2024 16:28:36 +0200 Received: from [85.1.206.226] (helo=linux.home) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rsO4w-0006EC-SC; Thu, 04 Apr 2024 16:28:34 +0200 Subject: Re: [PATCH] bpf: x86: avoid link error with CONFIG_SMP=n To: Arnd Bergmann , Alexei Starovoitov , Andrii Nakryiko , John Fastabend Cc: Arnd Bergmann , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , "David S. Miller" , David Ahern , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Kumar Kartikeya Dwivedi , Menglong Dong , Leon Hwang , Peter Zijlstra , bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240404123346.2661488-1-arnd@kernel.org> From: Daniel Borkmann Message-ID: <22b3dcfd-458d-dde3-7025-10611b3c6ef3@iogearbox.net> Date: Thu, 4 Apr 2024 16:28:34 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240404123346.2661488-1-arnd@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.103.10/27235/Thu Apr 4 10:24:59 2024) On 4/4/24 2:33 PM, Arnd Bergmann wrote: > From: Arnd Bergmann > > On UP systems, this_cpu_off is not defined, so the new percpu code in bpf > fails to link: > > x86_64-linux-ld: vmlinux.o: in function `do_jit': > bpf_jit_comp.c:(.text+0xbab14): undefined reference to `this_cpu_off' > > Use offset zero on UP builds instead. > > Fixes: 7bdbf7446305 ("bpf: add special internal-only MOV instruction to resolve per-CPU addrs") > Signed-off-by: Arnd Bergmann > --- > I assume this is not the correct fix, or at least not the best one, so > please treat this as a bug report. It does address the link failure for > me, so I applied this to my randconfig build tree. > --- > arch/x86/net/bpf_jit_comp.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c > index d6ebb9136f3c..8b8eebb89a9b 100644 > --- a/arch/x86/net/bpf_jit_comp.c > +++ b/arch/x86/net/bpf_jit_comp.c > @@ -1383,7 +1383,10 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, u8 *rw_image > EMIT3(0x0F, 0x44, add_2reg(0xC0, AUX_REG, dst_reg)); > break; > } else if (insn_is_mov_percpu_addr(insn)) { > - u32 off = (u32)(unsigned long)&this_cpu_off; > + u32 off = 0; > + > + if (IS_ENABLED(CONFIG_SMP)) > + off = (u32)(unsigned long)&this_cpu_off; > Thanks, there was already a fix in bpf-next tree in here: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=1e9e0b85255e6eca6036b59d8a5fbca6501905ac > /* mov , (if necessary) */ > EMIT_mov(dst_reg, src_reg); >