From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (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 100AC1BAEE3 for ; Fri, 30 Aug 2024 18:01:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725040884; cv=none; b=qRye2vDlKhoFkGhbjKw81rzHlnMNr/ut9hiVw7bc4Mr2RrsnIjgR4pQ+FC2mfFMeGoPSJnGklQh6aPky/GGBJunEAHAJ42PmkMsfbfxoQznx6H2pFv0Rb6l90BCRGDtx9a/u+1Uq8nK2JXx5vtbsoNePMuh2kykIOY8Zmgvgevc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725040884; c=relaxed/simple; bh=iONqyQ/8IRXyxLGbP8yDXUNOn1rmtSVFD3P6Y5gH4Rs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VzwRoD2B2znnD5+Fvx+QFY5ClIwoGZMxv1XAu5Q09S2zcl7C4hdal4IXCuIINLdJV07eRmTf+7ntmubOpYqlgem+KHkGo6b81hv+6PCCgb7xrAnfAqquqNr54wSQQNgay1A9Sf60252Xn/XJKzqJMZsEvaHTWb7y7IHSaoL4p0w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=WIdXrmX1; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="WIdXrmX1" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-7140ff4b1e9so1841219b3a.3 for ; Fri, 30 Aug 2024 11:01:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1725040882; x=1725645682; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=WHX2e16HhFXHNyVsyMjV+wt66b4YFtJkCjB0C7Pos18=; b=WIdXrmX1GUazbBuDiYqieW+IyGllXuGQglxoZDp9R4TnSr7irujhZbbeNsnX7VvcWE O+VzpdzjRPo+QSwx1i20hQoGf0cPQCvPOwOobEudxvs1SscITYMpvYTNyUf3FDs6yd8c GEKySrHNJ3Al92gQYqf2jpBvL9Th6Upl71txkzLxcZ72vA2qqya61qrikfVbuwBSSxHJ jSRk1z24X6ateLvjgLOZ3GjgSGvoQzr5KNksSEDd1yV+OfNBRIvhS9qmuJZFm76fCL2X ZDEckrZ0560knSxJmNN3piIJXBk55b47LXY8oUbYcBi9CyOmtauZJYBkMMCIk0YG+bKz RbjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725040882; x=1725645682; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WHX2e16HhFXHNyVsyMjV+wt66b4YFtJkCjB0C7Pos18=; b=AoXYv4eAaLAhJhqu04cY/fJniIaQgE8FH3aRuJQNgLH25eu0QCzHES0vP/SlKxSY39 6QlvaZX0mKmfMeyX26Cubp6FtaARbngTardK8eihJ2MfuS8fWN0ADM5CY7FhqOYcaUoh 03z1XDsFUnVZu1GhJfs0HPyBaUoE/C38p8OqV1KkumsFsJpWjX4KdcdZPuM9oQpz8LLc PwQNy5R4UhemyUsBNMBirMNrPxAShly29VvdMc+Jrgrvavm8bFVGAbbWs4yiVzCwXz12 WC+E8lali5URNOwvw+J+thuMWf6PM2svP588TvvMn9EpfRjxA1fWDPCqjLkGQSntvIq1 f3Ig== X-Forwarded-Encrypted: i=1; AJvYcCXT4w0npXESZg6rre50FLvQmkkTvWMsJ0FyppdCUZLa/7tJRme5wqDnj2jY2PVQXditIn/JCZ5S+L1Sbu8=@vger.kernel.org X-Gm-Message-State: AOJu0YwaTsBcQMbf1VzIlhXPpOl5X4UAfW8xwv3GguWxCRvYVpz2IMlU 1sneJgIu/+9K5M+WJbI9Vl98Hx/vyptzHUw2RrgDADANZyqOXYTVJVTgrdoRHfQ= X-Google-Smtp-Source: AGHT+IEFG8jRDeUE2XzEv/D/mcMBxmEig6pfl17gyEOiCPD1MBq5+4FIl0XovF0o+BsUsWuJ23oV4w== X-Received: by 2002:a05:6a20:d494:b0:1c4:8da5:21a4 with SMTP id adf61e73a8af0-1cce10aed82mr5375029637.41.1725040881940; Fri, 30 Aug 2024 11:01:21 -0700 (PDT) Received: from medusa.lab.kspace.sh (c-98-207-191-243.hsd1.ca.comcast.net. [98.207.191.243]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-715e569e9a9sm3046256b3a.117.2024.08.30.11.01.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Aug 2024 11:01:21 -0700 (PDT) Date: Fri, 30 Aug 2024 11:01:19 -0700 From: Mohamed Khalfella To: Alexander Lobakin Cc: Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , yzhong@purestorage.com, Tariq Toukan , Shay Drori , Moshe Shemesh , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/1] net/mlx5: Added cond_resched() to crdump collection Message-ID: References: <20240829213856.77619-1-mkhalfella@purestorage.com> <20240829213856.77619-2-mkhalfella@purestorage.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On 2024-08-30 15:07:45 +0200, Alexander Lobakin wrote: > From: Mohamed Khalfella > Date: Thu, 29 Aug 2024 15:38:56 -0600 > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.c > > index 6b774e0c2766..bc6c38a68702 100644 > > --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.c > > +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.c > > @@ -269,6 +269,7 @@ int mlx5_vsc_gw_read_block_fast(struct mlx5_core_dev *dev, u32 *data, > > { > > unsigned int next_read_addr = 0; > > unsigned int read_addr = 0; > > + unsigned int count = 0; > > > > while (read_addr < length) { > > if (mlx5_vsc_gw_read_fast(dev, read_addr, &next_read_addr, > > @@ -276,6 +277,9 @@ int mlx5_vsc_gw_read_block_fast(struct mlx5_core_dev *dev, u32 *data, > > return read_addr; > > > > read_addr = next_read_addr; > > + /* Yield the cpu every 128 register read */ > > + if ((++count & 0x7f) == 0) > > + cond_resched(); > > Why & 0x7f, could it be written more clearly? > > if (++count == 128) { > cond_resched(); > count = 0; > } > > Also, I'd make this open-coded value a #define somewhere at the > beginning of the file with a comment with a short explanation. What you are suggesting should work also. I copied the style from mlx5_vsc_wait_on_flag() to keep the code consistent. The comment above the line should make it clear. > > BTW, why 128? Not 64, not 256 etc? You just picked it, I don't see any > explanation in the commitmsg or here in the code why exactly 128. Have > you tried different values? This mostly subjective. For the numbers I saw in the lab, this will release the cpu after ~4.51ms. If crdump takes ~5s, the code should release the cpu after ~18.0ms. These numbers look reasonable to me.