Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3646888pxj; Tue, 11 May 2021 08:51:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCi+7Ly3QBYxeh8Oi6eEai5eABLNZRqT8wAHTDMV7N1kqZ3t3KUE/1Xfu2K6L0Cj+VgTnc X-Received: by 2002:aca:2402:: with SMTP id n2mr4204006oic.113.1620748297649; Tue, 11 May 2021 08:51:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620748297; cv=none; d=google.com; s=arc-20160816; b=aUusJgx7AJpMPMo8kdNaE0N0eNeQe7i3sfBsHbqIG0FIq9YoGjIEb50Nx5NOU7j6H7 2prk0A7WHjHLxwx5WcqY1Zi1VSJXjgfWnd1kncV9xYBnsW+PxJYzpIVFKJmfX93vdKA7 DTh5asKWM2hO1UoGn8WirSBuF7Es8TbllDxsuXcy7g3AS2Jk5T96eqn5bueZm7De9hLr ZFM49aWJUftGx4BbDmz4VEnOulgqTJEk5YTDtRAl7bbPonB8a+YlORpQx07xBeGw8r60 YLUxN4J9yFxmrE+9oMq4sgOOF0O6adce43eP2LW2oHKjkBYKwHhAe3ZROiiSCeOO0jLJ 54Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=YH6YgAVkTiXbdfOcXF2vDZOin/cgaMlrHhCUoByOUzM=; b=jkamhDU20eQRfzmvQo1jEN0E3wHjN38cD6SPFnwD7vJGZA4jZZOhObKcWBVxgI/SIU IJqEsYabjG/B+RyEfdUvXPHkCKs+lLYhDXEErb70rDhhBd1GNg5BnrVwOTa82q/T0SIi Xp1vB/9xCOL8DdyIhQBH0myrUAveZ8g+Y/5Bs5rycVca6h1guHe4kf4onuO9H3X0p0Mv MY2HgWhkcjzsju8XDbcs7v0QubgQKdQ81WwXoWalUox9WRbua26MrBltOCx0iVGY9BPV MlsVuX+Ec66Ol7g8NfABAu/i1n3kVHdX+PyaAsee6GyEgAWCmpY8fxO5nglBcC+TvpvF +tQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=KAVJuYtX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m15si16694237otp.247.2021.05.11.08.51.23; Tue, 11 May 2021 08:51:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=KAVJuYtX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231834AbhEKPvt (ORCPT + 99 others); Tue, 11 May 2021 11:51:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231561AbhEKPvr (ORCPT ); Tue, 11 May 2021 11:51:47 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F263FC061574 for ; Tue, 11 May 2021 08:50:40 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id c22so23450734edn.7 for ; Tue, 11 May 2021 08:50:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YH6YgAVkTiXbdfOcXF2vDZOin/cgaMlrHhCUoByOUzM=; b=KAVJuYtXoVccS7Mz6+WwXrwBzBNXVBJiXvHcQFoDhJKBjMBnBuHojuygaSnyjBFh2J juvXeZVJwPDRy+v2a+HBWLFfu29TOD989MaKVyZz7XHcJ3O1A+Sq/ZsrpqhPqO/vtNRs tJZM/jFTyvjuzNJj8uIiI+6Kk760+lBL2FSbujpXDN7b+nWSdhwY+pFNdwhyfj5J9ham 7/I4tKLzDZSH0mCw0oAdxkvaK8TYCEKmaKeJTfHtZBbJ4C8xUaObZxvd7rsKV6EQlFSQ bFExTo11KTR4WHN2uubvLiG/0eTzRbmZatHF7ZTdlD1HfviACmmHmsQPpJuo+LdICeQt dgbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YH6YgAVkTiXbdfOcXF2vDZOin/cgaMlrHhCUoByOUzM=; b=DAHdEYt/kq6DJzdmQvZbAzSAPoMnuO/MzmCm342s7QFjoJ+tJQZE3k8/QsWuD7xij0 pS6KVhkipIf+lhSJiVKcrG07/m4N0Q1SQM71XWZohOYsUYm3paF1Cfv8rcfBMmmDaDX6 JbIu1CurL5iA0wJojNabpPHY60mjZoWRT7T1Ms2JWuPV6G3oPkIr6UpFGU3vALpiJoSS Iv47tRCrDaUMWhHY03+TGIyCI8lhi0Ggq9ZF/8Seo4xdQH0iA7Qg9UigRAzHq6SJtXwm QEuDudMs951O35fqLUsJP/UOQFlQzjvFS4HegqEbAPMUZwFlcJgtEFcEnOOtQ6Y8mmZM cUcg== X-Gm-Message-State: AOAM53199i6mbXi9YzHkj0iOCzrwT3rBkUse0CS4MZ9pKBLGGpovxL6D iI7kzjfSaBZ+VBpAEAYZR2KyHSKmnA4imp8aUlSJqg== X-Received: by 2002:a50:f0d6:: with SMTP id a22mr37973492edm.354.1620748239760; Tue, 11 May 2021 08:50:39 -0700 (PDT) MIME-Version: 1.0 References: <0e577692-101e-38f7-ebe2-2e7222016a9f@linux.intel.com> <43e0a5cc-721a-04f1-50b6-b1319da10bac@intel.com> In-Reply-To: <43e0a5cc-721a-04f1-50b6-b1319da10bac@intel.com> From: Dan Williams Date: Tue, 11 May 2021 08:50:29 -0700 Message-ID: Subject: Re: [RFC v2 16/32] x86/tdx: Handle MWAIT, MONITOR and WBINVD To: Dave Hansen Cc: Andi Kleen , Kuppuswamy Sathyanarayanan , Peter Zijlstra , Andy Lutomirski , Tony Luck , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Raj Ashok , Sean Christopherson , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 11, 2021 at 8:45 AM Dave Hansen wrote: > > On 5/11/21 8:37 AM, Dan Williams wrote: > >> I disagree. We already spent a lot of cycles on this. WBINVD makes never > >> sense in current TDX and all the code will be disabled. > > Why not just drop the patch if it continues to cause people to spend > > cycles on it and it addresses a problem that will never happen? > > If someone calls WBINVD, we have a bug. Not a little bug, either. It > probably means there's some horribly confused kernel code that's now > facing broken cache coherency. To me, it's a textbook place to use > BUG_ON(). > > This also doesn't "address" the problem, it just helps produce a more > coherent warning message. It's why we have OOPS messages in the page > fault handler: it never makes any sense to dereference a NULL pointer, > yet we have code to make debugging them easier. It's well worth the ~20 > lines of code that this costs us for ease of debugging. The 'default' case in this 'switch' prints the exit reason and faults, can't that also trigger a backtrace that dumps the exception stack and the faulting instruction? In other words shouldn't this just fail with a common way to provide better debug on any unhandled #VE and not try to continue running past something that "can't" happen?