Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1418119pxv; Fri, 23 Jul 2021 07:55:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTaVnkjsjyupw4MbDdSLi5VM82r7xHAZw+lg7qhg7RBCoLawj+kn5RquEeV+RFJOrjzDFj X-Received: by 2002:a92:d0d2:: with SMTP id y18mr3784393ila.24.1627052117234; Fri, 23 Jul 2021 07:55:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627052117; cv=none; d=google.com; s=arc-20160816; b=xBmLLF5w7q4pZUEDTnVYmOgXwSUgN6NKjaxf85PiBsReSYk81FvpnovAGh+wN9+nte slaAJUWf/cQpGmeXGqCKQUWAmzoXcCV9fTZ8mWAbFhUgFiUTpZrULVOdSWBHMe3I4le0 bWu8GVkOv/6xJeSy9pFU48st7d/TOO7HlAyJm6gyfwvD/WvOb4h4B11AwwdwamH2KDUT R7PO/4oeoWe9Mb2Jpp5ORgNQQ+48FbhmRu4Q2HJuh4WsSOMcBlJD7cP+FGFVqYH4nbuM vDHurha44N0ixUXEPlOVNILK50VbqTsRP0SBXu0U1fvi20MFVEvFnilgxfyg9tHtEXCU Vx7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KzcnGLaacDgNN8JHkByoexh8GLTQOigyRJDFx1KyDyI=; b=ZrBZctE9xhj1/xFPHpHryTx+NINZsHw7Rs8gfAS7jM6zISNLlpTsyk1IfBUP1cabVR Bm1rF0+gfZVI3iIlsK2kuw8w2WzzjaH6150kgZhORE7vI6tRGswnXlQxLTKVraE+F1Sj vPkDRjwEcPk4+ugeQS9XN/OTNynDTirgzoMUuJbOXEoMxd9xbEmmUSwFOVb5zz5H8J7t MnFxRHTKwnMsA/JtkUFRsP1VY38P58JnpiDM/93JMRUvnJpjNqMCmR18gBwnYhMXnC62 eEHYg7pUsZG9xnuKX91/RqqwsWsQb8IFX/YIX/0TC7n/g4GavlGnEc2Hpv1aWEBzrhxN 4JJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gkD+OTzK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v19si24519979jat.76.2021.07.23.07.55.04; Fri, 23 Jul 2021 07:55:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gkD+OTzK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235472AbhGWONd (ORCPT + 99 others); Fri, 23 Jul 2021 10:13:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:30137 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235351AbhGWONa (ORCPT ); Fri, 23 Jul 2021 10:13:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1627052043; 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=KzcnGLaacDgNN8JHkByoexh8GLTQOigyRJDFx1KyDyI=; b=gkD+OTzKaN9ITGSUy4rUXoFnZ65UbIwaTaOH8oLurWIrQkcPXqgUqqMCaxYFU971Fdp//t wlB0IAFDRiFrWjZJwvPntAmvPlh6kDPzxAHCE+zwn7IhG5lNUteII0yvvApC1BGy5Raur9 YS2aad1lG5B/9/ksBpblgqMVAKLbwhM= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-78-W4e0NKjoM62qwxhbK2OT6A-1; Fri, 23 Jul 2021 10:54:02 -0400 X-MC-Unique: W4e0NKjoM62qwxhbK2OT6A-1 Received: by mail-wm1-f70.google.com with SMTP id c2-20020a7bc8420000b0290238db573ab7so1503767wml.5 for ; Fri, 23 Jul 2021 07:54:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KzcnGLaacDgNN8JHkByoexh8GLTQOigyRJDFx1KyDyI=; b=eukcg+UOZLMVVxLkkPKB3WrrPItR+2UXmKbnR5ardj80yQNzyaAECdPBcmeANbc6Zs lD2EfgNL/yLq8/MdEQ4ycOWuGOF6Xhmx13P9BkccZpZu6SogGzRsnO/py6p+qaswVmkh z4e9BsAYchrCX8NEtZiqWkhPiExGnquL6bfYYOiH08nY3tffGET8pgxPcNU8ZYcaiHLq EERgZNXV2Rh55cOwj+EXgU2qzK0JIFC8O+/7MDSVtfgfg9FGqgsHHP7d0Dup76HNCeCc LNjteF56Cteawu7EeP9XluTqUhzQAiXYws/B3UV678FAPYiHecps7/K6U84BjsW/JxVF Izzg== X-Gm-Message-State: AOAM532VmA+l7xVv2Qa6X6QvWj0ETyfdEdvZKxVeNLw4rwFsIErWa+Ec Ht0B5n5Y9iu0MMltabCxpJyHNJOmjN6vFK9w7mvpGVPk9qUQ/un2ZlN1NDT+hSo/H9GFE8ScCrm NgBnHTjPU2fvSxn+96a47sipf X-Received: by 2002:a7b:cb4d:: with SMTP id v13mr3594839wmj.68.1627052041371; Fri, 23 Jul 2021 07:54:01 -0700 (PDT) X-Received: by 2002:a7b:cb4d:: with SMTP id v13mr3594830wmj.68.1627052041247; Fri, 23 Jul 2021 07:54:01 -0700 (PDT) Received: from vian.redhat.com ([79.116.5.179]) by smtp.gmail.com with ESMTPSA id w18sm35594863wrg.68.2021.07.23.07.54.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jul 2021 07:54:01 -0700 (PDT) From: Nicolas Saenz Julienne To: bristot@kernel.org Cc: axboe@kernel.dk, bigeasy@linutronix.de, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, pbonzini@redhat.com, stable@vger.kernel.org, tglx@linutronix.de, viro@zeniv.linux.org.uk, zhe.he@windriver.com, Nicolas Saenz Julienne Subject: Re: [PATCH] eventfd: protect eventfd_wake_count with a local_lock Date: Fri, 23 Jul 2021 16:53:04 +0200 Message-Id: <20210723145303.272822-1-nsaenzju@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <523c91c4a30f21295508004c81cd2e46ccc37dc2.1626680553.git.bristot@kernel.org> References: <523c91c4a30f21295508004c81cd2e46ccc37dc2.1626680553.git.bristot@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 19 Jul 2021 09:54:52 +0200, Daniel Bristot de Oliveira wrote: > eventfd_signal assumes that spin_lock_irqsave/spin_unlock_irqrestore is > non-preemptable and therefore increments and decrements the percpu > variable inside the critical section. > > This obviously does not fly with PREEMPT_RT. If eventfd_signal is > preempted and an unrelated thread calls eventfd_signal, the result is > a spurious WARN. To avoid this, protect the percpu variable with a > local_lock. > > Reported-by: Daniel Bristot de Oliveira > Fixes: b5e683d5cab8 ("eventfd: track eventfd_signal() recursion depth") > Cc: He Zhe > Cc: Jens Axboe > Cc: Alexander Viro > Cc: Thomas Gleixner > Cc: Sebastian Andrzej Siewior > Cc: stable@vger.kernel.org > Cc: linux-fsdevel@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Co-developed-by: Paolo Bonzini > Signed-off-by: Paolo Bonzini > Signed-off-by: Daniel Bristot de Oliveira > --- Tested-by: Nicolas Saenz Julienne Thanks! -- Nicolás Sáenz