Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp7654ybt; Fri, 12 Jun 2020 17:46:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynINtWJ8pjGp/EWfRHgrMsRGuQVSk79/J2G5EQSN+5oasfCGk8onMHSHmugjvBj4P6Tyoj X-Received: by 2002:a17:907:369:: with SMTP id rs9mr15388489ejb.187.1592009178223; Fri, 12 Jun 2020 17:46:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592009178; cv=none; d=google.com; s=arc-20160816; b=GMp7VrBNpvflmzTi9JBQngC3UJQNIEWuM4EN3OxKIBvUlXOUQs2040Kc5tBusgZa0Z YjEO4GlGsjzDNQTpqlcGUD14LncTKHsxUVtXZZEEEr6QI8EdO9sMaNgBrOcaRGM0fnXm hveuIMjeaAszpTlAY3v558tCxLwIpybu1ko14NVrahWxKeOzwWau0gYo9v9A+3GzkEUO D0B17FfLY7pAyV+tEJaBphIY2v7djF7iD5jZpKbbzZaMdYz4YsC7WPcziamV6+8EEf55 6FzeyQwX5gpFcISN3NhcSl4QsnpzmDITrtLX6UxfjOeWgbrcdxcIjaeu2oyHBlmIHZbW XG0A== 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=cdUg0GniACwXPONsQMYkpyx7ie8Q1i6R7uuQjdzPtwY=; b=KE4hv0G5K+U3aMnoj048n8/64UrcxmR+45oLCH8xyGwzyxtjrbcC+9sJZdNsvoFnrF k8poMXAh5mS8BDzd+QYqiqzoC4keQhYjpAhXJ4KA2caYBmY0ltIBRh1Pst3A5AYi4V01 B3SDrdIZiiFUwxTSWRxHCkwev4HrYQ0liMBNgQn1QrcLnHywyZCPMuQK8dkKaQpJ+8sc VaRYsPm+vxWioL4TT2E12WDT6KQX5D7wZtZ7PHXOuQryuyH7Q+RRxTHZ59NhlGRTYxoD G/sBQ9cNfC+wBVZVBziTylcRq1v9q6t7r9+hYWH3We+z6B2nJu8yeiWFSoqamD1Fuhdy gL/w== 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 m8si4758564ejq.294.2020.06.12.17.45.55; Fri, 12 Jun 2020 17:46:18 -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 S1726582AbgFMAmZ (ORCPT + 99 others); Fri, 12 Jun 2020 20:42:25 -0400 Received: from mga12.intel.com ([192.55.52.136]:1253 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726466AbgFMAly (ORCPT ); Fri, 12 Jun 2020 20:41:54 -0400 IronPort-SDR: Xg9Q9E3MlY0yniS6MgOKX8HeCmWEUj8NXd3VIX83yiZB7rBLLd0ZZMmaabHrqGqXs7fjp7b+qb CRcYHFO/98Xw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2020 17:41:53 -0700 IronPort-SDR: KuN5V3YFsnjdTehZFOVByIv/QV1gDwWNBWqBvcj9vWPSDG+gYq+BDBKdZttdP86sq3Ahzgy1hZ cmCWPKOqxNeA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,505,1583222400"; d="scan'208";a="261011229" Received: from romley-ivt3.sc.intel.com ([172.25.110.60]) by orsmga007.jf.intel.com with ESMTP; 12 Jun 2020 17:41:52 -0700 From: Fenghua Yu To: "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "H Peter Anvin" , "David Woodhouse" , "Lu Baolu" , "Frederic Barrat" , "Andrew Donnellan" , "Felix Kuehling" , "Joerg Roedel" , "Dave Hansen" , "Tony Luck" , "Ashok Raj" , "Jacob Jun Pan" , "Dave Jiang" , "Yu-cheng Yu" , "Sohil Mehta" , "Ravi V Shankar" Cc: "linux-kernel" , "x86" , iommu@lists.linux-foundation.org, "amd-gfx" , "linuxppc-dev" , Fenghua Yu Subject: [PATCH v2 09/12] fork: Clear PASID for new mm Date: Fri, 12 Jun 2020 17:41:30 -0700 Message-Id: <1592008893-9388-10-git-send-email-fenghua.yu@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1592008893-9388-1-git-send-email-fenghua.yu@intel.com> References: <1592008893-9388-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 5778db3aa42d..904bc07411a9 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..085e72d3e9eb 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_PCI_PASID + 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