From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E20CEEB64DD for ; Tue, 18 Jul 2023 21:36:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229889AbjGRVg6 (ORCPT ); Tue, 18 Jul 2023 17:36:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbjGRVg5 (ORCPT ); Tue, 18 Jul 2023 17:36:57 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB3D9C0; Tue, 18 Jul 2023 14:36:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689716216; x=1721252216; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=1BDw+qUZlFSHxjhbgyBlkEgjL+F0zoRSb4egK/Yp7FI=; b=jJC08jRYLMdM+gxKn5rcJ9uVs6X8fknO/wjmQDHvvzQbAxAA5/t2VBPn hlBFgEHhL9D3vaU4bd/UqI1EHcZauxxqyy72579xeRGChRouZ0/7watek u8mTdvoLNllveXneHr4+jIfuzIsEu7Zs1IVw/ALqAGs/Q0jge14vh4kyM jGs5+H8Qw91v27JWKL1hHjrMeSKVXjrXv7sccfU7ANWk9uCSspzl2azIX 3Rk+7aHuy2UNAxE3Ix+asuSn8nGRrJF8kcrzIzhyhMupoPB+F/AY8HIpF ba8YexXrNOqwOkxDHWxW8ZG9NkoW5t/YrXp8lWRDvVRODrTIcVuhOB/sj g==; X-IronPort-AV: E=McAfee;i="6600,9927,10775"; a="432500416" X-IronPort-AV: E=Sophos;i="6.01,215,1684825200"; d="scan'208";a="432500416" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jul 2023 14:36:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10775"; a="1054464383" X-IronPort-AV: E=Sophos;i="6.01,215,1684825200"; d="scan'208";a="1054464383" Received: from unknown (HELO [10.209.37.195]) ([10.209.37.195]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jul 2023 14:36:54 -0700 Message-ID: Date: Tue, 18 Jul 2023 14:36:53 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH] x86/sgx: fix a NULL pointer Content-Language: en-US To: Haitao Huang , Jarkko Sakkinen , dave.hansen@linux.intel.com, linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" Cc: kai.huang@intel.com, reinette.chatre@intel.com, kristen@linux.intel.com, seanjc@google.com, stable@vger.kernel.org References: <20230717202938.94989-1-haitao.huang@linux.intel.com> From: Dave Hansen In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-sgx@vger.kernel.org On 7/18/23 14:22, Haitao Huang wrote: > I agree this is the race. But for this to happen, that is at #1 you have > only one non-SECS page left so #3 can happen. That means it is already > high pressure I think our definitions of memory pressure differ. Pressure is raised by allocations and dropped by reclaim. This raise->drop cycle is (or should be) time-limited and can't take forever. The reclaim either works in a short period of time or something dies. If allocations are transient, pressure is transient. Let's say a pressure blip (a one-time event) comes along and pages out that second-to-last page. That's pretty low pressure. Years pass. The enclave never gets run. Nothing pages the second-to-last page back in. A second pressure blip comes along. The SECS page gets paged out. That's two pressure blips in, say 10 years. Is that "high pressure"? > because reclaimer has swapped all other non-SECS. > In my example of two enclaves of 5 non-EPC pages. #3 won't happen > because you don't reach #1 with only one non-SECS left.