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.1 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,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 57464C07E9D for ; Mon, 19 Jul 2021 15:38:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E94E861419 for ; Mon, 19 Jul 2021 15:38:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E94E861419 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 449878D00F4; Mon, 19 Jul 2021 11:38:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 420398D00EC; Mon, 19 Jul 2021 11:38:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C1B48D00F4; Mon, 19 Jul 2021 11:38:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0116.hostedemail.com [216.40.44.116]) by kanga.kvack.org (Postfix) with ESMTP id E4D1F8D00EC for ; Mon, 19 Jul 2021 11:38:52 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 744538249980 for ; Mon, 19 Jul 2021 15:38:51 +0000 (UTC) X-FDA: 78379745262.23.382241A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf05.hostedemail.com (Postfix) with ESMTP id 08FE15012726 for ; Mon, 19 Jul 2021 15:38:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626709130; 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=+lFKwCAVKeBwWtdk13YauC5QOjrFzKdwp3ovNP9k6AY=; b=eTlO2q63EOW+QlTvtHrBScLXv+7tMfTT8vBfqsC0trOM9Ju8drqKPhOCqha897c9xCHJBr TPVMeBi3NtntERUWe2vXBY5CgImYn9Wf+iY9hOUdW0BOaGeWfyoJEDH5WLEpWBwKVvuvaA 16P5cXrqda8WncAXG2q0WyaWGlfmMwo= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-45-C9YTj9SbMze6YzCJmCiv7Q-1; Mon, 19 Jul 2021 11:38:49 -0400 X-MC-Unique: C9YTj9SbMze6YzCJmCiv7Q-1 Received: by mail-ej1-f70.google.com with SMTP id g6-20020a1709063b06b029051a448bab28so5563014ejf.17 for ; Mon, 19 Jul 2021 08:38:48 -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=+lFKwCAVKeBwWtdk13YauC5QOjrFzKdwp3ovNP9k6AY=; b=T+si4b5Ks/8ip2D6wc3bVOQXXrOMXN7YySUC2l4PirjopAcgdPKBc9tDGAkLluIZoy d8OiTumo+LB9pzj8zFkrigZLEmZ39XvcrD/niBD0JgINzdE4Ve86KYlH2gbJ4XKNc8SI kvpALzbEA014tTE+fuvIB6WU0JAKSPG+p78a1gNxH+Ow1cRfk+TSF4uEosZncohuqF9V i+FSnZPKshK9L4Dx8h+7VIvwA6ZdGgsvc0vphftkeRPzjFannLNidpUZtApNp1aiw/pZ Mm6tGfraZIeWQTamrHjNUyde1PivODmmgk47wnQsBc20jtYf88CSR9wNn0BQfCKeWk65 UOUg== X-Gm-Message-State: AOAM530VAsUu99WaXxwQ2oMYH0S1Rod4Ys7JYFS+gAEkCcXbw8hpzoJP tuEZ8ugRZOl7dGs1fFShDhd/SGbw/Zaeo5n6WCoywirVZzJbCKj+Cja7Is1PU/kvD65oukjLwVv KkpdBzDDOe00= X-Received: by 2002:a17:906:2752:: with SMTP id a18mr28974315ejd.458.1626709127965; Mon, 19 Jul 2021 08:38:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlJYprLql9Zhw1pUb/b66jZIzRDGS7wig2XiTxZjcvWhWWmHMwbRIx2nEi48m+v6BnHOglLQ== X-Received: by 2002:a17:906:2752:: with SMTP id a18mr28974294ejd.458.1626709127731; Mon, 19 Jul 2021 08:38:47 -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 t15sm6060125ejf.119.2021.07.19.08.38.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Jul 2021 08:38:47 -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> From: Paolo Bonzini Subject: Re: 5.13-rt1 + KVM = WARNING: at fs/eventfd.c:74 eventfd_signal() Message-ID: <724e7951-59c8-8b2b-37b8-6b0bf696ab04@redhat.com> Date: Mon, 19 Jul 2021 17:38:45 +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: <20210718124219.1521-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 Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=eTlO2q63; spf=none (imf05.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: arednw47mjgkyxcka3f1715dqiz55gkw X-Rspamd-Queue-Id: 08FE15012726 X-HE-Tag: 1626709130-836577 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 18/07/21 14:42, Hillf Danton wrote: >> It's caused by the missing wakeup, i.e. eventfd_signal not really >> signaling anything. >=20 > Can you please point me to the waiters in the mainline? It's irqfd_wakeup. > There are two cases of write_seqcount_begin in x/virt/kvm/eventfd.c, an= d > in kvm_irqfd_deassign() it is surrounded by spin_lock_irq(&kvm->irqfds.= lock) > that also protects irqfd_update(). >=20 > What isnt clear is if the risk is zero that either case can be preempte= d by > seqcount reader. That risk may end up with the livelock described in > x/Documentation/locking/seqlock.rst. Since the introduction of seqcount_spinlock_t, the writers automatically=20 disable preemption. This is definitely the right thing in this case=20 where the seqcount writers are small enough, and the readers are hot=20 enough, that using a local lock would be too heavyweight. Without that, the livelock would be possible, though very unlikely. In=20 practice seqcount updates should only happen while the producer is=20 quiescent; and also the seqcount readers and writers will often be=20 pinned to separate CPUs. Paolo > +A sequence counter write side critical section must never be preempted > +or interrupted by read side sections. Otherwise the reader will spin f= or > +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. >=20