From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1A2D1C27C4F for ; Tue, 18 Jun 2024 13:33:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C21AF613A6; Tue, 18 Jun 2024 13:33:30 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id oiyO29-uFrTA; Tue, 18 Jun 2024 13:33:29 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org BD297610E6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1718717609; bh=iJ6Ykm/kYhyCZT21ejKzNBRvOF1gIP1y0gYvOZ308+g=; h=Date:From:To:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=PZOUGuCiI7RYQGczKq6TW8ImUyx1DpwYrJIzqL3mG9HFP5hEoiyILopMhXnYn05jV iabRh8hZDHf/KP4VZqobGIePpqbit9bJQNTwjXN5a6VUNfkEFUwNgt+8CzjcIM7ms5 5ut1tcdiVO7MYVzNi4cT0MohwunQmVdGtsUwfP3vySg+QL5Ln/AlxuVTWdqZugZxvH RS3jKS+SFqJEm1Z0ilmYsdnr+be3VaDrgV757CHD4SdO39nPqM3C/tEap/yjX6id4M d8Ledhyr+GoeCLzJU6F2nNMokYHew+wYAQ85y6idI4MDs8cqVbYEG8CQmtVptmbJhh uv30pFrkXPXJQ== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id BD297610E6; Tue, 18 Jun 2024 13:33:29 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id B5BAF1BF3BB for ; Tue, 18 Jun 2024 13:33:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id A0DD140148 for ; Tue, 18 Jun 2024 13:33:28 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 86cTIlUUu9YJ for ; Tue, 18 Jun 2024 13:33:28 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=139.178.84.217; helo=dfw.source.kernel.org; envelope-from=horms@kernel.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org BD07E42A9C DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org BD07E42A9C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by smtp4.osuosl.org (Postfix) with ESMTPS id BD07E42A9C for ; Tue, 18 Jun 2024 13:33:27 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 90379618E1; Tue, 18 Jun 2024 13:33:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F25CC3277B; Tue, 18 Jun 2024 13:33:23 +0000 (UTC) Date: Tue, 18 Jun 2024 14:33:22 +0100 From: Simon Horman To: Przemek Kitszel Message-ID: <20240618133322.GO8447@kernel.org> References: <20240617132407.107292-1-przemyslaw.kitszel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240617132407.107292-1-przemyslaw.kitszel@intel.com> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718717606; bh=JZuxPolsAuRkq/uBpCeDrZdRmxqz2tm0CZN2xEu8kkY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iMOK6oywWe2jFel/MCtr2voYqPZp1PbAfEkZPwnNz8U82L97ffeEgbK/X/3V5Nt7v NIOza4F1iQtjYocHeJOFJg6RFO0on6A4rAdVIJ54IbZc0/SsNlPZclVnA+CLtOk7tg HjNj03vEWDJtb/ElnbD5jQc+6ww3HU6DVjdhVcc83ciok2+6wNywjli8F0WT8cmI1j Q8dOMuxxX6FOiuDQlP2Ut+KNZEGjtCeCrU6heg528OYIn4yuwvw8ZXSQOaitoomW8h Ofvi+w9LWQWwLqTb8li2mUEXhBXPLSl9wiXfi1OVFl/mimghgqXq5DRKV0A7YDjYIV 4zY0MYgl2Op9A== X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=kernel.org X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=iMOK6oyw Subject: Re: [Intel-wired-lan] [PATCH iwl-next v1] ice: do not init struct ice_adapter more times than needed X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jiri Pirko , Sergey Temerkhanov , netdev@vger.kernel.org, Lukasz Czapnik , Wojciech Drewek , Tony Nguyen , Jakub Kicinski , Jacob Keller , intel-wired-lan@lists.osuosl.org Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On Mon, Jun 17, 2024 at 03:24:07PM +0200, Przemek Kitszel wrote: > Allocate and initialize struct ice_adapter object only once per physical > card instead of once per port. This is not a big deal by now, but we want > to extend this struct more and more in the near future. Our plans include > PTP stuff and a devlink instance representing whole-device/physical card. > > Transactions requiring to be sleep-able (like those doing user (here ice) > memory allocation) must be performed with an additional (on top of xarray) > mutex. Adding it here removes need to xa_lock() manually. > > Since this commit is a reimplementation of ice_adapter_get(), a rather new > scoped_guard() wrapper for locking is used to simplify the logic. > > It's worth to mention that xa_insert() use gives us both slot reservation > and checks if it is already filled, what simplifies code a tiny bit. > > Reviewed-by: Wojciech Drewek > Signed-off-by: Przemek Kitszel Reviewed-by: Simon Horman From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65848155354 for ; Tue, 18 Jun 2024 13:33:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718717606; cv=none; b=oYcV6wYhIzdLE7yvJr8J0nEVLuwgssoMuJgQ6+k72hVVwnBMxw/bReSRMbklU3m7jhvH3AZbA3fd2KGg/J34zMdQchURSGPT9iVfDXml6s4VOnJ0375b5uzIZmyxOFrpPwGF8As1dmwBkjtzZOFpfgQm19ldm49O3wiKwtlOpNE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718717606; c=relaxed/simple; bh=JZuxPolsAuRkq/uBpCeDrZdRmxqz2tm0CZN2xEu8kkY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PlN6wftBZr2te6PNNc0ccy6p6390ZOpA3fFqOiKNxRexyaCbyPRC0CgX7QcksZpd++BWLVgX7fnpZsW/BGUyBSza9874zkqTlk6+mLz2abHCoFL7eK1oVqRTIWUSRYozVwZl4sTt/Gj44BFDpsJDBXEhCOLpNPF/E9PVtaznr+A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iMOK6oyw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iMOK6oyw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F25CC3277B; Tue, 18 Jun 2024 13:33:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718717606; bh=JZuxPolsAuRkq/uBpCeDrZdRmxqz2tm0CZN2xEu8kkY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iMOK6oywWe2jFel/MCtr2voYqPZp1PbAfEkZPwnNz8U82L97ffeEgbK/X/3V5Nt7v NIOza4F1iQtjYocHeJOFJg6RFO0on6A4rAdVIJ54IbZc0/SsNlPZclVnA+CLtOk7tg HjNj03vEWDJtb/ElnbD5jQc+6ww3HU6DVjdhVcc83ciok2+6wNywjli8F0WT8cmI1j Q8dOMuxxX6FOiuDQlP2Ut+KNZEGjtCeCrU6heg528OYIn4yuwvw8ZXSQOaitoomW8h Ofvi+w9LWQWwLqTb8li2mUEXhBXPLSl9wiXfi1OVFl/mimghgqXq5DRKV0A7YDjYIV 4zY0MYgl2Op9A== Date: Tue, 18 Jun 2024 14:33:22 +0100 From: Simon Horman To: Przemek Kitszel Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, Tony Nguyen , Lukasz Czapnik , Sergey Temerkhanov , Jacob Keller , Jiri Pirko , Michal Schmidt , Jakub Kicinski , Wojciech Drewek Subject: Re: [PATCH iwl-next v1] ice: do not init struct ice_adapter more times than needed Message-ID: <20240618133322.GO8447@kernel.org> References: <20240617132407.107292-1-przemyslaw.kitszel@intel.com> Precedence: bulk X-Mailing-List: netdev@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: <20240617132407.107292-1-przemyslaw.kitszel@intel.com> On Mon, Jun 17, 2024 at 03:24:07PM +0200, Przemek Kitszel wrote: > Allocate and initialize struct ice_adapter object only once per physical > card instead of once per port. This is not a big deal by now, but we want > to extend this struct more and more in the near future. Our plans include > PTP stuff and a devlink instance representing whole-device/physical card. > > Transactions requiring to be sleep-able (like those doing user (here ice) > memory allocation) must be performed with an additional (on top of xarray) > mutex. Adding it here removes need to xa_lock() manually. > > Since this commit is a reimplementation of ice_adapter_get(), a rather new > scoped_guard() wrapper for locking is used to simplify the logic. > > It's worth to mention that xa_insert() use gives us both slot reservation > and checks if it is already filled, what simplifies code a tiny bit. > > Reviewed-by: Wojciech Drewek > Signed-off-by: Przemek Kitszel Reviewed-by: Simon Horman