Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp804360lqp; Thu, 21 Mar 2024 16:52:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV7ETkbjrechR0TNeY7LAMSHKLn2IJaSaQsRLZ9DaNoiFyzbpDQB7gEMOHGNPWm1SalbkS1du4n03P9LnmtkDuak1bnXrk935wSo/e1sQ== X-Google-Smtp-Source: AGHT+IEGcVz4eeylZc/DiYoGkY1nBj55IteOH444x1qI99Kh26YjJyzl0lZwCZ7mm20LCziM3Cb7 X-Received: by 2002:a05:6870:9404:b0:220:bb3b:c762 with SMTP id d4-20020a056870940400b00220bb3bc762mr731312oal.33.1711065145362; Thu, 21 Mar 2024 16:52:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711065145; cv=pass; d=google.com; s=arc-20160816; b=MLLgdRBCiORDtF+oloowSZKcvvzWcdT/WSdc0NsfqicXzro6inNrq6YvgTHX4UH0wx FmCUISAFFA2vWR66vnGzDtBVXN7YU6G87aROhk7iBYnFkdHsOFQ3G4y1yF4RdfnBbhkB 1gtZ84JYC9mBS/HbZDD8v2BYE/CsDM2MuUVpVk5QPWT+4e3VQayyT/yZU8eWx+Ktt+P0 zSAFwhIoNxDRxsqV2oGUPirEejdzIqGleG49WIGiXKYBxzEgnEJaMx+B4fXFXGTxGBDd 2kI7iClPyIYy0DcOUxOt9n0ZLauXlUy4lua+Di7Mdu/PY8o+lSNBnD6WtXu5XWv7M7Er 8kig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=CiTYEEplzQ2lndzXWogIXNgYF7mGrpfPPiqJQaXPjZY=; fh=pjE+VlkLbwl4XXXkP/aC5ieY23M5xKENHxL9A6rrAM0=; b=LnhZu5cgcyy1DP/yLXuBI57TH0mbzPuqTmuLrhY+3oIyCpC9j2IcbS/KK0ZeA06Ivs gPFdK52C26njTJw9ucD5NbGLF3dx0lyUzIxfQ/uUnv2XqOb2puLzFS1TYZIB+zkNcuse n2VfVI7gVrOsZ9jAJBYc4qf7CmCn6ZGxyuHx8A/+oiEx7iBNoRK61NEMSgXgbQHd1QZu mv4EWno1MysfO9jrsclups2ao4MSwRyQCJSwIgmQ3XfVJAewvtcMgxDGcCDJZpWOltYp zBE/Ig6Ui55OA6wQyRghxgqJ8/5oplO2yvrg/GGXDRGMC3d3mCn7sGoV9qzbD0f7tdP6 5xaA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XRVnwmHb; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-110802-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110802-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id fb11-20020a056a002d8b00b006e6c71e1d33si720343pfb.165.2024.03.21.16.52.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 16:52:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-110802-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XRVnwmHb; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-110802-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110802-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0E33E2841CE for ; Thu, 21 Mar 2024 23:52:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EA2B43AC2B; Thu, 21 Mar 2024 23:52:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="XRVnwmHb" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50E3C1DFCF; Thu, 21 Mar 2024 23:52:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711065137; cv=none; b=nUDX1eSZexFlkIW1Lvfj95IaKoBTGvFxhTfLA+HjzyzADtLGbfNPqdRtjr6WBdBQ9n82xnBzDqu6PjxLiT7Kje1Hja6lCYeHcuPKWyb+Fbi0vT46/Z13HPGg6hdni7DMQuwWW/ZpEjszWTIWC7w2vR0fAwIGjDSSofg4OnbrMqk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711065137; c=relaxed/simple; bh=A6ppOylSGg1w6xWuXb/YW2+KGjwJm/zoyUI49PmjYEM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=f8iTdKzr+Rtnk80TI7SKu3Rd1sh7okG0bDWon0T7H9uNVi525bK8MuSEfwj1GvUuuwaBGgk+x6H4imPdynTi8Pm1niqTXbaRyjuXkBlFcMZ4lwN05Kr+KE0MxfOkefzhKn+v82Gh/eHruuekO1isY+ZOLzPWVsOhXZc7GBGJ5rg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=XRVnwmHb; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711065135; x=1742601135; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=A6ppOylSGg1w6xWuXb/YW2+KGjwJm/zoyUI49PmjYEM=; b=XRVnwmHbmH/9o3C+Shqkj4vqgabRzVQPifQrldV0fZbAliig8E0g6vso tDLF0NDWwfo+S8nM3W8bYFm4qrwHFFABljVtFY9fE5V8fL4FJwcx5SJvT mmG9MeIBo9l6KuyFgroQwTL4b3ALLSfpWgIk6BNPC1bzfWRiHwiCeeSxG H1KM7uXKP8eILBEr2mf0vxfHHZPZoGizIQd3SlfjXA6BHA3fLjcsd+GDv IA5nPKbvLJf0sXQxedoP3Xro9uMfNevF4L4cv4/4NDqdJYS2aTpCqjOV+ p2RdN4kYz4lfNjDkweCtCWqRd4BdAEWHKPSwhGBXlVIjPHLfxk59IcfVn Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11020"; a="17490815" X-IronPort-AV: E=Sophos;i="6.07,144,1708416000"; d="scan'208";a="17490815" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2024 16:52:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,144,1708416000"; d="scan'208";a="19345136" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2024 16:52:14 -0700 Date: Thu, 21 Mar 2024 16:52:14 -0700 From: Isaku Yamahata To: "Huang, Kai" Cc: Isaku Yamahata , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com, Binbin Wu , Yuan Yao , isaku.yamahata@linux.intel.com Subject: Re: [PATCH v19 030/130] KVM: TDX: Add helper functions to print TDX SEAMCALL error Message-ID: <20240321235214.GV1994522@ls.amr.corp.intel.com> References: <1259755bde3a07ec4dc2c78626fa348cf7323b33.1708933498.git.isaku.yamahata@intel.com> <315bfb1b-7735-4e26-b881-fcaa25e0d3f3@intel.com> <20240320215013.GJ1994522@ls.amr.corp.intel.com> <76e918cf-44ef-4e9b-9e56-84256b637398@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <76e918cf-44ef-4e9b-9e56-84256b637398@intel.com> On Thu, Mar 21, 2024 at 12:09:57PM +1300, "Huang, Kai" wrote: > > Does it make sense? > > > > void pr_tdx_error(u64 op, u64 error_code) > > { > > pr_err_ratelimited("SEAMCALL (0x%016llx) failed: 0x%016llx\n", > > op, error_code); > > } > > Should we also have a _ret version? > > void pr_seamcall_err(u64 op, u64 err) > { > /* A comment to explain why using the _ratelimited() version? */ Because KVM can hit successive seamcall erorrs e.g. during desutructing TD, (it's unintentional sometimes), ratelimited version is preferred as safe guard. For example, SEAMCALL on all or some LPs (TDH_MNG_KEY_FREEID) can fail at the same time. And the number of LPs can be hundreds. > pr_err_ratelimited(...); > } > > void pr_seamcall_err_ret(u64 op, u64 err, struct tdx_module_args *arg) > { > pr_err_seamcall(op, err); > > pr_err_ratelimited(...); > } > > (Hmm... if you look at the tdx.c in TDX host, there's similar code there, > and again, it was a little bit annoying when I did that..) > > Again, if we just use seamcall_ret() for ALL SEAMCALLs except VP.ENTER, we > can simply have one.. What about this? void pr_seamcall_err_ret(u64 op, u64 err, struct tdx_module_args *arg) { pr_err_ratelimited("SEAMCALL (0x%016llx) failed: 0x%016llx\n", op, error_code); if (arg) pr_err_ratelimited(...); } > > void pr_tdx_sept_error(u64 op, u64 error_code, const union tdx_sept_entry *entry, > > const union tdx_sept_level_state *level_state) > > { > > #define MSG \ > > "SEAMCALL (0x%016llx) failed: 0x%016llx entry 0x%016llx level_state 0x%016llx\n" > > pr_err_ratelimited(MSG, op, error_code, entry->raw, level_state->raw); > > } > > A higher-level wrapper to print SEPT error is fine to me, but do it in a > separate patch. Ok, Let's postpone custom version. -- Isaku Yamahata