Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp753539pxf; Thu, 18 Mar 2021 10:42:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwn3FB2MGM3xycwyQCKrQenIOkfvjiqrQdVK1oeJv0X25Ny05OGx+Twl788C2GfswqNuWIX X-Received: by 2002:aa7:c7d5:: with SMTP id o21mr5119473eds.166.1616089342908; Thu, 18 Mar 2021 10:42:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616089342; cv=none; d=google.com; s=arc-20160816; b=InsCLOdJRAo2YXMiCqTHdLN8bY5DBw0iyHGkHimjyf7Y+CbM/WJqMWZcia+WyztgAY aflOAzRo9wqZyDW/CGhxuAMmY7nMhYecOLq6DeAZcYENxKAjINAWbvNXH8lFOrROskL+ OrUc1Ig7OAbMXiNDhZD5wheVBbjEJcjPjIH+E/ii/mFP0XhZDs6LO302K43A2d6i9aq9 kXk5uHGL5u6FYs/yKDNgRNhp9CsV31NyodjX4a4I2ukjM41ikNMMNj1TkX7YA/kWmptd KLKTG23qp12K7Ao5qtV0URa/mr9uKLcHtyhk+xwbhBZEZ4HudRN9guNODkvM21mmT2AK bwQg== 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=5HUi4f5dejF+zrDWqEx6xSCL/wddRn6cotJCPEsJDjc=; b=ryUpEO0b/zmGsj0wBX69OYGEkTGUoIHbFIwnv6SNiWeMGkREemaPsv3LDGip6yKH4R jXc7SmZqk6J45ZWqdHbYah3j3xynrgEYe3VuxRvgIkouDU2hdO4gebkZtPocnbXQidpG E1hgfeDXhSH+jFna5a1cGegQTC0B7RczG9OAEnGvcGrBiQ27kwlJ7U4wRtaJk48+UIJV qgpVbhkqIdoPzuHyJhwmTO5ftn60WZjDl/Az3fJrPKu9BUS+2V3aF0uQiPK7gh8gTare JRyGpvspYIzOZZQLw8zJ5tbu9W60Pa5jxpMci13GdLuLqAf65qvs1HJunIW7+0IR4HU6 jhEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=MnvJO+hR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r11si1986478ejy.571.2021.03.18.10.42.00; Thu, 18 Mar 2021 10:42:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=MnvJO+hR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232256AbhCRRkn (ORCPT + 99 others); Thu, 18 Mar 2021 13:40:43 -0400 Received: from mail.skyhub.de ([5.9.137.197]:50794 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231952AbhCRRkf (ORCPT ); Thu, 18 Mar 2021 13:40:35 -0400 Received: from zn.tnic (p200300ec2f0fad00070f6d4b275c681b.dip0.t-ipconnect.de [IPv6:2003:ec:2f0f:ad00:70f:6d4b:275c:681b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 077CB1EC0249; Thu, 18 Mar 2021 18:40:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1616089234; h=from:from: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; bh=5HUi4f5dejF+zrDWqEx6xSCL/wddRn6cotJCPEsJDjc=; b=MnvJO+hRdyGGJWjcUH7ef8qvOmnp5N7CkLRWm0fMaAj8AEYXcaQ8YG1YUHanwbMTi8nrEF uJvBuzpW2Ccg6pZrGTvGB29D6zr08TifaTfPtWOKDJ/wPVFHSby1WBb0EzvvpjRk5yrFE/ fPikY0QsWlSvh8qW45Yavi4Sx4wzs4g= Date: Thu, 18 Mar 2021 18:40:32 +0100 From: Borislav Petkov To: Jarkko Sakkinen Cc: linux-sgx@vger.kernel.org, Jarkko Sakkinen , Dave Hansen , Thomas Gleixner , Ingo Molnar , x86@kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] x86/sgx: Replace section->init_laundry_list with sgx_dirty_page_list Message-ID: <20210318174032.GI19570@zn.tnic> References: <20210317235332.362001-1-jarkko.sakkinen@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210317235332.362001-1-jarkko.sakkinen@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 18, 2021 at 01:53:30AM +0200, Jarkko Sakkinen wrote: > From: Jarkko Sakkinen > > During normal runtime, the "ksgxd" daemon behaves like a version of > kswapd just for SGX. But, before it starts acting like kswapd, its > first job is to initialize enclave memory. > > Currently, the SGX boot code places each enclave page on a > epc_section->init_laundry_list. Once it starts up, the ksgxd code walks > over that list and populates the actual SGX page allocator. > > However, the per-section structures are going away to make way for the SGX > NUMA allocator. There's also little need to have a per-section structure; > the enclave pages are all treated identically, and they can be placed on > the correct allocator list from metadata stored in the enclave page > (struct sgx_epc_page) itself. > > Modify sgx_sanitize_section() to take a single page list instead of taking > a section and deriving the list from there. > > Signed-off-by: Jarkko Sakkinen > Acked-by: Dave Hansen > --- > > v5 > * Refine the commit message. > * Refine inline comments. > * Encapsulate a sanitization pass into __sgx_sanitize_pages(). > > v4: > * Open coded sgx_santize_section() to ksgxd(). > * Rewrote the commit message. > > arch/x86/kernel/cpu/sgx/main.c | 54 ++++++++++++++++------------------ > arch/x86/kernel/cpu/sgx/sgx.h | 7 ----- > 2 files changed, 25 insertions(+), 36 deletions(-) So both patches look ok to me but the sgx test case fails on -rc3 with and without those patches on my box: ./test_sgx 0x0000000000000000 0x0000000000002000 0x03 0x0000000000002000 0x0000000000001000 0x05 0x0000000000003000 0x0000000000003000 0x03 mmap() failed, errno=1. Box is: [ 0.138402] smpboot: CPU0: Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz (family: 0x6, model: 0x9e, stepping: 0xc) [ 0.693947] sgx: EPC section 0x80200000-0x85ffffff And AFAIR that test used to pass there... -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette