[PATCH V2 1/2] staging: slicoss: fix eeprom checksum code

2014-05-19 Thread David Matlack
), that's only 0x40 iterations - checksum is only computed during pci probe(), so not very often Tested on Mojave card Signed-off-by: David Matlack matlackda...@gmail.com --- drivers/staging/slicoss/slicoss.c | 110 ++ 1 file changed, 15

[PATCH V2 0/2] staging: slicoss: fix checksum computation

2014-05-19 Thread David Matlack
detail in the changelog of each patch describing the effects on the user. David Matlack (2): staging: slicoss: fix eeprom checksum code staging: slicoss: fail on corrupt eeprom drivers/staging/slicoss/slic.h| 7 --- drivers/staging/slicoss/slicoss.c | 113

[PATCH V2 2/2] staging: slicoss: fail on corrupt eeprom

2014-05-19 Thread David Matlack
-by: David Matlack matlackda...@gmail.com --- drivers/staging/slicoss/slic.h| 7 --- drivers/staging/slicoss/slicoss.c | 3 +-- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index 0dc73d5..3a5aa88 100644

Re: [PATCH V2 2/2] staging: slicoss: fail on corrupt eeprom

2014-05-20 Thread David Matlack
Thanks for the reviews! -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

[PATCH] staging: slicoss: remove gratuitous debug infrastructure

2014-05-22 Thread David Matlack
module is unloaded. Touching these files quickly leads to an oops. The net effect of this patch is that the driver will no longer create files in debugfs. Signed-off-by: David Matlack matlackda...@gmail.com --- This patch was originally sent here https://lkml.org/lkml/2014/5/6/4 with my google.com

[PATCH] staging: slicoss: fix free-after-free in slic_entry_remove

2014-05-22 Thread David Matlack
() and pci_release_regions() on the same pci_dev struct. They both free pci memory regions. Signed-off-by: David Matlack matlackda...@gmail.com --- This patch was originally sent here https://lkml.org/lkml/2014/5/6/3 with my google.com email address. But due to Google's recent change in DMARC policies, that patchset

[PATCH] staging: slicoss: fix 64-bit isr address bug

2014-05-22 Thread David Matlack
a lot of the driver. So for the time being, this patch will at least let the driver run correctly on 64-bit machines with 4GB of physical memory. Signed-off-by: David Matlack matlackda...@gmail.com --- This patch was originally sent here https://lkml.org/lkml/2014/5/6/6 with my google.com email

[PATCH] staging: slicoss: fix use-after-free bug in slic_entry_remove

2014-05-22 Thread David Matlack
(). Specifically, slic_unmap_mmio_space() frees adapter-slic_regs, but those registers are used in slic_entry_halt(). Signed-off-by: David Matlack matlackda...@gmail.com --- This patch was originally sent here https://lkml.org/lkml/2014/5/6/5 with my google.com email address. But due to Google's recent

[PATCH] staging: slicoss: clean up use of dev_err

2014-05-22 Thread David Matlack
First, don't print pci device information or driver prefixes, this is already printed by dev_err. Next, don't report error messages via dev_err when the failing function already reports all errors via dev_err. Signed-off-by: David Matlack matlackda...@gmail.com --- drivers/staging/slicoss

[PATCH] staging: slicoss: remove unused members of struct adapter

2014-05-22 Thread David Matlack
. Signed-off-by: David Matlack matlackda...@gmail.com --- This patch was originally sent here https://lkml.org/lkml/2014/5/6/9 with my google.com email address. But due to Google's recent change in DMARC policies, that patchset was silently dropped for at least some users (including my personal gmail

[PATCH] staging: slicoss: remove private netdev list

2014-05-22 Thread David Matlack
Remove the private linked list of netdev structs. This list isn't being used anyway. This patch has no noticable effect. Signed-off-by: David Matlack matlackda...@gmail.com --- drivers/staging/slicoss/slic.h| 1 - drivers/staging/slicoss/slicoss.c | 4 2 files changed, 5 deletions

[PATCH] staging: slicoss: fix use-after-free in slic_entry_probe

2014-05-22 Thread David Matlack
Fix a use-after-free bug that can cause a kernel oops. If slic_card_init fails then slic_entry_probe() (the pci probe() function for this device) will return error without cleaning up memory (including the registered netdev struct). Signed-off-by: David Matlack matlackda...@gmail.com

[PATCH 1/2] staging: slicoss: fix dma memory leak

2014-05-22 Thread David Matlack
Fix memory leak in slic_card_init. If the driver fails to poll for an interrupt after requesting config data from the device the dma memory is never freed. Signed-off-by: David Matlack matlackda...@gmail.com --- This patch was originally sent here https://lkml.org/lkml/2014/5/6/7 with my

[PATCH 2/2] staging: slicoss: handle errors from slic_config_get

2014-05-22 Thread David Matlack
slic_config_get() can fail. Change the return type from void to int and handle the error in slic_card_init(). So now, instead of silently failing (and then timing out waiting for the config data), the driver will fail loudly at request time. Signed-off-by: David Matlack matlackda...@gmail.com

[PATCH 0/2] fix two bugs in slic_card_init

2014-05-22 Thread David Matlack
This patchset fixes two bugs in slic_card_init(). They are grouped in a series because the second patch depends on the first (for a merge without conflicts). In content, they are completely separate changes. They just touch a few of the same lines. David Matlack (2): staging: slicoss: fix dma

[PATCH 0/2] staging: slicoss: cleanup checksum computation

2014-05-17 Thread David Matlack
This patchset fixes a broken checksum function and removes a struct that was being used to ignore bad checksum values. David Matlack (2): staging: slicoss: rewrite eeprom checksum code staging: slicoss: remove slic_reg_params struct drivers/staging/slicoss/slic.h| 7 -- drivers

[PATCH 1/2] staging: slicoss: rewrite eeprom checksum code

2014-05-17 Thread David Matlack
often Tested on Mojave card. Also tested against the old implementation (with the above bug fix applied) with test data. Signed-off-by: David Matlack matlackda...@gmail.com --- drivers/staging/slicoss/slicoss.c | 137 +- 1 file changed, 46 insertions

[PATCH 2/2] staging: slicoss: remove slic_reg_params struct

2014-05-17 Thread David Matlack
Remove uninitialized struct that is only used to regulate whether incorrect eeprom checksums are ignored. Signed-off-by: David Matlack matlackda...@gmail.com --- drivers/staging/slicoss/slic.h| 7 --- drivers/staging/slicoss/slicoss.c | 3 +-- 2 files changed, 1 insertion(+), 9 deletions

Re: [PATCH 1/2] staging: slicoss: rewrite eeprom checksum code

2014-05-17 Thread David Matlack
On Sat, May 17, 2014 at 9:12 PM, Joe Perches j...@perches.com wrote: On Sat, 2014-05-17 at 21:00 -0700, David Matlack wrote: [] diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c [] +static inline u16 __reduce(u32 checksum) +{ + u16 lower_16 = checksum

Re: [PATCH 1/2] staging: slicoss: rewrite eeprom checksum code

2014-05-18 Thread David Matlack
On Sat, May 17, 2014 at 9:51 PM, David Matlack matlackda...@gmail.com wrote: On Sat, May 17, 2014 at 9:12 PM, Joe Perches j...@perches.com wrote: The if seems unnecessary. Perhaps declare a u16 return var or use return lower_16 + upper_16; I agree it's fishy... but using overflow

Re: [PATCH 2/2] staging: slicoss: remove slic_reg_params struct

2014-05-19 Thread David Matlack
On Mon, May 19, 2014 at 2:21 AM, Dan Carpenter dan.carpen...@oracle.com wrote: Looking at the patch, this looks like a bugfix but the changelog doesn't give any clues. Yeah this isn't a bug fix. The only member of struct slic_reg_params that was in use was fail_on_bad_eeprom (implicitly set

Re: [PATCH 1/2] staging: slicoss: rewrite eeprom checksum code

2014-05-19 Thread David Matlack
On Mon, May 19, 2014 at 2:16 AM, Dan Carpenter dan.carpen...@oracle.com wrote: This patch is great, thanks, don't resend. But I wish the subject said fix instead of rewrite. I was expecting it to just be a cleanup. It helps a lot if `git log --oneline` says which patches should be

Re: [PATCH 2/2] staging: slicoss: remove slic_reg_params struct

2014-05-19 Thread David Matlack
On Mon, May 19, 2014 at 12:52 PM, Dan Carpenter dan.carpen...@oracle.com wrote: You have to understand that I review a lot of staging patches every day. Most patches try to remove struct members but the code should still work exactly as it did before (a clean up). Some patches remove struct

Re: [PATCH] staging: slicoss: fix use-after-free in slic_entry_probe

2014-05-23 Thread David Matlack
On Fri, May 23, 2014 at 4:14 AM, Greg KH gre...@linuxfoundation.org wrote: I think I've already applied all of these, if not, please let me know. Also, you forgot to number these patches to let me know what order to apply them in :( thanks, greg k-h Thanks Greg. Sorry for the confusion. I

Re: [PATCH] staging: slicoss: remove private netdev list

2014-05-23 Thread David Matlack
Greg, this is one of the two patches that got dropped. It should apply cleanly in any order with respect to all my other patches. Thanks. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at

Re: [PATCH] staging: slicoss: clean up use of dev_err

2014-05-23 Thread David Matlack
Greg, this is the other patch (of two) that got dropped. Thanks. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at

[PATCH RESEND] staging: slicoss: clean up use of dev_err

2014-05-23 Thread David Matlack
First, don't print pci device information or driver prefixes, this is already printed by dev_err. Next, don't report error messages via dev_err when the failing function already reports all errors via dev_err. Signed-off-by: David Matlack matlackda...@gmail.com --- drivers/staging/slicoss

[PATCH RESEND] staging: slicoss: remove private netdev list

2014-05-23 Thread David Matlack
Remove the private linked list of netdev structs. This list isn't being used anyway. This patch has no noticable effect. Signed-off-by: David Matlack matlackda...@gmail.com --- drivers/staging/slicoss/slic.h| 1 - drivers/staging/slicoss/slicoss.c | 4 2 files changed, 5 deletions

[PATCH 7/7] staging: slicoss: fix use-after-free bug in slic_entry_remove

2014-05-05 Thread David Matlack
. Signed-off-by: David Matlack dmatl...@google.com --- drivers/staging/slicoss/slicoss.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 55afe0d..96b29ec 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b

[PATCH 0/7] staging: slicoss: bug fixes to stabilize driver

2014-05-05 Thread David Matlack
patches were tested on the Mojave (single port, PCI) card. David Matlack (7): staging: slicoss: fix use-after-free in slic_entry_probe staging: slicoss: fix multiple free-after-free in slic_entry_remove staging: slicoss: remove unused members of struct adapter staging: slicoss: remove

[PATCH 4/7] staging: slicoss: remove gratuitous debug infrastructure

2014-05-05 Thread David Matlack
module is unloaded. Touching these files quickly leads to an oops. Signed-off-by: David Matlack dmatl...@google.com --- drivers/staging/slicoss/TODO | 1 - drivers/staging/slicoss/slic.h| 3 - drivers/staging/slicoss/slicoss.c | 450 +- 3 files changed

[PATCH 2/7] staging: slicoss: fix multiple free-after-free in slic_entry_remove

2014-05-05 Thread David Matlack
pci_dev struct. Signed-off-by: David Matlack dmatl...@google.com --- drivers/staging/slicoss/slicoss.c | 8 1 file changed, 8 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 6113b90..452aa02 100644 --- a/drivers/staging/slicoss

[PATCH 6/7] staging: slicoss: fix 64-bit isr address bug

2014-05-05 Thread David Matlack
This patch fixes a bug that only manifests when the physical address of the interrupt status register is 4GB. Specifically, the driver was only telling the device about the lower 32 bits of the ISR. This patch adds the upper 32 bits. Signed-off-by: David Matlack dmatl...@google.com --- drivers

[PATCH 5/7] staging: slicoss: fix dma memory leak

2014-05-05 Thread David Matlack
This patch fixes a memory leak in slic_card_init. If the driver fails to poll for an interrupt after requesting config data from the device the dma memory is never freed. Signed-off-by: David Matlack dmatl...@google.com --- drivers/staging/slicoss/slicoss.c | 3 +++ 1 file changed, 3 insertions

[PATCH 3/7] staging: slicoss: remove unused members of struct adapter

2014-05-05 Thread David Matlack
-by: David Matlack dmatl...@google.com --- drivers/staging/slicoss/slic.h| 2 -- drivers/staging/slicoss/slicoss.c | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index 702902c..379c4f7 100644 --- a/drivers

[PATCH 1/7] staging: slicoss: fix use-after-free in slic_entry_probe

2014-05-05 Thread David Matlack
This patch fixes a use-after-free bug that can cause a kernel oops. If slic_card_init fails then slic_entry_probe (the pci probe() function for this device) will return error without cleaning up memory. Signed-off-by: David Matlack dmatl...@google.com --- drivers/staging/slicoss/slicoss.c | 16

Re: [PATCH 1/2] KVM: fix cache stale memslot info with correct mmio generation number

2014-08-19 Thread David Matlack
On Tue, Aug 19, 2014 at 5:29 PM, Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com wrote: On 08/19/2014 05:03 PM, Paolo Bonzini wrote: Il 19/08/2014 10:50, Xiao Guangrong ha scritto: Okay, what confused me it that it seems that the single line patch is ok to you. :) No, it was late and I was

Re: [PATCH 1/2] KVM: fix cache stale memslot info with correct mmio generation number

2014-08-12 Thread David Matlack
On Mon, Aug 11, 2014 at 10:02 PM, Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com wrote: @@ -722,9 +719,10 @@ static struct kvm_memslots *install_new_memslots(struct kvm *kvm, { struct kvm_memslots *old_memslots = kvm-memslots; I think you want slots-generation =

Re: [PATCH 2/2] kvm: x86: fix stale mmio cache bug

2014-08-14 Thread David Matlack
On Thu, Aug 14, 2014 at 12:01 AM, Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com wrote: From: David Matlack dmatl...@google.com The following events can lead to an incorrect KVM_EXIT_MMIO bubbling up to userspace: (1) Guest accesses gpa X without a memory slot. The gfn is cached in struct

Re: [PATCH 1/2] KVM: fix cache stale memslot info with correct mmio generation number

2014-08-18 Thread David Matlack
On Mon, Aug 18, 2014 at 9:35 AM, Xiao Guangrong xiaoguangrong.e...@gmail.com wrote: Hi Paolo, Thank you to review the patch! On Aug 18, 2014, at 9:57 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 14/08/2014 09:01, Xiao Guangrong ha scritto: -update_memslots(slots, new,

Re: [PATCH 1/2] KVM: fix cache stale memslot info with correct mmio generation number

2014-08-18 Thread David Matlack
On Mon, Aug 18, 2014 at 12:56 PM, Xiao Guangrong xiaoguangrong.e...@gmail.com wrote: @@ -287,9 +293,15 @@ static bool set_mmio_spte(struct kvm *kvm, u64 *sptep, gfn_t gfn, static bool check_mmio_spte(struct kvm *kvm, u64 spte) { + struct kvm_memslots *slots = kvm_memslots(kvm);

Re: [PATCH 1/2] KVM: fix cache stale memslot info with correct mmio generation number

2014-08-18 Thread David Matlack
On Mon, Aug 18, 2014 at 2:24 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 18/08/2014 23:15, David Matlack ha scritto: I just realized how simple Paolo's idea is. I think it can be a one line patch (without comments): [...] update_memslots(slots, new, kvm-memslots-generation

[PATCH 1/2] kvm: fix potentially corrupt mmio cache

2014-08-18 Thread David Matlack
) will very soon become invalid. Cc: sta...@vger.kernel.org Cc: Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com Signed-off-by: David Matlack dmatl...@google.com --- virt/kvm/kvm_main.c | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm

[PATCH 2/2] kvm: x86: fix stale mmio cache bug

2014-08-18 Thread David Matlack
the code to make it simpler for stable-tree fix. ] Cc: sta...@vger.kernel.org Signed-off-by: David Matlack dmatl...@google.com Signed-off-by: Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/mmu.c | 4 ++-- arch/x86/kvm/mmu.h

Re: [PATCH 1/2] KVM: fix cache stale memslot info with correct mmio generation number

2014-08-18 Thread David Matlack
On Mon, Aug 18, 2014 at 8:50 PM, Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com wrote: On 08/19/2014 05:15 AM, David Matlack wrote: On Mon, Aug 18, 2014 at 12:56 PM, Xiao Guangrong xiaoguangrong.e...@gmail.com wrote: @@ -287,9 +293,15 @@ static bool set_mmio_spte(struct kvm *kvm, u64 *sptep

Re: [PATCH 1/2] KVM: fix cache stale memslot info with correct mmio generation number

2014-08-18 Thread David Matlack
On Mon, Aug 18, 2014 at 9:41 PM, Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com wrote: On 08/19/2014 12:31 PM, David Matlack wrote: But it looks like you basically said the same thing earlier, so I think we're on the same page. Yes, that is what i try to explain in previous mails. :( I'm

Re: [PATCH 1/2] KVM: fix cache stale memslot info with correct mmio generation number

2014-08-18 Thread David Matlack
On Mon, Aug 18, 2014 at 10:19 PM, Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com wrote: On 08/19/2014 01:00 PM, David Matlack wrote: On Mon, Aug 18, 2014 at 9:41 PM, Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com wrote: On 08/19/2014 12:31 PM, David Matlack wrote: The single line patch I

Re: [PATCH 2/2] kvm: x86: fix stale mmio cache bug

2014-08-28 Thread David Matlack
On Mon, Aug 18, 2014 at 3:46 PM, David Matlack dmatl...@google.com wrote: The following events can lead to an incorrect KVM_EXIT_MMIO bubbling up to userspace: (1) Guest accesses gpa X without a memory slot. The gfn is cached in struct kvm_vcpu_arch (mmio_gfn). On Intel EPT-enabled hosts, KVM

Re: [PATCH 2/2] kvm: x86: fix stale mmio cache bug

2014-08-29 Thread David Matlack
On Fri, Aug 29, 2014 at 12:58 AM, Paolo Bonzini pbonz...@redhat.com wrote: Il 28/08/2014 23:10, David Matlack ha scritto: Paolo, It seems like this patch ([PATCH 2/2] kvm: x86: fix stale mmio cache) is ready to go. Is there anything blocking it from being merged? (It should be fine to merge

[PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-19 Thread David Matlack
vcpu ioctls can hang the calling thread if issued while a vcpu is running. If we know ioctl is going to be rejected as invalid anyway, we can fail before trying to take the vcpu mutex. This patch does not change functionality, it just makes invalid ioctls fail faster. Signed-off-by: David

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread David Matlack
On 09/22, Paolo Bonzini wrote: Il 22/09/2014 15:45, Christian Borntraeger ha scritto: We now have an extra condition check for every valid ioctl, to make an error case go faster. I know, the extra check is just a 1 or 2 cycles if branch prediction is right, but still. I applied the

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread David Matlack
On 09/22, Christian Borntraeger wrote: On 09/22/2014 04:31 PM, Paolo Bonzini wrote: Il 22/09/2014 15:45, Christian Borntraeger ha scritto: We now have an extra condition check for every valid ioctl, to make an error case go faster. I know, the extra check is just a 1 or 2 cycles if

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread David Matlack
On 09/22, Marcelo Tosatti wrote: On Fri, Sep 19, 2014 at 04:03:25PM -0700, David Matlack wrote: vcpu ioctls can hang the calling thread if issued while a vcpu is running. There is a mutex per-vcpu, so thats expected, OK... If we know ioctl is going to be rejected as invalid anyway

Re: [PATCH 2/3] kvm: fix potentially corrupt mmio cache

2014-09-02 Thread David Matlack
On Fri, Aug 29, 2014 at 3:31 AM, Paolo Bonzini pbonz...@redhat.com wrote: From: David Matlack dmatl...@google.com vcpu exits and memslot mutations can run concurrently as long as the vcpu does not aquire the slots mutex. Thus it is theoretically possible for memslots to change underneath

Re: [PATCH 0/3] fix bugs with stale or corrupt MMIO caches

2014-09-02 Thread David Matlack
On Tue, Sep 2, 2014 at 8:42 AM, Paolo Bonzini pbonz...@redhat.com wrote: Il 29/08/2014 12:31, Paolo Bonzini ha scritto: David and Xiao, here's my take on the MMIO generation patches. Now with documentation, too. :) Please review! David Matlack (2): kvm: fix potentially corrupt mmio cache

Re: [PATCH 2/3] kvm: fix potentially corrupt mmio cache

2014-09-02 Thread David Matlack
On Tue, Sep 2, 2014 at 9:49 AM, Paolo Bonzini pbonz...@redhat.com wrote: Il 02/09/2014 18:44, David Matlack ha scritto: -#define MMIO_GEN_SHIFT 19 -#define MMIO_GEN_LOW_SHIFT 9 -#define MMIO_GEN_LOW_MASK ((1 MMIO_GEN_LOW_SHIFT) - 1) +#define

Re: [PATCH 0/3] fix bugs with stale or corrupt MMIO caches

2014-09-02 Thread David Matlack
On Tue, Sep 2, 2014 at 9:50 AM, Paolo Bonzini pbonz...@redhat.com wrote: Il 02/09/2014 18:47, David Matlack ha scritto: Ping? Sorry for the delay. I think the patches look good. And patch 3/3 still fixes the bug I was originally seeing, so I'm happy :). I just had one small comment (see my

Re: [PATCH] kvm: x86: add trace event for pvclock updates

2014-11-12 Thread David Matlack
On 11/10 11:18 PM, Marcelo Tosatti wrote: On Wed, Nov 05, 2014 at 11:46:42AM -0800, David Matlack wrote: The new trace event records: * the id of vcpu being updated * the pvclock_vcpu_time_info struct being written to guest memory This is useful for debugging pvclock bugs

Re: [RFC 2/2] x86, vdso, pvclock: Simplify and speed up the vdso pvclock reader

2014-12-24 Thread David Matlack
On Mon, Dec 22, 2014 at 4:39 PM, Andy Lutomirski l...@amacapital.net wrote: The pvclock vdso code was too abstracted to understand easily and excessively paranoid. Simplify it for a huge speedup. This opens the door for additional simplifications, as the vdso no longer accesses the pvti for

[PATCH] kvm: x86: add trace event for pvclock updates

2014-11-05 Thread David Matlack
The new trace event records: * the id of vcpu being updated * the pvclock_vcpu_time_info struct being written to guest memory This is useful for debugging pvclock bugs, such as the bug fixed by [PATCH] kvm: x86: Fix kvm clock versioning.. Signed-off-by: David Matlack dmatl...@google.com

Re: [PATCH] staging: slicoss: slicoss: Removed variables that is never used

2015-02-11 Thread David Matlack
On Sat, Jan 31, 2015 at 7:13 AM, Rickard Strandqvist rickard_strandqv...@spectrumdigital.se wrote: Variable was assigned a value that was never used. I have also removed all the code that thereby serves no purpose. This was found using a static code analysis program called cppcheck

Re: [PATCH] kvm: add halt_poll_ns module parameter

2015-02-09 Thread David Matlack
...@redhat.com --- Looks good, thanks for making those changes. I ran this patch on my benchmarks (loopback TCP_RR and memcache) using halt_poll_ns=7 and saw performance go from 40% to 60-65% of bare-metal. Tested-by: David Matlack dmatl...@google.com Reviewed-by: David Matlack dmatl

Re: [PATCH 1/2] KVM: x86: extract guest running logic from __vcpu_run

2015-02-09 Thread David Matlack
...@redhat.com --- Reviewed-by: David Matlack dmatl...@google.com arch/x86/kvm/x86.c | 67 +- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index bd7a70be41b3..0b8dd13676ef 100644

Re: [PATCH RFC] kvm: x86: add halt_poll module parameter

2015-02-05 Thread David Matlack
of the timer is around 8000-1 clock cycles compared to 2-12 without setting halt_poll. For the TSC deadline timer, thus, the effect is both a smaller average latency and a smaller variance. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- Reviewed-by: David Matlack dmatl

Re: [PATCH 1/9] KVM: MMU: fix decoding cache type from MTRR

2015-05-06 Thread David Matlack
On Thu, Apr 30, 2015 at 3:24 AM, guangrong.x...@linux.intel.com wrote: From: Xiao Guangrong guangrong.x...@linux.intel.com There are some bugs in current get_mtrr_type(); 1: bit 2 of mtrr_state-enabled is corresponding bit 11 of IA32_MTRR_DEF_TYPE bit 1, not bit 2. (code is correct though)

Re: [PATCH 8/9] KVM: MMU: fix MTRR update

2015-05-06 Thread David Matlack
On Thu, Apr 30, 2015 at 3:24 AM, guangrong.x...@linux.intel.com wrote: From: Xiao Guangrong guangrong.x...@linux.intel.com Currently, whenever guest MTRR registers are changed kvm_mmu_reset_context is called to switch to the new root shadow page table, however, it's useless since: 1) the

[PATCH] staging: slicoss: fix occasionally writing out only half of a dma address

2015-05-11 Thread David Matlack
size and the eeprom checksum fails. This patch fixes the issue by removing curaddrupper and always writing the upper 32-bits of dma addresses. Signed-off-by: David Matlack dmatl...@google.com --- drivers/staging/slicoss/slic.h| 1 - drivers/staging/slicoss/slicoss.c | 5 + 2 files changed, 1

[PATCH] staging: slicoss: remove slic_spinlock wrapper

2015-05-11 Thread David Matlack
As per TODO. This commit introduces no functional changes. Signed-off-by: David Matlack dmatl...@google.com --- drivers/staging/slicoss/TODO | 1 - drivers/staging/slicoss/slic.h| 19 +++--- drivers/staging/slicoss/slicoss.c | 125 ++ 3 files

Re: [PATCH 12/15] KVM: MTRR: introduce mtrr_for_each_mem_type

2015-06-08 Thread David Matlack
On Sat, May 30, 2015 at 3:59 AM, Xiao Guangrong guangrong.x...@linux.intel.com wrote: It walks all MTRRs and gets all the memory cache type setting for the specified range also it checks if the range is fully covered by MTRRs Signed-off-by: Xiao Guangrong guangrong.x...@linux.intel.com ---

Re: [PATCH 05/15] KVM: MTRR: clean up mtrr default type

2015-06-08 Thread David Matlack
On Sat, May 30, 2015 at 3:59 AM, Xiao Guangrong guangrong.x...@linux.intel.com wrote: Use union definition to avoid the decode/code workload and drop all the hard code Thank you for doing this cleanup. The new code is much clearer! Signed-off-by: Xiao Guangrong guangrong.x...@linux.intel.com

Re: [PATCH 09/15] KVM: MTRR: introduce var_mtrr_range

2015-06-08 Thread David Matlack
On Sat, May 30, 2015 at 3:59 AM, Xiao Guangrong guangrong.x...@linux.intel.com wrote: It gets the range for the specified variable MTRR Signed-off-by: Xiao Guangrong guangrong.x...@linux.intel.com --- arch/x86/kvm/mtrr.c | 19 +-- 1 file changed, 13 insertions(+), 6

Re: [PATCH] staging:slicoss:slicoss.h remove volatile variables

2015-06-26 Thread David Matlack
Hi Vikul, welcome! See my comment below... On Fri, Jun 26, 2015 at 12:57 PM, Vikul Gupta gup...@linux.vnet.ibm.com wrote: I am a high school student trying to become familiar with the opensource process and linux kernel. This is my first submission to the mailing list. I fixed the slicoss

Re: [PATCH 1/3] KVM: make halt_poll_ns per-VCPU

2015-08-24 Thread David Matlack
On Mon, Aug 24, 2015 at 5:53 AM, Wanpeng Li wanpeng...@hotmail.com wrote: Change halt_poll_ns into per-VCPU variable, seeded from module parameter, to allow greater flexibility. You should also change kvm_vcpu_block to read halt_poll_ns from the vcpu instead of the module parameter.

Re: [PATCH 2/3] KVM: dynamise halt_poll_ns adjustment

2015-08-24 Thread David Matlack
On Mon, Aug 24, 2015 at 5:53 AM, Wanpeng Li wanpeng...@hotmail.com wrote: There are two new kernel parameters for changing the halt_poll_ns: halt_poll_ns_grow and halt_poll_ns_shrink. halt_poll_ns_grow affects halt_poll_ns when an interrupt arrives and halt_poll_ns_shrink does it when idle

Re: [PATCH v2 2/3] KVM: dynamic halt_poll_ns adjustment

2015-08-25 Thread David Matlack
Thanks for writing v2, Wanpeng. On Mon, Aug 24, 2015 at 11:35 PM, Wanpeng Li wanpeng...@hotmail.com wrote: There is a downside of halt_poll_ns since poll is still happen for idle VCPU which can waste cpu usage. This patch adds the ability to adjust halt_poll_ns dynamically. What testing have

Re: [PATCH v9 17/18] KVM: Update Posted-Interrupts Descriptor when vCPU is blocked

2015-10-14 Thread David Matlack
Hi Feng. On Fri, Sep 18, 2015 at 7:29 AM, Feng Wu wrote: > This patch updates the Posted-Interrupts Descriptor when vCPU > is blocked. > > pre-block: > - Add the vCPU to the blocked per-CPU list > - Set 'NV' to POSTED_INTR_WAKEUP_VECTOR > > post-block: > - Remove the vCPU from

Re: [PATCH v9 17/18] KVM: Update Posted-Interrupts Descriptor when vCPU is blocked

2015-10-15 Thread David Matlack
On Wed, Oct 14, 2015 at 6:33 PM, Wu, Feng <feng...@intel.com> wrote: > >> -Original Message- >> From: David Matlack [mailto:dmatl...@google.com] >> Sent: Thursday, October 15, 2015 7:41 AM >> To: Wu, Feng <feng...@intel.com> >> Cc: Paol

Re: [PATCH 04/12] KVM: x86: Replace call-back set_tsc_khz() with a common function

2015-10-05 Thread David Matlack
On Mon, Oct 5, 2015 at 12:53 PM, Radim Krčmář wrote: > 2015-09-28 13:38+0800, Haozhong Zhang: >> Both VMX and SVM propagate virtual_tsc_khz in the same way, so this >> patch removes the call-back set_tsc_khz() and replaces it with a common >> function. >> >> Signed-off-by:

Re: [PATCH v2 2/3] KVM: dynamic halt_poll_ns adjustment

2015-08-27 Thread David Matlack
On Thu, Aug 27, 2015 at 2:59 AM, Wanpeng Li wanpeng...@hotmail.com wrote: Hi David, On 8/26/15 1:19 AM, David Matlack wrote: Thanks for writing v2, Wanpeng. On Mon, Aug 24, 2015 at 11:35 PM, Wanpeng Li wanpeng...@hotmail.com wrote: There is a downside of halt_poll_ns since poll is still

Re: [PATCH v4 0/3] KVM: Dynamic Halt-Polling

2015-09-01 Thread David Matlack
On Tue, Sep 1, 2015 at 5:29 PM, Wanpeng Li <wanpeng...@hotmail.com> wrote: > On 9/2/15 7:24 AM, David Matlack wrote: >> >> On Tue, Sep 1, 2015 at 3:58 PM, Wanpeng Li <wanpeng...@hotmail.com> wrote: >>> >>> Why this can happen? >> >> Ah, pro

Re: [PATCH v4 0/3] KVM: Dynamic Halt-Polling

2015-09-01 Thread David Matlack
On Thu, Aug 27, 2015 at 2:47 AM, Wanpeng Li wrote: > v3 -> v4: > * bring back grow vcpu->halt_poll_ns when interrupt arrives and shrinks >when idle VCPU is detected > > v2 -> v3: > * grow/shrink vcpu->halt_poll_ns by *halt_poll_ns_grow or > /halt_poll_ns_shrink > *

Re: [PATCH v4 0/3] KVM: Dynamic Halt-Polling

2015-09-01 Thread David Matlack
On Tue, Sep 1, 2015 at 3:58 PM, Wanpeng Li <wanpeng...@hotmail.com> wrote: > On 9/2/15 6:34 AM, David Matlack wrote: >> >> On Tue, Sep 1, 2015 at 3:30 PM, Wanpeng Li <wanpeng...@hotmail.com> wrote: >>> >>> On 9/2/15 5:45 AM, David Matlack wrote: >&

Re: [PATCH v4 0/3] KVM: Dynamic Halt-Polling

2015-09-01 Thread David Matlack
On Tue, Sep 1, 2015 at 3:30 PM, Wanpeng Li <wanpeng...@hotmail.com> wrote: > On 9/2/15 5:45 AM, David Matlack wrote: >> >> On Thu, Aug 27, 2015 at 2:47 AM, Wanpeng Li <wanpeng...@hotmail.com> >> wrote: >>> >>> v3 -> v4: >>> * bring

[PATCH 0/2] Adaptive halt-polling toggle

2015-09-01 Thread David Matlack
ld however keep halt_poll_ns below 1 ms since that is the tick frequency used by windows. David Matlack (1): kvm: adaptive halt-polling toggle Wanpeng Li (1): KVM: make halt_poll_ns per-VCPU include/linux/kvm_host.h | 1 + include/trace/events/kvm.h | 23 ++ virt/kvm/

[PATCH 1/2] KVM: make halt_poll_ns per-VCPU

2015-09-01 Thread David Matlack
From: Wanpeng Li Change halt_poll_ns into per-VCPU variable, seeded from module parameter, to allow greater flexibility. Signed-off-by: Wanpeng Li --- include/linux/kvm_host.h | 1 + virt/kvm/kvm_main.c | 5 +++-- 2 files changed, 4

[PATCH 2/2] kvm: adaptive halt-polling toggle

2015-09-01 Thread David Matlack
her frequency ticks. Signed-off-by: David Matlack <dmatl...@google.com> --- include/trace/events/kvm.h | 23 ++ virt/kvm/kvm_main.c| 110 ++--- 2 files changed, 97 insertions(+), 36 deletions(-) diff --git a/include/trace/events/kvm.h b/incl

Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-03 Thread David Matlack
On Thu, Sep 3, 2015 at 2:23 AM, Wanpeng Li wrote: > > How about something like: > > @@ -1941,10 +1976,14 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) > */ > if (kvm_vcpu_check_block(vcpu) < 0) { >

Re: [PATCH] staging: slicoss: remove unused variables

2015-09-04 Thread David Matlack
On Fri, Sep 4, 2015 at 6:23 AM, Sudip Mukherjee wrote: > These variables were only assigned some values but they were never used. > > Signed-off-by: Sudip Mukherjee > --- > drivers/staging/slicoss/slicoss.c | 27 ++- > 1

Re: [PATCH v6 0/3] KVM: Dynamic Halt-Polling

2015-09-02 Thread David Matlack
On Wed, Sep 2, 2015 at 12:29 AM, Wanpeng Li wrote: > v5 -> v6: > * fix wait_ns and poll_ns Thanks for bearing with me through all the reviews. I think it's on the verge of being done :). There are just few small things to fix. > > v4 -> v5: > * set base case 10us and

Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-02 Thread David Matlack
we save 3.4%~12.8% CPUs/second and get close > to no-polling overhead levels by using the dynamic-poll. The savings > should be even higher for higher frequency ticks. > > Suggested-by: David Matlack <dmatl...@google.com> > Signed-off-by: Wanpeng Li <wanpeng...@hotmail.com&g

Re: [PATCH v6 3/3] KVM: trace kvm_halt_poll_ns grow/shrink

2015-09-02 Thread David Matlack
On Wed, Sep 2, 2015 at 12:42 AM, Wanpeng Li wrote: > Tracepoint for dynamic halt_pool_ns, fired on every potential change. > > Signed-off-by: Wanpeng Li > --- > include/trace/events/kvm.h | 30 ++ > virt/kvm/kvm_main.c

Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-02 Thread David Matlack
On Wed, Sep 2, 2015 at 12:12 PM, Paolo Bonzini <pbonz...@redhat.com> wrote: > > > On 02/09/2015 20:09, David Matlack wrote: >> On Wed, Sep 2, 2015 at 12:29 AM, Wanpeng Li <wanpeng...@hotmail.com> wrote: >>> There is a downside of always-poll since poll is sti

Re: [PATCH] KVM: add halt_attempted_poll to VCPU stats

2015-09-15 Thread David Matlack
show as an abnormally high number of > attempted polling compared to the successful polls. Reviewed-by: David Matlack <dmatl...@google.com> > > Cc: Christian Borntraeger <borntrae...@de.ibm.com< > Cc: David Matlack <dmatl...@google.com> > Signed-off-by: Paolo Bonzini <

Re: [RFC PATCH 2/2] KVM: x86: use __kvm_guest_exit

2016-06-16 Thread David Matlack
On Thu, Jun 16, 2016 at 9:47 AM, Paolo Bonzini <pbonz...@redhat.com> wrote: > On 16/06/2016 18:43, David Matlack wrote: >> On Thu, Jun 16, 2016 at 1:21 AM, Paolo Bonzini <pbonz...@redhat.com> wrote: >>> This gains ~20 clock cycles per vmexit. On Intel there is

Re: [RFC PATCH 2/2] KVM: x86: use __kvm_guest_exit

2016-06-16 Thread David Matlack
On Thu, Jun 16, 2016 at 1:21 AM, Paolo Bonzini wrote: > This gains ~20 clock cycles per vmexit. On Intel there is no need > anymore to enable the interrupts in vmx_handle_external_intr, since we > are using the "acknowledge interrupt on exit" feature. AMD needs to do > that

Re: [PATCH 1/1] KVM: don't allow irq_fpu_usable when the VCPU's XCR0 is loaded

2016-03-11 Thread David Matlack
On Fri, Mar 11, 2016 at 1:14 PM, Andy Lutomirski <l...@amacapital.net> wrote: > > On Fri, Mar 11, 2016 at 12:47 PM, David Matlack <dmatl...@google.com> wrote: > > From: Eric Northup <digitale...@google.com> > > > > Add a percpu boolean, tracking whether

[PATCH 0/1] KVM: x86: using the fpu in interrupt context with a guest's xcr0

2016-03-11 Thread David Matlack
We've found that an interrupt handler that uses the fpu can kill a KVM VM, if it runs under the following conditions: - the guest's xcr0 register is loaded on the cpu - the guest's fpu context is not loaded - the host is using eagerfpu Note that the guest's xcr0 register and fpu context are

[PATCH 1/1] KVM: don't allow irq_fpu_usable when the VCPU's XCR0 is loaded

2016-03-11 Thread David Matlack
From: Eric Northup Add a percpu boolean, tracking whether a KVM vCPU is running on the host CPU. KVM will set and clear it as it loads/unloads guest XCR0. (Note that the rest of the guest FPU load/restore is safe, because kvm_load_guest_fpu and kvm_put_guest_fpu call

[PATCH] kvm: cap halt polling at exactly halt_poll_ns

2016-03-08 Thread David Matlack
=11000: ... kvm:kvm_halt_poll_ns: vcpu 0: halt_poll_ns 0 (shrink 1) ... kvm:kvm_halt_poll_ns: vcpu 0: halt_poll_ns 1 (grow 0) ... kvm:kvm_halt_poll_ns: vcpu 0: halt_poll_ns 2 (grow 1) Signed-off-by: David Matlack <dmatl...@google.com> --- virt/kvm/kvm_main.c | 3 +++ 1 file changed,

Re: [PATCH 0/1] KVM: x86: using the fpu in interrupt context with a guest's xcr0

2016-03-15 Thread David Matlack
On Mon, Mar 14, 2016 at 12:46 AM, Xiao Guangrong <guangrong.x...@linux.intel.com> wrote: > > > On 03/12/2016 04:47 AM, David Matlack wrote: > >> I have not been able to trigger this bug on Linux 4.3, and suspect >> it is due to this commit from Linux 4.2: >>

  1   2   3   4   >