From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 738E0C433F5 for ; Thu, 14 Apr 2022 16:12:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231377AbiDNQOn (ORCPT ); Thu, 14 Apr 2022 12:14:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347634AbiDNQKM (ORCPT ); Thu, 14 Apr 2022 12:10:12 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4AC54B429; Thu, 14 Apr 2022 08:55:19 -0700 (PDT) Received: from zn.tnic (p2e55d808.dip0.t-ipconnect.de [46.85.216.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 759C11EC05DE; Thu, 14 Apr 2022 17:55:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1649951713; 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:in-reply-to:in-reply-to: references:references; bh=BnxseTuJTt1+13p8Bbf/z4p5KH4GXzkEM2LCA1Q+mSA=; b=ixFitl7wM62yP+tsOhRPxZgD1GGIJbFmMnv4ijIg0DwOt7uNBbOiVF/p3MS/LJIVEGBucc 4pk4WW3iNkwnJkqFQRuoBJCBSvipRW7EeUgE0xnTA+AkwB6Djac1YLUlxLGZVj/8HRPOrC lZInPgtYZWtEqj2EdCfyVGijnb0AN+U= Date: Thu, 14 Apr 2022 17:55:13 +0200 From: Borislav Petkov To: Dave Hansen Cc: "Kirill A. Shutemov" , Andy Lutomirski , Sean Christopherson , Andrew Morton , Joerg Roedel , Ard Biesheuvel , Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Varad Gautam , Dario Faggioli , Brijesh Singh , Mike Rapoport , David Hildenbrand , x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv4 3/8] efi/x86: Implement support for unaccepted memory Message-ID: References: <20220405234343.74045-1-kirill.shutemov@linux.intel.com> <20220405234343.74045-4-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 08, 2022 at 10:26:14AM -0700, Dave Hansen wrote: > > + /* > > + * Accept small regions that might not be able to be represented > > + * in the bitmap: > > + */ > > + if (end - start < 2 * PMD_SIZE) { > > + __accept_memory(start, end); > > + return; > > + } > > This is not my first time looking at this code and I still had to think > about this a bit. That's not good. That pathological case here is > actually something like this: > > | 4k | 2044k + 2044k | 4k | > ^ 0x0 ^ 2MB ^ 4MB > > Where we have a 2MB-aligned 4k accepted area, a 4088k unaccepted area, > then another 4k accepted area. That will not result in any bits being > set in the accepted memory bitmap because no 2MB region is fully accepted. I could use that ascii art very well in a comment above it instead of having to paint it in my mind each time. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette