Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp410782imm; Thu, 31 May 2018 02:46:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLQBWgFQchB1+uzSXAfX2+55euh/3D3NFXtk5aFk2NO6rLBwRHaFy8wrehO2Lv9D8OcxTim X-Received: by 2002:a63:7f4e:: with SMTP id p14-v6mr4908248pgn.27.1527759968473; Thu, 31 May 2018 02:46:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527759968; cv=none; d=google.com; s=arc-20160816; b=SDrImzYTdfPRK0yaP9BMpENosDvbPxRkS/DEpW/pKwiiKMmN2Ujof5Ez799/rzKguJ aFv2kYnK/G+akdjj+wkT6qEk/vLl6gYoABI0GgRRsVwBjRYoBriOvhNnZsv6PzUaCQEY u1W8rsTusnhsd19URoYIHH4YNmVq54Hxbvxbx/vhoPD3C/CJXTGsfJs12vqwUbGF3Mx1 1oNTm0skEFEMhYO0FsOfbPpwgi+Zvw9UBwDYhSgUfF5YMypbdw9jlQHwp4hCbpQix4uk 274T5pBzzzjKcBUf/0/dovA0vSgCvRZiSJmKxplg6EvJBg3vi3noRpaiv2jYtcjrgImm f4jQ== 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:dkim-signature:arc-authentication-results; bh=fc2OqZM2xkHJDVvATBqoObIkOwAIUq3q3wAbb/0SHOA=; b=aPCVh1JgP1k3mKgUBOS2dsNf3xRSH8cgnDfZwTHpbWP/8AO24UxepM5z3qWEhout5x MUG4mC5/orcye2MpJgnnOLIrsU4LV6/5vzE3R6ACrrolaBp48Om1uj2NlQulxeG6XRg0 klOdtpH+6LmMuHyhiRODQqjWLOq6XV1ZF/H1ptngB1t71dPhKHdfU7xpC+u8NXKoRWN5 agYLsPkTT5uc3qfk6Ve/2+tDE/V/Cc9qreEx2OH+78f3qvHl5nxgECx7vSP9fbghnBEf 81vNz2e3SUEGVPKDB5fjvigXYnJL5/Hq0//CM72CRnmMGZIeaiL9TutP7DUf7s3kJPaV qQEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H0BQK67H; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k18-v6si37189319pfe.13.2018.05.31.02.45.54; Thu, 31 May 2018 02:46:08 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H0BQK67H; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754363AbeEaJpQ (ORCPT + 99 others); Thu, 31 May 2018 05:45:16 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:39135 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754219AbeEaJpO (ORCPT ); Thu, 31 May 2018 05:45:14 -0400 Received: by mail-pg0-f67.google.com with SMTP id w12-v6so8269715pgc.6; Thu, 31 May 2018 02:45:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=fc2OqZM2xkHJDVvATBqoObIkOwAIUq3q3wAbb/0SHOA=; b=H0BQK67HsFNWRuNdnM7kiXnWbhaHvP5RKu1UxlrywtuK39G7WKdUHqijT/VjYMgnP1 sDKC2FTpP3r247yPRTMXOT8Cx3f7QTK8Ix4/1+E0vdzXfgwIYEm8XZpDH2BQoJVLC884 0ZSTo3PAxkABxvWg7Oh+MxMAzglyXZru/B1JeB5zvUBgQOCmtn6LYVqZgGmRJ/BudmfA srek0lM7kkYwCj2XQF+cLV6k7MIBoLQpetJ+tJ1gSotUN2VieFxPNYfbPiwZzp8cR4ZW i+RdC2GMb9L0K2Orv13ZlccHOcZhNa0vheUvIEnpOeMhjH4pwDvHJbALeqTklAtDlaT8 krWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=fc2OqZM2xkHJDVvATBqoObIkOwAIUq3q3wAbb/0SHOA=; b=FPivqWajOspVx0ZqqCLov8IYHSTzi2V9PCm/+XeAEtKiAg3xBUoyZKxYlY5uHi+mmR FDNABkteNMzwl/ivhzYmXOSWva8sWk3UjFxfUDCEcnj/GZP45fVpHJleI+CcyMkxXVTz Z7i88BN47crnKH5doHjok/1Eh1jtyI/fDU8lkjW2ZV86gJ2igc7De9dttPnYZ4yyG42S gzUIjtEifBSymgbs8AA390FfZk4nabB8ba0s1rgVEElNWuAvRlkYzGzlwnQVw3tBeaBj hR5zi0ziUN5MHo9UalFVcDrjbLCh+d8DOmXQGeNBRS+Z4SZecgupVah2YO4UPKjVgv6V Q+Yg== X-Gm-Message-State: ALKqPwdTO0/Ql/3ZRxAAtprUmceiza7C6sABDbuV8AZRPKG0TEMxWl3l HPX988Fx1FALjDKys/7lnso= X-Received: by 2002:a63:4383:: with SMTP id q125-v6mr5072840pga.412.1527759913579; Thu, 31 May 2018 02:45:13 -0700 (PDT) Received: from localhost ([39.7.47.247]) by smtp.gmail.com with ESMTPSA id a23-v6sm41268375pfk.71.2018.05.31.02.45.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 31 May 2018 02:45:12 -0700 (PDT) Date: Thu, 31 May 2018 18:45:08 +0900 From: Sergey Senozhatsky To: Jia-Ju Bai Cc: bhelgaas@google.com, pmladek@suse.com, sergey.senozhatsky@gmail.com, rostedt@goodmis.org, Al Viro , Greg KH , corbet@lwn.net, Linus Torvalds , Linux Kernel Mailing List , Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org Subject: Re: Can printk() sleep at runtime? Message-ID: <20180531094508.GC477@jagdpanzerIV> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Cc-ing CLK people. On (05/31/18 17:08), Jia-Ju Bai wrote: > [FUNC] __might_sleep > kernel/locking/mutex.c: 747: __might_sleep in __mutex_lock_common > kernel/locking/mutex.c: 893: __mutex_lock_common in __mutex_lock > kernel/locking/mutex.c: 908: __mutex_lock in mutex_lock_nested > drivers/clk/clk.c, 123: mutex_lock_nested in clk_prepare_lock > drivers/clk/clk.c, 1369: clk_prepare_lock in clk_core_get_rate > drivers/clk/clk.c, 1393: clk_core_get_rate in clk_get_rate > lib/vsprintf.c, 1450: clk_get_rate in clock > lib/vsprintf.c, 1944: clock in pointer > lib/vsprintf.c, 2286: pointer in vsnprintf > lib/vsprintf.c, 2385: vsnprintf in vscnprintf > kernel/printk/printk.c, 1853: vscnprintf in vprintk_emit > kernel/printk/printk.c, 1947: vprintk_emit in vprintk_default > kernel/printk/printk_safe.c, 379: vprintk_default in vprintk_func > kernel/printk/printk.c, 1980: vprintk_func in printk > drivers/pci/pci.c, 5364: printk in pci_specified_resource_alignment > drivers/pci/pci.c, 5313: spin_lock in pci_specified_resource_alignment > > In fact, I suspect that my report is false, because I always have an > impression that printk() cannot sleep. > But according to the call path, I cannot find where I make the mistake... > > So could someone please help me to point the mistake? I think you are right. number(buf, end, clk_get_rate(clk), spec) indeed locks the `prepare_lock' mutex from atomic context. -ss