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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1BE9C433FE for ; Fri, 15 Oct 2021 23:10:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3FD6F61151 for ; Fri, 15 Oct 2021 23:10:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3FD6F61151 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id DE9BA900002; Fri, 15 Oct 2021 19:10:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D99F96B0072; Fri, 15 Oct 2021 19:10:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C62C5900002; Fri, 15 Oct 2021 19:10:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0127.hostedemail.com [216.40.44.127]) by kanga.kvack.org (Postfix) with ESMTP id B8BB66B006C for ; Fri, 15 Oct 2021 19:10:38 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 6FEFE1824194A for ; Fri, 15 Oct 2021 23:10:38 +0000 (UTC) X-FDA: 78700218156.28.A39FA2D Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by imf08.hostedemail.com (Postfix) with ESMTP id A006630000AA for ; Fri, 15 Oct 2021 23:10:36 +0000 (UTC) Received: by mail-pj1-f47.google.com with SMTP id ls18so8215583pjb.3 for ; Fri, 15 Oct 2021 16:10:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=oR3LCNmabVt3R+J20wC8aHIgyaKVLMjkgQ5/1xBnfBM=; b=SwzeqJEzN9tuw+lfOKLKPhITPNCkjVdSdbgIVfa3RAy9hIPkksKfXLkqTjB3mOY31h tEiNu31TiSyYHKxqDy5HyCbqtJWNeJih6BqXYYkJZOXK0cGXoTtDanmy/94r1RynCIgc 407/2Fmyp+dpsjNRFicwfIkGs7aoKIx+KSpdzMsG6BNBAScwrxRLjhSGbWyP6FTwFyPT v7aYXr/P7h99WqcE/YeBM07oCuKU9Xva2MnYG5whSp6q7qBL97G88qE7KL2vGn4Svoc1 n6qAhBUm130u0ZAcCZMq0rolY7yMN7ZAVWDZS7Py1o0xBwtjIa2VygJtQ5GXkgfEd6wj 6mog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=oR3LCNmabVt3R+J20wC8aHIgyaKVLMjkgQ5/1xBnfBM=; b=74oaGiDSV+Ax/dix7dH5IlT6SJdwRZIYX/+Ii7rwEySPcFmerkRWEgLeszEnkwDR1/ xq7ty4TTp/WPlDh9J7m8aGFkcN3HclGqzzI6Yv0RVdxjAjuc/yp9HyPTG4CD0ZZukcJW CEErvXfMou5lAsU8D3a1b5vptoNPMBWfo73sltANh17vK0cKkbPrNoF1KyZ064DjBiIF RzvK4jK/GIaNm/nCzytuPemYTcHyxc2FV9BkFc+ILwIdH4S/wCVwSasIeej5rO3Ykjrj 5oC1cgZOPBoa6wMXSllXFPKfsiqJGkbXk/F7EAGSiU10udmUcwSq4GEGwDSdPWBNAa3W HQEw== X-Gm-Message-State: AOAM530JK9SvrRq5bGjniyZMBxNd1kttEW7j2maKEFcrH+PZaJbIKBMF /FrptuiH3KywqfbhStVQHx6bPw== X-Google-Smtp-Source: ABdhPJwRJpfl2xcybfh60dYvU+59Xfc+ZYtjllm6Qmewk7zE1CxBc6njnYyskqxdV2ZXwkCi3QonbQ== X-Received: by 2002:a17:90b:33c3:: with SMTP id lk3mr16668019pjb.237.1634339436901; Fri, 15 Oct 2021 16:10:36 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id x17sm5688323pfa.209.2021.10.15.16.10.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 16:10:36 -0700 (PDT) Date: Fri, 15 Oct 2021 23:10:32 +0000 From: Sean Christopherson To: Tony Luck Cc: "Rafael J. Wysocki" , naoya.horiguchi@nec.com, Andrew Morton , Jarkko Sakkinen , Dave Hansen , Cathy Zhang , linux-sgx@vger.kernel.org, linux-acpi@vger.kernel.org, linux-mm@kvack.org, Reinette Chatre Subject: Re: [PATCH v9 4/7] x86/sgx: Add SGX infrastructure to recover from poison Message-ID: References: <20211001164724.220532-1-tony.luck@intel.com> <20211011185924.374213-1-tony.luck@intel.com> <20211011185924.374213-5-tony.luck@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211011185924.374213-5-tony.luck@intel.com> X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: A006630000AA X-Stat-Signature: wi88nrzc5mjfnxhcfdef4nq3epawp9os Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=SwzeqJEz; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf08.hostedemail.com: domain of seanjc@google.com designates 209.85.216.47 as permitted sender) smtp.mailfrom=seanjc@google.com X-HE-Tag: 1634339436-642417 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000222, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Oct 11, 2021, Tony Luck wrote: > + section = &sgx_epc_sections[page->section]; > + node = section->node; > + > + spin_lock(&node->lock); > + > + /* Already poisoned? Nothing more to do */ > + if (page->poison) > + goto out; > + > + page->poison = 1; > + > + /* > + * If flags is zero, then the page is on a free list. > + * Move it to the poison page list. > + */ > + if (!page->flags) { If the flag is inverted, this becomes if (page->flags & SGX_EPC_PAGE_FREE) { > + list_del(&page->list); > + list_add(&page->list, &sgx_poison_page_list); list_move(), and needs the same protection for sgx_poison_page_list. > + goto out; > + } > + > + /* > + * TBD: Add additional plumbing to enable pre-emptive > + * action for asynchronous poison notification. Until > + * then just hope that the poison: > + * a) is not accessed - sgx_free_epc_page() will deal with it > + * when the user gives it back > + * b) results in a recoverable machine check rather than > + * a fatal one > + */ > +out: > + spin_unlock(&node->lock); > + return 0; > +} > + > /** > * A section metric is concatenated in a way that @low bits 12-31 define the > * bits 12-31 of the metric and @high bits 0-19 define the bits 32-51 of the > > -- > 2.31.1 >