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=-0.8 required=3.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 82B3FC63793 for ; Thu, 22 Jul 2021 05:58:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CDF3561244 for ; Thu, 22 Jul 2021 05:58:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CDF3561244 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5339E6B005D; Thu, 22 Jul 2021 01:58:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E49E6B0071; Thu, 22 Jul 2021 01:58:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D3786B0072; Thu, 22 Jul 2021 01:58:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0073.hostedemail.com [216.40.44.73]) by kanga.kvack.org (Postfix) with ESMTP id 1F0A86B005D for ; Thu, 22 Jul 2021 01:58:27 -0400 (EDT) Received: from smtpin40.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C234C181AC1F5 for ; Thu, 22 Jul 2021 05:58:26 +0000 (UTC) X-FDA: 78389169012.40.9E01404 Received: from mail3-167.sinamail.sina.com.cn (mail3-167.sinamail.sina.com.cn [202.108.3.167]) by imf29.hostedemail.com (Postfix) with SMTP id 11F269002BE4 for ; Thu, 22 Jul 2021 05:58:24 +0000 (UTC) Received: from unknown (HELO localhost.localdomain)([1.24.238.81]) by sina.com (172.16.97.32) with ESMTP id 60F908FC0002233A; Thu, 22 Jul 2021 13:58:22 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com X-SMAIL-MID: 437593628790 From: Hillf Danton To: Paolo Bonzini Cc: Hillf Danton , Thomas Gleixner , Sebastian Andrzej Siewior , "Michael S. Tsirkin" , linux-mm@kvack.org, LKML , Al Viro Subject: Re: 5.13-rt1 + KVM = WARNING: at fs/eventfd.c:74 eventfd_signal() Date: Thu, 22 Jul 2021 13:58:14 +0800 Message-Id: <20210722055814.1209-1-hdanton@sina.com> In-Reply-To: <2b4aea8d-a038-e347-7f6f-10476d771b7e@redhat.com> 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> MIME-Version: 1.0 Authentication-Results: imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of hdanton@sina.com designates 202.108.3.167 as permitted sender) smtp.mailfrom=hdanton@sina.com; dmarc=none X-Rspamd-Server: rspam02 X-Stat-Signature: gfnyrfdnes16pfa6ky5347f7yqnmgkex X-Rspamd-Queue-Id: 11F269002BE4 X-HE-Tag: 1626933504-548841 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.005391, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, 21 Jul 2021 12:59:39 +0200 Paolo Bonzini wrote: >On 21/07/21 12:11, Hillf Danton wrote: >> On Wed, 21 Jul 2021 09:25:32 +0200 Thomas Gleixner wrote: >>> On Wed, Jul 21 2021 at 15:04, Hillf Danton wrote: >>>> >>>> But the preempting waker can not make sense without the waiter who i= s bloody >>>> special. Why is it so in the first place? Or it is not at all but th= e race >>>> existing from Monday to Friday. >>> >>> See the large comment in eventfd_poll(). >>=20 >> Is it likely for a reader to make eventfd_poll() return 0? >>=20 >> read * poll write >> ---- * ----------------- ------------ >> * count =3D ctx->count (INVALID!) >> * lock ctx->qwh.lock >> * ctx->count +=3D n >> * **waitqueue_active is false= ** >> * **no wake_up_locked_poll!** >> * unlock ctx->qwh.lock >>=20 >> lock ctx->qwh.lock >> *cnt =3D (ctx->flags & EFD_SEMAPHORE) ? 1 : ctx->count; >> ctx->count -=3D *cnt; >> **waitqueue_active is false** >> unlock ctx->qwh.lock >>=20 >> * lock ctx->wqh.lock (in poll_wait) >> * __add_wait_queue >> * unlock ctx->wqh.lock >> * eventfd_poll returns 0 >> */ >> count =3D READ_ONCE(ctx->count); >>=20 > >No, it's simply impossible. The same comment explains why: "count =3D=20 >ctx->count" cannot move above poll_wait's locking of ctx->wqh.lock. Ah good catch. Hillf