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 X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58D39C11D3D for ; Thu, 27 Feb 2020 18:01:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 30BC2246A1 for ; Thu, 27 Feb 2020 18:01:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CacxHc1s" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730406AbgB0SBY (ORCPT ); Thu, 27 Feb 2020 13:01:24 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36505 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729162AbgB0SBX (ORCPT ); Thu, 27 Feb 2020 13:01:23 -0500 Received: by mail-wr1-f65.google.com with SMTP id j16so3028709wrt.3; Thu, 27 Feb 2020 10:01:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E8ZWbS7tq2JVdfpTRDo8i0zrwTusfBz0dP/4sGTaYhE=; b=CacxHc1sX0lFECQt6xnPa7ab2DoBIXez7pUXgytY0T13W9k/YHrXteFuXYxvWcEtUL baWCq6Qjq1ofXIkAixN4zKjzxO6kA2z+bqxFXH8Qw+yoLwofFIeaEp+/Jhj0lWX//7nP sh8h/bX6nea9yMt/EZENdgjMMRbGV5qEuFHjj+kvap62I/5xBlT6LYb1aTH80jUYy1HR VDdb5vmtm8ksc5UEndBJRQAMSg24SVWx7f/g8HHE8is4YiwD/z7UU0sR1DXLe+pYvVqt Mvzcodidc1E5Fy+gWW11vodldtQoIjasP1oQkbE5JcCrt6u5hH+rlyviWCD2rJ0XH7tQ BzFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E8ZWbS7tq2JVdfpTRDo8i0zrwTusfBz0dP/4sGTaYhE=; b=WheFHmimv/nuAhsWh7A2xLg4Lm8U/Nwwj1CoHiR2v1oUXJlaT+eH50OstMp1jtx82D XCzI2+IUkerkqYYl6/IAVLLIRZIQNZC+Pf6P0+8NXnyX6UZgL0TO+ZrYJyakKld9x1y7 +br0PT+vWEaLTmbhSdRy8jq2OuJKe2/qPOH2/RfedOCOjAvbNkAmvsfjVKQs0v9Q6zL/ ResmSbEdjYhWZpPw5iVMFGlRI/LdcCy2bikjfeS88REyUKvjbxx9eNgGwB3XUABU64uY rgzaAVn39D4zsQPlgL5ZGJ4nW4KgvY6LMvlG+Bn8S36mQSHDjHz7bL3PVWbUSZ+2dvGV OzLQ== X-Gm-Message-State: APjAAAXpCmbvqok6pnV6T3UjzIelgMsxf9uAX1zdr/z6/Ihpz9LBDuAf qm76eupUyhXxVK8BvgjRdss= X-Google-Smtp-Source: APXvYqzd3Adej9lxNHdKHQ4vxXxVbjCB5TS6CY9IBBvPvHdwJ/a5fmSIuHpqkTy37ODZrIE+SJGI8g== X-Received: by 2002:adf:ef4e:: with SMTP id c14mr35395wrp.335.1582826480343; Thu, 27 Feb 2020 10:01:20 -0800 (PST) Received: from laptop.criteo.prod ([2a01:e34:eecb:7400:6cb4:8756:33ca:8626]) by smtp.gmail.com with ESMTPSA id b186sm8582287wmb.40.2020.02.27.10.01.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 10:01:19 -0800 (PST) From: Erwan Velu X-Google-Original-From: Erwan Velu Cc: Erwan Velu , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)), kvm@vger.kernel.org (open list:KERNEL VIRTUAL MACHINE FOR X86 (KVM/x86)), linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)) Subject: [PATCH v2] kvm: x86: Limit the number of "kvm: disabled by bios" messages Date: Thu, 27 Feb 2020 19:00:46 +0100 Message-Id: <20200227180047.53888-1-e.velu@criteo.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200214143035.607115-1-e.velu@criteo.com> References: <20200214143035.607115-1-e.velu@criteo.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In older version of systemd(219), at boot time, udevadm is called with : /usr/bin/udevadm trigger --type=devices --action=add" This program generates an echo "add" in /sys/devices/system/cpu/cpu/uevent, leading to the "kvm: disabled by bios" message in case of your Bios disabled the virtualization extensions. On a modern system running up to 256 CPU threads, this pollutes the Kernel logs. This patch offers to ratelimit this message to avoid any userspace program triggering this uevent printing this message too often. This patch is only a workaround but greatly reduce the pollution without breaking the current behavior of printing a message if some try to instantiate KVM on a system that doesn't support it. Note that recent versions of systemd (>239) do not have trigger this behavior. This patch will be useful at least for some using older systemd with recent Kernels. Signed-off-by: Erwan Velu --- arch/x86/kvm/x86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 359fcd395132..c8a90231befe 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -7308,12 +7308,12 @@ int kvm_arch_init(void *opaque) } if (!ops->cpu_has_kvm_support()) { - printk(KERN_ERR "kvm: no hardware support\n"); + pr_err_ratelimited("kvm: no hardware support\n"); r = -EOPNOTSUPP; goto out; } if (ops->disabled_by_bios()) { - printk(KERN_ERR "kvm: disabled by bios\n"); + pr_err_ratelimited("kvm: disabled by bios\n"); r = -EOPNOTSUPP; goto out; } -- 2.24.1