Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4698370rwb; Tue, 6 Sep 2022 11:10:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR6LlsjRw+k6omGaFEsrTbaXW7MrW51ujIm6WOIGPYdBU8tJnvt6qchW3QUbadLr+NjzPkDj X-Received: by 2002:a17:902:e94e:b0:16d:12b6:b9fe with SMTP id b14-20020a170902e94e00b0016d12b6b9femr54412450pll.152.1662487857061; Tue, 06 Sep 2022 11:10:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662487857; cv=none; d=google.com; s=arc-20160816; b=JwdT77MuCkRCyw9ckHiN78hx8BfubzS81pwBf4QC2wnVGmq8+6NvU3Uf5a0hROSGwN zHn/FM+ofn/Sk6kVt769MxSC86CGTK5gi7YeTyosuawuA3L9F7+/2jNosb2zIa+6e8AT MPL4eByPThZ4YmhjiKGtOcZh/AmH45g44wInhqcApj8Q0PwmLjajumqg+/T7QFc1f4+w Fy6MHaMIehfoTsATcpEYRdudEOR2SS3nIjsDroXQ2iv3pgSnfwiyQ5Si6uQTDQsMqzab oPGUNCzb37Chw+PauhNalncuVBW86tIFXm5qUCKrN+eXpbfB8FTZLmn6N5S5DiDHp19S ZzXw== 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=CjoWo3+k+FJefuKDmYvTvnT+WX8ScIS7BJ8NLr7fgUk=; b=yFhzOp+KPkBz87RriYNL5lcIyqDi5sZEj+hdmXgTaZBk9xFV5Gv8npXY92nX7Va4OQ +8AFYsVdDU5R5KZU04nTyGhkNMHBAwbAS7jwU1UW1b8ygPR0aHctW4CqMLGJ2WL34ftO cqTQQGS3wpSFvu0HtRyqp+NIXHEtuByC//Z5Dy1JHkhMUTMSVNR1sGGuBEy6tK+ZWbun qDhLnipGJDVnE11nWhatgaLEYDZdELs1SLB+XqEPectx6HYN8tHbf1fx3naBHcSP2r+O wjGEkLwctNEXPtldQ/RgvGAfZC5sh5l/+SfA+vpBLx438pj7oVvae70qQvMBd4lpwNCv qFWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JPpBQZyb; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x11-20020a634a0b000000b0041bb87776ebsi15251952pga.352.2022.09.06.11.10.45; Tue, 06 Sep 2022 11:10:57 -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=@linaro.org header.s=google header.b=JPpBQZyb; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232984AbiIFR2q (ORCPT + 99 others); Tue, 6 Sep 2022 13:28:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233699AbiIFR2E (ORCPT ); Tue, 6 Sep 2022 13:28:04 -0400 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60F5C2253D for ; Tue, 6 Sep 2022 10:19:50 -0700 (PDT) Received: by mail-io1-xd31.google.com with SMTP id b142so9450683iof.10 for ; Tue, 06 Sep 2022 10:19:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=CjoWo3+k+FJefuKDmYvTvnT+WX8ScIS7BJ8NLr7fgUk=; b=JPpBQZyb3MFCnoBO52mQbvRvFK1bzbdI+2/0tSQ5oAtPjJEdcY29K3sXpZD8LW583o rMaIFEo+9v2fgMfra5ZEmTVqfrlU4Kx3Z6vtoPQ7oMklEmD0m9CqzMKCWQrsQ7qnAeuA llGVacas3XKjxS7jF3f6w4fBsE1GCEFRkNSstvF/6wFP4jpQBwmadDv6B8YNQBWZHOT1 9dww/OZOZmcaE+5h9DAzKvfyrGEpSo6KDqsxbrm47GwywxTPcK5jaYyt07JisfArbRX5 pp+eePKsh8cRKOPl8iPWW7OoU7Ub4KQkR2KpO8Jtcb0qaNZ98j7eR2UGIUwAozFi/R2V 4aDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=CjoWo3+k+FJefuKDmYvTvnT+WX8ScIS7BJ8NLr7fgUk=; b=pNSWGar3bgRpLA/3Smq1d2V+Z8pnHoXdptvNgKJRTDve3h4QDl4tT3QmMkzJFkzwjj oURQ9esNhewUk0Hf1qcRYsJvKTjVwLtOcZG8sVXHWdIdM376zRpsPT9htO1jzWWEEOEr gKBVnzdl8l9oNQtLZEmvJtK9cFfNpVRvn7Gu5LpIU9hrdQ9yHbzc8bIzOXbElIFIM69X GFdi9ngoIGWLrE7NNXlrDktIXtyozsjHeJzZUSliUb34ddMBAMgUFsfOcQam+a2qakw+ tOYtpPJlfxcp4WJUkqszgbrtVatoy6/KUVLLi1h+dq8IBu2fE8KA3VIDmFw5cLFU5JDx U3lw== X-Gm-Message-State: ACgBeo2tr51lgYvOLg528sTvWUdwpuQZaP6bh9RGs1+aHd1lx0VsHo7I Dgv4tYd0tkrI65/3+9gHkE7gCg== X-Received: by 2002:a05:6638:4811:b0:349:d619:a9d9 with SMTP id cp17-20020a056638481100b00349d619a9d9mr29500805jab.240.1662484788720; Tue, 06 Sep 2022 10:19:48 -0700 (PDT) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id q10-20020a056e020c2a00b002eb3f5fc4easm5292204ilg.27.2022.09.06.10.19.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 10:19:48 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, evgreen@chromium.org, bjorn.andersson@linaro.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/5] net: ipa: kill the allocated transaction list Date: Tue, 6 Sep 2022 12:19:39 -0500 Message-Id: <20220906171942.957704-3-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220906171942.957704-1-elder@linaro.org> References: <20220906171942.957704-1-elder@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 only place the trans_info->alloc list is used is when initializing it, when adding a transaction to it when allocation finishes, and when moving a transaction from that list to the committed list. We can just skip putting a transaction on the allocated list, and add it (rather than move it) to the committed list when it is committed. On additional caveat is that an allocated transaction that's committed without any TREs added will be immediately freed. Because we aren't adding allocated transactions to a list any more, the list links need to be initialized to ensure they're valid at the time list_del() is called for the transaction. Then we can safely eliminate the allocated transaction list. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.h | 1 - drivers/net/ipa/gsi_trans.c | 12 +++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h index 13468704c4000..a3f2d27a7e4b3 100644 --- a/drivers/net/ipa/gsi.h +++ b/drivers/net/ipa/gsi.h @@ -96,7 +96,6 @@ struct gsi_trans_info { struct gsi_trans_pool cmd_pool; /* command payload DMA pool */ spinlock_t spinlock; /* protects updates to the lists */ - struct list_head alloc; /* allocated, not committed */ struct list_head committed; /* committed, awaiting doorbell */ struct list_head pending; /* pending, awaiting completion */ struct list_head complete; /* completed, awaiting poll */ diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c index a131a4fbb53fc..254c09824004c 100644 --- a/drivers/net/ipa/gsi_trans.c +++ b/drivers/net/ipa/gsi_trans.c @@ -246,7 +246,7 @@ struct gsi_trans *gsi_channel_trans_complete(struct gsi_channel *channel) return &trans_info->trans[trans_id %= channel->tre_count]; } -/* Move a transaction from the allocated list to the committed list */ +/* Move a transaction from allocated to committed state */ static void gsi_trans_move_committed(struct gsi_trans *trans) { struct gsi_channel *channel = &trans->gsi->channel[trans->channel_id]; @@ -254,7 +254,7 @@ static void gsi_trans_move_committed(struct gsi_trans *trans) spin_lock_bh(&trans_info->spinlock); - list_move_tail(&trans->links, &trans_info->committed); + list_add_tail(&trans->links, &trans_info->committed); spin_unlock_bh(&trans_info->spinlock); @@ -383,6 +383,7 @@ struct gsi_trans *gsi_channel_trans_alloc(struct gsi *gsi, u32 channel_id, memset(trans, 0, sizeof(*trans)); /* Initialize non-zero fields in the transaction */ + INIT_LIST_HEAD(&trans->links); trans->gsi = gsi; trans->channel_id = channel_id; trans->rsvd_count = tre_count; @@ -398,12 +399,6 @@ struct gsi_trans *gsi_channel_trans_alloc(struct gsi *gsi, u32 channel_id, /* This free transaction will now be allocated */ trans_info->free_id++; - spin_lock_bh(&trans_info->spinlock); - - list_add_tail(&trans->links, &trans_info->alloc); - - spin_unlock_bh(&trans_info->spinlock); - return trans; } @@ -821,7 +816,6 @@ int gsi_channel_trans_init(struct gsi *gsi, u32 channel_id) goto err_map_free; spin_lock_init(&trans_info->spinlock); - INIT_LIST_HEAD(&trans_info->alloc); INIT_LIST_HEAD(&trans_info->committed); INIT_LIST_HEAD(&trans_info->pending); INIT_LIST_HEAD(&trans_info->complete); -- 2.34.1