Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp977176ioo; Thu, 26 May 2022 21:18:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPefw8vfAqDzXUYh+5ZmJ8AKBdhCMd6mL3mgJXKotTbyUbXo3fi5yidJYfpKhhm60PsFdI X-Received: by 2002:a17:907:3f8c:b0:6fa:8b15:66fe with SMTP id hr12-20020a1709073f8c00b006fa8b1566femr36668193ejc.142.1653625085775; Thu, 26 May 2022 21:18:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653625085; cv=none; d=google.com; s=arc-20160816; b=qoOqelWPPokxTVBy0RQBVYboG1CSjp9DMzcreKBiH/hMSlvkjWBjD5KTP3sgycEhSm Lp4mG6QLwX5AJPjglRKgXHZkTSTb6Vd8gRkv560inm+M2wnL36N7DSdoTTnr2GOnkU1T oX26W1x9uqCcFRdOh+PNF0kJIlKv47EyQHWtYmKm9IgCXTMti2eA1UfgYjv9YTMTouPq s2Dt5uaIfCEb3lLf5ahV9uBv/dp5ck7e1yV7RkC6SLQTM9mOKhqEwUBIuJjBX3aXKfXj HyDj7l3JwzgO4StwqscxIl+8/HYepl73/keX/Tmrf0ns8r3tTemrkkHM/eNJNbl7SJZK qaPw== 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=xIt03l4m2Obkmv1Zk18bhy2vW/mIMfg9Kcj6zHUX2PQ=; b=p6LJ1OLwnIY0nWABG4zetgIx/ArkkStRvRXpRG1OxTRZFIwAzo4Yokrg44IBKlw1nm rzw9t6iXfL793T/5gR5TIhxtAnVqKZ3i/6DNwWNV7/Qswo+3J0X0FiYjFl/ed63jztGP IFEcVu0y5eR3S8LWEGIfIF/TWwF45FxBT0hl4XuPCAvKBXRm/2gB2NN2PW10/hnzN1n6 7e4dbbRDNfX4A1Oe8o6D5KDZPyo3ivHDOxwHDJIcrpZgqHsWmIw4r2Wa9xg/TfQLkZus PQ2RMRra5oRR1qvEZyKorxJfqn60jvSKQOXlAUZmbeand2LqQnRbOgvclgdkHG58xwqL SBcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="hypdEUT/"; 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; 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 sb40-20020a1709076da800b006efd86f3831si4065475ejc.109.2022.05.26.21.17.40; Thu, 26 May 2022 21:18:05 -0700 (PDT) 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=@intel.com header.s=Intel header.b="hypdEUT/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348899AbiEZUS2 (ORCPT + 99 others); Thu, 26 May 2022 16:18:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232295AbiEZUS1 (ORCPT ); Thu, 26 May 2022 16:18:27 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27955C964A for ; Thu, 26 May 2022 13:18:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653596307; x=1685132307; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=U+Ch9vTrwploO8vWhtYTLVwOMyG4nbopiYBQXxPiejI=; b=hypdEUT/ErJF4YQ7CixmrujZiFV2fDPrv88/wmFcmo0Q8xeOn8TkpyRR BMjDtzNL5Z2tExDeDqgkHjk8gxphMQXSWC4TO9SpmmRuNQXLKjsi4z5kG NUlXZO1oHz0GcXv1g7wnB+xK0aOgvD8AqEgJue8JKHwb/emn8Rgdd9XVk So9XVgtcDX49ci3AbiEOhLTh3hJ+Tozv05bMy5+/qpBF0syCSTJ3mNeCf Knkj6EK5oGXkZPeOR0s8K0CuWLDWQ2ktBGIJpx+kjr9jugJHswKYe6ADh /vZm3aYYQjLT+62p9aqIbsEE1epOEJoxc+m1kaaLgorIxoHV65rFTtRFY w==; X-IronPort-AV: E=McAfee;i="6400,9594,10359"; a="261893360" X-IronPort-AV: E=Sophos;i="5.91,252,1647327600"; d="scan'208";a="261893360" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 May 2022 13:18:26 -0700 X-IronPort-AV: E=Sophos;i="5.91,252,1647327600"; d="scan'208";a="643053535" Received: from tjeziers-mobl1.amr.corp.intel.com (HELO [10.251.23.34]) ([10.251.23.34]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 May 2022 13:18:25 -0700 Message-ID: Date: Thu, 26 May 2022 13:18:23 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCHv3 2/3] x86/tdx: Clarify RIP adjustments in #VE handler Content-Language: en-US To: "Kirill A. Shutemov" Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, luto@kernel.org, peterz@infradead.org, ak@linux.intel.com, dan.j.williams@intel.com, david@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org, sathyanarayanan.kuppuswamy@linux.intel.com, seanjc@google.com, thomas.lendacky@amd.com, x86@kernel.org References: <20220524221012.62332-1-kirill.shutemov@linux.intel.com> <20220524221012.62332-3-kirill.shutemov@linux.intel.com> <89f55141-a71c-1fd8-e1be-96355c63c03a@intel.com> <20220526201354.v5a6fsi4aiuet2d7@black.fi.intel.com> From: Dave Hansen In-Reply-To: <20220526201354.v5a6fsi4aiuet2d7@black.fi.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 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_H3,RCVD_IN_MSPIKE_WL,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-kernel@vger.kernel.org On 5/26/22 13:13, Kirill A. Shutemov wrote: >> I'm not super happy with how this comment ended up. First, let's put >> the comment next to the code to which it applies, like: >> >> /* >> * ve->instr_len is not defined for EPT violations. For those, >> * the kernel must decode instructions manually and should not >> * be using this function. >> */ >> if (WARN_ON_ONCE(ve->exit_reason == EXIT_REASON_EPT_VIOLATION)) >> return 0; >> >> /* >> * Assume that the #VE occurred due to instruction execution. >> */ >> return ve->instr_len; > Would it be helpful if the function has a whitelist of exit resons where > using ve->instr_len is safe? WARN_ONCE() and return 0 otherwise. Maybe. I was hoping to avoid mostly duplicating the virt_exception_kernel() switch().