Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2202699yba; Mon, 6 May 2019 01:24:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzLiJ8aCwKx4QggDOdW31wgO6aB0k3bziHy1m3fzz50Rl84nxO8qNA/mKWhKiXyV+AVOH1I X-Received: by 2002:a62:1990:: with SMTP id 138mr31072428pfz.98.1557131044115; Mon, 06 May 2019 01:24:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557131044; cv=none; d=google.com; s=arc-20160816; b=W3rIGlYKNE2mn7m5ZHtVm//nVnvz5dxpOYEGz9qQqaY0b7p6AoZw6C9pepoXGfBOX0 QhDR08ZTc06FbQLWiwlsGRjfag0gT4s6XzOutVOPhZd4l8mkzCv8SvOlry1Y134hbcoY qPc7cRkzrQ9FqpRwsf8eGR7h1umPcm6iyOorgU6MHKNUVSZ5PpAMTBevf8/WN/dveLVw XxMTvzTKS9MyDpQS9E0/NM6zuwMtSLvi/5iyAiUC8viRxc+sm+WIeCxEK/y/IhQ9Dd27 4TXcbxC2/ktCBs03scZdDLmvfUBuMu65SNm7KDCLX+cYSRtveM1cxRazeapjK9X9wQhS Iplg== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=46Uh2xRgxn4KaIXXApC/KA4VS5q9YToSjjEzf35J92A=; b=ailcN1sCufRoARfly1xZepYDfCHppVWIi6f5JcMXwM+GFk3isXFLe7qPs/Ehcvbu4A 3aTA9uOaGz+5+6Bpm62gJxz0xy2Q+JlGs7O5pvmwznUZ5km8bQ8Zvz6EzMaZwXVf3CPv yKcU919U0VKW2cvgiWXUOnk6D/B35mWt0RvMMs9XKZ0jO2Oxhwdh7HHH1a15u8HxV1We nCt1iFVU6tCZ8hatbxXQOZYjnCxrDv+PmOIz2KXzonAEzbqudj9/5U8nMoPBMJF3xIL2 3Bcj6G+UmId31j5+fjOO6SVjwvDZlOHNc5E2EtRZAuaWFJxilupzSMwg+ubP1dUEoMp6 ZgRQ== 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 h189si14012336pfc.283.2019.05.06.01.23.49; Mon, 06 May 2019 01:24:04 -0700 (PDT) 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 S1726529AbfEFIUX (ORCPT + 99 others); Mon, 6 May 2019 04:20:23 -0400 Received: from mx2.suse.de ([195.135.220.15]:58746 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726197AbfEFIUV (ORCPT ); Mon, 6 May 2019 04:20:21 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 900D3AEE8; Mon, 6 May 2019 08:20:20 +0000 (UTC) Date: Mon, 6 May 2019 10:20:20 +0200 From: Petr Mladek To: Daniel Vetter Cc: Intel Graphics Development , Daniel Vetter , Peter Zijlstra , Ingo Molnar , Will Deacon , Sergey Senozhatsky , Steven Rostedt , John Ogness , linux-kernel@vger.kernel.org Subject: Re: [PATCH] RFC: console: hack up console_lock more v2 Message-ID: <20190506082020.zobcuhiy6bkdekv3@pathway.suse.cz> References: <20190502141643.21080-1-daniel.vetter@ffwll.ch> <20190506074553.21464-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190506074553.21464-1-daniel.vetter@ffwll.ch> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 2019-05-06 09:45:53, Daniel Vetter wrote: > console_trylock, called from within printk, can be called from pretty > much anywhere. Including try_to_wake_up. Note that this isn't common, > usually the box is in pretty bad shape at that point already. But it > really doesn't help when then lockdep jumps in and spams the logs, > potentially obscuring the real backtrace we're really interested in. > One case I've seen (slightly simplified backtrace): > > Call Trace: > > console_trylock+0xe/0x60 > vprintk_emit+0xf1/0x320 > printk+0x4d/0x69 > __warn_printk+0x46/0x90 > native_smp_send_reschedule+0x2f/0x40 > check_preempt_curr+0x81/0xa0 > ttwu_do_wakeup+0x14/0x220 > try_to_wake_up+0x218/0x5f0 try_to_wake_up() takes p->pi_lock. It could deadlock because it can get called recursively from printk_safe_up(). And there are more locks taken from try_to_wake_up(), for example, __task_rq_lock() taken from ttwu_remote(). IMHO, the most reliable solution would be do call the entire up_console_sem() from printk deferred context. We could assign few bytes for this context in the per-CPU printk_deferred variable. Best Regards, Petr