From patchwork Fri Apr 3 12:18:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228204 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED5EEC2BA16 for ; Fri, 3 Apr 2020 12:18:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C391620857 for ; Fri, 3 Apr 2020 12:18:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="l81xwjYj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403879AbgDCMSa (ORCPT ); Fri, 3 Apr 2020 08:18:30 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:44891 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403880AbgDCMSa (ORCPT ); Fri, 3 Apr 2020 08:18:30 -0400 Received: by mail-wr1-f68.google.com with SMTP id m17so8224654wrw.11 for ; Fri, 03 Apr 2020 05:18:27 -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 :mime-version:content-transfer-encoding; bh=j0HDrtJ40KGmrEyhgHoOvV9sWkXPbMSoXXYHiNuzqAk=; b=l81xwjYjI2QueesoBZZ3DFadQQMAwkXjqGhYZn41UPl7x8uO/smq1qtz+udltxKzeR B7Zf58VxRHtBBBcwulnBqivYQy6GwInU98IZeGsqwMSW0PdTkw4+z39oHgYK6rc9ncU/ Ur4kuyi5GEgypU9diO+1VaP4aSNa1BuhOui0ZJ49K7wRpLHZFDQ5pfNrFRteuZRWTLwA 5t44k2V0wqvIcW+YKsS0oOEKKo0zgE6FqlzlB4c2E7DyhjsrC7dp+G6F9Thms2vGVcqj V0J0WsnzhOzxmor2CfL38CMPH/zpXsuffT4rI99gIDYTkhvQ0OSmq6u5Lj0O3+NPWcOf Uaug== 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:mime-version:content-transfer-encoding; bh=j0HDrtJ40KGmrEyhgHoOvV9sWkXPbMSoXXYHiNuzqAk=; b=NoZ4vqF+DjPhr0LLgkFLc9P5cZ2lqoSOHKqSdRnhri2gwZZE4bxK/f8pOd1I5uispB 2gwsOpf9BaitjwkPuAv0hS98D2Tr6r4Z5Mz0iGm75h6M+hiyp6PFbUmZHjKgeam1bn42 DMLu3w+VTmbGRm1VQOUhZc7Ryp57PVgsGPXYGKbP1BNKslrU50/NbtUCEbsaTIPofATr 3mEA0AwJ5Vq6D7JkVt1UhnVQnpuAi6P1doKRW2g4ArTgLYMvb9fuTDlrjPFW8bDdXZgv ulf7FCsdHogNEjkEdh23zPuv6hfYwp4qptgB06Sr40gF8ORau1TTeXX8YXxj1U6b17Zf Ka1A== X-Gm-Message-State: AGi0PuZxB1RPF8NK5nAoLB+UI9FvtajNbD1+vpANdrDecdnKReHi5Z6r Y3i+Vbo4XIG75IGJ2rRajetuivlQlz8= X-Google-Smtp-Source: APiQypL9PURqKI+7TJOmPdLEiZaidxWE9VMh2Z482i1QvR5phW8GA3kv7+ypbtb+TmaITjSaWxL9tA== X-Received: by 2002:a5d:4081:: with SMTP id o1mr9064608wrp.114.1585916306312; Fri, 03 Apr 2020 05:18:26 -0700 (PDT) Received: from localhost.localdomain ([2.27.35.179]) by smtp.gmail.com with ESMTPSA id l185sm11377712wml.44.2020.04.03.05.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 05:18:25 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Cc: Taniya Das , Stephen Boyd , Lee Jones Subject: [PATCH 4.19 01/13] clk: qcom: rcg: Return failure for RCG update Date: Fri, 3 Apr 2020 13:18:47 +0100 Message-Id: <20200403121859.901838-2-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200403121859.901838-1-lee.jones@linaro.org> References: <20200403121859.901838-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Taniya Das [ Upstream commit 21ea4b62e1f3dc258001a68da98c9663a9dbd6c7 ] In case of update config failure, return -EBUSY, so that consumers could handle the failure gracefully. Signed-off-by: Taniya Das Link: https://lkml.kernel.org/r/1557339895-21952-2-git-send-email-tdas@codeaurora.org Signed-off-by: Stephen Boyd Signed-off-by: Lee Jones --- drivers/clk/qcom/clk-rcg2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c index ee693e15d9ebc..f420f0c968775 100644 --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c @@ -105,7 +105,7 @@ static int update_config(struct clk_rcg2 *rcg) } WARN(1, "%s: rcg didn't update its configuration.", name); - return 0; + return -EBUSY; } static int clk_rcg2_set_parent(struct clk_hw *hw, u8 index) From patchwork Fri Apr 3 12:18:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228205 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 312C7C43331 for ; Fri, 3 Apr 2020 12:18:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0892B20737 for ; Fri, 3 Apr 2020 12:18:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UBLkL6O0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403911AbgDCMS3 (ORCPT ); Fri, 3 Apr 2020 08:18:29 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:46820 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727989AbgDCMS3 (ORCPT ); Fri, 3 Apr 2020 08:18:29 -0400 Received: by mail-wr1-f66.google.com with SMTP id j17so8185621wru.13 for ; Fri, 03 Apr 2020 05:18:28 -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 :mime-version:content-transfer-encoding; bh=DnkAuvHhRnj2l3DQmuWpIsKhX/U8TBhWcn7YJvtGsoE=; b=UBLkL6O0tH0woYHbbRUx0q4gII4caoWxObZvsTK47w1ng4/svVWSudHWpe0+wE3CYR 48iKuMlscs71LtSXM36AVG7JLw66JYsbVRPXas1YbVmC4F9DxROrdGsAZ7RygdYKdwmA l3V3W6BvbZOJ0rZJzxneLzYTdZyAR7s2/CA5ELqhtG6eMFF7Ij87nN3BBC5aWjNAtePJ Kt/ufqmfwe7mg+AHgpv0PQhwh3qFy0zqlDLTUzcfE26W2gJf8LWaWhYIJFGQXxrbxtjE rF4VSBNniUiIaF38IQaRQ3TxqUfxBtIpBhiLiCGPQAK2ptk67Zm6DeiiHgagJGpnQusD cK9w== 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:mime-version:content-transfer-encoding; bh=DnkAuvHhRnj2l3DQmuWpIsKhX/U8TBhWcn7YJvtGsoE=; b=aq0QzPzc/L+o5ASracxsQJDz+PepjYH2vASRAj/Eu6FCdA4ugnO7i6sXnT9tl0Fz3H PNUzkOnZ31NelEvceJsqlXje7n834uC+e9+kxR+gTL5MsoAakuVQyCH3MuBJiQuEPq+H xnBaSJ7/D0lsJcRChGnWsi+q+RIxQEglS1T0lRnRMFQJTnz3Mo+9efoMQpgJ2qeQ/gCA dKXtpinanhCObatL0a2N22zcgtYSz2kyYUqKnsXlgReru70A0eWZOpmbdtac+hchizI9 fTT4Hw24mdccCQpyLUd4DplPRZGSrTW6FPtMOC4AhYaY/mNxn7YRxjgsHw8pMQMcZgFL 1/7g== X-Gm-Message-State: AGi0PuYqM5U48cEEERqvzJVquVcNluL3cLZPusOLrmUa9GOYKlWC5UAs fbXNrvcyuohmmUHadWdRpsmcMTqhZhQ= X-Google-Smtp-Source: APiQypKndvT9XG1baSwqubuIcRbQ6CBOnMR7hbJNU26FDoRqVt5b3bq5KqFsOUzkXomFcyYRyJjWCQ== X-Received: by 2002:a5d:51cf:: with SMTP id n15mr8210570wrv.195.1585916307467; Fri, 03 Apr 2020 05:18:27 -0700 (PDT) Received: from localhost.localdomain ([2.27.35.179]) by smtp.gmail.com with ESMTPSA id l185sm11377712wml.44.2020.04.03.05.18.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 05:18:26 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Cc: Rob Clark , Stephen Boyd , Stephen Boyd , Jordan Crouse , Sean Paul , Lee Jones Subject: [PATCH 4.19 02/13] drm/msm: stop abusing dma_map/unmap for cache Date: Fri, 3 Apr 2020 13:18:48 +0100 Message-Id: <20200403121859.901838-3-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200403121859.901838-1-lee.jones@linaro.org> References: <20200403121859.901838-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Rob Clark [ Upstream commit 0036bc73ccbe7e600a3468bf8e8879b122252274 ] Recently splats like this started showing up: WARNING: CPU: 4 PID: 251 at drivers/iommu/dma-iommu.c:451 __iommu_dma_unmap+0xb8/0xc0 Modules linked in: ath10k_snoc ath10k_core fuse msm ath mac80211 uvcvideo cfg80211 videobuf2_vmalloc videobuf2_memops vide CPU: 4 PID: 251 Comm: kworker/u16:4 Tainted: G W 5.2.0-rc5-next-20190619+ #2317 Hardware name: LENOVO 81JL/LNVNB161216, BIOS 9UCN23WW(V1.06) 10/25/2018 Workqueue: msm msm_gem_free_work [msm] pstate: 80c00005 (Nzcv daif +PAN +UAO) pc : __iommu_dma_unmap+0xb8/0xc0 lr : __iommu_dma_unmap+0x54/0xc0 sp : ffff0000119abce0 x29: ffff0000119abce0 x28: 0000000000000000 x27: ffff8001f9946648 x26: ffff8001ec271068 x25: 0000000000000000 x24: ffff8001ea3580a8 x23: ffff8001f95ba010 x22: ffff80018e83ba88 x21: ffff8001e548f000 x20: fffffffffffff000 x19: 0000000000001000 x18: 00000000c00001fe x17: 0000000000000000 x16: 0000000000000000 x15: ffff000015b70068 x14: 0000000000000005 x13: 0003142cc1be1768 x12: 0000000000000001 x11: ffff8001f6de9100 x10: 0000000000000009 x9 : ffff000015b78000 x8 : 0000000000000000 x7 : 0000000000000001 x6 : fffffffffffff000 x5 : 0000000000000fff x4 : ffff00001065dbc8 x3 : 000000000000000d x2 : 0000000000001000 x1 : fffffffffffff000 x0 : 0000000000000000 Call trace: __iommu_dma_unmap+0xb8/0xc0 iommu_dma_unmap_sg+0x98/0xb8 put_pages+0x5c/0xf0 [msm] msm_gem_free_work+0x10c/0x150 [msm] process_one_work+0x1e0/0x330 worker_thread+0x40/0x438 kthread+0x12c/0x130 ret_from_fork+0x10/0x18 ---[ end trace afc0dc5ab81a06bf ]--- Not quite sure what triggered that, but we really shouldn't be abusing dma_{map,unmap}_sg() for cache maint. Cc: Stephen Boyd Tested-by: Stephen Boyd Reviewed-by: Jordan Crouse Signed-off-by: Rob Clark Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20190630124735.27786-1-robdclark@gmail.com Signed-off-by: Lee Jones --- drivers/gpu/drm/msm/msm_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index f59ca27a4a357..93b20ad23c23f 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c @@ -108,7 +108,7 @@ static struct page **get_pages(struct drm_gem_object *obj) * because display controller, GPU, etc. are not coherent: */ if (msm_obj->flags & (MSM_BO_WC|MSM_BO_UNCACHED)) - dma_map_sg(dev->dev, msm_obj->sgt->sgl, + dma_sync_sg_for_device(dev->dev, msm_obj->sgt->sgl, msm_obj->sgt->nents, DMA_BIDIRECTIONAL); } @@ -138,7 +138,7 @@ static void put_pages(struct drm_gem_object *obj) * GPU, etc. are not coherent: */ if (msm_obj->flags & (MSM_BO_WC|MSM_BO_UNCACHED)) - dma_unmap_sg(obj->dev->dev, msm_obj->sgt->sgl, + dma_sync_sg_for_cpu(obj->dev->dev, msm_obj->sgt->sgl, msm_obj->sgt->nents, DMA_BIDIRECTIONAL); From patchwork Fri Apr 3 12:18:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228203 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D294C43331 for ; Fri, 3 Apr 2020 12:18:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0056E2073B for ; Fri, 3 Apr 2020 12:18:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="i3iz78tT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403905AbgDCMSc (ORCPT ); Fri, 3 Apr 2020 08:18:32 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:51790 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403845AbgDCMSc (ORCPT ); Fri, 3 Apr 2020 08:18:32 -0400 Received: by mail-wm1-f65.google.com with SMTP id z7so6912055wmk.1 for ; Fri, 03 Apr 2020 05:18:31 -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 :mime-version:content-transfer-encoding; bh=u/8Oj2Ff4RNeFgOmfCdgYmb1Rv0nrDRFoL1TCNAUQ/o=; b=i3iz78tTwa0Wav771yX03ihSbuNrM6FG6B+vB0rxlPDllYV+JstD3gJT/+Pm3+71uL 7Li1DT2vsk8cmQZa49lcafqtSr4Nydl2KAiVpOSvYKQmtfYf+hJ5GwIEzioi9QZxax14 aqLdLtKRRHlmyeYXqePfFmXx7puf9IuD4oJ1IIceUMjJkDbtJLk+J6EoMqZegoH5wDUT cIWGhJkoWdqeLyyuOomSPeTdgtjmHZpum1gZZcqc4FjEIUWHTCERKUEDmQX063fiCIba 0iDjeHKCvqUAkZ5e0arAmHpRfmBYdPTzK1i4TGgNX0tf/XZ6EAJEe/JgYLmgk12QFAGA yCug== 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:mime-version:content-transfer-encoding; bh=u/8Oj2Ff4RNeFgOmfCdgYmb1Rv0nrDRFoL1TCNAUQ/o=; b=m8WpIkAKKpWu/lz7/8qZuwaLBMJyhxYq2gBkjvcm6YqnMWxhQKBjBmtJdd8C/7uo+4 jRL36GqgubWy0Ti598A7p0SygletQrsvBfhPuFFLIFm2XebPxpx+7gSaPLIXGp3YKhIf 7RIvPgMoGiOGS+0StpYK2fzq3PxwdHM1aEAzVnBS9J5JIuIeZGT5BDxoPTPfMECNUmns smbllA8q3kRg61o18A7zEgql7G2dMoKSFs9g1pFiSUAu9cIWoRR/NUbHbUzDlmprP+NP 4oMI4PLQ+DHsr8jLuP2klkLHYalrbh98zLB4YHSG2ktDE0/F1YlKR1ZpV+Koa6ZFqkIv QdvA== X-Gm-Message-State: AGi0PuaQ/uqWu9aaHSIG4lKgXZtft70XOUUINvqEXcVoe4mylmF3n+tZ nhnttkSux9IZcGuRIANYcZ+cdnVpWDE= X-Google-Smtp-Source: APiQypL4+uloNWonzduk1wcqQesUTmfyQBMoFt5g0QDZDN0kMXiIdp0qBR2bYyeEaQnHcUY0rWYC6A== X-Received: by 2002:a7b:c004:: with SMTP id c4mr8228923wmb.108.1585916310196; Fri, 03 Apr 2020 05:18:30 -0700 (PDT) Received: from localhost.localdomain ([2.27.35.179]) by smtp.gmail.com with ESMTPSA id l185sm11377712wml.44.2020.04.03.05.18.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 05:18:29 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Cc: Dedy Lansky , Maya Erez , Kalle Valo , Lee Jones Subject: [PATCH 4.19 05/13] wil6210: check rx_buff_mgmt before accessing it Date: Fri, 3 Apr 2020 13:18:51 +0100 Message-Id: <20200403121859.901838-6-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200403121859.901838-1-lee.jones@linaro.org> References: <20200403121859.901838-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dedy Lansky [ Upstream commit d6a553c0c61b0b0219764e4d4fc14e385085f374 ] Make sure rx_buff_mgmt is initialized before accessing it. Signed-off-by: Dedy Lansky Signed-off-by: Maya Erez Signed-off-by: Kalle Valo Signed-off-by: Lee Jones --- drivers/net/wireless/ath/wil6210/txrx_edma.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/ath/wil6210/txrx_edma.c b/drivers/net/wireless/ath/wil6210/txrx_edma.c index 5fa8d6ad66482..03d0e6c550b98 100644 --- a/drivers/net/wireless/ath/wil6210/txrx_edma.c +++ b/drivers/net/wireless/ath/wil6210/txrx_edma.c @@ -268,6 +268,9 @@ static void wil_move_all_rx_buff_to_free_list(struct wil6210_priv *wil, struct list_head *active = &wil->rx_buff_mgmt.active; dma_addr_t pa; + if (!wil->rx_buff_mgmt.buff_arr) + return; + while (!list_empty(active)) { struct wil_rx_buff *rx_buff = list_first_entry(active, struct wil_rx_buff, list); From patchwork Fri Apr 3 12:18:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228201 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0654C2D0E8 for ; Fri, 3 Apr 2020 12:18:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 869A420737 for ; Fri, 3 Apr 2020 12:18:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="zy6PUgdi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403904AbgDCMSg (ORCPT ); Fri, 3 Apr 2020 08:18:36 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:39008 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403912AbgDCMSf (ORCPT ); Fri, 3 Apr 2020 08:18:35 -0400 Received: by mail-wm1-f65.google.com with SMTP id e9so7455736wme.4 for ; Fri, 03 Apr 2020 05:18:32 -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 :mime-version:content-transfer-encoding; bh=rizpshgRSVswJNtjW2UZ/pm8CNXM39+z2QpqQR8eHr8=; b=zy6PUgdiW27LUHIvvtmZQIoOr1E7bQ431qighQH04lqY+1ww5gv5l691mERZx7cO44 C50dMOqm5V3moueQcvalZop4ISDjToL9Ul7OeDk1UPh/tGNK6c43q/DDXSqpykjGvd/9 TWXsWhMzXq47uhY4tB+KkmqVIT4t8M08hfzHsi6XaR/UXLtAWZpGOX3ufAe1f8TEv41p D76p/kYkgcbVDTQdMsjW9wGNHF/9sOZVAfu/n7vbItS+ublm2Q21s6uhCl3ZjSCXPeyw jQn7eiqEDnwsxsydCDUSI4RoMPIIjV2bETcLGtbDFHRDeK6tvh7hH+OBq61XmiJhYqnL Tngg== 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:mime-version:content-transfer-encoding; bh=rizpshgRSVswJNtjW2UZ/pm8CNXM39+z2QpqQR8eHr8=; b=IQabgYfGnoOfnxiVF2Xq7m6NCJtMPNxiAw8DTJMiF8D28Q2a74w+GJf6KN/SpVJ6uR 5LaDiUldv6zPLSQhQz/GVjGiADOTHN2uKrDOZr+BdV33jpW0GwNxCYMzdY8F+eQYNUYy LTkB8SkRoxj0Xjr8WRTEqt56Q7kuq+SfgV4L/NA4JALcHdg/N/P4qMfifTXR3fACvcdV mSaTTVbPnyH6Z4T1MYoOYzuxOaO2XMOb+gOr6b/GkSrCYaywrPXHB4hocxaxeck7I07M cSaM5YfEkQIeqWsQZ8J8IxGbUU8SivrDdIAknJUvhqrqN5Bavln18imezJk/GNlWuPGp woWA== X-Gm-Message-State: AGi0PuZJS3l+9Z6LfTKuJYoKlR0uqf7c8otAKaCOJM2xjwir0TWsADAe QT8oSI+Ovut0OxV0d+EeDHBuY8uqlWQ= X-Google-Smtp-Source: APiQypIWiOrmKspD4fGPUs54NvOGOflYCfbgYv2wMgeva7Kxt/hlobCUyfAWn/951LmtM8K8ACbb6A== X-Received: by 2002:a1c:9e42:: with SMTP id h63mr8002568wme.115.1585916311997; Fri, 03 Apr 2020 05:18:31 -0700 (PDT) Received: from localhost.localdomain ([2.27.35.179]) by smtp.gmail.com with ESMTPSA id l185sm11377712wml.44.2020.04.03.05.18.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 05:18:31 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Cc: Alexei Avshalom Lazar , Maya Erez , Kalle Valo , Lee Jones Subject: [PATCH 4.19 07/13] wil6210: add general initialization/size checks Date: Fri, 3 Apr 2020 13:18:53 +0100 Message-Id: <20200403121859.901838-8-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200403121859.901838-1-lee.jones@linaro.org> References: <20200403121859.901838-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Alexei Avshalom Lazar [ Upstream commit ac0e541ab2f2951845acee784ef487be40fb4c77 ] Initialize unset variable, and verify that mid is valid. Signed-off-by: Alexei Avshalom Lazar Signed-off-by: Maya Erez Signed-off-by: Kalle Valo Signed-off-by: Lee Jones --- drivers/net/wireless/ath/wil6210/debugfs.c | 2 ++ drivers/net/wireless/ath/wil6210/wmi.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index 44296c0159252..acd95ca0430b9 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -991,6 +991,8 @@ static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf, int rc; void *frame; + memset(¶ms, 0, sizeof(params)); + if (!len) return -EINVAL; diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c index 8a603432f5317..3928b13ae0266 100644 --- a/drivers/net/wireless/ath/wil6210/wmi.c +++ b/drivers/net/wireless/ath/wil6210/wmi.c @@ -2802,7 +2802,7 @@ static void wmi_event_handle(struct wil6210_priv *wil, if (mid == MID_BROADCAST) mid = 0; - if (mid >= wil->max_vifs) { + if (mid >= ARRAY_SIZE(wil->vifs) || mid >= wil->max_vifs) { wil_dbg_wmi(wil, "invalid mid %d, event skipped\n", mid); return; From patchwork Fri Apr 3 12:18:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228202 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6643FC2BA16 for ; Fri, 3 Apr 2020 12:18:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3DD002073B for ; Fri, 3 Apr 2020 12:18:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="sXjwfjhQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403923AbgDCMSf (ORCPT ); Fri, 3 Apr 2020 08:18:35 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:35198 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403904AbgDCMSf (ORCPT ); Fri, 3 Apr 2020 08:18:35 -0400 Received: by mail-wm1-f67.google.com with SMTP id i19so7484097wmb.0 for ; Fri, 03 Apr 2020 05:18:33 -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 :mime-version:content-transfer-encoding; bh=KIUT4HYy0VYSBkUgZ0BGRDLGJkL+uEuLOcNGteqvCdo=; b=sXjwfjhQj9dG12zL5en/AwwNv/kSjJGkOX7iUPHBn70jW1117vEjuxrzhyxTDsdbAa 0iJBU6DREjFFI9z6A9fIrlujMUiM6rQsV0kEdlKOYsDqy//fc8N3Hwht80tEPVrvMB3a 5/Cuxe9OpkhA9Pywj1N5JirJMVdwTo7BkJQz8k3z7NsJcbxbzlQlkaM8wxPu055bSG9V s5teKo6WdODrbnAOSAoO3dwC1evka+qXrj8WwZK8qGYf5mktLNut7Tgifjd4sUZi9GBP KWL4HmnXdNvnjgHAWuzzI3cZ/M4LmHRbz1X5izdtV8YmQbIE2NTNYnU0zBrhwYN5OOgl qTCg== 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:mime-version:content-transfer-encoding; bh=KIUT4HYy0VYSBkUgZ0BGRDLGJkL+uEuLOcNGteqvCdo=; b=F78ravbtGg6MJI7gE71XhGIwQ1u/uOXibpxO2cqGvrdoVwRteCG+H24jH20QLZraH4 NPs2E4/glLDSv6BCL5xjpHOknA6M24GmtktEa6SGyOV3iH6tpeTBcc/vghqI6g4H1usI hMoGx8r9erDWqRdfJiHxUnb4CmkkB5h67KiUmY7Y1/wWq0iOqbaE74bDDlUGtKEiI9vu YjfVnXgyk7Ul0qfzPX9wsONhrdffBZ3427bFhnRDBBDddPVmfpmAecR8NfOunsb5ggeS G/CBjGFltsXyK5z/5HUGoLOYGWIubB++9INt2UY1PAveD2kKvau8FhKt7Fm4QQQA2uK0 RkGQ== X-Gm-Message-State: AGi0PuYNfqeE4PfWaATolkMyM/FHVYXI7HcrryfIgP8D+LmL10i6AtpI viSBiMOsKoHgclDzQ0fSiIXZZbVwLNw= X-Google-Smtp-Source: APiQypI++d+cSHtIbJ3pIJNgmZEYo0VLx5RAtWRzWCBIMubUpMNneQj98QENR90GlmPeqkPqesEYnA== X-Received: by 2002:a1c:3bc4:: with SMTP id i187mr6021083wma.189.1585916312884; Fri, 03 Apr 2020 05:18:32 -0700 (PDT) Received: from localhost.localdomain ([2.27.35.179]) by smtp.gmail.com with ESMTPSA id l185sm11377712wml.44.2020.04.03.05.18.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 05:18:32 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Cc: Dedy Lansky , Maya Erez , Kalle Valo , Lee Jones Subject: [PATCH 4.19 08/13] wil6210: make sure Rx ring sizes are correlated Date: Fri, 3 Apr 2020 13:18:54 +0100 Message-Id: <20200403121859.901838-9-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200403121859.901838-1-lee.jones@linaro.org> References: <20200403121859.901838-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dedy Lansky [ Upstream commit 61e5ec044748486f06dec760a19dce78247b3ad8 ] When enlarging rx_ring_order module param, wil6210 fails to load because there are not enough Rx buffers. Fix this by enlarging number of Rx buffers at startup, if needed based on rx_ring_order. Signed-off-by: Dedy Lansky Signed-off-by: Maya Erez Signed-off-by: Kalle Valo Signed-off-by: Lee Jones --- drivers/net/wireless/ath/wil6210/main.c | 2 +- drivers/net/wireless/ath/wil6210/txrx.c | 4 ++-- drivers/net/wireless/ath/wil6210/txrx_edma.c | 11 ++++++++--- drivers/net/wireless/ath/wil6210/wil6210.h | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c index 28d2bfd0fde79..fe91db3478dc8 100644 --- a/drivers/net/wireless/ath/wil6210/main.c +++ b/drivers/net/wireless/ath/wil6210/main.c @@ -1687,7 +1687,7 @@ int __wil_up(struct wil6210_priv *wil) return rc; /* Rx RING. After MAC and beacon */ - rc = wil->txrx_ops.rx_init(wil, 1 << rx_ring_order); + rc = wil->txrx_ops.rx_init(wil, rx_ring_order); if (rc) return rc; diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c index 73cdf54521f9b..236dcb6f5e84d 100644 --- a/drivers/net/wireless/ath/wil6210/txrx.c +++ b/drivers/net/wireless/ath/wil6210/txrx.c @@ -881,7 +881,7 @@ static void wil_rx_buf_len_init(struct wil6210_priv *wil) } } -static int wil_rx_init(struct wil6210_priv *wil, u16 size) +static int wil_rx_init(struct wil6210_priv *wil, uint order) { struct wil_ring *vring = &wil->ring_rx; int rc; @@ -895,7 +895,7 @@ static int wil_rx_init(struct wil6210_priv *wil, u16 size) wil_rx_buf_len_init(wil); - vring->size = size; + vring->size = 1 << order; vring->is_rx = true; rc = wil_vring_alloc(wil, vring); if (rc) diff --git a/drivers/net/wireless/ath/wil6210/txrx_edma.c b/drivers/net/wireless/ath/wil6210/txrx_edma.c index 03d0e6c550b98..fe666a3583c10 100644 --- a/drivers/net/wireless/ath/wil6210/txrx_edma.c +++ b/drivers/net/wireless/ath/wil6210/txrx_edma.c @@ -593,9 +593,9 @@ static void wil_rx_buf_len_init_edma(struct wil6210_priv *wil) WIL_MAX_ETH_MTU : WIL_EDMA_RX_BUF_LEN_DEFAULT; } -static int wil_rx_init_edma(struct wil6210_priv *wil, u16 desc_ring_size) +static int wil_rx_init_edma(struct wil6210_priv *wil, uint desc_ring_order) { - u16 status_ring_size; + u16 status_ring_size, desc_ring_size = 1 << desc_ring_order; struct wil_ring *ring = &wil->ring_rx; int rc; size_t elem_size = wil->use_compressed_rx_status ? @@ -610,7 +610,12 @@ static int wil_rx_init_edma(struct wil6210_priv *wil, u16 desc_ring_size) "compressed RX status cannot be used with SW reorder\n"); return -EINVAL; } - + if (wil->rx_status_ring_order <= desc_ring_order) + /* make sure sring is larger than desc ring */ + wil->rx_status_ring_order = desc_ring_order + 1; + if (wil->rx_buff_id_count <= desc_ring_size) + /* make sure we will not run out of buff_ids */ + wil->rx_buff_id_count = desc_ring_size + 512; if (wil->rx_status_ring_order < WIL_SRING_SIZE_ORDER_MIN || wil->rx_status_ring_order > WIL_SRING_SIZE_ORDER_MAX) wil->rx_status_ring_order = WIL_RX_SRING_SIZE_ORDER_DEFAULT; diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h index 6a05f59ee58e9..bc89044d0b66e 100644 --- a/drivers/net/wireless/ath/wil6210/wil6210.h +++ b/drivers/net/wireless/ath/wil6210/wil6210.h @@ -602,7 +602,7 @@ struct wil_txrx_ops { struct wil_ring *ring, struct sk_buff *skb); irqreturn_t (*irq_tx)(int irq, void *cookie); /* RX ops */ - int (*rx_init)(struct wil6210_priv *wil, u16 ring_size); + int (*rx_init)(struct wil6210_priv *wil, uint ring_order); void (*rx_fini)(struct wil6210_priv *wil); int (*wmi_addba_rx_resp)(struct wil6210_priv *wil, u8 mid, u8 cid, u8 tid, u8 token, u16 status, bool amsdu, From patchwork Fri Apr 3 12:18:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228200 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D311AC2D0E8 for ; Fri, 3 Apr 2020 12:18:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A680E20737 for ; Fri, 3 Apr 2020 12:18:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="veyEAL64" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403927AbgDCMSj (ORCPT ); Fri, 3 Apr 2020 08:18:39 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:37331 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403845AbgDCMSj (ORCPT ); Fri, 3 Apr 2020 08:18:39 -0400 Received: by mail-wm1-f65.google.com with SMTP id j19so7458710wmi.2 for ; Fri, 03 Apr 2020 05:18:36 -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 :mime-version:content-transfer-encoding; bh=bQSVQUznH72WQBKL04U2uoQruvsVD6tJ6h7LJtSHrIo=; b=veyEAL64v91MslbK3AzClUmpLp/IS7ZozZ7HttjdXClrfNCOQ+KPVn1qLN+uoPBXYZ RSoGJKiVkecLcr5XA41lWf9ee+V9X6mzGeGa4IV7od252JuaRa347p7XquxlOjRTKGRM Z5VKnJssWBT/3IrsPddG+0fOuEBXerSUxfq01ktfoDg9Fy2tuJmKEJjkWuT2kmW5Wr2A YCWiySyUxCZ+HUfD77utoYsElyD/KdVbCAxHlMWx4vKv9vMAcU9/3KejwFlXy4b+Xm8Y Hwj8LxVhW8uhUNFhlcxKGf0g4EQR7jGSvqBkbR4PTaAgLuogFdTjqV3R7FW17FCn8vMI xhrw== 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:mime-version:content-transfer-encoding; bh=bQSVQUznH72WQBKL04U2uoQruvsVD6tJ6h7LJtSHrIo=; b=FREEIBNl/GlWjyzbSFIaUZm8t78C8ZVTCOnm1x9zd2IObY+DSWTmUAIO2F5Spxxya3 TLUMXN8hd5Z3YDBZwtRkSgA+ArDF0s6iVKHPiyRUit3x/Aty20wA7ImnH4Qi1izJ9LUn NlyWMoW98EQoyY3MgSc1OkY7x7FS7fUZSPsBk03fUA+nEnjsPjQ60MEZxiHDN8BC/cy8 k8DC7sdmIDVBGaPfFVGvGHuMokgrUt97EUwjgc9EZqv/48LG1JMg+EWYSiPmg39RtP3v Lc8eilO/CEYGivnI0gmCdi92ukMuDsbANHMEb0QrqKllWTvRRfPz/JEhzzNGvewLp9QL vIjA== X-Gm-Message-State: AGi0PubgRgxIrdZdn8g1ZjScFzm39Py2bDwBFTR6i+Oam2omgPmNjGyI IuEg9ATIVIGcB6dVS5PcMWWUYYsE2Os= X-Google-Smtp-Source: APiQypJRlcCY8V+WXHTfo+nsBY2mr74pmMDeBm0twCW/WbyEFSLdXZPCyPIKdDrtQC2DdKZzBbLH5Q== X-Received: by 2002:a1c:9ecb:: with SMTP id h194mr8858496wme.49.1585916315934; Fri, 03 Apr 2020 05:18:35 -0700 (PDT) Received: from localhost.localdomain ([2.27.35.179]) by smtp.gmail.com with ESMTPSA id l185sm11377712wml.44.2020.04.03.05.18.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 05:18:35 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Cc: Alexander Shishkin , Peter Zijlstra , Arnaldo Carvalho de Melo , David Ahern , Jiri Olsa , Linus Torvalds , Mark Rutland , Namhyung Kim , Stephane Eranian , Thomas Gleixner , Vince Weaver , Ingo Molnar , Lee Jones Subject: [PATCH 4.19 11/13] perf/core: Reattach a misplaced comment Date: Fri, 3 Apr 2020 13:18:57 +0100 Message-Id: <20200403121859.901838-12-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200403121859.901838-1-lee.jones@linaro.org> References: <20200403121859.901838-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Alexander Shishkin [ Upstream commit f25d8ba9e1b204b90fbf55970ea6e68955006068 ] A comment is in a wrong place in perf_event_create_kernel_counter(). Fix that. Signed-off-by: Alexander Shishkin Signed-off-by: Peter Zijlstra (Intel) Cc: Arnaldo Carvalho de Melo Cc: David Ahern Cc: Jiri Olsa Cc: Linus Torvalds Cc: Mark Rutland Cc: Namhyung Kim Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Vince Weaver Link: https://lkml.kernel.org/r/20191030134731.5437-2-alexander.shishkin@linux.intel.com Signed-off-by: Ingo Molnar Signed-off-by: Lee Jones --- kernel/events/core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 8c70ee23fbe91..16f268475e8e4 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -10954,10 +10954,6 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu, struct perf_event *event; int err; - /* - * Get the target context (task or percpu): - */ - event = perf_event_alloc(attr, cpu, task, NULL, NULL, overflow_handler, context, -1); if (IS_ERR(event)) { @@ -10968,6 +10964,9 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu, /* Mark owner so we could distinguish it from user events. */ event->owner = TASK_TOMBSTONE; + /* + * Get the target context (task or percpu): + */ ctx = find_get_context(event->pmu, task, event); if (IS_ERR(ctx)) { err = PTR_ERR(ctx); From patchwork Fri Apr 3 12:18:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228199 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E219EC2BA16 for ; Fri, 3 Apr 2020 12:18:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B93CE20737 for ; Fri, 3 Apr 2020 12:18:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="IexUxYQ7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403925AbgDCMSl (ORCPT ); Fri, 3 Apr 2020 08:18:41 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:41629 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403845AbgDCMSl (ORCPT ); Fri, 3 Apr 2020 08:18:41 -0400 Received: by mail-wr1-f65.google.com with SMTP id h9so8269290wrc.8 for ; Fri, 03 Apr 2020 05:18:38 -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 :mime-version:content-transfer-encoding; bh=T0ZLg9OVS5LPGUTR/MUK1s5R+uH5HTAX/aXfIPj67qI=; b=IexUxYQ7c8xFrTydW85NdnXLWhhva5JKcJOMEWEL2ZsemAmu1t+7V8q2P4ELTebUf0 zivoyMoTZNTUKkfJhcKodhgNHS/kqwxW4MH3qcP1fpdSTf3PWPog2RM4W5sKfzWfgdP/ VfFblxbGUTCe1I5TBjDR2LnzC9UtGQ/gmui1WjzoxRG+YGs6IJetzAb5VZ+vk7of+vj3 1Lw36kVxKNucOp104TXneTq3cQTLYjvnRHeA1TYT5BU35A86UCsFRXIIofYEINvGM3VC wtrTNZjdhBXsmy6+RV/0hYiKweZ6f6msgsUq8c252v35h8CZWXs0PigAgrwpczPVNVFA 99Ag== 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:mime-version:content-transfer-encoding; bh=T0ZLg9OVS5LPGUTR/MUK1s5R+uH5HTAX/aXfIPj67qI=; b=chLZ1OCGtvkSSTAhzZkQ7MykY5CTuQZOPeT9dkvfOACH6tyjlYPbUmprCFhEw22kFz sg8Ed5Ijno4VOpqyZWcPLw7734u6Base+S9Uzkj9pu1XHgTPU7k0qXmi6hZZfb2a0F4W yXerPEYUWWg/EGVfDUVEHh62biwdLvv14BgwP1ysW7QH66e/Gdt0mYX83OsH9myyi4d1 huwkQwtZx/GH2mzWDqrD3dHf35bVG54lbemstGkTahSmJGYXz+IghfdsZzdLuF2DxhMj sLIhBmVBCVrSgvLvMyhKrCnkIPkQr3T2j2QVJ1gPVFQZMOPenMHmRzfwkmLCKcSfkYCr 4pTg== X-Gm-Message-State: AGi0PubeSLVF9mTc9lXDq6kZHbBFOraoA0Pd5ySQzZgymHg3xzi/IWl9 Phl+x1LM1cXC0TwuS5icZoEPOyVar4U= X-Google-Smtp-Source: APiQypIfjRf03/lfA11+je8fRM4mopXftP+iRrE030Urzvdh+fTk8SQM56gLkzjNd1+TDZ1Ojxx6Bw== X-Received: by 2002:adf:ead1:: with SMTP id o17mr8827025wrn.14.1585916317227; Fri, 03 Apr 2020 05:18:37 -0700 (PDT) Received: from localhost.localdomain ([2.27.35.179]) by smtp.gmail.com with ESMTPSA id l185sm11377712wml.44.2020.04.03.05.18.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 05:18:36 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Cc: Austin Kim , Michal Hocko , Andrew Morton , Uladzislau Rezki , Roman Gushchin , Roman Penyaev , Rick Edgecombe , Mike Rapoport , Andrey Ryabinin , Linus Torvalds , Lee Jones Subject: [PATCH 4.19 12/13] mm/vmalloc.c: move 'area->pages' after if statement Date: Fri, 3 Apr 2020 13:18:58 +0100 Message-Id: <20200403121859.901838-13-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200403121859.901838-1-lee.jones@linaro.org> References: <20200403121859.901838-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Austin Kim [ Upstream commit 7ea362427c170061b8822dd41bafaa72b3bcb9ad ] If !area->pages statement is true where memory allocation fails, area is freed. In this case 'area->pages = pages' should not executed. So move 'area->pages = pages' after if statement. [akpm@linux-foundation.org: give area->pages the same treatment] Link: http://lkml.kernel.org/r/20190830035716.GA190684@LGEARND20B15 Signed-off-by: Austin Kim Acked-by: Michal Hocko Reviewed-by: Andrew Morton Cc: Uladzislau Rezki (Sony) Cc: Roman Gushchin Cc: Roman Penyaev Cc: Rick Edgecombe Cc: Mike Rapoport Cc: Andrey Ryabinin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Lee Jones --- mm/vmalloc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 958d6ba9ee2d1..be65161f97531 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1668,7 +1668,6 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, nr_pages = get_vm_area_size(area) >> PAGE_SHIFT; array_size = (nr_pages * sizeof(struct page *)); - area->nr_pages = nr_pages; /* Please note that the recursion is strictly bounded. */ if (array_size > PAGE_SIZE) { pages = __vmalloc_node(array_size, 1, nested_gfp|highmem_mask, @@ -1676,13 +1675,16 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, } else { pages = kmalloc_node(array_size, nested_gfp, node); } - area->pages = pages; - if (!area->pages) { + + if (!pages) { remove_vm_area(area->addr); kfree(area); return NULL; } + area->pages = pages; + area->nr_pages = nr_pages; + for (i = 0; i < area->nr_pages; i++) { struct page *page;