From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) (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 B2DA14B7176 for ; Thu, 3 Sep 2026 14:32:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.198 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788445975; cv=none; b=swkk/Otc/UoXPGYvm8oMRJL+ZcyVf9rIxBsTGGfuv8ytx57kdIPdm3F+e9/kbafz75z2MCWRZo+Ksn6ga9XY7jhkbYzrYAr4/Cd/9U/H32GaWi+2iH9FDoD/V9I91Q4mQASnqaKYEWdZrQlByEJ6gKBrLSjSKnOAhibwWVIaaAg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788445975; c=relaxed/simple; bh=NevMf3nDQq4VIBy/kjYGDtq3lURnltfIiR+R0CkPfUY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=AYlL4nPzJNoBBH3DX5LD3Ckot5jmTkg3Nfxd5erE0rbRNK3fmghtzL5xPvI+zjelgtMVKoDoIbePJTEIyagi3QmQ8Nj5xUOES4yy4AI5rncYIAsdljwho44k7gVws/9uy2+rJ260Z5MYx3jrwecF5Cf1WS+zLovjiHypv3YWkAY= 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=RPXLNsz3; arc=none smtp.client-ip=209.85.215.198 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="RPXLNsz3" Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-cc1eb205d31so3395864a12.2 for ; Thu, 03 Sep 2026 07:32:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1788445963; x=1789050763; darn=lists.linux.dev; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=jepDX0FobScpvhoQHC25avp5Il/0jZZ+6SCAUX+k/50=; b=RPXLNsz3+QfMeJzfuaSeLu/2ws8rNng2IVJuEymhlELRYliAXAf7O5hc+eOA4aAmPx l6wSeN7EqJOryodot+hToVYBJM4ynn1L3p8RLXxtaOg0w8MgK/IK/ltTynbzGlS0wKl0 SG7+NVzZ8HTvFUuhYfKUR+Rd4bkMuNtiRbKGkmjsQJIu3C4C45zgDDg3Bv3cyOXJ/cfM yTCuJFN32/vkJzXgKlS3wRApgd2YnuGPvkd+MfEzutWONRoFqasQHmxnpcvDweoYhHJS MPQ1mMvZoWHUkLNuOLbuRYrnqO8mp+6+sC/CbkfZYQLH2uIloOhGU3CuQ7LthCUDAxxf z2IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788445963; x=1789050763; h=content-type: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:content-type; bh=jepDX0FobScpvhoQHC25avp5Il/0jZZ+6SCAUX+k/50=; b=JID/kuD3S4Zpw5T0DNLR8V615atsM5b/dNKhG1HDZsfGhUomamTBrp79qTqS/5qhZ2 CKVLtihcHarJOFA6SyE9pMRSr+nH14iFwSNosZvsxjyB8kKm2bwgPM36FmX7QVT4MHfG tNODubbSk9d0OZqyv6ho5fTGiHc92CGqsz4yWRfCJX8sF9Zzm/Yh/n4e4t5/g9LJRQb0 MiSv6mSZEo/+Q/ZxuJ4lrGTIRd1ypjfIzOPZYGF9kRANtJkSZFYhUnkH2Cv4ncsXsNkE DneRoRCF91MBrVbFhW2hFSfS4vJRd30y095+n/njjz7fui18i48Juone69f3ocDnhICf ZPYA== X-Forwarded-Encrypted: i=1; AKwUvBzftA9pgwLZMWOl34nc5vuTwn76M90362bH4hG23LEF3/sWaPLI/5tjyJrW7fB2nqemAyy8Yoc=@lists.linux.dev X-Gm-Message-State: AFuF++m31RSCY/ibMY6qMCxrlS6V3t6ISYVy0Bm3n6oq7aPLkDQ/9Mcl rZbxF8UwMqdzaw1zOI/6fV2sjSuDe2/ji7YSt/vi86nnPhKiUVoBC0+y3U3PaQQcy58FNkepJHy BfNfu5A== X-Received: from pgac2.prod.google.com ([2002:a05:6a02:2942:b0:cc4:37bf:2cab]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:33a8:b0:3d0:6c90:5a33 with SMTP id adf61e73a8af0-3d9ad9a2a0bmr20468355637.4.1788445963198; Thu, 03 Sep 2026 07:32:43 -0700 (PDT) Date: Thu, 3 Sep 2026 07:32:42 -0700 In-Reply-To: Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260831144802.834315-1-seiden@linux.ibm.com> <20260831144802.834315-3-seiden@linux.ibm.com> <20260902075028.231001-D-seiden@linux.ibm.com> <20260903114241.33034-C-seiden@linux.ibm.com> Message-ID: Subject: Re: [PATCH v7 02/23] KVM: Make device name configurable From: Sean Christopherson To: Steffen Eiden Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, Alexander Gordeev , Andreas Grapentin , Arnd Bergmann , Catalin Marinas , Christian Borntraeger , Claudio Imbrenda , David Hildenbrand , Friedrich Welter , Fuad Tabba , Gautam Gala , Hariharan Mari , Heiko Carstens , Hendrik Brueckner , Ilya Leoshkevich , Janosch Frank , Joey Gouly , Marc Zyngier , Nico Boehr , Nina Schoetterl-Glausch , Oliver Upton , Paolo Bonzini , Suzuki K Poulose , Sven Schnelle , Ulrich Weigand , Vasily Gorbik , Will Deacon , Zenghui Yu Content-Type: text/plain; charset="us-ascii" On Thu, Sep 03, 2026, Sean Christopherson wrote: > On Thu, Sep 03, 2026, Steffen Eiden wrote: > > On Wed, Sep 02, 2026 at 09:14:21AM -0700, Sean Christopherson wrote: > > > And taking things a few steps further, we can solve the MMIO issue in a more > > > elegant way, and eliminate the runtime string building in this patch (after looking > > > more closely, that code needs to be jettisoned no matter what, there's simply no > > > reason to specify the names at runtime since they're separate compilation units). > > > > > > Rather than splatter #defines throughout header files, deal with the bulk of the > > > pain in Makefile.kvm. By feeding conditionals into Makefile.kvm, the s390+arm64 > > > build can easily omit coalesced_mmio.o and async_pf.o, define __KVM_HAVE_ARCH_MMIO > > > programatically without having to change other architectures, and solve the naming > > > stuff. > > > > Yes, this is a great idea. Thank you. I second you, this looks more clean > > and stable than the stuff we came up with :) > > Looking more at arch/s390/kvm/Kconfig and virt/kvm/Kconfig, we might need/want to > to build out infrastructure to handle this sort of thing in a more generic fashion? > > Which probably isn't that much infrastructure? It's more just changing how arch > code communicates with common KVM? I.e. instead of providing boolean configs in > virt/kvm/Kconfig, formalize communicating HAVE-type macros through the Makefile. > That might even be a net positive in the long run, as it will make it easier to > provide defaults for the common cases. > > I say that because unless there's magic I'm unaware of these Kconfigs also needs > to be configured per-KVM, not per-kernel: > > - KVM_MMU_LOCKLESS_AGING, otherwise aging on arm64 will unintentionally be done > outside of mmu_lock. > > - KVM_GENERIC_PRE_FAULT_MEMORY, so that arm64 doesn't need to provide a stub > for something it doesn't support > > - HAVE_KVM_MSI, because presumably it's needed for arm64 support. > > - HAVE_KVM_READONLY_MEM, same story as HAVE_KVM_MSI. And in the opposite direction, HAVE_KVM_VCPU_RUN_PID_CHANGE also falls into this category. That one is probably better handled as a #define in header files? > Which isn't _that_ many knobs, but add in KVM_MMIO, KVM_ASYNC_PF, and > KVM_ASYNC_PF_SYNC, and it's enough that I think we should think about the big > picture and not play whack-a-mole. > > Actually, thinking about this more, what I've proposed here, plus the pattern of > #define-ing macros in arch-specific kvm_host.h files, should suffice. For things > like __KVM_HAVE_ARCH_VM_FREE, it absolutely makes sense to #define the macro in > kvm_host.h since it's very directly tied to an arch callback. Whereas with KVM_MIO > and KVM_ASYNC_PF, because they enable compilation of C files, it makes sense to > define them in Makefiles. > > So I think the "gap" is purely that the four knobs listed above need handling > (and arguably KVM_MMU_LOCKLESS_AGING is ok as-proposed). But I do think we should > try our best to be more thoughtful than we usually are when deciding how to enable > common code, because obviously s390+arm64 is adding wrinkles no one has had to deal > with before. >