Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp962222imw; Fri, 15 Jul 2022 16:57:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tKw1TbDnHODKg2a++W72aevBUsmkAUhF4ObsjIiIB9XTcA5Z2n4XC127oGsoI2mpuXUWdI X-Received: by 2002:a63:1259:0:b0:40d:d290:24ef with SMTP id 25-20020a631259000000b0040dd29024efmr14490130pgs.141.1657929461992; Fri, 15 Jul 2022 16:57:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657929461; cv=none; d=google.com; s=arc-20160816; b=HdKguWhkiX1rDbXh1T0u7bQ/UfZuisTKKE25lNaKktypOiGEVES2mx/UAu+AQ6n/dV R2gwRen0mR3xkQrze75T4VKR6ukyBexQYdN6t/jAigvneMchFUykAIPyJVxih1cxsX1h ee3NUuLvjbuRy3yIH9Z1+PlX0aGaDmOS5on1sY7enxAJnx/u+Z4+drmhgWc4sgf0hVjn 1cXu4SDxYBBqIFthWZODdAwde/7zmvTW9AudoqIwCcEMIfh26+TZv4m73+I/zV4nws3W 75TeUkq0tgp6iJbg7HZkDctn3nKr/7GGK+fQ6TU2j/DAeuk9xO+maG2ocoob5PyEhxAY WhzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:date:from:references:in-reply-to :message-id:dkim-signature; bh=xq+qB+6LSBSIw4B37E9JgHNJIm1VN9v6g48FmouXfvs=; b=mLdUMgW+tlD7mxf0SV1A5Y2e2mmioQ0hZb8biLhtDTesFuNezGrxPtjcbTry/6lie6 yr8kNklO9LPCXrxfzJ9zK6TT8vI1k1fRiCfVfK/g5n5muxJ1lHF+yQF4/tY28wMcVfRF q0JX/5z1Q//w77Qe+z/ByKNk2rw6MMBDh8sXrz+QZk4tnRu1Z1A7hLPLWcqgtIpb2OUp cHfLPKC1qmUT7d3U1SMspYywvrSCwW7gemu6UjonWu8CLeSHl1ymMG79kpJWrA2LxdyC EMJoZhEApGj9Rqcl4DrgUvgXpr6zpiCt0D+V8JTsrAIQEgUCh0juky0qKs5OASE9/P0a yXJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crudebyte.com header.s=lizzy header.b=PfR2RMgc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=crudebyte.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o1-20020a056a0015c100b0052aaf7fecd0si8520664pfu.18.2022.07.15.16.57.27; Fri, 15 Jul 2022 16:57:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crudebyte.com header.s=lizzy header.b=PfR2RMgc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=crudebyte.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232676AbiGOX0z (ORCPT + 99 others); Fri, 15 Jul 2022 19:26:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232657AbiGOX03 (ORCPT ); Fri, 15 Jul 2022 19:26:29 -0400 X-Greylist: delayed 1830 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 15 Jul 2022 16:26:05 PDT Received: from lizzy.crudebyte.com (lizzy.crudebyte.com [91.194.90.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C35D95B19; Fri, 15 Jul 2022 16:26:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=xq+qB+6LSBSIw4B37E9JgHNJIm1VN9v6g48FmouXfvs=; b=PfR2R Mgcvo0wVAM8pQYMtGKaxu3eb+Anpl/ljkBpGDGBxS1YrgjsrtTWn+FCCeRt21TqMJGsdXKg+JvIyG wqK5pxbn7Dp6aSYvEIO9uedfa0+UZDjSa1m+HF/sh2hlCkA6WYUsjoVtwI3x1fR3xeDdPOMYGuazK ffLEMU0ebR2kqxn3QX5fZwR9WgWrS2XMh/uOkWUQSfS8HUB9iudGaUgAVyavXsA9jZOczO6TgLlPW Iqmc5g5GB1G3hlov3B0e33mH7MeBedxqNHKvYuYjjhvfvZRz7VkC9Dp+WZPjfsG7YvPL4e9BCQiAR hY3SDLjGb2Uqz7vyZ+BbV3HXqrCFQ==; Message-Id: <692c3018766fa2fbb8d2654abcb4e43790364a2c.1657920926.git.linux_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Fri, 15 Jul 2022 23:32:12 +0200 Subject: [PATCH v6 01/11] 9p/trans_virtio: separate allocation of scatter gather list To: v9fs-developer@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Dominique Martinet , Eric Van Hensbergen , Latchesar Ionkov , Nikolay Kichukov X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The scatter gather list in struct virtio_chan currently resides as compile-time constant size array directly within the contiguous struct virtio_chan's memory space. Separate memory space and allocation of the scatter gather list from memory space and allocation of struct virtio_chan. Signed-off-by: Christian Schoenebeck --- net/9p/trans_virtio.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index b24a4fb0f0a2..2693e618080c 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c @@ -77,7 +77,7 @@ struct virtio_chan { */ unsigned long p9_max_pages; /* Scatterlist: can be too big for stack. */ - struct scatterlist sg[VIRTQUEUE_NUM]; + struct scatterlist *sg; /** * @tag: name to identify a mount null terminated */ @@ -574,6 +574,14 @@ static int p9_virtio_probe(struct virtio_device *vdev) goto fail; } + chan->sg = kmalloc_array(VIRTQUEUE_NUM, + sizeof(struct scatterlist), GFP_KERNEL); + if (!chan->sg) { + pr_err("Failed to allocate virtio 9P channel\n"); + err = -ENOMEM; + goto out_free_chan_shallow; + } + chan->vdev = vdev; /* We expect one virtqueue, for requests. */ @@ -635,6 +643,8 @@ static int p9_virtio_probe(struct virtio_device *vdev) out_free_vq: vdev->config->del_vqs(vdev); out_free_chan: + kfree(chan->sg); +out_free_chan_shallow: kfree(chan); fail: return err; @@ -728,6 +738,7 @@ static void p9_virtio_remove(struct virtio_device *vdev) kobject_uevent(&(vdev->dev.kobj), KOBJ_CHANGE); kfree(chan->tag); kfree(chan->vc_wq); + kfree(chan->sg); kfree(chan); } -- 2.30.2