Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6882018ybl; Wed, 15 Jan 2020 11:44:16 -0800 (PST) X-Google-Smtp-Source: APXvYqyKhlz7rOhq5oJjrWCnIv9l+ST6hYr+QJELgPUryTuQwF96qSbwfjUgVMAo6W2TOnIFqRXI X-Received: by 2002:a9d:6314:: with SMTP id q20mr3959416otk.3.1579117456238; Wed, 15 Jan 2020 11:44:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579117456; cv=none; d=google.com; s=arc-20160816; b=kB/Y8uIsFMkoLh9xfqiI94PcUI8NefWpKIClAl+y1M6g6xY/Ev2Qqr8mqaKFMXATF+ W/ho5bKjccSf4BCfQCXvhk5uSjVaXPaL08UXa6E6ezcEPt9Xzk2X1JLwuYmO+W33ePu4 8eCYwN/ZGHhJPB1xCuF1WGnkanbX5WZU+px9fcL0KwlMLocQ5Rly1NpjTfrdMVSD87xw s+VOsAWpeL+Zh5bQt9gKXYyJUaHhZ3tC7F/JXU+THmBOXSTJPsCF++wscP5a8T0FOUnT meb12P2asN5UqnbdNzOvZ8LapUzDLhuNbxkVx1XvjIvyv9d1Xb2XetvE2DEjSXKHHSRj bQHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=IaRwIBTidRg+FeQMjaWJXF4LpWPIm2ptNeGHjO7tn9s=; b=bmO8/qqwrjEzfrA9BaFjukivTcuwsj0/RXUBh3Y6qL8NtRnkCYoDS5/uAkEHfA0Wdq j2mfyKwfs1+R2nBfvUdBV4+npJUEMPBR8KBPz6PYHYDXqZViBGZJn6Zvko1+jlV4uMAN 5xX8ct9r6WBOh0QmrKAwyFfvQFEl8Q/vTjxLajnbhJDdFwK9oftwhI1K2D0lJa98kzwS TkfW/4v08qyZuNB6uwZ/PjI7xL7lirLMdklVoBVFYF8046306oiy1tO3x4a2NhaL8KoE /voOHVWiC6S0ojPViSuavkynDBKo45bkR+GC9HMY2i3OjqxvxjKWbP/eNryjDRFPnPW7 GjiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="Jws/Fhg/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g18si1727296otp.61.2020.01.15.11.44.03; Wed, 15 Jan 2020 11:44:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="Jws/Fhg/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729126AbgAOTmG (ORCPT + 99 others); Wed, 15 Jan 2020 14:42:06 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:40319 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbgAOTmF (ORCPT ); Wed, 15 Jan 2020 14:42:05 -0500 Received: by mail-lf1-f65.google.com with SMTP id i23so13644365lfo.7 for ; Wed, 15 Jan 2020 11:42:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IaRwIBTidRg+FeQMjaWJXF4LpWPIm2ptNeGHjO7tn9s=; b=Jws/Fhg/9IKJk9+nS1RTqQGl/D/R2qUDHpS3GKFKtCU0aMrpgYvxxwk+s7k/EB3PQG PvYHuYbuMYFbFlZxmS9QO1Dbd5gN7atnObLK9kI8sUR0ADxQryVnxUBd63vqDyd6qx16 WmkdXjfC8d3E/yNKayDZNJMSD7y4f95VjoUt4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IaRwIBTidRg+FeQMjaWJXF4LpWPIm2ptNeGHjO7tn9s=; b=RY2nHvgStPUyxRAUE0qHTjihr7cNXQuvYtppYbtlUpJuMbNYtA0fbvExdl9j2mk4IJ m+TQphNy0yi0i8w5srNwzynDCoN2dFKSxSNMwvC59UD7KS29r3gu+E8xB5rfVpjrptaW cJPJUQs4PuBxeKOrTbuQK7xC+kz6yTAJxIE9klRdT4zMeLO2P69tnt1MBwHd5+bgfL6d jy6SXL0sitrtPD+6lqNHGvRI8cSiQ/faWf0B1YfFMmqrF2gmgCThksuDGZS3Pash8ZVG EFxRvfNZJ27H44An+dRgHrcgpKwesUDPMLMp/A4rb5A+txqGR8Y6m30e9H9gHR1ZvVcV vMBQ== X-Gm-Message-State: APjAAAVhN8uIPNqRjgIaUKtGGIVvsHYdeVWLSRM8yuTZOfOuZxeCSI7H NVO46VDHmyIPxuUtak33WNSjp0ybrPI= X-Received: by 2002:a19:850a:: with SMTP id h10mr294477lfd.89.1579117323356; Wed, 15 Jan 2020 11:42:03 -0800 (PST) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com. [209.85.167.54]) by smtp.gmail.com with ESMTPSA id r9sm10881680lfc.72.2020.01.15.11.42.02 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Jan 2020 11:42:02 -0800 (PST) Received: by mail-lf1-f54.google.com with SMTP id 9so13663233lfq.10 for ; Wed, 15 Jan 2020 11:42:02 -0800 (PST) X-Received: by 2002:a19:22cc:: with SMTP id i195mr314766lfi.148.1579117322138; Wed, 15 Jan 2020 11:42:02 -0800 (PST) MIME-Version: 1.0 References: <20200113154739.GB11244@42.do-not-panic.com> <20200115021545.GD11244@42.do-not-panic.com> <20200115185812.GH11244@42.do-not-panic.com> In-Reply-To: <20200115185812.GH11244@42.do-not-panic.com> From: Linus Torvalds Date: Wed, 15 Jan 2020 11:41:46 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Fix built-in early-load Intel microcode alignment To: Luis Chamberlain Cc: Jari Ruusu , Borislav Petkov , Fenghua Yu , johannes.berg@intel.com, Linux Kernel Mailing List , stable , Hans de Goede , Andy Lutomirski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 15, 2020 at 10:58 AM Luis Chamberlain wrote: > > But *how? Why is there a 50/50 chance of it being aligned to > 16 bytes if 8 bytes are currently specified? What? It's trivial. Address 256 is 4-byte aligned. But it's also 8-byte aligned. And 16-byte aligned. And.. So if you ask for 8-byte alignment, and you already had that address (or were just below it), you'll get 8-byte alignment. But it will _also_ be 16-byte aligned just by happenstance. And yes, exactly half of the addresses that are 8-byte aligned are also 16-byte aligned, so you have a 50/50 chance of getting the bigger alignment simply by random chance. In fact, often you probably have a _better_ than 50/50 chance of getting the bigger alignment, since many other things are aligned too, and the starting address likely isn't very random. So it might have started out with a bigger alignment even before you asked for just 8-byte aligned data from the linker. (Of course, the reverse may be true too - there may be cases you were coimpletely mis-aligned, and asking for 8-byte alignment will never give you any more aligned memory, but I suspect aligned data is a lot more common than unaligned data is) Linus