From patchwork Tue Aug 13 18:27:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manoj Vishwanathan X-Patchwork-Id: 13762397 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E10531A38DF for ; Tue, 13 Aug 2024 18:28:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723573683; cv=none; b=t5TfNA65+eC02VD2+erFIChKEPWlhWCux32yZ5oiUjJQpatpXsNxBCo0xKZ6P+A2isp1HuMRGKR7FjMUAefjWEjSaDpGy+ZY0AOJ5iQcRdbbWIp28CdNImnPJ/8aj3LdT0QIfsoh45KUHCkl6qjwUB27g4rROFf5BK5HJWM5LTU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723573683; c=relaxed/simple; bh=/f0liMwdFEKT7a9xgkPkH9Cx1ArNObmnYwWZxxCvP3k=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=RVgitREwbQJr2ZcXdp4P9fVzhjaZoI2oYONacKMX/kC+aBUaEz3AKnqB9N9Op1FHI87S92B2N9la14dl7E7hiWR8PUypNQwOXFCFLdPO3a2Cy+EJqKw9NDn11rEUuc26PAeoLCJFxeI88WZHYu6yvXmZ3YBG37tn8Y1SCrDQliw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--manojvishy.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=YB2Fhnz7; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--manojvishy.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="YB2Fhnz7" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e0e3eb3feaeso9623420276.2 for ; Tue, 13 Aug 2024 11:28:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723573680; x=1724178480; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=0FUwl2486l/jeLoGKzs9tmDqeNS+tAHZe3YD3ALXm7s=; b=YB2Fhnz7zK4qon2QngSlVmHL7TPsH8eGCcedOwjP3lVLlj7mc5BWm8/uwOs+UzZEwV 5N1z+UhsM0hxMlM95mXA6A3ljLKKwTSnkjJDDcBwVf5VHKgdYiQLZ2rcTLw03eyLlybM abZvip6YyUyDfK0fKApj652piqtCCisnzE4pgNeSj7voVEby7YY2FDqa3o5GZN3tDlKF KKhcNonnNzvs1DFjUeKy07RoYSyiEXvXzOHgW5D2BatPe8ioRbOJdeK9ERp0wd7xfvHu SRft6LzhVyWRkYEzMhAyRf1kVERrOYWHQa2Ma7V3Di+yxVpcUJepdRj0MM5expl4Ze0h ogsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723573680; x=1724178480; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0FUwl2486l/jeLoGKzs9tmDqeNS+tAHZe3YD3ALXm7s=; b=hwcyjK5CNIqxbtHXPAXCPzeN/eonQZKPvxR5RE7SXLV/1Cb8RHEX6OmmMjLMNqxlgK oAgUl04QCKc9dWH00lHBYtmpEO8aNlcc65bqrNEY6pS5eXMiwFNgLZF09jg4Z8fw8HgB Lm8R/JnAVqFDCZlFRKKgmcuZNuu/tMxurBodY2/If+F4fTr3W3Cn3IcRp1BkG0AHPsrO FpO8u1sw3iuFk0ffkimHB5tcsYDKSFTmfndrFPqS4PcZV+qXWNhc6RPuc42dCGGruJID uMuuMyHWMjsK08TQpMPkWyXX1fCvAtDmn2Up3+14KDE3KE7ydzCtLhAAuJT5Ot9ukDW/ XNXQ== X-Gm-Message-State: AOJu0YwQv8aMhH/nK9jW5lRhmgwDqVXqSsLU+0bLKJCH7UjGZMAvWAZf f9rN1aJdL+O2R09j4tfW16aPaVidRAjUz7HUgDIw1XFmhLecPqnK2qeEP+bmvnSUq5U6lk/ovpV C8zsn19nU7QJX5HQBhg== X-Google-Smtp-Source: AGHT+IEtLel87VI5FBoqzbu00ocynCKeHOTMNEky1uO+1XuJvYBO+DGemsm7Z+Cht2r0k2SIU65ZGd3kOoHSPEw8 X-Received: from manojvishy.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:413f]) (user=manojvishy job=sendgmr) by 2002:a25:a223:0:b0:e0b:f1fd:1375 with SMTP id 3f1490d57ef6-e1155bafbf9mr618276.10.1723573679918; Tue, 13 Aug 2024 11:27:59 -0700 (PDT) Date: Tue, 13 Aug 2024 18:27:43 +0000 In-Reply-To: <20240813182747.1770032-1-manojvishy@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240813182747.1770032-1-manojvishy@google.com> X-Mailer: git-send-email 2.46.0.76.ge559c4bf1a-goog Message-ID: <20240813182747.1770032-2-manojvishy@google.com> Subject: [PATCH v1 1/5] idpf: address an rtnl lock splat in tx timeout recovery path From: Manoj Vishwanathan To: Tony Nguyen , Przemek Kitszel , "David S. Miller" , Eric Dumazet , intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, google-lan-reviews@googlegroups.com, Manoj Vishwanathan X-Patchwork-Delegate: kuba@kernel.org Adopt the same pattern as in other places in the code to take the rtnl lock during hard resets. Tested the patch by injecting tx timeout in IDPF , observe that idpf recovers and IDPF comes back reachable Without this patch causes there is a splat: [ 270.145214] WARNING: CPU: PID: at net/sched/sch_generic.c:534 dev_watchdog Signed-off-by: Manoj Vishwanathan --- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c index af2879f03b8d..3c01be90fa75 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c @@ -4328,14 +4328,26 @@ int idpf_vport_intr_init(struct idpf_vport *vport) { char *int_name; int err; + bool hr_reset_in_prog; err = idpf_vport_intr_init_vec_idx(vport); if (err) return err; idpf_vport_intr_map_vector_to_qs(vport); + /** + * If we're in normal up path, the stack already takes the + * rtnl_lock for us, however, if we're doing up as a part of a + * hard reset, we'll need to take the lock ourself before + * touching the netdev. + */ + hr_reset_in_prog = test_bit(IDPF_HR_RESET_IN_PROG, + vport->adapter->flags); + if (hr_reset_in_prog) + rtnl_lock(); idpf_vport_intr_napi_add_all(vport); - + if (hr_reset_in_prog) + rtnl_unlock(); err = vport->adapter->dev_ops.reg_ops.intr_reg_init(vport); if (err) goto unroll_vectors_alloc; From patchwork Tue Aug 13 18:27:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manoj Vishwanathan X-Patchwork-Id: 13762398 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9842B1A3BD0 for ; Tue, 13 Aug 2024 18:28:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723573685; cv=none; b=o+VZnVvPfXGFgw6WJA58szRkhDo3VErrfhDO0WxrltkWqQJWVVRNsAVQDkpmgsMDN3TpDnGtjliFKNmEWfOp8HbDuWxo3j4wRs6TlEmT9VzQnltk5julOfZDe5xwsmpIuKmymyGGWBcZdxZIuKOOFL82HXlOU++37wd5i10j5JI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723573685; c=relaxed/simple; bh=341AIaEeBSFJu73c47ddLKfkUSw2l+H2RZ6SJ/BltPE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=N00RonzQ8c8bj6iM6Y8iZRes1sdjaxuF9arPEh0iXadZJCqHIdW4t61Ad2U78HvvTrCjnbs4CetU7wsVy9W2JoZxi8V/ELB1HcRgfMjfi3pJ3XQWuS6zVsqIyTDGVgmgq/S4GQLACapbqDb3gCdl6zPXf8d1nkKOIx+ZxPEMXcw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--manojvishy.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Kl0qYfGx; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--manojvishy.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Kl0qYfGx" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-66619cb2d3eso158615127b3.2 for ; Tue, 13 Aug 2024 11:28:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723573682; x=1724178482; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=TvCJH3TZ9fBYiYpF5a88AFpsytgjevnUGq5R4un9KfQ=; b=Kl0qYfGx59p5J73dw8Ih+eN5iZ2LHLA4V4tl2uU0KQvdtJ0pw0mJ9uWt+zGCQSGDtN LRT9I+awdlnIqQHd+x18pPxtZPsP5FVxknjSzkFAPBP/vRIoSjLAU2wLHhOgy9vBkcnS dHTw3Lgtz7DtdNo0xvDGc8mlxTLmIGvgfI9TfKY1XAi6VhnDr0wDJpPdzWFyojrVWvuO QaGHVP0vd/sYow/JDgi5EcSbW1ioKn+QRSiPBJSvWfAe0EMBPJWwwhZQCcJWr/jNW0DI wwlQkL8Ql/7eRJkHfjzue7hAPcVQbM6Pq9AXlXVvm/mJ3VayM6Jp0q8dwYWYGHjDmtBk 5FJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723573682; x=1724178482; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TvCJH3TZ9fBYiYpF5a88AFpsytgjevnUGq5R4un9KfQ=; b=RrxpR1bxBuJnkPpCwOPVk5hHDK1G+uHvrc/9FD8zGe5LAAyqgfzW8vH+wAMkb0Ijqe L+nKhTn6AoOQUOBIPy2fkV11RQWGmhrDfNWnXApdKHhyHv/8cP+p3dYAI5CiGaqil/6B JKNBotfM127xYwUJ1rSBZ9dPPfAekmvfXn65F34zU7v7NWaBd20aDvNdJ60YSy42p/uz 2kKb/8pvYtf/1Ih6+oYEM2pSbr/7y/gTkjoyFl/hv586giGWjympdbuJbQUPdr/OdnzF aCIId5wRdGZSmb+bYYZHKdQ5T7dpJf1BKxVdKm6SF7SVSRL7aOxK6THUw4Ita+xJUZpI Jiaw== X-Gm-Message-State: AOJu0YxGqEKtMZxAswuIv64SC8uyAS14k88LH5ryPnDSgK5frmoqJvcT 3ovrujV5S4/HbVcO5gD3yZAaDFxD+b9jU1UNLfR8MMGrweTLW7TWsxw+c1la7X9VXIYJL5wBlkP 2ocxUK11SPpXjSKsmCg== X-Google-Smtp-Source: AGHT+IGj4/G4VHtyu7j84mLj7yhWkQtHtTJEHKj/H2cGvmAy6yo3iqZtz9v6g07d1BL8wXt51Jxah1P72bzfqR2d X-Received: from manojvishy.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:413f]) (user=manojvishy job=sendgmr) by 2002:a5b:b43:0:b0:e03:5b06:6db2 with SMTP id 3f1490d57ef6-e1155a57e9amr896276.3.1723573682504; Tue, 13 Aug 2024 11:28:02 -0700 (PDT) Date: Tue, 13 Aug 2024 18:27:44 +0000 In-Reply-To: <20240813182747.1770032-1-manojvishy@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240813182747.1770032-1-manojvishy@google.com> X-Mailer: git-send-email 2.46.0.76.ge559c4bf1a-goog Message-ID: <20240813182747.1770032-3-manojvishy@google.com> Subject: [PATCH v1 2/5] idpf: Acquire the lock before accessing the xn->salt From: Manoj Vishwanathan To: Tony Nguyen , Przemek Kitszel , "David S. Miller" , Eric Dumazet , intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, google-lan-reviews@googlegroups.com, Manoj Vishwanathan X-Patchwork-Delegate: kuba@kernel.org The transaction salt was being accessed before acquiring the idpf_vc_xn_lock when idpf has to forward the virtchnl reply. Fixes: 34c21fa894a1 ("idpf: implement virtchnl transaction manager") Signed-off-by: Manoj Vishwanathan --- drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c index 70986e12da28..30eec674d594 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c @@ -612,14 +612,15 @@ idpf_vc_xn_forward_reply(struct idpf_adapter *adapter, return -EINVAL; } xn = &adapter->vcxn_mngr->ring[xn_idx]; + idpf_vc_xn_lock(xn); salt = FIELD_GET(IDPF_VC_XN_SALT_M, msg_info); if (xn->salt != salt) { dev_err_ratelimited(&adapter->pdev->dev, "Transaction salt does not match (%02x != %02x)\n", xn->salt, salt); + idpf_vc_xn_unlock(xn); return -EINVAL; } - idpf_vc_xn_lock(xn); switch (xn->state) { case IDPF_VC_XN_WAITING: /* success */ From patchwork Tue Aug 13 18:27:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manoj Vishwanathan X-Patchwork-Id: 13762399 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51EC21A4F1F for ; Tue, 13 Aug 2024 18:28:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723573687; cv=none; b=Qk8HZuuGK20pEOB7geMCyEKjGEy9ErK1+jwW/p2Bq3iV7XKUbSoENhEwsWXzxs+s7MvveMS7ZsrxzBIKAFalSZi+FGPAwWrcTd2Ook6Eby92L3W/2hy+wZtZyBBEEtOw4VAfp1GqUed/wjwGTprm8PEX0yvSoiruigqs4t+QPVw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723573687; c=relaxed/simple; bh=j69ckPh7E3QD6AiHqrqUQtHhaCzw1plGFQ8OeVu17UQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=qFufTm1JhGNDK2WlNKi3GDZOKppDAN++MUp1zUpWd4VyVfkykwZARyfxtfG+QjGXV+xXUKJf/ag44rwCg/c6k0aPplw5m0uZV3JJzyHZpxBknm8aai0dihGzB56HOioMEi8vtN1cN83sfD+X4HSpyv9lfy4d61ukcuMRI6Lk1AE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--manojvishy.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=nwazf42l; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--manojvishy.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="nwazf42l" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-66890dbb7b8so131011437b3.0 for ; Tue, 13 Aug 2024 11:28:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723573685; x=1724178485; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=TP961J72JDd3W/A5AwIhTA95rpBeW3mVlPbF5keUAfI=; b=nwazf42lrD42GpXfM+jnF7888q8ncFWYTMYMigAohgEzXGv4S9yAa0SXQ0eOm3P4bR BzO5S2StBzMBoQ+hjldsU3GyApif5J8S1m9mayupmZZEWq70wwPjlzbiQdWeO8UZhiak 2EL9qtMAftz5I6UMFGiY4lA3ZBAl6ZzrsW7XI6AQqND8DEhuctR72AFniEq3oncViDuq 0q/I+1LC1ijdleIBL+0c9vY9VKuFOo2lnf/JjbiEcMhoK6Zx+tPVPqO4UG/NSNzuXPvq XqfFcud5tH/eyIl6Hpoe7W5sY8SwIugdkoRCrDXjecapJefBwqGKa5NyDbPeuNE0D+D9 z3aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723573685; x=1724178485; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TP961J72JDd3W/A5AwIhTA95rpBeW3mVlPbF5keUAfI=; b=dcgNoC1fJqBcabxsZrX34RO3fwu3Kb8cQX38ulxdMCfPuJAlTlA5jqfkN3HAizsldD oNS928vlaPHkeaKHlzoQVeI6Iov9n6BDHPrzlqXIFuj5peTE9rfv7+8ovuh2n1UexFuA JNeAjrXuQnzaAsWCkSyXqPYC6WyawIt7ETEiUK5slCn4zjJjcKJrEItsYR708oQa1p4M jYExcrIJ6wcLq/jtIZtiAg0GHh1H9bdYcvXTCE3BCDK4IYVokab+UcoMfqPrNIXnXAkr 3iikHDCTzxKTce0o+sLwYJQuNOqusAc/w5rcFrsykoWOqiFpPwgyfdvP4GS2gpM9M2D0 /j8w== X-Gm-Message-State: AOJu0YwLcSv0PFgAV+pJXdr2owAbslcW2/o7IUA9uTJzLNNuBGf5XoV9 XuAJ973T1SMkxvMK96Ug3h4WWKw2MIAtTeqfdvR9cTjm3Z9ianh8l/y6wLpA4pa6gq0AgVZlWdq gH/NBFbV+DcdApOxA9w== X-Google-Smtp-Source: AGHT+IEcUJ4nno820COmCVkqEY2grkP8CkJXPuWKQlxjBtfvY5Cd6Kury80B6+oOUU3OFR28ZBOqgQRdHfLwWACY X-Received: from manojvishy.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:413f]) (user=manojvishy job=sendgmr) by 2002:a25:c5c3:0:b0:e0b:f69b:da30 with SMTP id 3f1490d57ef6-e1155b7c6cbmr11272276.9.1723573685319; Tue, 13 Aug 2024 11:28:05 -0700 (PDT) Date: Tue, 13 Aug 2024 18:27:45 +0000 In-Reply-To: <20240813182747.1770032-1-manojvishy@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240813182747.1770032-1-manojvishy@google.com> X-Mailer: git-send-email 2.46.0.76.ge559c4bf1a-goog Message-ID: <20240813182747.1770032-4-manojvishy@google.com> Subject: [PATCH v1 3/5] idpf: convert workqueues to unbound From: Manoj Vishwanathan To: Tony Nguyen , Przemek Kitszel , "David S. Miller" , Eric Dumazet , intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, google-lan-reviews@googlegroups.com, Marco Leogrande , Manoj Vishwanathan X-Patchwork-Delegate: kuba@kernel.org From: Marco Leogrande When a workqueue is created with `WQ_UNBOUND`, its work items are served by special worker-pools, whose host workers are not bound to any specific CPU. In the default configuration (i.e. when `queue_delayed_work` and friends do not specify which CPU to run the work item on), `WQ_UNBOUND` allows the work item to be executed on any CPU in the same node of the CPU it was enqueued on. While this solution potentially sacrifices locality, it avoids contention with other processes that might dominate the CPU time of the processor the work item was scheduled on. This is not just a theoretical problem: in b/317234476, a misconfigured process was hogging most of the time from CPU0, leaving less than 0.5% of its CPU time to the kworker. The IDPF workqueues that were using the kworker on CPU0 suffered large completion delays as a result, causing performance degradation, timeouts and eventual system crash. Tested: * I have also run a manual test to gauge the performance improvement. The test consists of an antagonist process (`./stress --cpu 2`) consuming as much of CPU 0 as possible. This process is run under `taskset 01` to bind it to CPU0, and its priority is changed with `chrt -pQ 9900 10000 ${pid}` and `renice -n -20 ${pid}` after start. Then, the IDPF driver is forced to prefer CPU0 by editing all calls to `queue_delayed_work`, `mod_delayed_work`, etc... to use CPU 0. Finally, `ktraces` for the workqueue events are collected. Without the current patch, the antagonist process can force arbitrary delays between `workqueue_queue_work` and `workqueue_execute_start`, that in my tests were as high as `30ms`. With the current patch applied, the workqueue can be migrated to another unloaded CPU in the same node, and, keeping everything else equal, the maximum delay I could see was `6us`. Signed-off-by: Marco Leogrande Signed-off-by: Manoj Vishwanathan --- drivers/net/ethernet/intel/idpf/idpf_main.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/idpf/idpf_main.c b/drivers/net/ethernet/intel/idpf/idpf_main.c index db476b3314c8..dfd56fc5ff65 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_main.c +++ b/drivers/net/ethernet/intel/idpf/idpf_main.c @@ -174,7 +174,8 @@ static int idpf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pci_set_master(pdev); pci_set_drvdata(pdev, adapter); - adapter->init_wq = alloc_workqueue("%s-%s-init", 0, 0, + adapter->init_wq = alloc_workqueue("%s-%s-init", + WQ_UNBOUND | WQ_MEM_RECLAIM, 0, dev_driver_string(dev), dev_name(dev)); if (!adapter->init_wq) { @@ -183,7 +184,8 @@ static int idpf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_free; } - adapter->serv_wq = alloc_workqueue("%s-%s-service", 0, 0, + adapter->serv_wq = alloc_workqueue("%s-%s-service", + WQ_UNBOUND | WQ_MEM_RECLAIM, 0, dev_driver_string(dev), dev_name(dev)); if (!adapter->serv_wq) { @@ -192,7 +194,8 @@ static int idpf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_serv_wq_alloc; } - adapter->mbx_wq = alloc_workqueue("%s-%s-mbx", 0, 0, + adapter->mbx_wq = alloc_workqueue("%s-%s-mbx", + WQ_UNBOUND | WQ_MEM_RECLAIM, 0, dev_driver_string(dev), dev_name(dev)); if (!adapter->mbx_wq) { @@ -201,7 +204,8 @@ static int idpf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_mbx_wq_alloc; } - adapter->stats_wq = alloc_workqueue("%s-%s-stats", 0, 0, + adapter->stats_wq = alloc_workqueue("%s-%s-stats", + WQ_UNBOUND | WQ_MEM_RECLAIM, 0, dev_driver_string(dev), dev_name(dev)); if (!adapter->stats_wq) { @@ -210,7 +214,8 @@ static int idpf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_stats_wq_alloc; } - adapter->vc_event_wq = alloc_workqueue("%s-%s-vc_event", 0, 0, + adapter->vc_event_wq = alloc_workqueue("%s-%s-vc_event", + WQ_UNBOUND | WQ_MEM_RECLAIM, 0, dev_driver_string(dev), dev_name(dev)); if (!adapter->vc_event_wq) { From patchwork Tue Aug 13 18:27:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manoj Vishwanathan X-Patchwork-Id: 13762400 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EBB0D1A4F3D for ; Tue, 13 Aug 2024 18:28:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723573690; cv=none; b=RLANLaPBT8G/dIYOMsORt5VCD2FGNNPOoGKdESHBnK8YtQiJcVRgEr+RLxLirgd3Pphsbw10fxVWuvEalIF1zrQOqOJpdeJg2c5Yd29Jn+XI1H+VuhvJVxymP+AhDmF5qwbU5w3XX1FOr6HILcHO4Sw3eJxCYhlJepH/zYKSCaI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723573690; c=relaxed/simple; bh=wURwSNeTR3DMbnqhyCGTD2j34T/sj0viD1kYtD7tK/o=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=cPRefU5gFqrxLG/4OJRNSbPbtMjl94dgGBXOZRtCoRLsnWCeVHVegrcjWmUuULVBgINwT+pNGyQqLW5k4z6U0QlKuWbCfdan+/Wf6/FeODfc9+fuIw4nVsubQ0/jF3cM0bWBiiW/P1n0OXUEGxjM/M1rDOF8wQRM+yqY2YO9HkQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--manojvishy.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=gLdpMmvZ; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--manojvishy.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="gLdpMmvZ" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6506bfeaf64so114723547b3.1 for ; Tue, 13 Aug 2024 11:28:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723573688; x=1724178488; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=l/Sac5m4oGMZ3mG4jh/NoF4fykuTzT6XDGolN2ik8MI=; b=gLdpMmvZ9p6kGYw7KvRFjBZo5FGWAuDATy2ajfatU6HKdijA/+Y3JgJ5p1gDZh8xwo D4lteo87NAdCWkqKciXS9Cw8cSKdiLqS9AUk5Lda1nx7zzYeISZ6VfPOXRfME4kigqX2 M3MTO5RMM2s3Gxf/s+lDRoGxX5FMs1kH0TYhzWmOLCwmKxVdhZpRxcWDBTkTG5ZzhRWA Jft9yAuqeBb99y93DPqOPBXbmBsuF8hPrIs5Mu7ZNcQ8MGcMu+uBVDakOF/WA9hsY3oB haMQAUBmsGaHdIW2SIqX9QC/wITEJodoD3uJJLz3g+qce3GY+Dr/Squ0yDVWKvvQFihF 4SMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723573688; x=1724178488; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=l/Sac5m4oGMZ3mG4jh/NoF4fykuTzT6XDGolN2ik8MI=; b=k0uWsA3ajitFuBgVHNvi4sQY4A82G7hJIgowaRjetJijxKv4kOQd3ffbckv6gokl26 TEOxdqgkdl51EC1WK7vLESc/YFxuyGM0WgfQT8uFvr21GknkPlCoOzpCVm63AffJ0Az/ lpRJKn7bMgUBwd2ENLzCfshr1UF35XBOirZMb+q3pIA/eOrSZ1u7VDb+Jzj2paafFdoc x2UmEzyfKJNUYQfMlKXChEk5LBRP7rcORN159BaaBNQBcOdRtcryAG9txJOpP4mQftPj f/KL9zCj24MXH/Hg6oPqtE6jzy3UHbAO/8z8B6hOHoHJH2mgoNpoZZSfarqZSDrHJuVB LQtg== X-Gm-Message-State: AOJu0YwNr0T8LMQgpV5y9GUYumSV8qQaa+ofl3UELTw74nHATBeCrCKF i73gjHk3WUq0VajeRlBCzBV7IZ4C8ldIQ7OyGA9h7yRoA7bU0xy1F+c9qY39bqQZPgA/1ZOq9Ia G04E1oWPa8WipE+yLfw== X-Google-Smtp-Source: AGHT+IGMc7q2tq4LDbjY97g5fn1H9eJpq9yMVM8n/S+oYbY7lnb67UbACWQriHtyDPG5G0lfyfbpfMowGW8x+pG6 X-Received: from manojvishy.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:413f]) (user=manojvishy job=sendgmr) by 2002:a81:b810:0:b0:64b:5cc7:bcb7 with SMTP id 00721157ae682-6ac954aa2acmr70637b3.1.1723573687771; Tue, 13 Aug 2024 11:28:07 -0700 (PDT) Date: Tue, 13 Aug 2024 18:27:46 +0000 In-Reply-To: <20240813182747.1770032-1-manojvishy@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240813182747.1770032-1-manojvishy@google.com> X-Mailer: git-send-email 2.46.0.76.ge559c4bf1a-goog Message-ID: <20240813182747.1770032-5-manojvishy@google.com> Subject: [PATCH v1 4/5] idpf: more info during virtchnl transaction time out From: Manoj Vishwanathan To: Tony Nguyen , Przemek Kitszel , "David S. Miller" , Eric Dumazet , intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, google-lan-reviews@googlegroups.com, Manoj Vishwanathan X-Patchwork-Delegate: kuba@kernel.org Add more information related to the transaction like cookie, vc_op, salt when transaction times out and include info like state, vc_op, chnl_opcode when transaction salt does not match. Sample output for transaction timeout: ------------------- Transaction timed-out (op:5015 cookie:45fe vc_op:5015 salt:45 timeout:60000ms) ------------------- Signed-off-by: Manoj Vishwanathan --- drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c index 30eec674d594..07239afb285e 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c @@ -517,8 +517,9 @@ static ssize_t idpf_vc_xn_exec(struct idpf_adapter *adapter, retval = -ENXIO; goto only_unlock; case IDPF_VC_XN_WAITING: - dev_notice_ratelimited(&adapter->pdev->dev, "Transaction timed-out (op %d, %dms)\n", - params->vc_op, params->timeout_ms); + dev_notice_ratelimited(&adapter->pdev->dev, + "Transaction timed-out (op:%d cookie:%04x vc_op:%d salt:%02x timeout:%dms)\n", + params->vc_op, cookie, xn->vc_op, xn->salt, params->timeout_ms); retval = -ETIME; break; case IDPF_VC_XN_COMPLETED_SUCCESS: @@ -615,8 +616,8 @@ idpf_vc_xn_forward_reply(struct idpf_adapter *adapter, idpf_vc_xn_lock(xn); salt = FIELD_GET(IDPF_VC_XN_SALT_M, msg_info); if (xn->salt != salt) { - dev_err_ratelimited(&adapter->pdev->dev, "Transaction salt does not match (%02x != %02x)\n", - xn->salt, salt); + dev_err_ratelimited(&adapter->pdev->dev, "Transaction salt does not match (exp:%d@%02x(%d) != got:%d@%02x)\n", + xn->vc_op, xn->salt, xn->state, ctlq_msg->cookie.mbx.chnl_opcode, salt); idpf_vc_xn_unlock(xn); return -EINVAL; } From patchwork Tue Aug 13 18:27:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manoj Vishwanathan X-Patchwork-Id: 13762401 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B85A61A4F26 for ; Tue, 13 Aug 2024 18:28:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723573693; cv=none; b=MDfmjfFypMA5qNfg/Dmx73K/XICqJoyo3REnY4YNWZ+iFbAJ6EGeTMH/xfCXZ2pqmJSf8lejOokcxCY0hRjEzeohX24UR41ci4QZTZkAfUS/Ky2Dmgdlv4P49R1bbHXLor84yAt3RFJGaH60Cx4bMEtYjaDQnR9GCJGvWnBc+7U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723573693; c=relaxed/simple; bh=mFkftTIu02mfcYwHXBEgJrzZ1AKjIW4aHcghMUbRkOw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=UBFpwA/l1r+cXvI9pOpIFjmLS2l1LfyIJuesMRRUZrlWkl4obxEsPyWvrrVJmgX+PM5vidtbj+zZ2vjzm4dhUmCT3w+u+hHgBIna5EkdQ3UMgKeDeb7o32e03UDBn9aYzSHe6vFfEWyRw3PYZ0CKPMOFlEg4v0RISFCv1lCQifY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--manojvishy.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=JtAT5yIh; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--manojvishy.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="JtAT5yIh" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-664aa55c690so131654647b3.2 for ; Tue, 13 Aug 2024 11:28:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723573691; x=1724178491; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=2l203xNbbDmQFlGySVGE48ihh5ns60KyrsTrGKa57JU=; b=JtAT5yIhxSVnFOVNQxpQtPI0Skwsvb0Z4tn/opjN3IbB4pfEXjfWCkrfslRjKnkViT 3Db+DTf5TFRpfF+omJsZuI0PNLpgJFZhWKAgFCz9LU4FtMv6TBA9rrjhPLMeQMYsNuua BxAh01ncKAUFzFy1QgAS3dniFLNF1Go5vbvp3fC4hJAHnpgcRhoqmB5C3a+CxP8R8ajf 8KquqEuZTqFcM/Q6MQQv6t/WzEl+sdEPkslNXxKh7GXfRxJ02fGarYUDV9l23mZTi6nf YBExgpH5YsHVzq1V7cnTeZ0iBiS1lBLhWzcjkjm00dxLwa4uxNkPGuAzfZm1RnnWx2jv LNTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723573691; x=1724178491; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2l203xNbbDmQFlGySVGE48ihh5ns60KyrsTrGKa57JU=; b=KMIosklOzT7dTWRerZlnPKOuTVX2OluPplbE4gu6FPRhhZVThf1Gq0bsohY+wsGNYh +aTOTlaLSh2E0qzOcTa34pyFygcGzdIA2cOJ3m+HUdxU7EPvYgYDjSTPBZQl57IfxMfE YjAgfSp4m/XrU+Dilh8lc6lhOGimRJFB1D+6hA4ZbWTxrITAabh56xxa86fyErerbk0k /rgz/Z90hzSkN09AGpivji31V7BlAZucmyj9TjepeSSW9hF8RugF2rCPeVYQTJUQQJFQ 61Oe4FbjXLhl3UnglreQlZTb8ueLLqj+aOWacg3nRNWoqckUwIxmPpsXebZgnr+oHs02 d+mA== X-Gm-Message-State: AOJu0Yzp7NuaRvELwNcl6nxX1p2CLwIzwnYHs5XtolirQlbPVrC5iGB7 YbN9rs/6nchfEDZ5/Z+fxw8zgSfPAUDMh1onEVSTgRLmzlomtKgcp0m19jKRniOwAeVD910y928 tfzb0o9gyo6ZdXjb9CA== X-Google-Smtp-Source: AGHT+IEjC2wQwCxOJBrBI4mvt/RtCshXJNtsKgTfCt4RfM09XRcGt/PRVIU4C6Llzti+4BVUOLQboVqmXWvBEOBm X-Received: from manojvishy.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:413f]) (user=manojvishy job=sendgmr) by 2002:a25:c5d1:0:b0:e0e:3f14:c29d with SMTP id 3f1490d57ef6-e1155a94bdbmr13662276.4.1723573690732; Tue, 13 Aug 2024 11:28:10 -0700 (PDT) Date: Tue, 13 Aug 2024 18:27:47 +0000 In-Reply-To: <20240813182747.1770032-1-manojvishy@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240813182747.1770032-1-manojvishy@google.com> X-Mailer: git-send-email 2.46.0.76.ge559c4bf1a-goog Message-ID: <20240813182747.1770032-6-manojvishy@google.com> Subject: [PATCH v1 5/5] idpf: warn on possible ctlq overflow From: Manoj Vishwanathan To: Tony Nguyen , Przemek Kitszel , "David S. Miller" , Eric Dumazet , intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, google-lan-reviews@googlegroups.com, Willem de Bruijn , Manoj Vishwanathan X-Patchwork-Delegate: kuba@kernel.org From: Willem de Bruijn The virtchannel control queue is lossy to avoid deadlock. Ensure that no losses occur in practice. Detect a full queue, when overflows may have happened. In practice, virtchnl is synchronous currenty and messages generally take a single slot. Using up anywhere near the full ring is not expected. Tested: Running several traffic tests and no logs seen in the dmesg Signed-off-by: Willem de Bruijn Signed-off-by: Manoj Vishwanathan --- drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c index 07239afb285e..1852836d81e4 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c @@ -218,6 +218,15 @@ static int idpf_mb_clean(struct idpf_adapter *adapter) if (err) goto err_kfree; + /* Warn if messages may have been dropped */ + if (num_q_msg == IDPF_DFLT_MBX_Q_LEN) { + static atomic_t mbx_full = ATOMIC_INIT(0); + int cnt; + + cnt = atomic_inc_return(&mbx_full); + net_warn_ratelimited("%s: ctlq full (%d)\n", __func__, cnt); + } + for (i = 0; i < num_q_msg; i++) { if (!q_msg[i]) continue;