Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp66280rdb; Thu, 21 Dec 2023 03:02:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IEll0doGAb2lkPJ01Rdj5qKI0tSoJiPl1VoUBMXhT5JIgRPNptttWvD4Lyw2g77jnxUTrLM X-Received: by 2002:a05:6a20:914a:b0:18f:97c:8a29 with SMTP id x10-20020a056a20914a00b0018f097c8a29mr1382396pzc.84.1703156555686; Thu, 21 Dec 2023 03:02:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703156555; cv=none; d=google.com; s=arc-20160816; b=wEPcXekZwLjlIqihevPQM64fT6dq/3Sp83VlGvX1GvPHqujYIGQaLvh7ZkiqVsJrOm tzpkhkTpOp32gy+T+Jf1IsMph4tyzH39uUy3MDgZgdVVfh/vqRFLx+KM1pjY65XVk6Zt 2T+TOvT9RCekcFyZZfLFuZN3eVKN003LUF1Od6seL0slFfvIijICHyass6/TcDoR2SWX HAhCFt6TK9OBA4YtAHogQKCoRI4i5YJHEJq023wsD+VKhTyOsDaUZZUQS5E5OGORLFGg gj9ybpjMxH55meAszaJMJSRU3z+O2Y6CoAJhCWOZRVvWdvNdDt0/zoQFil2PleqAmDI2 R+qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=ElSrmozZyUsokAThnq4wPW5kOt6faY/NHCM9TivHbsA=; fh=V7POK2KT4nsXKsQbvwfJ8cI8F9WjhWBr90Sb76guZqM=; b=hrEQ6Qcmp31eVif6DgqdUZhFswq6KpPpjirhztNUBmsE1MddyyLkSz495urEYSQfOu MSiPSvL/UrAA7DFu19AdV4TKJs/9MrYVU60HxJiSS+ZmV5dXAZYrCw2peJXQJbDvFG34 ErF7B+pr6EC2Toay0EN9+/PfhSJv6ct3E2qLo+HGvwSDwF2pAQ3+Qbo1XsvIolO8GtxT ekklasHHiAYe04fJOUjY6uXPWiols4hTiC5AKSojJUMpVicfuw6kDldlhlU3uOR1jwOp MAgqDUsoMzAIqnjR4VeS/UKcO28YCasY8v5EytjHaJCS+Jyyt4G+LooO5xBEigLcDk6q 2ysA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-8259-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8259-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y15-20020a056a001c8f00b006d9415b7697si1391698pfw.339.2023.12.21.03.02.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 03:02:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8259-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-8259-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8259-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5F3CC286184 for ; Thu, 21 Dec 2023 11:02:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9526C6D1CA; Thu, 21 Dec 2023 11:02:09 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 05C216BB59; Thu, 21 Dec 2023 11:02:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 552F92F4; Thu, 21 Dec 2023 03:02:52 -0800 (PST) Received: from [10.57.85.225] (unknown [10.57.85.225]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F1CB93F5A1; Thu, 21 Dec 2023 03:02:05 -0800 (PST) Message-ID: <6f49be01-89e3-4407-9813-51d62e723947@arm.com> Date: Thu, 21 Dec 2023 11:01:56 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] iommu/vt-d: don's issue devTLB flush request when device is disconnected To: Lukas Wunner Cc: Ethan Zhao , bhelgaas@google.com, baolu.lu@linux.intel.com, dwmw2@infradead.org, will@kernel.org, linux-pci@vger.kernel.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Haorong Ye References: <20231213034637.2603013-1-haifeng.zhao@linux.intel.com> <20231213034637.2603013-3-haifeng.zhao@linux.intel.com> <20231213104417.GA31964@wunner.de> <3b7742c4-bbae-4a78-a5a6-30df936a17d4@arm.com> <20231221104254.GB12714@wunner.de> Content-Language: en-GB From: Robin Murphy In-Reply-To: <20231221104254.GB12714@wunner.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2023-12-21 10:42 am, Lukas Wunner wrote: > On Wed, Dec 13, 2023 at 11:54:05AM +0000, Robin Murphy wrote: >> I think if we want to ensure ATCs are invalidated on hot-unplug we need an >> additional pre-removal notifier to take care of that, and that step would >> then want to distinguish between an orderly removal where cleaning up is >> somewhat meaningful, and a surprise removal where it definitely isn't. > > Even if a user starts the process for orderly removal, the device may be > surprise-removed *during* that process. So we cannot assume that the > device is actually accessible if orderly removal has been initiated. > If the form factor supports surprise removal, the device may be gone > at any time. Sure, whatever we do there's always going to be some unavoidable time-of-check-to-time-of-use race window so we can never guarantee that sending a request to the device will succeed. I was just making the point that if we *have* already detected a surprise removal, then cleaning up its leftover driver model state should still generate a BUS_NOTIFY_REMOVE_DEVICE call, but in that case we can know there's no point trying to send any requests to the device that's already gone. Thanks, Robin.