Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp657535lqt; Fri, 19 Apr 2024 06:55:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWtMNLuHcZlRiWgjuK/bB/hBtlHPml9sl5cnbsiHb5/vjlEQPo1HN+52dnkOaTP0Jgsr0K7/Ia2bFVy1exY722agJ6Ps1Nb8lYcUPIOrQ== X-Google-Smtp-Source: AGHT+IF5E2rHtAiSiE+hqKdavkSqoj2/5wD8UasMl51l2R0ekLsZfBBy3KaolDNKWUsdaFGQt610 X-Received: by 2002:a17:902:f791:b0:1e8:b768:2c32 with SMTP id q17-20020a170902f79100b001e8b7682c32mr2487931pln.20.1713534956050; Fri, 19 Apr 2024 06:55:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713534956; cv=pass; d=google.com; s=arc-20160816; b=ExQYmFrlJDH+20XWEwN8bZfK+Ybrd7rfOQ+LGp72mOs9cOiDhVvNro86vSKE8k+CM8 cnNXZJrbXt/XaHF2bnQ9dJQcTBPvhe3FA0JMkCFpAVYppCYQM84UPJUC6J52YXcHymeL N9aGbtgJXCLKrqt0TdgesuRKciNBY0oYryt9sixuWQlF96CZ+X6GvBr1J1cvyeA9jlIY qCskjH2ZXMi0LJXGBie0BtA2Yv5L5CTRuMNevlVj4Lsaii8IBqAblwcIX0XJtUWrd2oG Ha1pRsEvEcm47A9cgy4znLESlp7Nlmz8Nb04pIVmpmB9xDPLICVK/tGFBCdyF3+seQuG mJKg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=eIbLUE3R+om1X38nMWnrzy+JncLTgQydVTTv5mFU/to=; fh=iPKbJouNg6YX8oP4psgxdaD6zUjMrT2bcmRGH0qq0+o=; b=sXHkYSAC9DAuOtuOOkZK6u9Bpf0bScs6CUHvyMS0oNv7qh0fWc/AcUrJl38Fx6bM55 RA5sua3JedJULXtWI0mC5cpjlEsHdNmLit+ALwPvX9xXAVoAeYS+Iqx65NZCvztsU5Va K7m+DLbdDqtHCtVRfMuvX6VRomGB7aWOkOEddU1kmS1aolcaHLfhJypFLIvIn7QLHs4H AzZ5APVOMxk5ISIrjPwMnGOKNH0Y/yvho1T6rTRJrTHE4kWeC4n1LGee7kVsVCVznIWB 4DRW1si9d0DL9LkGD6RldxefDan7FzEn5/brdP4rmcfft/B+ZB/9+baC8rH6/L6L2JzJ gVfg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=yhS8pdkg; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-151492-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151492-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id j7-20020a170903028700b001e2c37aca1dsi3366889plr.109.2024.04.19.06.55.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 06:55:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151492-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=yhS8pdkg; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-151492-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151492-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 78EF8B21A06 for ; Fri, 19 Apr 2024 13:42:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 319AE12C817; Fri, 19 Apr 2024 13:41:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="yhS8pdkg" Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 138B312A14B for ; Fri, 19 Apr 2024 13:41:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713534110; cv=none; b=cmq+kVmqaqIU1mh6WZlEajvpqUg8sMs3DP5ES1dMbZqhbj6Y6aqvEwFC/KEWZikGOTuNT2NMryFLEbE+VCfOKsmX7i1hb9Y42Z4SAMgkh2mdCrr79EehNZpH7j1mZBxs0zmNxS2K/1z4NDLNoHSBHPufwM9rWWAuXfx1SXjwpjc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713534110; c=relaxed/simple; bh=++wcf7Oo4HULNgJkZlzxzN8ZrDnid6G0r8PM+hd/TmA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=mfrHKfgF2N/sRzsp96HaRa3li97EBPy4Rnh+B4q9ubnfXDSW9IHpxYANwVBxHgvYIvKiRA2eUAFoVyUfyVPpewFykP8wsBDUvzVsOFr5a4N4vf+JWcYhzfPQGVQqzAFuakvHGtl7FGlFzKQKJDSqnRIvTcoERyMitEDwt50Fjx4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=yhS8pdkg; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-de46f4eacd3so3225155276.3 for ; Fri, 19 Apr 2024 06:41:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1713534108; x=1714138908; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=eIbLUE3R+om1X38nMWnrzy+JncLTgQydVTTv5mFU/to=; b=yhS8pdkg5a0QmmX07joNPZJ0N4sU0obGDf6bRs3TVSq11kdwDWrV2dp0S34rlwlkN1 iBLI9kvtOwYSmtla4xBsqI3NgAhVW/o0WGzVGMqUdkaAVTEMQQ+u5jBuotUDBPNekhUA 6yDZE6n/pkcuDReGrlYG9mTy48l5Wg/VeFK8ZZZlOO0D8eMjEHpe/0N5U2aVYMKNcPP/ 2O6ofg8VDMxwmxGSN/faxHXi9tlhY2D8JWh6BRWXrwOq3z2ogq5kPrA+NQ59lQAqYfjH b/A5qWjFY9Ug+IPinjO55AorMBOcgVKn3CM8jFCvXgMz1Ma1Nigch69YJgquBIl5IOtZ x/CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713534108; x=1714138908; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eIbLUE3R+om1X38nMWnrzy+JncLTgQydVTTv5mFU/to=; b=dGFcyLD7ZeYBVyWFv3jUS+x1+zieC+ETY/70xHVIyim4fYc+UWgMHyBA5ZOXlhYg5c 00v7LP7r517RKqFcV8hFW9X51dJAe5mYhl0sGH0wgZekERZM3/Wj1+NLct40GlxLWOd3 RJgVMjT7mWfNJcLXhWJslgvMQu8kIlaNMZwKWIOc2H8lTpCidTCZUhxpa5ZczQ4wyb8r KWeUf8gkXO4nQkQj4moRvf1fNYE5srMlWf9B2szPG4u83q8zJo0ROadPn65rF9NrYNck UlLaECaaqbiG0u2sO6GYd6rKZbNlFiDUh3reFc3WxF2Ig8RIJbzgWpV904ozQUG8J9pf jE3Q== X-Forwarded-Encrypted: i=1; AJvYcCWJxwoFEYU612MsR9UizsM/chRWrNuxzkw6Tw9hly1hpP4eJ17uW0kvgAIZvOgnfttiqk2N4FLRKdf+RV6Rn3ADSmtRM+OaPpXr5YBr X-Gm-Message-State: AOJu0Yx4kkRnSZiLbs3cdgs+/FfVcSmdLsYmvKItVLj1tz3dTpddlEwS wrkl0umspnz8A/SRvaBHeGk3aaSq5iX+lrybayTqQJMJMvcJZtzfje9Uw7Q+7gz1g5IfsllnSNm Fjw== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6902:100e:b0:de4:c2d4:e14f with SMTP id w14-20020a056902100e00b00de4c2d4e14fmr404835ybt.11.1713534108121; Fri, 19 Apr 2024 06:41:48 -0700 (PDT) Date: Fri, 19 Apr 2024 06:41:46 -0700 In-Reply-To: <20240419112952.15598-5-wei.w.wang@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240419112952.15598-1-wei.w.wang@intel.com> <20240419112952.15598-5-wei.w.wang@intel.com> Message-ID: Subject: Re: [RFC PATCH v2 4/5] KVM: x86: Remove KVM_X86_OP_OPTIONAL From: Sean Christopherson To: Wei Wang Cc: pbonzini@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="us-ascii" On Fri, Apr 19, 2024, Wei Wang wrote: > KVM_X86_OP and KVM_X86_OP_OPTIONAL were utilized to define and execute > static_call_update() calls on mandatory and optional hooks, respectively. > Mandatory hooks were invoked via static_call() and necessitated definition > due to the presumption that an undefined hook (i.e., NULL) would cause > static_call() to fail. This assumption no longer holds true as > static_call() has been updated to treat a "NULL" hook as a NOP on x86. > Consequently, the so-called mandatory hooks are no longer required to be > defined, rendering them non-mandatory. This is wrong. They absolutely are mandatory. The fact that static_call() doesn't blow up doesn't make them optional. If a vendor neglects to implement a mandatory hook, KVM *will* break, just not immediately on the static_call(). The static_call() behavior is actually unfortunate, as KVM at least would prefer that it does explode on a NULL point. I.e. better to crash the kernel (hopefully before getting to production) then to have a lurking bug just waiting to cause problems. > This eliminates the need to differentiate between mandatory and optional > hooks, allowing a single KVM_X86_OP to suffice. > > So KVM_X86_OP_OPTIONAL and the WARN_ON() associated with KVM_X86_OP are > removed to simplify usage, Just in case it isn't clear, I am very strongly opposed to removing KVM_X86_OP_OPTIONAL() and the WARN_ON() protection to ensure mandatory ops are implemented.