Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1620330ybe; Tue, 3 Sep 2019 00:44:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqwv+SUzo4/gykkF7+55cVSxIZFkFqg3WkL6mSlepYt5ZPAPy1Zwtb2cbG2S6mYPEFWw3ph/ X-Received: by 2002:a63:3ec7:: with SMTP id l190mr29712924pga.334.1567496649885; Tue, 03 Sep 2019 00:44:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567496649; cv=none; d=google.com; s=arc-20160816; b=lw/3cjoZ6ugGZ3+YX0qfv6uNWbaBlNg1K6VCquTj6zWZFUjOZD5Na6N3qStYH+VhGv CuiDGFDdw+AJEqOP6M9lVy4JdNuu/ndIX1UYojjFLps4UgLZ15s3YUXpYOG4kaU9gsVy 6ruCHF4JncwMdyG/gGKccf6nwC99vL6Pbo1Gif3sRlGrGndJCCIn6EKK8tCUiyW37OmJ blXVUqG50RE0OzwbR3LoPRz98PLCHqUH0i+x0weZWHt3X3CNJbHp9eKkJ2NFoU01zmFa Pk2FuMunUBngsGBiBXjB3MiENKvC9BBe2MekkKBsbtyR3vBohK5Kp01fg59E8BdPdzuV 4jRQ== 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:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from; bh=o+2i6kntHOlNYlm0BFb+HieOLrKKLehScn2xl6RKsY0=; b=hi83LZ1+ZtL0y/wa8ykAoNpM/ln6AyzoFPbuuyDxJRL/a8cXhJDzoztW90GGR4e+WU BNFpDnJ9sI95sKvj3mkYtbb5+1e9mbr3R2EbKo+XpMm6iS9B4kAZuCMfwC+2wuclI3Y1 HQyeGr8ETC1ltFf9pseOaQTlhizKN4F45mATwZetQpyv2QF8XO55haG3eZCT5IL0h8ed QP0n0ZKWnjPe/qBzyk2CYR7cxvDZurAafRRdtkpHnKmcxpTEqzGwio154pZ7BrQTD78H dem0S3ILfp3C4yZIOAUGViEfaS2EovcKweEIS8e1wVEMxyx+ifzT4Uah4e4cjrrSTj74 jw7g== 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 y16si16986192pfc.51.2019.09.03.00.43.54; Tue, 03 Sep 2019 00:44:09 -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 S1727942AbfICHls (ORCPT + 99 others); Tue, 3 Sep 2019 03:41:48 -0400 Received: from mga02.intel.com ([134.134.136.20]:5585 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725895AbfICHls (ORCPT ); Tue, 3 Sep 2019 03:41:48 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Sep 2019 00:41:47 -0700 X-IronPort-AV: E=Sophos;i="5.64,462,1559545200"; d="scan'208";a="176505229" Received: from jkrzyszt-desk.igk.intel.com (HELO jkrzyszt-desk.ger.corp.intel.com) ([172.22.244.17]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Sep 2019 00:41:45 -0700 From: Janusz Krzysztofik To: Lu Baolu Cc: David Woodhouse , Joerg Roedel , iommu@lists.linux-foundation.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?utf-8?B?TWljaGHFgg==?= Wajdeczko , Janusz Krzysztofik Subject: Re: [RFC PATCH] iommu/vt-d: Fix IOMMU field not populated on device hot re-plug Date: Tue, 03 Sep 2019 09:41:23 +0200 Message-ID: <2674326.ZPvzKFr69O@jkrzyszt-desk.ger.corp.intel.com> Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316 In-Reply-To: <52fbfac9-c879-4b45-dd74-fafe62c2432b@linux.intel.com> References: <20190822142922.31526-1-janusz.krzysztofik@linux.intel.com> <1769080.0GM3UzqXcv@jkrzyszt-desk.ger.corp.intel.com> <52fbfac9-c879-4b45-dd74-fafe62c2432b@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Baolu, On Tuesday, September 3, 2019 3:29:40 AM CEST Lu Baolu wrote: > 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? The most simple way to reproduce the issue, assuming there are no non-Intel graphics adapters installed, is to run the following shell commands: #!/bin/sh # load i915 module modprobe i915 # open an i915 device and keep it open in background cat /dev/dri/card0 >/dev/null & sleep 2 # simulate device unplug echo 1 >/sys/class/drm/card0/device/remove # make the background process close the device on exit kill $! Thanks, Janusz > 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 >