Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1238406lqj; Mon, 3 Jun 2024 14:58:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV3l8oysAT+Gx27XHCeZ1AmSYc7yACbEcFPdWwXo34p8dBB5Ueyjnt7NP5+Bk8jtNm8+yrxpMo+ItsslgoJH7TvZvI9w8d2YYNZ1hkTzg== X-Google-Smtp-Source: AGHT+IHhfHzXeJ6yQigx8umqE2S4iqDguoQWgge/6bBIPGQK92WvD+ThjKfseJ6oNgVHpYRhdlCb X-Received: by 2002:a17:906:e0d4:b0:a68:b586:d4f6 with SMTP id a640c23a62f3a-a68b586d768mr481581166b.28.1717451914445; Mon, 03 Jun 2024 14:58:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717451914; cv=pass; d=google.com; s=arc-20160816; b=E6qDNmKfelWhJF8l9nQd/v+wdddwMJ2xfFbeSQs/Ba+VSlx21e3nTDh8jThZfr7VNI 19B85/EcEUUwyw9b3JR5mJEPE/RVfs/OQBTkkPetQmJ1mRG1ncnxIiIwEZA4qnOBw7zf /bSJyhtjAQL6oA+OXAuFIpWZN3oVskt2mmHzvspT8Nw1+y9U6gl7mDk82IBf+mrAtFXC uyLLkqGWdPIJJWUpsYZXJU+Mr4o+7VLPVeegABrKgmaqLrId51ZFH83s4agRGpBMEISI Iibfs3DQlNLQZvrqqHb2gEwJ72V17fwNDq2qAnsnlXMx4wIyLenasnbKShlaq99Ka/kL jx5g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=+huiNJRLt44NCN/r6bDMvnL/tWOjvPnxr5JvMN59Ows=; fh=YYJRn/0DMn5NksZ42CxKBe+li44XQVPE8Zh+Khk6g+E=; b=QEiEDPU6QPpoUL4doHcte7KG7DbPqR3VWOQHSJGyqGniyoCN61sr871XGEabJnFYPe a2TYuTjs3H4Lkyt5KefRdFn+fqHmurvuHfY9ry1UKkrmSwKsUJOv9i1twyN/osZM2MPg 1bAsbsram+OR7F7Ldiwz2lLo2RDI+52VQWPJsAtbAHZRYX5VuoK3TiYlF0iEZ+U4Cy6H GVrzr2GlqZDp3HQZqBfebMHYsD6uV92+TJxlqaa4TMo57bDkPlcgDEURxZ2R8S2Nt6JE psc7rjhhtwRNFU4LLec7zll5/UHm99VD8hdtflzFLZCXXkDYwGoqHgEYTgSozJuh933Z ITLg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=kgRBbbf3; 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-kernel+bounces-199747-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199747-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 a640c23a62f3a-a696371f2c7si636266b.380.2024.06.03.14.58.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 14:58:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199747-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=kgRBbbf3; 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-kernel+bounces-199747-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199747-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 99B611F2487D for ; Mon, 3 Jun 2024 21:57:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EEBE213C902; Mon, 3 Jun 2024 21:57:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="kgRBbbf3" 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 5FB793236; Mon, 3 Jun 2024 21:57:47 +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=1717451869; cv=none; b=mMawfEbYUeRWdiq0yYtRWCAk+Z5fXmH0AJ8WBHqBt1EpwSUP2s5OkTQyp1V4L3gI9LGEvo+I9sWpJkr5bUi9QvkuVSqm7pyzFlxrhipGsHhh9zy+v64LDkI9GyuuccaI+Xa7UNPmuSbqEZ4wsPUnlTdJ92/KyF+jPYAgsTiLlBI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717451869; c=relaxed/simple; bh=uGjlFGkxYZ4n2nf5+mWi19eRsaCZv5UkZwE+PGMYBB4=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=TRTtm9Uv/ysrpfRWDl51gcgzyLV53L+V/wFCW5jPub/j+rENOUAndIPDnArygup8JJqJD/9TX/w2iVyvANfuiyNX3pKWjKeooLA9m38Iow6QNA+twYnkSdnIY3PhKXQBGJyWFvuahQ6xVzw4dopDmVadTUxzgTEgDd9hC/WjGGI= 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=kgRBbbf3; 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 Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 453ASsNE015299; Mon, 3 Jun 2024 21:57:45 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= +huiNJRLt44NCN/r6bDMvnL/tWOjvPnxr5JvMN59Ows=; b=kgRBbbf3F8N+RvZy v3h1WYFs24UFg3u4O6SWivJdpRvFEAWZra4YVi3/rqoD6CvzxRVQ3LNTV+5a3ixt xRmkfabk/5rjHWn8NFOWAAUuXmM4gKK6Sprsd/ffCJFbvX3cYxCqtPI9XHuU/qHO V/Q8GDyEiY4YkqkOcZAW8nQqnOdVWuYnzMYFV8G6YwkbkEQ9EFiOC8KL69Nf3T9z Udr10aRZek1P3ZyoghvW+8fdpSQkSjgr/vgCr1mBq6IZwXNTmr+ejZm94CcFeYUq HMcREi5ysrSj76TLAuuLRnCi9FXoFPcLVxXLiavKBlSaPpoivxO6g9hFJRc60aKW tIteyw== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yfw5wn2fn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2024 21:57:45 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 453LviYm002952 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 3 Jun 2024 21:57:44 GMT Received: from [10.110.69.141] (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.1544.9; Mon, 3 Jun 2024 14:57:43 -0700 Message-ID: <5f2ea1a4-17a9-4fdd-badc-386b9cc57183@quicinc.com> Date: Mon, 3 Jun 2024 14:57:43 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] bus: mhi: ep: Do not allocate memory for MHI objects from DMA zone To: Manivannan Sadhasivam , CC: , , References: <20240603164354.79035-1-manivannan.sadhasivam@linaro.org> Content-Language: en-US From: Mayank Rana In-Reply-To: <20240603164354.79035-1-manivannan.sadhasivam@linaro.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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: 7sqVywnf2gZBqIARLB72d1cYTxFVVZtx X-Proofpoint-ORIG-GUID: 7sqVywnf2gZBqIARLB72d1cYTxFVVZtx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-06-03_17,2024-05-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 adultscore=0 suspectscore=0 priorityscore=1501 clxscore=1011 lowpriorityscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406030178 On 6/3/2024 9:43 AM, Manivannan Sadhasivam wrote: > MHI endpoint stack accidentally started allocating memory for objects from > DMA zone since commit 62210a26cd4f ("bus: mhi: ep: Use slab allocator Going through mentioned commit it seems that it was intended purpose to use GFP_DMA/SLAB > where applicable"). But there is no real need to allocate memory from this > naturally limited DMA zone. This also causes the MHI endpoint stack to run > out of memory while doing high bandwidth transfers. > > So let's switch over to normal memory. > > Cc: stable@vger.kernel.org # 6.8 > Fixes: 62210a26cd4f ("bus: mhi: ep: Use slab allocator where applicable") > Signed-off-by: Manivannan Sadhasivam > --- > drivers/bus/mhi/ep/main.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/drivers/bus/mhi/ep/main.c b/drivers/bus/mhi/ep/main.c > index f8f674adf1d4..4acfac73ca9a 100644 > --- a/drivers/bus/mhi/ep/main.c > +++ b/drivers/bus/mhi/ep/main.c > @@ -90,7 +90,7 @@ static int mhi_ep_send_completion_event(struct mhi_ep_cntrl *mhi_cntrl, struct m > struct mhi_ring_element *event; > int ret; > > - event = kmem_cache_zalloc(mhi_cntrl->ev_ring_el_cache, GFP_KERNEL | GFP_DMA); > + event = kmem_cache_zalloc(mhi_cntrl->ev_ring_el_cache, GFP_KERNEL); > if (!event) > return -ENOMEM; > > @@ -109,7 +109,7 @@ int mhi_ep_send_state_change_event(struct mhi_ep_cntrl *mhi_cntrl, enum mhi_stat > struct mhi_ring_element *event; > int ret; > > - event = kmem_cache_zalloc(mhi_cntrl->ev_ring_el_cache, GFP_KERNEL | GFP_DMA); > + event = kmem_cache_zalloc(mhi_cntrl->ev_ring_el_cache, GFP_KERNEL); > if (!event) > return -ENOMEM; > > @@ -127,7 +127,7 @@ int mhi_ep_send_ee_event(struct mhi_ep_cntrl *mhi_cntrl, enum mhi_ee_type exec_e > struct mhi_ring_element *event; > int ret; > > - event = kmem_cache_zalloc(mhi_cntrl->ev_ring_el_cache, GFP_KERNEL | GFP_DMA); > + event = kmem_cache_zalloc(mhi_cntrl->ev_ring_el_cache, GFP_KERNEL); > if (!event) > return -ENOMEM; > > @@ -146,7 +146,7 @@ static int mhi_ep_send_cmd_comp_event(struct mhi_ep_cntrl *mhi_cntrl, enum mhi_e > struct mhi_ring_element *event; > int ret; > > - event = kmem_cache_zalloc(mhi_cntrl->ev_ring_el_cache, GFP_KERNEL | GFP_DMA); > + event = kmem_cache_zalloc(mhi_cntrl->ev_ring_el_cache, GFP_KERNEL); > if (!event) > return -ENOMEM; > > @@ -438,7 +438,7 @@ static int mhi_ep_read_channel(struct mhi_ep_cntrl *mhi_cntrl, > read_offset = mhi_chan->tre_size - mhi_chan->tre_bytes_left; > write_offset = len - buf_left; > > - buf_addr = kmem_cache_zalloc(mhi_cntrl->tre_buf_cache, GFP_KERNEL | GFP_DMA); > + buf_addr = kmem_cache_zalloc(mhi_cntrl->tre_buf_cache, GFP_KERNEL); > if (!buf_addr) > return -ENOMEM; > > @@ -1481,14 +1481,14 @@ int mhi_ep_register_controller(struct mhi_ep_cntrl *mhi_cntrl, > > mhi_cntrl->ev_ring_el_cache = kmem_cache_create("mhi_ep_event_ring_el", > sizeof(struct mhi_ring_element), 0, > - SLAB_CACHE_DMA, NULL); > + 0, NULL); > if (!mhi_cntrl->ev_ring_el_cache) { > ret = -ENOMEM; > goto err_free_cmd; > } > > mhi_cntrl->tre_buf_cache = kmem_cache_create("mhi_ep_tre_buf", MHI_EP_DEFAULT_MTU, 0, > - SLAB_CACHE_DMA, NULL); > + 0, NULL); > if (!mhi_cntrl->tre_buf_cache) { > ret = -ENOMEM; > goto err_destroy_ev_ring_el_cache; Reviewed-by: Mayank Rana