From patchwork Fri Jul 12 12:19:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 168938 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp813310ilk; Fri, 12 Jul 2019 05:23:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqxmeGWsVYl7Lmr9KfQDkrB22Ol9omA3uintjDs27aIl/9llh2vA5FiO2WQsidDi1YymoWft X-Received: by 2002:a17:90a:9dca:: with SMTP id x10mr11562575pjv.100.1562934182934; Fri, 12 Jul 2019 05:23:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562934182; cv=none; d=google.com; s=arc-20160816; b=VcsW7TF2wVj7eZWn45UiRvk+fvAG0DD17XdYbSizbvgM+worUWdiLnr2mtjmT5KSq/ 5POwJ4mwUTFiUNqhUna4i1L0BVeoGx+vKFXNHhW+4dbAGtNeI7Qn5a96nIa+7UnNmoBz 9ckzynJ3hSaCkBMZw1LbNBIcZu9Rnz52rboN2NmddY0yk+X+DbC4B1xJtOeRx0oB0ALc ak3DHrB43vtxFk6+Q88JNe3/ArzQpsyBHDrQsBFW+oHnzUEBxKKmu8kF201UwDNWRTJ+ VgTeZ45Wxjsn4heejpBumSzR+yPe/ERgMIpVcno8uWhaNViIFuOUNdOkMS2KEnWPYtd+ Gr+w== 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=g7ff/i5lSLSXseWqtTC0P8kikdlqUo2orL7Jmm/MfKw=; b=iPwFXNI+jYTPOvC7UBxBa2fz+OyjDDr6q9ehRrkrHdljhLHqsSMOClOw3ILnXpwZ94 +i1nF73G8T5RHvFOTHuynivLWL+SSk7dQKdFAjkn5t3MGBjKhS2jgi+bB0OFO+mQM1Ej xBqfyaTLCMIRpn568L34A6+XBVUWiH+XouSw31AtNSWYcugWjgo63pMhwDxPYr00V5/b JkAbby1DHbAoxhV2VTiWg5F+9ePQQM6xTIwXSpfpdyaV3IUim1nGDwfY3o1ROA0NQBKG o5uwuOG2MK2cATBVFyijMvrvDQmyCkjbSInu33jw871uEWQ2mQyJVBk2lDsSb0bXqHvC dImA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kzfnWAO8; 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 j5si8573174pjf.60.2019.07.12.05.23.02; Fri, 12 Jul 2019 05:23:02 -0700 (PDT) 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=kzfnWAO8; 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 S1727838AbfGLMXB (ORCPT + 29 others); Fri, 12 Jul 2019 08:23:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:58126 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727816AbfGLMW7 (ORCPT ); Fri, 12 Jul 2019 08:22:59 -0400 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 106472084B; Fri, 12 Jul 2019 12:22:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934178; bh=+YH3dYAhwbEtcBYAH0X9EUm6oml7V9ajXNjfFfs9FWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kzfnWAO85h+KaeozbWmsV3lefwX0potl7TmQK/Br5ZQqY9f/FK5O5PwCidMoke0aB 8h1qBQVv/IMmlhjswIdjMEdV6JZuWay6DfmucUSMdrn9k5xJrOauPkhNQ7DQmBlNvw gA7eEhZRCf5g6WQxSStpo4x9LVttN2DWQYSkj7Aw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Garry , Alexander Shishkin , Ben Hutchings , Hendrik Brueckner , Jiri Olsa , Kan Liang , Mark Rutland , Mathieu Poirier , Namhyung Kim , Peter Zijlstra , Shaokun Zhang , Thomas Richter , Will Deacon , linux-arm-kernel@lists.infradead.org, linuxarm@huawei.com, Arnaldo Carvalho de Melo Subject: [PATCH 4.19 62/91] perf pmu: Fix uncore PMU alias list for ARM64 Date: Fri, 12 Jul 2019 14:19:05 +0200 Message-Id: <20190712121625.161181001@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121621.422224300@linuxfoundation.org> References: <20190712121621.422224300@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 commit 599ee18f0740d7661b8711249096db94c09bc508 upstream. In commit 292c34c10249 ("perf pmu: Fix core PMU alias list for X86 platform"), we fixed the issue of CPU events being aliased to uncore events. Fix this same issue for ARM64, since the said commit left the (broken) behaviour untouched for ARM64. Signed-off-by: John Garry Cc: Alexander Shishkin Cc: Ben Hutchings Cc: Hendrik Brueckner Cc: Jiri Olsa Cc: Kan Liang Cc: Mark Rutland Cc: Mathieu Poirier Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Shaokun Zhang Cc: Thomas Richter Cc: Will Deacon Cc: linux-arm-kernel@lists.infradead.org Cc: linuxarm@huawei.com Cc: stable@vger.kernel.org Fixes: 292c34c10249 ("perf pmu: Fix core PMU alias list for X86 platform") Link: http://lkml.kernel.org/r/1560521283-73314-2-git-send-email-john.garry@huawei.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/pmu.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -750,9 +750,7 @@ static void pmu_add_cpu_aliases(struct l { int i; struct pmu_events_map *map; - struct pmu_event *pe; const char *name = pmu->name; - const char *pname; map = perf_pmu__find_map(pmu); if (!map) @@ -763,28 +761,26 @@ static void pmu_add_cpu_aliases(struct l */ i = 0; while (1) { + const char *cpu_name = is_arm_pmu_core(name) ? name : "cpu"; + struct pmu_event *pe = &map->table[i++]; + const char *pname = pe->pmu ? pe->pmu : cpu_name; - pe = &map->table[i++]; if (!pe->name) { if (pe->metric_group || pe->metric_name) continue; break; } - if (!is_arm_pmu_core(name)) { - pname = pe->pmu ? pe->pmu : "cpu"; + /* + * uncore alias may be from different PMU + * with common prefix + */ + if (pmu_is_uncore(name) && + !strncmp(pname, name, strlen(pname))) + goto new_alias; - /* - * uncore alias may be from different PMU - * with common prefix - */ - if (pmu_is_uncore(name) && - !strncmp(pname, name, strlen(pname))) - goto new_alias; - - if (strcmp(pname, name)) - continue; - } + if (strcmp(pname, name)) + continue; new_alias: /* need type casts to override 'const' */ From patchwork Fri Jul 12 12:19:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 168940 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp815390ilk; Fri, 12 Jul 2019 05:24:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwS9aqjq2YRU8C4w3aS8ELvWFnofcroMox1EnUlZCUP8za7bnCFaAJBbG3KwaAwF2Uszqch X-Received: by 2002:a17:902:6b81:: with SMTP id p1mr8618610plk.91.1562934298303; Fri, 12 Jul 2019 05:24:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562934298; cv=none; d=google.com; s=arc-20160816; b=zVR/8qHTHhiz/cqt/SnjuCdl1yvs9J1ik92rnxLMKJ2hvivvviMJN7BSfMvl7jUxpX 7V4Zv/Fd9BbkU12lhEQvgDGiK7weTTNRMv31l+7DkEH2HBToqSL9NCj+WKod3WovWikL 9mPsvtGEzceDDXadRuynZDSSCWTWPhiduVQF7xakP0NZ5jdp+kc1T7oihCQJNGNZ0KcI oLptnC+tNlwiZSUI4rep4QZDOm9po3SYBg/I+yD8ij2gRTo+FAbGz5WHcEocuWj8C4ve P4LI+jEZ/58fkzJ3/pomSWDFZK5rtFDlZzFmRkQTUiE35CTtshHNWqYaibtNn4V/1Ixk cy4w== 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=iIbSngCTKOxBtyz6yHT1qGLuFq8Akj/PBvDLHoo2jBQ=; b=M7mxySq5uQndX6yT5Envjc6Atz9944PapKP54nRmLQzk8n+YKmHeD1SwGfTd/IMfYu eZEzD/X9LFMm4PmP6NKWjAhUz02oovW8WcShA/gXGzVbEZEUbSTBMa3jGCYuTHd4ud9h GGhQcmyuofr+qSpIvq4ykur4pKrW6wWZ4ZJe6qeiuB88E1iFlMjlSumgME4jmBBSieQc Lq+tErRSTeKORvH6Hajnv9t1yUbXV7h4IJmX7hrS2PmOzf3WSH6G5mONtg3sD/6O2siX helx+G/YNU7loBW9I+7DAodSKz6zEGPMfJYN360Mtg9r8a9cHzu5pMcozy/0DdiFGCoj xvxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EbiLRYpN; 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 n6si8134322pjb.73.2019.07.12.05.24.58; Fri, 12 Jul 2019 05:24:58 -0700 (PDT) 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=EbiLRYpN; 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 S1728200AbfGLMY5 (ORCPT + 29 others); Fri, 12 Jul 2019 08:24:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:34108 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728186AbfGLMYx (ORCPT ); Fri, 12 Jul 2019 08:24:53 -0400 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 EFF3B21019; Fri, 12 Jul 2019 12:24:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934292; bh=jsEf85U9RQPk6zjAwVpuSjiPjd7dfdaqi7vkN8W13ko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EbiLRYpNo8C21VntfURrl+P5Cuf984BhXx1zfR8JonhH45GiB4NinFtCmi0ZZEg5c kCVtKIHB2870QJGh1l0whQ1pvrzo1lnXf0bMRS/cG4ROo+HnVEsfBucq04kO1o9a1o E2GoGHyYA5e7pFK+YfeFXsknWZ9zq73pJQnUnFPQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann Subject: [PATCH 4.19 91/91] staging: rtl8712: reduce stack usage, again Date: Fri, 12 Jul 2019 14:19:34 +0200 Message-Id: <20190712121626.572431972@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121621.422224300@linuxfoundation.org> References: <20190712121621.422224300@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: Arnd Bergmann commit fbd6b25009ac76b2034168cd21d5e01f8c2d83d1 upstream. An earlier patch I sent reduced the stack usage enough to get below the warning limit, and I could show this was safe, but with GCC_PLUGIN_STRUCTLEAK_BYREF_ALL, it gets worse again because large stack variables in the same function no longer overlap: drivers/staging/rtl8712/rtl871x_ioctl_linux.c: In function 'translate_scan.isra.2': drivers/staging/rtl8712/rtl871x_ioctl_linux.c:322:1: error: the frame size of 1200 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] Split out the largest two blocks in the affected function into two separate functions and mark those noinline_for_stack. Fixes: 8c5af16f7953 ("staging: rtl8712: reduce stack usage") Fixes: 81a56f6dcd20 ("gcc-plugins: structleak: Generalize to all variable types") Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 159 ++++++++++++++------------ 1 file changed, 89 insertions(+), 70 deletions(-) --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c @@ -141,10 +141,91 @@ static inline void handle_group_key(stru } } -static noinline_for_stack char *translate_scan(struct _adapter *padapter, - struct iw_request_info *info, - struct wlan_network *pnetwork, - char *start, char *stop) +static noinline_for_stack char *translate_scan_wpa(struct iw_request_info *info, + struct wlan_network *pnetwork, + struct iw_event *iwe, + char *start, char *stop) +{ + /* parsing WPA/WPA2 IE */ + u8 buf[MAX_WPA_IE_LEN]; + u8 wpa_ie[255], rsn_ie[255]; + u16 wpa_len = 0, rsn_len = 0; + int n, i; + + r8712_get_sec_ie(pnetwork->network.IEs, + pnetwork->network.IELength, rsn_ie, &rsn_len, + wpa_ie, &wpa_len); + if (wpa_len > 0) { + memset(buf, 0, MAX_WPA_IE_LEN); + n = sprintf(buf, "wpa_ie="); + for (i = 0; i < wpa_len; i++) { + n += snprintf(buf + n, MAX_WPA_IE_LEN - n, + "%02x", wpa_ie[i]); + if (n >= MAX_WPA_IE_LEN) + break; + } + memset(iwe, 0, sizeof(*iwe)); + iwe->cmd = IWEVCUSTOM; + iwe->u.data.length = (u16)strlen(buf); + start = iwe_stream_add_point(info, start, stop, + iwe, buf); + memset(iwe, 0, sizeof(*iwe)); + iwe->cmd = IWEVGENIE; + iwe->u.data.length = (u16)wpa_len; + start = iwe_stream_add_point(info, start, stop, + iwe, wpa_ie); + } + if (rsn_len > 0) { + memset(buf, 0, MAX_WPA_IE_LEN); + n = sprintf(buf, "rsn_ie="); + for (i = 0; i < rsn_len; i++) { + n += snprintf(buf + n, MAX_WPA_IE_LEN - n, + "%02x", rsn_ie[i]); + if (n >= MAX_WPA_IE_LEN) + break; + } + memset(iwe, 0, sizeof(*iwe)); + iwe->cmd = IWEVCUSTOM; + iwe->u.data.length = strlen(buf); + start = iwe_stream_add_point(info, start, stop, + iwe, buf); + memset(iwe, 0, sizeof(*iwe)); + iwe->cmd = IWEVGENIE; + iwe->u.data.length = rsn_len; + start = iwe_stream_add_point(info, start, stop, iwe, + rsn_ie); + } + + return start; +} + +static noinline_for_stack char *translate_scan_wps(struct iw_request_info *info, + struct wlan_network *pnetwork, + struct iw_event *iwe, + char *start, char *stop) +{ + /* parsing WPS IE */ + u8 wps_ie[512]; + uint wps_ielen; + + if (r8712_get_wps_ie(pnetwork->network.IEs, + pnetwork->network.IELength, + wps_ie, &wps_ielen)) { + if (wps_ielen > 2) { + iwe->cmd = IWEVGENIE; + iwe->u.data.length = (u16)wps_ielen; + start = iwe_stream_add_point(info, start, stop, + iwe, wps_ie); + } + } + + return start; +} + +static char *translate_scan(struct _adapter *padapter, + struct iw_request_info *info, + struct wlan_network *pnetwork, + char *start, char *stop) { struct iw_event iwe; struct ieee80211_ht_cap *pht_capie; @@ -257,73 +338,11 @@ static noinline_for_stack char *translat /* Check if we added any event */ if ((current_val - start) > iwe_stream_lcp_len(info)) start = current_val; - /* parsing WPA/WPA2 IE */ - { - u8 buf[MAX_WPA_IE_LEN]; - u8 wpa_ie[255], rsn_ie[255]; - u16 wpa_len = 0, rsn_len = 0; - int n; - - r8712_get_sec_ie(pnetwork->network.IEs, - pnetwork->network.IELength, rsn_ie, &rsn_len, - wpa_ie, &wpa_len); - if (wpa_len > 0) { - memset(buf, 0, MAX_WPA_IE_LEN); - n = sprintf(buf, "wpa_ie="); - for (i = 0; i < wpa_len; i++) { - n += snprintf(buf + n, MAX_WPA_IE_LEN - n, - "%02x", wpa_ie[i]); - if (n >= MAX_WPA_IE_LEN) - break; - } - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVCUSTOM; - iwe.u.data.length = (u16)strlen(buf); - start = iwe_stream_add_point(info, start, stop, - &iwe, buf); - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = (u16)wpa_len; - start = iwe_stream_add_point(info, start, stop, - &iwe, wpa_ie); - } - if (rsn_len > 0) { - memset(buf, 0, MAX_WPA_IE_LEN); - n = sprintf(buf, "rsn_ie="); - for (i = 0; i < rsn_len; i++) { - n += snprintf(buf + n, MAX_WPA_IE_LEN - n, - "%02x", rsn_ie[i]); - if (n >= MAX_WPA_IE_LEN) - break; - } - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVCUSTOM; - iwe.u.data.length = strlen(buf); - start = iwe_stream_add_point(info, start, stop, - &iwe, buf); - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = rsn_len; - start = iwe_stream_add_point(info, start, stop, &iwe, - rsn_ie); - } - } - { /* parsing WPS IE */ - u8 wps_ie[512]; - uint wps_ielen; - - if (r8712_get_wps_ie(pnetwork->network.IEs, - pnetwork->network.IELength, - wps_ie, &wps_ielen)) { - if (wps_ielen > 2) { - iwe.cmd = IWEVGENIE; - iwe.u.data.length = (u16)wps_ielen; - start = iwe_stream_add_point(info, start, stop, - &iwe, wps_ie); - } - } - } + start = translate_scan_wpa(info, pnetwork, &iwe, start, stop); + + start = translate_scan_wps(info, pnetwork, &iwe, start, stop); + /* Add quality statistics */ iwe.cmd = IWEVQUAL; rssi = r8712_signal_scale_mapping(pnetwork->network.Rssi);