Received: by 10.213.65.68 with SMTP id h4csp434927imn; Fri, 6 Apr 2018 02:55:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx48rwTmlVjsCw9NEJmpn3RJw5fL6NhnYBg9Mvz04NWsdBEIOkSiS6vek+kYvdAfJTdOenWy3 X-Received: by 10.99.107.8 with SMTP id g8mr7481586pgc.271.1523008500142; Fri, 06 Apr 2018 02:55:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523008500; cv=none; d=google.com; s=arc-20160816; b=TNvjkGtmTrhDAOX3m8F4O+DKJsTeCQkwvV4snfh9eG7U6x7dHSt/SNGYX1HB3I5ykK 1YOOBtcImavDjcBqtZl0I99ue1jr9xZekNTuKszGn/w23LTAj19knzuUkJjK/K8pjmp7 FWaqHxb7nB5+/0rimY9/xKBwumN2Tkqio1dDYqPpfOKZEt7XNsG2+ZCqvp5HH85lrwVb /0pYhUZ7DgwSu1MARYrkSj3VQK3mDGGkFOQzm28YQY+1x6ZFfWabMZwx3n20bDiHiEME xxmHxnMaDJIpeCW/m1oy6Po0zRlvhxVJdVmcD0PcYjAbMdRtloede9B3R8dOPRWfxPjk fsfg== 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:mime-version:user-agent:date:message-id :cc:subject:from:to:dkim-signature:arc-authentication-results; bh=Fn+mBLk+CLuASo1O6vKPyNn9N7qj9Gi35Thfwubo4DM=; b=hU6lWQOcGO2hsh+SRP95Ci0W+yM9meObI0FKTBcpBTkDp7AvarmNN3S6AXLPhlEtO2 1x90252GfxW9Nna7RsWqBmZp7sloYuLohUxLh21d5gipz6Zwuk8HRk6rTzU/KmNx4Edd vXQBlTWAETK+7ZfUqToDINTpU5yBaa/W4KNj09d9Rl77qGHUMMnAO6JT8IPCJP4JM/1G nEsxF8sqqxoSY13LD8a30ZjAJrvWaIWisE7NlpfBYmWWT5dnyFYE9b3XyNGFLLNkcXTu u6tA7ptKpwyPxyk9J9CEU+dNA7V7G1W4e8NJD9gZLZqw9TRmVAhdtAMGuL76N/hbQfGL JhNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DivKhIvl; 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 c9-v6si8086738plz.207.2018.04.06.02.54.46; Fri, 06 Apr 2018 02:55:00 -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=DivKhIvl; 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 S1752037AbeDFJxl (ORCPT + 99 others); Fri, 6 Apr 2018 05:53:41 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:50303 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751754AbeDFJxj (ORCPT ); Fri, 6 Apr 2018 05:53:39 -0400 Received: by mail-it0-f65.google.com with SMTP id r19-v6so1138741itc.0 for ; Fri, 06 Apr 2018 02:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:cc:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=Fn+mBLk+CLuASo1O6vKPyNn9N7qj9Gi35Thfwubo4DM=; b=DivKhIvlUNjhqbljc5TRaRshCIOI3952eV5MdjrhKQ6X3viLZrx2xETrcLW3OpaS+1 OZafLRBBhQ65ibNDyz8yuCJdpOTc8SLvV7wyvs8qR3efxnTlnIqt8tdHygeVRNu7hvHa dJag6bm9Op8Fa/sVGfRJ+8Njk9O2tqvmlAW4IDOUVwTUogUOl6urj+ppnaT/dbqMXvmE rRC0arBD6xJlSQWH1M8AWNetzvXvB6mFIwk2sHsswASx5LULlPzwrsefd/wtl8iYU+PS Uo15KcooFduogg6UE1ljDcF2yvs4LGRU9PMyUwru/5c7hsEBYXyIgUkRgMcZM4ojURX8 mHJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:cc:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=Fn+mBLk+CLuASo1O6vKPyNn9N7qj9Gi35Thfwubo4DM=; b=quxURT6XuzOzzQbta27p1rpeBhqd+UfkbqlwFnJGPV58P/B6OKPON5KUVPWk9FkN+h fbipFRScQXUK06U+d1LYflyCwO0Av0r+L/xqvpH5VQGjjK/9lXViuQMNCoeAv2DTbwXg 3Ew/aOIr1GnQ33/CbMJOnN26v9pwt+4WV/kMzo2qp0XUPvmgqIKASS/5vUeZs4YrbgS7 fW2f+w6toVBCshugwd6WD8ZU0605qTp03Ewxbrf8mik/7//FHAQ3ezZIwt+drJWEmNb0 g3HRcAAkQgMbY/gG4Slu8yzvP1uXa+OgZteo0e47hSEa70NCtP3/xPt0mPXlqRDbFF2P BlnA== X-Gm-Message-State: ALQs6tBxXX20uEbgllPu0H6j3PVVjNOYmhMKQpBf24OrM5MIda2ITdlB pexD5GBS5bAdumcOeZG9SgFcvnE6 X-Received: by 2002:a24:130e:: with SMTP id 14-v6mr17073757itz.151.1523008418595; Fri, 06 Apr 2018 02:53:38 -0700 (PDT) Received: from ?IPv6:2402:f000:1:1501:200:5efe:166.111.70.13? ([2402:f000:1:1501:200:5efe:a66f:460d]) by smtp.gmail.com with ESMTPSA id f10-v6sm5777307itb.40.2018.04.06.02.53.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 02:53:38 -0700 (PDT) To: akpm@linux-foundation.org, tglx@linutronix.de, mingo@kernel.org, keescook@chromium.org, lauraa@codeaurora.org, viresh.kumar@linaro.org, nicolas.pitre@linaro.org, thomas.lendacky@amd.com From: Jia-Ju Bai Subject: A question of sleeping with interrupts are disabled in start_kernel() Cc: Linux Kernel Mailing List Message-ID: <1eb16c24-ef3b-2962-d216-57f66321035e@gmail.com> Date: Fri, 6 Apr 2018 17:53:21 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, I have a question of the call path init/main.c: init/main.c: start_kernel() -> kernel/events/core.c: perf_pmu_register() -> kernel/events/core.c: perf_event_init() -> kernel/events/core.c: pmu_dev_alloc() In this call path, start_kernel() calls local_irq_disable() to disable the interrupt; perf_pmu_register() calls mutex_lock() and idr_alloc(GFP_KERNEL), and they can sleep; pmu_dev_alloc() calls kzalloc(GFP_KERNEL), and it can sleep. In my opinion, this code may sleep with interrupts are disabled. I wonder why this code is okay? Best wishes, Jia-Ju Bai