Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5596618rwb; Tue, 22 Nov 2022 02:09:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf7+v86KV+IuxgFeY0LVGts2yV0PVa4+MtfitUZZd4LQ9gmaznvfTS54BDTs8xpFrRd53JUH X-Received: by 2002:a63:1942:0:b0:46f:7b0d:3602 with SMTP id 2-20020a631942000000b0046f7b0d3602mr3329325pgz.143.1669111754734; Tue, 22 Nov 2022 02:09:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669111754; cv=none; d=google.com; s=arc-20160816; b=iEqc8EGEA0TRTHcs6cBm6B2NyBvrHCS9NbLpUbaaJT3JbRKJCqFtXrEbV+A9Ee/adg znf7b/0tHyM/lEB585s3QcJDkICUJo5bU/fLJ56QlA/8LaMCfU8qEPwD72CgeNqUIZ3O BFPcfQ6Kch0tarxsFe3KCTZsVdZDxqeuoVCfrfgxXVPzZjipBkUCPqPswvu5q6iDTcGa HjJQfblsUxBRZxgYrJKG5zM22kSTrN+5vWpoSxhLCl7vUZ2f0+n9kFdd9m9EQJMJyFuz GxdIMV+vaD3gLfwNWn5S1eiUvRu5MpzrmZUobaP9ovSHwn45w6o8a8IkXPJk0vGYuKE7 WRhA== 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=04mH2hDCkvHpLAW6koCu4FNsbF6qrp83kpM2X4j6UkE=; b=db0KfiYWHmvBoJO58Q5c6bg6diXfozJEU5DSt0PbluoZzGuDl+MBaSJtj/hMz8pQ1P bLAGH8HV+59VRvb+zGcs0u1ULw6H74Q/xq/ZeDGZZ5deweiCTkZzQErCyYxd21XqG/F2 bNj4d6IoBaJWESjy0KWH7QZmUsCwEn0Z9EXXIOuE5ro6tQOnd2sILw+hdn1jXZO6Gd7d Yhoh5MEGWrvWq0znvAIbRMG6m8bmwT6iEVTm47smMELUjM7S5BoweeB/ziy/kGxrZE6w am2Fcp2iEoqvd+s/DrZ0SHcRYNEh3NmvswvdHYV8TCq40kaEY/L5T+KH4OFkX+xEXUGk AMtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=k9zuYNij; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i64-20020a638743000000b004767bc460a2si1115974pge.520.2022.11.22.02.09.02; Tue, 22 Nov 2022 02:09:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=k9zuYNij; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233260AbiKVJKx (ORCPT + 91 others); Tue, 22 Nov 2022 04:10:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233148AbiKVJKe (ORCPT ); Tue, 22 Nov 2022 04:10:34 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 451F618B13; Tue, 22 Nov 2022 01:10:33 -0800 (PST) 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> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?