Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2533568pxj; Sat, 19 Jun 2021 15:30:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBompp6NnHLqMTeqsx/kfEKolw5+thHKPtxOAwgzejhAOeAnl3m4p1atg+HlMAfv3o7aAd X-Received: by 2002:a02:641:: with SMTP id 62mr5721562jav.125.1624141802532; Sat, 19 Jun 2021 15:30:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624141802; cv=none; d=google.com; s=arc-20160816; b=otynuHBuRqoxE2n2+3mG+249BuYjt1Fl0ZNDIAXh4l6wF4TyYZEmxB22ZC19Q/a+PZ 5tCWnxJefVZbDBlmUh5NIdofAUetyZz0yiqlGP5McUMF30Rc7we4R84Jw1lJND09lqel Z8TOczqnwbycFZP2OB89prm6EMAyAUuRYaIJhyw8vz90UY8dQjRKTBcx7Thn9epPTUcY hTyOtHxcPvlkKRDM0PZ2ySELBzz4W4AF36G12f+1KMVzefLse/tY7DhDgwub/9F6assu dUz8ifjVKqTSfvH3ZE6thgZ1ZH+2VH/vjQeYrmaHigXe8b52/oWe+Ak7P2qmQM41L2rl SV/w== 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:dkim-signature:dkim-signature:from; bh=0WkUU1i1UNpoG5pIe7zGWwNtXQBifCDLlz/iTVaWavw=; b=eqDgQIDjoB6kz5xwW09a7RZsqDxtdoCajOkATXdbpk/wSDGCw8RVlwyVpL8kaiBLCH OnGaFbmu8lyp/bGMpF4R4psqM5fjQNIINFNBkSZdozvULGCiaxPCBbtagjdrQDih+EE6 uE6uG+S+AI5QpHrkg3tgVx9rqomqqDHNTYaUoD/N2o7+xYn0u3S1J325DMfM5hvx+dEx Z0H7tcON5dl0k9e+FHp0EkGbdF1FqaNFq0HXmj4HWv5msolP3XbcNp4JA3J6C6qjLTUt s67Vxx4/lP0UpC/8tXknn48VgCFjlSsHuMhotD7QN5Qs5zdHew9MmSXxFXKzZXcszKGS SF/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=IoB2cHdk; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r14si6499842ile.136.2021.06.19.15.29.32; Sat, 19 Jun 2021 15:30:02 -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=@linutronix.de header.s=2020 header.b=IoB2cHdk; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229615AbhFSWaS (ORCPT + 99 others); Sat, 19 Jun 2021 18:30:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbhFSWaS (ORCPT ); Sat, 19 Jun 2021 18:30:18 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1E46C061574 for ; Sat, 19 Jun 2021 15:28:06 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1624141685; 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: in-reply-to:in-reply-to:references:references; bh=0WkUU1i1UNpoG5pIe7zGWwNtXQBifCDLlz/iTVaWavw=; b=IoB2cHdkor3N6XKoijdTkXID8pdDe4JIzj5V6e/pbivlsZ4yftFbeXwv7fUt7iTrfPqLwy HmG/aB9s5oNy2bvSQf6OdvZtNTkRy8B+v/hWXIo+4fQ9O4MEq6/4Y/83Bn6UMq6+sQWyC0 TRSk5F7TSunYTQNRrUAr/zlJF+tGp68jPykFS8erKoBTcdChSR1wpc4+avkXWAkxfodcjJ uju60I0aZjLJgM4vZpBimI/u+YM/zEKStW3noSkYmB5C5364CJuMzwZHVQ1O3fmZYkgs9m wvZ42ixLYCGuG8B6npwRjax6soLNZ7sKUaa6UGOfupJQQ9ixh6ziesY6C4wmWw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1624141685; 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: in-reply-to:in-reply-to:references:references; bh=0WkUU1i1UNpoG5pIe7zGWwNtXQBifCDLlz/iTVaWavw=; b=a2e27GGGAmo0bH0zDMZhcnNe1gmSW6n33X4SAj2CfS9MnN8sSDW1p4wIFKW03cbUHHqXAl EokKR0YTBzhi/MAw== To: Mark Rutland , linux-kernel@vger.kernel.org Cc: benh@kernel.crashing.org, boqun.feng@gmail.com, bp@alien8.de, catalin.marinas@arm.com, dvyukov@google.com, elver@google.com, ink@jurassic.park.msu.ru, jonas@southpole.se, juri.lelli@redhat.com, linux@armlinux.org.uk, luto@kernel.org, mark.rutland@arm.com, mattst88@gmail.com, mingo@redhat.com, monstr@monstr.eu, mpe@ellerman.id.au, paulmck@kernel.org, paulus@samba.org, peterz@infradead.org, rth@twiddle.net, shorne@gmail.com, stefan.kristiansson@saunalahti.fi, vincent.guittot@linaro.org, will@kernel.org Subject: Re: [RFC PATCH 01/10] thread_info: add helpers to snapshot thread flags In-Reply-To: <20210609122001.18277-2-mark.rutland@arm.com> References: <20210609122001.18277-1-mark.rutland@arm.com> <20210609122001.18277-2-mark.rutland@arm.com> Date: Sun, 20 Jun 2021 00:28:04 +0200 Message-ID: <87h7hth4ln.ffs@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 09 2021 at 13:19, Mark Rutland wrote: > We have common helpers to manipulate individual thread flags, but where > code wants to check several flags at once, it must open code reading > current_thread_info()->flags and operating on a snapshot. Who's we? > As some flags can be set remotely it's necessary to use READ_ONCE() to > get a consistent snapshot even when IRQs are disabled, but some code > forgets to do this. Generally this is unlike to cause a problem in > practice, but it is somewhat unsound, and KCSAN will legitimately warn > that there is a data race. > > To make it easier to do the right thing, and to highlight that > concurrent modification is possible, let's add a new helpers to > snapshot let's add? Why not simply "add"? > +static inline unsigned long read_ti_thread_flags(struct thread_info *ti) __always_inline() as Marco pointed out already Other than those nitpicks: Reviewed-by: Thomas Gleixner