Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp162458lqe; Fri, 5 Apr 2024 17:03:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVUiA3h9u8slx5lH6dMHs6ReBeFthv32YW5C0ipwwfGi8sv/faRXAGkGNSo+YRT+Bycdah4S6MnSCAOVKjWLtXbVSCKHU+dHsOwMp8UKA== X-Google-Smtp-Source: AGHT+IFAsgf8FNO80wSijItHzpr1FHTo2uofloyPiKUa0uT/HIQ7yqvV2761p0u2UVQBFJVK5wa/ X-Received: by 2002:a05:6808:258:b0:3c3:89af:128d with SMTP id m24-20020a056808025800b003c389af128dmr2854965oie.47.1712361795397; Fri, 05 Apr 2024 17:03:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712361795; cv=pass; d=google.com; s=arc-20160816; b=vzwd8P2xQY8HGcBaxq1dyau0K88VTzkmt4FxXl0KNsADDZIW2NsU5AdK8zUxRyU8qg ZOL3IQG9cQvP58yof9Eva3OQ0y/g6srFJqOv1zi79PHU5yoHSAPxdzylr/LhSjF4lG14 jjyol1EIim8+c12m9+TGz7iQJ0vG8Eb2WqZRM17lIQ7Pq8LXriagLC7DY1Surw/VeONu syNdQsxWgzNo99HjyucyJwPOoDr9WSwz0/JkEOBEVKvX4IOgTvMsZj6amy+sIdGbspdG 77xrAQhskQpgW95z8SxeZVLQbWAoT7SHYBar5RKENKbaTNAZhcuA6yEugRcBFWCDrb/x Es/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=g2EZMM7un4gCb6C5dgDAfVnR2eY/T3VaY8alF4x6rFg=; fh=1ARVOQzWxOr+ItXO76UA1EOEwrWFWbSrKT9+vhR6TY0=; b=YyonPyXvbkUZbBt7aLywPgZzl/q9/zoPw7Jl3Qfk3wUGremTikLfc+AjzSzQD9Nxf1 L2VoOj9Umok/7MWup1NGQXb979DM8xtXyD94gH5A9PqYYjP6jScUKTJqBnaX3XPmEbrx jjwIcWEFrlyHD6YY+m4rny5vk6hEUb55+Pj0iOR8BH61RITkJs5UD9QkRQGLVddXaSPV llOUvM6w4dSWEi+keYfU+dLaW7y4zQQDTmuVtNIHP7gPS/VwhlT+XR6yhO47DCLSFHqy QiI+EJ92jAdRxul+ke86Co9oaPg7yb27um3LxKRst3R00DJJPL/gT5U+yrxCvS/R7PxR HcAA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CG3TgztX; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-133728-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133728-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ec19-20020a05622a5b9300b004312a496392si2660029qtb.407.2024.04.05.17.03.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 17:03:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-133728-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CG3TgztX; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-133728-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133728-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 221E91C218E6 for ; Sat, 6 Apr 2024 00:03:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 30F93FBF0; Sat, 6 Apr 2024 00:03:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CG3TgztX" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 9E965816; Sat, 6 Apr 2024 00:03:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712361786; cv=none; b=SbA3khasmjRZ1Vfg2Fhh06B7Sl2jLSJpvpUWh4Ivg3UEfDjLnE5G1aeeU9cvg+iObwHYzdTmBVYTIThBKwYXO6eqxvWiBlobDyQURhETfEqmZKDbNvROHNh+QADB+evsWFaW2OeBOxdwHsJbzegjOWzbu5fbNcy/NMnKHy6km/A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712361786; c=relaxed/simple; bh=5+ttekEZLHQpyaO1iP5vIUkSvn9+MlpWyDlBi1o2uC0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lTJGjBBh+/RNtlzn/F8/5j+fAwN29w6nPtwZ/R8iPIskrls1e5ZTNjWKZlUqnrZkpiJqm/6CTqShD6/yRtetMMCczSdu+L6CrzrueHcyPO95ih3top5LCEQo4oirfXKE7Gx10ESvO0nyumvivmROm1jdXUkWUNX7SHi6ZDMGGoI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=CG3TgztX; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712361785; x=1743897785; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=5+ttekEZLHQpyaO1iP5vIUkSvn9+MlpWyDlBi1o2uC0=; b=CG3TgztXXawoWUj6a5VqKUbEOBezBAZE2x59mkjtyq87xc/FCFyskK48 8ig1KhDTaQem3VX/Cdy96N3rinrzuw2AzOYp765H9IX5P9sRVxb6q32qi 1M+L8DKtuDRv42W4oCP8+wRAv8HS/wNP3GBRTtrOpbWBsQZJxsHB0HqAL oTks+AqshnOeiFSnWaG2nuEUsga47aX/fQVd1jnd87gIJGbsXSZxieuvk oWaeyN2a7Y7rV6O4c4Gnx8uAX1ubMmRpL8fqmjCtUZrEgkd+/hV7quY4i vxWuY9Pdti3bnCW6xMzl62MYhXQcG7LZFKsZRgYpjl3eLOHOhnCVEsnJv A==; X-CSE-ConnectionGUID: YmEtQnnIQE+FrD7+qVnrmw== X-CSE-MsgGUID: T5bxxeTGQ+6PEkeY6Kabwg== X-IronPort-AV: E=McAfee;i="6600,9927,11035"; a="19071442" X-IronPort-AV: E=Sophos;i="6.07,182,1708416000"; d="scan'208";a="19071442" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2024 17:02:30 -0700 X-CSE-ConnectionGUID: E/h9uEyaRkSgY+NJKEllqw== X-CSE-MsgGUID: ewioc3H7R+CG3K+qX7ZKBA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,182,1708416000"; d="scan'208";a="19381024" Received: from djiang5-mobl3.amr.corp.intel.com (HELO [10.212.38.118]) ([10.212.38.118]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2024 17:02:25 -0700 Message-ID: <6f43f4be-f2da-4bc5-a70c-377599c9ec46@intel.com> Date: Fri, 5 Apr 2024 17:02:23 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 05/26] cxl/core: Simplify cxl_dpa_set_mode() Content-Language: en-US To: Ira Weiny , Fan Ni , Jonathan Cameron , Navneet Singh Cc: Dan Williams , Davidlohr Bueso , Alison Schofield , Vishal Verma , linux-btrfs@vger.kernel.org, linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240324-dcd-type2-upstream-v1-0-b7b00d623625@intel.com> <20240324-dcd-type2-upstream-v1-5-b7b00d623625@intel.com> <922007a0-3f85-4a40-80e4-5c906e6dd2c8@intel.com> <66104f505de74_e9f9f294f5@iweiny-mobl.notmuch> From: Dave Jiang In-Reply-To: <66104f505de74_e9f9f294f5@iweiny-mobl.notmuch> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 4/5/24 12:21 PM, Ira Weiny wrote: > Dave Jiang wrote: >> >> >> On 3/24/24 4:18 PM, Ira Weiny wrote: >>> cxl_dpa_set_mode() checks the mode for validity two times, once outside >>> of the DPA RW semaphore and again within. The function is not in a >>> critical path. Prior to Dynamic Capacity the extra check was not much >>> of an issue. The addition of DC modes increases the complexity of >>> the check. >>> >>> Simplify the mode check before adding the more complex DC modes. >> >> I would augment this by saying simplify "by using scope-based resource menagement". > > However, using the guard cleanup is not really the simplification here. It is > more about checking the mode a single time. > > That said I will change this to: > > Simplify the mode check and convert to use of a cleanup guard. Ok > > Ira