From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FA30C4338F for ; Fri, 23 Jul 2021 10:56:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F3AC360E91 for ; Fri, 23 Jul 2021 10:56:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F3AC360E91 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 754C56B005D; Fri, 23 Jul 2021 06:56:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6DDBB6B006C; Fri, 23 Jul 2021 06:56:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 57DD36B0070; Fri, 23 Jul 2021 06:56:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0081.hostedemail.com [216.40.44.81]) by kanga.kvack.org (Postfix) with ESMTP id 3B8FA6B005D for ; Fri, 23 Jul 2021 06:56:25 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id E5105180ACC51 for ; Fri, 23 Jul 2021 10:56:24 +0000 (UTC) X-FDA: 78393548688.19.D8E2CF1 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf19.hostedemail.com (Postfix) with ESMTP id 4FADCB002460 for ; Fri, 23 Jul 2021 10:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1627037783; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sJzoSvahRJ9+rJQNZV3D9cpQaKJq1s/ffcXYuLzuIZk=; b=brbk/ep5a5rkHvrnEP9waFaXjNJIMC2bbKSRgtGKpdyuqjWdllvwYI74DB3QTp0diwjpUK Z/9L701nzqyXgzStl3hyZ971gYpU7CmGYWqaL8wdIZdFn+s+FEt3Mz9Bo0+9L+Yts8p1/D 7viiDWF1J3wLFsdawBhG+sZlsTn5Tfk= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-144-AhWGS3x4PVaC5DylB8Z9kQ-1; Fri, 23 Jul 2021 06:56:21 -0400 X-MC-Unique: AhWGS3x4PVaC5DylB8Z9kQ-1 Received: by mail-ed1-f71.google.com with SMTP id j22-20020a50ed160000b02903ab03a06e86so531218eds.14 for ; Fri, 23 Jul 2021 03:56:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=sJzoSvahRJ9+rJQNZV3D9cpQaKJq1s/ffcXYuLzuIZk=; b=hzGitT0+Hh/QT4Hpm4WgZU4pKybGsNaUbstJgPzGZaTq2IOhs4PrXQ4twkwdKURLAU PT2KPPEYLWg/iBrrw3dOjdYjowegBCIbKS1/R9bEet64yLKPh+CbNYTMU1xnrGb5BpAv 8eJKD9mJQOOFXYE4jX2T69eFNEv1reb1whZvL4RHv7jTNk5GnSiVM0PTWT3CU9QsGpj6 aBnRGdgSMgpPH4NOkDny7NfiB0gW7pKm4dxQj2mJpwzayTQmOSyFV2R4zwBeUGWitqKd kLwLHK/AIL80D8lI4XuaRPYifJx8R3DwvNmC7c2mwBzZUJMz/hzUk8iihxuWRXHMW5z9 INXg== X-Gm-Message-State: AOAM531ummwwCnKnsiVvFOQZMLjNMASBYW9CI1wPQQeYGk+Zf5/IbCKJ nnKzrc1FD2GK0BSYnEH++PnNFW9aoAFs4hWmhPpZKegVgBo+3r5g/t+VpV+yT7RaughwftwRx1k Yeb4sayXcmlo= X-Received: by 2002:a17:907:f98:: with SMTP id kb24mr3965394ejc.554.1627037780273; Fri, 23 Jul 2021 03:56:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyX3+gu++3vSDW815wa55NOnY7cIAYhWyeDYffoMGfRNHivlcrLx6i0ZhGo4wRJUAYjhtHmMw== X-Received: by 2002:a17:907:f98:: with SMTP id kb24mr3965372ejc.554.1627037779975; Fri, 23 Jul 2021 03:56:19 -0700 (PDT) Received: from ?IPv6:2001:b07:add:ec09:c399:bc87:7b6c:fb2a? ([2001:b07:add:ec09:c399:bc87:7b6c:fb2a]) by smtp.gmail.com with ESMTPSA id t15sm10394010ejf.119.2021.07.23.03.56.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Jul 2021 03:56:19 -0700 (PDT) To: Hillf Danton Cc: Thomas Gleixner , Sebastian Andrzej Siewior , "Michael S. Tsirkin" , linux-mm@kvack.org, LKML , Al Viro References: <8dfc0ee9-b97a-8ca8-d057-31c8cad3f5b6@redhat.com> <475f84e2-78ee-1a24-ef57-b16c1f2651ed@redhat.com> <20210715102249.2205-1-hdanton@sina.com> <20210716020611.2288-1-hdanton@sina.com> <20210716075539.2376-1-hdanton@sina.com> <20210716093725.2438-1-hdanton@sina.com> <20210718124219.1521-1-hdanton@sina.com> <20210721070452.1008-1-hdanton@sina.com> <20210721101119.1103-1-hdanton@sina.com> <20210723022356.1301-1-hdanton@sina.com> <20210723094830.1375-1-hdanton@sina.com> From: Paolo Bonzini Subject: Re: 5.13-rt1 + KVM = WARNING: at fs/eventfd.c:74 eventfd_signal() Message-ID: <41e2046f-ebbb-9fb2-3b30-1d6edceaaced@redhat.com> Date: Fri, 23 Jul 2021 12:56:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210723094830.1375-1-hdanton@sina.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 4FADCB002460 Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="brbk/ep5"; spf=none (imf19.hostedemail.com: domain of pbonzini@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=pbonzini@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Stat-Signature: khxjpyhoksrak6hxo7x5p3axdaczwfod X-HE-Tag: 1627037784-537503 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 23/07/21 11:48, Hillf Danton wrote: > On Fri, 23 Jul 2021 09:59:55 +0200 Paolo Bonzini wrote: >> First and foremost, I'm not sure what you are trying to fix. >=20 > The change proposed builds the return value without assuming that the > event count is stable across poll_wait(). If it is unstable then we kno= w > there are concurrent reader and/or writer who both are ingnored current= ly. Concurrent reads or writes have their own wake_up_locked_poll calls.=20 Why are they not enough? >> Second, the patch is wrong even without taking into account the lockle= ss >> accesses, because the condition for returning EPOLLOUT is certainly wr= ong. >=20 > Given it is detected that event count was consumed, there is room, thou= gh > as racy as it is, in the event count for writer to make some progress. For one, you do not return EPOLLIN|EPOLLOUT correctly. >> Third, barriers very rarely speak for themselves. In particular what >> do they pair with? >=20 > There is no need to consider pair frankly. Barriers are just readded fo= r > removing the seep in the comment. Then the comment goes with the seep. Then you would need an smp_mb() to order a spin_unlock() against a=20 READ_ONCE(). But adding memory barriers randomly is the worst way to=20 write a lockless algorithm that you can explain to others, and "there is=20 no need to consider pair frankly" all but convinces me that you've put=20 enough thought in the change you're proposing. (Shameless plug: https://lwn.net/Articles/844224/). > What the comment does not cover is the cases of more-than-two-party rac= e. But, you still haven't explained what's the bug there. Paolo