Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp479887pxb; Mon, 8 Nov 2021 17:03:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxArD57Lzc6bHMILE3JNs4p86hdaubxbZAnpZJUv/+CSG4lOKKhKYZfhRwB2/u5BRi4bybx X-Received: by 2002:a05:6402:2791:: with SMTP id b17mr4565248ede.28.1636419812499; Mon, 08 Nov 2021 17:03:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636419812; cv=none; d=google.com; s=arc-20160816; b=X2sT4DmIYc95QFtlJ/SfXWrGVIbCD9bpeOlAwKi3GKZ/sFyiM7SXkKc5dAy6N7wW2v 1+CoK5Gw6B1ncq1yhvYLwjDbfGWZLQH7UccvH23v5UFbsYK24vrTIMrNRtlkuDkhO792 zY9eMU0dH4yCxcqzWwoDhQKb2REhkpbcH1FAhjO7eodq3G1L3ayr5u05bqMcC7fieXsh fdpULEJZLiKJ3uQwhFbK6jsPBRnirIyxIFkzCK9lHaeOJs+bRwCo2Ojjfc2IdLZL3Sx7 TjxLwSVHL+Lia2MZE2aRj7yKg/Rfv5LSlesGGCd9kzCThvkD5Pjs3OGBZhMv0buKSt0L afZA== 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=dLdQ0yIFYd1ygLhon2AAsMs+mSBj//ZL0dF1Yh8BgpI=; b=xjihTP3pwHfgAWa3iT0RfhuTe35Zao0yX4PiINg+g1U2lqWg+1qzeLeZAOxDQerht6 wJVh9dayGA2HH45HVNNd/W2G3PGTPMDmt0FSCFkeo/Pa1qyYIBCgB4aZTCmcBojipBeA 2mLdUL2mQMUtdzYho5Lbruby2k5j4LziDzLk9Vh8jjWebQB1INPNuZD+lrpiHinUbNbi DsFr3vPlTcFWZRZI3/WAsov5Dqst2rPsqECAZtrwACF1hXlmpyQNtGwlk0rAyCpdWtky 4aQ10FKP3hjyw0aaMR4texTrTR+wDvFTTcofEOIofWL8oRVAuS/EaEIMa+mnwefS4sxV qlWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=B+kuVTs4; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l7si28316197edi.523.2021.11.08.17.03.06; Mon, 08 Nov 2021 17:03:32 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=B+kuVTs4; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238503AbhKHUPi (ORCPT + 99 others); Mon, 8 Nov 2021 15:15:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:35982 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238492AbhKHUPh (ORCPT ); Mon, 8 Nov 2021 15:15:37 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4D2DF610FF; Mon, 8 Nov 2021 20:12:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636402372; bh=SLHrJGPlptWG4wM3hA+8zEcf0wasxqjylPj+dqMVE/Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=B+kuVTs44sfD1wvHblMCf/9H/IfoLhjrFvpCha3K/THzQc+sXWIUQnJQKR1eclV3f RZrNqHhqU5MeXh/XaBF1jAUv/rdZvfVVoBQcjOFV6ohJPyy7vj7ObvspcUZSiZlMq5 hWu1bFlv45h7fHwr2YZ50UQBXwvVO+YC/bumvF0ZweWW3yWwIcTZVe1AduSQcWCWzR sV4Vjmxu+t8O/ItggEHuDi0r+P7d0W33hVrjDo3tcgEsyTYjcBf+ld/KJ5vbpei1Ux RiTO670DtUvuMEJUXtVTxmr79KAm9PnYt5a9xjaqzSlpiCq8ehq16/OAO9INElmBa7 cL9I+BGKu2HXw== Date: Mon, 8 Nov 2021 22:12:50 +0200 From: Jarkko Sakkinen To: Reinette Chatre Cc: dave.hansen@linux.intel.com, tglx@linutronix.de, bp@alien8.de, mingo@redhat.com, linux-sgx@vger.kernel.org, x86@kernel.org, seanjc@google.com, tony.luck@intel.com, hpa@zytor.com, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] x86/sgx: Fix free page accounting Message-ID: References: <373992d869cd356ce9e9afe43ef4934b70d604fd.1636049678.git.reinette.chatre@intel.com> <6e51fdacc2c1d834258f00ad8cc268b8d782eca7.camel@kernel.org> <2a0b84575733e4aaee13926387d997c35ac23130.camel@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 08, 2021 at 11:48:18AM -0800, Reinette Chatre wrote: > Hi Jarkko, > > On 11/7/2021 8:47 AM, Jarkko Sakkinen wrote: > > On Sun, 2021-11-07 at 18:45 +0200, Jarkko Sakkinen wrote: > > > On Thu, 2021-11-04 at 11:28 -0700, Reinette Chatre wrote: > > > > The consequence of sgx_nr_free_pages not being protected is that > > > > its value may not accurately reflect the actual number of free > > > > pages on the system, impacting the availability of free pages in > > > > support of many flows. The problematic scenario is when the > > > > reclaimer never runs because it believes there to be sufficient > > > > free pages while any attempt to allocate a page fails because there > > > > are no free pages available. The worst scenario observed was a > > > > user space hang because of repeated page faults caused by > > > > no free pages ever made available. > > > > > > Can you go in detail with the "concrete scenario" in the commit > > > message? It does not have to describe all the possible scenarios > > > but at least one sequence of events. > > > I provided significant detail regarding the "concrete scenario" in a > separate response to Greg: > https://lore.kernel.org/lkml/a636290d-db04-be16-1c86-a8dcc3719b39@intel.com/ > > That message details the test that was run (the test hangs before the fix > and can complete after the fix), the traces captured at the time the test > hung, analysis of the traces with root cause of why the system is hung, > traces after fix applied demonstrating why user space is able to make > progress and explaining why the test can complete. For me that sequence looks like something that you could "abstract" a bit and get a rough description of the concurrency scenario. It is as important in this type of patch, as the code change itself, not least because it helps with maintaining in the future to have that info in some level of detail in the commit log. /Jarkko