Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp506737imw; Wed, 13 Jul 2022 02:46:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v93P43h2kkDQiMBdd9XjdImhGRUrLuK69fELHn9aPQEPRMtoBbUPuQxDmEnpMMSLJN0w3S X-Received: by 2002:a05:6a00:23d2:b0:52a:e7b1:f9ab with SMTP id g18-20020a056a0023d200b0052ae7b1f9abmr2574093pfc.20.1657705578237; Wed, 13 Jul 2022 02:46:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657705578; cv=none; d=google.com; s=arc-20160816; b=Zkp60PDxdFAA30YcMxOwbPAwAsRWY79XZ/5+OlXWC8mkFt8paceq8nMcCyY+C/WdgE xrdattHAeT9dfVI/sLDrJXWJxmhFG+NFqrHXd9rs+fZHYH6Wj7W6yPp6VGQBxpUaZ3lH CmGJeToMYBqHZ/K+zHUbZ3vuyjYyLrsBlYtxq877MtogODr3oBCgcp2go+b9TDijdgca khBTCIgSyVvXJ+0xtdVKKdXCPZWhCy6SyUFzvK5fiJQAu4H7Iqk9pY3dta9LAdu8zUEj IQq+zYrzL1P/+ZiLAJ/tbQQVPpNeHLPBJ4BsDfZXY4jBeC/iipxKVt01XALcpJMedbcI +Rug== 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=xQ7N/fYLlysLbE4zdECWnWy27WreI9oEQxiTnGoMGOc=; b=Qe5ZCeYUiK9nIPo09CdAM5EmBQw0dpW6w/+3LoVTM9Zkv8Rmw0H2zsihXPlPXBM6uc ex6Iks1IfRMRwEhb8hc4dAzjFgzrW7t6scauFhHa6EvubKEnMjAuSntaT/ZIb5485+f3 ZplcC3mNh4o1H/u7mMV6YAHBLZDExqe05YW+9eVjKw8TMbAEwo2ej7T6zSaxlUp2G7ZO By64ILirdXVxN/FenYgLGfrIeKHtbTDtsmeX//MFUfx9Lap0LTS6IDZu01tMCrtcd3Y0 v3Gc9DFCJT7BxES/t1uQKBBCXjdxcJVPfgSh5kCdSnndkxVEWmoWU3kMHnPcAOBozOZ3 WZpg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x9-20020a634849000000b00415c8d8e482si16511994pgk.742.2022.07.13.02.46.06; Wed, 13 Jul 2022 02:46:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235519AbiGMJhN (ORCPT + 99 others); Wed, 13 Jul 2022 05:37:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236234AbiGMJhE (ORCPT ); Wed, 13 Jul 2022 05:37:04 -0400 Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CA6FF32D5; Wed, 13 Jul 2022 02:36:56 -0700 (PDT) Received: by mail-qt1-f171.google.com with SMTP id y3so11382795qtv.5; Wed, 13 Jul 2022 02:36:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xQ7N/fYLlysLbE4zdECWnWy27WreI9oEQxiTnGoMGOc=; b=HYys9IgnJCWNzM+6vk+2H14DanpEbL6+ZOHdTpD4Nq7XHO8Qefix1pCCvI1CXxzRxd MFyLQonCez/l/90P4l64znB9efd0dxbcP3yLNkgZrTdR8e/wUVPPemgyyOPfO7SYD9Fj /CJ+5Y2DM8uE6qEGMT62w6ST2bk1RXiL2wQwdJFhKi8JrmCglIEovmXv35NfuOMi03R5 JsHO6+4rS5vbuyuEgXFzSr8G3xk6JpzYhnSKsKbQNmat32yRpZMQdn8HttGiYGDNFQ5u iZlM3P8W5DRq/uTu1PuhHEpHiY76UFUtm+ybgbA7jml2pUAOCucCQ4+AMNhvDnLzOFD9 uAVQ== X-Gm-Message-State: AJIora+Yim3pUifcYfeckLa3ke7u5knohP5HPIMrOewM+20w7zMKNePJ X1cTOXwcHIyatnkHr4srx8bcHhXDV/QLLA== X-Received: by 2002:ac8:5c94:0:b0:31b:899:3063 with SMTP id r20-20020ac85c94000000b0031b08993063mr1988143qta.153.1657705014171; Wed, 13 Jul 2022 02:36:54 -0700 (PDT) Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com. [209.85.219.176]) by smtp.gmail.com with ESMTPSA id fp6-20020a05622a508600b0031eb0bb5c3csm7823150qtb.28.2022.07.13.02.36.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Jul 2022 02:36:53 -0700 (PDT) Received: by mail-yb1-f176.google.com with SMTP id g4so18314343ybg.9; Wed, 13 Jul 2022 02:36:53 -0700 (PDT) X-Received: by 2002:a05:6902:1246:b0:66e:ea31:8d05 with SMTP id t6-20020a056902124600b0066eea318d05mr2830637ybu.89.1657705013318; Wed, 13 Jul 2022 02:36:53 -0700 (PDT) MIME-Version: 1.0 References: <20210713075726.1232938-1-kai.heng.feng@canonical.com> <20210713125007.1260304-1-kai.heng.feng@canonical.com> <5331e942ff28bb191d62bb403b03ceb7d750856c.camel@sipsolutions.net> In-Reply-To: <5331e942ff28bb191d62bb403b03ceb7d750856c.camel@sipsolutions.net> From: Geert Uytterhoeven Date: Wed, 13 Jul 2022 11:36:41 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] PCI: Reinstate "PCI: Coalesce host bridge contiguous apertures" To: Johannes Berg Cc: Kai-Heng Feng , Bjorn Helgaas , Guenter Roeck , "open list:PCI SUBSYSTEM" , open list Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, 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 Johannes, On Wed, Nov 17, 2021 at 6:41 PM Johannes Berg wrote: > So this patch landed now ... :) > > > + /* Coalesce contiguous windows */ > > + resource_list_for_each_entry_safe(window, n, &resources) { > > + if (list_is_last(&window->node, &resources)) > > + break; > > + > > + next = list_next_entry(window, node); > > + offset = window->offset; > > + res = window->res; > > + next_offset = next->offset; > > + next_res = next->res; > > + > > + if (res->flags != next_res->flags || offset != next_offset) > > + continue; > > + > > + if (res->end + 1 == next_res->start) { > > + next_res->start = res->start; > > + res->flags = res->start = res->end = 0; > > + } > > + } > > > > Maybe this was already a problem before - but I had a stupid thing in > arch/um/drivers/virt-pci.c (busn_resource has start == end == 0), and > your changes here caused that resource to be dropped off the list. > > Now this wouldn't be a problem, but we add it using pci_add_resource() > and then that does a memory allocation, but you don't free it here? I'm > not sure it'd even be safe to free it here and I'll just set > busn_resource to have end==1 instead (it's all kind of virtual). > > But I still wanted to ask if this might be a problem here for others. Yes it is. I've sent a fix https://lore.kernel.org/r/9c41a4372b27420c732ff5599d823e363de00c6d.1657704829.git.geert+renesas@glider.be Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds