From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::22d; helo=mail-wm0-x22d.google.com; envelope-from=roman.bacik@broadcom.com; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 25C8320957B00 for ; Thu, 3 May 2018 09:12:01 -0700 (PDT) Received: by mail-wm0-x22d.google.com with SMTP id w194so7245061wmf.2 for ; Thu, 03 May 2018 09:12:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:references:in-reply-to:mime-version:thread-index:date :message-id:subject:to:cc; bh=GGNMJPzM+gAxF1Rke6eozgSY72JMWr1yDyZ36fR4zGA=; b=OYk8pSZ2msCw7CtL7MQcuLygIW5bm/59XEwkX76rnxvawKbDNgwtS5qamLKQl6B42v 16K5EP/Rn+a3+6YBDJa/lO6MmYcT2AyFGg5vgbwoz8pfOXVrCasYP9c5sB5xefhMc/rU KBXo5N11CAlDK1T2rYcJrUHBZphayHFtaMHsQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:references:in-reply-to:mime-version :thread-index:date:message-id:subject:to:cc; bh=GGNMJPzM+gAxF1Rke6eozgSY72JMWr1yDyZ36fR4zGA=; b=AAYnEW0GKKCN+2Z2h6sS2o0kmR5B0Z/JoduM1NtTp0ZrG8LJyw0L8EsEwo6b9TyqKX uhRtEE8oRyhN+LM6d+jQW5sXIrn3nUERGJmYgaEUz0IjmHlAAARHUWE4iBdRKPnzBy2R R2cqf1CEcmxYdaAYdj2+Zi8gUpXHXQGiQdBCPLpwBU4ZWhHY0B8KVxdIJBgAa7NMuq4F F4yKMD5hwzhJKztK3jR3U1wnbIU55n50y93vyZmchsktuqCFxYcfB5vCKzLCG/gWOhay JJ2rvJY3ZKIpnlglZquLcZz7nyLDt/Q7qukOkT286TOJ/9ItQn9+bbbdGv5smFVnhpq5 t7bQ== X-Gm-Message-State: ALQs6tB74lfkIYnzc7M9EJKQOrWGBygWQhuVKDF7Q6jC+I28uO6+Ucrw QLqVVXwqmcRdYtAjzBFqxLizgLaJIRbct/n9XCsa7nZl X-Google-Smtp-Source: AB8JxZohGMbDZ0jXNJ1oPkHhbJ2LiBoD+SqkCAO+2HiEdmrkFHvfbswuFj2zU+O2yvV6tVsxTU2S9+MIG4d40ystcbk= X-Received: by 10.28.183.215 with SMTP id h206mr16332043wmf.2.1525363919829; Thu, 03 May 2018 09:11:59 -0700 (PDT) From: Roman Bacik References: <0C09AFA07DD0434D9E2A0C6AEB0483103BAE6C0D@shsmsx102.ccr.corp.intel.com> 902d4e396a11e3e72643e8a4ef64e5ac@mail.gmail.com In-Reply-To: 902d4e396a11e3e72643e8a4ef64e5ac@mail.gmail.com MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQKPIRkpdqnJqvYSzTgbyFfqUpHmYAJFLPUzopVtaYCAABi2wA== Date: Thu, 3 May 2018 09:11:58 -0700 Message-ID: <87ca4af94e7842d4b692635b2d6c3d58@mail.gmail.com> To: "Zeng, Star" , edk2-devel@lists.01.org Cc: "Ni, Ruiyu" , Vladimir Olovyannikov Subject: Re: [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2018 16:12:02 -0000 Content-Type: text/plain; charset="UTF-8" Hi Star, It turns out we can use EfiGcdAllocateAnySearchBottomUp instead of EfiGcdAllocateMaxAddressSearchBottomUp after few changes to our code. Thank you very much for clarification of our misunderstanding. We withdraw the patch and will close the associated bug ticket. Thanks, Roman > -----Original Message----- > From: Roman Bacik [mailto:roman.bacik@broadcom.com] > Sent: Thursday, May 3, 2018 7:47 AM > To: 'Zeng, Star'; 'edk2-devel@lists.01.org' > Cc: 'Ni, Ruiyu'; Vladimir Olovyannikov > Subject: RE: [edk2] [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd > > Hi Star, > > Thank you very much for your reply. Since the BaseAddress is the lowest > address in our case we thought this is a bug and the bottom up search starts > at BaseAddress and ends at BaseAddress+length-1. What would be the best > way to do a search starting from the BaseAddress as the lowest? Do we need > to add another search type? > Thanks, > > Roman > > -----Original Message----- > From: Zeng, Star [mailto:star.zeng@intel.com] > Sent: Wednesday, May 2, 2018 6:35 PM > To: Roman Bacik; edk2-devel@lists.01.org > Cc: Ni, Ruiyu; Vladimir Olovyannikov; Zeng, Star > Subject: RE: [edk2] [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd > > The GcdAllocateType are EfiGcdAllocateMaxAddress*, the MaxAddress > comes from input BaseAddress parameter. > > The original code logic is correct according to PI spec. > > PI Spec: > If GcdAllocateType is EfiGcdAllocateMaxAddressSearchBottomUp, then the > GCD memory space map is searched from the lowest address up to > BaseAddress looking for unallocated memory ranges of Length bytes > beginning on a boundary specified by Alignment that matches > GcdMemoryType. > If GcdAllocateType is EfiGcdAllocateMaxAddressSearchTopDown, then the > GCD memory space map is searched from BaseAddress down to the lowest > address looking for unallocated memory ranges of Length bytes beginning on > a boundary specified by Alignment that matches GcdMemoryType. > > > Thanks, > Star > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Roman Bacik > Sent: Thursday, May 3, 2018 2:01 AM > To: edk2-devel@lists.01.org > Cc: Ni, Ruiyu ; Vladimir Olovyannikov > > Subject: [edk2] [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd > > When BottomUp search is used the MaxAddress is incorrectly chosen to be > the BaseAddress instead of the EndAddress. > > Cc: Ruiyu Ni > Cc: Vladimir Olovyannikov > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Roman Bacik > --- > MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c > b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index > e17e98230b79..9eeb2bd74599 100644 > --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c > +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c > @@ -1170,8 +1170,8 @@ CoreAllocateSpace ( // // Compute the maximum > address to use in the search algorithm // > - if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchBottomUp || > - GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ) { > + if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown || > + GcdAllocateType == EfiGcdAllocateAnySearchTopDown ) { > MaxAddress = *BaseAddress; > } else { > MaxAddress = Entry->EndAddress; > -- > 1.9.1 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel