Received: by 10.223.185.116 with SMTP id b49csp7269wrg; Thu, 8 Mar 2018 11:56:07 -0800 (PST) X-Google-Smtp-Source: AG47ELs2zflcotDvuIIas3BDfPvAXUstp+glHccZqjf3U4tRInCl+tYjz0A9/DpKD9wbIRJo3G9x X-Received: by 10.99.114.86 with SMTP id c22mr21525430pgn.162.1520538967183; Thu, 08 Mar 2018 11:56:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520538967; cv=none; d=google.com; s=arc-20160816; b=SePxpHZqf09CLzE52KtCM6oGpz5p7tId+27mY9KYuLH8+CJT7XFiM1tPKHAlEYWY9x TwdI+nDrRFLvTmH2lA+u7NpMFr4V9VelFKgcO2fL+Xz2woBVHYACze4oFb6KEgo0eIsn N2jtBNF3XgP6oqMWBXJ9uJ6SGbcaRpGlO63UKSRx1jVqN3/bnmWPZvB3uwbJ1cO6jr6S PsRM/JTLD5cXdcJqOjrr2dj/TKquoC8tHwin45QKq5kglX8T4Cy06arIpLj1+UU7cSEz hbRnUReuizAv4b8IXiK7ZlmeCIZWOIueQsZmo9QEiul6uxjLqnL4q8v+yHuCCJwVN4mw I4ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=/7VogqQ8GfwhqPmFAgGmNfdHKvNMQGAjXqgR7qLe0rY=; b=ifOZjk5t7RUSRpAf6l7DlnB1iXBsFef92sZPKYTDxjXiP+70pfFnqd9dbkXsgsDt4S 32D+e8b47C4cMiZkW5xsfIicwdlg8qTN1eZUKnO2r3hcOUEfWSzUNQyh/D60QbNyZ+oS FaeDAL6BmJyLjhDZG1jbgTyk87FZa4RtEan0p7Yc8vgetCE5nBBIKcl6WqacPsJGYv40 9ZcMn0EEz7Ta1EJ0qLBGgBG8udkp0XGuJPHoeBx8jAYoa6dil3ln13nP98TImla1aTe5 PZHSRCSST7dt1OBBFgUtvwwvsm8kiXRN+vYxtw+QKO2+PuArWZxVjMkJi3V9sKuOX+Ow HuiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mvista-com.20150623.gappssmtp.com header.s=20150623 header.b=Ij6+A8er; 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 m12si13335364pgr.85.2018.03.08.11.55.51; Thu, 08 Mar 2018 11:56:07 -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; dkim=pass header.i=@mvista-com.20150623.gappssmtp.com header.s=20150623 header.b=Ij6+A8er; 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 S1752458AbeCHTyX (ORCPT + 99 others); Thu, 8 Mar 2018 14:54:23 -0500 Received: from mail-pl0-f44.google.com ([209.85.160.44]:37068 "EHLO mail-pl0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752432AbeCHTyU (ORCPT ); Thu, 8 Mar 2018 14:54:20 -0500 Received: by mail-pl0-f44.google.com with SMTP id w12-v6so3916578plp.4 for ; Thu, 08 Mar 2018 11:54:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mvista-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=/7VogqQ8GfwhqPmFAgGmNfdHKvNMQGAjXqgR7qLe0rY=; b=Ij6+A8erMSPfRPkwY834ekj3LfOF914nJmP+EWqwhLY/tu/l1F0PUzE75DcrPQHwmD h8r+keqHpb7Gos1mdAgPUqK9q5vbTub1sU2S+dYeiiBHyuy9AXdDG3K5ZINP4y0ezcYP ageN62sm1XNfUeVpl6LDB7W4UzzXOhQMcvsg3YouFVqFSObN3hf9u7o8f04BXDrqtuTA UAWE7Am4N9ujTp7vu8ry7dOA7NWd2U5Hps8ysmcseK1nptfxPrkQw0IqtoGYq+ULmbDx upfQYDVk1IdI14vhDf09foXoAnRSR0g928ZODpBIMUqhI97O+0xRAeQ5x2K8KHgh5ysY Y9lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=/7VogqQ8GfwhqPmFAgGmNfdHKvNMQGAjXqgR7qLe0rY=; b=sZHBpPieOxhBmvmPhxWW9/Or9DV+eK7HroTVV7kTR0pT7djFL9PHaFRWbD+tBh4gzn Qhtx4rquKkn+JbDCmKnKuThUYaywOgRRDJTK5Za8n3Tuw/NB7QJP83oX+KI0E85F54Dp Bd9n2Dgs3iwcSZCkjxtgfmytD/Gsjn/6RNhh0AfVRnnEDqLZl4Jz588rndIZaqrNrh2o Ms0zYMNrs3o8yGag0IjmfK53ND/2nvw8jiJRLw/eDK+2p2cH2QucxWFf5vaB6tByti7c PsjtlSaE/FDuC3A0mOw6MVrhAshnCsXO5T+Cw+8zas89PwXomGQ7Q7s747syx6IGBETu dGsQ== X-Gm-Message-State: AElRT7FY5pXzbgJgkWnxcSnjZSCtKoBTQuivACsGuuI1JFF/Nyf2eZ7I U5FkJEArZBOASqrOBiEmKnLjwcYG8IM= X-Received: by 2002:a17:902:bc81:: with SMTP id bb1-v6mr9855679plb.425.1520538860142; Thu, 08 Mar 2018 11:54:20 -0800 (PST) Received: from [192.168.27.3] ([47.184.168.85]) by smtp.gmail.com with ESMTPSA id w10sm32365444pgr.57.2018.03.08.11.54.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Mar 2018 11:54:19 -0800 (PST) Subject: Re: Warning from swake_up_all in 4.14.15-rt13 non-RT To: Sebastian Andrzej Siewior Cc: linux-rt-users , linux-kernel , Tejun Heo , Peter Zijlstra , Thomas Gleixner References: <20180306174604.nta5rcvfvrfdfftz@linutronix.de> <1704d817-8fb9-ce8f-1aa1-fe6e8b0c3919@mvista.com> <20180308174103.mduy5qq2ttlcvig3@linutronix.de> From: Corey Minyard Message-ID: Date: Thu, 8 Mar 2018 13:54:17 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180308174103.mduy5qq2ttlcvig3@linutronix.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/08/2018 11:41 AM, Sebastian Andrzej Siewior wrote: > 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. True, but this is an uncommon and already fairly expensive operation being done.  Adding a context switch doesn't seem that bad. > 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. That sounds promising, but where does wake_up_q() get called?  No matter what it's an expensive operation and I'm not sure where you would put it in this case. I had another idea.  This is only occurring if RT is not enabled, because with RT all the irq disable things go away and you are generally running in task context.  So why not have a different version of swake_up_all() for non-RT that does work from irqs-off context? -corey