Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6354879pxv; Thu, 29 Jul 2021 12:26:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYC1DouMjAfqc5TNQMAq6FvNz+Oqz+OcI0vWl5a4aDTt81GksRSVrcp6gWD/dcBrlCKJNc X-Received: by 2002:aa7:d34b:: with SMTP id m11mr902748edr.207.1627586771327; Thu, 29 Jul 2021 12:26:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627586771; cv=none; d=google.com; s=arc-20160816; b=wco3S3WqaQXOKVp3TZay8kcqzVA18QKwkAw0D1ZwDpiFKkpd0tiB88bjCuDmqsY0+Q l7CM+6lBl0iks5A10bTOxVCGKiEK+TYpSTg249NxokG80muHxng73OG/vfmPPErRyju+ vovwjNaNU8c7HW8mlYrp+SSB/j+vl9v+vYVtgp8EwChRVSuzBaX1oCnvD5ssZoEw1IWf o0f2iodsGJX9bJPY72r0JumpNIu+AfMP2Ya/2FU/YQ83otgvDknja+EUG2iPsUdnLdwU wyNFc9EDAJ8LaMvVJEipxOLflR8Z4ppobWdHyzMvsr9yvdMPYYfgftwqa6QfPErbk2Vv JcPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=CLUUShINeg3zB4pIKNSTR17WVfI3x7wR0IScyDb0lIQ=; b=XQ/0y9hbY599xnIBYwnJ/3z9D5SqPVDAxoCOuLRbmPKRnypyPqbzLZyg4uMMNBVS3z QzMhzhVHtEWJ+X2apzOp5TdmjQXo/IPIFpGkyUpEuo4A3YBXzcwy/ySsOtCKVmh/irNO oEZi97n66wOY7fETpOKs/iLZPrZ3EyV//C/q7Ur5LY8bryQmBpI+GofA6cGGuhkCwhZp o17mw2W9OIS6b6OVohfzsKYFvnZVnGr5Y11kzJEl3hJQ/bdxv0cERh9NHChJ8m/aa+WR AgWi/pEOuL2HcUivj7N84twb4b+lD+mFeOqe9ZWLA4+EXT6iMlchBuHiK/5v+rmsxbuP lx3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SoiuN1QW; 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 g16si67855ejf.744.2021.07.29.12.25.47; Thu, 29 Jul 2021 12:26:11 -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=SoiuN1QW; 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 S231984AbhG2TXx (ORCPT + 99 others); Thu, 29 Jul 2021 15:23:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60734 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229653AbhG2TXw (ORCPT ); Thu, 29 Jul 2021 15:23:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1627586629; 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=CLUUShINeg3zB4pIKNSTR17WVfI3x7wR0IScyDb0lIQ=; b=SoiuN1QW376dvkocMXZUKOi2N8QTwiyiGsc6sHW18sST/aUO9mxlLRqaRWCjJNHe2oHG2b lLf1M5OBUD8eaz16nvSUqYmi2I2r/t/UWT4QmFe4K4yltm9M0g+V9IlNJVSbsdQJjUkqoR 3k1LK6iKj6Is/Fw1f+uYPvqm67TPcPk= 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-593-_IkW8kJ5NTe8VBClptwxKg-1; Thu, 29 Jul 2021 15:23:47 -0400 X-MC-Unique: _IkW8kJ5NTe8VBClptwxKg-1 Received: by mail-ej1-f70.google.com with SMTP id x5-20020a1709064bc5b02905305454f5d1so2331348ejv.10 for ; Thu, 29 Jul 2021 12:23:47 -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=CLUUShINeg3zB4pIKNSTR17WVfI3x7wR0IScyDb0lIQ=; b=k2KTjd2qo8lKUc1fHve1HZRK0J1Wz8p8imUYPW/4lenv6Bgx6gyBT2gksw9eqibPpf yyA5ziZ1njPDJg+Am0BqcCK69rSj6oZvULmazvWJkeWWFUSXR/11Dpj1X2psZKdIFEzV GUyDcSy5V1dNsVs+CtDbIMkJop9DnYyv3jfd0oZ5KSnj6hi1gis0sw57AdoHriNseLmu cOys7TI9qxqvoBFPCAWoIME/vOBVb78MbdaZx3v+3O21bAdYSQNCDnO25mo0u6o5PjY6 X5VK/Q+8e6bnVkiwL6wVYfw40pebXM7milByrke2Z/ahgO3xfrb5pbzvUsbyf/PAbI5E DcIw== X-Gm-Message-State: AOAM533aVG6dk4R0EmJ/HffUT74RIiOL3ZYSl94bFHf5Sd5T5tCwqJRa yrrLvvdup5w3xCXKLCgX4cisdTo10+vEjOJ2X/O3mYP0V1nSMIiLFhpvAfbcQL37lER9ep7oHwz k9BGZoXLvZlfsqvMNlq/JtGKp X-Received: by 2002:a50:a456:: with SMTP id v22mr7669398edb.333.1627586626650; Thu, 29 Jul 2021 12:23:46 -0700 (PDT) X-Received: by 2002:a50:a456:: with SMTP id v22mr7669378edb.333.1627586626432; Thu, 29 Jul 2021 12:23:46 -0700 (PDT) Received: from x1.bristot.me (host-95-239-202-226.retail.telecomitalia.it. [95.239.202.226]) by smtp.gmail.com with ESMTPSA id jy17sm1272810ejc.112.2021.07.29.12.23.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Jul 2021 12:23:46 -0700 (PDT) Subject: Re: [PATCH] eventfd: Make signal recursion protection a task bit To: Thomas Gleixner , Paolo Bonzini , Jason Wang , Sebastian Andrzej Siewior , "Michael S. Tsirkin" , Juri Lelli Cc: LKML , Al Viro , He Zhe , Jens Axboe , Peter Zijlstra References: <8dfc0ee9-b97a-8ca8-d057-31c8cad3f5b6@redhat.com> <475f84e2-78ee-1a24-ef57-b16c1f2651ed@redhat.com> <87pmv23lru.ffs@nanos.tec.linutronix.de> <810e01ef-9b71-5b44-8498-b8a377d4e51b@redhat.com> <875ywujlzx.ffs@tglx> <87wnp9idso.ffs@tglx> From: Daniel Bristot de Oliveira Message-ID: Date: Thu, 29 Jul 2021 21:23: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: <87wnp9idso.ffs@tglx> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/29/21 1:01 PM, Thomas Gleixner wrote: > The recursion protection for eventfd_signal() is based on a per CPU > variable and relies on the !RT semantics of spin_lock_irqsave() for > protecting this per CPU variable. On RT kernels spin_lock_irqsave() neither > disables preemption nor interrupts which allows the spin lock held section > to be preempted. If the preempting task invokes eventfd_signal() as well, > then the recursion warning triggers. > > Paolo suggested to protect the per CPU variable with a local lock, but > that's heavyweight and actually not necessary. The goal of this protection > is to prevent the task stack from overflowing, which can be achieved with a > per task recursion protection as well. > > Replace the per CPU variable with a per task bit similar to other recursion > protection bits like task_struct::in_page_owner. This works on both !RT and > RT kernels and removes as a side effect the extra per CPU storage. > > No functional change for !RT kernels. > > Reported-by: Daniel Bristot de Oliveira > Signed-off-by: Thomas Gleixner Tested-by: Daniel Bristot de Oliveira Thanks!