From patchwork Fri Oct 12 08:56:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sharat Masetty X-Patchwork-Id: 10638121 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AC491933 for ; Fri, 12 Oct 2018 08:57:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D00A2943C for ; Fri, 12 Oct 2018 08:57:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 911222B799; Fri, 12 Oct 2018 08:57:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DFBE2943C for ; Fri, 12 Oct 2018 08:57:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728064AbeJLQ2m (ORCPT ); Fri, 12 Oct 2018 12:28:42 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:42466 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727705AbeJLQ2m (ORCPT ); Fri, 12 Oct 2018 12:28:42 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 16BE96063F; Fri, 12 Oct 2018 08:57:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539334637; bh=szomR2usLQNRx5OdTgTvemRxdaf8ucSN3+UFc76NZ2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pDZAOcvd68jXVpq5Cvu+YsE41HOc9DnWIwbPtjaD2WPpMY3k+Wo+fkR/lPqDIbv9e 47weIt65/gDFlwBMPFTthoBK3d6730HrgZd4+6G8eZfoEN4hO9YAMcZyvv4j2pKRMB q8tFkCbxu1n0FqbIdZBnNf2qiMD3uoFW2XAp/Doo= Received: from smasetty-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: smasetty@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id AA7A46063F; Fri, 12 Oct 2018 08:57:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539334636; bh=szomR2usLQNRx5OdTgTvemRxdaf8ucSN3+UFc76NZ2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YJxa7IFQzU8TyWkyNrPhR+MIZ9TeCnt173vL3c0ndlxAYy9NfQjcnZWYkS4XgU91C 3pcbydqrNsI+piHL5KaD1pWBX9cjTrpc/+q8MoAj0fNnBXw6ZjqtodKFRXYzMY3KVc uteljTLGHx1zvP5GveAeaurxBI96V2/0aAr2jhsY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org AA7A46063F Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=smasetty@codeaurora.org From: Sharat Masetty To: freedreno@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, jcrouse@codeaurora.org, Sharat Masetty Subject: [PATCH 3/3] drm/msm: Fix task dump in gpu recovery Date: Fri, 12 Oct 2018 14:26:56 +0530 Message-Id: <1539334616-11723-4-git-send-email-smasetty@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1539334616-11723-1-git-send-email-smasetty@codeaurora.org> References: <1539334616-11723-1-git-send-email-smasetty@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The current recovery code gets a pointer to the task struct and does a few things all within the rcu_read_lock. This puts constraints on the types of gfp flags that can be used within the rcu lock. This patch instead gets a reference to the task within the rcu lock and releases the lock immediately, this way the task stays afloat until we need it and we also get to use the desired gfp flags. Signed-off-by: Sharat Masetty --- drivers/gpu/drm/msm/msm_gpu.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index da63d3d..ca573f6 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c @@ -438,10 +438,9 @@ static void recover_worker(struct work_struct *work) if (submit) { struct task_struct *task; - rcu_read_lock(); - task = pid_task(submit->pid, PIDTYPE_PID); + task = get_pid_task(submit->pid, PIDTYPE_PID); if (task) { - comm = kstrdup(task->comm, GFP_ATOMIC); + comm = kstrdup(task->comm, GFP_KERNEL); /* * So slightly annoying, in other paths like @@ -454,10 +453,10 @@ static void recover_worker(struct work_struct *work) * about the submit going away. */ mutex_unlock(&dev->struct_mutex); - cmd = kstrdup_quotable_cmdline(task, GFP_ATOMIC); + cmd = kstrdup_quotable_cmdline(task, GFP_KERNEL); + put_task_struct(task); mutex_lock(&dev->struct_mutex); } - rcu_read_unlock(); if (comm && cmd) { dev_err(dev->dev, "%s: offending task: %s (%s)\n",