Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1451490pxb; Fri, 1 Oct 2021 10:51:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/vp7GFay6c+N1hT2QRYxxQqveHy2qeyQcm2/xXxmGNwr7C6yP3yd+tso4ZLzdTfYKRIUm X-Received: by 2002:a17:902:c184:b0:13e:2e49:8a92 with SMTP id d4-20020a170902c18400b0013e2e498a92mr10795802pld.2.1633110710001; Fri, 01 Oct 2021 10:51:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633110709; cv=none; d=google.com; s=arc-20160816; b=Tg5mtWo/ElmyrVSJxIcK2cV4veprb3tA8+6HJKVkmWL91bQX/hXSgnVLnqFpDqa2m5 73TUlRdbEnhcayDJr6Y5WTgxAEe0xNw0yqYhhaxa+0Lom9yw0xkGJu4qWxHgZnEUcBPR bK6An7pQdwIuDju/RalzaoxCYnm0/KCPayokFU4Q7Gsrmbyw4GThWa6bQ7NafczVpcCs qow2uIi6zldvz5PyRZxU5NFVuVsoaEDnnPwnUZAoM87VOpDuhSiSfWonaTob7+bZW+DR iPuR8nqT9LAu4FQJTqzUmLYg3OxIfR62tqZugwdb4RfITZvzfq75XDGZpVkX+oJImxr3 XF3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=SNmp1yJNm4uNrgRCWpPHRqj9RYhndnfIWfHO1Hi+AXk=; b=jVUNH0p99A4n79EDIq+zFMqk+OzLtq0JkAnT465ZoKF1EYVXxh8SRK7/5QqvyigsvQ cGOI5jeFCh01Lw0tfWHP6C/gcodGbBl/rtIKs2L71jxstSpXlqNC06ViQOwTYxls6r2p H8Qu3nxQvWfBm2xpCupREXHPNOLQVWEFL2qzXVgdmlv6LW0GQR6U6+LUmTFcmZ0KqiQY AjleOkrvyC5SZHXdEN6u2vOwk9KdE7A2gs+fBL8004SgtuLmWFnffdgQi4EvXL9c4izK INfCQDMrB+5PFnJQqNcK8qvuwHUu+Ij5MWqvnS19ZPRv44jY6m7rYikw2eVbEh1T8Huh Ry2w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bc5si7864200plb.125.2021.10.01.10.51.36; Fri, 01 Oct 2021 10:51:49 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355345AbhJARwM (ORCPT + 99 others); Fri, 1 Oct 2021 13:52:12 -0400 Received: from foss.arm.com ([217.140.110.172]:49438 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231852AbhJARwL (ORCPT ); Fri, 1 Oct 2021 13:52:11 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A9C94106F; Fri, 1 Oct 2021 10:50:26 -0700 (PDT) Received: from e113632-lin (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 08A123F70D; Fri, 1 Oct 2021 10:50:24 -0700 (PDT) From: Valentin Schneider To: Frederic Weisbecker , "Paul E . McKenney" Cc: LKML , Thomas Gleixner , Sebastian Andrzej Siewior , Peter Zijlstra , Uladzislau Rezki , Frederic Weisbecker , Boqun Feng , Neeraj Upadhyay , Josh Triplett , Joel Fernandes , rcu@vger.kernel.org Subject: Re: [PATCH 04/11] rcu/nocb: Make rcu_core() callbacks acceleration preempt-safe In-Reply-To: <20210929221012.228270-5-frederic@kernel.org> References: <20210929221012.228270-1-frederic@kernel.org> <20210929221012.228270-5-frederic@kernel.org> Date: Fri, 01 Oct 2021 18:50:22 +0100 Message-ID: <87bl48my75.mognet@arm.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/09/21 00:10, Frederic Weisbecker wrote: > From: Thomas Gleixner > > While reporting a quiescent state for a given CPU, rcu_core() takes > advantage of the freshly loaded grace period sequence number and the > locked rnp to accelerate the callbacks whose sequence number have been > assigned a stale value. > > This action is only necessary when the rdp isn't offloaded, otherwise > the NOCB kthreads already take care of the callbacks progression. > > However the check for the offloaded state is volatile because it is > performed outside the IRQs disabled section. It's possible for the > offloading process to preempt rcu_core() at that point on PREEMPT_RT. > > This is dangerous because rcu_core() may end up accelerating callbacks > concurrently with NOCB kthreads without appropriate locking. > > Fix this with moving the offloaded check inside the rnp locking section. > > Reported-by: Valentin Schneider > Signed-off-by: Thomas Gleixner > Cc: Valentin Schneider > Cc: Peter Zijlstra > Cc: Sebastian Andrzej Siewior > Cc: Josh Triplett > Cc: Joel Fernandes > Cc: Boqun Feng > Cc: Neeraj Upadhyay > Cc: Uladzislau Rezki > Cc: Thomas Gleixner > Signed-off-by: Frederic Weisbecker Reviewed-by: Valentin Schneider