Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2990153rdb; Wed, 15 Nov 2023 17:44:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IHkGIwYId7at/3qWrVQHfUzpvn/rWObKwViBGpVfsATOxYvD41GwjGcz3rojWbDHi3hWYMB X-Received: by 2002:a05:6a21:32a5:b0:181:4ae0:ecaa with SMTP id yt37-20020a056a2132a500b001814ae0ecaamr14038010pzb.18.1700099057203; Wed, 15 Nov 2023 17:44:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700099057; cv=none; d=google.com; s=arc-20160816; b=VFssiVVd+9JYnLZZBmhJ3xlUSLrB2TSVVMCXbiGXg7IO4T23hWkr6anyabj9Gt7zCZ /ImEiGJxf1t1thFVvF3GDJfRboiJdQxlfu0nQj+/4mT+wFy/kLc2lWkevMn+t9EuMKHG AoukcXpsazekhz+e+ML/+8otkmvjdZL2GIqWYO3b1IoBZ9r2TS89tYCxdRG06aZydA09 TLJ0FXDFHK9WAe/zT+sgqBaQDgbxWd4bxXLB8jV70uEdcbqQI2drtpLHVrX+ERwcLr6p LvlmCQPennfrn+1ytWqNbIxkufjqraWsXidycioIPhdyWbbJSGzZ551g+tB4ARGqT4tQ nm5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=o/Iqmf+UOkksO6EQzJwwdUzLvFpk1GON5M7ALl4Cirk=; fh=hBlbN11lb2D7fnr07jw/EYBe3bHnmx/nbxMYNEfyRPg=; b=BYOrWijHmqZCRy49cmu/HJqYv2BqXwqmwI1bgo0pftyNOuPtjPgmuoruYQy01HdieE mHxVXJDcfVX1TL1TKK7Xy7oT4cQ6oxjiZ2B5iWQtwWlo97MIUlR0UGW/Qod+hfAGtx8f XleW3NLyOshjEhn2I2nMYeDcJkZc2zTJEiCkAxgIItEYD0YI7Uy0qOVbrMRotXjKDb0b KCs013upcdGL9t6+tTzKqn84/uxr3s0Z8E760fhn3dV4JAoGwEEmkecZvmSImf7wxard dSh6+BdgDoOEJRM3fWLwGkgP4cty/irfrtb4plQ1LaJ+ieu85xIav76g/kg9YlMTwyiR oqpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NGWHtMom; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id t1-20020a17090aba8100b0028014e41ff7si895483pjr.48.2023.11.15.17.44.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 17:44:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NGWHtMom; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 7EDA9809C932; Wed, 15 Nov 2023 17:44:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230024AbjKPBmf (ORCPT + 99 others); Wed, 15 Nov 2023 20:42:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229692AbjKPBme (ORCPT ); Wed, 15 Nov 2023 20:42:34 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71E2B98; Wed, 15 Nov 2023 17:42:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700098951; x=1731634951; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=8V9GxQGhmWnHBzLUfmWUpWRTkqOnn/65G7sZH4jO9eQ=; b=NGWHtMomKc5i9YycJyNQNsCjUjg+VkJZyUANLp0svvscVsOfFvvbonWM TwGTKN+9b0feVx9JWWahfntGE/UCgpMYwg1+cvqS/CiP/AhI3+yk3xvW0 jQTCrJj3cyui1mlaiTHYPGWi3Tib1cNIzTFBFb0PE2lF0PfzFZRC0YYT/ AoBJI8wwwppY+x0V4IZ4WoLkIoYX5v7a3XxlFjoIDFld8Xe5g7YBnFB+P vXwWueRlj8tfkaVxaoXZqzWd+NWChWc+Bxa5h5Yf6vfq4b46TTxvEPOk+ i8k+ZxqnLqwTn1VYUWLITHEKid6YnfbrLSFxagr17q0cmLaIgF6sKhFib A==; X-IronPort-AV: E=McAfee;i="6600,9927,10895"; a="422084504" X-IronPort-AV: E=Sophos;i="6.03,306,1694761200"; d="scan'208";a="422084504" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Nov 2023 17:42:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10895"; a="908957353" X-IronPort-AV: E=Sophos;i="6.03,306,1694761200"; d="scan'208";a="908957353" Received: from linux.intel.com ([10.54.29.200]) by fmsmga001.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Nov 2023 17:42:30 -0800 Received: from [10.93.24.3] (liujing-mobl1.ccr.corp.intel.com [10.93.24.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id 0E2F2580D77; Wed, 15 Nov 2023 17:42:25 -0800 (PST) Message-ID: <8f24918e-aa57-4160-902a-58d10021246e@linux.intel.com> Date: Thu, 16 Nov 2023 09:42:23 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 0/6] IOMMUFD: Deliver IO page faults to user space Content-Language: en-US To: Jason Gunthorpe 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 References: <20231026024930.382898-1-baolu.lu@linux.intel.com> <20231102124742.GA4634@ziepe.ca> From: "Liu, Jing2" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 15 Nov 2023 17:44:14 -0800 (PST) Hi Jason, On 11/15/2023 9:58 PM, Jason Gunthorpe wrote: > On Wed, Nov 15, 2023 at 01:17:06PM +0800, Liu, Jing2 wrote: > >> This is the right way to approach it, >> >> I learned that there was discussion about using io_uring to get the >> page fault without >> >> eventfd notification in [1], and I am new at io_uring and studying the >> man page of >> >> liburing, but there're questions in my mind on how can QEMU get the >> coming page fault >> >> with a good performance. >> >> Since both QEMU and Kernel don't know when comes faults, after QEMU >> submits one >> >> read task to io_uring, we want kernel pending until fault comes. While >> based on >> >> hwpt_fault_fops_read() in [patch v2 4/6], it just returns 0 since >> there's now no fault, >> >> thus this round of read completes to CQ but it's not what we want. So >> I'm wondering >> >> how kernel pending on the read until fault comes. Does fops callback >> need special work to > Implement a fops with poll support that triggers when a new event is > pushed and everything will be fine. Does userspace need also setup a POLL flag to let io_uring go into poll, or io_uring always try to poll? > There are many examples in the > kernel. The ones in the mlx5 vfio driver spring to mind as a scheme I > recently looked at. Thank you very much for guiding the way. We will study the example to understand more. BRs, Jing > Jason