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=-8.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 E002FC12002 for ; Wed, 21 Jul 2021 13:25:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8B05E61241 for ; Wed, 21 Jul 2021 13:25:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8B05E61241 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 34D9E6B0071; Wed, 21 Jul 2021 09:25:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2FDB96B0074; Wed, 21 Jul 2021 09:25:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1ED576B0075; Wed, 21 Jul 2021 09:25:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0003.hostedemail.com [216.40.44.3]) by kanga.kvack.org (Postfix) with ESMTP id 036B76B0071 for ; Wed, 21 Jul 2021 09:25:34 -0400 (EDT) Received: from forelay.prod.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by fograve01.hostedemail.com (Postfix) with ESMTP id 71D1718549E29 for ; Wed, 21 Jul 2021 10:59:47 +0000 (UTC) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 164ED235C7 for ; Wed, 21 Jul 2021 10:59:47 +0000 (UTC) X-FDA: 78386299614.27.20C3D8F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf06.hostedemail.com (Postfix) with ESMTP id 9D2A380246EA for ; Wed, 21 Jul 2021 10:59:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626865185; 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=ZNFxyv8EkVrHF82POeUeAbgVCzcWksdQvRviSPKQXfw=; b=FqSmOg9FQO0G4PT/95fUz6l8VrwawARmhLllEmW+U+cxpRRAnlVkVY218z3i1aeH2NLH2i ub/nv0sRFjJ8xM9TvvvjfnhdQSsG2cIPnlSbC5lZpSzP4qmWoOj0UYoxbzvWTOWX6wS+1+ SZlX9O79Zloi6uhvtVfJFuZrMmvvpGo= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-397-VsDkS2FYONewQ-vd4Wrlcw-1; Wed, 21 Jul 2021 06:59:42 -0400 X-MC-Unique: VsDkS2FYONewQ-vd4Wrlcw-1 Received: by mail-wm1-f72.google.com with SMTP id o21-20020a05600c4fd5b029023448cbd285so444270wmq.2 for ; Wed, 21 Jul 2021 03:59:42 -0700 (PDT) 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=ZNFxyv8EkVrHF82POeUeAbgVCzcWksdQvRviSPKQXfw=; b=g+cdWeH7j2+8iEFuzpQp7oO5MgKnm+kfV2G6dxDbTMWrfybDQtvW8/HjH3slz8fQu2 NoCPbHkYd2w2BmVukwst7jnSoAC6wakRdYGLic/gqhzdZKNrI3UNhkh9wuC+qnI1Rn9P YeUqtRsHVNOGLdPDh34nQjI40mZFqdmuj5zLovyUo2syq48qypvaa0r1JFqy+er5/Mbh O6HYU6jHAZfpnpi0uI1KpGcN7FShBpP28Kx1mP63CSROqmQoHT4oIm6S8mY1CvFSeBEo xL/S3u3XegQ/eOQKZCKASFaHLqgQ8pzq8d0IrQED8V113y820pLZ1TPKDwulYfijut/t 74cw== X-Gm-Message-State: AOAM530iR6HIcc+xNUrPWSMGwKI61bhO7xEop+TK/PlYALcVvPlKbaSy a1TtxDcAiLWds3vx2ljOcMR17QPW1t3pdJjTCwdgmFKdTh0vrcYN8hZKnh79bZVwtUt4jfA0oHK rbku9tk2lShY= X-Received: by 2002:a7b:c74a:: with SMTP id w10mr3441874wmk.54.1626865181515; Wed, 21 Jul 2021 03:59:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAz8QRFjMdVMkdngNvEh+DxLGf/YfcxGPbpYARXikkxgkKmd2Lg2dIaNEzL9byiF2pZqDjuw== X-Received: by 2002:a7b:c74a:: with SMTP id w10mr3441847wmk.54.1626865181224; Wed, 21 Jul 2021 03:59:41 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e? ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id z7sm13424582wrt.94.2021.07.21.03.59.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Jul 2021 03:59:40 -0700 (PDT) Subject: Re: 5.13-rt1 + KVM = WARNING: at fs/eventfd.c:74 eventfd_signal() To: Hillf Danton , Thomas Gleixner Cc: 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> From: Paolo Bonzini Message-ID: <2b4aea8d-a038-e347-7f6f-10476d771b7e@redhat.com> Date: Wed, 21 Jul 2021 12:59:39 +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: <20210721101119.1103-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 Content-Transfer-Encoding: 7bit Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FqSmOg9F; spf=none (imf06.hostedemail.com: domain of pbonzini@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=pbonzini@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam05 X-Stat-Signature: 6twfkabskqz3335zjunawesbiy4xj6io X-Rspamd-Queue-Id: 9D2A380246EA X-HE-Tag: 1626865186-464235 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 is bloody >>> special. Why is it so in the first place? Or it is not at all but the race >>> existing from Monday to Friday. >> >> See the large comment in eventfd_poll(). > > Is it likely for a reader to make eventfd_poll() return 0? > > read * poll write > ---- * ----------------- ------------ > * count = ctx->count (INVALID!) > * lock ctx->qwh.lock > * ctx->count += n > * **waitqueue_active is false** > * **no wake_up_locked_poll!** > * unlock ctx->qwh.lock > > lock ctx->qwh.lock > *cnt = (ctx->flags & EFD_SEMAPHORE) ? 1 : ctx->count; > ctx->count -= *cnt; > **waitqueue_active is false** > unlock ctx->qwh.lock > > * lock ctx->wqh.lock (in poll_wait) > * __add_wait_queue > * unlock ctx->wqh.lock > * eventfd_poll returns 0 > */ > count = READ_ONCE(ctx->count); > No, it's simply impossible. The same comment explains why: "count = ctx->count" cannot move above poll_wait's locking of ctx->wqh.lock. Paolo