Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp4000rdb; Mon, 15 Jan 2024 09:59:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IGz/5GLdV1W1xJ3zDSoZ+s2CDn/4gEIyqwuXrrJNvgwaQG3Kc3cgMlHYBeq8YCrF27kXkJf X-Received: by 2002:a05:6808:1285:b0:3bd:463f:c64b with SMTP id a5-20020a056808128500b003bd463fc64bmr4608526oiw.106.1705341549774; Mon, 15 Jan 2024 09:59:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705341549; cv=none; d=google.com; s=arc-20160816; b=PCVAUYL2HVTTIn2xc/4pkJlZrgF/KA3l4RhwuCJit62/O/Hd1dOqH6kZle2j2Rma+R Ujj1AnHfO+TE0T8bbXVSqqXzzZlNIRCdlq7+eY08N3ExXlWpJepV4PIQKwKSZ/VILY29 T48trHlHVpuY7g/Gl8mhWWFWJJDkQwA38K0bnzH9+6E8K/GLE20y0txqPvRgIHHdHTra Fut3AjlnfzMKBL7IFN6WR5x63cXHQ7HLy9WXtg+wimkMwIvqWxrt40s/jR0RzSZSBFXS H71k4Ikj7cxuQ8sTJaTOEDcjpniP8o5qazsKN00JYah5Zt0RBMLb61MSduox2dWBCLRC Drqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=1wGaOr22tAz8ZsKDr+cBOsYsgD9Gp6tmTN5qVEUIqRw=; fh=0mbG92jHgBxwQEr8PNrEFCJOgdGC4ALxSM2tBqI6lgo=; b=GcuvNp65Ulh9RT3QKZfHYvtDAVI+MsUwujDqWGpu+lbgbevLGBhw5AZSQfDT501SZL ytsqGt0uD6YPmE33xuR/HpxfL42pNkpFAGETAzwgRPukODJXOBrndTUoVV+7v6s7ixoh UkyzdZKtayxpvKNEf6UBtBeMwahAD6K4aSjx6wEvHARY46dAnIC/eXgquwYGqjqNl0cb JqLbmO8dOoo0YqpAmObr1DZ/JQKuxLEOxQsEFa8yJDp2Chrb7I05gyFbgUfZlOLIxVpv NFcj3tIrjoyCFVVwPH+CS7RYoSPMRylvGKFsbwwSCEujJ13pmCLuA0sZwDFgKbMsW9uf y2aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=ILZGkR44; spf=pass (google.com: domain of linux-kernel+bounces-26338-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26338-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id l11-20020a05622a174b00b00429bfedc3d9si8199622qtk.87.2024.01.15.09.59.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 09:59:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26338-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=ILZGkR44; spf=pass (google.com: domain of linux-kernel+bounces-26338-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26338-linux.lists.archive=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 831751C21E88 for ; Mon, 15 Jan 2024 17:59:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D6FE9182A3; Mon, 15 Jan 2024 17:59:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="ILZGkR44" Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9F6218046 for ; Mon, 15 Jan 2024 17:59:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Received: by mail-qk1-f171.google.com with SMTP id af79cd13be357-7833a51a1aaso502894185a.0 for ; Mon, 15 Jan 2024 09:59:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1705341540; x=1705946340; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=1wGaOr22tAz8ZsKDr+cBOsYsgD9Gp6tmTN5qVEUIqRw=; b=ILZGkR44NdOor92BDo3h2CNCw9AGUff2VFZN4safD0dL1Y6fqJBwGRcgfTsn0upGDf XOypfW1xsJK4BuNPD4oyusXyNSRXMsnMVB5hQWonegGg8IHJsDFPaoO2HtA/TlIPInMA zc+2Z1GCc+bhuIFSPITTPsPS8Yzma0qsDyT5IGl7uq+oE8tuJXBz/7rnNqnpyR6ImYt5 4lmk25EL0dJ8v7JO7PwbsOHtqi9LMTzoxzsOPg4Ao8QfQMp94EkDAVaHGCCU8aitXqDn 0cOBsqJ20RmhgCqFGo/QksyCT0lEKKOqQp0WHGvnbxZagB/bfltJyiF420khfBiPhFj8 Ylsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705341540; x=1705946340; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1wGaOr22tAz8ZsKDr+cBOsYsgD9Gp6tmTN5qVEUIqRw=; b=hyZjVPOpCRrHqCtOxKpjELzdNGs5PtPH1+Nl8oXMX0U9b3kmEc3CntLSuplVj8Yz5Z EQOhVqi3nBDExJEKjNWntDUDRUAUz9q21u8CvKOCp6R+21LSoUmmTxdwQoDAT8l96jPC eo5JQTOfuW0lgGQJHvj8/54UCuBdssfoFAR0c7EFsIWjORGPBLL2jTAR+4uv/+R8HMJb YGNoTcji1R5ewA30GZlemsHAl1HeLqE21QaDshwqz8VpiW7Ee+/Pa5WR9bIxb23sf9wQ zD6mGUoxNTXwu6yex+1ZhBUwOLce0a2/iATPXfmtS/th0sKaXKJZCI33oW0gorjNznVo zpqg== X-Gm-Message-State: AOJu0YxcZwjKS+zlElLGbGt6YZEb8YRyjBf5arHa0fDhGEqn/CT1qKQj ljaL8lMpy93W5QEeM5ME2EaZPmiRNrkPvw== X-Received: by 2002:a05:6214:518c:b0:67f:d236:5c0f with SMTP id kl12-20020a056214518c00b0067fd2365c0fmr7596556qvb.90.1705341540583; Mon, 15 Jan 2024 09:59:00 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-68-80-239.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.80.239]) by smtp.gmail.com with ESMTPSA id d10-20020a0cfe8a000000b0067f454b5307sm3452291qvs.108.2024.01.15.09.59.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 09:59:00 -0800 (PST) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1rPREh-003u0V-Kj; Mon, 15 Jan 2024 13:58:59 -0400 Date: Mon, 15 Jan 2024 13:58:59 -0400 From: Jason Gunthorpe To: Shameerali Kolothum Thodi Cc: Lu Baolu , Kevin Tian , Joerg Roedel , Will Deacon , Robin Murphy , Jean-Philippe Brucker , Nicolin Chen , Yi Liu , Jacob Pan , "iommu@lists.linux.dev" , "linux-kselftest@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2 4/6] iommufd: Deliver fault messages to user space Message-ID: <20240115175859.GC50608@ziepe.ca> References: <20231026024930.382898-1-baolu.lu@linux.intel.com> <20231026024930.382898-5-baolu.lu@linux.intel.com> <20240115164723.GB50608@ziepe.ca> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Jan 15, 2024 at 05:44:13PM +0000, Shameerali Kolothum Thodi wrote: > > If it is valid when userspace does read() then it should be valid when > > userspace does write() too. > > > > It is the only way the kernel can actually match request and response > > here. > > The kernel currently checks the pasid only if IOMMU_FAULT_PAGE_RESPONSE_NEEDS_PASID > is set. > > https://lore.kernel.org/linux-iommu/20200616144712.748818-1-jean-philippe@linaro.org/ > > > So, I think you have a userspace issue to not provide the right > > pasid?? > > This is not just ARM stall resume case, but for some PCI devices as well as per > the above commit log. So do we really need to track this in userspace ? Yes, these weird HW details should not leak into userspace. The PASID is required on the read() side, userspace should provide it on the write() side. It is trivial for it to do, there is no reason to accommodate anything else. Alternatively I'm wondering if we should supply a serial number to userspace so it can match the request/response instead of relying on guessing based on pasid/grpid? Jason