Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp59381rdf; Mon, 20 Nov 2023 16:16:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IFiSMTwCMUoWPT8qX/Dyo/I3I4sTcdX6ax8YLEQWW/dp2VOulO98Jr1Y7jtvBP5+RgB/4er X-Received: by 2002:a17:902:6901:b0:1ce:95a:9210 with SMTP id j1-20020a170902690100b001ce095a9210mr6673146plk.63.1700525759880; Mon, 20 Nov 2023 16:15:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700525759; cv=none; d=google.com; s=arc-20160816; b=Q7PzWovJor7tCUIbYNLtzXhnzFL7I3tRMBpq5A5JCeNgrpSDlF3fQnEJc1UylKyC0H Ps1dDHZm4JH1sA5WZW5d993JFRCU/6XiLcChOx55stA0+BGL1KUCgSrF6uH/Tgn9ncEZ T5WdGI2tAofvDBoLdGAmTahP5IBbjGHdfDsneCroRejjyB3VftanIcEh5hA4XgDeqmod jNrzJFW0rIVMXtNB/HUE4ZhYMWGoxAbnSFGqikejphqGJ9mXG0vxWij+/evZc6xohGuv 6Li2RPT9LKII/MzV/iwtPvwZh9PGzwwV/QoJthrNJF1xfQY9O3buHqVlbY/6iVtnxE6q LKIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=cM4nXDiFJOID9V8g8m4rSnX0D2eYIgzoLqQUP7X4x5w=; fh=1qlkEpGXJSO2l20kOUepW35hWgHMhwFrv3ZEX5HgV8I=; b=v02LnhYxcNUbg+OY0jfidOM6YOZkaXh6ATcbS8liNQoGeSF0Uf1bwa1z2foGNFdN2Q mKnmKP0o8nU5VbQP7qyEM4On36l3o9Pl1UQSCJJ8huwj5dBTxJP6EqdUwhVWi5xB+Vi1 1ZQIx34R2tOiQtDL47YrmdkG/CCZktH1HiudZMLRlJhKFYXKP1o56bEp/dgQGjEBAXlJ 1+CEF6I7B4TgomWpohT8p2RHEq7hmge9JGTSnpYeHtjsNq792s6WlLTLQtyZ1+RXxXXG eUfRVODTZdA+ao+tlYqxqAp83M/gWUp8JcOBTDxMF8p1Y1J0jWMrTPrk2W7ZQCO5/noJ vIxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=UOGvAkMz; 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 Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id a23-20020a17090ad81700b002850dc3a3c2si6481900pjv.155.2023.11.20.16.15.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 16:15:59 -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=@ziepe.ca header.s=google header.b=UOGvAkMz; 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 Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 95F21807C56E; Mon, 20 Nov 2023 16:15:09 -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 S229767AbjKUAO7 (ORCPT + 99 others); Mon, 20 Nov 2023 19:14:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbjKUAO6 (ORCPT ); Mon, 20 Nov 2023 19:14:58 -0500 Received: from mail-oo1-xc33.google.com (mail-oo1-xc33.google.com [IPv6:2607:f8b0:4864:20::c33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADBF7BE for ; Mon, 20 Nov 2023 16:14:54 -0800 (PST) Received: by mail-oo1-xc33.google.com with SMTP id 006d021491bc7-5872b8323faso2851388eaf.1 for ; Mon, 20 Nov 2023 16:14:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1700525694; x=1701130494; 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=cM4nXDiFJOID9V8g8m4rSnX0D2eYIgzoLqQUP7X4x5w=; b=UOGvAkMzHSUdsL6VXs/dSpIWDQFNn3S7Ovaghpcz3SKOanJvWPiwH/Ec1KleH4CsPU hnCnm+6LNvzNIRiMbR+NnVoDlAOVbV0Rzrapyqk5tnU2XscX3psiwhMaGvNYnnQ4ur1V 25tNQ0e1L5h40ej1tX4yKBOnKDx+vogOKG/Xhb8dEXglLx/olfQTNHgxP3OiG/2LtlMr ToyHsFK73VB7v4nyQLysCoRSsT2Zw/Yzmnw8yzgHssby01ENKcJQ+ENx2cv+7ia2wi4w aU9d9lSKWmJcPV06R4/lUXO6HwFlUipPNNtJHSi3b1w+/0x25lnuIoQOXWFqX90v2cc9 RGMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700525694; x=1701130494; 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=cM4nXDiFJOID9V8g8m4rSnX0D2eYIgzoLqQUP7X4x5w=; b=HGzGCogY7c+1tPCaJPwx3UqBTVM8ZCIOu6BR54UCfRM09adyJk0YK9Zn8A1D944MMm tzhjcSUNmvWumMN0ZywhYR3hzp8/a3jJ0/0uzL07lj//cKuU97PE42oGNX89nthjHtcG 3XYBltoaWfXsPml+ddV3WPXIq/vr9jslRsi1GLOqfifWQdUNFdMTvEm4iNeYu9H8RfVs Y0OmdX82J8gXTTT+jStpPgZcpPpQdtuTFtYFJWa/5x7hvd0Tq2ayUjlet+hT9AUGr7b5 eCrb5vJuUlwGTgIrpKwTeNYH9eIMzsqm/biLnsCQg4q8iHghEsa+aYPYwo+A0yy67TLA nxpw== X-Gm-Message-State: AOJu0YwI2g7D5ctCIolo37jHStITZ5Gi/JG+pGQxaxkHaMC3sqCMh/G8 5qGuVQaTUrLeZ49DzZK2BIkFsw== X-Received: by 2002:a05:6820:1628:b0:581:ed12:98c6 with SMTP id bb40-20020a056820162800b00581ed1298c6mr10069537oob.4.1700525694024; Mon, 20 Nov 2023 16:14:54 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-134-23-187.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.134.23.187]) by smtp.gmail.com with ESMTPSA id w9-20020a4aaf09000000b005840b5783a1sm1569061oon.43.2023.11.20.16.14.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 16:14:53 -0800 (PST) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1r5EPk-0019u1-1E; Mon, 20 Nov 2023 20:14:52 -0400 Date: Mon, 20 Nov 2023 20:14:52 -0400 From: Jason Gunthorpe To: "Liu, Jing2" 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 0/6] IOMMUFD: Deliver IO page faults to user space Message-ID: <20231121001452.GF10140@ziepe.ca> References: <20231026024930.382898-1-baolu.lu@linux.intel.com> <20231102124742.GA4634@ziepe.ca> <8f24918e-aa57-4160-902a-58d10021246e@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8f24918e-aa57-4160-902a-58d10021246e@linux.intel.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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]); Mon, 20 Nov 2023 16:15:09 -0800 (PST) On Thu, Nov 16, 2023 at 09:42:23AM +0800, Liu, Jing2 wrote: > 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? io_uring can trigger poll and use other approaches, it is flexible the driver can scale this in different ways. Jason