Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1152514pxu; Fri, 27 Nov 2020 00:34:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwqdh5CeAVWhYz9IaCThBkJYhGWv/SlFh8aG5kv9CNhSijy2xDn8kmNGcwY8LKzDiOTHr0q X-Received: by 2002:aa7:d459:: with SMTP id q25mr6612696edr.104.1606466084479; Fri, 27 Nov 2020 00:34:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606466084; cv=none; d=google.com; s=arc-20160816; b=GklzDOtxBFCC0XYdPUN+NY44dcX4+h94RKISRtt53Oa/6f7d2765+QJ02Q600LoVTu who65YSMTwCPADVman6AY3IV5+ckdK4RcJJk51bakIbZIC+IgSAb2fdjD7L9kj8mpbC/ wmHVeyZqx7AzcKXUZX4X4AP0+qaO7CdH6QwTk3d8sU8/6bjysDuXLQnYn6WTawkTx/zI 9IU7GNRdnJ1pos+a3vtLOizc0Db0T4RBAFul1f5tfhZpjOTnZ81h1POaIXYW0HtKtp9u TJI5vvqqZaF7Dk+mGzIlzxRNR08uzi+VbN+tbciOcVki7ggu59g6/hc+6RdCB0Lip/+E gnoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Yd5o1ZhT6n3IllGPM9QevybiC1ZAZ/hson6rMvA9R3Y=; b=O9l4QqTbicO2BxKoRBxHPILaoQUjAQD9qzHInBgg0Axa1+d6tgzOm2gPcbHDtu3wl2 CfDgX/ruzMAS77JIPm2hwXTdA0rMRAetXBeFOKMkXP+O6LOy8SJ3UEB3BT0+fWteoawP CHTdWXK1fVa6+D07Xz08WfGNn9oDPfq0d858xcOlPOIchVvD6dgTwdUjdUquBC6KHqG7 PE4644d62IqmqXXQW1BPcZ8AsxhltY8VitPbY6KUiBR4/wAVjadZ/iWQaZzxQxdLRbWx 860+vt7ZXg7YQR4IqTnR48MAAWP5U6EYjW3M8Q2alcT0hxUBnz5XEOlFEALccEXznIlX 9CDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=J+tA97uL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c15si4901007edf.17.2020.11.27.00.34.21; Fri, 27 Nov 2020 00:34:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=J+tA97uL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391208AbgKZOwC (ORCPT + 99 others); Thu, 26 Nov 2020 09:52:02 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45021 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388331AbgKZOwB (ORCPT ); Thu, 26 Nov 2020 09:52:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606402320; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yd5o1ZhT6n3IllGPM9QevybiC1ZAZ/hson6rMvA9R3Y=; b=J+tA97uL+uV21kizknVIkGjhr0tQF7ulLU4oV/wOXmF4cZdjo4XH2FB7jkZza4JZbVpWjN kzmQJ14suG0plylaxYcJJTOJNTvmAnP0AdsrEiopPsHZgcNfBNpkA7XJrsWoy3KCTaxxVq RQoyY4xq44i/aiSkerzoLeICEtKfy10= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-431-PX7VQgOZO52-vMZDb_ZqFg-1; Thu, 26 Nov 2020 09:51:56 -0500 X-MC-Unique: PX7VQgOZO52-vMZDb_ZqFg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3D87E1E7DB; Thu, 26 Nov 2020 14:51:55 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-113-252.ams2.redhat.com [10.36.113.252]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7673E60855; Thu, 26 Nov 2020 14:51:53 +0000 (UTC) From: Stefano Garzarella To: virtualization@lists.linux-foundation.org Cc: Stefan Hajnoczi , linux-kernel@vger.kernel.org, Laurent Vivier , Max Gurtovoy , "Michael S. Tsirkin" , Eli Cohen , Jason Wang Subject: [PATCH v2 14/17] vdpa_sim: use kvmalloc to allocate vdpasim->buffer Date: Thu, 26 Nov 2020 15:49:47 +0100 Message-Id: <20201126144950.92850-15-sgarzare@redhat.com> In-Reply-To: <20201126144950.92850-1-sgarzare@redhat.com> References: <20201126144950.92850-1-sgarzare@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The next patch will make the buffer size configurable from each device. Since the buffer could be larger than a page, we use kvmalloc() instead of kmalloc(). Acked-by: Jason Wang Signed-off-by: Stefano Garzarella --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c index 4327efd6d41e..3bcf622949c8 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c @@ -405,7 +405,7 @@ static struct vdpasim *vdpasim_create(struct vdpasim_dev_attr *dev_attr) if (!vdpasim->iommu) goto err_iommu; - vdpasim->buffer = kmalloc(PAGE_SIZE, GFP_KERNEL); + vdpasim->buffer = kvmalloc(PAGE_SIZE, GFP_KERNEL); if (!vdpasim->buffer) goto err_iommu; @@ -686,7 +686,7 @@ static void vdpasim_free(struct vdpa_device *vdpa) struct vdpasim *vdpasim = vdpa_to_sim(vdpa); cancel_work_sync(&vdpasim->work); - kfree(vdpasim->buffer); + kvfree(vdpasim->buffer); if (vdpasim->iommu) vhost_iotlb_free(vdpasim->iommu); kfree(vdpasim->vqs); -- 2.26.2