Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp5082010pxv; Tue, 6 Jul 2021 17:15:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfh4llu6hEKro4bfJmFuGm6/h7OcoRVufuVqwHMsohRaP/j174uFfOLou9iKKeV5A/RiMM X-Received: by 2002:a17:907:162a:: with SMTP id hb42mr13524854ejc.147.1625616934642; Tue, 06 Jul 2021 17:15:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625616934; cv=none; d=google.com; s=arc-20160816; b=IuQ+I/M80aHbXdHhWr8GOm4s765ZjRByVkvkSI9zuaUKWms2sgoI+O6ROzbL0FEuxT HSTXXvJO/L97GTDdnqCXAoNCHT3hr9d9EWRpBhH/Pv/LfcAhJBN9AGDz8ndMejnUnYy6 o5ifZrEybIs4bmjtBRWJVGmCr47YU22kUzkpUZ35l2TJEFLb68hIrph8oahGSDBuqPzg w9T4XqFNQANcsJtEwE6sJPejbs5uyDrfLmtiHNXhhtvQP4ok35Ffz/bFPWcWC3+kcYcf M17rshJzGLnq4Zgh5EIc/KVjjt9mIoE9xEVf8iN7PbLTO0Omsmqwo65Y1BglI/ea8jop 4uoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=+DDol8v7PS4irLceM2BdB9xIARMURPJexX35wfkR+CY=; b=djcIPR18KyhfDHbK8Rd5KD+OxgXXO/t2YRMOaNSgpmweG/CwJ6Ir7beuIf3mza01AP 8Am39hcGYXjCa5sWc3wGu1EfTFc3cjPAxTWbvXfZmTlgwOXaKXoC86/HqYTyyy5BEdXX 9YKCpVGio+5wxma6+rkOIA61hGg9dIa+EjWZLlY5PQ4DZsNQjYsMC7EZ5S3VBLAFaHsO iR1DvlAh8t09ndAv5YjAKSGESYUmxqgGyNmPS8y0MGQieE2Rl8nygFqTUeVAMhi+EZrI MI9Sgib628DArc8MfhhLiiKRBTWsc8uAwrcQ/BgT6KnQLIMgwDk91bHT1hOVJ8edVyQi nCcQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nb19si20076946ejc.197.2021.07.06.17.15.11; Tue, 06 Jul 2021 17:15:34 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229919AbhGGAN3 (ORCPT + 99 others); Tue, 6 Jul 2021 20:13:29 -0400 Received: from mga11.intel.com ([192.55.52.93]:26019 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229834AbhGGAN3 (ORCPT ); Tue, 6 Jul 2021 20:13:29 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10037"; a="206204168" X-IronPort-AV: E=Sophos;i="5.83,330,1616482800"; d="scan'208";a="206204168" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2021 17:10:40 -0700 X-IronPort-AV: E=Sophos;i="5.83,330,1616482800"; d="scan'208";a="457255424" Received: from rchatre-mobl3.amr.corp.intel.com (HELO [10.252.132.138]) ([10.252.132.138]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2021 17:10:39 -0700 Subject: Re: [PATCH 4/4] selftests/sgx: Trigger the reclaimer and #PF handler To: Jarkko Sakkinen Cc: Shuah Khan , linux-kselftest@vger.kernel.org, linux-sgx@vger.kernel.org, Borislav Petkov , Dave Hansen , linux-kernel@vger.kernel.org References: <20210705143652.116125-1-jarkko@kernel.org> <20210705143652.116125-5-jarkko@kernel.org> <715ed555-5044-6fee-1d09-1c4cfa827af3@intel.com> <20210706235016.uucukyrr3ckk57pi@kernel.org> From: Reinette Chatre Message-ID: <16505466-e001-c4b0-ec41-5384ddcf194b@intel.com> Date: Tue, 6 Jul 2021 17:10:38 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210706235016.uucukyrr3ckk57pi@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jarkko, On 7/6/2021 4:50 PM, Jarkko Sakkinen wrote: > On Tue, Jul 06, 2021 at 11:34:54AM -0700, Reinette Chatre wrote: >> Hi Jarkko, >> >> On 7/5/2021 7:36 AM, Jarkko Sakkinen wrote: >>> Create a heap for the test enclave, which has the same size as all >>> available Enclave Page Cache (EPC) pages in the system. This will guarantee >>> that all test_encl.elf pages *and* SGX Enclave Control Structure (SECS) >>> have been swapped out by the page reclaimer during the load time. Actually, >>> this adds a bit more stress than that since part of the EPC gets reserved >>> for the Version Array (VA) pages. >>> >>> For each test, the page fault handler gets triggered in two occasions: >>> >>> - When SGX_IOC_ENCLAVE_INIT is performed, SECS gets swapped in by the >>> page fault handler. >>> - During the execution, each page that is referenced gets swapped in >>> by the page fault handler. >>> >> >> If I understand this correctly, all EPC pages are now being consumed during >> fixture setup and thus every SGX test, no matter how big or small, now >> becomes a stress test of the reclaimer instead of there being a unique >> reclaimer test. Since an enclave is set up and torn down for every test this >> seems like a significant addition. It also seems like this would impact >> future tests of dynamic page addition where not all scenarios could be >> tested with all EPC pages already consumed. >> >> Reinette > > Re-initializing the test enclave is mandatory thing to do for all tests > because it has an internals state. > Right, but not all tests require the same enclave. In kselftest terminology I think you are attempting to force all tests to depend on the same test fixture. Is it not possible to have a separate "reclaimer" test fixture that would build an enclave with a large heap and then have reclaimer tests that exercise it by being tests that are specific to this "reclaimer fixture"? Reinette