Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1924106lql; Wed, 13 Mar 2024 12:00:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXTglf0pY8PwmLoezjPl1LphUU2Sa6d6ZVID8ZA8PUea+DUvRuuF8pZUCesxh1sG5utFQ4O1r3PmghEAJIbJFx7FjK7F4ibNUxBeBDjJw== X-Google-Smtp-Source: AGHT+IH3klMxbjiDTfRdLGvcscGazm6+nvdl7qdLvpg3Le25e/p6AGYTZ4HtUJSQAHfdIYPcrCMU X-Received: by 2002:ac8:5a56:0:b0:42e:b2e9:36eb with SMTP id o22-20020ac85a56000000b0042eb2e936ebmr6907526qta.28.1710356425521; Wed, 13 Mar 2024 12:00:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710356425; cv=pass; d=google.com; s=arc-20160816; b=MlFMCkW2pLbT2AzEh4FkP84XINBQGkClORqb+ZyHMELSyhY+CjLLlwfnjFtCsDoQDF xy9Sxkr3kC9jsObqM3mI9RAR3gMELn6vwoE90DXYMx+TTN3vEFMSsCanDM3xY6A52PIf Q+0UNkDoPIaT9Zu6a5rnWWpX1vTxKHVmxf9KJfoD/w4dbwyipMFVSXWN4sid2LAWRSH7 J1isJTuQ8lTLWJG2qeK6rdXIYlnUh6Gc68pGDSYFVVjfC7cf2CtcYExx1sFIFPMIXfF9 ew602V4kvBUkTegbDogedocdLY/kmiIq4HIoTIbvUPBPIcyZKk08B5pPKZbaCDPeAR37 HF4g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=5UEYdMiZ1vcEMNvAnOtdk4ekyPB3q5c4UPNOfGmqfBI=; fh=bEaXtmS8lzRItYrE/RfaVyKNdc9i8y6GHBEJVBz/DUE=; b=EcbAPOOP7lyexkd+swk8/EAlovzMixbaNA6yWmWHK4dqhxbsW6K4zyiLBXB31Sm64B 20LgCfddPxQ1J5C7q05e+5PBIl8DsEhORfWWZ0IzGzXpcxNfGkaKYjt/33UZMrSA3o3f Xy0CTKJS/Y/GRaxp6SVYkWy4b6dGIWks5kM3IXKJoSOpsb3iozZS+UProQqAp643bLwR wsrJXWyqhoSgCsUcJ6xVyTwDWUOc5oZdvHW28/olIxIGqUBy49cErGhKdAnuf9+SD50U WGFEka0Xruj5tNDCH9DrDhps81p3FokGPU/MOSxSkOwedk4HgWa1OJhIRzZHePr/YFvu 6Pzw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ItqaNtW8; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-102326-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102326-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d11-20020a05622a15cb00b0042f513f3bc1si5277681qty.786.2024.03.13.12.00.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 12:00:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102326-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ItqaNtW8; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-102326-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102326-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 2D33A1C236B9 for ; Wed, 13 Mar 2024 19:00:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 811775DF0D; Wed, 13 Mar 2024 18:02:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ItqaNtW8" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 EFAF65D8FE for ; Wed, 13 Mar 2024 18:02:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710352925; cv=none; b=gEg7l4cujtM3pqJJN3CZW6xQCIWv8jt31jFlz6kd2NJXQFdb0kMVrDGD5jQcRBsfeuZEtJFOinmq/C/ZyRLS6YdJq7qJrIWZ8Xw/xHlwbQUo6IJHDZ8MBerbmKV6eZpKYHrzdYskXWEf0xwdVv3bT2sBp/7W9e20pizQFFNUd+A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710352925; c=relaxed/simple; bh=YS/A//x6PCebh/TWonZTX7b84I7rd//vuuT12T+EEYU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=jV4YaKqCpxfZzw+1l/4ABMIqYIBQ08/SRsjbADIoUpi9IYFb8h98ToNE/k5DSYnyY4vT7dokqgHG7Ww8TroUv3C0l0qOiLiyegnsGT3IOWGomwGwJiE6yZFawtb+ePykz3BnWkSenaVE7Hu7XWYu9gFI0UBdZSosKAa5U/gzCrA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ItqaNtW8; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710352921; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=5UEYdMiZ1vcEMNvAnOtdk4ekyPB3q5c4UPNOfGmqfBI=; b=ItqaNtW8AxS3LyJC6GUTlDiQNf18YY1NZk+HGP5B76/68AoTxeFioX3fMlqr46CGNv65RF JfksBkAcv70p0KRwGjBk4p9u/ehREIZerbXEgJxdW/RWpbl6RCHCq1CDkZ/Fkq9KRc/6Kk rfp6d713wVS8SA+HCzMMQTCrO2URcr0= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-336-ZvZIZRHwPJ6YkkSYFTIo-A-1; Wed, 13 Mar 2024 14:02:00 -0400 X-MC-Unique: ZvZIZRHwPJ6YkkSYFTIo-A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 200F53801F50; Wed, 13 Mar 2024 18:01:59 +0000 (UTC) Received: from vschneid-thinkpadt14sgen2i.remote.csb (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E25F5C04221; Wed, 13 Mar 2024 18:01:52 +0000 (UTC) From: Valentin Schneider To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-arch@vger.kernel.org, x86@kernel.org Cc: Thomas Gleixner , Borislav Petkov , Peter Zijlstra , Josh Poimboeuf , Pawan Gupta , Ingo Molnar , Dave Hansen , "H. Peter Anvin" , Paolo Bonzini , Wanpeng Li , Vitaly Kuznetsov , Arnd Bergmann , Jason Baron , Steven Rostedt , Ard Biesheuvel , Frederic Weisbecker , "Paul E. McKenney" , Feng Tang , Andrew Morton , "Mike Rapoport (IBM)" , Vlastimil Babka , David Hildenbrand , "ndesaulniers@google.com" , Michael Kelley , "Masami Hiramatsu (Google)" Subject: [PATCH v3 0/4] jump_label: Fix __ro_after_init keys for modules & annotate some keys Date: Wed, 13 Mar 2024 19:01:02 +0100 Message-ID: <20240313180106.2917308-1-vschneid@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Hi folks, This series fixes __ro_after_init keys used in modules (courtesy of PeterZ) and flags more keys as __ro_after_init. Compile & boot tested for x86_64_defconfig and i386_defconfig. @Peter, regarding making __use_tsc x86_32-only, I hit a few snags: Currently, for the static key to be enabled, we (mostly) need: o X86_FEATURE_TSC is in CPUID o determine_cpu_tsc_frequencies passes All X86_64 systems have a TSC, so the CPUID feature is a given there. Calibrating the TSC can end up depending on different things: o CPUID accepting 0x16 as eax input (cf. cpu_khz_from_cpuid()) o MSR_FSB_FREQ being available (cf. cpu_khz_from_msr()) o pit_hpet_ptimer_calibrate_cpu() doesn't mess up I couldn't find any guarantees for X86_64 on having the processor frequency information CPUID leaf, nor for the FSB_FREQ MSR (both tsc_msr_cpu_ids and the SDM seem to point at only a handful of models). pit_hpet_ptimer_calibrate_cpu() relies on having either HPET or the ACPI PM timer, the latter being widely available, though X86_PM_TIMER can be disabled via EXPERT. The question here is: are there any guarantees that at least one of these can be relied upon for x86_64? And with all of that, there is still the "apicpmtimer" cmdline option which currently invokes notsc_setup() on x86_64. The justification I found for it was in 0c3749c41f5e ("[PATCH] x86_64: Calibrate APIC timer using PM timer"): """ On some broken motherboards (at least one NForce3 based AMD64 laptop) the PIT timer runs at a incorrect frequency. This patch adds a new option "apicpmtimer" that allows to use the APIC timer and calibrate it using the PMTimer. """ Revisions ========= v2 -> v3 ++++++++ o Rebased against latest upstream o Fixed up jump_label_del_module() error in first patch reported by kernel test robot http://lore.kernel.org/r/202402191313.3276317d-oliver.sang@intel.com o Removed mds_user_clear patch; key was switched to an ALTERNATIVE by 6613d82e617d ("x86/bugs: Use ALTERNATIVE() instead of mds_user_clear static key") v1 -> v2 ++++++++ o Collected tags (Josh, Sean) o Fixed CONFIG_JUMP_LABEL=n compile fail (lkp) Cheers, Valentin Peter Zijlstra (1): jump_label,module: Don't alloc static_key_mod for __ro_after_init keys Valentin Schneider (3): context_tracking: Make context_tracking_key __ro_after_init x86/kvm: Make kvm_async_pf_enabled __ro_after_init x86/tsc: Make __use_tsc __ro_after_init arch/x86/kernel/kvm.c | 2 +- arch/x86/kernel/tsc.c | 2 +- include/asm-generic/sections.h | 5 ++++ include/linux/jump_label.h | 3 ++ init/main.c | 1 + kernel/context_tracking.c | 2 +- kernel/jump_label.c | 53 ++++++++++++++++++++++++++++++++++ 7 files changed, 65 insertions(+), 3 deletions(-) -- 2.43.0