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 39C54C636C8 for ; Sun, 18 Jul 2021 12:42:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 72C8361166 for ; Sun, 18 Jul 2021 12:42:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 72C8361166 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 E17118D00F4; Sun, 18 Jul 2021 08:42:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DC7D38D00EC; Sun, 18 Jul 2021 08:42:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C68638D00F4; Sun, 18 Jul 2021 08:42:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0036.hostedemail.com [216.40.44.36]) by kanga.kvack.org (Postfix) with ESMTP id 9F16E8D00EC for ; Sun, 18 Jul 2021 08:42:37 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 42159181AEF21 for ; Sun, 18 Jul 2021 12:42:36 +0000 (UTC) X-FDA: 78375672312.09.BA7EC45 Received: from r3-11.sinamail.sina.com.cn (r3-11.sinamail.sina.com.cn [202.108.3.11]) by imf03.hostedemail.com (Postfix) with SMTP id 5F54D30001AC for ; Sun, 18 Jul 2021 12:42:33 +0000 (UTC) Received: from unknown (HELO localhost.localdomain)([222.130.245.194]) by sina.com (172.16.97.27) with ESMTP id 60F421B4000219F0; Sun, 18 Jul 2021 20:42:31 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com X-SMAIL-MID: 22935449283349 From: Hillf Danton To: Paolo Bonzini Cc: 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: Sun, 18 Jul 2021 20:42:19 +0800 Message-Id: <20210718124219.1521-1-hdanton@sina.com> In-Reply-To: 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> MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 5F54D30001AC X-Stat-Signature: bu4dpeya9jik3m6w7gfkmi3emu3z1byy Authentication-Results: imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of hdanton@sina.com designates 202.108.3.11 as permitted sender) smtp.mailfrom=hdanton@sina.com; dmarc=none X-HE-Tag: 1626612153-866615 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, 16 Jul 2021 13:55:27 +0200 Paolo Bonzini wrote: >On 16/07/21 11:37, Hillf Danton wrote: >> On Fri, 16 Jul 2021 09:59:15 +0200 Paolo Bonzini wrote: >>> * the warning only occurs if preemption occurs during the >>> spin_lock_irqsave critical section (and therefore it can only occur i= n >>> PREEMPT_RT kernels) >>=20 >> With that lock held, no waitqueue entry can be added on to the WQ - IO= W no >> wakeup will go stray. >>=20 >>> * the warning causes an early return 0 that messes up the VM's networ= king >>=20 >> Is the messup due to the zero or wakeup? > >It's caused by the missing wakeup, i.e. eventfd_signal not really=20 >signaling anything. There are two cases of write_seqcount_begin in x/virt/kvm/eventfd.c, and in kvm_irqfd_deassign() it is surrounded by spin_lock_irq(&kvm->irqfds.lo= ck) that also protects irqfd_update(). What isnt clear is if the risk is zero that either case can be preempted = by seqcount reader. That risk may end up with the livelock described in x/Documentation/locking/seqlock.rst. +A sequence counter write side critical section must never be preempted +or interrupted by read side sections. Otherwise the reader will spin for +the entire scheduler tick due to the odd sequence count value and the +interrupted writer. If that reader belongs to a real-time scheduling +class, it can spin forever and the kernel will livelock.