Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp486396pxa; Fri, 31 Jul 2020 18:30:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzu6Ldzla+pQ4pBw6nueZlkzqNfMS6lgDT23hiy0QpUMU2FB+VSr4PMQllT5UfprjwvMMac X-Received: by 2002:a50:8f83:: with SMTP id y3mr6540147edy.257.1596245443553; Fri, 31 Jul 2020 18:30:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596245443; cv=none; d=google.com; s=arc-20160816; b=bfkWeqQL9Fruy3C0dx589HZz/AS3xwwfhHsGmJrujwxQHfG+YB6T+GZcPRL9n21EVT 1YbyZLPkCv8burDxfcjbR5DgYGy4yDxqUyD/JIQnYPLF5LW3tPBbgHuHU7cPHbjOqTtM 7A9kTE7iYEFcdosRgJFpvWzLqTrm4Hkb4TQxFZxdY7/N1+3dB5ZjLdkqcusmu68u8NNe bBsrzbrDq2KxqzM30pc/2Iqvv0ZvBf0OG7jCZ1mhqc+9uk9K1MoCNcJiUzHXOkDUKZsk 3GUNDGsXhOD3l94YFXqIfVLO4qCB+Wq1KwNNd4uvEw/o06IkfPLunC5WXNTH4C0vP56+ ACJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=6O8GEtYyKhZU20tfgENjmSfDwnjR6T61P8v8fUc3804=; b=aKsc/sGS+3aL55hFsN/m4reBrrkOdYWFb80A+3Lu9WuHxe0rnRuL2fkB1AQIYygGjI unztOBu4Z/GlU/f+PksWlbTOKq3lgmbsd8vktKCS/wxX611GmLfJhqgPcfMKngwSWKhq p1SG2p8Ll7VcQggiuJZZnDw52NoRmJ0SnPphT4wZSIdSG5OnoO5RrVFERwHT3nhMIOlS LriV7RxkwCvW3I/Cno7Hcdeyn6k4JKAdk3Lk2gc/LeeIgw15/3KnjhJudXFPQpPKw1YC B3Gy71Hh2TmI2sgpcuW1a3+PSNC1GolrqrnPMHmjxOy4YDCRsrjdMMOlTFwaQ/9/zyK7 +d3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oyiKjd9j; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d8si6340808edl.399.2020.07.31.18.30.21; Fri, 31 Jul 2020 18:30:43 -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=@kernel.org header.s=default header.b=oyiKjd9j; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728086AbgHAB2v (ORCPT + 99 others); Fri, 31 Jul 2020 21:28:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:45958 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727095AbgHAB2v (ORCPT ); Fri, 31 Jul 2020 21:28:51 -0400 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3448E22CBB for ; Sat, 1 Aug 2020 01:28:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596245330; bh=iEFTd5J3OaIz2CPblhNjm4HIdHFf3NTyBlaCyk5tBwc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=oyiKjd9jYrsQoTyhz9So/eaYiCUToFDRE+yR5g+YKhAtuoTBf++uEjYmgaJO0yqqO qnJf3bCLRvBIa7DYC2uz+LmCEDskSnC4cnYhI+4Ncll+MjqEsOQuS2Xxm8wbccwuol vNVp2k1dV+au0yLp8bu3hI5+0WnCXeDq9gno9e+U= Received: by mail-wm1-f52.google.com with SMTP id t14so5528091wmi.3 for ; Fri, 31 Jul 2020 18:28:50 -0700 (PDT) X-Gm-Message-State: AOAM532PVWM18aVWQaThFqjFgBtH0C1Q1Qp4+CwW/EuBXH5MLxwdl6O0 W6GUR9jkHVwJeDaghTMz1Az6cyGJRu2r+eOXyOHUOg== X-Received: by 2002:a7b:c76e:: with SMTP id x14mr5903705wmk.176.1596245328660; Fri, 31 Jul 2020 18:28:48 -0700 (PDT) MIME-Version: 1.0 References: <1594684087-61184-1-git-send-email-fenghua.yu@intel.com> <1594684087-61184-13-git-send-email-fenghua.yu@intel.com> In-Reply-To: <1594684087-61184-13-git-send-email-fenghua.yu@intel.com> From: Andy Lutomirski Date: Fri, 31 Jul 2020 18:28:37 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v6 12/12] x86/traps: Fix up invalid PASID To: Fenghua Yu Cc: Thomas Gleixner , Joerg Roedel , Ingo Molnar , Borislav Petkov , Peter Zijlstra , H Peter Anvin , David Woodhouse , Lu Baolu , Felix Kuehling , Dave Hansen , Tony Luck , Jean-Philippe Brucker , Christoph Hellwig , Ashok Raj , Jacob Jun Pan , Dave Jiang , Sohil Mehta , Ravi V Shankar , linux-kernel , x86 , iommu , amd-gfx Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 13, 2020 at 4:48 PM Fenghua Yu wrote: > > A #GP fault is generated when ENQCMD instruction is executed without > a valid PASID value programmed in the current thread's PASID MSR. The > #GP fault handler will initialize the MSR if a PASID has been allocated > for this process. Let's take a step back here. Why are we trying to avoid IPIs? If you call munmap(), you IPI other CPUs running tasks in the current mm. If you do perf_event_open() and thus acquire RDPMC permission, you IPI other CPUs running tasks in the current mm. If you call modify_ldt(), you IPI other CPUs running tasks in the current mm. These events can all happen more than once per process. Now we have ENQCMD. An mm can be assigned a PASID *once* in the model that these patches support. Why not just send an IPI using essentially identical code to the LDT sync or the CR4.PCE sync? --Andy