Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp405149lqg; Fri, 1 Mar 2024 08:36:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVdUmKeofg93xuzErPMHPLQr00UAYq2rwHLmoxUY7QMjkcKn2sXJDe3Yve2kqA4A3Nq2MfGgA1Zq8FukgHKC/Luq8oSslNrxOKCyF6eoA== X-Google-Smtp-Source: AGHT+IHYDfjlqLJC2cxQOP4ap/UwaUu+D9HROcLgb0eEkeVErpgTMubnp7e/7LaletjFKZWi3I8y X-Received: by 2002:a05:6a20:7f99:b0:1a0:f3d0:15af with SMTP id d25-20020a056a207f9900b001a0f3d015afmr1977734pzj.34.1709310997957; Fri, 01 Mar 2024 08:36:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709310997; cv=pass; d=google.com; s=arc-20160816; b=Y9OAjl8aBFYWc36pKq2xAfepviCMLLJvMCfc/X2H/hlvJbkN5ru7MROBs1YuxGbmIP G7zyvCWieaLyjaq5sSU63qdz9QH095XzafBmkSjTsIC2Ai9c1oppBdPUmb3p7YX38RPb pJ6PDby5PkilR6oFKOwYgg3z+BlpPUQXGeojlvaWwkz5Vtn92tu99udtGfKpduly54/z x9K/yXEolkVdCOgkYpGzx2X6B7tu9NddCI29DhB4iq2RrphvQ08AEuQSduOqTn4n6Lll 3WzMSYLL6lCjOuK4vx/on51Cgsody91zJSb3l5H7B06E24udpdo7eBx8Q7uILAK3W9Dx husA== 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=Dvgcsfsg+exslaJEGkS1pZ6A+PHALDV2pGqujcWHtfg=; fh=QVFjA40o+fMJyX+uu0TcGgIjGzMpwVuCrzWsD3tYTiw=; b=BPBs6ii3NxUfDDtuP68DshS/Ov5I9HmSMWDcTZpBw53v6tdWqv3IMo9y2OgDj2ihXw E/GPFhKUuWbdU5CguK9Rh2oTO6ZIHa0su/VSPyGWgsm2FWRnVGGHhDEcqvm/VSOL/Fby iyOPU51j1QFx6jHIafweegNqQXAUnwcj+2diq+5E0v5+BJJyTSDeHhrpOJD0lx67Ri7x q5VW9I87m/VhWgBMyU7OpyccfQX5FzujMSX4ETm99mESEAqkq4Jb22VYTm/Hx2YdzOe1 PYpt8QVekkUgMKFMoW83fI5TCDgtA9ycbfi4Y3N7M+x1Gea0ImRluZlOsoKcCisQmUqQ Yy8A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IUg5VHhR; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88710-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88710-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s196-20020a6377cd000000b005db652f1ef0si3905650pgc.545.2024.03.01.08.36.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 08:36:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88710-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IUg5VHhR; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88710-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88710-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id ED4852812F1 for ; Fri, 1 Mar 2024 16:36:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5F8213D8E; Fri, 1 Mar 2024 16:35:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IUg5VHhR" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 866631FAB for ; Fri, 1 Mar 2024 16:35:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709310958; cv=none; b=B50LgnDbNJVMaKtvBDxUqG7NyKQCF5BgBKGxb6duOzShNxLAvRZhe+wN9Vutb3XwMOIi2+oHJmMu5Mul1BqCthUwP1cirKaA5uapaYM92OhA1TRcPFijx2i42Obg2Kae02RCkX3aTxsNAhagX095Z8x8DTIfUDQgTNkii7TEzNY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709310958; c=relaxed/simple; bh=UsRbkLa0yerir383cqzaT/O58UqKQZXBWw0CKzi2W7M=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=l4y39b3yrteD1B1Y4iWqyimITdiE3C5Z636ogaZ1kGy4rQJ2XNZJqwLcyGd7KaUnPd67jPxdnTUhtcRcNU34yl0u4V1AtB3KnPjbxjAYqa03jqoXBsr1pAhHH9mrljnxTVJSscDW0tQwN4dZCk9IoKghMav4qWpf02JrejmFJxQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IUg5VHhR; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F11F9C433A6 for ; Fri, 1 Mar 2024 16:35:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709310958; bh=UsRbkLa0yerir383cqzaT/O58UqKQZXBWw0CKzi2W7M=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=IUg5VHhR4FV4zYf7VWPubgDQr0DYoaijrNq8k51hoUv2BJaddrMsFdKp4/KQltSNm rNnHiJPbXvX4h1AalToO/exN/OWw0haQHT3s+r7vkgQLlOQE5BvkGLu76K6pjDWM6q 7EFTjeuFWkSyicydY0L1/AVqVBmMwn5DDVYvErxe0puiV3pmVJ/rnUBWijxqg4tAg1 Zt7jb3WTHnssNWHan+iIlMAtKuHy2B3qj/HokkXvwB7vXuCB4SpZCNa4ATjuOjiRNH pnaIe/wIqK9PA3sKkEty3PiP1By6c7QKSD3wHyDUWRz36kzcxs9ZgeVVbilEJbITaV MzwyYcDR6Eoug== Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-2d109e82bd0so25464801fa.3 for ; Fri, 01 Mar 2024 08:35:57 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXYSRUroT6zIS0mo1Q3fAitMT+rBM3eJQAFsY3QJeh/ZnfUYNehZo+w3+V9tu4tRxWbfYOoOuzv9l0svbY7y/96yh7tbX2UoEc2HLJf X-Gm-Message-State: AOJu0Yz/eGwvMdAOTpaiTkNKWgPoS0sj6C3pmseIxskYFN39HCzIMgIJ 4tJcCb15zXGcP+jcwVnEzPaLKOzv7ddrghiKAcS5UmwH5qxBzZnIXfQy5HYAxhOV9ikUTjmzaYy GH1ZJZR7J4x5lOltdx523ILsxM3k= X-Received: by 2002:a05:651c:3c2:b0:2d2:eb57:3ac8 with SMTP id f2-20020a05651c03c200b002d2eb573ac8mr1343322ljp.34.1709310956162; Fri, 01 Mar 2024 08:35:56 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240124103859.611372-1-ubizjak@gmail.com> <170929679278.398.4143931058196373559.tip-bot2@tip-bot2> <2fadcf62-e77d-49b4-b194-1cfa987d8709@citrix.com> In-Reply-To: <2fadcf62-e77d-49b4-b194-1cfa987d8709@citrix.com> From: Ard Biesheuvel Date: Fri, 1 Mar 2024 17:35:44 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [tip: x86/boot] x86/boot: Use 32-bit XOR to clear registers To: Andrew Cooper Cc: Uros Bizjak , linux-kernel@vger.kernel.org, Ingo Molnar , Andy Lutomirski , Brian Gerst , Denys Vlasenko , "H. Peter Anvin" , Linus Torvalds , Josh Poimboeuf , x86@kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 1 Mar 2024 at 17:02, Andrew Cooper wrot= e: > > On 01/03/2024 1:10 pm, Ard Biesheuvel wrote: > > On Fri, 1 Mar 2024 at 13:51, Uros Bizjak wrote: > >> On Fri, Mar 1, 2024 at 1:45=E2=80=AFPM Ard Biesheuvel wrote: > >>> On Fri, 1 Mar 2024 at 13:39, tip-bot2 for Uros Bizjak > >>> wrote: > >>>> The following commit has been merged into the x86/boot branch of tip= : > >>>> > >>>> Commit-ID: 721f791ce1cddfa5f2bf524ac14741bfa0f72697 > >>>> Gitweb: https://git.kernel.org/tip/721f791ce1cddfa5f2bf524ac1= 4741bfa0f72697 > >>>> Author: Uros Bizjak > >>>> AuthorDate: Wed, 24 Jan 2024 11:38:59 +01:00 > >>>> Committer: Ingo Molnar > >>>> CommitterDate: Fri, 01 Mar 2024 12:47:37 +01:00 > >>>> > >>>> x86/boot: Use 32-bit XOR to clear registers > >>>> > >>>> x86_64 zero extends 32-bit operations, so for 64-bit operands, > >>>> XORL r32,r32 is functionally equal to XORQ r64,r64, but avoids > >>>> a REX prefix byte when legacy registers are used. > >>>> > >>> ... and so this change is pointless churn when not using legacy > >>> registers, right? > >> Although there is no code size change with REX registers, it would > >> look weird to use XORQ with REX registers and XORL with legacy regs. > > You are changing an isolated occurrence of XORQ into XORL on the basis > > that XORQ 'looks weird', and would produce a longer opcode if the > > occurrence in question would be using a different register than it > > actually uses. > > > > Apologies for the bluntness, but in my book, this really falls firmly > > into the 'pointless churn' territory. The startup code is not > > performance critical, neither in terms of size nor in speed, and so > > I'd prefer to avoid these kinds of changes. Just my 2c, though - Ingo > > has already merged the patch. > > Without trying to get into an argument here... > No worries, we're all friends here :-) > The better reason is that Silvermont Atoms don't recognise the 64bit > form as a zeroing idiom. They only recognise the 32bit form of the idiom= . > > Therefore in fastpaths it is (marginally) important to xorl %r15d, %r15d > rather than xorq %r15, %r15. > > But this instance is not a fastpath, and it also doesn't save any > encoding space, so I'm not sure it was really worth changing. > Yeah, that is my point, really. But let's move on. And apologies to Uros for the tone - it didn't sound as grumpy in my head when I typed it as it does now reading back the thread.