Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6020615pxb; Mon, 14 Feb 2022 13:18:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJxCsSXsOL1I/EPFIVEFJkN9gfwnMgch4YOWfz2g1tPkExvImhPG+tnkWH0T+LfxgftU+m9U X-Received: by 2002:a05:6a00:1914:: with SMTP id y20mr794144pfi.39.1644873502780; Mon, 14 Feb 2022 13:18:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644873502; cv=none; d=google.com; s=arc-20160816; b=p+pcbhqBhVx5XeYEznpdTP9Q7LNkj93ckErhmSqQyeZ/W7+Q6b7XMasZQNLq/LZdgH 44Fyjka2baJv7KrKXVwHEGsGnMBqDawNCmFfs1S39v9BtRi0DEQV9otvq1KcnOPtl97z nbsmhN/S+LB76Br7mnRYB4uAbSBCWsqULr7Ptdmb/5L8YivrpPc2TAGiD3F66FxVTO5y iGzZKmAfM1NmYa/2gaPhZi0BsDRn4+PMPVI/n+AhiexnELqLGmAXhtt8pRuJfzsM+tKJ N/opH78V7R6nhj6zvDt3qTqCaKZum4REfI5C0yVk5Rmy1iYRgApRlaDX2upjOg75t7f1 5Htg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=X1Jpjwwox5k5370KtI4j1QtTVVVbkixYWe+bK2EarXk=; b=fncKZvBKco4aikZ6WPVwure6dQA2Vg7/AB8QmvnFAhxufnBSqzG2Pj3fCnPPKEQcCY OmXCsa7V4WEIpdEu7pETjdD/TRgERqu34wmojq0Ts8KMW0zHfog113EwmiE1XMLu3USh +yEqSXJrFeYhZbzXaXkNKXvqBVv1znF5IwfmH5S/KS7Gt4RrpbQBdub3gffLXtL2j/+m zQogy0d9gAXEeWpvugodb0hsvOdPMqJvQiRH0+/5IDDotQXHVMbmDy5aMPdaATOQ+Hid FO4ixFn95ffdz2vZG5ya8L+JjormH0dRYCskR2x3hj7q2Lucb1nDKtVIugKn1rRMqWGd y3eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EyamBed5; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id n17si14039946plg.613.2022.02.14.13.18.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 13:18:22 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EyamBed5; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4DD4211629F; Mon, 14 Feb 2022 12:36:12 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353306AbiBNMmo (ORCPT + 99 others); Mon, 14 Feb 2022 07:42:44 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:37148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234721AbiBNMmm (ORCPT ); Mon, 14 Feb 2022 07:42:42 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7A44349279 for ; Mon, 14 Feb 2022 04:42:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644842553; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X1Jpjwwox5k5370KtI4j1QtTVVVbkixYWe+bK2EarXk=; b=EyamBed5oWg3TvufrkDnZPUJb7lweEi4Xn4FXJPwMFEnF/0wIAywFoCTxAXKcB5lfeIz0h Epd11zxQ0i2ilzmobZDbz1aRSP+zpLieL21zV6xYgtMtFOb/mdD7tB9QBug/+TrvkRkwhc t/0ds+Oj54pHK50VZf1Xp9M4r1hOxno= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-251-nWFaa9fIN06n_jXoP-_3aQ-1; Mon, 14 Feb 2022 07:42:32 -0500 X-MC-Unique: nWFaa9fIN06n_jXoP-_3aQ-1 Received: by mail-ed1-f72.google.com with SMTP id d11-20020a50c88b000000b00410ba7a14acso1517915edh.6 for ; Mon, 14 Feb 2022 04:42:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=X1Jpjwwox5k5370KtI4j1QtTVVVbkixYWe+bK2EarXk=; b=qiShP55mTgDWDoyxUg1kgvRu04dL98CIHBZhVWF/8eP8gBkTUBNwo9Catu8NPJsYa6 j1I2MCZjOAHVkvs3MmeLaZg9e2AADf0hmMwnu0c2cq4XwESnDPOpPJS4hvhTPv9PAloF +Z76iXkmFFiZ9iJd1oQ6zsp9vfU7CVppPzPDzy2o1doQPHnr7pHvrkzxedhvGW3aPYoj 1NahhtRqRjVvZCN+vM6KWgAJXW6/sQ6dM00g8bBYl5NBt/9sbWNJ3LPIWCoFVQnSuye4 THpAb1dDdoBNo2Ln+V9SYQq8ZbmaT8kaGs1ym50ZgS1yBoFwGw7K0TWkQkAicg8wqaBT aEVw== X-Gm-Message-State: AOAM531fMwujTSaqtwAgAgHbCFeJ3AU7taMQURF/RtwupzTeMpTiKFQr MLCsPG+gLwd3fpS4PWBBVWOiRmbmRs5EdDIIbl3vOTzskxWSe5rKWRxPdTrRfxN292IcV0GbTFd Mv58oQZWQ6+Yhudg3ddgefpzO X-Received: by 2002:aa7:c50c:: with SMTP id o12mr724066edq.371.1644842551360; Mon, 14 Feb 2022 04:42:31 -0800 (PST) X-Received: by 2002:aa7:c50c:: with SMTP id o12mr724052edq.371.1644842551154; Mon, 14 Feb 2022 04:42:31 -0800 (PST) Received: from [10.40.98.142] ([78.108.130.194]) by smtp.gmail.com with ESMTPSA id 29sm6336686ejk.147.2022.02.14.04.42.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Feb 2022 04:42:30 -0800 (PST) Message-ID: <039f9e8d-6e29-0288-606a-1d298e026c97@redhat.com> Date: Mon, 14 Feb 2022 13:42:29 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [5.17 regression] "x86/PCI: Ignore E820 reservations for bridge windows on newer systems" breaks suspend/resume Content-Language: en-US To: Mika Westerberg Cc: "Rafael J. Wysocki" , Bjorn Helgaas , =?UTF-8?Q?Krzysztof_Wilczy=c5=84ski?= , Myron Stowe , Juha-Pekka Heikkila , Ingo Molnar , Borislav Petkov , linux-acpi , Linux PCI , x86@kernel.org, Linux Kernel Mailing List , =?UTF-8?Q?Benoit_Gr=c3=a9goire?= , Hui Wang References: <697aaf96-ec60-4e11-b011-0e4151e714d7@redhat.com> <02994528-aaad-5259-1774-19aeacdd18fc@redhat.com> <2f01e99d-e830-d03c-3a9d-30b95726cc2c@redhat.com> From: Hans de Goede In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 2/10/22 07:39, Mika Westerberg wrote: > Hi Hans, > > On Wed, Feb 09, 2022 at 05:08:13PM +0100, Hans de Goede wrote: >> As mentioned in my email from 10 seconds ago I think a better simpler >> fix would be to just do: >> >> diff --git a/arch/x86/kernel/resource.c b/arch/x86/kernel/resource.c >> index 9b9fb7882c20..18656f823764 100644 >> --- a/arch/x86/kernel/resource.c >> +++ b/arch/x86/kernel/resource.c >> @@ -28,6 +28,10 @@ static void remove_e820_regions(struct resource *avail) >> int i; >> struct e820_entry *entry; >> >> + /* Only remove E820 reservations on classic BIOS boot */ >> + if (efi_enabled(EFI_MEMMAP)) >> + return; >> + >> for (i = 0; i < e820_table->nr_entries; i++) { >> entry = &e820_table->entries[i]; >> >> >> I'm curious what you think of that? > > I'm not an expert in this e820 stuff but this one looks really simple > and makes sense to me. So definitely should go with it assuming there > are no objections from the x86 maintainers. Unfortunately with this suspend/resume is still broken on the ThinkPad X1 carbon gen 2 of the reporter reporting the regression. The reporter has been kind enough to also test in EFI mode (at my request) and then the problem is back again with this patch. So just differentiating between EFI / non EFI mode is not an option. FYI, here is what I believe is the root-cause of the issue on the ThinkPad X1 carbon gen 2: The E820 reservations table has the following in both BIOS and EFI boot modes: [ 0.000000] BIOS-e820: [mem 0x00000000dceff000-0x00000000dfa0ffff] reserved Which has a small overlap with: [ 0.884684] pci_bus 0000:00: root bus resource [mem 0xdfa00000-0xfebfffff window] This leads to the following difference in assignments of PCI resources when honoring E820 reservations [ 0.966573] pci 0000:00:1c.0: BAR 14: assigned [mem 0xdfb00000-0xdfcfffff] [ 0.966698] pci_bus 0000:02: resource 1 [mem 0xdfb00000-0xdfcfffff] vs the following when ignoring E820 reservations: [ 0.966850] pci 0000:00:1c.0: BAR 14: assigned [mem 0xdfa00000-0xdfbfffff] [ 0.966973] pci_bus 0000:02: resource 1 [mem 0xdfa00000-0xdfbfffff] And the overlap of 0xdfa00000-0xdfa0ffff from the e820 reservations seems to be what is causing the suspend/resume issue. ### As already somewhat discussed, I'll go and prepare this solution instead: 1. Add E820_TYPE_MMIO to enum e820_type and modify the 2 places which check for type == reserved to treat this as reserved too, so as to not have any functional changes there 2. Modify the code building e820 tables from the EFI memmap to use E820_TYPE_MMIO for MMIO EFI memmap entries. 3. Modify arch/x86/kernel/resource.c: remove_e820_regions() to skip e820 table entries with a type of E820_TYPE_MMIO, this would actually be a functional change and should fix the issues we are trying to fix. Regards, Hans