From patchwork Sat Feb 18 00:28:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Houghton X-Patchwork-Id: 58852 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp147399wrn; Fri, 17 Feb 2023 16:46:15 -0800 (PST) X-Google-Smtp-Source: AK7set+jar8wSBACGxBZ1rdB9ujrp4hMNfBoUhEMbL9hNaqDPN6R5CWMZv0WeKFXb05Pb1gpdCAN X-Received: by 2002:a17:902:f682:b0:19c:1433:5fba with SMTP id l2-20020a170902f68200b0019c14335fbamr5206990plg.0.1676681175367; Fri, 17 Feb 2023 16:46:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676681175; cv=none; d=google.com; s=arc-20160816; b=eyB2L9310wjhDG8UkGtEgMNewg/gpEiyvvmWGaAitzYmthOns4jcI5Mjx51oWGQ54K eRsCR3LdOxpShpnEDQtjyMTw6zjcqXIEMHD438/K0RQhGo1RwMNPlWctt6l+/x0FkfRS PT/g8lciLABMEoalLKLcTkjLey9ul5lLJj1btdr7GhRyXT25JDK7dTnxsM/Y0LVVLweX 1Fo34m7l27EXXfm+MyeLxIdeGg6jtL/8s90HDoFS4QmWyDsjU6mDRfnA9uQCaUshxD/Z TGVtyjCORx9n6vvalA5ZMuDM9gx/Jnb7a/3sWETiKhF5+bsZtyvy2LpxdxSeI3j9sVxa 0dVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=YyhF10hcbQMtiIcRNPe2j9wgCL3nu0mYgfomzauIh1M=; b=FHH12/a04stID5EXIrTk+FC6lGY4YM2BKiSpItrSQsbBWHVYWOQoRcGwnQLtoWEVCA HhnfwJs9fNiJuKlPv01ULiLoc9ODXDSQAc5RSrgRhPILKONT9QSt8lruAUol7ZJugLE/ ifTSSI78hPap+FyBfA2sbHbNWJ0lIKDcUIsqPZ048gYLr8gZ7F3otB5n1fxvklxI/3EO t0YU9RRS0NcFin6a0wkBmNqJk9dlG81I1lVKnE13K+zDD686ELQY1xrZ9Gjm9CG+tEcW l2XECITajfC1zFijlW7tdRfKtVUEfqQ66caXn3TX8jchyXGzkbUu6/g3tfyCRM0iBscF CeGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=mdWiwuhX; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f1-20020a170902ff0100b00198e0aa6c41si1092328plj.450.2023.02.17.16.46.02; Fri, 17 Feb 2023 16:46:15 -0800 (PST) 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; dkim=pass header.i=@google.com header.s=20210112 header.b=mdWiwuhX; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230330AbjBRAbk (ORCPT + 99 others); Fri, 17 Feb 2023 19:31:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229795AbjBRAao (ORCPT ); Fri, 17 Feb 2023 19:30:44 -0500 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDBFE5BDB0 for ; Fri, 17 Feb 2023 16:29:43 -0800 (PST) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-53655de27a1so28453887b3.14 for ; Fri, 17 Feb 2023 16:29:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=YyhF10hcbQMtiIcRNPe2j9wgCL3nu0mYgfomzauIh1M=; b=mdWiwuhXmCO7ZvCnfOzT5kGyeI1B76654OSvGqg0v4SfpBfq8gE8Y2HxCtDlqyAoCe RlH3iNC1O3POA4w07JzQSLH9WOuQMtWGYGTcuZDqfaF7LyXaloMakwXqjQejR67+NzLM ZSebxnW4BLvieTC+ErPKwo8+NE2d2ITkqYp8qePD98ii1puW00fdoHibbpwmm78EnXnc e9mKjUDG0xvqx47GeoE/+zEj2Ty0K8brFhlfqMVjJV2l/MZO0YGU5DUAH3uw/T0E0FYc e6nZsvIWbjAB08oOCLK03Uzk6o/Dc+xelLgiCeHsfs3lPkfiBKCFNyXIzhr8GfZEa1Cd rW1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YyhF10hcbQMtiIcRNPe2j9wgCL3nu0mYgfomzauIh1M=; b=ldTZJnUaB9vjveagyNoKM5vwgl2MAh23/erCGa2jZLxRTuWUtZIZAZJ/Yw+7oA2Wq5 vQIfUkBpg2CT3xPQsJomH8uJZIEmI4nAw9FRI8vKGHXzTNP0H11uiniSbmHI8O/wf6Hx ypMwPIdAQ8vB/YFN8ac9m357B71xxCoJxkc2rGC/uzvNiq/dMtyAKPWM0JhwLlLoecEF +rYz5fzdhZ+qi78ddrqW7DsRyw5F1re3ZpWDF6GfYMSjV+0eaDU1ihBECmY2fzilr60T JSQYMTTiQJa1BYxIy+h3NFcHH6pNrqSzdbX+h198sn3GZhNsbBMJd8ZF15fYxnkaNIHj 2diQ== X-Gm-Message-State: AO0yUKX4Yt//dgMwaoDJjkyVOFg0of0EPrlLBHMTjA5znVF8LSgevKft ATzq4Stpg8E/1bWZNxREnyiUJPp8tTSluhdh X-Received: from jthoughton.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:2a4f]) (user=jthoughton job=sendgmr) by 2002:a05:6902:3:b0:90d:af77:9ca6 with SMTP id l3-20020a056902000300b0090daf779ca6mr34196ybh.7.1676680163234; Fri, 17 Feb 2023 16:29:23 -0800 (PST) Date: Sat, 18 Feb 2023 00:28:12 +0000 In-Reply-To: <20230218002819.1486479-1-jthoughton@google.com> Mime-Version: 1.0 References: <20230218002819.1486479-1-jthoughton@google.com> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog Message-ID: <20230218002819.1486479-40-jthoughton@google.com> Subject: [PATCH v2 39/46] hugetlb: x86: enable high-granularity mapping for x86_64 From: James Houghton To: Mike Kravetz , Muchun Song , Peter Xu , Andrew Morton Cc: David Hildenbrand , David Rientjes , Axel Rasmussen , Mina Almasry , "Zach O'Keefe" , Manish Mishra , Naoya Horiguchi , "Dr . David Alan Gilbert" , "Matthew Wilcox (Oracle)" , Vlastimil Babka , Baolin Wang , Miaohe Lin , Yang Shi , Frank van der Linden , Jiaqi Yan , linux-mm@kvack.org, linux-kernel@vger.kernel.org, James Houghton X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758127639911247805?= X-GMAIL-MSGID: =?utf-8?q?1758127639911247805?= Now that HGM is fully supported for GENERAL_HUGETLB, we can enable it for x86_64. We can only enable it for 64-bit architectures because the vm flag VM_HUGETLB_HGM uses a high bit. The x86 KVM MMU already properly handles HugeTLB HGM pages (it does a page table walk to determine which size to use in the second-stage page table instead of, for example, checking vma_mmu_pagesize, like arm64 does). Signed-off-by: James Houghton diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 3604074a878b..fde9ba1dd8d7 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -126,6 +126,7 @@ config X86 select ARCH_WANT_GENERAL_HUGETLB select ARCH_WANT_HUGE_PMD_SHARE select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP if X86_64 + select ARCH_WANT_HUGETLB_HIGH_GRANULARITY_MAPPING if X86_64 select ARCH_WANT_LD_ORPHAN_WARN select ARCH_WANTS_THP_SWAP if X86_64 select ARCH_HAS_PARANOID_L1D_FLUSH