From patchwork Tue Jun 25 23:37:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 13712128 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D5EBAC2BBCA for ; Tue, 25 Jun 2024 23:38:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-ID:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=gUv0XF9ImHRIc/me3sWorh5ZdrDgeX1depLdT9MjEns=; b=pjUNrAGHE2IU3C2c+3Qw6ZV1e7 vshO4d1574yEJb9zpkAjIjzxNn+1X+hFm8Ttvpc9Q91FmHUujA1CUsfhQGiG7hvQDzf9yO6XWCGAo uvGx9qODyy4MavUYdqAgEZeDmyN5sNhEv3dI4Syy0Amr9jyAOwhCcEpXbp1Jp1bZQ+xbtM4hNo0lZ Ao5Q6FlvqHGGzGxpIxsjO9wuk1ROgM/uzGeD22q+SiDL3eL5lebrGObdUgCrtEgTNEAzpL2U8ctol vQT17MoGZHJdBR3vegP7RZQe11C1j/MHO/0t8KkvDPygpSPF665cElyIY0jtYrvsCfxNa628w6Pks USj8atEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMFjW-00000004oEx-2C8b; Tue, 25 Jun 2024 23:37:54 +0000 Received: from mail-dm6nam11on20700.outbound.protection.outlook.com ([2a01:111:f403:2415::700] helo=NAM11-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMFjO-00000004oCH-47X7 for linux-arm-kernel@lists.infradead.org; Tue, 25 Jun 2024 23:37:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SP1iGQtZrhdyQ+o0IqVbjZDeFsjrSz9xx8QKytV7s/vEdqCxvhY+p5SuGoR5hbIOPAe5i+4mTe51MjnBZoBVxVsuDml8K6jbXMuX9ZgXgHwddrx8qxNIDS/YRfflRA5zNs/5rUqhMp78LdCxqd4vARIZQELDL2ZLoqHkJYL9AyPmJlAjFfkGREGOMYc9StJkEEGxonPKTzH1BA+dRx3VmritJmEzGT02Cb3qNmuihff8SlqngNtsIGcSeieCyaUD4VCOzN3zgyob+SwsefL/Jez5BWCZbJyo1yJdUfL7BKSg7UG+KsQBdmSMdIEEqE/ml/8nrc/HcB/Ho3NfQnUgTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gUv0XF9ImHRIc/me3sWorh5ZdrDgeX1depLdT9MjEns=; b=ZfYOACOMt+skagR7lK1M43Z2KH+ox6qCcCLHikPcSPEmp4hDi8M7VjbSIp10Wn/byLr9aMSbqQ6y6lqIwTYU31ZSPfyIUvtQtZHn+lYJzSx2yBPAsbQ2kr9aQSpcqSdDig/puJkPHdhGXQ1xanU1TN24P1Q6yJZzafLzTaT5PdrikhKwjNw1jV6b0yzgRCUlxpISeABQzm3XM0xqW9J0WdB5hwgOMEGoaMPz15ZKFHWs4lwOmu9TLBg4YysKXMJ2qqUnBhiKCTmhleBzoeiiJk4kB5mQ/eRGnL1gDHX5y6lefeHNuM+XeFaOJnb1erNW/MunberWY/IKqZhuvLzkxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gUv0XF9ImHRIc/me3sWorh5ZdrDgeX1depLdT9MjEns=; b=jEj7S25Ab2Rlg0t4EYPwoY18q2dHU+qQC9b6MovsecU4F+sX1Dz8Ain54GjNB44ySY1oQMAQlbrnc4mbTgK7WCW5WjdUSqpfK0WDfTwzUVDgf21pOGSZcRdfxTsghZS/upSXwdfBKCyRYjehnJ+y3Hv8w4Ni8AgBE06JFA3wVMU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from MN2PR01MB5471.prod.exchangelabs.com (2603:10b6:208:11b::13) by SA1PR01MB6720.prod.exchangelabs.com (2603:10b6:806:188::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.31; Tue, 25 Jun 2024 23:37:35 +0000 Received: from MN2PR01MB5471.prod.exchangelabs.com ([fe80::dba1:7502:f7ff:3f80]) by MN2PR01MB5471.prod.exchangelabs.com ([fe80::dba1:7502:f7ff:3f80%7]) with mapi id 15.20.7698.025; Tue, 25 Jun 2024 23:37:32 +0000 From: Yang Shi To: muchun.song@linux.dev, catalin.marinas@arm.com, will@kernel.org, akpm@linux-foundation.org Cc: yang@os.amperecomputing.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] hugetlbfs: add MTE support Date: Tue, 25 Jun 2024 16:37:17 -0700 Message-ID: <20240625233717.2769975-1-yang@os.amperecomputing.com> X-Mailer: git-send-email 2.41.0 X-ClientProxiedBy: CH2PR04CA0028.namprd04.prod.outlook.com (2603:10b6:610:52::38) To MN2PR01MB5471.prod.exchangelabs.com (2603:10b6:208:11b::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR01MB5471:EE_|SA1PR01MB6720:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b204756-222c-479f-76f1-08dc956fc90a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230038|366014|52116012|376012|1800799022|38350700012; X-Microsoft-Antispam-Message-Info: WLs4J+1FI/YmhAKz5Fduw8A58hd5scBFbWaer34hOU0M35WTXe90CIDhGsGGWLTQ3eBiM0zFIojTvsrMYVeE2TGen7c8Qibs0aqLbWyLOB5mt+IEhsID44hQMUX77tETm6hfZZU2BTdbzlFXYiZ7ib+J4stmBfQYnL2e6UApXTaWTT9UXFRXkbFE3TowfzQ+6DzkzfpCow24i7n9kkIShwb4tVnXY/enrEfpU7t02UkvVIR/ad208Nm/tpuMxKbqCm8qjCVz0VUi6f75ORlcjNr5+etDfDSDSrY4ZsPVTNiRQSCZMgk3q0L3JjLLxN8NaFqXcbCPTsG3RVtWk/PgwdUF+RaePCNVmCSl1d8H9yUkgiv9nKLJlZVJQguERXKSINrse1zMsRCtvqS3S0f9JVpr1l+rjoe5dCIG+dkEKz0DtsVtS0DBeNpvtXR6BBAk7MfXAZvL54BIqmbzbUHs/UwwE+Y9nwQnq9PGG1a19lLeZ7OfwFuoOHEbKxIKgFBLtIgyLYlHm82oDQPTsJvmMI6P+AwJV1B1BzZw2SXI8dksaNlT5b+p1ZAu130eHsbT+eqqMsX2vafa9k72x4xLiItK0Uaqv83/hfBrcRUUbofT076c6RmSxxq44QHTrhn06zb2XRUNwCmi68LSO/UEf3RTpJsZwy7L1l4SOwVfcf0wLSJ8UXvfZP6EE7x1sgClPbwAtxSWnobTWR86+IJbwfUb4Eey7huAlsEFwSRoiaMeR1BdLPsac60KzYkxX8vyzibPEEdV2LzSPA5ej+RzgrvKt5+were/h0WYlG6iauBndrTR9gPxmlVRC23o8IX7HtfgGtBCJjfFBQZ8SrJJJOGCZneFl0BbRdNeexSmONkTdrrmlAYH+zTfNn39nbvP1yXHBceCdlLnc4ceahw68JAbPmwNxxfd2hS9ODJcPJeNPAD9ih3++ly0X3PhFHU84sv9DU8XJTTnFSfXxaG36dVAdAUiXMK8qKOq7JPK4ARkib2KsXy0q/O+1dDAdH9o2J4jd7UobjDl7tHwowbW+dF1dB5rvbtJgw24oLe+DGEbxKeYUoSEvfpdtez2AeYd+OZm1YyPtsnEfLsB8HRxu4KvL272EaMnuiC8zR7QUM1i7arV49N3ZMv8VVHaiNmavB+Ji6fDb09d83M3sIeODnUioyg9vlN5SOwKjra8X1breWBBa0Kudcjcq7HcpjHMTzei/drCBY9lpl0gCHZJOw+4f8NDNxN+VLHnvneYemUaXadc+CcqoiIvwyRmIoBRATXN86DOAdltVlz2KjOmNOvuW68d/s4IW8F+aTKAKECjb5/DSg9pxvRkMqEGRSDRUaZ/fjveqjj0/+F8JhNB1mBwbampjAvgsGmmgfHsx5U= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR01MB5471.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230038)(366014)(52116012)(376012)(1800799022)(38350700012);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oWRduHwGnCyoV3Np/YzXMlkCKGugmz3Y1sO8Hcy5mozZNikaGzfv89LQukaf36z8uw5++YMHZ/KHsojrd10eWp1MYOlb6ldgeXIVcCTzjOBwebxZB29mleXwYEteAXAMCOJOacRl5jvw5Xg5M0U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TyYzkg7gsNqUESZUAynJ5zRL63ilWaPD0KDuS4OJmZK9qbMmxdmmmlw84Ts3Zt8fYNWdBjUPjZp3kCuEurRg6BV007xXHX3WdhZmvZHLfMTtNQ43xfFCbFivwVU2ixHDQO8KMJ6HAWmmEVNjWYpiVpHUANaQpQULZuSqk0IGNlQ9DfhjU1EDtlbq3q4jzkdpzaLLTSJJYe54hEoJyEZPqrebTgl4GRPZr2rmnpJcEkzBHt0BZhR6WreSvSmv/iLI2haZAHo2Lc4tL0FQietwMTYl6iimZpNZP+7muLyWIBZOuBTE+Adq3i4GrdK2yFb16yRNBO/rxCe0TE+KzeiSowpRX9IyregiQkjQwxOU5jr1S1ejexSFVcbLgePtObjdi/WvzxF9bNxu7AUc6dI7GZQvtfkLsMUIMNFP0z9kE= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b204756-222c-479f-76f1-08dc956fc90a X-MS-Exchange-CrossTenant-AuthSource: MN2PR01MB5471.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2024 23:37:32.8872 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tsXVWgZHlriOLBRnj7g20PeJXZfZnxhtHqqPRjPv1Kztpbv+UlGTn20i1S5vnGCR1tDvUIYLQV7yDhf5TJZMHSIjVaJPf8UVmbfg9m/4Xb8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR01MB6720 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240625_163747_034632_C6C290E5 X-CRM114-Status: GOOD ( 11.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org MTE can be supported on ram based filesystem. It is supported on tmpfs. There is use case to use MTE on hugetlbfs as well, adding MTE support. Signed-off-by: Yang Shi --- fs/hugetlbfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index ecad73a4f713..c34faef62daf 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -110,7 +110,7 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) * way when do_mmap unwinds (may be important on powerpc * and ia64). */ - vm_flags_set(vma, VM_HUGETLB | VM_DONTEXPAND); + vm_flags_set(vma, VM_HUGETLB | VM_DONTEXPAND | VM_MTE_ALLOWED); vma->vm_ops = &hugetlb_vm_ops; ret = seal_check_write(info->seals, vma);