From patchwork Thu Jun 20 22:12:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11008299 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 DEFC176 for ; Thu, 20 Jun 2019 22:12:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE57D288FA for ; Thu, 20 Jun 2019 22:12:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C225828900; Thu, 20 Jun 2019 22:12:59 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 63FD5288FA for ; Thu, 20 Jun 2019 22:12:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ZGvU2vl0MTL1q7suEOcr7mSdalCom3VqQKITGbEkTdk=; b=PSXkZ4OQH5FpmlvcK4DcCp7n51 9t7qCpDIoo0cM8YCb94oidEbTJxLDvedwnPvEae0IKqddje/TqubR1s3K/7A9RbXsIahGv10/I9XK TmC9MdIWlGARbodAbodevUHHb1fcUQnghkcoRcEAjEi9hMv/TCGlLtiGfFy4hDaweHgFe/h46P0JP lY/oti3o1goc2HBtiJrN/0uj3OTyoW3OxtRYFnIqR2GE4NCu6B0ab8o2VTTgvlMD9U7ZqKbDcD9CI D87XlGyztgosBnWzDVM4W3dY/uYa94KflJthjAHZ5Osh8mcPOkUaBXG8tHgcTrfZ5mpwwcf4l5Lte iae8wCyw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1he5Id-0001SJ-LQ; Thu, 20 Jun 2019 22:12:55 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1he5IO-0001HO-H8 for linux-arm-kernel@lists.infradead.org; Thu, 20 Jun 2019 22:12:41 +0000 Received: by mail-pf1-x443.google.com with SMTP id r1so2431411pfq.12 for ; Thu, 20 Jun 2019 15:12:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TxtCjItR/HePUznrVtuNN3cyDKqo7Ma3sG38mJR5jPY=; b=p2o7SvyHXzJWQ+RAwe3uPSeNr9zNV3R6flC88MCD91hiaNf9HPIWR44bpVpv6OgIx/ cfCRwo+msS18BhlphrI5YzW5IMp582lnHlz+1zhlGapJvU5o6Wmt9vh8tqOSJS4pan+P dI5nep22Jq5l1mY0rZqCdsiMQ468Tv+IrXsUPmi6f0pqGrzMyNAEYgppTqPv/VTy58Gr u6own9zL3fqWES0jwkkRY1JCOncvXHuI+lB4uxLxTuOVHYZOhqOxZn7ddQhmgrImRZbc +bPkXyWqeVaI8ywfH4CKch9eZ7TTqTs8SE018jc5E5gNY6EhpPBEnx8yCx2gQIaSk+se 1N1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TxtCjItR/HePUznrVtuNN3cyDKqo7Ma3sG38mJR5jPY=; b=CmT+LXM9fSj6sbDVlXzBMFy06h5AhF0HXb14yg7lc5MhvaTzhP+D8Tcslqn3T0OGdF JU+Uu3Eei37DKt6bejADtfaSYmUaG46NR8Kef87CpH3zZSVQgEr508z0VKV/e7piJlwQ sWLoyJsa+yAgKR7h5uf293IM2oGGsH69S/9hPieEfXQOq6gqkoM0v3XMQAdOy2fQafLr znszi4HQ5wbdfZbdz56OuAhoR8OgD0O1g3bBKW8xTgX681Uce/buMV++htBL43tzAAse Znwsfg0feD5f1HggCb3pHuMR04/LedSgWIqMOyq0b65H4pzeYv7A+Jh654BHB3Wl62nH Attw== X-Gm-Message-State: APjAAAU9bqgRh2ujG95BuBYHx6rFge1MNzztbHMGluL+xfDNN71EGlg9 qUgr+ieNKEWPrpwwjQLbrwSb8Q== X-Google-Smtp-Source: APXvYqyqE+RGdtQXuLwVleMWv0Ep1T9Bivmn5pLdI1JXtRstGEbn7ytg8ImTPheYH4reP7HcJAOUTQ== X-Received: by 2002:a17:90a:2023:: with SMTP id n32mr1846707pjc.3.1561068759939; Thu, 20 Jun 2019 15:12:39 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id x25sm450636pfm.48.2019.06.20.15.12.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 15:12:39 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 1/5] coresight: tmc-etr: Do not call smp_processor_id() from preemptible Date: Thu, 20 Jun 2019 16:12:33 -0600 Message-Id: <20190620221237.3536-2-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190620221237.3536-1-mathieu.poirier@linaro.org> References: <20190620221237.3536-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190620_151240_566469_9F0AFD50 X-CRM114-Status: GOOD ( 14.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose During a perf session we try to allocate buffers on the "node" associated with the CPU the event is bound to. If it's not bound to a CPU, we use the current CPU node, using smp_processor_id(). However this is unsafe in a pre-emptible context and could generate the splats as below : BUG: using smp_processor_id() in preemptible [00000000] code: perf/1743 caller is alloc_etr_buf.isra.6+0x80/0xa0 CPU: 1 PID: 1743 Comm: perf Not tainted 5.1.0-rc6-147786-g116841e #344 Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Feb 1 2019 Call trace: dump_backtrace+0x0/0x150 show_stack+0x14/0x20 dump_stack+0x9c/0xc4 debug_smp_processor_id+0x10c/0x110 alloc_etr_buf.isra.6+0x80/0xa0 tmc_alloc_etr_buffer+0x12c/0x1f0 etm_setup_aux+0x1c4/0x230 rb_alloc_aux+0x1b8/0x2b8 perf_mmap+0x35c/0x478 mmap_region+0x34c/0x4f0 do_mmap+0x2d8/0x418 vm_mmap_pgoff+0xd0/0xf8 ksys_mmap_pgoff+0x88/0xf8 __arm64_sys_mmap+0x28/0x38 el0_svc_handler+0xd8/0x138 el0_svc+0x8/0xc Use NUMA_NO_NODE hint instead of using the current node for events not bound to CPUs. Fixes: 855ab61c16bf70b646 ("coresight: tmc-etr: Refactor function tmc_etr_setup_perf_buf()") Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index df6e4b0b84e9..c6a36897924f 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1317,13 +1317,11 @@ static struct etr_perf_buffer * tmc_etr_setup_perf_buf(struct tmc_drvdata *drvdata, struct perf_event *event, int nr_pages, void **pages, bool snapshot) { - int node, cpu = event->cpu; + int node; struct etr_buf *etr_buf; struct etr_perf_buffer *etr_perf; - if (cpu == -1) - cpu = smp_processor_id(); - node = cpu_to_node(cpu); + node = (event->cpu == -1) ? NUMA_NO_NODE : cpu_to_node(event->cpu); etr_perf = kzalloc_node(sizeof(*etr_perf), GFP_KERNEL, node); if (!etr_perf) From patchwork Thu Jun 20 22:12:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11008301 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 9570D14DB for ; Thu, 20 Jun 2019 22:13:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 854E9288FA for ; Thu, 20 Jun 2019 22:13:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79A4528900; Thu, 20 Jun 2019 22:13:28 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2152F288FA for ; Thu, 20 Jun 2019 22:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=728zgjUbDxnoX91dFIEmnt4BIBEFY1CS76RXNEShq2Y=; b=gehqESnsie1lvmm5lhz0QVh21O loPUkcrdXP3tWAFJmm80wa220oj3ezzMIKpIKU74Eh7i5VMzwZWHVInErvi5PWZy4NAUt5+8frKMX 4ZWuuKqBh1FPdTbqDzc3+3Z+YglRX3kLbKH9qdJ51zAQQVgRhJag/WKIVqcQrLa6rQi735huCPqXf cbIOlLGvbHwwj4FKrGCCJ6kg7YYE3Lyh/xuQxy6dfPn3p0mEje6tm19s/bYPk/lgEZ8YgDmu6hzrJ 2HmOUZu9Xovmo4VRGvss+aLD10SccgWf2ZSw3BCMwJjwnAVrdbrE7/ArDnyvDnc157y/GRmnon8zm YLWOgHBw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1he5J2-0001tm-UQ; Thu, 20 Jun 2019 22:13:20 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1he5IP-0001Hd-A3 for linux-arm-kernel@lists.infradead.org; Thu, 20 Jun 2019 22:12:42 +0000 Received: by mail-pf1-x442.google.com with SMTP id 19so2451487pfa.4 for ; Thu, 20 Jun 2019 15:12:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=j4aNe1rIqaAwjoc7tlrjsp5QRUVkJOX1GccjZR4hNpM=; b=UX0t/idDH0oR6ByW6kbbd9RAUo4jyFHX3vi7xwn6dlWJF9+AJvFr9isLSAsUfBOj7Q yyOyN0fO2vkWtNWcgWv4vQKAM9pxjkj8lECH6sPE4oLSRUkViZEkxttaIZEHZlyrfuj/ IAg100WVXIUm+GyVn1ll6WtkqfSLEu8Z1o/35wnqY7d73XFNGICJwpac7fLcmaIj1tsO q2LuUYzJrymwQzJR8Jr9SlmOxti5M5/55x1D8fQa0gaidyP2xhXhEuMeQH7RtI+HsTnl daVZkAlWrPFmpZVmv5DlFLKFJKmi+WfLj3qW09vTLeC68ofrvu2MpZGGXyO9m1Flgk4a jD7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=j4aNe1rIqaAwjoc7tlrjsp5QRUVkJOX1GccjZR4hNpM=; b=coPu/0Goc+sCf633h+/uJ+mvG8mzSutV+Ez20qs028LkZkqaBRTVVC5rxmXL4wh0Fw QZis7MYKYr82xsx4IFH8qxmkIOPuBTG62uoUc3+OSZOW6b5Q6A7idh1I4uwoKccCBwmp g1KNppo1H8n/0cD4JLm3UjqiCYu2HDXLchpjLSyARF60HZU3ahS/9c8jrsBno/p101Wt VJQw6q5+p19W7XFW5qGd7/vNmSOZsDHhiLeJxOUcrAQrE0xfg0wmYj5TEij6rGMlg8H5 Or4TTiM6/4Iz3SB3vYiI4QH5IghdxDlbdkPNXzgdGnfrdD7nkh3xwCsIYcXH4h35Mo3V vQgw== X-Gm-Message-State: APjAAAVQUOL4Rb5SiV3VqHr7rSezSNNqbSBBQ+mrnE/CwJfRh6VyRR1H VTFe3XJvOKs/ipyUftZjhd/jjQ== X-Google-Smtp-Source: APXvYqydRXocyuNB1pJNnqLzyFVuPhnRH3kKYclIhMwPsq+1zlkiDyax/aKyiWE96e+LK/h4qIvbZw== X-Received: by 2002:a17:90a:23a4:: with SMTP id g33mr1961318pje.115.1561068760699; Thu, 20 Jun 2019 15:12:40 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id x25sm450636pfm.48.2019.06.20.15.12.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 15:12:40 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 2/5] coresight: tmc-etr: alloc_perf_buf: Do not call smp_processor_id from preemptible Date: Thu, 20 Jun 2019 16:12:34 -0600 Message-Id: <20190620221237.3536-3-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190620221237.3536-1-mathieu.poirier@linaro.org> References: <20190620221237.3536-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190620_151241_348725_1C3B10F9 X-CRM114-Status: GOOD ( 14.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose During a perf session we try to allocate buffers on the "node" associated with the CPU the event is bound to. If it is not bound to a CPU, we use the current CPU node, using smp_processor_id(). However this is unsafe in a pre-emptible context and could generate the splats as below : BUG: using smp_processor_id() in preemptible [00000000] code: perf/1743 caller is tmc_alloc_etr_buffer+0x1bc/0x1f0 CPU: 1 PID: 1743 Comm: perf Not tainted 5.1.0-rc6-147786-g116841e #344 Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Feb 1 2019 Call trace: dump_backtrace+0x0/0x150 show_stack+0x14/0x20 dump_stack+0x9c/0xc4 debug_smp_processor_id+0x10c/0x110 tmc_alloc_etr_buffer+0x1bc/0x1f0 etm_setup_aux+0x1c4/0x230 rb_alloc_aux+0x1b8/0x2b8 perf_mmap+0x35c/0x478 mmap_region+0x34c/0x4f0 do_mmap+0x2d8/0x418 vm_mmap_pgoff+0xd0/0xf8 ksys_mmap_pgoff+0x88/0xf8 __arm64_sys_mmap+0x28/0x38 el0_svc_handler+0xd8/0x138 el0_svc+0x8/0xc Use NUMA_NO_NODE hint instead of using the current node for events not bound to CPUs. Fixes: 22f429f19c4135d51e9 ("coresight: etm-perf: Add support for ETR backend") Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose Cc: stable # 4.20+ Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index c6a36897924f..9f293b9dce8c 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1178,14 +1178,11 @@ static struct etr_buf * alloc_etr_buf(struct tmc_drvdata *drvdata, struct perf_event *event, int nr_pages, void **pages, bool snapshot) { - int node, cpu = event->cpu; + int node; struct etr_buf *etr_buf; unsigned long size; - if (cpu == -1) - cpu = smp_processor_id(); - node = cpu_to_node(cpu); - + node = (event->cpu == -1) ? NUMA_NO_NODE : cpu_to_node(event->cpu); /* * Try to match the perf ring buffer size if it is larger * than the size requested via sysfs. From patchwork Thu Jun 20 22:12:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11008303 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 B650076 for ; Thu, 20 Jun 2019 22:13:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A522A288FA for ; Thu, 20 Jun 2019 22:13:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9925828900; Thu, 20 Jun 2019 22:13:35 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0A0D3288FA for ; Thu, 20 Jun 2019 22:13:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=wWWELGJ8rEmg13a7Mol9J7yy1/cu8vsHvLvZodv7FLk=; b=s6aQJ9O/UxZgialOGyeRIrdbuE LUEnbKED9gYNvZb2cxS1f70xtPksS9nm5bgzJR5rUxtgrkmHVdb4VIr6i1YswVLKhHPWOdut77Pra PJh7DrmKl0mvblDJgxIsHJYeXzGYJafv7bKM27HGma9CUhReHhWvbcEDda4vuj7sLu7TbGfUefNzH nqvdzOOI+9RzHu8Z6NBIqhvmmKuS2e94uW2gPg4ccrBL/dwFXl/uU0MIOMnfFYCsEMotn1cafglri 8R+WAZO/LuD4u/QC9Dd/G0L4Yg6Ml/cK9M1J7ccZhPZJLK+IayEQ2v9b35KlJyaXFfcoIWHXqsngu i3iQdVOw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1he5JG-00028w-K2; Thu, 20 Jun 2019 22:13:34 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1he5IR-0001I1-BJ for linux-arm-kernel@lists.infradead.org; Thu, 20 Jun 2019 22:12:44 +0000 Received: by mail-pf1-x441.google.com with SMTP id r1so2431444pfq.12 for ; Thu, 20 Jun 2019 15:12:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9oc8QygCb8ggPn+H3Fd5IukoXHijgHATKhnf6mfsKcY=; b=HU4yFjC/659KEUTmad1K7s/ZNbVutm6aGP6xDevTK3I8nCTMMZnvNGSSe+YdJiHEQ5 AIj/1HjIRPRLU9xv+E+ZaIfI/kE0LroOmhdU84i8O4idm7umHjFJBWgQYgfybXZEQ4mF nmfRBBg+iX7Y37xHY+5LkllZovw478dvVHaZjPQU5yAIvhGBAnjnHXvp2wcoWTiHoxyW XAP4NDAtp3RNV+d4IjYym2Ie+iw1rCK/RzeZAlv98racCme/O8rMIujn/Ibj02Q30Bl2 8NmzzAJS+y/1GSzeCXfBhB7tJnmKWizcZN/An2z5NxhqrZIwVHaJ7wONR7p4hFwtZCc6 VP9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9oc8QygCb8ggPn+H3Fd5IukoXHijgHATKhnf6mfsKcY=; b=PDHUH8FzhkH61w3poqzaqkU7RST7yLlYXi/cn0DYG0zO3vjQpLC68bO4fVL1PaTvWY JE509FkAWt00unvYi1Sq0NW9Eu3YML/lTAL3+mNg9r9n3wPS3X3CLukJxiaRXJX8Kcp3 T8hBC/S36WbB+qe8bBGPuyJcYiDQvlNIY9atbuk7pgo3Gh0/wyfUQ3qaOIfgQjmkdv9U 6bPV2aKwFSQl68U20L2WpaCDLwI751g4ggpBvfPlf6KM4Mc9Rfgkn4qF9Yz01EakqM5m dXjcUrFTiEyW5TD/UyNXyKE9t9Ny+YhdoPFGGU8FvORjc40pZggx/yCCNjiI11JAj6VO a9WQ== X-Gm-Message-State: APjAAAXtqKfU1C2dUApoP4wsfCW9Wek9M9BDVBQG/CZNdBng3+gTfadq H7LDH15T0g1u6YDndHT2pGN5FJCKI84A0w== X-Google-Smtp-Source: APXvYqwCmJaNb6VpTzUCYM2a9OIibNo9Vu5RXGk17EABZL0LDRsZDjTbhvF7jTRXjRMEKyl/Sho4YA== X-Received: by 2002:a17:90a:ad86:: with SMTP id s6mr1972685pjq.42.1561068761578; Thu, 20 Jun 2019 15:12:41 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id x25sm450636pfm.48.2019.06.20.15.12.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 15:12:41 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 3/5] coresight: tmc-etf: Do not call smp_processor_id from preemptible Date: Thu, 20 Jun 2019 16:12:35 -0600 Message-Id: <20190620221237.3536-4-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190620221237.3536-1-mathieu.poirier@linaro.org> References: <20190620221237.3536-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190620_151243_418118_2781210B X-CRM114-Status: GOOD ( 14.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose During a perf session we try to allocate buffers on the "node" associated with the CPU the event is bound to. If it is not bound to a CPU, we use the current CPU node, using smp_processor_id(). However this is unsafe in a pre-emptible context and could generate the splats as below : BUG: using smp_processor_id() in preemptible [00000000] code: perf/2544 caller is tmc_alloc_etf_buffer+0x5c/0x60 CPU: 2 PID: 2544 Comm: perf Not tainted 5.1.0-rc6-147786-g116841e #344 Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Feb 1 2019 Call trace: dump_backtrace+0x0/0x150 show_stack+0x14/0x20 dump_stack+0x9c/0xc4 debug_smp_processor_id+0x10c/0x110 tmc_alloc_etf_buffer+0x5c/0x60 etm_setup_aux+0x1c4/0x230 rb_alloc_aux+0x1b8/0x2b8 perf_mmap+0x35c/0x478 mmap_region+0x34c/0x4f0 do_mmap+0x2d8/0x418 vm_mmap_pgoff+0xd0/0xf8 ksys_mmap_pgoff+0x88/0xf8 __arm64_sys_mmap+0x28/0x38 el0_svc_handler+0xd8/0x138 el0_svc+0x8/0xc Use NUMA_NO_NODE hint instead of using the current node for events not bound to CPUs. Fixes: 2e499bbc1a929ac ("coresight: tmc: implementing TMC-ETF AUX space API") Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose Cc: stable # 4.7+ Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-tmc-etf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index 2527b5d3b65e..8de109de171f 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c @@ -378,12 +378,10 @@ static void *tmc_alloc_etf_buffer(struct coresight_device *csdev, struct perf_event *event, void **pages, int nr_pages, bool overwrite) { - int node, cpu = event->cpu; + int node; struct cs_buffers *buf; - if (cpu == -1) - cpu = smp_processor_id(); - node = cpu_to_node(cpu); + node = (event->cpu == -1) ? NUMA_NO_NODE : cpu_to_node(event->cpu); /* Allocate memory structure for interaction with Perf */ buf = kzalloc_node(sizeof(struct cs_buffers), GFP_KERNEL, node); From patchwork Thu Jun 20 22:12:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11008305 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 C22D976 for ; Thu, 20 Jun 2019 22:13:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0F9D288FA for ; Thu, 20 Jun 2019 22:13:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A52C228900; Thu, 20 Jun 2019 22:13:54 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 42332288FA for ; Thu, 20 Jun 2019 22:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=HaaDCAAfvks+7Zp37eXefps8GGQ25ecSyoTlhph9cm0=; b=SZIzX9qx8Fgxl4npgpdwMhffg/ W2CyCDnFBet4vLjJT0YB3JWxLrPip3zzfTEGhGf5FtdBGby7clmiY5I8q2RN3T4zMlxRYcpYU1BP2 xdxQ0Eu+UkqHaawFGnBqiLxaNNERNVhgk9zoAh9PvK9Gs13b/85+dWTluvUu0S3YaZTrCyIvbKkvx k9j+6HDV/BDlNnor1b9jL8qJPuJjF7LNjDE/2f35wQtzogioHie164sqX9jV1SYI8OXdcRbLws1nZ yacJ1VGKPG/aVvWHtMTMICEJMn/gVA8tUaISWmStsVbzn7uJxNK1xhRnfIUiQR3pOtjSpncMaD3pq ttf8vrdw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1he5JZ-0002Or-3a; Thu, 20 Jun 2019 22:13:53 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1he5IR-0001JR-Sb for linux-arm-kernel@lists.infradead.org; Thu, 20 Jun 2019 22:12:45 +0000 Received: by mail-pg1-x542.google.com with SMTP id m4so1693186pgk.0 for ; Thu, 20 Jun 2019 15:12:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GvxBY/i2ZSlgmLIDUuRnFPPWvrwaxjh9VeMcvUEhcgY=; b=cV/eDn4E8MYKEIrkcvvFpRm8TVvEF8vqvLn/Y4k6iS+aDbLyJZPUoSxQhomCOw5hoK y6mlRCLwZDhHtXC1ibJzKtxHGAMUrjHb+5iHtMf+pzu3RvAm5A/EE8JonuVrTjON/F8t SkibQO2c+Qi1dPt/gyuuR+sUq7D3Qyr9yo0iKpKNSmzOmASDwFh5oamIMZbkHZ9cMxdX mgwDlW3i4iBBhEbDxwD9K4Hk5r3b42z6kO/Lvj8CAQFTClP7yswFWdmDgMgzalC64glm FKBtHjpls9TaeZ2koEdQEESXMU8QDelL/67qo2UexXmROvA4e22zVA5TSCWgrB958AG/ FnFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GvxBY/i2ZSlgmLIDUuRnFPPWvrwaxjh9VeMcvUEhcgY=; b=ZW25NlayPfZ9xE9UejGrvxXxAdA55JEIAvcNBkiBuXP+OkC2mqH7ff8UV4zaIr9TOU ZvIMIo2zI7njC6v/ZL2QXGMvp3KeSWHnaokEeQsWyY86FM/kzRmSs/HoiHtWcd6tapXh oQWYkxMXTqoeDU6CR3nx7zY12msgZQ+7Lhqh/oBFKCnUPeARzJGIA02fT3pvM2CM+ivu W7Io2CTzm56k9glu8rMS9GN4gtdbBpv+oMxCSWgkjYFA4gSBgEFL6tM+Bk/1JKqWXE8t XlNhW5d8goClQG0Auwri0mqGsLRbH3VgXJdEg2sEJysOqA/rvopKaA2GTr8EaeRnP6CA kZ9g== X-Gm-Message-State: APjAAAUIGlSs235/eoWpvoLkytKc9ldi0VAfqC9doHQdaP8+O7gg4VvK 1po+wTxBlOdXW1UpnPAxdtlSsg== X-Google-Smtp-Source: APXvYqwAxSA8AZHnt57NqT+imeYSD5/BwWekfsP51A0bj5TjA/F+MKaS12yobEF2ZUlS6HxiqqFzbQ== X-Received: by 2002:a62:e403:: with SMTP id r3mr98800176pfh.37.1561068762487; Thu, 20 Jun 2019 15:12:42 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id x25sm450636pfm.48.2019.06.20.15.12.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 15:12:41 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 4/5] coresight: etb10: Do not call smp_processor_id from preemptible Date: Thu, 20 Jun 2019 16:12:36 -0600 Message-Id: <20190620221237.3536-5-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190620221237.3536-1-mathieu.poirier@linaro.org> References: <20190620221237.3536-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190620_151243_974944_4779D214 X-CRM114-Status: GOOD ( 13.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose During a perf session we try to allocate buffers on the "node" associated with the CPU the event is bound to. If it is not bound to a CPU, we use the current CPU node, using smp_processor_id(). However this is unsafe in a pre-emptible context and could generate the splats as below : BUG: using smp_processor_id() in preemptible [00000000] code: perf/2544 Use NUMA_NO_NODE hint instead of using the current node for events not bound to CPUs. Fixes: 2997aa4063d97fdb39 ("coresight: etb10: implementing AUX API") Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose Cc: stable # 4.6+ Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etb10.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 4ee4c80a4354..543cc3d36e1d 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -373,12 +373,10 @@ static void *etb_alloc_buffer(struct coresight_device *csdev, struct perf_event *event, void **pages, int nr_pages, bool overwrite) { - int node, cpu = event->cpu; + int node; struct cs_buffers *buf; - if (cpu == -1) - cpu = smp_processor_id(); - node = cpu_to_node(cpu); + node = (event->cpu == -1) ? NUMA_NO_NODE : cpu_to_node(event->cpu); buf = kzalloc_node(sizeof(struct cs_buffers), GFP_KERNEL, node); if (!buf) From patchwork Thu Jun 20 22:12:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11008309 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 B44C276 for ; Thu, 20 Jun 2019 22:14:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A45A2288FA for ; Thu, 20 Jun 2019 22:14:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98D1228900; Thu, 20 Jun 2019 22:14:08 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4E607288FA for ; Thu, 20 Jun 2019 22:14:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=fmG1+7DlPifeCB6dY+OcT42IV0YdYeTiR2lVCr03k1A=; b=ePynD2P3tQZ++UN+eq/VT2Tbp/ zWbcCmOaVmbfZ3hwIfAsxW2ibK4Y6bZcoiN7LkstPznhOTd4ZNsW93jvbd8b9U4kMBXBoC79y0Bkk wWqXQfLfkBnhY/nGh4Mf3ATZM3Y7KvyFZTrn3sGDHO21Im5OY3XaMBwUq0jhPfK5fXSKHX7OObOWx 422O11UJOReh1GdQFr2gQvRo+hSnGSs5vtolRdgLXy7hUrx/hfFsoUrQpMCZHWKGFUWApDLXvjIn0 B/GB0XJafrIOqKKyeuBl+1JnxeKLlNgMJhaAI8iihQ693ujbWsu1aWqGGEoPOahaoaFGEtyzSY7zU BkIhY5cQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1he5Jn-0002gs-Pi; Thu, 20 Jun 2019 22:14:07 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1he5IY-0001PA-BV for linux-arm-kernel@lists.infradead.org; Thu, 20 Jun 2019 22:12:51 +0000 Received: by mail-pg1-x541.google.com with SMTP id m4so1693301pgk.0 for ; Thu, 20 Jun 2019 15:12:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8MyASeb2pq1GJMfZxC7yx2+Bj3AJzIxnxH61a4huhDc=; b=XrN3HU9izdd2Sp+S3438jh8C2VSDKv7g0b3Mqmwoir/dPFn7Miu1I0sUirGMWc5eMm dxhV3RJtWXAOrBiw/+ggiqgb0yx25zlSfSIiVUpC/PydlbuX8Q/QTSVO87qTGUBOttxk Gm9vcsZT5umuozCGcGuj0422PivlfEEbuY354gRosgVBQWqH+X3NjCKCb1WmGgNrBB0J WXrA3W8ann+Jq1QuZImPORxWUKD4tncngVYQKQ0bdgLKZ+FVnNddlQID++yF1VFvvF0h J+H1vcOcCO6uNr6qEl8PDzWqxbzMJs3FVOvf7UiKGte5ztcQyaHDBYOA1yE4iEOET7O3 17nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8MyASeb2pq1GJMfZxC7yx2+Bj3AJzIxnxH61a4huhDc=; b=uZqd3P6TknUJR8Wxrfw+5gXpm70nip5nN+35uTvKh4K6nAXLx7EuL5AOEt5/zEGu2Z z28+rJsJ2U2JpjH9pFbn5GqMhCb5U53eyslgL1oAUEI0FKOzDDoe+fcg/IG/oN6y44Ty bI3WBx6l2L1laH1jCZE123jl1a6EZ+yT1LlySEXEUR+z6jY7FRxbEwCl7OcoI9eWyR+n hC7ebqC1kQdNp//KDCBcU0icue9oEpI+RMaUEU4/5XZkcPcxX6GWO9rAlh2pfs4kEUBu vk6700CaiHkHaQsdlF2wnjRdhaMpGJEZWhQwMsUntjzVj6ISzUme9XtF2fjxokvoqBDz rcPg== X-Gm-Message-State: APjAAAXMALcwUt+qcjEN/CPXmCcP5Qno2Ui4DvQyqGzeNP3pYrhW/FsO 7EI0PuAdt7tr/JktPWJ5dzQ0PA== X-Google-Smtp-Source: APXvYqxxSDzac9zXrBTJvjPo1TwxzRO4032QR4BB6l/8YhaZ65OcHnnp+rf15FhLYkj3elOV3/55HA== X-Received: by 2002:aa7:8106:: with SMTP id b6mr60711746pfi.5.1561068764781; Thu, 20 Jun 2019 15:12:44 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id x25sm450636pfm.48.2019.06.20.15.12.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 15:12:42 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 5/5] coresight: Potential uninitialized variable in probe() Date: Thu, 20 Jun 2019 16:12:37 -0600 Message-Id: <20190620221237.3536-6-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190620221237.3536-1-mathieu.poirier@linaro.org> References: <20190620221237.3536-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190620_151250_436522_53156DA5 X-CRM114-Status: GOOD ( 12.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dan Carpenter The "drvdata->atclk" clock is optional, but if it gets set to an error pointer then we're accidentally return an uninitialized variable instead of success. Fixes: 78e6427b4e7b ("coresight: funnel: Support static funnel") Signed-off-by: Dan Carpenter Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-funnel.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c index 16b0c0e1e43a..ad6e16c96263 100644 --- a/drivers/hwtracing/coresight/coresight-funnel.c +++ b/drivers/hwtracing/coresight/coresight-funnel.c @@ -241,6 +241,7 @@ static int funnel_probe(struct device *dev, struct resource *res) } pm_runtime_put(dev); + ret = 0; out_disable_clk: if (ret && !IS_ERR_OR_NULL(drvdata->atclk))