Received: by 2002:ac8:3b51:0:b0:3f3:9eb6:4eb6 with SMTP id r17csp2753974qtf; Mon, 12 Jun 2023 09:22:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4LsZEwy1taX3+1bXVlsjIioj2Nn7M/aNxkryYysfeaP7JDUvDPG/rE0XHERCaA1c3Ne7Gc X-Received: by 2002:a17:906:5303:b0:977:b21d:7d8c with SMTP id h3-20020a170906530300b00977b21d7d8cmr8772649ejo.6.1686586968216; Mon, 12 Jun 2023 09:22:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686586968; cv=none; d=google.com; s=arc-20160816; b=HWJhYEPv7kPyrvdasBSidE2izhbu3gqXlS2ZKkDVh/LQvvcscBhWPYiyFhQN0PzOcG M6tSUeMANPmAaP5dlwtFgwnQtkaIdE6NC91fh3j9mQRXuaKKe7ii76fItj6DJjwfrPxY A9ElOmPpDGuzcrdFrkjJGAWgCoZS/Hkz0BI9yQsHhjktdA4Uak+0Yz99vn3c4WouSBOk oiSymvG+w0VF9hD1oZaQwkrlSb6UL4WLgc6IY0zz8fGGDg9G4FdDhbFWfarJt/PU3hKt 9CWXdEybHzNgGmQzMHXizv9pvnp5UApXFZbGQnovM3hy6doo5I3sFcxNbUAjJgDFycUE 2Izw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=YDOX0qvilhB1ysLp4ydOFwxDazVQ/jKQek++eIkaMFI=; b=E7UFXl9mVoKu3dDEmvk2EkmtCcV1bdqdxL7QAkDbE2PDGjkk8tWjNh/wpX28GajAR8 Y1Kvt8xQi+QOV1dmKPok0sMaQDXZp1fLQz8vCxsHFldXh3PRDhjZDq3k5/i5izOcSZcX 7CnnXAJdJpM1x3woXMPGbCcRNSIOQhgEYfVsb8MmTQU9FFN3qab9ybBpfuSf1bkysgYV +OrVT4DuQbokW3IJzeesJ4tV8BCJ78muzmSs2AX9fI8Tj3uh9H84Jl/BQwiH1DGPK1eU UegJWHCJth/DQbDmQiz2RTV2Y1m/2QR1GuJ8l0sgoLbSSQ952CeBxQ70aieT7SlK/hjh MfTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JLFnb+nC; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j23-20020a1709066dd700b009747720b1dbsi5444675ejt.152.2023.06.12.09.22.23; Mon, 12 Jun 2023 09:22:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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=@intel.com header.s=Intel header.b=JLFnb+nC; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235548AbjFLQOk (ORCPT + 99 others); Mon, 12 Jun 2023 12:14:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231488AbjFLQOW (ORCPT ); Mon, 12 Jun 2023 12:14:22 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D25951BC7; Mon, 12 Jun 2023 09:14:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686586455; x=1718122455; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=nxVNBn+XWFWeEHcN8pf1WYBMgr4o1yAKNG8v2o0cHHw=; b=JLFnb+nCWWyfIXGAqAwkc/zTQh+tc5f1oIBfQloqo0/ec7KItbbMjJHw hdH3or2aAFoS89DfYEqzQT600buQVnIrjiWN5U82ICbVJFrf2n8clvg+P X6jEKSo/ozHR7logih0JF8xCjyMpdLcpe6koaoUUR4C7Kf/R6UKk4b0A2 /x0+kks3uLJhKh+wrbYbdS4mRLPphQ42tODo/iIvkQ7Y0QEQkcMtjViZS zBpdM+Zwr9lCQ1bAqddLgVd1iYfPtxT9qw/OCsy5BGLeb5rXpYMH0OKzy A/ojQ/+AYHqLK6I7UaylDYadeJlLIXzTnnYEbs5rhJ9RwewvyFQq9CM6a A==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="356976308" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="356976308" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 09:12:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="705457138" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="705457138" Received: from spmantha-mobl1.amr.corp.intel.com (HELO [10.209.43.2]) ([10.209.43.2]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 09:12:34 -0700 Message-ID: <15148682-e2fd-8176-563b-74acf9815b6d@intel.com> Date: Mon, 12 Jun 2023 09:12:34 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH RFC v9 10/51] x86/fault: Add helper for dumping RMP entries Content-Language: en-US To: Michael Roth , kvm@vger.kernel.org Cc: linux-coco@lists.linux.dev, linux-mm@kvack.org, linux-crypto@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, jroedel@suse.de, thomas.lendacky@amd.com, hpa@zytor.com, ardb@kernel.org, pbonzini@redhat.com, seanjc@google.com, vkuznets@redhat.com, jmattson@google.com, luto@kernel.org, dave.hansen@linux.intel.com, slp@redhat.com, pgonda@google.com, peterz@infradead.org, srinivas.pandruvada@linux.intel.com, rientjes@google.com, dovmurik@linux.ibm.com, tobin@ibm.com, bp@alien8.de, vbabka@suse.cz, kirill@shutemov.name, ak@linux.intel.com, tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com, alpergun@google.com, dgilbert@redhat.com, jarkko@kernel.org, ashish.kalra@amd.com, nikunj.dadhania@amd.com, liam.merwick@oracle.com, zhi.a.wang@intel.com, Brijesh Singh References: <20230612042559.375660-1-michael.roth@amd.com> <20230612042559.375660-11-michael.roth@amd.com> From: Dave Hansen In-Reply-To: <20230612042559.375660-11-michael.roth@amd.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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-crypto@vger.kernel.org On 6/11/23 21:25, Michael Roth wrote: > + /* > + * If the RMP entry at the faulting pfn was not assigned, then not sure > + * what caused the RMP violation. To get some useful debug information, > + * iterate through the entire 2MB region, and dump the RMP entries if > + * one of the bit in the RMP entry is set. > + */ > + pfn = pfn & ~(PTRS_PER_PMD - 1); > + pfn_end = pfn + PTRS_PER_PMD; > + > + while (pfn < pfn_end) { > + ret = __snp_lookup_rmpentry(pfn, &e, &level); > + if (ret) { > + pr_info("Failed to read RMP entry for PFN 0x%llx\n", pfn); > + pfn++; > + continue; > + } > + > + if (e.low || e.high) > + pr_info("RMPEntry paddr 0x%llx: [high=0x%016llx low=0x%016llx]\n", > + pfn << PAGE_SHIFT, e.high, e.low); > + pfn++; > + } > +} Dumping 511 lines of (possible) junk into the dmesg buffer seems a _bit_ rude here. I can see dumping out the 2M RMP entry, but not the other 510. This also destroys the information about which pfn was being targeted for the dump in the first place. That seems unfortunate.