Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp293921pxb; Wed, 14 Apr 2021 15:52:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUJiSUuIz0s/iGewpYl/IxgJG5BbAHxzAmhiIWc5j9I8KuR312dPBHyNxN0VuXgW8rLluq X-Received: by 2002:a63:1125:: with SMTP id g37mr590466pgl.56.1618440742565; Wed, 14 Apr 2021 15:52:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618440742; cv=none; d=google.com; s=arc-20160816; b=Jb8vSUf41kbt41kxSmMIDi9AShDFUs4OjKMOY5w35jdKRnQMXZfv8MdbeL9P9h4XEn LeKjG5vxKi/QEyjcHU9G4KzzF52fPEe3veCfRRpVqKitQNCuNHO+qBsiaRyG6qIyZwg3 pZZRQNYSE3ChKYjqJkcjPu19lUEXOAIifIXnz94I9AXpDBIEUnT3FBnD9FeYgkLFXGum YdjVbSiDHxmozQjgg2w4aCxpmXMfygK7p/RcRUrCN2ny0GEsVlb+OMBmRbK1CSM84ZSl TfjI1CDe27vGG0pw5xbW82byR35kxhurQJMYK9Jtbmfu+0GABso/D/es6x2smeuN479L TFdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=6d/FuuxybGA+l39RRGwCNBN7zcndhrQwzJhiqm3MB4U=; b=Q5KdNg7D7204U/uegdbaOSsz/KhzJ5s2JXX4tggER41FxJy8mvggvK7jtFehbB5JPx AgJ3RL4FFo85AR76NLTexzyoaNTFUPq4se7WVvYvsPp2ZiMSEmjiwlZeXg2MduvdbNWg B9U+/vPWQTBklaFvuXsf/9zuz1o7rtnuq+lQJUuxN1mVXmYwc8Tv0jZulnAkCqB/5z9E XjGwB1ZIToU4boZT50EvKcAYrgytCg4hO0f/QvWbajJfC7FaWJswZwhPPKv+e7pR7nUr ZZbhfgEIxFY9mx9vi55/u37JShmQXs6DjDCX7439IDwUQCdgK7r9H+hXe1U0Cy7KXzEY zeug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g13si952273pgo.287.2021.04.14.15.52.10; Wed, 14 Apr 2021 15:52:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233860AbhDNKte (ORCPT + 99 others); Wed, 14 Apr 2021 06:49:34 -0400 Received: from mail-oo1-f49.google.com ([209.85.161.49]:40816 "EHLO mail-oo1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233890AbhDNKtZ (ORCPT ); Wed, 14 Apr 2021 06:49:25 -0400 Received: by mail-oo1-f49.google.com with SMTP id v21-20020a4ae0550000b02901e6970ea355so410950oos.7; Wed, 14 Apr 2021 03:49:04 -0700 (PDT) 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=6d/FuuxybGA+l39RRGwCNBN7zcndhrQwzJhiqm3MB4U=; b=h3VBrqCppbzBjATV9RqXps3D1LGKBiHB6zQEDCjvskd6EY2JOB0xpfm7rvnNpD297N 4B5IsKxmNpxsMOiDjhl21wz0TkXDB6kdPivKJ1V5XlVmdXOZJ5nDsNYvLFPZq1ECEE19 oakxqnoZbKjvqhw3qypLJCUIQX45fO9OD8iGXC7eFn0tTxaoK/KlAtwnxTq+f2/oU64F Tposu8/FooGYj+J7wbIEMnjRb++rBBkzmnQmnl6i7ZModHpx7bnzWa0IcoQsUuyMrxsc Scisu6VmH2d+HcpojUy3ZmWRDdrmgIu6g/jn9axUde+eIjsi062znyZ6nZgDNghgqhT1 oDhg== X-Gm-Message-State: AOAM532n6zXNphjrgnrMkR/rsR1n0P37Zb5pb+GVJ60qqnfNJyKAju0V PZSbzD7v4kQCnjHxVN2Pa66S3EBJq5N8dvdZVos= X-Received: by 2002:a4a:d48b:: with SMTP id o11mr30553600oos.2.1618397335486; Wed, 14 Apr 2021 03:48:55 -0700 (PDT) MIME-Version: 1.0 References: <11752259.O9o76ZdvQC@kreacher> <5cfba81b-fe73-b604-2442-011deee9bcb3@redhat.com> In-Reply-To: From: "Rafael J. Wysocki" Date: Wed, 14 Apr 2021 12:48:43 +0200 Message-ID: Subject: Re: [PATCH] ACPI: x86: Call acpi_boot_table_init() after acpi_table_upgrade() To: Mike Rapoport Cc: David Hildenbrand , "Rafael J. Wysocki" , "Rafael J. Wysocki" , Linux ACPI , George Kennedy , LKML , x86 Maintainers , Hans de Goede Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 14, 2021 at 10:13 AM Mike Rapoport wrote: > > On Wed, Apr 14, 2021 at 09:42:01AM +0200, David Hildenbrand wrote: > > On 13.04.21 19:53, Rafael J. Wysocki wrote: > > > On Tue, Apr 13, 2021 at 7:43 PM David Hildenbrand wrote: > > > > > > > > On 13.04.21 16:01, Rafael J. Wysocki wrote: > > > > > From: Rafael J. Wysocki > > > > > > > > > > Commit 1a1c130ab757 ("ACPI: tables: x86: Reserve memory occupied by > > > > > ACPI tables") attempted to address an issue with reserving the memory > > > > > occupied by ACPI tables, but it broke the initrd-based table override > > > > > mechanism relied on by multiple users. > > > > > > > > > > To restore the initrd-based ACPI table override functionality, move > > > > > the acpi_boot_table_init() invocation in setup_arch() on x86 after > > > > > the acpi_table_upgrade() one. > > > > > > > > > > Fixes: 1a1c130ab757 ("ACPI: tables: x86: Reserve memory occupied by ACPI tables") > > > > > Reported-by: Hans de Goede > > > > > Tested-by: Hans de Goede > > > > > Signed-off-by: Rafael J. Wysocki > > > > > --- > > > > > > > > > > George, can you please check if this reintroduces the issue addressed by > > > > > the above commit for you? > > > > > > > > > > --- > > > > > arch/x86/kernel/setup.c | 5 ++--- > > > > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > > > > > > > Index: linux-pm/arch/x86/kernel/setup.c > > > > > =================================================================== > > > > > --- linux-pm.orig/arch/x86/kernel/setup.c > > > > > +++ linux-pm/arch/x86/kernel/setup.c > > > > > @@ -1045,9 +1045,6 @@ void __init setup_arch(char **cmdline_p) > > > > > > > > > > cleanup_highmap(); > > > > > > > > > > - /* Look for ACPI tables and reserve memory occupied by them. */ > > > > > - acpi_boot_table_init(); > > > > > - > > > > > memblock_set_current_limit(ISA_END_ADDRESS); > > > > > e820__memblock_setup(); > > > > > > > > > > @@ -1132,6 +1129,8 @@ void __init setup_arch(char **cmdline_p) > > > > > reserve_initrd(); > > > > > > > > > > acpi_table_upgrade(); > > > > > + /* Look for ACPI tables and reserve memory occupied by them. */ > > > > > + acpi_boot_table_init(); > > > > > > > > > > vsmp_init(); > > > > > > > > This is fairly late; especially, it's after actual allocations -- see > > > > e820__memblock_alloc_reserved_mpc_new(). > > > > > > > > Can't the table upgrade mechanism fix up when adjusting something? > > > > > > Not at this point of the cycle I'm afraid. > > > > > > > Some details on what actually breaks would be helpful. > > > > > > Generally speaking, the table overrides that come from the initrd are > > > not taken into account if acpi_boot_table_init() runs before > > > acpi_table_upgrade() and the latter cannot run before > > > reserve_initrd(). > > > > I see. (looking at Documentation/acpi/initrd_table_override.txt I understand > > what acpi table overrides are for :) ) > > > > > > > > Honestly, I'm not sure how much effort it would take to untangle this ATM. > > > > Also true; ideally, we wouldn't have any allocations (find+reserve) before > > ordinary reservations are done. > > > > However, I have no idea if we can move > > e820__memblock_alloc_reserved_mpc_new() and reserve_real_mode() around > > easily. Also, reserve_initrd()->relocate_initrd() does allocations. > > Even if we can move e820__memblock_alloc_reserved_mpc_new() and > reserve_real_mode(), the allocation in reserve_initrd() has to be before > the tables override, we would only reduce the probability of allocating an > ACPI page. > > I think what we can do is to override the ACPI tables separately from their > initial parsing. Rafael, what do you say? Well, possibly. With one caveat that parsing a table that's going to be overridden subsequently may not be a good idea. Anyway, things like that can only be done in the next cycle or later.