Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1301261ybe; Mon, 2 Sep 2019 18:33:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7IKs9t7BpBOxxUUk2A5wCz9zw/29zX49JVzhRvbeet6Oli4Al28m1NZPCE0d4cKkka89W X-Received: by 2002:a17:902:a415:: with SMTP id p21mr9240180plq.319.1567474414250; Mon, 02 Sep 2019 18:33:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567474414; cv=none; d=google.com; s=arc-20160816; b=eXxW3drKeZKj8HYj5dmKuAXq8ozJn5JLpL3uHeHy7tvvZmKGd7ChI7WMRiFDYIiH8/ PVhaczIxdLE1QPXHtO6fsfvpuLcXLoRu3+r2UKlaxwvZbQI0wTfa4NChn/4UhcRITk9C kV6RkHoniFrMfk7hP2W1ZMYII42BWOPzTsY7OLHo4RiP5tR6aMOTIsE7Z2YtC3oHohhc rGAbDdbXp8pa7Vi9KNvfg2WisKkipQghSwhQBvjoT/c1+tEmpIo4Kc7REyYsPkRCbtSk 5Rd/C85wvkE58kSNwmiIy8F3S0tOz3Q0nLGeQ1BQRHQgYF4ezMoCYm72sv6aqTfBoqAj nERQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:cc; bh=3KcxKGGimJTYBmpVMoaSM8N1aN5tImtxtmyrEVqSSEQ=; b=wdSM+5St+37auujJhDVkhfz94+EOxEKmrhDYWFQAY8SubALmHA/oQN3UaXn38i9yxT W+5QKLz9lJeHtMhlQde7hwQiFxzGR1jb9Nf6aIDGXAI4oCKy27lITjLXGIRB0YQAiRa5 dmBNzjT+HTEXQ9QreJRgQoHPjY1ezlyzKvdiVChvRWz8Qj71gXcgCKua0nos+6x9mZnz QeHxE1mU/evL5OAd7yHnL/TDpSS2FYTG6gYZUWvdTIDlJxQv/QRwBLlO3dpMPAVpPqt/ TiWYsnP3ZDSS6UqGSvTKEu3ggMS2qbT3rSVBbY4seEy5xwegkit75f7LdFsVWK4VNg05 PCJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id q11si13105910pgk.194.2019.09.02.18.33.17; Mon, 02 Sep 2019 18:33:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726410AbfICBbG (ORCPT + 99 others); Mon, 2 Sep 2019 21:31:06 -0400 Received: from mga06.intel.com ([134.134.136.31]:40781 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725306AbfICBbG (ORCPT ); Mon, 2 Sep 2019 21:31:06 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Sep 2019 18:31:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,461,1559545200"; d="scan'208";a="381967332" Received: from allen-box.sh.intel.com (HELO [10.239.159.136]) ([10.239.159.136]) by fmsmga005.fm.intel.com with ESMTP; 02 Sep 2019 18:31:04 -0700 Cc: baolu.lu@linux.intel.com, David Woodhouse , Joerg Roedel , iommu@lists.linux-foundation.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?UTF-8?Q?Micha=c5=82_Wajdeczko?= Subject: Re: [RFC PATCH] iommu/vt-d: Fix IOMMU field not populated on device hot re-plug To: Janusz Krzysztofik References: <20190822142922.31526-1-janusz.krzysztofik@linux.intel.com> <3255251.C7nBVfOIaa@jkrzyszt-desk.ger.corp.intel.com> <1769080.0GM3UzqXcv@jkrzyszt-desk.ger.corp.intel.com> From: Lu Baolu Message-ID: <52fbfac9-c879-4b45-dd74-fafe62c2432b@linux.intel.com> Date: Tue, 3 Sep 2019 09:29:40 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <1769080.0GM3UzqXcv@jkrzyszt-desk.ger.corp.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Janusz, On 9/2/19 4:37 PM, Janusz Krzysztofik wrote: >> I am not saying that keeping data is not acceptable. I just want to >> check whether there are any other solutions. > Then reverting 458b7c8e0dde and applying this patch still resolves the issue > for me. No errors appear when mappings are unmapped on device close after the > device has been removed, and domain info preserved on device removal is > successfully reused on device re-plug. This patch doesn't look good to me although I agree that keeping data is acceptable. It updates dev->archdata.iommu, but leaves the hardware context/pasid table unchanged. This might cause problems somewhere. > > Is there anything else I can do to help? Can you please tell me how to reproduce the problem? Keeping the per device domain info while device is unplugged is a bit dangerous because info->dev might be a wild pointer. We need to work out a clean fix. > > Thanks, > Janusz > Best regards, Baolu