Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1424916pxb; Fri, 10 Sep 2021 05:47:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwG9TsFGnsl8KDrcHrqLUUffsNhxd8IlEv8fgefvxaMBo0E40NjVRYJFSHhCWJXnuNDDzAx X-Received: by 2002:a05:6e02:1250:: with SMTP id j16mr6090351ilq.215.1631278051960; Fri, 10 Sep 2021 05:47:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631278051; cv=none; d=google.com; s=arc-20160816; b=kC8pzqYy+aZ0w4DCowDFemjhoULVgdduPQkMYzmD9YQvDXWNLBevmsJvxuXQSsAqxC pSc8SK3lTyZaWORUvBbrf/sqkGVvq9tcLmhzv/AKIvOeYC43epnKFrI8VA7LNV6+qFlS qOQOHROgoVL4DKv7DnbuT4IZ0nn10axYyuFalDOBl0hS1RVIHuK6wLTgt0RXWAvRq5Tu PCkBfebo/4sasWF89MyMU/fJo7qphN6Bah/gNztAdScBgP/Um3Ybi0fZ5qpBY0oFDE/e BEW7u5WRMn4jmKNBmKl3A5TydVZpuj5tfk0gLos0+my4up9pLxee6DoBsp+5RrKwXAAA XCOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature :dkim-signature:date; bh=kYe9djVH32oIH1dMg/4UjSUuB4tMkZH3lMYm37JAmKk=; b=B02GybKFGpr9dMbfq+2WHnyInrEKA3Bp04o+xQhTs4ZU71LkfbvpAfmERi12qW6o9w mzK1lG/LNDUBDeGharzsHabFqTHDhcN5BbqeU+DZutGJAjxK/KE6+VJpSEHaPgeK2o82 8hw3QIaOBF/oHlti4naAPOyGFXNWwOZkt1nZMH4vfNUwxrkn3mmBOsB/QxgMDC1jf9Ny 3qriGO9Cy8/o2Ed4b/VrqKTRkB4IoOtiGv/CvSiXBjgimPTgbjiHx8mKm5N7qaoZkVNk IqhJLNnOhqQLuKaqvObJF/Q72zgzVs/4w1zQbghwRnXWV4VRAR9xEc9KRtmGz009KDjV DLSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=w+k4dlfO; 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 s16si4378945ilh.179.2021.09.10.05.47.19; Fri, 10 Sep 2021 05:47:31 -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=w+k4dlfO; 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 S233704AbhIJMqo (ORCPT + 99 others); Fri, 10 Sep 2021 08:46:44 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:38424 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233683AbhIJMqn (ORCPT ); Fri, 10 Sep 2021 08:46:43 -0400 Date: Fri, 10 Sep 2021 14:45:30 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1631277931; 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=kYe9djVH32oIH1dMg/4UjSUuB4tMkZH3lMYm37JAmKk=; b=w+k4dlfOOv7gn5eutCAba/foctsxreNZ4ry2tb6w4PXPlKcgSDM8Ceq3VK8NSCyGDYibiw C06iw+7yUoIV/VAxyQ9ZwJ16BO+yK4vGK7yNUtuMZXv68GgvvdnllhWxWRfU1spWVvEDRK DMCwo0fJTQ+LIRdz9QmnFkWNegRvEVcFZoHhsIaw6xAtF2Kneu8BRrqRx+akpdcU3yLrl7 LkfSJ8Ec3KcUObMDk40940jM7wkl89y23Qqdn+Gdu/8VThNJ1c58cwVGKPdPCPnUsdOBgc XYxDzawY7nKXlEMM7Oz+30jpvry+c9g4ahGAh5LLo5djlDCwP4rIhgNVd/sk4Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1631277931; 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=kYe9djVH32oIH1dMg/4UjSUuB4tMkZH3lMYm37JAmKk=; b=AdsAeligySKM6SzqdjbDXCbe8QdfU3L2ILy9rWSDZPjeIoOBtuy2qnH6MlEPJT1GgufPDQ yuf71zaDqRumWfBw== From: Sebastian Andrzej Siewior To: Peter Zijlstra Cc: tglx@linutronix.de, boqun.feng@gmail.com, linux-kernel@vger.kernel.org, Ingo Molnar , Juri Lelli , Steven Rostedt , Davidlohr Bueso , Will Deacon , Waiman Long , Mike Galbraith , Daniel Bristot de Oliveira Subject: Re: [PATCH 1/4] sched/wakeup: Strengthen current_save_and_set_rtlock_wait_state() Message-ID: <20210910124530.iezmxpzzhkbl6gwt@linutronix.de> References: <20210909105915.757320973@infradead.org> <20210909110203.767330253@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210909110203.767330253@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-09-09 12:59:16 [+0200], Peter Zijlstra wrote: > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -253,22 +254,24 @@ struct task_group; > */ > #define current_save_and_set_rtlock_wait_state() \ > do { \ > - lockdep_assert_irqs_disabled(); \ > - raw_spin_lock(¤t->pi_lock); \ > + unsigned long flags; /* may shadow */ \ could we haz __flags so no shadow? > + \ > + raw_spin_lock_irqsave(¤t->pi_lock, flags); \ > current->saved_state = current->__state; \ > debug_rtlock_wait_set_state(); \ > - WRITE_ONCE(current->__state, TASK_RTLOCK_WAIT); \ > - raw_spin_unlock(¤t->pi_lock); \ > + smp_store_mb(current->__state, TASK_RTLOCK_WAIT); \ > + raw_spin_unlock_irqrestore(¤t->pi_lock, flags); \ Sebastian