Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2767885rdd; Sat, 13 Jan 2024 00:48:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IHXCkFKxJp4w+TP15gP6dus8GMuvVadrZcdBSiIvn/9XjVkkclk+77ahOYa9dT5xGN/bC6r X-Received: by 2002:a05:6402:2303:b0:558:f5d2:addb with SMTP id l3-20020a056402230300b00558f5d2addbmr323110eda.56.1705135738499; Sat, 13 Jan 2024 00:48:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705135738; cv=none; d=google.com; s=arc-20160816; b=ztNE3Rk4WXHO8to8zL9vsUuXsyKxX2WtCkZk58RKC2OsDSdhpQQgCUXYqqjylyGe+Q 0snXZa/KCIdfKlPueYmHPr2ssMR2dtGfJPDJEWTxvhAO2rxQldZEqWFjvnIZkGZXmad2 f44ASZyMaBpO9FD0WAmTllT2lOCJze9spFj22g4Ahk5m3MtPuiuW/kot9n5GwubKbKBI 7glrHcBSLrVC116WhYUtdbyI+Hhl0eGbrIkxvdAh3buUkm8Rz2tMHMaGHbCF1gSYtWSl JndUtvmSXmAdxB6JaOu9nTMnEjtNbtxVmNpNeOvz43Z61UfPn+u/UHuN9YvLCVsOws87 43IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=7zI8o8wV/f/yjTtW1lV7+IUwZnz8TpP8RFm0kpmJmB4=; fh=IBRY2OfN0iTWW2ZjSSKvUJynIiV/JLaiDZe55wN3MqA=; b=qm+SfruqH6yB64GPaB6t8ZkOLLu60lCruD4KSP65cCTpQR7onJqzHVmeCdEO4YqwHA cbo5axq1DDVUvadIkfv7dudEmUxqx6Ch7XV1HE0yIuE3Bj2leQsb6NEDJKWzMpNfZIa8 2FGYQZFIj4pxEzlCCS134sNlYR2ErI05DiUlh0wwKy9B9JgH4IyU3CdqjUbDKyOv1Y1Y eOQB0oTZAnvEOz7OdYcBKGgoqIFHvIgqFCCrcekoWtalcbsYbh+cj5dFmiivLtSgtlc/ YaVR5OVKe12hJgOgy2QVyofuzQONXnnfqdUHWGOGSEw7Jse32IkdrFQ9v97Fw7ZN1vdi akyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-25218-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25218-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id q32-20020a05640224a000b0055860ed12c4si2181281eda.612.2024.01.13.00.48.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jan 2024 00:48:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25218-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-25218-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25218-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 411A21F23420 for ; Sat, 13 Jan 2024 08:48:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7CA2011190; Sat, 13 Jan 2024 08:48:25 +0000 (UTC) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21CF563C3 for ; Sat, 13 Jan 2024 08:48:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4TBsQD2LV9z1FJ3B; Sat, 13 Jan 2024 16:44:04 +0800 (CST) Received: from kwepemm600003.china.huawei.com (unknown [7.193.23.202]) by mail.maildlp.com (Postfix) with ESMTPS id DC46A1404F7; Sat, 13 Jan 2024 16:48:13 +0800 (CST) Received: from huawei.com (10.175.113.32) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sat, 13 Jan 2024 16:48:12 +0800 From: Nanyong Sun To: , , , , , CC: , , , , , Subject: [PATCH v3 0/3] A Solution to Re-enable hugetlb vmemmap optimize Date: Sat, 13 Jan 2024 17:44:33 +0800 Message-ID: <20240113094436.2506396-1-sunnanyong@huawei.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600003.china.huawei.com (7.193.23.202) HVO was previously disabled on arm64 [1] due to the lack of necessary BBM(break-before-make) logic when changing page tables. This set of patches fix this by adding necessary BBM sequence when changing page table, and supporting vmemmap page fault handling to fixup kernel address translation fault if vmemmap is concurrently accessed. I have tested this patch set with concurrently accessing the vmemmap address when do BBM and can recover by vmemmap fault handler. Also tested under the config of 2/3/4 pgtable levels with 4K/64K page size and all works well. V3: Cleanup: Move the declarations of helper function in proper head file. V2: This version mainly changes some naming, and uses more appropriate helper functions to make the code more clean, according to review comments from Muchun Song and Kefeng Wang. [1] commit 060a2c92d1b6 ("arm64: mm: hugetlb: Disable HUGETLB_PAGE_OPTIMIZE_VMEMMAP") Nanyong Sun (3): mm: HVO: introduce helper function to update and flush pgtable arm64: mm: HVO: support BBM of vmemmap pgtable safely arm64: mm: Re-enable OPTIMIZE_HUGETLB_VMEMMAP arch/arm64/Kconfig | 1 + arch/arm64/include/asm/esr.h | 4 ++ arch/arm64/include/asm/pgtable.h | 8 ++++ arch/arm64/include/asm/tlbflush.h | 16 +++++++ arch/arm64/mm/fault.c | 78 +++++++++++++++++++++++++++++-- arch/arm64/mm/mmu.c | 28 +++++++++++ mm/hugetlb_vmemmap.c | 55 +++++++++++++++++----- 7 files changed, 175 insertions(+), 15 deletions(-) -- 2.25.1