From patchwork Sun Dec 25 13:45:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alvaro Karsz X-Patchwork-Id: 121363 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 81345A0032; Sun, 25 Dec 2022 14:45:28 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 205FF40146; Sun, 25 Dec 2022 14:45:28 +0100 (CET) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mails.dpdk.org (Postfix) with ESMTP id 8093B400D4 for ; Sun, 25 Dec 2022 14:45:26 +0100 (CET) Received: by mail-wr1-f54.google.com with SMTP id bs20so6249861wrb.3 for ; Sun, 25 Dec 2022 05:45:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=solid-run-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=QLl3WIeLPu/ooctIcLFBSoEO7fwTDHeGHZl2tGumQ5M=; b=vrLjCqcpU30P780qr868+mQTraKvI1YqAAXCotr05aXWvkYbM+mYHoO7LT4qSwD0qx vpAIQVynKIa7Kw7dwnKAZwmkNxIweTUh6aLVodY4DTjehVs9PLHbaLXALXTgIci/LeEs bItpXLBcHFK04WxSqlzHqCmcE6Bo43R/o2NHEiwmzoKP/nHYUSX4/o5+TzcfNHrMBNXc JkGl8CbmTAO4FTIAhuYtboPN1txFIyqQ3B8CfY3dcrSM3O9RoxA1ixOFqpqXuQxyRKzP htdKDJB+TZmEPhNErqRhOXllXgvN6rUeeFn67a+lfEdlJNMkaxeNAqXz3jero3IMKd0F mT+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QLl3WIeLPu/ooctIcLFBSoEO7fwTDHeGHZl2tGumQ5M=; b=quCb2NKI/duQweQGIYzYIZP2n0gkWwEsCaFOkseo5Ipp5t1BmdX+GpMEphd7InFmdS tuOdVWZRNZDdfavS9RMdjYITGdTBhvlgNAJopT8Jr+LSdq6H4Ac1420jB0nsGBcJE+89 Hgsfv+Y9xgQN0kwKs3iDV6Lfxj7pF+eGhiQjQ4SqCPC8Pjmnz+Fw3HnIHQbQd6MwG1au gu36QibimsnAD3BKU/zgFqwbDARV7Udzr396UPeJVn1mmCmd/PYlNNA7seMjxPY9Tp0R w/K4lZK6viqvA3Uvy2UmS7BZ6AxRIN6rf86ZcD4h9pyQGPQSMY+c1qlAYcPJnnBkhgf7 UDNQ== X-Gm-Message-State: AFqh2ko5fPH7dWdiq5KY8tWxPXPcEP4TzPY+EvJPzdriDtbYdYQenpIO W4RueBYKmbfsFnNbBCk2tC6A2l2oW8h3GmfG X-Google-Smtp-Source: AMrXdXtsaL6pVq0zw2bOQ8BKAd12jOI/Iw04E0+9FWX0VbxIddUzb/AfCTgKgQ3WQEpoz0AonZEoAg== X-Received: by 2002:adf:f2c9:0:b0:242:1522:24a7 with SMTP id d9-20020adff2c9000000b00242152224a7mr9181205wrp.32.1671975925206; Sun, 25 Dec 2022 05:45:25 -0800 (PST) Received: from localhost.localdomain (bzq-84-110-153-254.static-ip.bezeqint.net. [84.110.153.254]) by smtp.gmail.com with ESMTPSA id f8-20020a05600c154800b003cf774c31a0sm17529668wmg.16.2022.12.25.05.45.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Dec 2022 05:45:24 -0800 (PST) From: Alvaro Karsz To: dev@dpdk.org Cc: sachin.saxena@oss.nxp.com, hemant.agrawal@nxp.com, Alvaro Karsz Subject: [PATCH] bus/fslmc: unlock spinlock in case of timeout Date: Sun, 25 Dec 2022 15:45:21 +0200 Message-Id: <20221225134521.2359999-1-alvaro.karsz@solid-run.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Commit 79711846f6 introduces timeouts to mc, but in case of a timeout, the spinlock that was locked before isn't unlocked. Fixes: 79711846f6 ("bus/fslmc: add timeout in MC send command API") Signed-off-by: Alvaro Karsz --- drivers/bus/fslmc/mc/mc_sys.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/bus/fslmc/mc/mc_sys.c b/drivers/bus/fslmc/mc/mc_sys.c index ab9a074835..a78e504bd2 100644 --- a/drivers/bus/fslmc/mc/mc_sys.c +++ b/drivers/bus/fslmc/mc/mc_sys.c @@ -77,8 +77,12 @@ int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd) total_time = rte_get_timer_cycles() - start_time; } while (status == MC_CMD_STATUS_READY && total_time <= time_to_wait); - if (status == MC_CMD_STATUS_READY) + if (status == MC_CMD_STATUS_READY) { + /* --- Call unlock function here in case portal is shared --- */ + rte_spinlock_unlock(&mc_portal_lock); + return mc_status_to_error(MC_CMD_STATUS_TIMEOUT); + } /* Read the response back into the command buffer */ mc_read_response(mc_io->regs, cmd);