From patchwork Sun Dec 29 17:18:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 182534 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp5440473ild; Sun, 29 Dec 2019 09:22:30 -0800 (PST) X-Google-Smtp-Source: APXvYqwlefBjDhETI/KXkZil8KJDZOeP+irQQPDsYn2KukDJIvmNoBuHYcqD2rIpRTV3Dxx1MzJX X-Received: by 2002:a9d:3e16:: with SMTP id a22mr71666283otd.259.1577640149988; Sun, 29 Dec 2019 09:22:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577640149; cv=none; d=google.com; s=arc-20160816; b=C6Kp8YFDYkqtwv5bbk1LXVEAp4K+LuvS/AxW6lM1WRgLtz0otNqTyQMSZ1ptBjwNnR vtNB+NlrLP1mcQKYwPDMEqlZTcBEQssWBs4Z0mVuDi3RoqMDH2CTXV5GdoPv6fHXw4qW IX4/i+HXrsEDLZZg92hHDzR/t5qfstaHOKJNQ2dqcGmjnmiVhdGKdAXzHf5inkRJGm4N DxHKIXk83zjAhqO3ge+2LFATXsnHMj3VRzOMz4s/UaN7udFS5GWPWkYAZWcTHt6GfQKw qdxy5Ti5R7qtPzl85/LcJ42+NxoS8BUHvLkU/G7w6pw/nGxtPli1K0I/2ApFERHCcRQG CY1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t+J3DT39q2p3KUkkXb4LSFexUVleer7xLkwdWgBUym4=; b=VufG50PaRQ9+kyUta8SGwRxzP35R/FLD4HDi68UTzxmldTxd80H/AacHFlW1HuHLbO Sl8kalvuyICwSVSHt8MvUwNpvSh0QLa9FGQ0JZKrbSaa8Jw/KdNPXlW2N6yT7lLZ4rS1 HEFJNYd6G46VjbrVpXwSWeXi+jo3zjsNsiXChryYtC42coL3evnNM92SuhPQ7UqiPtkD Q9ZtZWwJ9UUZkAPtjlrrhSAaNwNI0WFvIriM5/6Rh5TNsTDW2b9mC8kF0GZps7dMF9Bj OOjrn27QFoFVeMvsAVluxayCebTmZjIahI0CBry9E2U2537a78M2dTpMiamIa31ekGvU zy9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iV2HjVGP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x24si20494157oto.255.2019.12.29.09.22.29; Sun, 29 Dec 2019 09:22:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iV2HjVGP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727318AbfL2RW2 (ORCPT + 27 others); Sun, 29 Dec 2019 12:22:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:38816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726658AbfL2RW0 (ORCPT ); Sun, 29 Dec 2019 12:22:26 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6EF58207FD; Sun, 29 Dec 2019 17:22:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640145; bh=0Gybm7l43eGqhyVETCvyuH6F8el7S/oOIAMXjqiNJeo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iV2HjVGP3706P2remmRbykcY1JKKEkU4BC9AWCluDziwGMTckCRWbzP2NeHJEPdk/ Y4kZLCAUXo6Pbm3xASM84NX0Yl1AHcQCr7EQg5BpURcgF/O+fAhK/T43/lPQWn1cGM R95QkPvP7uL/0jp63GWq18v1jsRjUmOSCdBlB/Q4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Loic Poulain , Stanimir Varbanov , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.14 036/161] media: venus: core: Fix msm8996 frequency table Date: Sun, 29 Dec 2019 18:18:04 +0100 Message-Id: <20191229162410.186246630@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162355.500086350@linuxfoundation.org> References: <20191229162355.500086350@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Loic Poulain [ Upstream commit c690435ed07901737e5c007a65ec59f53b33eb71 ] In downstream driver, there are two frequency tables defined, one for the encoder and one for the decoder: /* Encoders / <972000 490000000 0x55555555>, / 4k UHD @ 30 / <489600 320000000 0x55555555>, / 1080p @ 60 / <244800 150000000 0x55555555>, / 1080p @ 30 / <108000 75000000 0x55555555>, / 720p @ 30 */ /* Decoders / <1944000 490000000 0xffffffff>, / 4k UHD @ 60 / < 972000 320000000 0xffffffff>, / 4k UHD @ 30 / < 489600 150000000 0xffffffff>, / 1080p @ 60 / < 244800 75000000 0xffffffff>; / 1080p @ 30 */ It shows that encoder always needs a higher clock than decoder. In current venus driver, the unified frequency table is aligned with the downstream decoder table which causes performance issues in encoding scenarios. Fix that by aligning frequency table on worst case (encoding). Signed-off-by: Loic Poulain Signed-off-by: Stanimir Varbanov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/qcom/venus/core.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 769e9e68562d..9360b36b82cd 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -345,10 +345,11 @@ static const struct venus_resources msm8916_res = { }; static const struct freq_tbl msm8996_freq_table[] = { - { 1944000, 490000000 }, /* 4k UHD @ 60 */ - { 972000, 320000000 }, /* 4k UHD @ 30 */ - { 489600, 150000000 }, /* 1080p @ 60 */ - { 244800, 75000000 }, /* 1080p @ 30 */ + { 1944000, 520000000 }, /* 4k UHD @ 60 (decode only) */ + { 972000, 520000000 }, /* 4k UHD @ 30 */ + { 489600, 346666667 }, /* 1080p @ 60 */ + { 244800, 150000000 }, /* 1080p @ 30 */ + { 108000, 75000000 }, /* 720p @ 30 */ }; static const struct reg_val msm8996_reg_preset[] = { From patchwork Sun Dec 29 17:18:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 182535 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp5440880ild; Sun, 29 Dec 2019 09:22:55 -0800 (PST) X-Google-Smtp-Source: APXvYqzlLhBtyujbhyIBYFq1swX8EtP5VpDAbkVDn6JFMrRFg+FgxcnPsVM3fE5gatdBmh4Oqh+Y X-Received: by 2002:a05:6830:1ecf:: with SMTP id c15mr26599922otj.65.1577640175085; Sun, 29 Dec 2019 09:22:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577640175; cv=none; d=google.com; s=arc-20160816; b=rjWd4qAMziEdclIm00LTKKe13IrCIqp2ML0Vt1ZgpgDE7nhkEQZN6MIIKaJ/kJwo+C blaYSjmdwE8G3ac//9345y++Ny52J/qKgtKASbiawAnFaCwMUMzjSAB79ZcsiJqXZH8/ RawYyjGVsfEAKTdY+D9PZcqNT1a7OESfsSM4MQjANCiOihVs8DXcnPhujKrKUfVygQ6e //+mhwsGKjCOB88puMFlve9nPThhO3veyz7zF/MPTIfxhciNLJBgtMQA9tIUKFordlLd MDbgy5TJoyRghVeckjCSMaSlni4k8krS2I0+w2gf2AGQRp5eHGSKZjPjzFJOfyNkZr4n Ycmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=svlolREnYgtRDtaBzvyr9Uz3A9hDfvINopZcnyLjRQ0=; b=mOgiFyaEnQw5k4lNEQI98QpQAuyc1Qd3UNoRxDFjcz7V27EKMqwj8WH8ndocMrI1uk P3trmO5g6wSPJJyif9+oo9hjkDRCj4s5eGWAUDIG0gZGClyqREzc0wAEbQcRJ2AojwX2 LwTlvj+x2ZZAMMkzJrypOYR2hbXQRLdZG5r8rLX80nehrhJIF4azROJMqHffQp6XBwJo Zbk5TVp197DScpHqBVPE3waySijPDNDrlmWQQMcIW5An5sKUut47xRTgdvuww3QEH3Sq XslOypDOU3v118qSEBK/pl34nNzyjPE9XMWkqfjcsew8wQfYQxmphp9pZwDUqiT8E8Xx YfXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Lnw4DO42; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 44si22044263otu.77.2019.12.29.09.22.54; Sun, 29 Dec 2019 09:22:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Lnw4DO42; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727444AbfL2RWx (ORCPT + 27 others); Sun, 29 Dec 2019 12:22:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:39616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727416AbfL2RWs (ORCPT ); Sun, 29 Dec 2019 12:22:48 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B4ED7207FD; Sun, 29 Dec 2019 17:22:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640168; bh=cGJoQaBLeDWQxSAkGHpykO2M28PK5xPPF5XrwpBF+GI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lnw4DO42JVya9yN+hiyk5AaFQQd47UZHS1GM0iJMGH37nolRpoL4SP4REm7bl9LhF XuPTCrMudCbvdYNgWHPmYiJiD2OlElzxLYZpX33c237jYDCWFuQgQ3uVyhBlSq8oFy NiH7Jrb5nqXUTIhoD7lROwRdtAImCSDnKWtg+teI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ivan Khoronzhuk , Daniel Borkmann , Song Liu , Sasha Levin Subject: [PATCH 4.14 039/161] selftests/bpf: Correct path to include msg + path Date: Sun, 29 Dec 2019 18:18:07 +0100 Message-Id: <20191229162411.621058361@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162355.500086350@linuxfoundation.org> References: <20191229162355.500086350@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ivan Khoronzhuk [ Upstream commit c588146378962786ddeec817f7736a53298a7b01 ] The "path" buf is supposed to contain path + printf msg up to 24 bytes. It will be cut anyway, but compiler generates truncation warns like: " samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c: In function ‘setup_cgroup_environment’: samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c:52:34: warning: ‘/cgroup.controllers’ directive output may be truncated writing 19 bytes into a region of size between 1 and 4097 [-Wformat-truncation=] snprintf(path, sizeof(path), "%s/cgroup.controllers", cgroup_path); ^~~~~~~~~~~~~~~~~~~ samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c:52:2: note: ‘snprintf’ output between 20 and 4116 bytes into a destination of size 4097 snprintf(path, sizeof(path), "%s/cgroup.controllers", cgroup_path); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c:72:34: warning: ‘/cgroup.subtree_control’ directive output may be truncated writing 23 bytes into a region of size between 1 and 4097 [-Wformat-truncation=] snprintf(path, sizeof(path), "%s/cgroup.subtree_control", ^~~~~~~~~~~~~~~~~~~~~~~ cgroup_path); samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c:72:2: note: ‘snprintf’ output between 24 and 4120 bytes into a destination of size 4097 snprintf(path, sizeof(path), "%s/cgroup.subtree_control", cgroup_path); " In order to avoid warns, lets decrease buf size for cgroup workdir on 24 bytes with assumption to include also "/cgroup.subtree_control" to the address. The cut will never happen anyway. Signed-off-by: Ivan Khoronzhuk Signed-off-by: Daniel Borkmann Acked-by: Song Liu Link: https://lore.kernel.org/bpf/20191002120404.26962-3-ivan.khoronzhuk@linaro.org Signed-off-by: Sasha Levin --- samples/bpf/cgroup_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 diff --git a/samples/bpf/cgroup_helpers.c b/samples/bpf/cgroup_helpers.c index 09afaddfc9ba..b5c09cd6c7bd 100644 --- a/samples/bpf/cgroup_helpers.c +++ b/samples/bpf/cgroup_helpers.c @@ -43,7 +43,7 @@ */ int setup_cgroup_environment(void) { - char cgroup_workdir[PATH_MAX + 1]; + char cgroup_workdir[PATH_MAX - 24]; format_cgroup_path(cgroup_workdir, ""); From patchwork Sun Dec 29 17:18:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 182579 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp5486715ild; Sun, 29 Dec 2019 10:17:07 -0800 (PST) X-Google-Smtp-Source: APXvYqzSSHpgVNRIPwdJ5GUHyILp+N/hMOSvnIsoQVm2yt09qOkhHkrGntAXet8+eh/Fhh7nfRp2 X-Received: by 2002:a9d:730e:: with SMTP id e14mr65982272otk.62.1577643427382; Sun, 29 Dec 2019 10:17:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577643427; cv=none; d=google.com; s=arc-20160816; b=bH+Rsxi4b/8NmIhGX1tdBbo46OaKWxnltFdE5Dl5f+yXUYpQw19yGfj0WsBB6e5Kni ibxR14qwJj2yBxfZYTBBdihK8nSpMAmbI50sTs6pNPlY369PDg8QmGSJIYlXj3+8aq+R OK0+07yz6PvVvxW7akjSKOYkw2os2ki22J6oS8yZDdD9hvbGyOiA6UK4Lrm+zibo4Qtl tFVchFMs2JAWMNG2TF3WACWaFJQEvZjG0cSwSWTJyrWsz+srvBp5hRNhfrNuKP1tu8je nPSLB/vEHwFsQRx6epq9NiDjE5+uvw2n1lL/wBV+vyKQsnlgjXOzIV0z9u0OzRw7Dj5T J8fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IEH/fFxNML3oJnvKFwX0j2E50OjpHfSw2OxR/9TNL3A=; b=gDXuP06rI3V94NwRFxqb/ZWkqHO95VPAQk50GpGSDQnwsrl4ipcwpzL6WXlSkFvR2F TXCReu8GaTOoft3WtG7/fHlFIyP0wnENM/yR7htMFtiRoQ22aODKWMgcnOnxXqrorvme ZxvT1VYXDIC5Xx4d+9ZPMekdVTGZZ8qDBPwcKvdCETn0kYU3RMq8IDzDwFbLsk61JQID aM1YMADKoZZ7eaNDY47OHJlZMWrh9s76ZU8C4RHpB6WvP+2cSc6zzxQsjv01cHs1LjJj 5uRPYuh4gfFgQWzr+TeROLMvNv2YePDpT4I2iZho0ed/7oQZNVRMQrF88MsPichsRQFI Gkmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bqpfgQzU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l2si18364836oti.303.2019.12.29.10.17.07; Sun, 29 Dec 2019 10:17:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bqpfgQzU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727215AbfL2RX1 (ORCPT + 27 others); Sun, 29 Dec 2019 12:23:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:40886 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727523AbfL2RXX (ORCPT ); Sun, 29 Dec 2019 12:23:23 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D818B207FF; Sun, 29 Dec 2019 17:23:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640202; bh=j/zL3L0ZTW9/R0p1OEI97exdIz+cMlX2FZgmmFNH1Rg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bqpfgQzUE9UKsvkj2WhCPpeGSnfxkLzZdrBv/R50/vOQCZtHUWlMM6BEJv310Ien8 6ktfklrzb8I7TDKX1MB16FBCNYP3SqqJLfdZDugDrT+Ih2zWk/y5qjAYasY+KJy/wl kkfurYvjZDlPYslk49jReD3U/4z52UabvPUoQ2mU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leo Yan , Alexander Shishkin , Jiri Olsa , Mark Rutland , Namhyung Kim , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 4.14 060/161] perf test: Report failure for mmap events Date: Sun, 29 Dec 2019 18:18:28 +0100 Message-Id: <20191229162417.653410127@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162355.500086350@linuxfoundation.org> References: <20191229162355.500086350@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leo Yan [ Upstream commit 6add129c5d9210ada25217abc130df0b7096ee02 ] When fail to mmap events in task exit case, it misses to set 'err' to -1; thus the testing will not report failure for it. This patch sets 'err' to -1 when fails to mmap events, thus Perf tool can report correct result. Fixes: d723a55096b8 ("perf test: Add test case for checking number of EXIT events") Signed-off-by: Leo Yan Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Link: http://lore.kernel.org/lkml/20191011091942.29841-1-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/tests/task-exit.c | 1 + 1 file changed, 1 insertion(+) -- 2.20.1 diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c index 89c8e1604ca7..94fe5464bc6f 100644 --- a/tools/perf/tests/task-exit.c +++ b/tools/perf/tests/task-exit.c @@ -104,6 +104,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused if (perf_evlist__mmap(evlist, 128, true) < 0) { pr_debug("failed to mmap events: %d (%s)\n", errno, str_error_r(errno, sbuf, sizeof(sbuf))); + err = -1; goto out_delete_evlist; } From patchwork Sun Dec 29 17:18:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 182578 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp5486382ild; Sun, 29 Dec 2019 10:16:47 -0800 (PST) X-Google-Smtp-Source: APXvYqz8uYZUawB88zkJeyLp3mV4UpyTazZZLlRcflkS2KnZlAzCU1BNgs3p1rvWs/msKYCR/J9B X-Received: by 2002:a9d:7f16:: with SMTP id j22mr68017251otq.256.1577643407737; Sun, 29 Dec 2019 10:16:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577643407; cv=none; d=google.com; s=arc-20160816; b=Bm8qxKYussuPmamlh1eTnUz3JoJRpvV8r0xlqx9kFgsIwzX9k5KPNNpm0EU1cQ40KV ZPdP7IyVYptSIQHJPQGoja9itzF/yUt//2A+0TDkeiJsPqgvABtIcAVNxxgCeftN6vUG os35w62BUADbVuLoLoTMjjRuw8v+zurjjE0Sp/35amK6zGiOFkw/DGtRv+MmIWD0WSPE Iz0X/hIl/feTAVnN6KRjTHXmS7i3fIowlCU4BwcsvfiJSgJ9bqSZeEyMkPHI/kG1KBhF OseLa4wyzAiND+/c0irRXq1mjxSNp3SCpoOj8voxX1N9BF3KD4yBa0pSdmYy9ng8FaUQ nnhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gCNRiCymMNV7c8osL+CrXJF63IEG2UbmO5Biujddaq8=; b=rCvWNquXzXC/BwITUcLNVKx39Boo6ynUld6skPH7RxMtFDSRsJTY0VyI24IWYJsTQ4 ZLWh4FAPTBtvcVkvJwe6Elv0yVN1b4c/evJcqlRqSVrNPtFde1rX3mUnW78xMXFb/EIT 5VRWPZxVo203VMToBHnRmT+91sGQEfjigTDsrnU+VdCpUj0arfBWH8Z2svmKWxn3Xcu9 VS6pJ2W5p7KylpMD1rhGpMYa7kZdd74r+1+OyI36gGgh8TvDP3s1lZmLdcxa5vadLxSn qIRtdWG27PIBEqoOFuzSsxpd2ZmYmNuVDMoOruJSYCVauL2m1KnPnl5qgz2epbrLAsPQ cIRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RcxM5a5x; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v6si21677206ota.19.2019.12.29.10.16.47; Sun, 29 Dec 2019 10:16:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RcxM5a5x; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727640AbfL2RX7 (ORCPT + 27 others); Sun, 29 Dec 2019 12:23:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:41956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727268AbfL2RXw (ORCPT ); Sun, 29 Dec 2019 12:23:52 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BDE9F20CC7; Sun, 29 Dec 2019 17:23:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640231; bh=nie5E4wN1HIpMmq7neBcmQuVrAMzR5DezXZ/OIavkYc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RcxM5a5xvzgy5RwlznouQhrzm5lu8Nu+lBLlCSHd7eE1DOH8CZIzVP8nTA9KxmGf5 +a5qVv4DBQXLm+VWxQMp0FVeUZ1Uf+9e20g7akBA1p70nl+dpNzF7yMcH+oD8iRS9D c0vqvmn/XsL6LIXvgEffTsjTwXlNti+torsks4DI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Grygorii Strashko , Andrew Lunn , Florian Fainelli , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 071/161] net: phy: dp83867: enable robust auto-mdix Date: Sun, 29 Dec 2019 18:18:39 +0100 Message-Id: <20191229162421.660580953@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162355.500086350@linuxfoundation.org> References: <20191229162355.500086350@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Grygorii Strashko [ Upstream commit 5a7f08c2abb0efc9d17aff2fc75d6d3b85e622e4 ] The link detection timeouts can be observed (or link might not be detected at all) when dp83867 PHY is configured in manual mode (speed/duplex). CFG3[9] Robust Auto-MDIX option allows to significantly improve link detection in case dp83867 is configured in manual mode and reduce link detection time. As per DM: "If link partners are configured to operational modes that are not supported by normal Auto MDI/MDIX mode (like Auto-Neg versus Force 100Base-TX or Force 100Base-TX versus Force 100Base-TX), this Robust Auto MDI/MDIX mode allows MDI/MDIX resolution and prevents deadlock." Hence, enable this option by default as there are no known reasons not to do so. Signed-off-by: Grygorii Strashko Reviewed-by: Andrew Lunn Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/phy/dp83867.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) -- 2.20.1 diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c index e03e91d5f1b1..0cbcced0870e 100644 --- a/drivers/net/phy/dp83867.c +++ b/drivers/net/phy/dp83867.c @@ -84,6 +84,10 @@ #define DP83867_IO_MUX_CFG_IO_IMPEDANCE_MAX 0x0 #define DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN 0x1f +/* CFG3 bits */ +#define DP83867_CFG3_INT_OE BIT(7) +#define DP83867_CFG3_ROBUST_AUTO_MDIX BIT(9) + /* CFG4 bits */ #define DP83867_CFG4_PORT_MIRROR_EN BIT(0) @@ -320,12 +324,13 @@ static int dp83867_config_init(struct phy_device *phydev) return ret; } + val = phy_read(phydev, DP83867_CFG3); /* Enable Interrupt output INT_OE in CFG3 register */ - if (phy_interrupt_is_valid(phydev)) { - val = phy_read(phydev, DP83867_CFG3); - val |= BIT(7); - phy_write(phydev, DP83867_CFG3, val); - } + if (phy_interrupt_is_valid(phydev)) + val |= DP83867_CFG3_INT_OE; + + val |= DP83867_CFG3_ROBUST_AUTO_MDIX; + phy_write(phydev, DP83867_CFG3, val); if (dp83867->port_mirroring != DP83867_PORT_MIRROING_KEEP) dp83867_config_port_mirroring(phydev); From patchwork Sun Dec 29 17:18:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 182577 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp5486187ild; Sun, 29 Dec 2019 10:16:35 -0800 (PST) X-Google-Smtp-Source: APXvYqxhIhMixwPmJEDSPPunV/j/jP3h4r4x4z+UpVKsYQnadplUMJKODndn7KPE0uRjmEbQqsYT X-Received: by 2002:a9d:6f85:: with SMTP id h5mr69982517otq.19.1577643395881; Sun, 29 Dec 2019 10:16:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577643395; cv=none; d=google.com; s=arc-20160816; b=yjQDnOATPcpcTc5ZXMpBg9/q92/ZR9BbncdRDz9tmnu/AouJwI1dT8pER+wQOtLbhz tA4UidIWhmvAfeFkDW9Q6lZxq23Squiu2qKJvq79FFTDC+5DDspJ2fZxa8xIc871oQhc i0aWKjucKeaUrdK49m0NX3II102AWrHwRdQkNMKdogeIQtpiICseqQYm4VX6IR814E9J XsOpWRH/atcVBKa2klGTmqWTT+SRo4ZC1MdWp+xhakpF6QvwmZxz6gkOY+NEzqcnUezn YGQSZq0Q5GlF70SE9OVfpwKS0mjdxOUNGSYsJKfk34zM1c/5XnxgGm/ajgt93wg9bEJH 05cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5DwwcB3bIZPgHJnqaAzJOhApBbMTj3W+NAQtSdE09PY=; b=JWF08Rny9BemGarPrB0i/Nju57vPkVKPFShrlFasWKFWzRDbnEPy3xxt+MkVOGhXUg BVf2D5VIH0ez4aRUis8qQIdz8ngzjqyGgS9jgaHZqcmHHamddqsqs6q1vXQUmQUtA5z5 6WoY9wtUMbRiISiT3+ITe4fe8MrPSUj78Lxb3kN6S0S/aq/My8CKaYZhVwm6va8ijfs4 CtdifW/WG9C4MFlDfkDLn/cS5mml+qaRHOsN/PgDETBYCG+EvCWmXzCcysO1z8AhAKSM gBE0juZSmhuP5SCJO4W5RXirp9iCuQP568beAsm7IfPXHTX0ZYYMkXzQbYmG46c72qgo RPeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=x0JpPnSf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q19si18157719otr.193.2019.12.29.10.16.35; Sun, 29 Dec 2019 10:16:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=x0JpPnSf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732134AbfL2SQe (ORCPT + 27 others); Sun, 29 Dec 2019 13:16:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:42580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727683AbfL2RYL (ORCPT ); Sun, 29 Dec 2019 12:24:11 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4366420722; Sun, 29 Dec 2019 17:24:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640250; bh=p7mjhz8gd3jd+JBPn7f9tDNZ2ZJUC7aK1rTtuhAB4Qw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x0JpPnSf7/sC+eM/+inzePcUJj2NaIYsD+sFZ9vl5IaVeAQKJcbnwRYn7WBNQmv+o ftyvW630UQ5DfYmbW+s1eTpC7uavPGmJZvZzjaQYZXJBsr5Uq04Y04dcF1yVsLe00K 7SrRkLU/tG040JCdH37dquB4a/23gV5hdz2trqNY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Garry , Jens Axboe , Sasha Levin Subject: [PATCH 4.14 078/161] libata: Ensure ata_port probe has completed before detach Date: Sun, 29 Dec 2019 18:18:46 +0100 Message-Id: <20191229162423.838150494@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162355.500086350@linuxfoundation.org> References: <20191229162355.500086350@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: John Garry [ Upstream commit 130f4caf145c3562108b245a576db30b916199d2 ] With CONFIG_DEBUG_TEST_DRIVER_REMOVE set, we may find the following WARN: [ 23.452574] ------------[ cut here ]------------ [ 23.457190] WARNING: CPU: 59 PID: 1 at drivers/ata/libata-core.c:6676 ata_host_detach+0x15c/0x168 [ 23.466047] Modules linked in: [ 23.469092] CPU: 59 PID: 1 Comm: swapper/0 Not tainted 5.4.0-rc1-00010-g5b83fd27752b-dirty #296 [ 23.477776] Hardware name: Huawei D06 /D06, BIOS Hisilicon D06 UEFI RC0 - V1.16.01 03/15/2019 [ 23.486286] pstate: a0c00009 (NzCv daif +PAN +UAO) [ 23.491065] pc : ata_host_detach+0x15c/0x168 [ 23.495322] lr : ata_host_detach+0x88/0x168 [ 23.499491] sp : ffff800011cabb50 [ 23.502792] x29: ffff800011cabb50 x28: 0000000000000007 [ 23.508091] x27: ffff80001137f068 x26: ffff8000112c0c28 [ 23.513390] x25: 0000000000003848 x24: ffff0023ea185300 [ 23.518689] x23: 0000000000000001 x22: 00000000000014c0 [ 23.523987] x21: 0000000000013740 x20: ffff0023bdc20000 [ 23.529286] x19: 0000000000000000 x18: 0000000000000004 [ 23.534584] x17: 0000000000000001 x16: 00000000000000f0 [ 23.539883] x15: ffff0023eac13790 x14: ffff0023eb76c408 [ 23.545181] x13: 0000000000000000 x12: ffff0023eac13790 [ 23.550480] x11: ffff0023eb76c228 x10: 0000000000000000 [ 23.555779] x9 : ffff0023eac13798 x8 : 0000000040000000 [ 23.561077] x7 : 0000000000000002 x6 : 0000000000000001 [ 23.566376] x5 : 0000000000000002 x4 : 0000000000000000 [ 23.571674] x3 : ffff0023bf08a0bc x2 : 0000000000000000 [ 23.576972] x1 : 3099674201f72700 x0 : 0000000000400284 [ 23.582272] Call trace: [ 23.584706] ata_host_detach+0x15c/0x168 [ 23.588616] ata_pci_remove_one+0x10/0x18 [ 23.592615] ahci_remove_one+0x20/0x40 [ 23.596356] pci_device_remove+0x3c/0xe0 [ 23.600267] really_probe+0xdc/0x3e0 [ 23.603830] driver_probe_device+0x58/0x100 [ 23.608000] device_driver_attach+0x6c/0x90 [ 23.612169] __driver_attach+0x84/0xc8 [ 23.615908] bus_for_each_dev+0x74/0xc8 [ 23.619730] driver_attach+0x20/0x28 [ 23.623292] bus_add_driver+0x148/0x1f0 [ 23.627115] driver_register+0x60/0x110 [ 23.630938] __pci_register_driver+0x40/0x48 [ 23.635199] ahci_pci_driver_init+0x20/0x28 [ 23.639372] do_one_initcall+0x5c/0x1b0 [ 23.643199] kernel_init_freeable+0x1a4/0x24c [ 23.647546] kernel_init+0x10/0x108 [ 23.651023] ret_from_fork+0x10/0x18 [ 23.654590] ---[ end trace 634a14b675b71c13 ]--- With KASAN also enabled, we may also get many use-after-free reports. The issue is that when CONFIG_DEBUG_TEST_DRIVER_REMOVE is set, we may attempt to detach the ata_port before it has been probed. This is because the ata_ports are async probed, meaning that there is no guarantee that the ata_port has probed prior to detach. When the ata_port does probe in this scenario, we get all sorts of issues as the detach may have already happened. Fix by ensuring synchronisation with async_synchronize_full(). We could alternatively use the cookie returned from the ata_port probe async_schedule() call, but that means managing the cookie, so more complicated. Signed-off-by: John Garry Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/ata/libata-core.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.20.1 diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index cbb162b683b6..08f67c109429 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -6676,6 +6676,9 @@ void ata_host_detach(struct ata_host *host) { int i; + /* Ensure ata_port probe has completed */ + async_synchronize_full(); + for (i = 0; i < host->n_ports; i++) ata_port_detach(host->ports[i]); From patchwork Sun Dec 29 17:19:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 182536 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp5443137ild; Sun, 29 Dec 2019 09:25:32 -0800 (PST) X-Google-Smtp-Source: APXvYqwwzIm56SXfLSoo3pQfXxI5pqKqjOpM2fMF5qfW/8/3uCqTOnufcymm6FIX7v/ibmcjgvJd X-Received: by 2002:a9d:74c8:: with SMTP id a8mr66374771otl.57.1577640332499; Sun, 29 Dec 2019 09:25:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577640332; cv=none; d=google.com; s=arc-20160816; b=SfTt08VJdClhYwzdAExmc1g1Aix5GvJ2a1DrssCcakOMYAwAfD8uKP3dsrL7/cGzWD mXr+/XHwD34WcAFD9bbqW8FYRCYz1y6433XIbfTmgn0pnR5EUfiTfO+fEVfhAFV5lrCw gOZ201DDZWCgyennWsihp1sE8cPwFfbPLIqv5Z2h7+3NfuVKvhhrFCjQdqJje/VFxOdn B1NCYG+I1rea7M3i15Rh44pDlO94CNqSSf7RftrQEg00UI7/idQzhQ8ZbF394/L65e/P W5zKaYow8aUsVbByBy/GefNScdV95W3Jm2Rb2aGfBrXckdNQQWC8dl+NcZEhKjA/Hic2 D8JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YbW3dMR63hUMm8s2W+Bu8GpWj6uwVbWTJP7ACrUBOTI=; b=pEg5SDJVUj5M/UMxfZUjPZazr6j0+Ow3P9GP97jHV0/OPg6NW0p0JLjq5oBeuK6qaQ p0c0gcFO9xILawSIQpWkC7wrXY0AC0hO91vPLB/wQ0+2KP3cQQWzdrkkFJGTvazmUhzA Dw+JqkjMefRB9OHnC2W6Hb2JYbKhFyP3XHp9Cx2MrGpcab2wGmAVBx2Kgv4/DQy85jFW h2wAS8jpX8rCgoaPv3xwRyYeuCFPg1EWG6M2AlOSbXMdqV93Zi0Ndk2Pd7fjG2Hs33ku qY1fegXxqY6k1wVS/T3aknsLYbVjmJ8CtX5824MSsq6ly2xCXNrMNPQVFpT7REZNMGM0 CdZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lCPqqlz+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 92si22016276otr.25.2019.12.29.09.25.32; Sun, 29 Dec 2019 09:25:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lCPqqlz+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727600AbfL2RZb (ORCPT + 27 others); Sun, 29 Dec 2019 12:25:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:45332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727474AbfL2RZ2 (ORCPT ); Sun, 29 Dec 2019 12:25:28 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 26FF620409; Sun, 29 Dec 2019 17:25:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640327; bh=UtjqdOVa/KZHKY7sXd8vUgrnNeXDFcZoscPGOtTCDYc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lCPqqlz+t+xZ4SeaVsHDqbotOI6V36x2PrwKRUo4BXFhTOS9yxO5DfytQeRni1mEL XLzPWz36bloEHf4ZJdNwXAoa6aOlECq3+pi/V3nIrgwVgqlph73pNGId/4Gn840PiS CpksaEjBM1lTSAHJyACyrDRhCVseytqtmR5LPe8Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Morse , Robert Richter , Borislav Petkov , Mauro Carvalho Chehab , "linux-edac@vger.kernel.org" , Tony Luck , Sasha Levin Subject: [PATCH 4.14 111/161] EDAC/ghes: Fix grain calculation Date: Sun, 29 Dec 2019 18:19:19 +0100 Message-Id: <20191229162430.774697006@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162355.500086350@linuxfoundation.org> References: <20191229162355.500086350@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Robert Richter [ Upstream commit 7088e29e0423d3195e09079b4f849ec4837e5a75 ] The current code to convert a physical address mask to a grain (defined as granularity in bytes) is: e->grain = ~(mem_err->physical_addr_mask & ~PAGE_MASK); This is broken in several ways: 1) It calculates to wrong grain values. E.g., a physical address mask of ~0xfff should give a grain of 0x1000. Without considering PAGE_MASK, there is an off-by-one. Things are worse when also filtering it with ~PAGE_MASK. This will calculate to a grain with the upper bits set. In the example it even calculates to ~0. 2) The grain does not depend on and is unrelated to the kernel's page-size. The page-size only matters when unmapping memory in memory_failure(). Smaller grains are wrongly rounded up to the page-size, on architectures with a configurable page-size (e.g. arm64) this could round up to the even bigger page-size of the hypervisor. Fix this with: e->grain = ~mem_err->physical_addr_mask + 1; The grain_bits are defined as: grain = 1 << grain_bits; Change also the grain_bits calculation accordingly, it is the same formula as in edac_mc.c now and the code can be unified. The value in ->physical_addr_mask coming from firmware is assumed to be contiguous, but this is not sanity-checked. However, in case the mask is non-contiguous, a conversion to grain_bits effectively converts the grain bit mask to a power of 2 by rounding it up. Suggested-by: James Morse Signed-off-by: Robert Richter Signed-off-by: Borislav Petkov Reviewed-by: Mauro Carvalho Chehab Cc: "linux-edac@vger.kernel.org" Cc: Tony Luck Link: https://lkml.kernel.org/r/20191106093239.25517-11-rrichter@marvell.com Signed-off-by: Sasha Levin --- drivers/edac/ghes_edac.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index 6f80eb65c26c..acae39278669 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -187,6 +187,7 @@ void ghes_edac_report_mem_error(struct ghes *ghes, int sev, /* Cleans the error report buffer */ memset(e, 0, sizeof (*e)); e->error_count = 1; + e->grain = 1; strcpy(e->label, "unknown label"); e->msg = pvt->msg; e->other_detail = pvt->other_detail; @@ -282,7 +283,7 @@ void ghes_edac_report_mem_error(struct ghes *ghes, int sev, /* Error grain */ if (mem_err->validation_bits & CPER_MEM_VALID_PA_MASK) - e->grain = ~(mem_err->physical_addr_mask & ~PAGE_MASK); + e->grain = ~mem_err->physical_addr_mask + 1; /* Memory error location, mapped on e->location */ p = e->location; @@ -389,8 +390,13 @@ void ghes_edac_report_mem_error(struct ghes *ghes, int sev, if (p > pvt->other_detail) *(p - 1) = '\0'; + /* Sanity-check driver-supplied grain value. */ + if (WARN_ON_ONCE(!e->grain)) + e->grain = 1; + + grain_bits = fls_long(e->grain - 1); + /* Generate the trace event */ - grain_bits = fls_long(e->grain); snprintf(pvt->detail_location, sizeof(pvt->detail_location), "APEI location: %s %s", e->location, e->other_detail); trace_mc_event(type, e->msg, e->label, e->error_count, From patchwork Sun Dec 29 17:19:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 182538 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp5443731ild; Sun, 29 Dec 2019 09:26:14 -0800 (PST) X-Google-Smtp-Source: APXvYqwoO2QmqV7Nlub2in8zB+dGiP8JwSaFBVn8z/yIXjoqDRoJTrN2cB+91O7d3BL7EWHmyhsy X-Received: by 2002:a9d:588d:: with SMTP id x13mr65865043otg.6.1577640374101; Sun, 29 Dec 2019 09:26:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577640374; cv=none; d=google.com; s=arc-20160816; b=LFElsHov0Hblz8WVFpZfry1bTFZjKl9WZj4cl4fwun4/oeqhZSLylc14SD+B3UyDOz zmWmuVk9IC++y4e4feQDbPBIN1a+x325Zl5iyloWcsY+p7gFQs4jQtEDEUogXpcQ0diJ pFOhRtKk7EzE68yRj2/wQ8JmvawA3WeNuY90Fy7jHIxPD0qtwB9w1gy4sdc1jEi9cxdn zktHShQv60vLXgnVI+hUOtEtwVp1S9MIfARJheVjQFd6Ioy8yALB0KWT14pnQmwO5h5g tilbE3Pzth3mn9s49G7feNCy4LeMGptDyjZJu3I9rL7J79sDihL54BfhOFloCIxxUJfN 8kow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZFRapnysdZ32zH+Fs4tBt5UNKzpkUBx2KcyDvOFTrXI=; b=UhpemRsD36OlnY6p0DSsRHyY1HGnNyV/MS6dsFStl21TArPhRw3Z8LKE5sYojpgcDl J+IispXmCDgcgUunJu9JDlWquZ1l6In/k4gq11rWTL9hD6Kg+7mSqxBH26uMu+1uLM5E zeP5fBRWZXoJM/nPjrQ/YszML6LplR6SmDMA3h6JCYkg7rEjny5SL7RsYsBUP7PmAidx nnvdn3R0qyWVdIh6Zn7+LUeRMLAcfiVzigahRnhGXsvjDxnkDbWSb8jfRW88UhUgYM0n asLPPCQCmyctm/rqf+rnqC0ImpyVTOq31mmq2eHcUTT0vPc1EXYiOG6YJAi0rAxEqM4C 2dzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WSAQ2+O0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q127si18794403oic.99.2019.12.29.09.26.13; Sun, 29 Dec 2019 09:26:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WSAQ2+O0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728144AbfL2R0M (ORCPT + 27 others); Sun, 29 Dec 2019 12:26:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:46838 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728123AbfL2R0I (ORCPT ); Sun, 29 Dec 2019 12:26:08 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DF0A5207FF; Sun, 29 Dec 2019 17:26:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640368; bh=wTeLpwQ9NyWe9Ik7bwUjxLI73XPOTIwTnGzR5hpahyQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WSAQ2+O0qTPSgM0I62BcDSK7Jtx0Y1SdWN9NQ1SS2I7S+9AF3aQEFS5Z3rCtt2F1w l8Ww2TQzHjcFCB+fKDV52sGwPHKfAWdg/TTm7Ok4cTursDK9QTSDQXtOzpoi2qA2Xh HT46jRiLmP6BPagdW6IdCBVQVtsbhdp+Mmk4diKQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Corentin Labbe , Herbert Xu , Sasha Levin Subject: [PATCH 4.14 130/161] crypto: sun4i-ss - Fix 64-bit size_t warnings on sun4i-ss-hash.c Date: Sun, 29 Dec 2019 18:19:38 +0100 Message-Id: <20191229162438.205997055@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162355.500086350@linuxfoundation.org> References: <20191229162355.500086350@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Corentin Labbe [ Upstream commit a7126603d46fe8f01aeedf589e071c6aaa6c6c39 ] If you try to compile this driver on a 64-bit platform then you will get warnings because it mixes size_t with unsigned int which only works on 32-bit. This patch fixes all of the warnings on sun4i-ss-hash.c. Signed-off-by: Corentin Labbe Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 2.20.1 diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c index f6936bb3b7be..1a724263761b 100644 --- a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c +++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c @@ -276,8 +276,8 @@ static int sun4i_hash(struct ahash_request *areq) */ while (op->len < 64 && i < end) { /* how many bytes we can read from current SG */ - in_r = min3(mi.length - in_i, end - i, - 64 - op->len); + in_r = min(end - i, 64 - op->len); + in_r = min_t(size_t, mi.length - in_i, in_r); memcpy(op->buf + op->len, mi.addr + in_i, in_r); op->len += in_r; i += in_r; @@ -297,8 +297,8 @@ static int sun4i_hash(struct ahash_request *areq) } if (mi.length - in_i > 3 && i < end) { /* how many bytes we can read from current SG */ - in_r = min3(mi.length - in_i, areq->nbytes - i, - ((mi.length - in_i) / 4) * 4); + in_r = min_t(size_t, mi.length - in_i, areq->nbytes - i); + in_r = min_t(size_t, ((mi.length - in_i) / 4) * 4, in_r); /* how many bytes we can write in the device*/ todo = min3((u32)(end - i) / 4, rx_cnt, (u32)in_r / 4); writesl(ss->base + SS_RXFIFO, mi.addr + in_i, todo); @@ -324,8 +324,8 @@ static int sun4i_hash(struct ahash_request *areq) if ((areq->nbytes - i) < 64) { while (i < areq->nbytes && in_i < mi.length && op->len < 64) { /* how many bytes we can read from current SG */ - in_r = min3(mi.length - in_i, areq->nbytes - i, - 64 - op->len); + in_r = min(areq->nbytes - i, 64 - op->len); + in_r = min_t(size_t, mi.length - in_i, in_r); memcpy(op->buf + op->len, mi.addr + in_i, in_r); op->len += in_r; i += in_r;