Re: [PATCH v2 53/63] KVM: x86: Use struct_group() to zero decode cache

2021-08-18 Thread Sean Christopherson
structions would be noticeable. And hilariously, the "optimization" is completely unnecessary because both gcc and clang are clever enough to batch the first five into a movq even when zeroing the fields individually. So, I would much prefer to go with the following: >From dbdca

Re: Nested AVIC design (was:Re: [RFC PATCH v3 04/19] KVM: x86: mmu: allow to enable write tracking externally)

2022-09-29 Thread Sean Christopherson
On Mon, Aug 08, 2022, Maxim Levitsky wrote: > Hi Sean, Paolo, and everyone else who wants to review my nested AVIC work. Before we dive deep into design details, I think we should first decide whether or not nested AVIC is worth pursing/supporting. - Rome has a ucode/silicon bug with no known w

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-14 Thread Sean Christopherson
On Fri, Feb 14, 2020 at 11:26:06AM +0100, Paolo Bonzini wrote: > On 13/02/20 23:18, Chia-I Wu wrote: > > > > The bug you mentioned was probably this one > > > > https://bugzilla.kernel.org/show_bug.cgi?id=104091 > > Yes, indeed. > > > From what I can tell, the commit allowed the guests to cre

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-14 Thread Sean Christopherson
On Fri, Feb 14, 2020 at 01:56:48PM -0800, Jim Mattson wrote: > On Fri, Feb 14, 2020 at 1:47 PM Chia-I Wu wrote: > > AFAICT, it is currently allowed on ARM (verified) and AMD (not > > verified, but svm_get_mt_mask returns 0 which supposedly means the NPT > > does not restrict what the guest PAT can

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-18 Thread Sean Christopherson
On Tue, Feb 18, 2020 at 05:28:51PM +0100, Paolo Bonzini wrote: > On 14/02/20 23:03, Sean Christopherson wrote: > >> On Fri, Feb 14, 2020 at 1:47 PM Chia-I Wu wrote: > >>> AFAICT, it is currently allowed on ARM (verified) and AMD (not > >>> verified, but svm_ge

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-21 Thread Sean Christopherson
On Thu, Feb 20, 2020 at 09:39:05PM -0800, Tian, Kevin wrote: > > From: Chia-I Wu > > Sent: Friday, February 21, 2020 12:51 PM > > If you think it is the best for KVM to inspect hva to determine the memory > > type with page granularity, that is reasonable and should work for us too. > > The usersp

Re: [PATCH v1] drm/ttm: Refcount allocated tail pages

2023-01-11 Thread Sean Christopherson
On Thu, Aug 18, 2022, Christian König wrote: > Am 18.08.22 um 01:13 schrieb Dmitry Osipenko: > > On 8/18/22 01:57, Dmitry Osipenko wrote: > > > On 8/15/22 18:54, Dmitry Osipenko wrote: > > > > On 8/15/22 17:57, Dmitry Osipenko wrote: > > > > > On 8/15/22 16:53, Christian König wrote: > > > > > > Am

Re: [PATCH v1] drm/ttm: Refcount allocated tail pages

2023-01-11 Thread Sean Christopherson
On Tue, Sep 06, 2022, Daniel Vetter wrote: > On Tue, Sep 06, 2022 at 10:01:47PM +0200, Daniel Vetter wrote: > > On Mon, Aug 15, 2022 at 12:05:19PM +0200, Christian König wrote: > > > Am 15.08.22 um 11:54 schrieb Dmitry Osipenko: > > > > Higher order pages allocated using alloc_pages() aren't refcou

Re: [PATCH linux-next 3/3] kvm: x86/pmu: Add blank line separator before KVM_CAP_PMU_EVENT_MASKED_EVENTS code path list

2023-01-20 Thread Sean Christopherson
On Fri, Jan 20, 2023, Bagas Sanjaya wrote: > Stephen Rothwell reported htmldocs warning when merging kvm-x86 tree: > > Documentation/virt/kvm/api.rst:5070: ERROR: Unexpected indentation. > > Fix the warning by adding a blank line separator before > KVM_CAP_PMU_EVENT_MASKED_EVENTS code path list t

Re: Nested AVIC design (was:Re: [RFC PATCH v3 04/19] KVM: x86: mmu: allow to enable write tracking externally)

2022-11-09 Thread Sean Christopherson
Sorry for the super slow reply, I don't have a good excuse other than I needed to take break from AVIC code... On Mon, Oct 03, 2022, Maxim Levitsky wrote: > On Thu, 2022-09-29 at 22:38 +0000, Sean Christopherson wrote: > > On Mon, Aug 08, 2022, Maxim Levitsky wrote: > > &

Re: [PATCH] drm/ttm: set TTM allocated pages as reserved

2023-03-29 Thread Sean Christopherson
+David On Wed, Mar 29, 2023, Paolo Bonzini wrote: > On 3/29/23 18:43, Christian K�nig wrote: > > > > > > > > > 3) other uses of kmap() must switch to MMU-notifier protection. > > > > I would rather suggest to return the page additionally to the pfn from > > hva_to_pfn() when the function was

Re: [PATCH] drm/ttm: set TTM allocated pages as reserved

2023-03-29 Thread Sean Christopherson
On Wed, Mar 29, 2023, Christian K�nig wrote: > Am 29.03.23 um 19:22 schrieb Sean Christopherson: > > +David > > > > On Wed, Mar 29, 2023, Paolo Bonzini wrote: > > > On 3/29/23 18:43, Christian K�nig wrote: > > > > > > > > > > 3)

Re: [PATCH] drm/ttm: set TTM allocated pages as reserved

2023-03-29 Thread Sean Christopherson
On Wed, Mar 29, 2023, Christian K�nig wrote: > Am 29.03.23 um 19:39 schrieb Sean Christopherson: > > On Wed, Mar 29, 2023, Christian K�nig wrote: > > > Am 29.03.23 um 19:22 schrieb Sean Christopherson: > > > > +David > > > > > > > > On Wed

Re: [PATCH v5 1/6] mm/gup: remove unused vmas parameter from get_user_pages()

2023-05-15 Thread Sean Christopherson
| 3 +-- > mm/gup.c| 9 +++-- > mm/gup_test.c | 5 ++--- > virt/kvm/kvm_main.c | 2 +- > 7 files changed, 10 insertions(+), 15 deletions(-) Acked-by: Sean Christopherson (KVM) > diff --git a/virt

Re: [PATCH v5 1/6] mm/gup: remove unused vmas parameter from get_user_pages()

2023-05-16 Thread Sean Christopherson
On Tue, May 16, 2023, David Hildenbrand wrote: > On 15.05.23 21:07, Sean Christopherson wrote: > > On Sun, May 14, 2023, Lorenzo Stoakes wrote: > > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > > > index cb5c13eee193..eaa5bb8dbadc 100644 > > > -

Re: [PATCH 2/2] eventfd: simplify eventfd_signal_mask()

2023-07-13 Thread Sean Christopherson
On Thu, Jul 13, 2023, Christian Brauner wrote: > diff --git a/fs/eventfd.c b/fs/eventfd.c > index dc9e01053235..077be5da72bd 100644 > --- a/fs/eventfd.c > +++ b/fs/eventfd.c > @@ -43,9 +43,10 @@ struct eventfd_ctx { > int id; > }; > > -__u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __u

Re: [git pull] drm for 6.10-rc1

2024-05-16 Thread Sean Christopherson
On Thu, May 16, 2024, Dave Airlie wrote: > On Thu, 16 May 2024 at 08:56, Linus Torvalds > wrote: > > If the *main* CONFIG_WERROR is on, then it does NOT MATTER if somebody > > sets CONFIG_DRM_WERROR or not. It's a no-op. It's pointless. +1 > It's also possible it's just that hey there's a few o

Re: [RFC PATCH] KVM: Introduce KVM VIRTIO device

2023-12-18 Thread Sean Christopherson
+Yiwei On Fri, Dec 15, 2023, Kevin Tian wrote: > > From: Zhao, Yan Y > > Sent: Thursday, December 14, 2023 6:35 PM > > > > - For host non-MMIO pages, > > * virtio guest frontend and host backend driver should be synced to use > > the same memory type to map a buffer. Otherwise, there will

Re: [RFC PATCH] KVM: Introduce KVM VIRTIO device

2023-12-20 Thread Sean Christopherson
On Wed, Dec 20, 2023, Yan Zhao wrote: > On Tue, Dec 19, 2023 at 12:26:45PM +0800, Yan Zhao wrote: > > On Mon, Dec 18, 2023 at 07:08:51AM -0800, Sean Christopherson wrote: > > > > > Implementation Consideration > > > > > === > > > > > There

Re: [PATCH] i915: fix DRM_I915_GVT_KVMGT dependencies

2024-10-16 Thread Sean Christopherson
On Tue, Oct 15, 2024, Arnd Bergmann wrote: > From: Arnd Bergmann > > Depending on x86 and KVM is not enough, as the kvm helper functions > that get called here are controlled by CONFIG_KVM_X86, which is > disabled if both KVM_INTEL and KVM_AMD are turned off. > > ERROR: modpost: "kvm_write_track

[PATCH v2 0/8] x86, KVM: Optimize SEV cache flushing

2025-05-16 Thread Sean Christopherson
ugh...@google.com [2] https://lore.kernel.org/all/20250128015345.7929-1-szy0...@sjtu.edu.cn Kevin Loughlin (2): x86, lib: Add WBNOINVD helper functions KVM: SEV: Prefer WBNOINVD over WBINVD for cache maintenance efficiency Sean Christopherson (3): drm/gpu: Remove dead checks on wbinvd_on

[PATCH v2 3/8] x86, lib: Drop the unused return value from wbinvd_on_all_cpus()

2025-05-16 Thread Sean Christopherson
Drop wbinvd_on_all_cpus()'s return value; both the "real" version and the stub always return '0', and none of the callers check the return. Signed-off-by: Sean Christopherson --- arch/x86/include/asm/smp.h | 5 ++--- arch/x86/lib/cache-smp.c | 3 +-- 2 files ch

[PATCH v2 7/8] x86, lib: Add wbinvd and wbnoinvd helpers to target multiple CPUs

2025-05-16 Thread Sean Christopherson
;t need to check that the one and only CPU in the system is present in the mask. Signed-off-by: Zheyun Shen Reviewed-by: Tom Lendacky Link: https://lore.kernel.org/r/20250128015345.7929-2-szy0...@sjtu.edu.cn [sean: move to lib, add SMP=n helpers, clarify usage] Acked-by: Kai Huang Signed-of

[PATCH v2 5/8] KVM: SEV: Prefer WBNOINVD over WBINVD for cache maintenance efficiency

2025-05-16 Thread Sean Christopherson
: Sean Christopherson --- arch/x86/kvm/svm/sev.c | 41 - 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index e9fd3bcec37a..9dcdeea954d3 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm

[PATCH v2 2/8] drm/gpu: Remove dead checks on wbinvd_on_all_cpus()'s return value

2025-05-16 Thread Sean Christopherson
Remove the checks and associated pr_err() on wbinvd_on_all_cpus() failure, as the helper has unconditionally returned 0/success since commit caa759323c73 ("smp: Remove smp_call_function() and on_each_cpu() return values"). Signed-off-by: Sean Christopherson --- drivers/gpu/drm/drm_c

[PATCH v2 1/8] KVM: SVM: Remove wbinvd in sev_vm_destroy()

2025-05-16 Thread Sean Christopherson
dropped. Suggested-by: Sean Christopherson Signed-off-by: Zheyun Shen Reviewed-by: Tom Lendacky Signed-off-by: Sean Christopherson --- arch/x86/kvm/svm/sev.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 978a0088a3f1..e9fd3bcec37a

[PATCH v2 8/8] KVM: SVM: Flush cache only on CPUs running SEV guest

2025-05-16 Thread Sean Christopherson
-developed-by: Sean Christopherson Signed-off-by: Sean Christopherson --- arch/x86/kvm/svm/sev.c | 46 +++--- arch/x86/kvm/svm/svm.h | 1 + 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index

[PATCH v2 6/8] KVM: x86: Use wbinvd_on_cpu() instead of an open-coded equivalent

2025-05-16 Thread Sean Christopherson
Use wbinvd_on_cpu() to target a single CPU instead of open-coding an equivalent. In addition to deduplicating code, this will allow removing KVM's wbinvd_ipi() once the other usage is gone. No functional change intended. Reviewed-by: Tom Lendacky Signed-off-by: Sean Christopherson ---

[PATCH v2 4/8] x86, lib: Add WBNOINVD helper functions

2025-05-16 Thread Sean Christopherson
eeded. Signed-off-by: Kevin Loughlin Reviewed-by: Tom Lendacky [sean: massage changelog and comments, use ASM_WBNOINVD and _ASM_BYTES] Reviewed-by: Kai Huang Signed-off-by: Sean Christopherson --- arch/x86/include/asm/smp.h | 6 ++ arch/x86/include/asm/special_insns.h

Re: [PATCH v2 7/8] x86, lib: Add wbinvd and wbnoinvd helpers to target multiple CPUs

2025-05-19 Thread Sean Christopherson
On Sat, May 17, 2025, Ingo Molnar wrote: > > * Sean Christopherson wrote: > > > From: Zheyun Shen > > > > Extract KVM's open-coded calls to do writeback caches on multiple CPUs to > > common library helpers for both WBINVD and WBNOINVD (KVM will use bo

Re: [PATCH v2 4/8] x86, lib: Add WBNOINVD helper functions

2025-05-19 Thread Sean Christopherson
On Sat, May 17, 2025, Ingo Molnar wrote: > > * Sean Christopherson wrote: > > > From: Kevin Loughlin > > > > In line with WBINVD usage, add WBONINVD helper functions. Fall back to > > WBINVD (via alternative()) if WBNOINVD isn't supported, as WBINVD pr

Re: [PATCH v2 7/8] x86, lib: Add wbinvd and wbnoinvd helpers to target multiple CPUs

2025-05-19 Thread Sean Christopherson
On Sat, May 17, 2025, Ingo Molnar wrote: > > * Sean Christopherson wrote: > > > From: Zheyun Shen > > > > Extract KVM's open-coded calls to do writeback caches on multiple CPUs to > > common library helpers for both WBINVD and WBNOINVD (KVM will use bo

[PATCH v3 0/8] x86, KVM: Optimize SEV cache flushing

2025-05-22 Thread Sean Christopherson
0259.3289143-1-kevinlough...@google.com [2] https://lore.kernel.org/all/20250128015345.7929-1-szy0...@sjtu.edu.cn Kevin Loughlin (2): x86, lib: Add WBNOINVD helper functions KVM: SEV: Prefer WBNOINVD over WBINVD for cache maintenance efficiency Sean Christopherson (3): drm/gpu: Remove dead checks

[PATCH v3 3/8] x86, lib: Add WBNOINVD helper functions

2025-05-22 Thread Sean Christopherson
patibility with early boot code as needed. Signed-off-by: Kevin Loughlin Reviewed-by: Tom Lendacky Reviewed-by: Kai Huang Acked-by: Ingo Molnar Co-developed-by: Sean Christopherson Signed-off-by: Sean Christopherson --- arch/x86/include/asm/smp.h | 6 ++ arch/x86/i

[PATCH v3 2/8] x86, lib: Drop the unused return value from wbinvd_on_all_cpus()

2025-05-22 Thread Sean Christopherson
Drop wbinvd_on_all_cpus()'s return value; both the "real" version and the stub always return '0', and none of the callers check the return. Signed-off-by: Sean Christopherson --- arch/x86/include/asm/smp.h | 5 ++--- arch/x86/lib/cache-smp.c | 3 +-- 2 files ch

[PATCH v3 7/8] KVM: SEV: Prefer WBNOINVD over WBINVD for cache maintenance efficiency

2025-05-22 Thread Sean Christopherson
Lavra Signed-off-by: Sean Christopherson --- arch/x86/kvm/svm/sev.c | 45 -- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index be70c8401c9b..2676be2b121d 100644 --- a/arch/x86/kvm/svm/sev.c

[PATCH v3 4/8] x86, lib: Add wbinvd and wbnoinvd helpers to target multiple CPUs

2025-05-22 Thread Sean Christopherson
;t need to check that the one and only CPU in the system is present in the mask. Signed-off-by: Zheyun Shen Reviewed-by: Tom Lendacky Link: https://lore.kernel.org/r/20250128015345.7929-2-szy0...@sjtu.edu.cn [sean: move to lib, add SMP=n helpers, clarify usage] Acked-by: Kai Huang Signed-of

[PATCH v3 8/8] KVM: SVM: Flush cache only on CPUs running SEV guest

2025-05-22 Thread Sean Christopherson
Signed-off-by: Zheyun Shen Co-developed-by: Sean Christopherson Signed-off-by: Sean Christopherson --- arch/x86/kvm/svm/sev.c | 46 +++--- arch/x86/kvm/svm/svm.h | 1 + 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/svm/sev.c b/arch

[PATCH v3 1/8] drm/gpu: Remove dead checks on wbinvd_on_all_cpus()'s return value

2025-05-22 Thread Sean Christopherson
Remove the checks and associated pr_err() on wbinvd_on_all_cpus() failure, as the helper has unconditionally returned 0/success since commit caa759323c73 ("smp: Remove smp_call_function() and on_each_cpu() return values"). Signed-off-by: Sean Christopherson --- drivers/gpu/drm/drm_c

[PATCH v3 6/8] KVM: SVM: Remove wbinvd in sev_vm_destroy()

2025-05-22 Thread Sean Christopherson
dropped. Suggested-by: Sean Christopherson Signed-off-by: Zheyun Shen Reviewed-by: Tom Lendacky Signed-off-by: Sean Christopherson --- arch/x86/kvm/svm/sev.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index a7a7dc507336..be70c8401c9b

[PATCH v3 5/8] KVM: x86: Use wbinvd_on_cpu() instead of an open-coded equivalent

2025-05-22 Thread Sean Christopherson
Use wbinvd_on_cpu() to target a single CPU instead of open-coding an equivalent, and drop KVM's wbinvd_ipi() now that all users have switched to x86 library versions. No functional change intended. Reviewed-by: Tom Lendacky Signed-off-by: Sean Christopherson --- arch/x86/kvm/x86.

Re: [PATCH v3 0/8] x86, KVM: Optimize SEV cache flushing

2025-07-09 Thread Sean Christopherson
On Wed, Jul 09, 2025, Borislav Petkov wrote: > On Wed, Jul 09, 2025 at 09:25:35AM -0700, Sean Christopherson wrote: > > On Thu, May 22, 2025, Sean Christopherson wrote: > > > This is the combination of Kevin's WBNOINVD series[1] with Zheyun's > > > targeted &g

Re: [PATCH v3 0/8] x86, KVM: Optimize SEV cache flushing

2025-07-09 Thread Sean Christopherson
On Thu, May 22, 2025, Sean Christopherson wrote: > This is the combination of Kevin's WBNOINVD series[1] with Zheyun's targeted > flushing series[2]. The combined goal is to use WBNOINVD instead of WBINVD > when doing cached maintenance to prevent data corruption due to C-bit

Re: [PATCH v3 3/8] x86, lib: Add WBNOINVD helper functions

2025-07-10 Thread Sean Christopherson
On Thu, Jul 10, 2025, Borislav Petkov wrote: > On Thu, May 22, 2025 at 04:37:27PM -0700, Sean Christopherson wrote: > > diff --git a/arch/x86/lib/cache-smp.c b/arch/x86/lib/cache-smp.c > > index 079c3f3cd32c..1789db5d8825 100644 > > --- a/arch/x86/lib/cache-smp.c > > +++

Re: [PATCH v3 3/8] x86, lib: Add WBNOINVD helper functions

2025-07-10 Thread Sean Christopherson
On Thu, Jul 10, 2025, Peter Zijlstra wrote: > On Thu, Jul 10, 2025 at 04:37:29PM +0200, Peter Zijlstra wrote: > > On Thu, Jul 10, 2025 at 01:29:02PM +0200, Borislav Petkov wrote: > > > On Thu, May 22, 2025 at 04:37:27PM -0700, Sean Christopherson wrote: > > > > d

Re: [PATCH v3 0/8] x86, KVM: Optimize SEV cache flushing

2025-07-10 Thread Sean Christopherson
On Thu, 22 May 2025 16:37:24 -0700, Sean Christopherson wrote: > This is the combination of Kevin's WBNOINVD series[1] with Zheyun's targeted > flushing series[2]. The combined goal is to use WBNOINVD instead of WBINVD > when doing cached maintenance to prevent data corr