Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp72500lqt; Thu, 18 Apr 2024 08:44:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWwBjfI7tUiQ58XeBbnc61cNBVNqs1CiDhmldRnZWvPzzqaOc5mI06lOkZXd+uAmM/tHU0mTYuDhqaodKph9cLeeLhHY7P7cB5SiEMLLQ== X-Google-Smtp-Source: AGHT+IEWpRzOblOLQNEE6jPKLO0dUC6yedUKXNWJl6ruftU4CzHJVCHhkU7vnXLgiflhw+bYHuAV X-Received: by 2002:a25:9187:0:b0:dd1:37ff:696 with SMTP id w7-20020a259187000000b00dd137ff0696mr2980495ybl.59.1713455079451; Thu, 18 Apr 2024 08:44:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713455079; cv=pass; d=google.com; s=arc-20160816; b=rFLVHqk/+l/buV5Kc60pSWmOPfyueZk1vJpkskXPPY2rpXNFmlFFwfIylEx/HTEz5/ vNYiK8qHWEAeCPPr3gzWXc1L1HoTKZuYWBrrn1VaV6NJCyi1YmeLJF49OH55wpoANML4 cnWlx+4f49NBmBu2Kg1w3okG2RRPOBzTMscqun9rPy6jlMSm6KjlwphNQbrwqiuLaH0l BLDbqTZlpPvD2Mq/Z0cKSqVXsW/wsZ/F90E76C6yvyEDyQJYFokq8hrfrPLlVdy3ww79 hEUzwZr2y1G1hu8czK3mxPzBpjb07PmSiakFfAEaIYIWh3UWKTj8WiDMg6LEnon9Q2rH V+8A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=UtCAalpEU3sOWMKDUifAwR/7NkFi/BBuronL/FSnyNk=; fh=k/z8y3uD9fSIAfYkjwSqgWEWJCmM5OXjUBErBKv1LxM=; b=mPQ/QWdbIheHnwXBMQF/f7GpXGkCjc4krN8WXHA6ZE0oD7DqwDWj9F/02oTcnKkI+T AGlKo+ZpX2aKyrWss8ek3K8efLwFuqiiHTvqYAxL1/bBuzSFoD9yWUnGxfSUTe1+FJNx uFgYoK0expM7GzNjehFwJdSxXIP/FZqto0CzERwzEBiIQ6RAPoZJikgtKExCi768oP3f fIC5R42hksLw4kK7RYD8s3G0EiOKjGGLLoZaOH+ZJL3IHaAXZ8pe+x/Z33KdD9PhxG9b 5/rF9RJavQvY/tY8nFwzEmi7W7v2p+jV8QfXvc9da5RS1ziBPmq+JMMri9hbe8mMlBZG PQFQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=nGkHN+Cz; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-150415-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150415-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id iv12-20020ad45cec000000b006a04a0fac02si1701174qvb.415.2024.04.18.08.44.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 08:44:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-150415-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=nGkHN+Cz; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-150415-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150415-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 024861C222EF for ; Thu, 18 Apr 2024 15:44:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 548D116F830; Thu, 18 Apr 2024 15:44:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="nGkHN+Cz" Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 BB5D916E891 for ; Thu, 18 Apr 2024 15:44:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713455070; cv=none; b=hd0tJQphJrbtOQxLcTzVrVHIJuiVNKA72EFKQhFwE4mgQIjPLdCNo7767KQN+cQiBHoKUA7S6EIG2xMjao6ZX9nNPuQUuLu8aEia/DVeRgU3h4mfJ/0BWMwnei3pxiImV6I3ubQMYlAzDSQ2WFK6o/qDf9YZSKc6Ez9Cdf1PEJ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713455070; c=relaxed/simple; bh=eW41FDAYitNVnqBwCLv7gIF9iBGx/T1PWewJl/Lc39k=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=V9ycTdtrnU7Ku4o3zJB2KpQPhsGCV84vUSz0H9kb0ubup+vHSuyPBfhUWTPK4N9K+/AkAfxv+loFnMNSq76sOkq9YtrQ7BNli/EEsda5gjuQr5f4aX2xrnLF1SaCWcFa3f5ZHLWysqOQYjbu6q6p16quSHRooOeaSWut/Z5yc+k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=nGkHN+Cz; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-343b92e54f5so777737f8f.0 for ; Thu, 18 Apr 2024 08:44:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1713455067; x=1714059867; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=UtCAalpEU3sOWMKDUifAwR/7NkFi/BBuronL/FSnyNk=; b=nGkHN+Czc/F8uoFXtHCbSIZM+yy0deqX7miZec2LA42CxZ/4zHw9dxTaa0rKzUDXoK wyiJgY43EwMMQbVCzysExVyheRe6BUh3/ysKr5rYjXcSlKCtQp+LW4nqWIOGnNdS+eUt EAQ03NWHYmd4IkxaVKm5Catup61N73bHIxugZ85NDZzciXM5u8kiLdG7UgO44D1jA4n/ qCmcE2pm6eO/xfBbKxJfI8zPyehXz4qhG5a9ncd9ADrfJFjwgDg8r7mxl1VzaqI8blaO ONP2d1CQutgD8Z+TOSg1jJzqn+XDThU33a6n6yeCqxUiR20zFPl6xwxbF/8Tf4eb1mt5 H7IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713455067; x=1714059867; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UtCAalpEU3sOWMKDUifAwR/7NkFi/BBuronL/FSnyNk=; b=JNIx3rBCIKaRqqPjPdux9JacINvxYPQ7m5FGBYe+mVOZmCrb0Vxet6qB++Z6X2IFCg WZ9ZNRgQknWPIHVlFy5b0DQweULJ5OFF5SKh2NFlkSnhIEdDthfojFSlnGQlwJvDAgb4 QXFhZrznqjZ1yMaPe/j8LBoOf4Oe7qV/me3mzmt6rsdOnc3J5YpKSb+WKIIjoRrE4USQ GZhfCx7OYNEDPWhsCcp8wNVhjId0XzXBu0XMHvFTqKaaVL4BjskglwXCBaOwR3YnFRG9 vN3hNpenHQoCMaz4GHUV+ydlZte4R9M//ebDEVnwh0RjGEuvFLj6Z0n7rBMdJsBAWxs4 xsBw== X-Forwarded-Encrypted: i=1; AJvYcCUz2O9dCequA5pfNTTnsNKkwqDhfPmvAp5SFQ9JnrWF8evJ5UWTQ364h3DBPUabluAojEHN5TPj2oPTa6+K+QVLCoL8EmT2fhJ/sbkl X-Gm-Message-State: AOJu0YyWhYhjmRg1zAFeVxPOyY2Zr99uObSDSize2QayNezOSP2LjtSA Y8OHMvPILCv+J4PQsWnXpcGizrBhFRQIu7xboKfHbxhvpZHKcdaMVuRNbkwsL4K0xbbCUr7g3T1 mFwcmdtZt55NtlDhmEooGal+XNH9vX1mW3Kse X-Received: by 2002:a05:6000:912:b0:346:cd6f:40d4 with SMTP id cw18-20020a056000091200b00346cd6f40d4mr2059470wrb.59.1713455066857; Thu, 18 Apr 2024 08:44:26 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240417-x86-fix-kexec-with-llvm-18-v1-0-5383121e8fb7@kernel.org> <46343CD5-24D6-46BF-92A7-0B0FA0E6937D@alien8.de> In-Reply-To: <46343CD5-24D6-46BF-92A7-0B0FA0E6937D@alien8.de> From: Nick Desaulniers Date: Thu, 18 Apr 2024 08:44:12 -0700 Message-ID: Subject: Re: [PATCH 0/2] x86/purgatory: Avoid kexec runtime warning with LLVM 18 To: Borislav Petkov , Arthur Eubanks Cc: Nathan Chancellor , tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, morbo@google.com, justinstitt@google.com, song@kernel.org, ribalda@chromium.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev, ns <0n-s@users.noreply.github.com>, Fangrui Song , Ard Biesheuvel Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Apr 18, 2024 at 4:15=E2=80=AFAM Borislav Petkov wrot= e: > How much of this silliness should we expect now for other parts of the ke= rnel? Looks like ARCH=3Dpowerpc sets -mcmodel=3Dlarge for modules and ARCH=3Dum does for the whole kernel. So that LLVM change may have implications for those 2 other architectures. Not sure we've had any bug reports or breakage in CI yet, like we have for x86+kexec. > Can we turn this off? Maybe we need to revisit commit e16c2983fba0 ("x86/purgatory: Change compiler flags from -mcmodel=3Dkernel to -mcmodel=3Dlarge to fix kexec relocation errors") https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?= id=3De16c2983fba0fa6763e43ad10916be35e3d8dc05 at least the -mcmodel=3Dkernel addition (since that patch added a few additional compiler flags that still LGTM). > Why does llvm enforce .ltext for large code models and why gcc doesn't do= that? Why does llvm need to do that, what requirement dictates that? Google is now at the point where a few binaries running in data centers are measured in the gigabytes, and attempting to link them may result in relocation overflows. From that commit message, it sounds like they link together object files built with the default code model and some objects from the larger code model. Putting large code model data+code in distinct sections is helpful for then being able to place those further away in an object. For other architectures, the linker may insert a veneer/trampoline. Not sure why that's not used here. https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#index-mlarge-data-thres= hold makes it sound like GCC may place data larger than a certain threshold in a new section. Dunno about code (.text) though. Arthur, you probably happen to know more about code models at this point than anyone particularly cares to. The raison d'etre for e16c2983fba0 was avoiding R_X86_64_32/R_X86_64_32S relocations. Do you know if there's another code model that can force R_X86_64_64? Or is the large code model the way to go here, with updates to linker scripts for this new section? + Fangrui, Ard, who might know of alternative solutions to -mcmodel=3Dlarge for e16c2983fba0. Otherwise, I think the dedicated linker script is the way to go. We really want tight control over what is or is not in the purgatory image. --=20 Thanks, ~Nick Desaulniers