Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1353293ybh; Mon, 13 Jul 2020 16:50:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAgDL1bdmjaL7lUFHdOmUAQlMuOiXlKVcm+bgXaAj4mXf45L0T9Yr3jp47ZesPydbf3u1l X-Received: by 2002:aa7:c398:: with SMTP id k24mr1764096edq.95.1594684227394; Mon, 13 Jul 2020 16:50:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594684227; cv=none; d=google.com; s=arc-20160816; b=KpMYx5w+AJm9Y722zjUqI20Aks2O4uLEN/wKb0dixz7N17NUdyO+tbhiKxLvem3NSM Atqt4VSS0cUMvVEMcZc8QF33kj/FFi/qY3/16KuOPg5ao1z5795R2PjhSdusu6JttWDb QwfNAOlYQMkZ5+PXNU0Cv0rOiyZ8yRcHszmSAyYqJWTZteXQXEjP+PpqE8YQUIZlwNA4 /y9+GQ/ms9tF0T+NP6v9vDlTfO4Ul06j7CE7LxcQMR6qptCfSC123ZFpMPyApCXYNVbs joPccwX152iBXskkm42LEWjGCPyqxgI9dfi5hgbNvcaluVY7aWC2JSYdY7govlPkVjir I1Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=LmNDTwLlb3KqWuQbdAg4zlVEQb7xAzzSj874sMC/2KA=; b=tM0wydAGqAc9LwBmdQMB6im/dLc8IbGmSGUWNDacvX+OUO2e6IKgJ+ba0updtrX6A0 ZrCPYCIe5GuLP1QZhIE915ovoHhaeiDW2D/RXCtnL5kux5UaVJoe5x7UJiUcyXRqY+jq 2uLKssAUYBPni+2tYngSUh2xVwTi9Gb+Y7br/IqGp/243/dkEWw6RZ37UdZcu04rR5/4 7Xh18KqtpHXovyfl7CLpjcrM8mRiLGeRA73nzEhXmpxqIsVkzqoJkTmXJXveMLCOGSoU Ib+qr9SwDGWT1VG+f6/q3Q8RiOK6BC+Rx7HCHB4XDu0vW9VyClhhM6A/M8dWAVXVEdmO XpgQ== ARC-Authentication-Results: i=1; mx.google.com; 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 t25si10590353edr.537.2020.07.13.16.50.05; Mon, 13 Jul 2020 16:50:27 -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; 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 S1727858AbgGMXtU (ORCPT + 99 others); Mon, 13 Jul 2020 19:49:20 -0400 Received: from mga03.intel.com ([134.134.136.65]:36768 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727058AbgGMXss (ORCPT ); Mon, 13 Jul 2020 19:48:48 -0400 IronPort-SDR: pTJlU/xzx7+/m/VZ5jR+209udK0G25L4PVf5lQCqDubwzcjHW8Ior8CPPCDOJkXkhEKGVcrGKI mJ94bJGrSP3w== X-IronPort-AV: E=McAfee;i="6000,8403,9681"; a="148748423" X-IronPort-AV: E=Sophos;i="5.75,349,1589266800"; d="scan'208";a="148748423" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2020 16:48:45 -0700 IronPort-SDR: /tnDm7xCM0ITyTa3ULW8zhR0g9VhUAxKhEXMsB7rnWmWxYq2zGAirZOXRV6pMWBOoeFAJwphTI 41RmA2m/qCxw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,349,1589266800"; d="scan'208";a="281570459" Received: from romley-ivt3.sc.intel.com ([172.25.110.60]) by orsmga003.jf.intel.com with ESMTP; 13 Jul 2020 16:48:45 -0700 From: Fenghua Yu To: "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" Cc: "linux-kernel" , "x86" , iommu@lists.linux-foundation.org, "amd-gfx" , Fenghua Yu Subject: [PATCH v6 08/12] fork: Clear PASID for new mm Date: Mon, 13 Jul 2020 16:48:03 -0700 Message-Id: <1594684087-61184-9-git-send-email-fenghua.yu@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1594684087-61184-1-git-send-email-fenghua.yu@intel.com> References: <1594684087-61184-1-git-send-email-fenghua.yu@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a new mm is created, its PASID should be cleared, i.e. the PASID is initialized to its init state 0 on both ARM and X86. Signed-off-by: Fenghua Yu Reviewed-by: Tony Luck --- v2: - Add this patch to initialize PASID value for a new mm. include/linux/mm_types.h | 2 ++ kernel/fork.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index d61285cfe027..d60d2ec10881 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -22,6 +22,8 @@ #endif #define AT_VECTOR_SIZE (2*(AT_VECTOR_SIZE_ARCH + AT_VECTOR_SIZE_BASE + 1)) +/* Initial PASID value is 0. */ +#define INIT_PASID 0 struct address_space; struct mem_cgroup; diff --git a/kernel/fork.c b/kernel/fork.c index 142b23645d82..43b5f112604d 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -1007,6 +1007,13 @@ static void mm_init_owner(struct mm_struct *mm, struct task_struct *p) #endif } +static void mm_init_pasid(struct mm_struct *mm) +{ +#ifdef CONFIG_IOMMU_SUPPORT + mm->pasid = INIT_PASID; +#endif +} + static void mm_init_uprobes_state(struct mm_struct *mm) { #ifdef CONFIG_UPROBES @@ -1035,6 +1042,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, mm_init_cpumask(mm); mm_init_aio(mm); mm_init_owner(mm, p); + mm_init_pasid(mm); RCU_INIT_POINTER(mm->exe_file, NULL); mmu_notifier_subscriptions_init(mm); init_tlb_flush_pending(mm); -- 2.19.1