From patchwork Fri Oct 12 08:56:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sharat Masetty X-Patchwork-Id: 10638113 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 7AD2C933 for ; Fri, 12 Oct 2018 08:57:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B6A12943C for ; Fri, 12 Oct 2018 08:57:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5FB982B799; Fri, 12 Oct 2018 08:57:13 +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 14E832943C for ; Fri, 12 Oct 2018 08:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728054AbeJLQ2h (ORCPT ); Fri, 12 Oct 2018 12:28:37 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:42152 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727705AbeJLQ2h (ORCPT ); Fri, 12 Oct 2018 12:28:37 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D5D2660BE3; Fri, 12 Oct 2018 08:57:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539334631; bh=MxqOKQIJXhqnwFeNXvwCIfN3fc4PCTE4h8yxLXJMZBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DHhzxQU82Lsp4JoFsUkrdTdYJty0/iwsy3zGMk7N/RgcWCx43JLjFvLr7txMjbR1E mkvkWHBw3b8g3VI7QWjYJlO2rmuq9IVpJpmtS1HxptpeQVqyXlVDL16ZGrzbRiT7RP bZWRB0QbKJetZORSjxPP9jNltmlX5HeZRedZs8uk= 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 899206031A; Fri, 12 Oct 2018 08:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539334631; bh=MxqOKQIJXhqnwFeNXvwCIfN3fc4PCTE4h8yxLXJMZBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DHhzxQU82Lsp4JoFsUkrdTdYJty0/iwsy3zGMk7N/RgcWCx43JLjFvLr7txMjbR1E mkvkWHBw3b8g3VI7QWjYJlO2rmuq9IVpJpmtS1HxptpeQVqyXlVDL16ZGrzbRiT7RP bZWRB0QbKJetZORSjxPP9jNltmlX5HeZRedZs8uk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 899206031A 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 1/3] lib/string: Pass the input gfp flags to kmalloc Date: Fri, 12 Oct 2018 14:26:54 +0530 Message-Id: <1539334616-11723-2-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 Pass the user sent gfp flags to kmalloc() calls. This helps calling the functions in user desired contexts. Signed-off-by: Sharat Masetty --- lib/string_helpers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/string_helpers.c b/lib/string_helpers.c index 29c490e..60f9015 100644 --- a/lib/string_helpers.c +++ b/lib/string_helpers.c @@ -576,7 +576,7 @@ char *kstrdup_quotable_cmdline(struct task_struct *task, gfp_t gfp) char *buffer, *quoted; int i, res; - buffer = kmalloc(PAGE_SIZE, GFP_KERNEL); + buffer = kmalloc(PAGE_SIZE, gfp); if (!buffer) return NULL; @@ -612,7 +612,7 @@ char *kstrdup_quotable_file(struct file *file, gfp_t gfp) return kstrdup("", gfp); /* We add 11 spaces for ' (deleted)' to be appended */ - temp = kmalloc(PATH_MAX + 11, GFP_KERNEL); + temp = kmalloc(PATH_MAX + 11, gfp); if (!temp) return kstrdup("", gfp); From patchwork Fri Oct 12 08:56:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sharat Masetty X-Patchwork-Id: 10638117 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 D80FA933 for ; Fri, 12 Oct 2018 08:57:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8B5E2943C for ; Fri, 12 Oct 2018 08:57:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD0842B799; Fri, 12 Oct 2018 08:57:15 +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 6DF582943C for ; Fri, 12 Oct 2018 08:57:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728056AbeJLQ2j (ORCPT ); Fri, 12 Oct 2018 12:28:39 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:42308 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727705AbeJLQ2j (ORCPT ); Fri, 12 Oct 2018 12:28:39 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 71EAB60C60; 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=1539334634; bh=GO0+S6z30lSUSwUQMY2sKlOyUFs9spFis3nQEQajpnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pwwn4iHE2iSJRmwodL5KPWt4n15d7AgMweAIv7GVWO4jwx2mNR3/jt9uyCgZrsSDY wk0q74FGv+DeMBcbq0yV6lq7CUfagQyxE6obIEMlgRafzjHW/ulUKy/w2ifrT7xy/6 Zjq91t5dVGUHcVfegWELUMZZBtcJ5CvXOJijUFvs= 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 2246960C60; Fri, 12 Oct 2018 08:57:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539334634; bh=GO0+S6z30lSUSwUQMY2sKlOyUFs9spFis3nQEQajpnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pwwn4iHE2iSJRmwodL5KPWt4n15d7AgMweAIv7GVWO4jwx2mNR3/jt9uyCgZrsSDY wk0q74FGv+DeMBcbq0yV6lq7CUfagQyxE6obIEMlgRafzjHW/ulUKy/w2ifrT7xy/6 Zjq91t5dVGUHcVfegWELUMZZBtcJ5CvXOJijUFvs= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2246960C60 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 2/3] drm/msm: Check if target supports crash dump capture Date: Fri, 12 Oct 2018 14:26:55 +0530 Message-Id: <1539334616-11723-3-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 This patch simply checks first to see if the target can support crash dump capture before proceeding. Signed-off-by: Sharat Masetty --- drivers/gpu/drm/msm/msm_gpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index 19b4afe..da63d3d 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c @@ -345,6 +345,10 @@ static void msm_gpu_crashstate_capture(struct msm_gpu *gpu, { struct msm_gpu_state *state; + /* Check if the target supports capturing crash state */ + if (!gpu->funcs->gpu_state_get) + return; + /* Only save one crash state at a time */ if (gpu->crashstate) return; 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",