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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D69E0CCA481 for ; Wed, 22 Jun 2022 16:00:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376375AbiFVQA5 (ORCPT ); Wed, 22 Jun 2022 12:00:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358292AbiFVQAp (ORCPT ); Wed, 22 Jun 2022 12:00:45 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 871F81BE92 for ; Wed, 22 Jun 2022 08:59:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655913559; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1NdMm0iLNJd/24Dw1R7/L5qi45bvELpzRHktbWg9Imw=; b=ijWCg7GsekodFLv5BQmeK35nxGlJXuYoMufUQaBdd2Cq+mtUX3pU98VKFvm63XTqCQNb+L mP4KTC5QeSnAV+qIrYvFl8Atd/eUEPS0/uHnKYq3R39undOhMklbz4F1m0iPUKJ/2XHJwV GpJznaN3OXpjlU6CFHIZ0DhmbadU+gM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-250--_HLc7psOCOZoQTxdDKulQ-1; Wed, 22 Jun 2022 11:59:13 -0400 X-MC-Unique: -_HLc7psOCOZoQTxdDKulQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 93720101E165; Wed, 22 Jun 2022 15:59:12 +0000 (UTC) Received: from starship (unknown [10.40.194.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E0BB40D282F; Wed, 22 Jun 2022 15:59:07 +0000 (UTC) Message-ID: Subject: Re: [PATCH 2/4] x86/cpuid: refactor setup_clear_cpu_cap/clear_feature From: Maxim Levitsky To: Dave Hansen , linux-kernel@vger.kernel.org Cc: "Chang S. Bae" , Jiri Olsa , linux-perf-users@vger.kernel.org, Peter Zijlstra , "H. Peter Anvin" , "David S. Miller" , Borislav Petkov , Kees Cook , Mark Rutland , Alexander Shishkin , Namhyung Kim , Tim Chen , Pawan Gupta , Herbert Xu , Dave Hansen , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Jane Malalane , Tony Luck , Ingo Molnar , Thomas Gleixner , Arnaldo Carvalho de Melo , "open list:CRYPTO API" , Paolo Bonzini Date: Wed, 22 Jun 2022 18:59:06 +0300 In-Reply-To: <677c46db-02ef-24b8-c25f-762b41fb8bdb@intel.com> References: <20220622144820.751402-1-mlevitsk@redhat.com> <20220622144820.751402-3-mlevitsk@redhat.com> <677c46db-02ef-24b8-c25f-762b41fb8bdb@intel.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org On Wed, 2022-06-22 at 08:07 -0700, Dave Hansen wrote: > On 6/22/22 07:48, Maxim Levitsky wrote: > > Simplify the code a bit by always passing &boot_cpu_data > > in case the setup_clear_cpu_cap was called. > > > > Also unify clear_cpu_cap and do_clear_cpu_cap. > > Please always add a "()" suffix to functions. "foo" is a variable, but > "foo()" is a function. Will do next time! > > I also really like when a changelog has a clear problem statement. I > _think_ the problem here is something along the lines of the 'c' > argument to clear_feature() having different behavior when it is NULL > versus '&boot_cpu_data'. To be honest I didn't try to fix any problem here, I just wanted to simplify clear_feature() a bit by avoiding a recursive call to clear_cpu_cap. > > Basically, there's no reason to support clearing a bit in > '&boot_cpu_data' without also setting that bit in 'cpu_caps_cleared'. > > { > > - do_clear_cpu_cap(NULL, feature); > > + clear_cpu_cap(&boot_cpu_data, feature); > > } I'll try to think about a better changelog message for this. Thank you! Best regards, Maxim Levitsky