Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4287857pxj; Wed, 12 May 2021 02:08:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkw/kz/mPuS1CzR8WrMaz2QkkCmR8yN3XzaZCBfYNqMiD9X84lwfBJQIAfjGueprkak5Tt X-Received: by 2002:a05:6e02:2143:: with SMTP id d3mr15481915ilv.269.1620810535961; Wed, 12 May 2021 02:08:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620810535; cv=none; d=google.com; s=arc-20160816; b=XWveFAnQ/mbCnXhn4nfyMf0Fr1RH5iD5TtFsYHMCWVMpiXBtru4L5uN9+lzojZO8AN aEBzdYuB0wB0b9PSpBDuW066AK0QMonwTEfJSsq8Z6I+UHbWf+y7q+DCRCtUuUOewlm3 8CrtG1gDRjhhNLEELhKb1y0ZGtS7j/iKq2vTRHinDbZ7Dh2BdIrnlr9XjutKg7rYF3u3 P69SMy3P22P0gv1H/ISuvLT39/hVd2XMxvmFLNPgEuO/dXQJcbdwKMr+ol/XteQyUJHS I/zH3vsjFaOL6FmIss8O/GLVZZI6+ynnUzfnycSrTMYFbNB4EjG8I//Ld9xZMXvemaAA bYqA== 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:date:dkim-signature; bh=Grgb//N/lCPeK7sJQo/JIeouZ0dY42fB6qihCoLIo8c=; b=yh4MomtvodkIg+vnbqqYcyTusLCmqSSTzNBQxiWnk/REh8fFJTpMGBSdWcPQEN6OMz AtYl9QVmAC5nUybhHYYEDi47p1jLNjwFX7gI7uZbv24mkY2YSoX6c32BC6b7Pfe+Q9d8 k9o/8gD9aRxuCLExuQqbsYZpIpg3MjB4DwP8CKhsar1xGRvn/8uvAK57GrrzeWD5tYNs Ztj9weCSguiwWn3CAZgu7cMbRMguiOAnXPPJRkSW6aWhustorL7sdHMYQHt9T6df+Ve4 Pe4MFcIZoRRkijhJgZz81cMi/98mX5x2I+iIr5Bv07KbvS7xn0eI8SFV/YbH9n0XRA9P Opdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=UWdODZ+3; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k6si22505242ilo.39.2021.05.12.02.08.42; Wed, 12 May 2021 02:08:55 -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=@infradead.org header.s=desiato.20200630 header.b=UWdODZ+3; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230236AbhELJJK (ORCPT + 99 others); Wed, 12 May 2021 05:09:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230114AbhELJJJ (ORCPT ); Wed, 12 May 2021 05:09:09 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED77DC061574 for ; Wed, 12 May 2021 02:08:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Grgb//N/lCPeK7sJQo/JIeouZ0dY42fB6qihCoLIo8c=; b=UWdODZ+3hIheUJWXjqDbq4mfTW homSj6CT1obAGXGb9Qh43G8nTHS2sdfgjyfDHYilmHhQt8iIbzkMw3Zw8aYvPwjXdgDZFhxMim6OD JMk3tubYX4Rub4qkfsJZSCnBdPYaH5G5GuRe3TJiBqF4hnreLjFfPuq0Y3adfIhj01PtNb3Cfkc47 3Byf3DGxULDQzTjr1D2OnXj3Pb16HPCUKww3HvC57fSeDXWzaScC6rl4tsgZ2PYjxOUJT3Snf18GM ehKgzvc4qz8PIIHJBLl0lTGMrlHOnOZfKKdc1Juciyc0IuHPNbkY4JFLS+ezFBUn1nfknFtmoyR1S 9mjFmxhw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lgkqR-002Obs-EJ; Wed, 12 May 2021 09:07:55 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 0BAEB300242; Wed, 12 May 2021 11:07:55 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id E3CEE2BA8A557; Wed, 12 May 2021 11:07:54 +0200 (CEST) Date: Wed, 12 May 2021 11:07:54 +0200 From: Peter Zijlstra To: Aubrey Li Cc: Joel Fernandes , "Hyser,Chris" , Josh Don , Ingo Molnar , Vincent Guittot , Valentin Schneider , Mel Gorman , Linux List Kernel Mailing , Thomas Gleixner Subject: Re: [PATCH v2 04/19] sched: Prepare for Core-wide rq->lock Message-ID: References: <20210422120459.447350175@infradead.org> <20210422123308.196692074@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 08, 2021 at 04:07:35PM +0800, Aubrey Li wrote: > > +#ifdef CONFIG_SMP > > +/* > > + * double_rq_lock - safely lock two runqueues > > + */ > > +void double_rq_lock(struct rq *rq1, struct rq *rq2) > > Do we need the static lock checking here? > __acquires(rq1->lock) > __acquires(rq2->lock) > > > +{ > > + lockdep_assert_irqs_disabled(); > > + > > + if (rq_order_less(rq2, rq1)) > > + swap(rq1, rq2); > > + > > + raw_spin_rq_lock(rq1); > > + if (rq_lockp(rq1) == rq_lockp(rq2)) { > > And here? > __acquire(rq2->lock); > > > + return; > } > > + > > + raw_spin_rq_lock_nested(rq2, SINGLE_DEPTH_NESTING); > > +} > > +#endif I'd as soon rip out all that sparse annotation crud; I don't think I've ever had any benefit from it. > > @@ -2368,11 +2354,11 @@ static inline void double_rq_unlock(stru > > __releases(rq1->lock) > > __releases(rq2->lock) > > { > > - raw_spin_rq_unlock(rq1); > > if (rq_lockp(rq1) != rq_lockp(rq2)) > > raw_spin_rq_unlock(rq2); > > else > > __release(rq2->lock); > > + raw_spin_rq_unlock(rq1); > > This change seems not necessary, as the softlockup root cause is not > the misorder lock release. No, it really is needed; rq_lockp() is not stable if we don't hold a lock.