Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp339043rdb; Tue, 19 Dec 2023 20:21:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IED0+tZdPrxOXBzJ0mt3m7D95egFhfoHHOrDcrnRC5xgToBlmGtNTRvMOClanigflL5Mw/w X-Received: by 2002:a2e:9c99:0:b0:2cc:74c7:a1a9 with SMTP id x25-20020a2e9c99000000b002cc74c7a1a9mr1003208lji.20.1703046113265; Tue, 19 Dec 2023 20:21:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703046113; cv=none; d=google.com; s=arc-20160816; b=qS1PQLQIQJgPW3Y1Jltoa7UwmQfQRVB2V4Ge94nB+PWvuJhL4MX15hQ1YnK1SJcBZ9 AG5R3S3USUN1w504S4O0Ukrot89CKC+uUb1gIToMtZFMnEQ5nprf0BDJ9wmIdFWfctRu 4zFpim9tdIj9sUH7iSJUTA4cvkmZNhDAwDMinmRT72aPET2GFKWRgZhZGeqcPOD+szU0 6R5U2+xjT2Ex0naBBVRvXLLsnF/uNdlF9+kwIW08KLwX5jUpr65H/KWGKjUes1zd1R92 CfTE6U7m3h+dKV5m7eBMN2ep8QqYGbRKtfPbl1GAmz0em/lI3yshH6Zz6QTRKlc4gCJj t+DA== 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=Q0QXhCfXUpQ0lsgYwaOUqV8ddW58wap0TJEwDEHxftM=; fh=IBRY2OfN0iTWW2ZjSSKvUJynIiV/JLaiDZe55wN3MqA=; b=O7+TFe056DoAk4ttYuZOiX2yBB8dLC+pXJpLO2aiCr6jUcYd4AEzn3lqTsvXN3vRNY W9Sj3r1caeoyDZ0LlvJkd1Ewk9GSF0rMLkNdoVFtVdVw7SuYcGN9pYmo0LhHaDbvXt05 qUUEDVqpKc166E1OZ/3NrgxncmMCyJScNb7pc6S0ilHXKBISk0I66uFXh9SaoZQRV1uf 345hpwzw6oh24q4JGlo1X58zhBMGIY4DGYNWcQr8P7eCHYkLHCaMtyUfOhnwZfY5eNR2 mu+hxM6iiz0lYXRCqKEGFhOMEOkzXHQQpkg02wpn2vN+8PL9U8ZD/w8X/h+8zvp2Z+b3 UHFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-6363-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6363-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 b11-20020a056402084b00b0054c878f57ecsi11403806edz.621.2023.12.19.20.21.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 20:21:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6363-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-6363-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6363-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 03E271F2605B for ; Wed, 20 Dec 2023 04:21:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A2D6515AF6; Wed, 20 Dec 2023 04:21:46 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) (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 1EFB4156E2 for ; Wed, 20 Dec 2023 04:21:43 +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.88.194]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Sw0kD4qwgz1Q65Q; Wed, 20 Dec 2023 12:21:24 +0800 (CST) Received: from kwepemm000003.china.huawei.com (unknown [7.193.23.66]) by mail.maildlp.com (Postfix) with ESMTPS id 302BA1402DE; Wed, 20 Dec 2023 12:21:41 +0800 (CST) Received: from huawei.com (10.175.113.32) by kwepemm000003.china.huawei.com (7.193.23.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 20 Dec 2023 12:21:40 +0800 From: Nanyong Sun To: , , , , , CC: , , , , , Subject: [PATCH v2 0/3] A Solution to Re-enable hugetlb vmemmap optimize Date: Wed, 20 Dec 2023 13:18:52 +0800 Message-ID: <20231220051855.47547-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: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm000003.china.huawei.com (7.193.23.66) 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 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. 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/mmu.h | 20 +++++++++ arch/arm64/mm/fault.c | 78 ++++++++++++++++++++++++++++++++++-- arch/arm64/mm/mmu.c | 28 +++++++++++++ mm/hugetlb_vmemmap.c | 55 +++++++++++++++++++------ 6 files changed, 171 insertions(+), 15 deletions(-) -- 2.25.1