From patchwork Tue Nov 19 15:47:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Johnson X-Patchwork-Id: 13880204 X-Patchwork-Delegate: quic_jjohnson@quicinc.com Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59E131CD1FA; Tue, 19 Nov 2024 15:47:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732031275; cv=none; b=do7jifA/j9BbTXL49xAr9en2YRpZKGGF63vALZ9ie4Qx0h03ZYSPZYuKFjneiBXhNBI5jMJLf249YwxhlJ+JOgjz6fDpCsg0KlUf3JPW4wvRH/q3+5YkSYrmDqnipjcsx00F/gMbd8nrb9vTJYXupjXyNoSpcIzTqRHto1de4F8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732031275; c=relaxed/simple; bh=5MF/eHFxhz4lLiYgNMoLEJmeQOGm6mspTqQslf4kDSA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=fe7+p7puCF+9QHwLIjsMx0oPoiN5NEXA5UgWBES5h+Hn/gd7F8ZhVLOg/2+WfuRwOsnCoN7t/4KGNiiuz1XRx3EaNWA+WfMGesFN4zUwUSON11yRzDdySOOrolG1z79xdr0nOSA46GBip6Q8mcTifOigQ5+oezQN+eRgC7oXAnI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=TZbPbM8h; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="TZbPbM8h" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AJ7tGMx004845; Tue, 19 Nov 2024 15:47:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= X087BfXQg6BD2sjwe/yB8ONSWahVOcFU4h791bEZ9Vk=; b=TZbPbM8hEKGGsMq+ vFjKsZP4Bl78ijmIuXj9kmJimJIjYXCZji2UMt0dTmwpa8tchlDy8c++rHbsp6rg KRaDzBGWw/I4JiJKMVaJm31U+4lyIJKM3wJk1FDur2vZIGmTCE1fUUPVn5zI+oie XfD//vhss4Y0XDy6iHcfuBAjhWWBGDCBh2dQqxNMzpN+k0dRubp0LPH2+9k6KbjT sUAhTzrJBjNmtkx/esoNcShR3oLXYHYacBkrR6ULX021DOqDfzCufNaoExGU8lAc 8f8aU6PdFTWlCXzoaBcosg960FYKkYHNec34kGbAIXh4cxQEsDeNfyepvCbA60Hg SkMSgA== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4308y7ty0f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Nov 2024 15:47:46 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 4AJFljoW020030 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Nov 2024 15:47:45 GMT Received: from [169.254.0.1] (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 19 Nov 2024 07:47:44 -0800 From: Jeff Johnson Date: Tue, 19 Nov 2024 07:47:38 -0800 Subject: [PATCH 1/3] wifi: ath11k: mark some QMI driver event helpers as noinline Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20241119-ath11k-noinline-v1-1-4ec0a8aa30b2@quicinc.com> References: <20241119-ath11k-noinline-v1-0-4ec0a8aa30b2@quicinc.com> In-Reply-To: <20241119-ath11k-noinline-v1-0-4ec0a8aa30b2@quicinc.com> To: Kalle Valo , Jeff Johnson , "Nathan Chancellor" , Nick Desaulniers , Bill Wendling , Justin Stitt , "Arnd Bergmann" CC: , , , , Jeff Johnson X-Mailer: b4 0.14.0 X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: ANTenyc0ixLNJC7vqakfpwpD54qyl3Hy X-Proofpoint-ORIG-GUID: ANTenyc0ixLNJC7vqakfpwpD54qyl3Hy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 phishscore=0 spamscore=0 bulkscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411190117 When compiling the ath11k driver using clang with KASAN enabled, the following warning is observed: drivers/net/wireless/ath/ath11k/qmi.c:3199:13: warning: stack frame size (1560) exceeds limit (1024) in 'ath11k_qmi_driver_event_work' [-Wframe-larger-than] This is similar to the issue found in ath12k/qmi.c that was discussed in [1] and fixed with [2]. The issue is that clang inlining can explode stack usage. Just as in ath12k, ath11k_qmi_driver_event_work() itself is a pretty lightweight function, but it dispatches to several other functions which do the real work: ath11k_qmi_driver_event_work() ath11k_qmi_event_server_arrive() ath11k_qmi_fw_ind_register_send() ath11k_qmi_host_cap_send() * ath11k_qmi_event_load_bdf() ath11k_qmi_event_mem_request() ath11k_qmi_respond_fw_mem_request() ath11k_qmi_event_load_bdf() ath11k_qmi_wlanfw_m3_info_send() * ath11k_qmi_m3_load() ath11k_qmi_process_coldboot_calibration() Of these, the two marked with * have non-trivial stack usage. Mark those functions as 'noinline_for_stack' to prevent them from being inlined in ath12k_qmi_driver_event_work(), thereby eliminating the excessive stack usage. Note that this approach is a bit more "surgical" than the ath12k approach as only the two functions with the largest stack usage are modified. Link: https://msgid.link/bc214795-1c51-4cb7-922f-67d6ef98bff2@quicinc.com # [1] Link: https://patch.msgid.link/20241028-ath12k_qmi_driver_event_work-v1-1-0d532eb593fa@quicinc.com # [2] Signed-off-by: Jeff Johnson Acked-by: Kalle Valo --- drivers/net/wireless/ath/ath11k/qmi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c index 7a22483b35cd..5759fc521316 100644 --- a/drivers/net/wireless/ath/ath11k/qmi.c +++ b/drivers/net/wireless/ath/ath11k/qmi.c @@ -1704,7 +1704,9 @@ static const struct qmi_elem_info qmi_wlfw_fw_init_done_ind_msg_v01_ei[] = { }, }; -static int ath11k_qmi_host_cap_send(struct ath11k_base *ab) +/* clang stack usage explodes if this is inlined */ +static noinline_for_stack +int ath11k_qmi_host_cap_send(struct ath11k_base *ab) { struct qmi_wlanfw_host_cap_req_msg_v01 req; struct qmi_wlanfw_host_cap_resp_msg_v01 resp; @@ -2570,7 +2572,9 @@ static void ath11k_qmi_m3_free(struct ath11k_base *ab) m3_mem->size = 0; } -static int ath11k_qmi_wlanfw_m3_info_send(struct ath11k_base *ab) +/* clang stack usage explodes if this is inlined */ +static noinline_for_stack +int ath11k_qmi_wlanfw_m3_info_send(struct ath11k_base *ab) { struct m3_mem_region *m3_mem = &ab->qmi.m3_mem; struct qmi_wlanfw_m3_info_req_msg_v01 req; From patchwork Tue Nov 19 15:47:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Johnson X-Patchwork-Id: 13880207 X-Patchwork-Delegate: quic_jjohnson@quicinc.com Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A70E1D0DE2; Tue, 19 Nov 2024 15:47:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732031279; cv=none; b=HnpPpvRWZ0BQBXRTtBdcWwq4UWvT0qVmPVtajNO5O4tocYMUcYz4WZsfKq0ezayYKhpkQ0KLSQbKYmN8Q+VIFQ/6CAGa2VuzXvgsT/ARQadIgdObOOVXY/uOVCYr0jECu+tDvqlCJa+lAo0xpNR/rgCm6LqZAub9PGNJED+fTvY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732031279; c=relaxed/simple; bh=cLw12Zjh6zUfG86/iyBkPkfgzbOqHF0Ea4GJvzYXXb0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=c2PVLKL2+RF0jxxH1cz37uQRZ/D84B7qir2PD9UixPqc8yuyp4xnX9l/5ooBNJMEDlnf3wVyCSx+eM1Fbca2sHf1ZeLsJoSIMKCH9GaD1LGDkTkNeUDmLNKTRG4rAyYvYWU0PZUcgSwrhWL/vylvurxHJ3vx6fFNTwYiE3oMhvU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=B0fvycUA; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="B0fvycUA" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AJ7tQpF028408; Tue, 19 Nov 2024 15:47:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= EGSwUJHgOxgr1HMRtCMrkYZZWmUpYkPwRq8EfT9qEz8=; b=B0fvycUA0nLOys3S UPpBXpI1keFd54UqrIBn/4S2iX8LWPwAAyh0H/XjEHJPAIZcK3g3453AXG+kB4HD +/Cr6D11HbJ4DHgNbSaj62uwoeIZw1OceUfdYkXeO5/FJkmIRAZ4nmR7Kdxq1FOm AihAtaoNAnOQSCMjFXu4VeadzJELGT6iBfZKcMggyj5cZPwLWl3FY9ph6Be5P825 QMmqmE9BKwzXpAC0n1HoFFJ76Y0OjhM5ayFoJKsfXGyUWWdr4X7vgFdc+oi48qaP 4Xol05RTUQr1+jVGLA/ikGFOG3jURyPUqW+RsjctTuQCGZAFoE8C4Gz5iUUddHm0 +FM56g== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4308y5tyqu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Nov 2024 15:47:45 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 4AJFljga008291 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Nov 2024 15:47:45 GMT Received: from [169.254.0.1] (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 19 Nov 2024 07:47:45 -0800 From: Jeff Johnson Date: Tue, 19 Nov 2024 07:47:39 -0800 Subject: [PATCH 2/3] wifi: ath11k: mark ath11k_dp_rx_mon_mpdu_pop() as noinline Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20241119-ath11k-noinline-v1-2-4ec0a8aa30b2@quicinc.com> References: <20241119-ath11k-noinline-v1-0-4ec0a8aa30b2@quicinc.com> In-Reply-To: <20241119-ath11k-noinline-v1-0-4ec0a8aa30b2@quicinc.com> To: Kalle Valo , Jeff Johnson , "Nathan Chancellor" , Nick Desaulniers , Bill Wendling , Justin Stitt , "Arnd Bergmann" CC: , , , , Jeff Johnson X-Mailer: b4 0.14.0 X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: sw7WdpPCnlm3rNfk5s6_Gdlp0txLOK8r X-Proofpoint-ORIG-GUID: sw7WdpPCnlm3rNfk5s6_Gdlp0txLOK8r X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 suspectscore=0 malwarescore=0 mlxscore=0 adultscore=0 clxscore=1015 spamscore=0 impostorscore=0 priorityscore=1501 mlxlogscore=926 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411190117 When compiling the ath11k driver using clang with KASAN enabled, the following warning is observed: drivers/net/wireless/ath/ath11k/dp_rx.c:5244:5: warning: stack frame size (1304) exceeds limit (1024) in 'ath11k_dp_rx_process_mon_status' [-Wframe-larger-than] This is similar to the issue found in ath12k/qmi.c that was discussed in [1] and fixed with [2]. The issue is that clang inlining can explode stack usage. ath11k_dp_rx_process_mon_status() itself is a pretty lightweight function, but it dispatches to several other functions which do the real work: ath11k_dp_rx_process_mon_status() ath11k_dp_rx_reap_mon_status_ring() ath11k_dp_rx_mon_dest_process() ath11k_dp_rx_mon_mpdu_pop() * ath11k_dp_rx_mon_deliver() ath11k_dp_rx_mon_merg_msdus() ath11k_dp_rx_deliver_msdu() ath11k_dp_rx_update_peer_stats() Of these, only ath11k_dp_rx_mon_mpdu_pop() has non-trivial stack usage, so mark that function as 'noinline_for_stack' to prevent it from being inlined in ath11k_dp_rx_process_mon_status(), thereby eliminating the excessive stack usage. Link: https://msgid.link/bc214795-1c51-4cb7-922f-67d6ef98bff2@quicinc.com # [1] Link: https://patch.msgid.link/20241028-ath12k_qmi_driver_event_work-v1-1-0d532eb593fa@quicinc.com # [2] Signed-off-by: Jeff Johnson Acked-by: Kalle Valo --- drivers/net/wireless/ath/ath11k/dp_rx.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c index 40088e62572e..f253fac116bc 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -4690,11 +4690,12 @@ static void ath11k_dp_mon_get_buf_len(struct hal_rx_msdu_desc_info *info, } } -static u32 -ath11k_dp_rx_mon_mpdu_pop(struct ath11k *ar, int mac_id, - void *ring_entry, struct sk_buff **head_msdu, - struct sk_buff **tail_msdu, u32 *npackets, - u32 *ppdu_id) +/* clang stack usage explodes if this is inlined */ +static noinline_for_stack +u32 ath11k_dp_rx_mon_mpdu_pop(struct ath11k *ar, int mac_id, + void *ring_entry, struct sk_buff **head_msdu, + struct sk_buff **tail_msdu, u32 *npackets, + u32 *ppdu_id) { struct ath11k_pdev_dp *dp = &ar->dp; struct ath11k_mon_data *pmon = (struct ath11k_mon_data *)&dp->mon_data; From patchwork Tue Nov 19 15:47:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Johnson X-Patchwork-Id: 13880206 X-Patchwork-Delegate: quic_jjohnson@quicinc.com Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A5BF1D0DC9; Tue, 19 Nov 2024 15:47:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732031278; cv=none; b=QQA+14ZNiQBv4PS5ASc04HBtQschc8mI3lmNBOTJu3xdNbIsGeSwC8HjvvQGM6NTixxI6xhyxmyaLOXUil4a8+lo2QkJkbBiaz2Cb0LVZyNpY8iIyBaDpHWYC474d7l8eRQ/fmpnCn0Djiy2+sH3UStZOjT4E9XPoHmd9EiqtpE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732031278; c=relaxed/simple; bh=DGl/gJjPpBm9CT7fgRU2o+1qYAL1Nznv+5BYXHQlYTg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=cyuuYXrJkHfbFTSoaQbkruE31xOe6Pt1kniVVyIAWEf1NF18heY6Xya0JX/T5Kz/lt1aOjuEEV/pvoCCyJzQBT8E3X5YUU+AwHG3erN90/3bEzbT3MSkwiHkk+4ov+u8bENgsj6otTyl0r6HWwBm0sN4c122H26Sp1GQqcbYMjI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=TJoX1ZPW; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="TJoX1ZPW" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AJ7hvBX006081; Tue, 19 Nov 2024 15:47:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= AcYOEB0NFhdQWlr9OmvFY1dYwwPZ7UBBM5ddUWgGHqs=; b=TJoX1ZPW6k4XoV8w tLRKf6JySVmdaYZ8D9jkZOywhrIGurv1mMvZBGrRxwWVmf00ZQE5RH6TT2S9/Prb PzcQ2PVYMJGTaQdkmpBtGG8jtJeGGUZQoDDRGtkQh/1rHIx+IPrwxLKaYhc+rV8D ieIrB4V7NBGBWCrBUg3wcjQ0/NwuhLRT2UG2GT0pI4nOSGgyJldk62D7Up+TjNkZ u0zN/HWNPPXRQVIfb3qLrgXToRy34uX0mTYwKB/i9lxTCmx/JSZ1qm/m5naPWDfj Bx94sfith/6fRK+skqiYqzXsda2D4HBpzjiNJsza1x+gykD2r+40T89i8dM+BYtw JPkfgw== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4308y8k013-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Nov 2024 15:47:46 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 4AJFljuh016796 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Nov 2024 15:47:45 GMT Received: from [169.254.0.1] (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 19 Nov 2024 07:47:45 -0800 From: Jeff Johnson Date: Tue, 19 Nov 2024 07:47:40 -0800 Subject: [PATCH 3/3] wifi: ath11k: mark ath11k_wow_convert_8023_to_80211() as noinline Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20241119-ath11k-noinline-v1-3-4ec0a8aa30b2@quicinc.com> References: <20241119-ath11k-noinline-v1-0-4ec0a8aa30b2@quicinc.com> In-Reply-To: <20241119-ath11k-noinline-v1-0-4ec0a8aa30b2@quicinc.com> To: Kalle Valo , Jeff Johnson , "Nathan Chancellor" , Nick Desaulniers , Bill Wendling , Justin Stitt , "Arnd Bergmann" CC: , , , , Jeff Johnson X-Mailer: b4 0.14.0 X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 9NdK69iXssGbEhH_il1RCRipLQvEdYIz X-Proofpoint-GUID: 9NdK69iXssGbEhH_il1RCRipLQvEdYIz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxlogscore=979 lowpriorityscore=0 clxscore=1015 malwarescore=0 adultscore=0 impostorscore=0 mlxscore=0 spamscore=0 phishscore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411190117 When compiling the ath11k driver using clang with KASAN enabled, the following warning is observed: drivers/net/wireless/ath/ath11k/wow.c:672:5: warning: stack frame size (1336) exceeds limit (1024) in 'ath11k_wow_op_suspend' [-Wframe-larger-than] This is similar to the issue found in ath12k/qmi.c that was discussed in [1] and fixed with [2]. The issue is that clang inlining can explode stack usage. ath11k_wow_op_suspend() itself is a pretty lightweight function, but it dispatches to several other functions which do the real work. One path in particular is: ath11k_wow_op_suspend() ath11k_wow_set_wakeups() ath11k_vif_wow_set_wakeups() ath11k_wow_convert_8023_to_80211() Of these, ath11k_wow_convert_8023_to_80211() has non-trivial stack usage, so mark it as 'noinline_for_stack' to prevent it from being inlined in ath11k_wow_op_suspend(), thereby eliminating the excessive stack usage. Link: https://msgid.link/bc214795-1c51-4cb7-922f-67d6ef98bff2@quicinc.com # [1] Link: https://patch.msgid.link/20241028-ath12k_qmi_driver_event_work-v1-1-0d532eb593fa@quicinc.com # [2] Signed-off-by: Jeff Johnson Acked-by: Kalle Valo --- drivers/net/wireless/ath/ath11k/wow.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/wow.c b/drivers/net/wireless/ath/ath11k/wow.c index 827085a926b2..b6f08755129f 100644 --- a/drivers/net/wireless/ath/ath11k/wow.c +++ b/drivers/net/wireless/ath/ath11k/wow.c @@ -148,8 +148,10 @@ static int ath11k_wow_cleanup(struct ath11k *ar) * 802.11: |4B|dest mac(6B)| 6B |src mac(6B)| 8B |type(2B)| body... | * +--+------------+----+-----------+---------------+-----------+ */ -static void ath11k_wow_convert_8023_to_80211(struct cfg80211_pkt_pattern *new, - const struct cfg80211_pkt_pattern *old) +/* clang stack usage explodes if this is inlined */ +static noinline_for_stack +void ath11k_wow_convert_8023_to_80211(struct cfg80211_pkt_pattern *new, + const struct cfg80211_pkt_pattern *old) { u8 hdr_8023_pattern[ETH_HLEN] = {}; u8 hdr_8023_bit_mask[ETH_HLEN] = {};