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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AA99C6FD1C for ; Sat, 25 Mar 2023 23:41:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2F0E3900003; Sat, 25 Mar 2023 19:41:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 29FDF900002; Sat, 25 Mar 2023 19:41:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A5E9900003; Sat, 25 Mar 2023 19:41:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id E6DD6900002 for ; Sat, 25 Mar 2023 19:41:22 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id AC04CA02A7 for ; Sat, 25 Mar 2023 23:41:22 +0000 (UTC) X-FDA: 80609044404.21.80C7A8C Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf07.hostedemail.com (Postfix) with ESMTP id 0565940006 for ; Sat, 25 Mar 2023 23:41:18 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=cwF7UiLQ; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=rrQSIfPm; spf=pass (imf07.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679787679; h=from:from:sender: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:dkim-signature; bh=b3g6C8BmG7gibcQB310g4Q18cDB8St9DaZqXYqYqUnI=; b=Rum0NkwthhzC9gUHlRSVOGHCI/aArvcxI+CgLMVZMkwB+Z9IbH5DylQ17guFLI6ZaBpFGL rcf3QGLnxnaR5EZirRLgpVkj47oOtQoffoFddK46mBPM3mq44viMmbUODp0vzUV3H2FzpO y6fJgpQ6sGik1YsVbZkUvvwomaZdEeg= ARC-Authentication-Results: i=2; imf07.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=cwF7UiLQ; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=rrQSIfPm; spf=pass (imf07.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1679787679; a=rsa-sha256; cv=pass; b=w4FmNDxMvSIQcV+8LzzLaGzriK+zR2QlYoNq0iKCIe+F9BXm0VUMihl7CHs+4EjAmK8fZ0 O+dmyCv10wUE2abO11wTHwSnG4zv6nsZBpw5x1OgyPRTnorbLM6lRTznBe8DsDVfgwVcnf zKB1LPy2i/HeHPrdHWLVc8Gnu5I6c68= Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32PNaNTo002913; Sat, 25 Mar 2023 23:41:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : content-type : in-reply-to : mime-version; s=corp-2022-7-12; bh=b3g6C8BmG7gibcQB310g4Q18cDB8St9DaZqXYqYqUnI=; b=cwF7UiLQ/kgQxj9kgH8yoJ0/LU0TpvWfALv9n6jy0m1GCCFiTChgG7DKMRxuldYEC/6V bJcp+HRuRoPMbL2CLHU0fOxtf/H9upTccqbjCWscQ+ikOcSy9JVH5y4KrKswL9Y1TAwq 3fWh6M0A6lavckgYTx3LKcxskkc/exQLQBHpWmoMxU0KDOJs3OSs/liScykRb9TqzZ1J 2vHuce/zLbDLlwTEPj4b202EUfy2F0E1qZVGnsXrx8YhCDczwG8QqASzb69KM8qIV1hY HeV6C9+R+Bx9wDssBIzVD5/tAb7+4xEyTtsxY/DWt9m36BlkkHmr0mTF1yDcvMTXNoAv 8Q== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3pjarkg05r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 25 Mar 2023 23:41:08 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 32PMHPJU005510; Sat, 25 Mar 2023 23:41:08 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2046.outbound.protection.outlook.com [104.47.51.46]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3phqd3c2s7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 25 Mar 2023 23:41:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XjB57Qd8yn3e5xzQ0AfkS33sypeSbF1eMTrKfS61vVm9RlwZhh9g4cIUo4ApK1xrYmcVjH9Bu43mXKi2FElEslMQDDJN55PROx0MBeqzPTnVHrbLOXZINK7AIhiVYyF6gzul9LoJUInZWUSJ4F/yMl4I72g0EUYdUPxLlLYTo93yCegM66f1NsVvsLeBHrtAUQXJFO0ebw8mwKSwGYWGoMXHdNZF+6csOjZP9+aOLrsDM5Bbxa8sMGuKcgNDI1kTl0fEGizPDkQWWSO4MHE1iXwyBWIbF+d0hHIot3DRMXtZzVyp8Mivv4DzqaM/k4s/kapxwanZFEDm3c9k80Qc5w== 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=b3g6C8BmG7gibcQB310g4Q18cDB8St9DaZqXYqYqUnI=; b=SzM+VqxjGSAb8SliB1ec/n78Mh7XLVODg7KNTQcGSIF2EeVOjTuWY7axh/5ayqbVGk7NZ4mCQfcjYvmcd3iDx+H6e5M86hGSWj2IRe6r3awrLE73ieB0oq83E3a7hXv2jJ7Ryp+VZucKQ/Vh/zzHhJnBXWvc8deB+XWoqX/sPqbryumF3hjvcxQbFnU9+kXm9h1mv2FwJ3WBOfvhFgM6Rh4LwA8wCn9VpHqt5pk1t29ZNA3wJ+YOD4uPZ90BGyhBhlfo8F92qPbQkd/GgI/tz0n3sDj9iis5RyYuBjC+5Jo/0lurNTuU0/nzpuRE1rfd4iFcKH5Z1sGscfEASYvmAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=b3g6C8BmG7gibcQB310g4Q18cDB8St9DaZqXYqYqUnI=; b=rrQSIfPmSaeylFSLzX+/RX0GB1oqVK5RzsV6gitDdsmT2uEl/lTLgs5F+Rv1FEwiLIgKoof/EQYeke9pVuWKFEt0clMs04lq0P66H3h6TVAbjOmIv1mMHDu2icw9NrSesYWm0A4lF0VjhyS0g3bxuYJkNsMDsj3kk1yyGBKdb1A= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DS7PR10MB5390.namprd10.prod.outlook.com (2603:10b6:5:3a1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.41; Sat, 25 Mar 2023 23:41:05 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::93c9:c99e:5ab:4319]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::93c9:c99e:5ab:4319%7]) with mapi id 15.20.6178.041; Sat, 25 Mar 2023 23:41:05 +0000 Date: Sat, 25 Mar 2023 19:41:02 -0400 From: "Liam R. Howlett" To: Mark Brown Cc: linux-mm@kvack.org Subject: Re: [PATCH 2/2] regmap: Add maple tree based register cache Message-ID: <20230325234102.izwnfhnwfdryxlyk@revolver> Mail-Followup-To: "Liam R. Howlett" , Mark Brown , linux-mm@kvack.org References: <20230325-regcache-maple-v1-0-1c76916359fb@kernel.org> <20230325-regcache-maple-v1-2-1c76916359fb@kernel.org> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230325-regcache-maple-v1-2-1c76916359fb@kernel.org> User-Agent: NeoMutt/20220429 X-ClientProxiedBy: YT3PR01CA0101.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:85::14) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DS7PR10MB5390:EE_ X-MS-Office365-Filtering-Correlation-Id: 96e5b635-1090-4332-b840-08db2d8a663e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bj2hHgibE86HHIt1R1QKWOOXnIly6HCgEf3AJ5yShPJyjix9agZaqejDQR6YMcBoKq3uyDDihFafQBKeSiYX6WDO7wh/QTs9ZPakT11PNfE7qFh4rq9KojvA4/q3dBL36PIxAF9sI4D9xy2gs3Gxh5R5ToMQ9jw+WisgffCJPm91TgmUXHlhhE1EMZ7Tu6KVIysgL6n3QsaEy5dCFK/JKHnIG1usNpdS5WC2fL6PdszEuUNhSGuAT/QnuW+snTRaKNgO/3u0jUwgJSXjvlcQLSWnrDxGPksfXFn5HknJSn/Tlc8e11MfN975RMo4g4+uVz22yhvZFLmf9Wglflepl4en9/Rdg/WxPbilc1WmMyFDgYNHBEu/VXLS4bcg+P+ALenJAbjNrTxc95GCeGRO5cj6jcGlOcv/ZhmHpQkWAgNrj7sjzvJCRdNmJ/0I3PV2kuFlRNCXutaYcCaKsVoWng3Ii5B3LnPQeDQUzbIxPCEbZSoo8QWroL7XqMlKUAqLk39WGQ0JjdQEbPu6Lb9zEY1rLoU6JEzgYknXtkVaT/kgZgh+z5MVsMK/cKtjJaTj X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(7916004)(396003)(346002)(136003)(366004)(376002)(39850400004)(451199021)(86362001)(33716001)(3716004)(2906002)(66899021)(478600001)(6486002)(26005)(6666004)(83380400001)(1076003)(4326008)(316002)(6916009)(66946007)(66556008)(66476007)(8676002)(186003)(6512007)(6506007)(9686003)(30864003)(38100700002)(5660300002)(8936002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?S5afMdBdTZthRz5Z3xlObBPFb6NMBUKKK5o4hNZmOgHWH6Ah1dARn3kLNNHo?= =?us-ascii?Q?4rSOarDYWig5yeraQAK388cNBF3jYDliPM0zzKdANSqBwT3Xr5Q4vKPxLTL3?= =?us-ascii?Q?abFHqRKM4CrR8/dKNpgqKoMfeZBSv/dU0qZWHXEEirQrkZjaY27jb1FLE4+I?= =?us-ascii?Q?1ZnguTC3X3ir/a9w9R4pVnG24rhswVh/BCe5i5BMYKlV2RvrmZ67XlaKjPXA?= =?us-ascii?Q?bVYVPed+hP2icngLHFW/cs47fLaU5AS4IvOwDsB+2lbEF6jSCEtFbMsIDGpd?= =?us-ascii?Q?Xa4ZdzX2mr52N0XYc7u+GHE71q0zR6ta1ILs8WUzsdJBqHW3aU5RW0y0sfsm?= =?us-ascii?Q?HW460RGpCvXUNJlHdZqINf+pBBEGycayBtonSZ+nAzSr49Rc8OsvJZRj9WRL?= =?us-ascii?Q?Yry6H4G1SFxe4h/zH8df0PpATnPZMBboysWg75TaTymM6GJHdI2ccO1tTDyF?= =?us-ascii?Q?LquEVkIgM78v4v+2/b+3B6Osf84dzPlom4bgWqtOlYE5ytIc6RfSXGZ6/ZtU?= =?us-ascii?Q?SCgczoZ6q1SHHorqbPX70DT/6WmnRmKuFIe+BssTcRidc2aGlyNAfj5ydfGH?= =?us-ascii?Q?nHyRTJ4UE62Ood+aVRFvQ+Bgyix+++64ReFykFEjKPwPnsS0FkwdWQv4gHE5?= =?us-ascii?Q?evmjhNT5S1AbRloxIrE8W/2TfNIyMjshEqEGoVNVV0eNjYwrwEVmRx8ME1JK?= =?us-ascii?Q?2mDBUu252/x1Yk9FQBoRX66+2ZkupOGzrkiD9UwxPosH92itr0722FET3K+E?= =?us-ascii?Q?HvwSjBJbEaO0s187z1Ho912mP3/WUFeUFgOk0gnOH5STORIeIYc1fD4GI7kr?= =?us-ascii?Q?D7uB6BpRfpR9vwLTs83ifcRBH3bkYeIU84ECFTCmJJRS/1zHD/vvdbfHMTCV?= =?us-ascii?Q?f2sjR+Abf8FaEVty5Fpk3tFpEnbDVCZVpRLDW14F1JXF0UQB7Pvj27yfOR7z?= =?us-ascii?Q?a6ODLtDFs3SmPrE5wH9P7/R5M/5HfPCNsLM7mQ4+pSaZH4ODOD8RYoawZj+4?= =?us-ascii?Q?6y2cqpqFcfjqKBnJTKAIXwJ0s8K4Mu7tMZ/o6jl/CApEvktqTTmYCwNRi3eJ?= =?us-ascii?Q?Drr0bLwgJxB7KyP3fhl6pBb5T5iU3JAsKkrgHruFDLWw92MkbZ8CUjnk9K9i?= =?us-ascii?Q?Gw7e+5Q+onoGqrLdORXBplx1hVAtJf3wh/91ewD7jHX7si5WtigEEGTfpPPm?= =?us-ascii?Q?BkBXsjIilZanEk9ct18FgujjUw/HObRsMRIbb0aQeX+4LAPvff/NLlMDIjKD?= =?us-ascii?Q?BxGLeiSddqPduG4L9xYmsyVn5i0gV3R4qn9amikfvyi6hQ7Ne3ks0pzQ6DQn?= =?us-ascii?Q?rajEEMO2mQyOsspG3xy/zGGQx5cm7A1F/UHk/T+RJAQltjYkbfO70NnFe8GK?= =?us-ascii?Q?qhGWwKDap20bpEPhANRltfMMULgCCWxeRf4wSKIo6IqSFvKuBIHOBZSnA542?= =?us-ascii?Q?tU6CqoJuyTpWwESn6Kdep9sU/uuAu7bvDFn8qW+CLkMWrtDXENyjcWpU6FAL?= =?us-ascii?Q?HKRi7sjp+Wm+R7ipz849bmlnLxGJpXpiB2gws/S0DKpqn/pk7EsWe0TPc/MS?= =?us-ascii?Q?qfTf+Oh4WvWqij6TAy/U6ShMgtcMtRwukUEwtzYLneqNINwUTH4+B3aQ4NMD?= =?us-ascii?Q?Vw=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 437ZoFDXJwvMaIhVUMiAJiCTuSA0ZSmF58KtesxanmHPhY48iB9POolqg2dfQLX365fECblqUYvBp24S5JsgTg/yz4Ui+D8jeFYr8o07egXXL6Ojwi4KWIgs+GNMAt4byVcBsAXRp5/rbAFr5RyTpX4BbVxK/kViAcarR+FTJjSBUeNS3g0B4U7RGLsiLwSnGQDywwrqGWVJ4EwLw2rc3k+ZPNpM6QmJhQYUeDMoX2UHZ7JRLmwrPUHzqhH9VqA7ov0SBBL0kn7Cd0DHHNpRVUdjlitRofSMAR6BDA+kD3J4YWmojJ9deEQ0EjBacQZiWw1EWOnO2aX3FZiYV63uvaVAhIWpyTI9xDV1fpjk5wQ1epm/hWV0s15w0hAgsgWvuGQyBrdlAxe3QWFBIGPlcnVN1ADqag+uDeVwpQLmFT7DdJcqIepOlfNIiw5/7QRVx6IkPThwr5md3gJkEqJBD7QyIu2xGLQd0lRf9Zv8Lnd4qEbPMRN6/EVuGzCxEfsRrWwPbavyI3/JPc6J7KibFqTYKt3x5gpLvp/06XidH9AYPCVACjBxGAi14yJBcPPMOjryWNJZNWUkbwOe5VL34plGp/jKKuHNqdmrsahc80aN/Edmt8QZ8WzBjx6BMq2dtJ/2u7LEcIAuf//bV33w56E8nhCk6vkii8KasbaOpsY9LxXs3YdBEomaBkt6bxEdmj6aDBStR+1VzvRgcoqjDhXlBlKiyWwpXztlvfzfWnIXxdPnVTvEnc7FiKTlAoBwLpaAqKqgRFzizGsJp5hybw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96e5b635-1090-4332-b840-08db2d8a663e X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2023 23:41:05.0305 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lN2w3a7t4DTV4l2J5TAuoNqQr0ntm2cHIh2BIQ972w9YJ2+CubFklEflP3vhhsUzwMu00IU0xxdf+tcl7HB8pw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5390 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-24_11,2023-03-24_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 phishscore=0 suspectscore=0 malwarescore=0 spamscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2303250195 X-Proofpoint-GUID: vc-rhXmAisCdO8V4JjyJXtLx3UJK8qOT X-Proofpoint-ORIG-GUID: vc-rhXmAisCdO8V4JjyJXtLx3UJK8qOT X-Rspamd-Queue-Id: 0565940006 X-Stat-Signature: bso33qqz3zkzyy6qa5udttcyhcu1i98m X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1679787678-635094 X-HE-Meta: U2FsdGVkX18KhsGDh/5m2kAdyZktKrX+kaV3gvZg3Nf3Q3tbUbqXUSkWjOuytEW79bvQ15b1quCK31TntStDa0NFotFYlztAMDJuwIDpsd9tHWYHNP1Dru12bO7yS+NsVb3iWKxtCrRCalQ5pJbNyWaH7sqCsxKZ3Z4HugG3sHloZk+0ri+09peHOV6C9MqGx6kdLZLmOS8eGeuX4jCWl+korWAaDFa5KMQVFG2MBap1JaabIdG/dqEXG9buDdpsJTZsNFQlqYCg5SIFGunPWwAtW9dOAdaDqjFtmEAiHT3GZRhCjjnVMd1fvCghSSIEtg/gzuYyomlqmqbP8B/ecEltYqi7QZMhZdPTICBRZCH4YmYXBqW9g1hqIkEJTzSFQMVFhcMlu5oUHbG51tZU9aeoqOrA2MurRRACuWvhgPlcUOg47x9XBQ5njkOZdK5AJseJF6k2JYSY4sko2rGowfiAjgC6HevGGWrXbWEg3pWgNmdc076FhAz1mgg/vd8I+/vgSQGLuqVsdEu3IsdowNQnTlAIgy6ygd1CT3vGy56SIW92Yc5A3z3ftkMOGkZs9mWWxL7Isq4ktJv49x4Nn9tFL6Oflsd1xfYByEr+Ev2xgmaDgQvfSZHhp4/Q/TbSeLPm4Fh7GAjTKIyFE+ULDW/M4pO0SUtYYGfy1aUZas7jogx9vjbC6imc2rfL9YCfCUjpGQ3W59VNZ5Ee2gM+ZbeeDna6oyLJidrG6//OwsNgVsQm2RVgknzOlPc2p8NgsMHwd/bEKEDgxX7PzA373wCIudR3ffil6l/MH0VVKyrVVlXL//Gp5rdAe51LYRUtSLJPmseJ8iOssbdpb8UUVmvV1serSj7v+2yApA64MhP9SqS6xMLG5++cvi63Yp6ZoWEQjwiaXklk6zZ7PzYYtg1PYuW4ufwvdh0obZMbxvRf32W5CULi2xI+mre2CElP12qcAwtiyMqeUBPQ8UR px41Wrg1 Jck66Qiv1sOHrcQuA3U51frZrBCC0jpbXX6BnH9E7kz1vjxGFI/R5VJFx3Ua7dzPKFpGX1yh3JKgbCilgKrrhdB7aoz52NW3ZQXpje9xK2vcN2PYZbvFaByZ8wBYYW11xgvBX7qdC4yzkEFmAvWfxJ6CW3rcidV24W8hh8Wc4mzo/08sStiOOrlzBfcIW5FmVhhz6S4GcXzQGM+fmm9ShzrUuYKJeNJNrnYO6HSJLiqUpD6poJXq36msw0BaiQtuMGxOFfjNNw0ygE3ZJU5gjoA++nczb0YOOBd4SkDMR51Gjh+4rhB3RVUVFDjNxFBmtHZ7XA6OlisaKNIMSjciuiB0bOjnIcn4Evr0QZxwBoXb/yHdXd04nMyhlO94LOtSqUJOJuwqxSCROb0KNi8mSc0E6D/eundMWlMHI0SK8Ol4VQcVJRUnlUM6aVVg0oGiXFTp+s2tdQ3nD3p/2NWYxK5nP+w== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: * Mark Brown [230325 17:53]: > The current state of the art for sparse register maps is the rbtree cache. > This works well for most applications but isn't always ideal for sparser > register maps since the rbtree can get deep, requiring a lot of walking. > Fortunately the kernel has a data structure intended to address this very > problem, the maple tree. Provide an initial implementation of a register > cache based on the maple tree to start taking advantage of it. > > This initial implementation is very simplistic and doesn't take full > advantage of the capabilities of the maple tree, we simply store each > register as a single value within the tree. Since maple tree values are > pointers and iteration doesn't naturally give us the key we allocate a > small structure for each register, effectively adding another layer to the > tree. > > We also store data in host native format rather than device native format > as we do for rbtree, this will be a benefit for devices where we don't > marshal data within regmap and until we are able to store more than one > register in a node there's no reason to have preformatted data even where > we do marshal. > > This works well enough to get started and should already work well for some > devices but there is a great deal of room for improvement, as well as > storing blocks rather than just individual registers we don't need the > locking that the maple tree does and are likely to benefit from caching the > last accessed entry. Very small register maps may continue to to better > with rbtree longer term. Without use of the locking, the maple tree will generate lockdep complaints. With the mas_* family of functions, you are responsible for locking. On read you can take the rcu_read_lock(), on writes you need to take mas_lock(&mas). If you have a lock you already use, you can init the tree with the external lock flag and set the external lock like we do in the VMA code. mtree_* functions handle this for you. > > Signed-off-by: Mark Brown > --- > drivers/base/regmap/Makefile | 2 +- > drivers/base/regmap/internal.h | 1 + > drivers/base/regmap/regcache-maple.c | 154 +++++++++++++++++++++++++++++++++++ > drivers/base/regmap/regcache.c | 1 + > drivers/base/regmap/regmap-kunit.c | 3 + > include/linux/regmap.h | 1 + > 6 files changed, 161 insertions(+), 1 deletion(-) > > diff --git a/drivers/base/regmap/Makefile b/drivers/base/regmap/Makefile > index 4cb73468a197..f6c6cb017200 100644 > --- a/drivers/base/regmap/Makefile > +++ b/drivers/base/regmap/Makefile > @@ -3,7 +3,7 @@ > CFLAGS_regmap.o := -I$(src) > > obj-$(CONFIG_REGMAP) += regmap.o regcache.o > -obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o > +obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o regcache-maple.o > obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o > obj-$(CONFIG_REGMAP_KUNIT) += regmap-kunit.o > obj-$(CONFIG_REGMAP_AC97) += regmap-ac97.o > diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h > index 7b9ef43bcea6..6361df6f553a 100644 > --- a/drivers/base/regmap/internal.h > +++ b/drivers/base/regmap/internal.h > @@ -282,6 +282,7 @@ enum regmap_endian regmap_get_val_endian(struct device *dev, > const struct regmap_config *config); > > extern struct regcache_ops regcache_rbtree_ops; > +extern struct regcache_ops regcache_maple_ops; > extern struct regcache_ops regcache_flat_ops; > > static inline const char *regmap_name(const struct regmap *map) > diff --git a/drivers/base/regmap/regcache-maple.c b/drivers/base/regmap/regcache-maple.c > new file mode 100644 > index 000000000000..a18966aed27e > --- /dev/null > +++ b/drivers/base/regmap/regcache-maple.c > @@ -0,0 +1,154 @@ > +// SPDX-License-Identifier: GPL-2.0 > +// > +// Register cache access API - maple tree based cache > +// > +// Copyright 2023 Arm, Ltd > +// > +// Author: Mark Brown > + > +#include > +#include > +#include > +#include > + > +#include "internal.h" > + > +struct cache_entry { > + unsigned int reg; > + unsigned int val; > +}; > + > +static int regcache_maple_read(struct regmap *map, > + unsigned int reg, unsigned int *value) > +{ > + struct maple_tree *mt = map->cache; > + struct cache_entry *entry; > + > + entry = mtree_load(mt, reg); > + if (!entry) > + return -ENOENT; > + > + *value = entry->val; > + > + return 0; > +} > + > +static int regcache_maple_write(struct regmap *map, unsigned int reg, > + unsigned int val) > +{ > + struct maple_tree *mt = map->cache; > + MA_STATE(mas, mt, reg, reg); > + struct cache_entry *entry; > + int ret; > + The locking is missing here, so you will get lockdep complaints. > + entry = mas_find(&mas, reg); > + if (entry) { > + entry->val = val; > + return 0; > + } > + > + entry = kmalloc(sizeof(*entry), GFP_KERNEL); > + if (!entry) > + return -ENOMEM; > + > + entry->reg = reg; > + entry->val = val; > + > + ret = mtree_store(mt, reg, entry, GFP_KERNEL); > + if (ret != 0) > + kfree(entry); > + > + return ret; > +} > + > +static int regcache_maple_drop(struct regmap *map, unsigned int min, > + unsigned int max) > +{ > + struct maple_tree *mt = map->cache; > + MA_STATE(mas, mt, min, max); > + struct cache_entry *entry; > + mas_lock(&mas); > + for (entry = mas_find(&mas, min); entry; entry = mas_next(&mas, max)) { This can be written with the maple tree iterator: mas_for_each(mas, entry, max) { > + kfree(entry); > + mas_erase(&mas); This isn't the most efficient way of removing a list of entries, but it certainly works for the first pass, as you say in the comments. > + } mas_unlock(&mas); > + > + return 0; > +} Wait, if this is for destroying the entire tree: mas_lock(&mas); mas_for_each(mas, entry, max) kfree(entry); __mt_destroy(mt); mas_unlock(&mas); Calling erase for each item will cause the tree to slowly drain; rebalancing and re-allocating new nodes over and over. mtree_destroy() and the non-locking __mt_destroy() will more efficiently walk to free every node. If it's not for the entire tree, you can free a range then write a NULL over the entire range. But be conscience of the maple state range after the iterator ends, you will need to mas_set_range(&mas, min, max) prior to the mas_store_gfp(). > + > +static int regcache_maple_sync(struct regmap *map, unsigned int min, > + unsigned int max) > +{ > + struct maple_tree *mt = map->cache; > + struct cache_entry *entry; > + MA_STATE(mas, mt, min, max); > + int ret; > + > + map->cache_bypass = true; > + rcu_read_lock(); > + for (entry = mas_find(&mas, min); entry; entry = mas_next(&mas, max)) { mas_for_each(mas, entry, max) { > + ret = regcache_sync_val(map, entry->reg, entry->val); > + if (ret != 0) > + goto out; > + } > + > +out: rcu_read_unlock(); > + map->cache_bypass = false; > + > + return ret; > +} > + > +static int regcache_maple_exit(struct regmap *map) > +{ > + struct maple_tree *mt = map->cache; > + > + /* if we've already been called then just return */ > + if (!mt) > + return 0; There's not a race here with multiple tasks in here at once, right? > + > + regcache_maple_drop(map, 0, UINT_MAX); > + > + kfree(mt); > + map->cache = NULL; > + > + return 0; > +} > + > +static int regcache_maple_init(struct regmap *map) > +{ > + struct maple_tree *mt; > + int i; > + int ret; > + > + mt = kmalloc(sizeof(*mt), GFP_KERNEL); > + if (!mt) > + return -ENOMEM; > + map->cache = mt; > + > + mt_init(mt); > + The maple tree does support bulk loading (in the b-tree sense). You can put the maple tree in this state and pre-allocate nodes in bulk. kernel/fork.c currently does this through the vma iterator interface. Note that after a bulk-load, you have to ensure you call mas_destroy() to free any unused nodes and to potentially cause a rebalance of the last node (this is automatic). But, again, like you said in your comment; this is good for the first pass. > + for (i = 0; i < map->num_reg_defaults; i++) { > + ret = regcache_maple_write(map, > + map->reg_defaults[i].reg, > + map->reg_defaults[i].def); > + if (ret) > + goto err; > + } > + > + return 0; > + > +err: > + regcache_maple_exit(map); > + return ret; > +} > + > +struct regcache_ops regcache_maple_ops = { > + .type = REGCACHE_MAPLE, > + .name = "maple", > + .init = regcache_maple_init, > + .exit = regcache_maple_exit, > + .read = regcache_maple_read, > + .write = regcache_maple_write, > + .drop = regcache_maple_drop, > + .sync = regcache_maple_sync, > +}; > diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c > index e5d6b535c002..0b47721089e6 100644 > --- a/drivers/base/regmap/regcache.c > +++ b/drivers/base/regmap/regcache.c > @@ -17,6 +17,7 @@ > > static const struct regcache_ops *cache_types[] = { > ®cache_rbtree_ops, > + ®cache_maple_ops, > ®cache_flat_ops, > }; > > diff --git a/drivers/base/regmap/regmap-kunit.c b/drivers/base/regmap/regmap-kunit.c > index 6f2bfa4650fe..3486bf9e28b8 100644 > --- a/drivers/base/regmap/regmap-kunit.c > +++ b/drivers/base/regmap/regmap-kunit.c > @@ -29,6 +29,7 @@ static const struct regcache_types regcache_types_list[] = { > { REGCACHE_NONE, "none" }, > { REGCACHE_FLAT, "flat" }, > { REGCACHE_RBTREE, "rbtree" }, > + { REGCACHE_MAPLE, "maple" }, > }; > > KUNIT_ARRAY_PARAM(regcache_types, regcache_types_list, case_to_desc); > @@ -36,12 +37,14 @@ KUNIT_ARRAY_PARAM(regcache_types, regcache_types_list, case_to_desc); > static const struct regcache_types real_cache_types_list[] = { > { REGCACHE_FLAT, "flat" }, > { REGCACHE_RBTREE, "rbtree" }, > + { REGCACHE_MAPLE, "maple" }, > }; > > KUNIT_ARRAY_PARAM(real_cache_types, real_cache_types_list, case_to_desc); > > static const struct regcache_types sparse_cache_types_list[] = { > { REGCACHE_RBTREE, "rbtree" }, > + { REGCACHE_MAPLE, "maple" }, > }; > > KUNIT_ARRAY_PARAM(sparse_cache_types, sparse_cache_types_list, case_to_desc); > diff --git a/include/linux/regmap.h b/include/linux/regmap.h > index 24fc4a9ed1f9..11b360da199d 100644 > --- a/include/linux/regmap.h > +++ b/include/linux/regmap.h > @@ -51,6 +51,7 @@ enum regcache_type { > REGCACHE_NONE, > REGCACHE_RBTREE, > REGCACHE_FLAT, > + REGCACHE_MAPLE, > }; > > /** > > -- > 2.34.1 >