From patchwork Sun Dec 29 17:17:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 182549 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp5455710ild; Sun, 29 Dec 2019 09:40:52 -0800 (PST) X-Google-Smtp-Source: APXvYqyXjYIiqHxa3z92OQn9I8zg80R6ow793uPaoWvdEjjFHpvPcLacXHIXkd/4cLEywd0xdLDh X-Received: by 2002:a9d:3e16:: with SMTP id a22mr71742069otd.259.1577641252791; Sun, 29 Dec 2019 09:40:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577641252; cv=none; d=google.com; s=arc-20160816; b=ZaAGtRvcAcryCkECXEd6mCHv56J9aCc3sEoHG5S/w0ou/CShO8LULILY6JqdbKQl5k pNA+0IpCXngXGTHoiTEBSwbAgjU787YnpC+42uzugdLmLqwlu0urrEp1aUrp+5wixeU1 Go8VGf4lNzqb0fSU8YO0uNtOBuLPDHiWIFMZNatrLF3g6LK/T6wcBQwyf3n/B+h5/D+h wpzvXeCOLYOHp6Q8w4L4CLSKzk8BFwA8SX4tkakGBQCxmMucvboGfYLTgopTGZS4l4c9 5JnOV9ebk+AbcpmLwiz37ZKY/fYYsNG7x0X2IfYKlCuMiQ6AXF7WL3b4wUFxRBQE3r8/ jTgQ== 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=Jsg8SoAmaIXYOqxEJvroijf1A3fyQ999sEjvcfHFxJY=; b=v2/FpUQlLxpqdK8/wqIczJswSVexuZvyPr3jqLgtZc77Muuu0cO+rsCM7FJXdptvL3 c1NwxySQzo8LGTa/KD7n9J/QUs4aLKaqORpaDBkxV5tJyTNhw1R4zVgy9DX3Fp+MKopG S4YW9RIEMQ32si1L8+CT8s8yT+OP7VvpP448EO8TAkk9q+w9iU2f1S6JZMp44mFr3ySN 8tq5LMM4UhvUYprj5kdTJCstXGWq7JrJaf8YI0LXdy69dBWOPJ1quFAO7q7BZCsy+YMq EuRa6giYLvXIbKIajVwa1fhRe7sjlsdfQsfTb1NP3zTaxJGb/J26hxR9O3fAjoMMr0Zn 7hUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RdVlJjiB; 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 w29si24890447oth.313.2019.12.29.09.40.52; Sun, 29 Dec 2019 09:40:52 -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=RdVlJjiB; 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 S1729113AbfL2RbN (ORCPT + 27 others); Sun, 29 Dec 2019 12:31:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:57980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729093AbfL2RbI (ORCPT ); Sun, 29 Dec 2019 12:31: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 2F6E320722; Sun, 29 Dec 2019 17:31:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640667; bh=h4t23SUmlTtLdC4v+T1ti6aWL9NaAaQmUVYOp73w/Zo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RdVlJjiBhWtY3xWIiyUvUozm5fDT3Jg3G/y9rJwonUf+Hva6YNtOTQHCBw6TYP0tE JWAe9O98XaNIVg7jh/Cbe3fUQpZx3oYY/rO5KhQHqYermd11vUbrQwW6DF4DiP6CfT 1DpmnZ3OLW/px12OiGvTmTVsY4T0ZvMn+wYgUgEI= 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.19 050/219] selftests/bpf: Correct path to include msg + path Date: Sun, 29 Dec 2019 18:17:32 +0100 Message-Id: <20191229162514.999519096@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162508.458551679@linuxfoundation.org> References: <20191229162508.458551679@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 --- tools/testing/selftests/bpf/cgroup_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 diff --git a/tools/testing/selftests/bpf/cgroup_helpers.c b/tools/testing/selftests/bpf/cgroup_helpers.c index cf16948aad4a..6af24f9a780d 100644 --- a/tools/testing/selftests/bpf/cgroup_helpers.c +++ b/tools/testing/selftests/bpf/cgroup_helpers.c @@ -44,7 +44,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:17:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 182541 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp5447873ild; Sun, 29 Dec 2019 09:31:15 -0800 (PST) X-Google-Smtp-Source: APXvYqw3kk5HWbWzxHxcGcTd+nt+kAL/3MUzKRkauV+14VyE9VYu1mVmHbxh0d5Kp8NoU5tSWocp X-Received: by 2002:a05:6830:1b7b:: with SMTP id d27mr72479178ote.78.1577640675205; Sun, 29 Dec 2019 09:31:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577640675; cv=none; d=google.com; s=arc-20160816; b=Pt2qQrWWDP6POI1TcFBos2YlRnwsrMYeAi/lDdb9awwhGPKkRCsW0Us2TbIrZjuCLT Vw6EVkpOIObkWcg3yjqTvZpFG6KmSPKl2zEq5pQQHJ9fnY3rpj5V7FSdppU+2buhuFa0 1q3mDWjWXGgiYuan0h/HSahD8G8ceYiZDjlUbZ9bwBDzffJDXCIYymZkMPV0FgT4kZQE wdPmGIvZdNiOIq7nUxqKIa+j0OhzytTs6vRtw61I24zwQTRwpcWTp26wVDdaw6QQD3l/ lozC2B4TenuLOqhi+BHC/gxWkuhu912v28+Snkyg8QE8GmKuAl8+OJbhvajNPaFYqU1m Cq0g== 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=QmHfVVK8AjV5lIF6cY3SYjLlMC6Oh+Ib1JuGwMCp9Ng=; b=I1uHwPfWp6RT0L3VcViuL1krBAq7KOY7gh0vxmlxBYUefua9rCxKkO5DuinTNAqbex 4bIEeZL9YsdODVVjGhjlDklbmMpEB7GyTBNh3f7UxQHXvwnDQF9Z+IgSk3tj4fhmJ6Pu YWLtiRn2q9ZLWnYLqG4VuVc2yrQ2h28l2VH4WP57L2s64KR6V2sHqVCSSqNLRUIefDdM Sg0bVvosaYDOK8gF6biLtYZRENaMsuQcqfeCFP+jKL/lEz4vFdJfqhK8q7BBkBC5nXF1 aI8BiK3AlGwjOKUXH91TOQGWssOJSGYpr/C3ZYIOYWxORqMrwQO/TmQU4QNRu6rDu9ox xU9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YAc24KRs; 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 d23si19965215oij.270.2019.12.29.09.31.14; Sun, 29 Dec 2019 09:31:15 -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=YAc24KRs; 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 S1729122AbfL2RbO (ORCPT + 27 others); Sun, 29 Dec 2019 12:31:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:58078 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729102AbfL2RbK (ORCPT ); Sun, 29 Dec 2019 12:31:10 -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 A150520409; Sun, 29 Dec 2019 17:31:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640670; bh=WHsWUyjkT6BtcW+ctw78vQlYzOCMH3wIY6zzM3e/Ubk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YAc24KRsGbBgdS6uIPt1PuyADBBuju5qVedlWe6wdij+1P8rk9VJ17d08BexqSyM9 OJB0ZgeRtE+cC31EOuj7aNqYyEcrTGs4kDKhi1ti1k4hFebBBjpRcc34pPhXWs1yf6 wteiBgCazhJZNZdHFo8GkmzT/Zjlaui7oXOrPGWQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stanimir Varbanov , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 051/219] media: venus: Fix occasionally failures to suspend Date: Sun, 29 Dec 2019 18:17:33 +0100 Message-Id: <20191229162515.108617394@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162508.458551679@linuxfoundation.org> References: <20191229162508.458551679@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: Stanimir Varbanov [ Upstream commit 8dbebb2bd01e6f36e9a215dcde99ace70408f2c8 ] Failure to suspend (venus_suspend_3xx) happens when the system is fresh booted and loading venus driver. This happens once and after reload the venus driver modules the problem disrepair. Fix the failure by skipping the check for WFI and IDLE bits if PC_READY is on in control status register. Signed-off-by: Stanimir Varbanov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/qcom/venus/hfi_venus.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.20.1 diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c index 124085556b94..fbcc67c10993 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c @@ -1484,6 +1484,7 @@ static int venus_suspend_3xx(struct venus_core *core) { struct venus_hfi_device *hdev = to_hfi_priv(core); struct device *dev = core->dev; + u32 ctrl_status; bool val; int ret; @@ -1499,6 +1500,10 @@ static int venus_suspend_3xx(struct venus_core *core) return -EINVAL; } + ctrl_status = venus_readl(hdev, CPU_CS_SCIACMDARG0); + if (ctrl_status & CPU_CS_SCIACMDARG0_PC_READY) + goto power_off; + /* * Power collapse sequence for Venus 3xx and 4xx versions: * 1. Check for ARM9 and video core to be idle by checking WFI bit @@ -1523,6 +1528,7 @@ static int venus_suspend_3xx(struct venus_core *core) if (ret) return ret; +power_off: mutex_lock(&hdev->lock); ret = venus_power_off(hdev); From patchwork Sun Dec 29 17:18:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 182543 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp5449652ild; Sun, 29 Dec 2019 09:33:06 -0800 (PST) X-Google-Smtp-Source: APXvYqzpPY5/nwhBMImLmErjn+Kogylcth2683YUjLEK3bMhJ+P6XWu4v/wWuRdRd4H6rzlaHey/ X-Received: by 2002:a9d:6a41:: with SMTP id h1mr36251012otn.279.1577640786561; Sun, 29 Dec 2019 09:33:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577640786; cv=none; d=google.com; s=arc-20160816; b=0ikrs2AZLwaDVlGE19h8kqWIZAPjb9pxccyHeA9l/3bsV6zUHIqGEmNrQkHp/8aTXX ap+iQmxloB7abk1v2YxQuOHi35UkfOcfjAh4Uub5o1p7a3AjgUztXbEFzT3yMrnZV5K+ 3V0pc5Pp2dP//KUtFqkXIG5h1MCcgm6o3wJdldLFi5srB1OdQ1Ho0d/j6tzUyo26xhxl rP4sQKL1o85L3vpiAcdOCU+itN/JAkpjLaj6M91U1CTP+3quG2vxZaCSb+S/Py5blzgb XILmj33WVfNH62wsecKg/PTb7d4TFNq4kZrgoA1vaKvq1RBQJjsSiJtzzG29jUmtYMQY Gq3g== 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=YbXRHwglRGZvBfVtbVGxZ94THApPXtkrz7ZHyH/mG3Y=; b=ko9EeGTJSvRikWP+QgSWU05591zFdxGRpsvX8SZa9JLuDwJDenv8ep1xvuBvLxAYvU KxaYNp9/1TRpAg0IgIQKDYa1gPZeEmWpFSoUsli4W/kBDkKR7bgP5Wf4eR5f35vs40/R 6iPFyE2aybi1j9d6xgU192jIuv5mNhW7peJtdC538SQpPoGfZ+0iaupgbeQzgM/hP/sY DJX2yv+l9GrNxuW6D5v4F1QgbMQ/XJxn8GJ4s/KAQszJ+aP155dq60mSHYvLz/RyAPdI +zIJTucqMjXSkOvoy+cLude3rXPMuwekcIsr5VeN5JW9mFR/4SEracK6rgMifLGqfh1O AZkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KNFEQ92h; 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 k7si19631477otb.90.2019.12.29.09.33.06; Sun, 29 Dec 2019 09:33:06 -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=KNFEQ92h; 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 S1729389AbfL2RdF (ORCPT + 27 others); Sun, 29 Dec 2019 12:33:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:34124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727452AbfL2RdA (ORCPT ); Sun, 29 Dec 2019 12:33:00 -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 D7EC720409; Sun, 29 Dec 2019 17:32:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640779; bh=1u3chDRibC6IUIfpSJQ4eqliyQuIjrD7HqX5Hcdi72M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KNFEQ92hjCedqTqm3uwnvEwrGCJfMfLfFHhohtvgLZxAZRqIvBEPmbqQsOeMKmfUD vOBbMDy/AzHcMseD6TLntRVUdB/8qZ3OVGw4saustjDOypzS+7IT3gKU9kmrIepOk2 POa0lqk7YsmjFiOqTL9CRN9y78oZODBGfqDclA58= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leo Yan , Adrian Hunter , Alexander Shishkin , Brajeswar Ghosh , Florian Fainelli , Jiri Olsa , Mark Rutland , Michael Petlan , Namhyung Kim , Peter Zijlstra , Song Liu , Souptick Joarder , Will Deacon , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 4.19 086/219] perf tests: Disable bp_signal testing for arm64 Date: Sun, 29 Dec 2019 18:18:08 +0100 Message-Id: <20191229162518.590431950@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162508.458551679@linuxfoundation.org> References: <20191229162508.458551679@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 6a5f3d94cb69a185b921cb92c39888dc31009acb ] As there are several discussions for enabling perf breakpoint signal testing on arm64 platform: arm64 needs to rely on single-step to execute the breakpointed instruction and then reinstall the breakpoint exception handler. But if we hook the breakpoint with a signal, the signal handler will do the stepping rather than the breakpointed instruction, this causes infinite loops as below: Kernel space | Userspace ---------------------------------|-------------------------------- | __test_function() -> hit | breakpoint breakpoint_handler() | `-> user_enable_single_step() | do_signal() | | sig_handler() -> Step one | instruction and | trap to kernel single_step_handler() | `-> reinstall_suspended_bps() | | __test_function() -> hit | breakpoint again and | repeat up flow infinitely As Will Deacon mentioned [1]: "that we require the overflow handler to do the stepping on arm/arm64, which is relied upon by GDB/ptrace. The hw_breakpoint code is a complete disaster so my preference would be to rip out the perf part and just implement something directly in ptrace, but it's a pretty horrible job". Though Will commented this on arm architecture, but the comment also can apply on arm64 architecture. For complete information, I searched online and found a few years back, Wang Nan sent one patch 'arm64: Store breakpoint single step state into pstate' [2]; the patch tried to resolve this issue by avoiding single stepping in signal handler and defer to enable the signal stepping when return to __test_function(). The fixing was not merged due to the concern for missing to handle different usage cases. Based on the info, the most feasible way is to skip Perf breakpoint signal testing for arm64 and this could avoid the duplicate investigation efforts when people see the failure. This patch skips this case on arm64 platform, which is same with arm architecture. [1] https://lkml.org/lkml/2018/11/15/205 [2] https://lkml.org/lkml/2015/12/23/477 Signed-off-by: Leo Yan Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Brajeswar Ghosh Cc: Florian Fainelli Cc: Jiri Olsa Cc: Mark Rutland Cc: Michael Petlan Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Song Liu Cc: Souptick Joarder Cc: Will Deacon Link: http://lore.kernel.org/lkml/20191018085531.6348-3-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/tests/bp_signal.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) -- 2.20.1 diff --git a/tools/perf/tests/bp_signal.c b/tools/perf/tests/bp_signal.c index 910e25e64188..6cf00650602e 100644 --- a/tools/perf/tests/bp_signal.c +++ b/tools/perf/tests/bp_signal.c @@ -48,14 +48,6 @@ asm ( "__test_function:\n" "incq (%rdi)\n" "ret\n"); -#elif defined (__aarch64__) -extern void __test_function(volatile long *ptr); -asm ( - ".globl __test_function\n" - "__test_function:\n" - "str x30, [x0]\n" - "ret\n"); - #else static void __test_function(volatile long *ptr) { @@ -301,10 +293,15 @@ bool test__bp_signal_is_supported(void) * stepping into the SIGIO handler and getting stuck on the * breakpointed instruction. * + * Since arm64 has the same issue with arm for the single-step + * handling, this case also gets suck on the breakpointed + * instruction. + * * Just disable the test for these architectures until these * issues are resolved. */ -#if defined(__powerpc__) || defined(__s390x__) || defined(__arm__) +#if defined(__powerpc__) || defined(__s390x__) || defined(__arm__) || \ + defined(__aarch64__) return false; #else return true; From patchwork Sun Dec 29 17:18:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 182542 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp5449579ild; Sun, 29 Dec 2019 09:33:03 -0800 (PST) X-Google-Smtp-Source: APXvYqwJtfLQprul9c8qF74VNjoJgxj7ocDYlN5nXK/lqeZqEYbAXH3X3bLXrYsAfTTpZRiDCxHp X-Received: by 2002:a05:6830:2111:: with SMTP id i17mr65128008otc.24.1577640782938; Sun, 29 Dec 2019 09:33:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577640782; cv=none; d=google.com; s=arc-20160816; b=oFQeFlsy2z3s9vjISgrfKfxeYq1TIjf57bxMdxdFZxb0YYuUSkC7ZX6zQfUSgnlnON iZ3HX0m0dySQZ2ua/UdLOGJtwxV23aTFRHLdXkFINboTD5/E5eUnCLdNpmJKAUye0qfV uGNCMq2Ar491xM1Ht76DX3kgEGFOP1GqklmW3Ltm4XYJmLp/L/H2ORfkAyRCR5gC+uSJ Kv+wHT2mrNuOfUSx3tWMN486ec2dvENsB80esOQEziByADjOfldaKDCbPFd13acrJawJ ruGEvAEu+7JAhcXjcihGZZWIVEInD6r/Je+R0BRJUCV9ZZSal2IsOj+f0QcV4/WpG4E1 B9XQ== 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=rLK5dwQ6taZ5eAzetqzTsLRtzAMNiJWFei6vRG68qrg=; b=d3aqT0B7RZddT92YtZAvm0/cTH81AR504u3rPpkzhXZ2u6Ruk/bRwmznDKRtoMWhHE 6U1YgtiLQL1MKCgQh7h8W4tm1YlIN5o5TSicTVLxcWh9kPHNoxraSxQXUr+5SzWsS3zn axeOe9x5TNgMpYn1GNSXymXZQ0NseFwiY0J5eUQ+/YEsQLYAMB0gaesayD0YtFQ+2D1U VNIRxyy2a5SlF8+guyKpW5st6MVRKaQTr2wsdZtTiK372yTEtXwt0Sw5W8jdjY8CnAsS +px6qJG2t+SEGVlg/yCRqwFQIq9CPmxCA4rcPlOmLXem1eymr9fQIzreWkCpZvxaLdxn p/zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="S/aJxpT9"; 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 k7si19631477otb.90.2019.12.29.09.33.02; Sun, 29 Dec 2019 09:33:02 -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="S/aJxpT9"; 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 S1729382AbfL2RdB (ORCPT + 27 others); Sun, 29 Dec 2019 12:33:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:34020 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729377AbfL2Rc5 (ORCPT ); Sun, 29 Dec 2019 12:32:57 -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 97E98207FD; Sun, 29 Dec 2019 17:32:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640777; bh=f+oyQdJV2mvKWAwexwUt8dcxFVa+jkYNOVD3dekVTwE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S/aJxpT9XCP6XPLxiwKVOOVKubtG6+8M10T2nRM48pGYdBmKufBQVrnd7jtywI5tB zE5BUKn8ezWYPzBH/YihwQgPLdJWIeAAIkD7IwHQMwM7HFE/fAngiSHqFpuYij5T2t 93J6/P7K1gzaIfcPj0vpAUdE2kWC9oDBYb8mwlDQ= 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.19 095/219] net: phy: dp83867: enable robust auto-mdix Date: Sun, 29 Dec 2019 18:18:17 +0100 Message-Id: <20191229162521.892610959@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162508.458551679@linuxfoundation.org> References: <20191229162508.458551679@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 eeadfde15940..879096d3ff41 100644 --- a/drivers/net/phy/dp83867.c +++ b/drivers/net/phy/dp83867.c @@ -86,6 +86,10 @@ #define DP83867_IO_MUX_CFG_CLK_O_SEL_MASK (0x1f << 8) #define DP83867_IO_MUX_CFG_CLK_O_SEL_SHIFT 8 +/* 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) @@ -331,12 +335,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:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 182548 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp5455407ild; Sun, 29 Dec 2019 09:40:27 -0800 (PST) X-Google-Smtp-Source: APXvYqxfMkFpYbmYBHubiuhYQzHyrN0tjQfKpov+o0RI2Eh4KCmlZOQpjAj3dwpSuOjMO4jNmVm0 X-Received: by 2002:a05:6830:14d9:: with SMTP id t25mr61085886otq.258.1577641226909; Sun, 29 Dec 2019 09:40:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577641226; cv=none; d=google.com; s=arc-20160816; b=gxefY6JE4qlVUxqnuOiRjOTk1VJlqLQyTr2XUxJ3sw2rekdCj+k1JzARHFhQRwrSqa dZRKfRexuEZ/GA7J0HmAZcXzDs6Z6p+eaua7Kx7TOA1pZDciCHUJcoYSh0zP3HgmFXag 5aKX3IZeOJsSL0noThG5e44kx/lnI7Ev5xyYbVSD7swZf+J3M4LBvsc8LqT4vu0+BkoE Oc/kszBhfTCIeuLcDbaQI7+t4Xl6paf/TSNGqqMP0VrB4vdXDJlaj/FavTOcoqi8Sh9v 8avqwkA9QV7DseTceBczKvmqaBG1IRKTanhsBKqvRLh35KpcYL0lW8NPpIVqZ/NMwCxt WrfA== 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=GC4QxHo0zp0FZ4Iwi3YhMZiLrIu3iSPg4jDW4NCRlp0=; b=C36Ke3Pvi733DVzbdUycIlK/U8Ftultua+/1X9EAnigHMgcBrI7Hlt63apKS+RZ5ut ibvWsh+oQPL9H1c79tRzPiB4mazKCvedzW807iuKgL2cOeniX/m339bso4raeoad1CL7 N5Iq93v7PqUqSxhlacBVxcs4E0azOZ70osquPOQQZg0O94skdqdlicDBKaCbZ5bVNO0h xxdldJcvPzpeU51NZsxohaPP9GwKuC53P0jKw4U3dfezUfbpG95RewBCM2JEJq7FTOT1 +lwioi/7UIoLNLbqnaSE1Jbc51tZ1zOALEXtjqQBnyybGQvMpxnYLJ5KHdT74D0BXmV7 kcJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JEtbS8D7; 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 z25si23149633oto.211.2019.12.29.09.40.26; Sun, 29 Dec 2019 09:40:26 -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=JEtbS8D7; 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 S1730130AbfL2RkZ (ORCPT + 27 others); Sun, 29 Dec 2019 12:40:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:59670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728952AbfL2Rbw (ORCPT ); Sun, 29 Dec 2019 12:31: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 030A021D7E; Sun, 29 Dec 2019 17:31:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640711; bh=wHSuNbaQOr9d0JXrs1QbazHeHnvK/wg9JvQeH+r/jCM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JEtbS8D7mT+HoWkAKdvUG1Fh47Wpt94o7G2pIb16oZmiugtV+QxObZPJzFQmT7PAP xucA6oM9ivjBxh+eF5YiETW85x6gGIC94BpsfvHjAVEJyurAS4quyAWwITWl2m+T/1 iY686V9YLOHoczYPyVpnG7qoDNKhxPvTOFh7XwZs= 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.19 107/219] libata: Ensure ata_port probe has completed before detach Date: Sun, 29 Dec 2019 18:18:29 +0100 Message-Id: <20191229162524.815972605@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162508.458551679@linuxfoundation.org> References: <20191229162508.458551679@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 133fed8e4a8b..85ee6c35d8e0 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -6726,6 +6726,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:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 182544 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp5450095ild; Sun, 29 Dec 2019 09:33:41 -0800 (PST) X-Google-Smtp-Source: APXvYqwqO51o14bWiYcvt9k/f91mzbzRythIAc+BK/TzAwR5BzAtqk6nuftnUcRTL1L59kg50sEF X-Received: by 2002:a9d:5c86:: with SMTP id a6mr70416962oti.68.1577640821489; Sun, 29 Dec 2019 09:33:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577640821; cv=none; d=google.com; s=arc-20160816; b=zmvSEZuxbyvb4dq5JW3xvmHk3dOMiG6G0vZR2XwaK8Th0HD06v/9NdYCwQwMY4b9zP duxr7GKOZFQfrZz8ytRAcE+0mP4uI8vZj2qpE82ROUyKzJIqb3Ae2+UfAUJAJxR401OZ eAs3U3CuRmjCkMiKZt0R4Q461nzPPWoLI8MeKPTr2ntskfWDmO8knbEnKSB3nxnIldWN wvSZh946OFcaIuiVohET9hpnIEr3o9SxpXLIlholbZpqzbDRbvi3evjkMgxIkFl9fL57 HNZ8T31lhSnVKeMP0lp/fq5GlsAOWeEzmIGZyHN77+jxgwx4thYrvqVGWUBB9jvRvgMv oSQQ== 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=DvZ3GhAVXzLylW1kj9Y66/Bz3NQdE3K4w/oFBzcQuMs=; b=ToN9XRHX3Cc4EEWk4eqA6kqOFTwaZ2znkFflCpAGz9xjPmOk8CQvwMRvHQeEXYiCCB /jNAGIGDwQGmvNB9w2/M8I/I0tbkk8UmcGlrZDbWEcOIwSD3fJ2kWHSb11Pzxmb+oLyz X4Fc/C+OLkaq8YEgxOz82RqWIO/O5ri5yosNMa0+ivZggKxNbF69KUtOB3+2EltZgQFw h2DUhw4FZiBaqIkI4YjUZLawtXQzbDfJFDjFLCIVt0s6wH1x3h18Xo3MBzj2xs12Jwli j5hGY1aLdQBWeOI/Z+DkNBPpgcWzKCA3p46YMcYNPoPdA/BYJDxJoDERaJ+pHoIyuLAa z82w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bURsVCl9; 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 h138si19581659oib.6.2019.12.29.09.33.41; Sun, 29 Dec 2019 09:33:41 -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=bURsVCl9; 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 S1729490AbfL2Rdk (ORCPT + 27 others); Sun, 29 Dec 2019 12:33:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:35474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729459AbfL2Rde (ORCPT ); Sun, 29 Dec 2019 12:33:34 -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 9E555207FD; Sun, 29 Dec 2019 17:33:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640813; bh=tuRipZte5EqskJXk8kD1/fPZoHKEC/8f/pLxDLZ6hIE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bURsVCl9+Rui7rCzX+5Ewe6WTDVExQC9FWnVI0+Jzxc1vgTFzi1c/1IZW8Y3mkOM3 crfZe2Ba8xqnTKTikc7KN3BIa3fZnPPUDC60ElI77XKjAS6vOi+R8UWa+cKMaIhTzy 7J+imMxIMEc9mRc5MQ0a02KhHeEHlE3IIThwZlJg= 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.19 149/219] EDAC/ghes: Fix grain calculation Date: Sun, 29 Dec 2019 18:19:11 +0100 Message-Id: <20191229162530.890383917@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162508.458551679@linuxfoundation.org> References: <20191229162508.458551679@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 574bce603337..78c339da19b5 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -210,6 +210,7 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) /* 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; @@ -305,7 +306,7 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) /* 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; @@ -412,8 +413,13 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) 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:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 182547 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp5453631ild; Sun, 29 Dec 2019 09:38:04 -0800 (PST) X-Google-Smtp-Source: APXvYqw4dz+O6we49roeSomJMgzF0Iqwnf2gxyqcYHT3b3wniFm2O5bGz177s/b5x292YEbTvA4q X-Received: by 2002:a05:6830:1402:: with SMTP id v2mr58432168otp.12.1577641084231; Sun, 29 Dec 2019 09:38:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577641084; cv=none; d=google.com; s=arc-20160816; b=ISkHbhs8JIuyBlqPZLf0ecY8hVtlv5FvuGvdtJDXw7XQry3xxbjvK12PZiuan92yh3 f6QiiTyFcnUReP84ixhgqM8Uk/0cSVhjU4D19St6i8qg9lq6iwPQBmuYoKvMMXMbOY4j krmjAG1OQDdLCxTt3FsZ5t0ptCe8WDPrNGWXfW0BeSqQpytGHnwzF026s3Orrk5FDZJK /OT9k/mkjbYQK4UAIjM2tMIF9bdnAgbMHWcjW3Vqvv+5MP++65p/nlDLNaxmWYBW2PCO AfdMNXWPedcUPd6f8gifFHzcKwFroBD9qkn86qbPpqh/ZJb3B6BHuMrktub64ml1ko1t PXNw== 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=jq0Ckz6901hnHbr/lvNxUtR/mCuNSgnwPQShPJkDt7DtaySlpAVMjz4JwS48OehKBv 95TBZO9FuhVgZvYFJLGu9sHZQHUoXprMdjlexEHpL7gwXhMUrXcXxJbbEuzu7MahS15E SH/yuk/pQplKzRlF0jwPdylYZPVrpltH4V6Xo/WKgexmm/VfkCwfZ8Rarcv7ChaLzU20 mCHUinWyHLvstW2ppnIBBJNIlIWl8Ev5AKLJnwtcqxRNLfavndzsjC0PDc44YBhTjp6B WFjW+PeXg4NQPnviSrZj7xCIyLL1ylL0163ZLkCNSYbw/DW1mCx9BtfRGTfScTV3GLq5 F1gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=onP9yjqS; 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 l20si21105276otr.227.2019.12.29.09.38.04; Sun, 29 Dec 2019 09:38:04 -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=onP9yjqS; 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 S1729980AbfL2RiD (ORCPT + 27 others); Sun, 29 Dec 2019 12:38:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:38438 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729729AbfL2Res (ORCPT ); Sun, 29 Dec 2019 12:34: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 A9FA120722; Sun, 29 Dec 2019 17:34:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640888; bh=wTeLpwQ9NyWe9Ik7bwUjxLI73XPOTIwTnGzR5hpahyQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=onP9yjqSiRoaTnOZqyumPmVd5Z55gYwJXJHbNVBiybQKsaO3QlEr44/IMQ76Mevpy 1rrIxva3OYWUG9Ta5BoYrHcc4bJmlxtdcuiqBo8eCI1F1zivJHDJuZn35ou67MyYiT w6erUdWmGx31ueDlWO9EPiaGJH3iZznL+2pZSN3M= 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.19 181/219] crypto: sun4i-ss - Fix 64-bit size_t warnings on sun4i-ss-hash.c Date: Sun, 29 Dec 2019 18:19:43 +0100 Message-Id: <20191229162536.490846003@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162508.458551679@linuxfoundation.org> References: <20191229162508.458551679@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;