Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5819009rdb; Sun, 17 Sep 2023 14:03:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGn7yoxjjWFjX37nhlrh1fVpqun9U8SMppEWUoxxVlmHtcBoel3/RxNtIyG19BK8/AaS+39 X-Received: by 2002:a17:90b:1e11:b0:274:638d:da9a with SMTP id pg17-20020a17090b1e1100b00274638dda9amr6437193pjb.34.1694984600495; Sun, 17 Sep 2023 14:03:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694984600; cv=none; d=google.com; s=arc-20160816; b=Rn4Q8YHsIcUCOaIZP7JIeAwZZgLQrH/I0vWNS9+5NOqNSQhFMz8Ej3RONyjwFDbDBO pxFND6S+l54eUjzrkXqfYftnb11LEL4xZspIcV3Z/k3BgaKY62jVsUUDwlhfTlmOFlL+ NfW9jH9d9MB6DpOaE2kxtNghs2TvTJKYWtbdsvA+/9NJU1KSQ/wvfBPHkZ9QAuxLqpxi Fi2T9VLaAkkEQdyWnKFkIToPfN55r9nfEXPCD/CG9v95vKDagUVblVodiH46Atgq/P+1 p6ifpeq9fnKtKjRo1A/QyBJFkFZUptdXib3hhDckSy8nb2XiS5DkTJYMYvK+pCQg+L2N YAjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=rQrwAUkPTCf7mEWbGe5HicgNN0apRCUhmUHCoHth/Ys=; fh=UbhKPdNltO1HRoVv8XN24jKRC3BmjGtx+PtfI9DlwMM=; b=vVXoV0tnMQF2LAi99u5cmpltxxTnkQAEWSkDHNmBZNB8U3NMPYC8gybM7OmkB2c5B6 /xDTJ8nMeRjFqVDM24TacBPaLhcXm4/GdvGY772gPN1gPp06R4xojJn6YekiFCd/Vt1Z ruV0eWrLybDH6iVJtdg65d/8tgn6btDabeD7tMamgv0AmY4n/HhinngXkjuWyhAHUlYI kA2R4NAANTnla+bXd2pnUZk3fra/1FWy2PusK5ZDTRkAv5r4VOICTtiDII6/3NEJQZfy BCyTS9FyiGjxEPpgFi8TlowyHAmNo9IFqDzkzOft155SxEdhgQgMpzYxzVU9HnrZAid/ Tdng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id l6-20020a17090ac58600b0026f73c2056dsi6777979pjt.184.2023.09.17.14.03.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Sep 2023 14:03:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id D4B8981D6D8F; Sun, 17 Sep 2023 14:02:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239029AbjIQVB1 convert rfc822-to-8bit (ORCPT + 99 others); Sun, 17 Sep 2023 17:01:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239717AbjIQVBM (ORCPT ); Sun, 17 Sep 2023 17:01:12 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAFE6B6 for ; Sun, 17 Sep 2023 14:01:03 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-173-5VIfJed7MXGh7MjJ3HyGRg-1; Sun, 17 Sep 2023 22:00:50 +0100 X-MC-Unique: 5VIfJed7MXGh7MjJ3HyGRg-1 Received: from AcuMS.Aculab.com (10.202.163.4) by AcuMS.aculab.com (10.202.163.4) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sun, 17 Sep 2023 22:00:40 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Sun, 17 Sep 2023 22:00:40 +0100 From: David Laight To: 'James Morse' , "x86@kernel.org" , "linux-kernel@vger.kernel.org" CC: Fenghua Yu , Reinette Chatre , Thomas Gleixner , "Ingo Molnar" , Borislav Petkov , H Peter Anvin , Babu Moger , "shameerali.kolothum.thodi@huawei.com" , D Scott Phillips OS , "carl@os.amperecomputing.com" , "lcherian@marvell.com" , "bobo.shaobowang@huawei.com" , "tan.shaopeng@fujitsu.com" , "xingxin.hx@openanolis.org" , "baolin.wang@linux.alibaba.com" , Jamie Iles , Xin Hao , "peternewman@google.com" , "dfustini@baylibre.com" , "amitsinght@marvell.com" Subject: RE: [PATCH v6 09/24] x86/resctrl: Use set_bit()/clear_bit() instead of open coding Thread-Topic: [PATCH v6 09/24] x86/resctrl: Use set_bit()/clear_bit() instead of open coding Thread-Index: AQHZ5zAaDgmrK1w/n0WuE13QIAvATLAfhSSQ Date: Sun, 17 Sep 2023 21:00:40 +0000 Message-ID: <6f7b411db77846b2a305b93d0cf0ee7b@AcuMS.aculab.com> References: <20230914172138.11977-1-james.morse@arm.com> <20230914172138.11977-10-james.morse@arm.com> In-Reply-To: <20230914172138.11977-10-james.morse@arm.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sun, 17 Sep 2023 14:02:33 -0700 (PDT) From: James Morse > Sent: 14 September 2023 18:21 > > The resctrl CLOSID allocator uses a single 32bit word to track which > CLOSID are free. The setting and clearing of bits is open coded. > > A subsequent patch adds resctrl_closid_is_free(), which adds more open > coded bitmaps operations. These will eventually need changing to use > the bitops helpers so that a CLOSID bitmap of the correct size can be > allocated dynamically. > > Convert the existing open coded bit manipulations of closid_free_map > to use set_bit() and friends. > > int closids_supported(void) > @@ -126,7 +126,7 @@ static void closid_init(void) > closid_free_map = BIT_MASK(rdt_min_closid) - 1; > > /* CLOSID 0 is always reserved for the default group */ > - closid_free_map &= ~1; > + clear_bit(0, &closid_free_map); Don't the clear_bit() etc functions use locked accesses? These are always measurably more expensive than the C operators. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)