Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1507353pxp; Sun, 6 Mar 2022 17:34:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJyVJQvjoVVF+d/AUr6rn0W2ilvhGw1tfbYRfyy1YEaklERi+KRGeFjZOJOKyEC8/ZWyCKO0 X-Received: by 2002:aa7:ca04:0:b0:410:92a6:1a9e with SMTP id y4-20020aa7ca04000000b0041092a61a9emr9159449eds.411.1646616849299; Sun, 06 Mar 2022 17:34:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646616849; cv=none; d=google.com; s=arc-20160816; b=JyVYOdean2BxpWEmd6jJ8jxzyDiiB8YVYuxL59qPMP1r4Vs/t8sHjFDCrNz7f8QBtE ywmGDV0/NEQ+BC3Pampf/rBlumS/3NcLmkCTjkkA6JSX4QkRm9WhfxvzTEjML3Cr5PkH 8DbBA04hBYBuwUxfwtMhWi6GMGYytz9fglHlGqPGYXJzXEAPgGWifuonat505jvS6gYC 5u+xtWiJUA6uE4QL8HZoRN42A/iQ1e2Ahx/5bSlrPZDGgCQNljoXA7wX/VtuuuoM9DWt YM+kKRTtdNmXVSiqbQCUsR9RGNDuS4U8gzm8Ew2kHbHCQF1N981fs2Q7RRwwFu47FK1L DBeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0bjH8VO4KlomOVuZSk7B7dtxiMVWFTHxERsjo5nCkyE=; b=qgO/UhtYwuhW7PWbWq9IByqSJrjSiz82FNjcoTVfP2aOOEDI8xqABZLf97FqLNkUlk cJLpjiiK7YtdSvSdSXnmVxkTJRuiV6LfN2JgvwgocT+4YtBvWxr32AEbvoXoQUViWQzZ BXJutuX+Ov9tOpPtzwVKgf6uDFtKka0PqTFstXno9iI7zh0FCFOiTXIJhUd4tB0/Boxw ev+JU96RObjlvhkgxhTa3/iKGZIwiH9+V6aZkBQprOwSHFDEXHp7nDT63Gm6Nj8LKY1c KZeTWt1Uh8lw4R8h3vAikirr96D+W8SROMFi2aS0wMaBhADjvczsd4vv8WEmncJfYMpK U0oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QXV9fKVC; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y9-20020a056402270900b00415d562b739si8152930edd.98.2022.03.06.17.33.32; Sun, 06 Mar 2022 17:34:09 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=QXV9fKVC; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231217AbiCFARD (ORCPT + 99 others); Sat, 5 Mar 2022 19:17:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229752AbiCFARC (ORCPT ); Sat, 5 Mar 2022 19:17:02 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F8EE36B6B; Sat, 5 Mar 2022 16:16:12 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DE95960EC8; Sun, 6 Mar 2022 00:16:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF420C004E1; Sun, 6 Mar 2022 00:16:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646525771; bh=fRzblLoTU0IIepSzyJUSFHl7AXMCwFYni+g4JkSYhbg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QXV9fKVCKfPzG9vF33d7AEPx1yP3YesqHNp08TJJc2sL8HfLEXA/XzmXHNh+A+sLB gwuoW6jbm1JS+gms6qn2NrNlXfKZl0MAS1fEtV2fZW6Wlrhe0nf6itzIud25uuxnKJ CCA1n/BCF4a+e7+JoFap54ZyxIrCxCCg1DXcSYjaLKLKvRTG7RqF/wYQ5N2xZrbkaG jAyhus3BL7L7QynDTZ2uxFs7Y5/8sLjMtOX3GTUr/4v2VaWUhl1phIpM/Yg7B9+a+Z axIMqCx6vpEIOK3PcFQmIk3LQUPPbl30kzigbwpc+VnhEdl1LTl6+IVvQpm+rBbzwZ pobOlAh8xYGrQ== Date: Sun, 6 Mar 2022 02:15:29 +0200 From: Jarkko Sakkinen To: Dave Hansen Cc: Reinette Chatre , Haitao Huang , "Dhanraj, Vijay" , "dave.hansen@linux.intel.com" , "tglx@linutronix.de" , "bp@alien8.de" , "Lutomirski, Andy" , "mingo@redhat.com" , "linux-sgx@vger.kernel.org" , "x86@kernel.org" , "Christopherson,, Sean" , "Huang, Kai" , "Zhang, Cathy" , "Xing, Cedric" , "Huang, Haitao" , "Shanahan, Mark" , "hpa@zytor.com" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH V2 16/32] x86/sgx: Support restricting of enclave page permissions Message-ID: References: <2d2d3471-78ce-9faa-daf6-138078f5ffaa@intel.com> <6f65287a-f69c-971e-be2c-929e327e7ff9@intel.com> <19155cab-ecff-a8a6-f724-98c4535642ef@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Sat, Mar 05, 2022 at 05:19:24AM +0200, Jarkko Sakkinen wrote: > Sorry, I missed this. > > On Thu, Mar 03, 2022 at 01:44:14PM -0800, Dave Hansen wrote: > > On 3/3/22 13:23, Reinette Chatre wrote: > > > Unfortunately MAP_POPULATE is not supported by SGX VMAs because of their > > > VM_IO and VM_PFNMAP flags. When VMAs with such flags obtain this capability > > > then I believe that SGX would benefit. > > > > Some Intel folks asked for this quite a while ago. I think it's > > entirely doable: add a new vm_ops->populate() function that will allow > > ignoring VM_IO|VM_PFNMAP if present. > > I'm sorry what I don't understand what you mean by ignoring here, > i.e. cannot fully comprehend the last sentece. > > And would the vm_ops->populate() be called right after the existing ones > involved with the VMA creation process? > > > Or, if nobody wants to waste all of the vm_ops space, just add an > > arch_vma_populate() or something which can call over into SGX. > > > > I'll happily review the patches if anyone can put such a beast together. > > I'll start with vm_ops->populate() and check the feedback first for > that. I would instead extend populate() in file_operations into: int (*populate)(struct file *, struct vm_area_struct *, bool populate); This does not add to memory consumption. BR, Jarkko