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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49B46C433FE for ; Tue, 22 Nov 2022 09:10:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BD3986B0071; Tue, 22 Nov 2022 04:10:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B84056B0073; Tue, 22 Nov 2022 04:10:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A4D448E0001; Tue, 22 Nov 2022 04:10:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 971EC6B0071 for ; Tue, 22 Nov 2022 04:10:26 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 630B341014 for ; Tue, 22 Nov 2022 09:10:26 +0000 (UTC) X-FDA: 80160507252.12.84F4E98 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf01.hostedemail.com (Postfix) with ESMTP id 60C3C4000A for ; Tue, 22 Nov 2022 09:10:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=04mH2hDCkvHpLAW6koCu4FNsbF6qrp83kpM2X4j6UkE=; b=k9zuYNijeiPPZQgyzXcFeWVzjf 2kRDb8PjFNnE3rml8UaKa2fpc2ojYbhduPE/0bMcz9S3UjP4c3qRlLNCJKEGJdXarG9GScWgmn7Tt vRktddCb9AdXAYCNM16jwhdF0wkK9N5B1dQl4GAufPTiQP9Qx3OSqnQ22tmQyECNSjZBVjb+fnING x7igpnSIxEqEwPu7Fc+rSWOo0FI5GGRFCJ0Kv9/qjws+Kp5WirAQriU844RUHMwkuq+EEor4RTOoO GuTlt3CeDJ7Avm1OIUXK6L7KyYMtSxQcVgK6xlZ1raqY51Db6NnBU3mPRgFvHwl8eQghb987Yb0iB 14zkWEOA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oxPIR-00699A-NU; Tue, 22 Nov 2022 09:10:27 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 9DD45300282; Tue, 22 Nov 2022 10:10:20 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 835852D669367; Tue, 22 Nov 2022 10:10:20 +0100 (CET) Date: Tue, 22 Nov 2022 10:10:20 +0100 From: Peter Zijlstra To: Kai Huang Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, seanjc@google.com, pbonzini@redhat.com, dave.hansen@intel.com, dan.j.williams@intel.com, rafael.j.wysocki@intel.com, kirill.shutemov@linux.intel.com, ying.huang@intel.com, reinette.chatre@intel.com, len.brown@intel.com, tony.luck@intel.com, ak@linux.intel.com, isaku.yamahata@intel.com, chao.gao@intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, bagasdotme@gmail.com, sagis@google.com, imammedo@redhat.com Subject: Re: [PATCH v7 06/20] x86/virt/tdx: Shut down TDX module in case of error Message-ID: References: <48505089b645019a734d85c2c29f3c8ae2dbd6bd.1668988357.git.kai.huang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <48505089b645019a734d85c2c29f3c8ae2dbd6bd.1668988357.git.kai.huang@intel.com> ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=k9zuYNij; spf=none (imf01.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669108224; a=rsa-sha256; cv=none; b=tJwKhsl9SvAbLSSBo8kTq6+5aHPwFyIpH1G+VYkLLaYvJps5k8STFXOUzyMW1R4JtgwMMn 1hXfa+9oarXDwjz9LhAlXJ1gqamjATBfyKlxrPoWDodOmbT0xoeRTy0k+xZFVyT6cv7dxH l7hMx9r69M4j7sJgXqtGrgq3EeUSpOw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669108224; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=04mH2hDCkvHpLAW6koCu4FNsbF6qrp83kpM2X4j6UkE=; b=DjjWQ9k9ulhMaWCaGlfY0NgETA1YBHNdHPLsX6zGGvd4BbUti5KqgWHIBZohWj0vIRUTcA FhKJKoPelpPM2w30R8ekYGCtyvjVurRHv5qI61voVXiYpbRdvnuhMYjBm+d4us91Z+sgJJ k1lq1scov+jX5njjGEjseVmj7G7jb6s= X-Rspamd-Queue-Id: 60C3C4000A X-Rspam-User: Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=k9zuYNij; spf=none (imf01.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org; dmarc=none X-Rspamd-Server: rspam06 X-Stat-Signature: q5obgz3dujcibno87te1g7gjrxa9i49r X-HE-Tag: 1669108224-224395 X-Bogosity: Ham, tests=bogofilter, spamicity=0.003079, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Nov 21, 2022 at 01:26:28PM +1300, Kai Huang wrote: > +/* > + * Data structure to make SEAMCALL on multiple CPUs concurrently. > + * @err is set to -EFAULT when SEAMCALL fails on any cpu. > + */ > +struct seamcall_ctx { > + u64 fn; > + u64 rcx; > + u64 rdx; > + u64 r8; > + u64 r9; > + atomic_t err; > +}; > @@ -166,6 +180,25 @@ static int __always_unused seamcall(u64 fn, u64 rcx, u64 rdx, u64 r8, u64 r9, > } > } > > +static void seamcall_smp_call_function(void *data) > +{ > + struct seamcall_ctx *sc = data; > + int ret; > + > + ret = seamcall(sc->fn, sc->rcx, sc->rdx, sc->r8, sc->r9, NULL, NULL); > + if (ret) > + atomic_set(&sc->err, -EFAULT); > +} Can someone explain me this usage of atomic_t, please?