Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp506383ybv; Wed, 5 Feb 2020 09:19:01 -0800 (PST) X-Google-Smtp-Source: APXvYqx6wiAD/cJd5/eDeYxgFgbZpu9F95XeyCZMAupPauoE7RBT5aof+SStc3/EHJ5QR25tO149 X-Received: by 2002:a9d:5d07:: with SMTP id b7mr21738506oti.209.1580923141310; Wed, 05 Feb 2020 09:19:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580923141; cv=none; d=google.com; s=arc-20160816; b=ey7SFFJpHPBfr1bUD/d3fuvCG4fwU7H2Wb86Dg/ZuRA01nukJnLKmn4R7upiw2P+d5 rMtgYTfuHX28F7BDb1y6fZLALWWtp1M2dN4RPXfKbFnE+d9vhVDGdGQpG0BkgqLsCe4f RRLgtLATO0gOzd0pyg3CgDvc12tsWLgC0o94QfynDxMxkoro+heL/oPuRw6bPG0aiwyI 0OCcNJuEyuo+HRqU4tyAi4BSOudFANq5j7a9hj0RGpkpPmoh8pO3JI3UqXCbeZCTFMp/ eczCLi28AX1bsPk4WA2VXew9ZuymYOcRQzZHcRX5yBp5cCTjgwi7/3LrZY8shNYlrjnY maFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=gro8+/WYQ95dq/YkmpDcqQGotCrT27nrMh3aJyFjzsk=; b=CTLkR1fsHA8WEj5Ksrf6z0ya2wZ+7BR+cwyYygNBFfJoKa9XmGykCTh6Ttkpa/aV4N nZhN0DPh1tKH/UHyPEBcsSzLPlJNNg5BkWWb0tMAyOh4Q9s7/bFuTmCDE23Uq4WGolK0 6d4Vjw0a5ZGY+BYd5hnESpAi0Db/1HmN65vmUUoyRf1jgQJlJ+9g4U8U4qhMDIu+HCig 02oG0tHXb2k5PMZZr/YUOEwozHMxnzQzT4vCtsAkKMLVdh2uCvRRoxuzeBw3syy0iv5d NENYl1j/B3U8PhqWIOoerA4sykjYbaVwq6y8we8bntof+mkuJkwtkC0MRp8xY3yJUn1s nuAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=JNt1RExN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x26si18889otk.325.2020.02.05.09.18.49; Wed, 05 Feb 2020 09:19:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=JNt1RExN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727482AbgBERRq (ORCPT + 99 others); Wed, 5 Feb 2020 12:17:46 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:42627 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726748AbgBERRo (ORCPT ); Wed, 5 Feb 2020 12:17:44 -0500 Received: by mail-pf1-f195.google.com with SMTP id 4so1521300pfz.9 for ; Wed, 05 Feb 2020 09:17:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=gro8+/WYQ95dq/YkmpDcqQGotCrT27nrMh3aJyFjzsk=; b=JNt1RExN/SIzR4L+sA2jTVZkmBl9TCzvX4yznNaDxTzKH5uwzSKIjcVHnHftIcgrRg KYBgL6C7Ru3SaMQbgDtoWtkpax80mxWthUu6Ym72awzLGSn0BhSd6exozmiox08IevlU MEWzNCTypFjnXVPSl9ZBRP0NCqapmHz4Kz6mPPqRvMpBH3rtCOS+Wt4UEfnSnbjNrsas 2WlnZ5UfN84c4R06vcs2DoKwwVO5yLSgr7PQwdExbgrdqa3oOYe9t42q0suG2yhXBNAu l6+I+qWAJSceesNmAeR4OI/SXfMLI3BXW+Zv1aE47L1g+ztjTA1Ab8gEGhXCjOHuvjbo +HSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=gro8+/WYQ95dq/YkmpDcqQGotCrT27nrMh3aJyFjzsk=; b=O+yopllL8s46zvDUlJGOUOZ0UdJexJM6zHUepVWHNXa2SkiqQ1g3gq6kfGEEhJtgzC b29+NOyB9xcsJKweus+oUm0mszYlcGxtSvwKm2FAW3tkhYE0bdvzMndFGq7ck1hkx7Jq W0DrAervH5Dj2lF5maunV83uLhQZ0CxlRwuLMXJYpzviF6wAimVS/ZALhRV5mYrvBQJP bn0YHyOXjfW2kdC8z2pR9eR8Tt7Y5XTG/6gXYjhgk/rJu+445aSJrS/EUauXs6AAVrry 8NOOHPOd6ofndnfbd5GuXaRKsNRgGcamIhLtuVVdWXGxMGjQ1XfJDQA/1dASAdVhLjxp EQ5Q== X-Gm-Message-State: APjAAAU0YSfy5+ycstehrCLjvFSlOTD+zhTQtfoYuxVLM6IT/j4GYNjf MleMPalYSV0c8Gq+XS8J/7Q= X-Received: by 2002:a63:e04a:: with SMTP id n10mr36912315pgj.341.1580923064263; Wed, 05 Feb 2020 09:17:44 -0800 (PST) Received: from emb-wallaby.amd.com ([165.204.156.251]) by smtp.gmail.com with ESMTPSA id l8sm357945pjy.24.2020.02.05.09.17.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 09:17:43 -0800 (PST) From: Arindam Nath To: Jon Mason , Dave Jiang , Allen Hubbe , Sanjay R Mehta Cc: linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, Arindam Nath Subject: [PATCH 2/4] ntb_perf: send command in response to EAGAIN Date: Wed, 5 Feb 2020 22:46:56 +0530 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org perf_spad_cmd_send() and perf_msg_cmd_send() return -EAGAIN after trying to send commands for a maximum of MSG_TRIES re-tries. But currently there is no handling for this error. These functions are invoked from perf_service_work() through function pointers, so rather than simply call these functions is not enough. We need to make sure to invoke them again in case of -EAGAIN. Since peer status bits were cleared before calling these functions, we set the same status bits before queueing the work again for later invocation. This way we simply won't go ahead and initialize the XLAT registers wrongfully in case sending the very first command itself fails. Signed-off-by: Arindam Nath --- drivers/ntb/test/ntb_perf.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c index 0e9b9efe74a4..5116655f0211 100644 --- a/drivers/ntb/test/ntb_perf.c +++ b/drivers/ntb/test/ntb_perf.c @@ -625,14 +625,24 @@ static void perf_service_work(struct work_struct *work) { struct perf_peer *peer = to_peer_service(work); - if (test_and_clear_bit(PERF_CMD_SSIZE, &peer->sts)) - perf_cmd_send(peer, PERF_CMD_SSIZE, peer->outbuf_size); + if (test_and_clear_bit(PERF_CMD_SSIZE, &peer->sts)) { + if (perf_cmd_send(peer, PERF_CMD_SSIZE, peer->outbuf_size) + == -EAGAIN) { + set_bit(PERF_CMD_SSIZE, &peer->sts); + (void)queue_work(system_highpri_wq, &peer->service); + } + } if (test_and_clear_bit(PERF_CMD_RSIZE, &peer->sts)) perf_setup_inbuf(peer); - if (test_and_clear_bit(PERF_CMD_SXLAT, &peer->sts)) - perf_cmd_send(peer, PERF_CMD_SXLAT, peer->inbuf_xlat); + if (test_and_clear_bit(PERF_CMD_SXLAT, &peer->sts)) { + if (perf_cmd_send(peer, PERF_CMD_SXLAT, peer->inbuf_xlat) + == -EAGAIN) { + set_bit(PERF_CMD_SXLAT, &peer->sts); + (void)queue_work(system_highpri_wq, &peer->service); + } + } if (test_and_clear_bit(PERF_CMD_RXLAT, &peer->sts)) perf_setup_outbuf(peer); -- 2.17.1