Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1563519ima; Thu, 25 Oct 2018 00:56:45 -0700 (PDT) X-Google-Smtp-Source: AJdET5dGvOIMC8O8Pa4fa06csFB/WgO+FDZQbrfnUrAGXOctvDU2B39eD/f1zo2r0TSrJ82+Jx15 X-Received: by 2002:a17:902:ab:: with SMTP id a40-v6mr518523pla.296.1540454205763; Thu, 25 Oct 2018 00:56:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540454205; cv=none; d=google.com; s=arc-20160816; b=KYR/Xx4JP6Cgru5x/gLApJhIRVzT5hSVCWMrTWLAinDmS6fjnXxJESqlnQZE7QrNci /3IC5o7/hTaRlwVlUYPn5bJUdY+P/4/YTtEv/kkEZ7YzrlNh0wmFWDPxACmxcdFLFMH9 uY0heFNNjjeysqauIp/8wS3rTh0vpeW/qn270jO5Mymu9OIt5M3/KXtJIhieqS9F8mCy 3+iIOVK16bXq7h8abOTmF+h9ws1f1P37koXQ6/Pzp8H5LbbhEAcwfx/L3JjDA8Li91lG 7ZQJIi71Rrv+jkK4W6eA6jwqS2pD8nTIFaC+9MHW87nhjQ+HIGvg7OVcNZMa8CIOwd2w Vwiw== 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; bh=0J9jQQ383DO4cVbVvJLdlB5/kE189wIQ7lwT9bMOnjQ=; b=j1u9WnngJftKzJRPctF4DETuDob+ydLMyrV+XHHdSEX8szuI+byF28UQwsi2cK3usQ jTGJmq7EQrw0og4EESH+MnQVY3dCYoY6vee5ruIdbzARBhNezZzmJDhMIyHpCWerS+Em IxxTb91RrpNomEezGCQXaMJZ5zEUrSY5sGI6itXmHOdKBd7iU/7byN0BlhNW68xh8hCD D04RDG7k0FOVeso6ASTYeRPNQrgkWkZZ+Suf9XCGlhZ94Qu3TXfxbrIwt/yGRf7BXZLo bHpAAyKSHJmiva+mYZZ5yuwP67mh9Lq6i8NFm5JHm2pqRqXIjl0bc8PIAXjdneLDTN5G WUKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=mOyqMi7M; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n188-v6si521274pga.434.2018.10.25.00.56.29; Thu, 25 Oct 2018 00:56:45 -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=@googlemail.com header.s=20161025 header.b=mOyqMi7M; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727022AbeJYQ1g (ORCPT + 99 others); Thu, 25 Oct 2018 12:27:36 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:38466 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726497AbeJYQ1g (ORCPT ); Thu, 25 Oct 2018 12:27:36 -0400 Received: by mail-ed1-f67.google.com with SMTP id c1-v6so7538621ede.5 for ; Thu, 25 Oct 2018 00:55:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.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=0J9jQQ383DO4cVbVvJLdlB5/kE189wIQ7lwT9bMOnjQ=; b=mOyqMi7Me+B2HHZFBZICz6MfDHzcgp+kAy8tgH5iYasdxg9nKIsidpJbN5OVZxlUZX 4VF2o5Pny+NYJJV0dF3MJmmVYL7+Rkhrto9jWCsVe+wrrGBCCLdIQkx9VuOV4envGE4x OIdeXMw8B2HxRgAzyAxY3/2EAR994mWQCDL3SLMCEoXpuSI7ovsiepa+xRj6++Hn43fc dmj0GGFNVBv/ojbfV1BWP66UgnH7DdRoVh1Oqtjgy5mnHshGYf/BE58G34LGLhHWx7Gz JS0dF3FfrovZeG7esG6qSGhfp0QAmqN4pjEwep08w78ajINvMF06LrfVnV8EYtO/1aIw 3Idg== 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=0J9jQQ383DO4cVbVvJLdlB5/kE189wIQ7lwT9bMOnjQ=; b=ppbZk9C7z/1kWTlFzQA82jL8q/tSV1D1vsEAr7EZEmNoWEAB8ZvjswZ+PknLbNVSLc LdDSwcnWfcKjml8g6e5KJYM9/3/nH4Fjj5sREy7MDndtsL+iHWTQX8ptA838KpNxWQ8e XvK9IkHHyQbYUuP+pxZV0fkZYaI7alFb4qWHoBjzwN0rMpPKhL7y8ITkeWCYduK4VlNr fyCK2bU046j/oV3qXZrzV1Eb2jOPqrSYd398Fd1LraqgFxV1yWl00eIr/r0mCs/96X1l Ze8ZpRblMGxfeNkyLMhsNdjEGlBtdAbjwqSFdAJJncSoJyIKtoyiKoNLw5Nx2PGdLfid 0P7Q== X-Gm-Message-State: AGRZ1gKs76jXPU5QqkDWl0gcz9L30JzFMEvLVPPMLdnIfETkAilh8Q/5 OAgjZYzJ6N8rEswBEzYN9A== X-Received: by 2002:a50:b003:: with SMTP id i3-v6mr747556edd.120.1540454158826; Thu, 25 Oct 2018 00:55:58 -0700 (PDT) Received: from ?IPv6:2a02:908:1257:4460:1ab8:55c1:a639:6740? ([2a02:908:1257:4460:1ab8:55c1:a639:6740]) by smtp.gmail.com with ESMTPSA id m19-v6sm1437967ejz.70.2018.10.25.00.55.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Oct 2018 00:55:58 -0700 (PDT) Subject: Re: [PATCH] drm: fix call_kern.cocci warnings (fwd) To: Maarten Lankhorst , Julia Lawall , Chunming Zhou Cc: kbuild-all@01.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Gustavo Padovan , Sean Paul , David Airlie , linux-kernel@vger.kernel.org References: <995c8e64-46d3-7320-744e-b9bd1cb66530@linux.intel.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: Date: Thu, 25 Oct 2018 09:55:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <995c8e64-46d3-7320-744e-b9bd1cb66530@linux.intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 25.10.18 um 09:50 schrieb Maarten Lankhorst: > Op 24-10-18 om 20:57 schreef Julia Lawall: >> The containing function is called with a spin_lock held, so GFP_KERNEL >> can't be used. >> >> julia >> >> ---------- Forwarded message ---------- >> Date: Tue, 23 Oct 2018 17:14:25 +0800 >> From: kbuild test robot >> To: kbuild@01.org >> Cc: Julia Lawall >> Subject: [PATCH] drm: fix call_kern.cocci warnings >> >> CC: kbuild-all@01.org >> CC: intel-gfx@lists.freedesktop.org >> CC: dri-devel@lists.freedesktop.org >> TO: Chunming Zhou >> CC: "Christian K?nig" >> CC: Gustavo Padovan >> CC: Maarten Lankhorst >> CC: Sean Paul >> CC: David Airlie >> CC: dri-devel@lists.freedesktop.org >> CC: linux-kernel@vger.kernel.org >> >> From: kbuild test robot >> >> drivers/gpu/drm/drm_syncobj.c:202:4-14: ERROR: function drm_syncobj_find_signal_pt_for_point called on line 390 inside lock on line 389 but uses GFP_KERNEL >> >> Find functions that refer to GFP_KERNEL but are called with locks held. >> >> Semantic patch information: >> The proposed change of converting the GFP_KERNEL is not necessarily the >> correct one. It may be desired to unlock the lock, or to not call the >> function under the lock in the first place. >> >> Generated by: scripts/coccinelle/locks/call_kern.cocci >> >> Fixes: 48197bc564c7 ("drm: add syncobj timeline support v9") >> CC: Chunming Zhou >> Signed-off-by: kbuild test robot > The issue appears to be real and the patch looks sane. Chunming Zhou, do you want to fix it like this, or preallocate > a fence obj? If former, just ack. :) Well, wait a second with that advise1 The problem here is that userspace (indirectly) controls when this allocation is made. So what you could do is to construct some code to force the kernel into doing a *lot* of GFP_ATOMIC allocations. And when the kernel runs out of GFP_ATOMIC space, then well bad things start to happen :) Christian. > > ~Maarten >> tree: git://anongit.freedesktop.org/drm/drm-tip drm-tip >> head: 8d7ffd2298c607c3e1a16f94d51450d7940fd6a7 >> commit: 48197bc564c7a1888c86024a1ba4f956e0ec2300 [1968/2033] drm: add syncobj timeline support v9 >> :::::: branch date: 4 hours ago >> :::::: commit date: 5 days ago >> >> Please take the patch only if it's a positive warning. Thanks! >> >> drm_syncobj.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> --- a/drivers/gpu/drm/drm_syncobj.c >> +++ b/drivers/gpu/drm/drm_syncobj.c >> @@ -199,7 +199,7 @@ static struct dma_fence >> (point <= syncobj->timeline)) { >> struct drm_syncobj_stub_fence *fence = >> kzalloc(sizeof(struct drm_syncobj_stub_fence), >> - GFP_KERNEL); >> + GFP_ATOMIC); >> >> if (!fence) >> return NULL; >