Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1870354ybv; Thu, 6 Feb 2020 11:17:49 -0800 (PST) X-Google-Smtp-Source: APXvYqxbE9Mf6fUImoe4Yt55sHUPqW2eraM/94zW0Te0P1suCaehgkShvUSylPQXddwNyN7BN7K5 X-Received: by 2002:aca:f487:: with SMTP id s129mr8201837oih.75.1581016669171; Thu, 06 Feb 2020 11:17:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581016669; cv=none; d=google.com; s=arc-20160816; b=Ct/CkJJ/0EUKk6nDkeLi6G6EVNmRtfoVDO3VdbZ/ZdiYuLzO9jSQnsOU2H2RKrUqQH hliiGJGeuc94vd2cKNbDZUkztIOrz4NM4jwLwDnZ7Ij2ypSq0wYcNJZXchwbEibr/CYZ jzh5xwa13pnAFB5pPkIAJ3pcWvrd+e4iQu5kYE/d78RilqdlaPSxENOYHQKUDYed6erP 8CxaTDMUdO3GI2aa6K7awaJXmLwb3SBg/1+Xaaaek7ZxJSag+4Ed288CqptRM8BqKQal aw0z+BNn8Lsy6gqX6VgNV6FRp/8fycQIggkl7afVnsTSxvCNlJnVlsZ2MQGhp1nLioy7 VPaQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=Yyz692Z6QnWkYdRBwPjOV5YRM7wE4OOKfECgwMN1dhg=; b=O16J/DMB9ZGCkBRrp4ZsJX7KByADa5ATI/2t6464nwU5giUDivkp8Wmwh+3uVNSRos S0C6gugwdHKIpV7NUFBcM7PGOHQ4ssHRv2h/hk7WH7aitu2drNBMuYn8fmMYlpRCHr/U l3RrQ0c0e5HTsWShF4BeVqRg8ly6HBnTnjpR5UntvOoNVLtlfh8w2OP8V1MDAhRN9Jj1 CMZw1LokgrQ+eotMkRbB7wYwQBaGd+3P2mAKoR9jEnPzkJIUvgZ2uSABSepnFPxSj3s2 gqKuXOl3b7dxONghNk5S9tAIG1rMg44O0a5GtArL9+JN+qJ7kcSgOZu5GUQ8qUd2l7BA j/bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=Grq6uFMg; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j15si2512145oii.163.2020.02.06.11.17.36; Thu, 06 Feb 2020 11:17:49 -0800 (PST) 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; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=Grq6uFMg; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727930AbgBFTPx (ORCPT + 99 others); Thu, 6 Feb 2020 14:15:53 -0500 Received: from mail-io1-f65.google.com ([209.85.166.65]:43774 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726990AbgBFTPw (ORCPT ); Thu, 6 Feb 2020 14:15:52 -0500 Received: by mail-io1-f65.google.com with SMTP id n21so7456769ioo.10 for ; Thu, 06 Feb 2020 11:15:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Yyz692Z6QnWkYdRBwPjOV5YRM7wE4OOKfECgwMN1dhg=; b=Grq6uFMgAOnJdzWKvD6ZREbmfO9JcWzNoe0EBRumz6W7fuDuDuTj/fMO82/kOD32Yw gR5aluhel4VewaE9wMutb9gi4yhS+KUBIvNGv66ywt7H+XvGB4z0PiFBSmo2H7Op8zf0 hxwwN+ZEaxnAlo0/H2MDU85KF+qTk/2SWLMwiniMlqailA+T8U/uW4RGVVi4jgvyxfi4 VMjc9z9cA9zyxlIfQmtvefIjFs60wIJMyYQ2rTu5n5Ta+R45zP411g0UivDzTIJM2cH1 Ew1ace86wpP0pNy9E0uDWCZKxRQpDdle7AiiUWxSHG1yN8px1wO4P5ZpCJdMUnWXFd9W yOcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Yyz692Z6QnWkYdRBwPjOV5YRM7wE4OOKfECgwMN1dhg=; b=QAmLW1NC5xahouP6LBWwzUJXJioLrVGLLMATjpKSkmMJdHhWRHqeib82NUC0XX9hx0 b4YVExI+VhZJPh5Uofn6XAheisEcM9kS7AQpsEQqZjMwB1vFGNlk9Qg5h249YOoFWS4a U1pEbc5mgbKQi9NX9mUUt5pamXQwzatyEtRWiKeJaXPopEnnx/C0G92+MhnRLVIYKFwU CwpUi1TcgD7brsprhCgWWO+BsCohfdBBpQGLr+/tYZRV4DTvtAjlCxvgExVLpmMT78X8 KsB5zSqj77PJbNqktGsCLH5dBncnUG0wVkVVceu1+svhoQ4qYFEChJH+HoKssAQX1Qeu Yjrg== X-Gm-Message-State: APjAAAX4s+khoLkFi43VEuO8Qpu/833uAu0sgQ/YV4AEVl5lzA68WfcD +9O6aI1/QJ3dGfYXKUS+ajZpmPuacAg= X-Received: by 2002:a5e:9246:: with SMTP id z6mr35891873iop.232.1581016550692; Thu, 06 Feb 2020 11:15:50 -0800 (PST) Received: from [192.168.1.159] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id i11sm132553ion.1.2020.02.06.11.15.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 06 Feb 2020 11:15:50 -0800 (PST) Subject: Re: [PATCH liburing v2 0/1] test: add epoll test case To: Stefano Garzarella Cc: linux-kernel@vger.kernel.org, io-uring@vger.kernel.org References: <20200131142943.120459-1-sgarzare@redhat.com> From: Jens Axboe Message-ID: Date: Thu, 6 Feb 2020 12:15:49 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/6/20 10:33 AM, Stefano Garzarella wrote: > > > On Fri, Jan 31, 2020 at 4:39 PM Jens Axboe wrote: >> >> On 1/31/20 7:29 AM, Stefano Garzarella wrote: >>> Hi Jens, >>> this is a v2 of the epoll test. >>> >>> v1 -> v2: >>> - if IORING_FEAT_NODROP is not available, avoid to overflow the CQ >>> - add 2 new tests to test epoll with IORING_FEAT_NODROP >>> - cleanups >>> >>> There are 4 sub-tests: >>> 1. test_epoll >>> 2. test_epoll_sqpoll >>> 3. test_epoll_nodrop >>> 4. test_epoll_sqpoll_nodrop >>> >>> In the first 2 tests, I try to avoid to queue more requests than we have room >>> for in the CQ ring. These work fine, I have no faults. >> >> Thanks! >> >>> In the tests 3 and 4, if IORING_FEAT_NODROP is supported, I try to submit as >>> much as I can until I get a -EBUSY, but they often fail in this way: >>> the submitter manages to submit everything, the receiver receives all the >>> submitted bytes, but the cleaner loses completion events (I also tried to put a >>> timeout to epoll_wait() in the cleaner to be sure that it is not related to the >>> patch that I send some weeks ago, but the situation doesn't change, it's like >>> there is still overflow in the CQ). >>> >>> Next week I'll try to investigate better which is the problem. >> >> Does it change if you have an io_uring_enter() with GETEVENTS set? I wonder if >> you just pruned the CQ ring but didn't flush the internal side. > > If I do io_uring_enter() with GETEVENTS set and wait_nr = 0 it solves > the issue, I think because we call io_cqring_events() that flushes the > overflow list. > > At this point, should we call io_cqring_events() (that flushes the > overflow list) in io_uring_poll()? > I mean something like this: > > diff --git a/fs/io_uring.c b/fs/io_uring.c > index 77f22c3da30f..2769451af89a 100644 > --- a/fs/io_uring.c > +++ b/fs/io_uring.c > @@ -6301,7 +6301,7 @@ static __poll_t io_uring_poll(struct file *file, poll_table *wait) > if (READ_ONCE(ctx->rings->sq.tail) - ctx->cached_sq_head != > ctx->rings->sq_ring_entries) > mask |= EPOLLOUT | EPOLLWRNORM; > - if (READ_ONCE(ctx->rings->cq.head) != ctx->cached_cq_tail) > + if (!io_cqring_events(ctx, false)) > mask |= EPOLLIN | EPOLLRDNORM; > > return mask; That's not a bad idea, would just have to verify that it is indeed safe to always call the flushing variant from there. -- Jens Axboe