Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5562723pxv; Wed, 28 Jul 2021 13:48:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCE13GIRlBXSnVBm6Q+U19auyfruPsVHfRJarpeWQ5xxCaHkZMLjOEGYXAsB7NJLuNHo1E X-Received: by 2002:a17:906:c304:: with SMTP id s4mr1262051ejz.346.1627505335846; Wed, 28 Jul 2021 13:48:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627505335; cv=none; d=google.com; s=arc-20160816; b=cyEUEYdxFjfZIRamll9uJNDW2ToYNmCAXGHoCZnLzC54zX9kxhy+QPeJ6yMjOdoxKG VBhkOOUlkfjTpP2lOmziAGqglCD1qNqcLNrbAKHBtlzcGqX8cOOMq/lHtTiVAUhTW5n1 hZGZhsEUGpQS74ImagV9rw8jv2WRoc7ra4c4ivP5c9BlW9om/ySoEDpnb8VKvKH9Q/Ce oKxN6M0Rzkcttk2hbKXGN9c05NNyYj0hAJg9/iojvfDmlhxSX5Gu4KGV/eS0mTPlHzF0 jJxv2n6CPA4yVXaeErdLuOASJ9sjaf4vSz0mqddFgYHUtInw5mMBhNqPX9HSR0U7wRE5 LVfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=SJsRBE/YVTlxRaJ0gjysO9Xw1+zAC+no/2GKhkBND/U=; b=dwuiaCNd1Ea/Bj56W2oYU+XDZxJi16cHNE1OB1K83XbN+AtUEU5L5CriunFC33dXXS ioYRuHiuR1nmbL2mjEQMQjV2MXGpgHWmJ2M/kp+hAPkHPWmDvnQ1emexVG9L2LIQD+Qb RQxfAyp/sJQ7v91bah/vEsn3qym6/tpeuNiT7ewsKYA3aH/xClrnsTMYxPvzwQ986ANQ /mwbWJ33ZZh3aPjbUpE+wA+TVGIPlbjQwk8e3lw8Shdl17v2VigHNX2gnhpZwNNrgbDh f2LmcgHL3KaFGX9p+XBnes/4JItKN7nlVKu7b36McU3IWFm660Ehh8IZk+IOOvLJPeec JRHA== 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 nb41si920944ejc.167.2021.07.28.13.48.32; Wed, 28 Jul 2021 13:48:55 -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 S231732AbhG1UrM (ORCPT + 99 others); Wed, 28 Jul 2021 16:47:12 -0400 Received: from mga01.intel.com ([192.55.52.88]:60186 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231576AbhG1UrE (ORCPT ); Wed, 28 Jul 2021 16:47:04 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10059"; a="234634465" X-IronPort-AV: E=Sophos;i="5.84,276,1620716400"; d="scan'208";a="234634465" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2021 13:47:01 -0700 X-IronPort-AV: E=Sophos;i="5.84,276,1620716400"; d="scan'208";a="506679889" Received: from agluck-desk2.sc.intel.com ([10.3.52.146]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2021 13:47:01 -0700 From: Tony Luck To: Sean Christopherson , Jarkko Sakkinen , Dave Hansen Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Tony Luck Subject: [PATCH v3 7/7] x86/sgx: Add documentation for SGX memory errors Date: Wed, 28 Jul 2021 13:46:53 -0700 Message-Id: <20210728204653.1509010-8-tony.luck@intel.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210728204653.1509010-1-tony.luck@intel.com> References: <20210719182009.1409895-1-tony.luck@intel.com> <20210728204653.1509010-1-tony.luck@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Error handling is a bit different for SGX pages. Add a section describing how asynchronous and consumed errors are handled and the two new debugfs files that show the count and list of pages with uncorrected memory errors. Signed-off-by: Tony Luck --- Documentation/x86/sgx.rst | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Documentation/x86/sgx.rst b/Documentation/x86/sgx.rst index dd0ac96ff9ef..461bd1daa565 100644 --- a/Documentation/x86/sgx.rst +++ b/Documentation/x86/sgx.rst @@ -250,3 +250,29 @@ user wants to deploy SGX applications both on the host and in guests on the same machine, the user should reserve enough EPC (by taking out total virtual EPC size of all SGX VMs from the physical EPC size) for host SGX applications so they can run with acceptable performance. + +Uncorrected memory errors +========================= +Systems that support machine check recovery and have local machine +check delivery enabled can recover from uncorrected memory errors in +many situations. + +Errors in SGX pages that are not currently in use will prevent those +pages from being allocated. + +Errors asynchronously reported against active SGX pages will simply note +that the page has an error. If the enclave terminates without accessing +the page Linux will not return it to the free list for reallocation. + +When an uncorrected memory error is consumed from within an enclave the +h/w will mark that enclave so that it cannot be re-entered. Linux will +send a SIGBUS to the current task. + +In addition to console log entries from processing the machine check or +corrected machine check interrupt, Linux also provides debugfs files to +indicate the number of SGX enclave pages that have reported errors and +the physical addresses of each page: + +/sys/kernel/debug/sgx/poison_page_count + +/sys/kernel/debug/sgx/poison_page_list -- 2.29.2