Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2939892ybh; Mon, 16 Mar 2020 12:36:37 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtfqKJsTzza9WdzLbvfwr41nu+VokXphblUKWTM/kZyU4HszV/Qd+oYP56WTtQBgwSEAuU/ X-Received: by 2002:a9d:728e:: with SMTP id t14mr728165otj.63.1584387397472; Mon, 16 Mar 2020 12:36:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584387397; cv=none; d=google.com; s=arc-20160816; b=WysFsl3j56Xy+efii5D95agBDYumix/NdMbvvlcyJRKehf8s7ylFRAucBuCB+V8nZe o56SbUwd/6Od9nm5a2EI8HBj5L6I7emvNwmvAiS2oISdq81YgQYcpJjLEWCHEYDD/ecL IOLKrAAKpPjyCojdPmP7m174ZOIRGqYNbJSSIlLiqpVEvzomrNMuhs9Gi7McwtswUdku 29K60OPm9R3ONGSioQJs/TaYRvx5503o/rxlvypkUimDqGQdeclO1VVe67ULKwIlTFnX oZI5StqgE1RYIyWcvPNVbAmFoBoF19Jhpa0IENp04lXk+suB3iHaQWajdua6dlLqhiSe aLdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=W8OfUyHm0UTWayZ5RkWZ2zRjaHzq09KBG/yLGxvJAik=; b=08CZvYlEZRd4+Q1EyjLeLs3mglttq6btIxXLKsqape39rDiTb1/xMBmWVC86u6CVAn Phtip06Ed026HmvvGfpfGxx34BodvOzNxQMNbholbMldRhF8xd+mk7Yb0pojxTyNX2qv yEcjvXPCEJEiVy03NupiEOQBlHMOa+C+1hQmZQ4F3ONGZuqhP11rnMJeYb1bYIjbS1HH l0L2QFHi9qWGzwmuQ1Fi0PpRAQuSKLkFTdVCfFVaHPtg1taaVn8m7PDyA004TgoB6rbi 6cc8lBp1EwLcDBJz+uvRGP8zou82Gw3z/gyqwmQAYb3u6nm7tXRH7xwUCqO+3PqUCUXG zogA== ARC-Authentication-Results: i=1; mx.google.com; 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 u7si376914otq.323.2020.03.16.12.36.23; Mon, 16 Mar 2020 12:36:37 -0700 (PDT) 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; 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 S1732441AbgCPTet (ORCPT + 99 others); Mon, 16 Mar 2020 15:34:49 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:52812 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732366AbgCPTet (ORCPT ); Mon, 16 Mar 2020 15:34:49 -0400 Received: from p5de0bf0b.dip0.t-ipconnect.de ([93.224.191.11] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jDvVT-0004MQ-5x; Mon, 16 Mar 2020 20:34:35 +0100 Received: by nanos.tec.linutronix.de (Postfix, from userid 1000) id 84ABC1013B2; Mon, 16 Mar 2020 20:34:34 +0100 (CET) From: Thomas Gleixner To: Logan Gunthorpe , Sebastian Andrzej Siewior , linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Ingo Molnar , Will Deacon , "Paul E . McKenney" , Joel Fernandes , Steven Rostedt , Linus Torvalds , Kurt Schwemmer , Bjorn Helgaas , linux-pci@vger.kernel.org Subject: Re: [PATCH 3/9] pci/switchtec: Don't abuse completion wait queue for poll In-Reply-To: <4d3a997d-ced4-3dbe-d766-0b1e9fc35b29@deltatee.com> References: <20200313174701.148376-1-bigeasy@linutronix.de> <20200313174701.148376-4-bigeasy@linutronix.de> <4d3a997d-ced4-3dbe-d766-0b1e9fc35b29@deltatee.com> Date: Mon, 16 Mar 2020 20:34:34 +0100 Message-ID: <87v9n4ccvp.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Logan Gunthorpe writes: > On 2020-03-13 11:46 a.m., Sebastian Andrzej Siewior wrote: >> 1) It cannot work with EPOLLEXCLUSIVE > > Why? You don't explain this. man epoll_ctt(2) EPOLLEXCLUSIVE (since Linux 4.5) Sets an exclusive wakeup mode for the epoll file descriptor that is being attached to the target file descriptor, fd. When a wakeup event occurs and multiple epoll file descriptors are attached to the same target file using EPOLLEXCLUSIVE, one or more of the epoll file descriptors will receive an event with epoll_wait(2). As this uses complete_all() there is no distinction possible, because complete_all() wakes up everything. > And I don't see how this patch would change anything to do with the > call to poll_wait(). All you've done is open-code the completion. wake_up_interruptible(x) resolves to: __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL) which wakes exactly 1 exclusive waiter. Also the other way round is just working because the waker side uses complete_all(). Why? Because completion internally defaults to exclusive mode and complete() wakes exactly one exlusive waiter. There is a conceptual difference and while it works for that particular purpose to some extent it's not suitable as a general wait notification construct. Thanks, tglx