Received: by 10.223.185.116 with SMTP id b49csp6580497wrg; Thu, 8 Mar 2018 09:42:15 -0800 (PST) X-Google-Smtp-Source: AG47ELvVyyFwo82VawIIbJx7rEqJ/ZA69U1mCBXdff3S0eM7uhFpw7gGShJrvDg0spa8Y6zl2YZu X-Received: by 10.99.124.85 with SMTP id l21mr20709273pgn.274.1520530935736; Thu, 08 Mar 2018 09:42:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520530935; cv=none; d=google.com; s=arc-20160816; b=FbTrpm8+BR+IaAA6RKoY2fIwkiUSlbNHN5QUJBfSmZW3nD3rsr6ZUgenFVOgD4t7qJ /AoGb58AEd+RyAblpzHrH7+Jo8teoqoKw2WKHCNd8dsS9HI6DWEBuhvnwvugAXE/AuAw Unys9bl+9C6T+3owGeWHo9qMIJn2aw64fbnlqo/t3wnVF7ypa1n67jMcLDYe0hOFq6v9 J4awChepyjqE1K+tQIzbgCoIVIlDybzWsobFWtPW6J6onJlyMcx/FtE87z+YMZgpZdkZ F+R/sPxt2QoGYA/0JVU39BL/+M+tiKQkSIsCHEvImW5lRPBIUBw0cFAGIAratDrVB2OQ 7IRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=U71y9aBzxdkvoMQMF7m4euB91iwcbX6kegkHDyvyWgA=; b=gpPNshozSPL22MI+A3ZlFDP2xI/yMhmyWmtI59+JnX/x2f36vicjfQoEgdP4pzzFiW 5fxgEdjDGX6oFDe23DV5TkqRImLBjxGyaBdPkALL2BNhaf4FnBUhkTuWSdOdqi3Y+bmN GDiCEjSBSWxuyEAIo13YGVvw2NEur3VilOd6JbQcsCTjlXqB1AC5+qgmcXrapzir7PDG +5adUwpYX1JpTSP/HeVoU17ns5wkUPPiE8kbzL2jEFx1sksyN/EYonmR/D5PoOAtKNpY VEl58qrHZj5Qiy+qfcIBOtcZxf/2fr3evY4nY73eddAW4XJnqcGLAKX6VA4nngLOn0qF anxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f91-v6si13797504plf.203.2018.03.08.09.42.01; Thu, 08 Mar 2018 09:42:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935829AbeCHRlJ convert rfc822-to-8bit (ORCPT + 99 others); Thu, 8 Mar 2018 12:41:09 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:39334 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752181AbeCHRlH (ORCPT ); Thu, 8 Mar 2018 12:41:07 -0500 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1etzXL-0007g3-W9; Thu, 08 Mar 2018 18:41:04 +0100 Date: Thu, 8 Mar 2018 18:41:03 +0100 From: Sebastian Andrzej Siewior To: Corey Minyard Cc: linux-rt-users , linux-kernel , Tejun Heo , Peter Zijlstra , Thomas Gleixner Subject: Re: Warning from swake_up_all in 4.14.15-rt13 non-RT Message-ID: <20180308174103.mduy5qq2ttlcvig3@linutronix.de> References: <20180306174604.nta5rcvfvrfdfftz@linutronix.de> <1704d817-8fb9-ce8f-1aa1-fe6e8b0c3919@mvista.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <1704d817-8fb9-ce8f-1aa1-fe6e8b0c3919@mvista.com> User-Agent: NeoMutt/20180223 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-03-07 09:45:29 [-0600], Corey Minyard wrote: > > I have no idea what is the wisest thing to do here. The obvious fix > > would be to use the irqsafe() variant here and not drop the lock between > > wake ups. That is essentially what swake_up_all_locked() does which I > > need for the completions (and based on some testing most users have one > > waiter except during PM and some crypto code). > > It is probably no comparison to wake_up_q() (which does multiple wake > > ups without a context switch) but then we did this before like that. > > > > Preferably we would have a proper list_splice() and some magic in the > > "early" dequeue part that works. > > > > Maybe just modify the block code to run the swake_up_all() call in a > workqueue > or tasklet?  If you think that works, I'll create a patch, test it, and > submit it if > all goes well. It will work but I don't think pushing this into workqueue/tasklet is a good idea. You want to wakeup all waiters on waitqueue X (probably one waiter) and instead there is one one wakeup + ctx-switch which does the final wakeup. But now I had an idea: swake_up_all() could iterate over list and instead performing wakes it would just wake_q_add() the tasks. Drop the lock and then wake_up_q(). So in case there is wakeup pending and the task removed itself from the list then the task may observe a spurious wakeup. > Thanks, > > -corey Sebastian