Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp541171imm; Fri, 31 Aug 2018 07:04:55 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZhHqIjZky867djnVyus04cjWGc6kIDXS77ht+lr/8s2+SYefJmvN42xW/Myj4yQOdW1TNk X-Received: by 2002:a17:902:9302:: with SMTP id bc2-v6mr15891396plb.280.1535724295425; Fri, 31 Aug 2018 07:04:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535724295; cv=none; d=google.com; s=arc-20160816; b=iKpwOpY6JU3AW9HcRyHfZ3ehoK8g6Wmzzz1tmiU/mknYNDreCsc4J7ViwXwwXsjbKQ fRO1lDw6osVPWj17ylSJUUSWfG6AOHLh4WTlGlpBvc8pmIBeaJsV3s8Q5Vm6YrtPMDCg c8P/fPrexCyjVJzW4FS8/GYsLKMazN779xyH2pJ7BF1qP+Jsjwtb6lcxmQ/RqOpDERr4 Mw7S6FN0OGqjbs5r/5UtBinKyL4MpajE+hSxAyf2/UD+k2uoUSUY7XKlsOIWxD5dScf0 Zu+3PfmXFJdw/qzD+udd0pnV5/51VJehntILCAHmDWgcun9DKeX5YKDolf2yiB9xbZ3d MV0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=rVNC5UvQwHDq176lihbrP2wr5Zx0dquZM1RD84JXpz8=; b=LjmUXZyOnr/qITqDisVcx9QvcGGfCIPcWQWOZ5W+YotT4vmI9a3cCtMFPeMtLCm2l0 +SxIKVMa35jgW+OmxHxP6VWNprEDDDZ77vkjhFz/YG5rgcwI3wX5ajikg3FQDn/DpA6h dQXvec1sla2blGCGxYKuzCR/39NDbe9m1z4Gl6Dw3ChHL9FfIbledhHIQ+sxZ0MVEsdA PPbafAnHrNmNsYyNQFYlxQFRG/s6V9q/uioqU3fBRpSNHQfGY0LYdLYkk7yNpslC85UL yk9lS04YShJCOjrGYK4sJy/24G2r2FFSvr4IAXh/TgQns5MDvG+bzx5jo5u0990MQhUJ apuw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w14-v6si10391272pgc.527.2018.08.31.07.04.40; Fri, 31 Aug 2018 07:04:55 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727681AbeHaR7X (ORCPT + 99 others); Fri, 31 Aug 2018 13:59:23 -0400 Received: from mga04.intel.com ([192.55.52.120]:19895 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727344AbeHaR7X (ORCPT ); Fri, 31 Aug 2018 13:59:23 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Aug 2018 06:51:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,311,1531810800"; d="scan'208";a="69607600" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.157]) by orsmga008.jf.intel.com with SMTP; 31 Aug 2018 06:51:36 -0700 Received: by lahna (sSMTP sendmail emulation); Fri, 31 Aug 2018 16:51:35 +0300 Date: Fri, 31 Aug 2018 16:51:35 +0300 From: Mika Westerberg To: Jon Derrick Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Lorenzo Pieralisi , Keith Busch , Greg Kroah-Hartman , Sinan Kaya , Christoph Hellwig , Matthew Wilcox , Logan Gunthorpe , Stephen Bates Subject: Re: [PATCH v2] PCI: Equalize hotplug memory for non/occupied slots Message-ID: <20180831135135.GO2283@lahna.fi.intel.com> References: <1535667120-3002-1-git-send-email-jonathan.derrick@intel.com> <1535667120-3002-2-git-send-email-jonathan.derrick@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1535667120-3002-2-git-send-email-jonathan.derrick@intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 30, 2018 at 04:12:00PM -0600, Jon Derrick wrote: > Currently, a hotplug bridge will be given hpmemsize additional memory if > available, in order to satisfy any future hotplug allocation > requirements. > > These calculations don't consider the current memory size of the hotplug > bridge/slot, so hotplug bridges/slots which have downstream devices will > get their current allocation in addition to the hpmemsize value. > > This makes for possibly undesirable results with a mix of unoccupied and > occupied slots (ex, with hpmemsize=2M): > > 02:03.0 PCI bridge: <-- Occupied > Memory behind bridge: d6200000-d64fffff [size=3M] > 02:04.0 PCI bridge: <-- Unoccupied > Memory behind bridge: d6500000-d66fffff [size=2M] > > This change considers the current allocation size when using the > hpmemsize parameter to make the reservations predictable for the mix of > unoccupied and occupied slots: > > 02:03.0 PCI bridge: <-- Occupied > Memory behind bridge: d6200000-d63fffff [size=2M] > 02:04.0 PCI bridge: <-- Unoccupied > Memory behind bridge: d6400000-d65fffff [size=2M] > > The calculation for IO (hpiosize) should be similar, but platform > firmwares I've encountered (including QEMU) provide strict allocations > for IO and would not provide free IO resources for hotplug buses > in order to prove this calculation. > > Signed-off-by: Jon Derrick Reviewed-by: Mika Westerberg