Received: by 10.223.176.5 with SMTP id f5csp1994746wra; Thu, 8 Feb 2018 06:52:53 -0800 (PST) X-Google-Smtp-Source: AH8x225q9dAWpyIYRU5rDsxb6vX3QYFFhrnh3EAannwNRMxy3PiKqdA86tjW4dWys/Aksm06J55b X-Received: by 2002:a17:902:bd84:: with SMTP id q4-v6mr866760pls.247.1518101573635; Thu, 08 Feb 2018 06:52:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518101573; cv=none; d=google.com; s=arc-20160816; b=zyPx6G0mlD7JSkh8zUGvGFgMi8KIC/dq8/2fGcSaYcEAKp5cAhG3tT3h8ageJKXpQm ZPY3LsCpY35zuZrUE4fmrcEf13bpWrspgZVr99vN9+5Lc4N8LDWSEoZdOJvF+GhOoDRx 6DoLMpXBraSo4zY+tUDsRMBG+EhceMKdrAGvZ0N1iGXSC5T4CtYOpLHRwnhQI09D8GbB GdNua3fwSRL4OqipQfmUwvXWk+GNmGeuRka9kj+QBQbqdhIqXSvHUGTtkuTJiU7oD+GE toeOSX0XrCHQ+4MSEmd1NuaZu4riGZWNAi7E5rV1jCZpNDnHVKBTQm7ROMcCHRgYPgP5 n8lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=1rFTiO+JEpLe9IPzcC8bGHLBcRzHFh3aQ6d/JzJU+PE=; b=cmFIHFKMgyOzfjUQYh3t9cISCgd1eP7D0UObsxlDePB4RZgJi4i/tsazvqBLTcgagr ZL0lu0FtojgZUBdior3WOmpsXYIHvAB+bsi35GEPmhfwB1YPPrU5Wj9pK7/7hIyAx/k8 xq22SoiPXhgubny79udMq0zVBpOmdTXot0ONCW5T9AZgc1tj/C0EKxKUj8wG27z2KZq2 w6nOhT8ME7mrTOvdiJhDRcywpKG0pAU2bibBYEyiQhCl5ag5ywXd2a9o0tM4kNc88gnO NBk0nKb1N9V3bIF26ZGNu1TtDnGueE/EQCXqhav55uIyKAkvDfoOyiO1d8EXGBYCPWfE uV2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=I1pbSabh; 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 o128si29588pfo.68.2018.02.08.06.52.39; Thu, 08 Feb 2018 06:52:53 -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=fail header.i=@gmail.com header.s=20161025 header.b=I1pbSabh; 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 S1751848AbeBHOv7 (ORCPT + 99 others); Thu, 8 Feb 2018 09:51:59 -0500 Received: from mail-ot0-f196.google.com ([74.125.82.196]:36268 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750882AbeBHOv5 (ORCPT ); Thu, 8 Feb 2018 09:51:57 -0500 Received: by mail-ot0-f196.google.com with SMTP id m20so4546897otf.3; Thu, 08 Feb 2018 06:51:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=1rFTiO+JEpLe9IPzcC8bGHLBcRzHFh3aQ6d/JzJU+PE=; b=I1pbSabhLJiVAlyVfFuRHmDQGmZNcxpg5sXJoJosujA/v/Iu8z56yrIDZuMF/Ck6Xl HRxIp/9/VQItpglJ6/2t0Pvl4c66q9CqIae06UwHxh74mVdoFvBD1Z0WaprJwRdV+ubl N2vtrwlclz5NVIno13ajr8ocihKZW60n5n1aL+o/SGMqgNWjO2VCmht1E/obU4jT+Xwy BFEAQR49097pqdmFz9785kcgi375QCadLFLaTuqAuoyhRKsTgpf6Q2zr3B2XvY34xiyC +FSUrrFuUnXJocgc5/EBAZHBonRJSh9ym7VOutRpj3jxkTFITadw50wCQL5Mck+3cEfd EOxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=1rFTiO+JEpLe9IPzcC8bGHLBcRzHFh3aQ6d/JzJU+PE=; b=tJz2qYCFr2J8bkTG9Tugjy8X4tps4kfKIEjefz9LnJ/0OKca8ISl8RU+K5jLruAbK6 IwnXrjD2eesSx63/fDxGZrJalLSMwAU1aeZqSmSYCTyold2XsqVdnqTaiwXQwnCRLsm9 qBE7IhlCnRB0p4yl/tE7Wicw7y1zVfV1KkciGWS2rDC56MUKRuVX0NAyCxb5roqLdcPb LEWXN4PSs+9bjw2oKJvwQgB1d/tCGbiDb2zklUCBv80Kf+Y6o3mA4xJMWrTiWDR8bo2v Dr+dRP1sSIwYlADv6clUB5SUTMwZrYurwse6lJnRz8aCb8YaGvgLcrJDMORoDFDHHfFP cqQA== X-Gm-Message-State: APf1xPCHLKua6WnOJ8ItlM0ajN8JlB/YZEn6nx67dKoq/t6D60WUT7u7 gfAxHC2nawi8O3CSRassfg3NJYP7hQHudbuJSuk= X-Received: by 10.157.91.47 with SMTP id x44mr762770oth.206.1518101516892; Thu, 08 Feb 2018 06:51:56 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.46.234 with HTTP; Thu, 8 Feb 2018 06:51:56 -0800 (PST) In-Reply-To: <2e48794f-1ebb-6466-f4bf-aa409674bdaa@gmail.com> 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> <2e48794f-1ebb-6466-f4bf-aa409674bdaa@gmail.com> From: "Rafael J. Wysocki" Date: Thu, 8 Feb 2018 15:51:56 +0100 X-Google-Sender-Auth: wnSNlGunbG_i9yxsq3E-cW7S2p4 Message-ID: Subject: Re: [PATCH] acpi: osl: Replace GFP_ATOMIC with GFP_KERNEL in acpi_os_execute To: Jia-Ju Bai Cc: "Rafael J. Wysocki" , Chris Wilson , Len Brown , ACPI Devel Maling List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 8, 2018 at 2:41 PM, Jia-Ju Bai wrote: > > > 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. No worries. > My tool missed that acpi_ev_sci_xrupt_handler() is an interrupt handler, sorry. That just means that the tool is not perfect, which is nothing unusual. :-) I only would suggest double checking its findings before sending out patches next time.