Received: by 10.223.176.5 with SMTP id f5csp1918461wra; Thu, 8 Feb 2018 05:44:44 -0800 (PST) X-Google-Smtp-Source: AH8x227qrRuekuLQ3FaEvOyJeQ4k6lFcOJRYHfQF0UQbKDCRjNTwDQAS0zbmGM6cAre2l266Mh1J X-Received: by 2002:a17:902:4:: with SMTP id 4-v6mr679783pla.187.1518097484613; Thu, 08 Feb 2018 05:44:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518097484; cv=none; d=google.com; s=arc-20160816; b=mjlvh1gYHO82GZmFaymwyh66m4Zb7JAwAs1axHFLNy9JvOny87EE4q9Ofc9Vp6UKDo R5HXgveejJ8O0pICaKvVyuB8KTevXnVpbVcejap8XV3x1kgPt7vSBRm9kpzD96Q+JH4O 83+q9ctPcpbqWrVfsTHLpKk82ObWsMOg0no44Gx7L7Q1yzf8bbcXa+nD3ZEN7LvVUTb0 tX0XCWTRWFRu1nZ1GjKbbqx2uD1ikn0WyshpJU0LwKMaxWwKbXtH0nInd7AQfdhaAnrU n6aXnqLxeI3XmnInS1kij+EJ9EPRvzPLI9EdFK8Ihzq2soeWpkcc9T98eF/vHyBXqFb3 bOMA== 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=4tJpuu9viuhY2fOw8RRWCs0WiQdKFfT4G0Yf1jIsk6o=; b=jm8XLVvcSx1g5X1BWPXelNyX1AI+VQMQ+BOr3/Zd4dy9p2roW/DVMZLay7DR9VFznx 5OH+FswOGJJx6brDre2n8wPeafy33EivDvMmyXuD+gVlcMyCSR/ETMADC8XDUp95RyGx llsbP9U6vLYKvi7zb7KL19+5B0qeidw5wpoWiidD0duzI4qnwjmdNFe3SKgHznrfvwzO +puNCLo7Sub+zg0GtkEIWrh3CuX7az4adldPvPfmmoGSi9GcRbPcCV615MJlKCSiAHnA yt9J1kLx65T21U9mE0yTx1qNZi0K3uKkaJ8xrBabRbD/XdL0qGM1ojL/TXArXa1I2H/C +myw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ka4UGRlw; 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 98-v6si2795370pla.756.2018.02.08.05.44.20; Thu, 08 Feb 2018 05:44:44 -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=@gmail.com header.s=20161025 header.b=ka4UGRlw; 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 S1751941AbeBHNmE (ORCPT + 99 others); Thu, 8 Feb 2018 08:42:04 -0500 Received: from mail-io0-f193.google.com ([209.85.223.193]:37385 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750961AbeBHNmA (ORCPT ); Thu, 8 Feb 2018 08:42:00 -0500 Received: by mail-io0-f193.google.com with SMTP id f89so5799031ioj.4; Thu, 08 Feb 2018 05:42:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=4tJpuu9viuhY2fOw8RRWCs0WiQdKFfT4G0Yf1jIsk6o=; b=ka4UGRlw2CSYtTenSrz6E7gjxI02irrJlxr4QkBEEGowjMEL/DE+AMAP04xsDGl1SP 6ZDc3Hbp1IQ3BpRJVwR7CqPDrbbo0Pd+JzpUYZRpqbzzYNcUsdPYLEILiYoUz0pzfGFR 1Peq1/PLSyz2VMcvK6VnArUs8uBeYPYrXErlRoHXqNcDaR47dJcHFBfiloptyNbp08LP lWWVXenKxrmcbZqAwo8GZWRWzeZN8eMrySrYsNja0xxrNutCPRkMUT3uDwmnUgBnKSdM WHeX9z4R36gY4vpzptPv17iqq7kI4v5/TtTz+vtrwmFYM2D8MbN9GrPsitqr2tVqOTrz atBA== 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=4tJpuu9viuhY2fOw8RRWCs0WiQdKFfT4G0Yf1jIsk6o=; b=nDLbcTEPkS+dz58H1qMvO5pf8uglRwknTe65KmsE1vXvTI4BgM+mI7xv2RWyLEIGTa JPEBYrldXudf94Cvw2JDeNkQo+7c29WI1iNCN6nsVW2DqriyNqh5q5ZJBOa5tW7zXrbK dft9eaxFWUHXxsL1uOWmEd7Wo2Oj0gosePd03XSrBdkf5B5Xfwi/cVxaWi1HZubqictg WcMhbHULqC4m3b2E2KS/O4C1SpiQgO8NronvqOfjawZFL9ycTEA5duY1+z+iZSitKInH T17YQluOndDrIKEbOe7fVozbfrEcx3nWlVD0hcFn5kyxuElLX6krNvl2bXu3LkMLLc4Q hCdg== X-Gm-Message-State: APf1xPCaFq3sEzKFYIizfI6/GNdzY3uLKMquCCPwGxi7Cf+u9zckO9XQ rpL9R0jPseTuTfxxkREj5lyp5V/m X-Received: by 10.107.35.84 with SMTP id j81mr799655ioj.226.1518097319696; Thu, 08 Feb 2018 05:41:59 -0800 (PST) Received: from ?IPv6:2402:f000:1:1501:200:5efe:166.111.252.84? ([2402:f000:1:1501:200:5efe:a66f:fc54]) by smtp.gmail.com with ESMTPSA id t123sm462094itb.41.2018.02.08.05.41.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Feb 2018 05:41:58 -0800 (PST) Subject: Re: [PATCH] acpi: osl: Replace GFP_ATOMIC with GFP_KERNEL in acpi_os_execute To: "Rafael J. Wysocki" , Chris Wilson Cc: lenb@kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org References: <1516875222-12293-1-git-send-email-baijiaju1990@gmail.com> <1808276.ZJn2ZeULZY@aspire.rjw.lan> <151808479008.28809.166946118004484639@mail.alporthouse.com> <1914141.qoxtLSqbUU@aspire.rjw.lan> From: Jia-Ju Bai Message-ID: <2e48794f-1ebb-6466-f4bf-aa409674bdaa@gmail.com> Date: Thu, 8 Feb 2018 21:41:53 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <1914141.qoxtLSqbUU@aspire.rjw.lan> 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 On 2018/2/8 18:20, Rafael J. Wysocki wrote: > On Thursday, February 8, 2018 11:13:10 AM CET Chris Wilson wrote: >> Quoting Rafael J. Wysocki (2018-02-08 09:51:41) >>> On Thursday, January 25, 2018 11:13:41 AM CET Jia-Ju Bai wrote: >>>> After checking all possible call chains to acpi_os_execute here, >>>> my tool finds that acpi_os_execute is never called in atomic context. >>>> And acpi_os_execute calls acpi_debugger_create_thread >>>> which calls mutex_lock, >>>> thus it proves again that acpi_os_execute can >>>> call functions which may sleep. >>>> Thus GFP_ATOMIC is not necessary, and it can be replaced with GFP_KERNEL. >>>> >>>> This is found by a static analysis tool named DCNS written by myself. >>>> >>>> Signed-off-by: Jia-Ju Bai >>>> --- >>>> drivers/acpi/osl.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c >>>> index 3bb46cb..8ee605e 100644 >>>> --- a/drivers/acpi/osl.c >>>> +++ b/drivers/acpi/osl.c >>>> @@ -1066,7 +1066,7 @@ acpi_status acpi_os_execute(acpi_execute_type type, >>>> * having a static work_struct. >>>> */ >>>> >>>> - dpc = kzalloc(sizeof(struct acpi_os_dpc), GFP_ATOMIC); >>>> + dpc = kzalloc(sizeof(struct acpi_os_dpc), GFP_KERNEL); >>>> if (!dpc) >>>> return AE_NO_MEMORY; >>>> >>>> >>> Applied, thanks! >> Hmm, not this patch per se, but >> >> https://intel-gfx-ci.01.org/tree/next/next-20180207/fi-bxt-dsi/dmesg0.log >> [ 111.378236] BUG: sleeping function called from invalid context at mm/slab.h:420 >> [ 111.378259] in_atomic(): 1, irqs_disabled(): 1, pid: 1701, name: gem_exec_flush >> [ 111.378275] INFO: lockdep is turned off. >> [ 111.378277] irq event stamp: 0 >> [ 111.378280] hardirqs last enabled at (0): [< (null)>] (null) >> [ 111.378286] hardirqs last disabled at (0): [<00000000a01fa473>] copy_process.part.7+0x2f1/0x1db0 >> [ 111.378290] softirqs last enabled at (0): [<00000000a01fa473>] copy_process.part.7+0x2f1/0x1db0 >> [ 111.378292] softirqs last disabled at (0): [< (null)>] (null) >> [ 111.378293] Preemption disabled at: >> [ 111.378298] [] __mutex_lock+0x56/0x9b0 >> [ 111.378311] CPU: 1 PID: 1701 Comm: gem_exec_flush Tainted: G U W 4.15.0-next-20180207-g5d1c98967100-next-20180207 #1 >> [ 111.378313] Hardware name: Intel Corp. Broxton P/Apollolake RVP1A, BIOS APLKRVPA.X64.0150.B11.1608081044 08/08/2016 >> [ 111.378314] Call Trace: >> [ 111.378318] >> [ 111.378323] dump_stack+0x5f/0x86 >> [ 111.378328] ___might_sleep+0x1d9/0x240 >> [ 111.378334] ? acpi_os_execute+0x2d/0x130 >> [ 111.378338] kmem_cache_alloc_trace+0x1ae/0x2b0 >> [ 111.378344] ? acpi_ev_asynch_enable_gpe+0x2d/0x2d >> [ 111.378347] acpi_os_execute+0x2d/0x130 >> [ 111.378351] acpi_ev_gpe_dispatch+0xd7/0x120 >> [ 111.378355] acpi_ev_gpe_detect+0x156/0x195 >> [ 111.378362] acpi_ev_sci_xrupt_handler+0x16/0x28 >> [ 111.378365] acpi_irq+0xd/0x30 >> [ 111.378369] __handle_irq_event_percpu+0x3c/0x340 >> [ 111.378374] handle_irq_event_percpu+0x1b/0x50 >> [ 111.378378] handle_irq_event+0x2f/0x50 >> [ 111.378381] handle_fasteoi_irq+0x93/0x150 >> [ 111.378386] handle_irq+0x11/0x20 >> [ 111.378390] do_IRQ+0x5e/0x120 >> [ 111.378395] common_interrupt+0xbb/0xbb >> [ 111.378397] >> >> does tell us that acpi_os_execute() is called in irq context. > Well, right, thanks! > > I overlooked this instance, so dropping the patch. Sorry for my false positive. My tool missed that acpi_ev_sci_xrupt_handler() is an interrupt handler, sorry. Thank Chris for testing my patch. Best wishes, Jia-Ju Bai