Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp167616rwb; Thu, 6 Oct 2022 16:25:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6w5L4FKh8K+YPcVLjPFNtpFsTBpEBDxz3pBc8CPwHQxsvgVb7NV+lYF+U/kDhEJs25sf6L X-Received: by 2002:a05:6402:538a:b0:457:b602:d5a6 with SMTP id ew10-20020a056402538a00b00457b602d5a6mr2006038edb.371.1665098755789; Thu, 06 Oct 2022 16:25:55 -0700 (PDT) Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz11-20020a1709077d8b00b007413b206b16si858691ejc.843.2022.10.06.16.25.30; Thu, 06 Oct 2022 16:25:55 -0700 (PDT) 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=@intel.com header.s=Intel header.b=da7lUH1B; arc=fail (signature failed); 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232330AbiJFXRw (ORCPT + 99 others); Thu, 6 Oct 2022 19:17:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232308AbiJFXRt (ORCPT ); Thu, 6 Oct 2022 19:17:49 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B485CAE51; Thu, 6 Oct 2022 16:17:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665098269; x=1696634269; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=Qh+BIREdPjwB4pdSJ1JIt5PnaRlyIZMvNj7GrQg0fO0=; b=da7lUH1B+aBwJUhjgx4RS+Q1pRM4Ltn1SOIlPuvraQqT/PI5HRWsJug9 hEwncgrSOC3LLipVC5YR2R4OKUlV0DJ3ShaSmpi530uidLTaX6mpIdBXI /SFXF1EvrCrY0oBHBIQyoDR5YambJ/fUppLpCqzW1E4hdm09VbRFR3xu2 BO/T1K71TfbxFd1OD+AnlHsU6oxwBtr+Q/Q7p7Rgwh86cXuOtiQhZ3DOt Hk4ztnXkzY4eZHJjNmWn/bfimsEYJGjAhhpAa12ZNl6ye5b7537nsdEND U1Nn/JmTB2KqzssF+XUvfgXxK1Muh0nFT8AyBYorfGwNfKIff7slfoxbq g==; X-IronPort-AV: E=McAfee;i="6500,9779,10492"; a="389892204" X-IronPort-AV: E=Sophos;i="5.95,164,1661842800"; d="scan'208";a="389892204" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Oct 2022 16:17:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10492"; a="576020476" X-IronPort-AV: E=Sophos;i="5.95,164,1661842800"; d="scan'208";a="576020476" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga003.jf.intel.com with ESMTP; 06 Oct 2022 16:17:47 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 6 Oct 2022 16:17:47 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Thu, 6 Oct 2022 16:17:47 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.173) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Thu, 6 Oct 2022 16:17:46 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=boF3PM95OLwwFznLhQG34eMX8T4vFO3Dtt8N6saQwHQU+iVd6LJWQ6j++HIh7PfzKRfc6Ifhgn5bWFMe6jWxf+/x/bcaNByaafsIZah+N3oeklabB/JphFOy1sHzIiDDD9rdgMA3HbTbsPxhfsa5q5iUAJeFDQmoumVqdgyHc+d2gyEe4LUyURzqfd2zQQyGXChR37aE/ur/3nrKt2SarrJqf54+KhiUnyK40unv9MZynJAqgWDMbX9yoJwKflmnuN96qlgUAmD94eSoAUhWEvLDDfT6dJ2GqnRM7wQY9Rjg3pGpRP96JYuQinIf1iv6RDwfOt9XSIKobv7Q/VOMdQ== 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=t/HyKqVRnbrrXTLGDyD8WmIU1OsAOf0OfLKAEbuAKC4=; b=bJLv5xqR+uMdFNhYpTQ5ikF2QudU5cEEMWQabtNzxYM6y0x1wThyTwNe9VuPHYXDmOusDFm+kzj8LbLbbchIPlSm/awbraqUcYfzYtYAZEBbIJNUP3FnWlBneMDlb+zCQ6xxVnwU8eRLw4yEDHdPkVBkR0hiD9m2qvYC87XUJE7Mxrv5bVCd0jvqJGWIj7otrd6Qwqbvosxmg7bK6usNVHB4WmZbwAf2UmigeM5rgN2T5BXva7M1kA4OIOr+q4c0MI10T8vCJ/YuPFjPSH73GVUoDqcNBTliRkj1QEAnvekT57I3tKaDyTV1YGUQ1HFhW9Gk0+XOJUw7e1/g+qs+mw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from SA1PR11MB6733.namprd11.prod.outlook.com (2603:10b6:806:25c::17) by CY5PR11MB6234.namprd11.prod.outlook.com (2603:10b6:930:25::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.34; Thu, 6 Oct 2022 23:17:44 +0000 Received: from SA1PR11MB6733.namprd11.prod.outlook.com ([fe80::6f83:c165:aa0c:efae]) by SA1PR11MB6733.namprd11.prod.outlook.com ([fe80::6f83:c165:aa0c:efae%6]) with mapi id 15.20.5676.032; Thu, 6 Oct 2022 23:17:44 +0000 Date: Thu, 6 Oct 2022 16:17:39 -0700 From: Ira Weiny To: Dave Hansen CC: "Fabio M. De Francesco" , , , Jarkko Sakkinen , Dave Hansen , "Thomas Gleixner" , Ingo Molnar , "Borislav Petkov" , , "H. Peter Anvin" , Kristen Carlson Accardi Subject: Re: [PATCH] x86/sgx: Replace kmap/kunmap_atomic calls Message-ID: References: <20220929160647.362798-1-kristen@linux.intel.com> <3694452.kQq0lBPeGt@mypc> <8124835.T7Z3S40VBb@mypc> <3dfccc80-e089-4915-d57e-96d26b237182@intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <3dfccc80-e089-4915-d57e-96d26b237182@intel.com> X-ClientProxiedBy: BY5PR04CA0018.namprd04.prod.outlook.com (2603:10b6:a03:1d0::28) To SA1PR11MB6733.namprd11.prod.outlook.com (2603:10b6:806:25c::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA1PR11MB6733:EE_|CY5PR11MB6234:EE_ X-MS-Office365-Filtering-Correlation-Id: 5f6d642b-fae9-410c-209f-08daa7f0f95b X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Um+luB2ZQQfRCNKpYk8RzZ2dKgiQP0CdrahKWf+yYJab/z5aZMlB69CzG077zOpDZQ7qR2vrCy1O2SCOX7aFCeBmp6D5sFscVsSAyh0KZn1sw3bebIZJP+eLxSmx3K9d313BpcdJ+aEdeAKz6SOd9P2z/mOe4KF8zfP+lg93am/R6OkUJ29a/USiGgiZG8NJc2Fb8dWK8NX6c2TJO6rt6+MhZLDEpmx9gJ99PT7Vy7hL4fmLyw71OReNNfYAtUXwE0Ej7ymvt+5zE0Mx65sovt7pLAprt4JB46AtAVQEH7srk/xBF9QSKVLMGje5n886X2kUZiQ1tBi3TPUFsRnzMeL8gNNt+YwCu8kkjvZelQOPaD8mO372ZRl6aeEE1ExuUmc/yWQTFiCel4xB2Oadfhn/IyvPTHA1kpZeAecA2IOKLqxxb9oi9sOAhFFZ/izSEPb1RsfWPfc6Uy5ZMYpX9FC6ghF4y4avM5R4S2dH7fKZl2U85+WMbQ9avLYCxjvUBJCEy/UBAkxuQeMRUA2R2fpNdX/PkW5dWa+rNVx+mG1hGreGa5zC0dDVnHoNbQAIbshKPquhmqACT6NMvo7WYzozi5PV9dHKT/BuStvnRTwdi8MB8wGn0gHOpom4Dr1WvknMrDrzPcNpSOIiez05110XSJx/KyV6TzNLonXlIrd7JpHHSEj+2Kgq0814bOl/yTgrufPG955w07oojR5J3A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR11MB6733.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(7916004)(366004)(396003)(136003)(346002)(39860400002)(376002)(451199015)(54906003)(6636002)(316002)(86362001)(8936002)(6862004)(7416002)(5660300002)(2906002)(66556008)(66946007)(44832011)(66476007)(41300700001)(4326008)(8676002)(186003)(53546011)(33716001)(6506007)(6512007)(6666004)(478600001)(9686003)(6486002)(82960400001)(38100700002)(26005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?m3F0YT10b0zy92/dcgBQMvo328vyp5GJff2M8yADvQVKRQhe2QEQoyvFxtwu?= =?us-ascii?Q?FA9iBJXWlcRw594bV57vTVdb8PodLs5Pr6V/jwBHxCMT0XGtAVO8OyASE900?= =?us-ascii?Q?I5/X4CgG6RhTIazQV6hUp/ZHMEbTxDbNqkERFEwFggvxmSAwXQ6m/rCJVcCu?= =?us-ascii?Q?VwDXSQm6yxAATb5qFKbnwAYLtvwBvVW1ApDTRV6Xx6VMkbIf6EP1n2wIWy6w?= =?us-ascii?Q?wJDqnEWWkT5ch80De/TEXERQAJsw7icN9rmN62AZPgi8CnpAegPSY/KEIPZP?= =?us-ascii?Q?8VTfaQ7Zjdn4nNXhUH+rcngGsVs8aydAdcDIEHrJRmcW8d0XffA/x7bDVCze?= =?us-ascii?Q?GY5HZRl0tHE+OtkuZpTkyC+j2ugz5sLvlyvIo3M9rbf233SeMD7WMUcrO5mn?= =?us-ascii?Q?duOgla5QF7ZgLKmtWzDL8lGSEWcuoej2ghr/ph10724A7uoLwH+od8AgSx5r?= =?us-ascii?Q?3TxHc2o2CX4HqO1LTK4MOJjgjZjspJ/2yIycfgOXTL5peQ3vvwshF6rkxj+f?= =?us-ascii?Q?63CB9/qypWONFwqlqOUQs7ilG3gVxar6h37lkT8G3jOQ9JNhKkkeNhy1WU6f?= =?us-ascii?Q?MFtBeylCAunkUXeEa0B88ucpi0DsHL2rrHZKsNd6a3zVFxUaDa8I7VwVD8Ot?= =?us-ascii?Q?0ts1qNyWk0juKTc2L4o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?= =?us-ascii?Q?gueshDuzb/gsveWuYrD7lnYDX9HRVwUB3pnry3Oi?= X-MS-Exchange-CrossTenant-Network-Message-Id: 5f6d642b-fae9-410c-209f-08daa7f0f95b X-MS-Exchange-CrossTenant-AuthSource: SA1PR11MB6733.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2022 23:17:44.5266 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2D9FgN1ZfPU/P6TZH7NckwbanfYOI7xACdCVZrVm1tfO9rQiG0dsVOyRD/7kTOPLuyzC83bKYwu+YJf9OkAFDQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR11MB6234 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 On Thu, Oct 06, 2022 at 03:29:35PM -0700, Hansen, Dave wrote: > On 10/6/22 15:02, Fabio M. De Francesco wrote: > > On Thursday, October 6, 2022 10:45:56 PM CEST Dave Hansen wrote: > > Am I still missing anything fundamental? > > Yes. :) > > kmap() users can sleep. That means the number of them that you need to > keep around is unbounded. kmap_atomic()'s fundamentally can't sleep so > you need fewer of them. That means that when you kunmap_atomic() you > can use a simple, fast, CPU-local TLB flushing operation. kunmap() > eventually requires a big fat global TLB flush. > > So, you're right. On lowmem-only systems, kmap() *can* be cheaper than > kmap_atomic(). But, on highmem systems there's no contest: > kmap_atomic() is king. > > That's why kmap_atomic() is and should be the default. But in the last few years optimizing lowmem systems has been the default. Few care about the performance of highmem systems. Given that we don't want to ever use kmap() nor kmap_atomic() going forward I think this discussion is purely academic. Ira