Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp766680rdb; Thu, 22 Feb 2024 21:31:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV0ZCAAzKpEiXvIBLzDJyYU6oJlV4rCEOS/lgwsCQ1Hqk6s5JAX/OBUJE+P+1A3aP/LS1M+aWKxykJs6Net15KLZM1Leekxj9ot0cVCcA== X-Google-Smtp-Source: AGHT+IH24PZCGV7+HWUXA9iRE3vrW+BBSMg8fMk4amwc5PyVobRMIi6seVXzQF8CikW2aCLgwkti X-Received: by 2002:a17:906:2409:b0:a3f:4fd7:3cf5 with SMTP id z9-20020a170906240900b00a3f4fd73cf5mr440358eja.17.1708666319441; Thu, 22 Feb 2024 21:31:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708666319; cv=pass; d=google.com; s=arc-20160816; b=IKKNLSRkZMXXuB1MOs5xGlssdvQ8C64JM7dRTL34gnjmY+tEJBWuG0M/rAG0G9Sl0x EAEU17S0JDl4ROuyGFnMRVbl22zS7naalvrdq+gc2+fJFori9XF4YmAQkYkJvYI0k0XV t0B8JJIGKXURUh2GvwpTLLdi9gLk0tWRgBH2jXjWcHyqCiqieeoFg+Ca5kWHV2oNjW4c n2awPA5kufHSrokwbV1nWwKJCJ52gdtJ7eUf/M5EE7ZV3NJjfa4mdpvKOSERARTtxTzL kwbf40qXsG6nEyPrpVW/nN6jzCVOg4okjbLlkEkWR1123ZCRv3NleQ9NO3dNTumgwu/k dLhw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=/ix5n4Uy7ZZck+FQJQw+eupkhQcsnzI4Byt+3vQeupU=; fh=j480mrNlK527R2LSjAa5EczedEomDzgwrIPbXwRGWTc=; b=CN39pJOMrmLfnbGEvJ5iZfMlhoqt2AR5+E2+ou8zX4rr9Qt10XZLYsoKwTx/jJLSnQ iLQPc3n1vIGC/BNQ2oyBrAPrg+GafAyrzlKFm3XSMv7NB2sDJdoLvhzPOSXiijqX/ih/ E9fXwcgNl1623wjPCZrNXWeQVt0UJk7OBNxPeUiu8FjUfum9KFfHNvC5hAQ7mERzUQpO QTbEgwTwvKQ9GlHkIhfbol8ri6dz/OG8UZfkuvovEFMTA2kqZMIZ4eVgi/eUcQO8banQ F5vB4fCQNuNrOfFa4eLopHRgPeNDp/DS42Fj6fhTW3LN/z99UPb/xaLwu0OSYxckftCY y6EQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ShuwfJh+; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-3946-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3946-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id o6-20020a1709061b0600b00a3f7fd43281si1173027ejg.611.2024.02.22.21.31.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 21:31:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-3946-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ShuwfJh+; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-3946-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3946-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 96C3B1F241B3 for ; Fri, 23 Feb 2024 05:31:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3306B101E3; Fri, 23 Feb 2024 05:31:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="ShuwfJh+" X-Original-To: linux-wireless@vger.kernel.org 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 6F9B6F9EB for ; Fri, 23 Feb 2024 05:31: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=1708666315; cv=none; b=X0RotvUoRyRCSRxQCrc40jVHZiOv990SM10tOr/WOOqMirDglD5aNgDskla00j9oN/JHTKoaNmSwPLTG9VcOy+Ue9vS4TtSZe2Xak29E8yVVxGD8PgVdhd3F/kN4uJ4va/FSKfOX411cYgvLd7oEjh6P+0N/ZykI0HtuxEAq9Q8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708666315; c=relaxed/simple; bh=3iTGB0AlOkie2QnOK6aAlTVThY9Go1Obbhzz2H0VMlQ=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=VUgKD6KZzvfSEd40dwkI+K3O1Yq+JZo1fzOdYadftJ8zyBUFh0v/ma7cMmO/zuD8GbaUOrGTVhjYDvHyl7ZQ6hGnlhN2QQmWYgCMlfWbGqDcXLTLSPQYkKf9tdXXp31txKC1Tkgle31rTR5IRT12KBQ7cPahXytI4R2RWeyyxH0= 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=ShuwfJh+; 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 Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41N1sGfp010430; Fri, 23 Feb 2024 05:31:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=qcppdkim1; bh=/ix5n4U y7ZZck+FQJQw+eupkhQcsnzI4Byt+3vQeupU=; b=ShuwfJh+lFs7N0OsA7shgjx SgjuwCY4+obTjfwuuE85Y2kqgs4OjDjt58D9hD101I8YWzraEc9z1weyOAAgIYyM sMYQyYlWwMPyLf+QObYcJyFabFbntoBaJ7C6MXRb7h+TVbKhUDk/YW9xmYgI8wCK vwhI3zbrL40DljH9O+JSjLWQVxgr3LvCPCq7s5k1okFSAIPI82h/NoHDFJTyzc3p BBiu9TXsJK2JEsR+bVJoeRqAXiiiur7Q7uSc32rKWMvBhG1Yj/gODN/pJnFWJUT4 UwzqhzLmWala01x6jKxamaHgc8Kocd8FxkE0aeHbvLOlb3We+DIqraqOgKls9Vw= = Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3weedkru8c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 05:31:31 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41N5VVnw002597 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 05:31:31 GMT Received: from bqiang-SFF.qca.qualcomm.com (10.80.80.8) 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.1118.40; Thu, 22 Feb 2024 21:31:29 -0800 From: Baochen Qiang To: CC: , Subject: [PATCH] wifi: ath11k: decrease MHI channel buffer length to 8KB Date: Fri, 23 Feb 2024 13:31:11 +0800 Message-ID: <20240223053111.29170-1-quic_bqiang@quicinc.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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: oGn3GiT7OAvn6WmeSJ_KZgpqgxdUkoz- X-Proofpoint-GUID: oGn3GiT7OAvn6WmeSJ_KZgpqgxdUkoz- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_15,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=717 phishscore=0 suspectscore=0 spamscore=0 adultscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402230037 Currently buf_len field of ath11k_mhi_config_qca6390 is assigned with 0, making MHI use a default size, 64KB, to allocate channel buffers. This is likely to fail in some scenarios where system memory is highly fragmented and memory compaction or reclaim is not allowed. There is a fail report which is caused by it: kworker/u32:45: page allocation failure: order:4, mode:0x40c00(GFP_NOIO|__GFP_COMP), nodemask=(null),cpuset=/,mems_allowed=0 CPU: 0 PID: 19318 Comm: kworker/u32:45 Not tainted 6.8.0-rc3-1.gae4495f-default #1 openSUSE Tumbleweed (unreleased) 493b6d5b382c603654d7a81fc3c144d59a1dfceb Workqueue: events_unbound async_run_entry_fn Call Trace: dump_stack_lvl+0x47/0x60 warn_alloc+0x13a/0x1b0 ? srso_alias_return_thunk+0x5/0xfbef5 ? __alloc_pages_direct_compact+0xab/0x210 __alloc_pages_slowpath.constprop.0+0xd3e/0xda0 __alloc_pages+0x32d/0x350 ? mhi_prepare_channel+0x127/0x2d0 [mhi 40df44e07c05479f7a6e7b90fba9f0e0031a7814] __kmalloc_large_node+0x72/0x110 __kmalloc+0x37c/0x480 ? mhi_map_single_no_bb+0x77/0xf0 [mhi 40df44e07c05479f7a6e7b90fba9f0e0031a7814] ? mhi_prepare_channel+0x127/0x2d0 [mhi 40df44e07c05479f7a6e7b90fba9f0e0031a7814] mhi_prepare_channel+0x127/0x2d0 [mhi 40df44e07c05479f7a6e7b90fba9f0e0031a7814] __mhi_prepare_for_transfer+0x44/0x80 [mhi 40df44e07c05479f7a6e7b90fba9f0e0031a7814] ? __pfx_____mhi_prepare_for_transfer+0x10/0x10 [mhi 40df44e07c05479f7a6e7b90fba9f0e0031a7814] device_for_each_child+0x5c/0xa0 ? __pfx_pci_pm_resume+0x10/0x10 ath11k_core_resume+0x65/0x100 [ath11k a5094e22d7223135c40d93c8f5321cf09fd85e4e] ? srso_alias_return_thunk+0x5/0xfbef5 ath11k_pci_pm_resume+0x32/0x60 [ath11k_pci 830b7bfc3ea80ebef32e563cafe2cb55e9cc73ec] ? srso_alias_return_thunk+0x5/0xfbef5 dpm_run_callback+0x8c/0x1e0 device_resume+0x104/0x340 ? __pfx_dpm_watchdog_handler+0x10/0x10 async_resume+0x1d/0x30 async_run_entry_fn+0x32/0x120 process_one_work+0x168/0x330 worker_thread+0x2f5/0x410 ? __pfx_worker_thread+0x10/0x10 kthread+0xe8/0x120 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x34/0x50 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1b/0x30 Actually those buffers are used only by QMI target -> host communication. And for WCN6855 and QCA6390, the largest packet size for that is less than 6KB. So change buf_len field to 8KB, which results in order 1 allocation if page size is 4KB. In this way, we can at least save some memory, and as well as decrease the possibility of allocation failure in those scenarios. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.30 Reported-by: Vlastimil Babka Closes: https://lore.kernel.org/ath11k/96481a45-3547-4d23-ad34-3a8f1d90c1cd@suse.cz/ Signed-off-by: Baochen Qiang --- drivers/net/wireless/ath/ath11k/mhi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/mhi.c b/drivers/net/wireless/ath/ath11k/mhi.c index b53659145fcf..a5b9ec2ed8f8 100644 --- a/drivers/net/wireless/ath/ath11k/mhi.c +++ b/drivers/net/wireless/ath/ath11k/mhi.c @@ -106,7 +106,7 @@ static struct mhi_controller_config ath11k_mhi_config_qca6390 = { .max_channels = 128, .timeout_ms = 2000, .use_bounce_buf = false, - .buf_len = 0, + .buf_len = 8192, .num_channels = ARRAY_SIZE(ath11k_mhi_channels_qca6390), .ch_cfg = ath11k_mhi_channels_qca6390, .num_events = ARRAY_SIZE(ath11k_mhi_events_qca6390), base-commit: 707e306f3573fa321ae197d77366578e4566cff5 -- 2.25.1