lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55C86414.5070203@linaro.org>
Date:	Mon, 10 Aug 2015 10:43:00 +0200
From:	Eric Auger <eric.auger@...aro.org>
To:	Alex Williamson <alex.williamson@...hat.com>
CC:	eric.auger@...com, feng.wu@...el.com, pbonzini@...hat.com,
	linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.cs.columbia.edu,
	kvm@...r.kernel.org, avi.kivity@...il.com, mtosatti@...hat.com,
	joro@...tes.org, marc.zyngier@....com, christoffer.dall@...aro.org,
	linux-kernel@...r.kernel.org, patches@...aro.org
Subject: Re: [PATCH v4 4/5] KVM: introduce kvm_arch functions for IRQ bypass

On 08/07/2015 10:09 PM, Alex Williamson wrote:
> On Mon, 2015-08-03 at 19:20 +0200, Eric Auger wrote:
>> This patch introduces
>> - kvm_arch_irq_bypass_add_producer
>> - kvm_arch_irq_bypass_del_producer
>> - kvm_arch_irq_bypass_stop
>> - kvm_arch_irq_bypass_start
>>
>> They make possible to specialize the KVM IRQ bypass consumer in
>> case CONFIG_KVM_HAVE_IRQ_BYPASS is set.
>>
>> Signed-off-by: Eric Auger <eric.auger@...aro.org>
>> Signed-off-by: Feng Wu <feng.wu@...el.com>
>>
>> ---
>>
>> v2 -> v3 (Feng Wu):
>> - use 'kvm_arch_irq_bypass_start' instead of 'kvm_arch_irq_bypass_resume'
>> - Remove 'kvm_arch_irq_bypass_update', which is not needed to be
>>   a irqbypass callback per Alex's comments.
>> - Make kvm_arch_irq_bypass_add_producer return 'int'
>>
>> v1 -> v2:
>> - use CONFIG_KVM_HAVE_IRQ_BYPASS instead CONFIG_IRQ_BYPASS_MANAGER
>> - rename all functions according to Paolo's proposal
>> - add kvm_arch_irq_bypass_update according to Feng's need
>> ---
>>  include/linux/kvm_host.h | 33 +++++++++++++++++++++++++++++++++
>>  virt/kvm/Kconfig         |  3 +++
>>  2 files changed, 36 insertions(+)
>>
>> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
>> index 05e99b8..84b5feb 100644
>> --- a/include/linux/kvm_host.h
>> +++ b/include/linux/kvm_host.h
>> @@ -24,6 +24,7 @@
>>  #include <linux/err.h>
>>  #include <linux/irqflags.h>
>>  #include <linux/context_tracking.h>
>> +#include <linux/irqbypass.h>
>>  #include <asm/signal.h>
>>  
>>  #include <linux/kvm.h>
>> @@ -1151,5 +1152,37 @@ static inline void kvm_vcpu_set_dy_eligible(struct kvm_vcpu *vcpu, bool val)
>>  {
>>  }
>>  #endif /* CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT */
>> +
>> +#ifdef CONFIG_HAVE_KVM_IRQ_BYPASS
>> +
>> +int kvm_arch_irq_bypass_add_producer(struct irq_bypass_consumer *,
>> +			   struct irq_bypass_producer *);
>> +void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *,
>> +			   struct irq_bypass_producer *);
>> +void kvm_arch_irq_bypass_stop(struct irq_bypass_consumer *);
>> +void kvm_arch_irq_bypass_start(struct irq_bypass_consumer *);
>> +
>> +#else
> 
> Do we really need static inline stubs?  When would they get used?
This addresses the case where another arch would use an irq bypass
producer (such as vfio platform driver ) and irqfd without
implementing/needing forwarding/posting stuff.

I see 2 solutions: either we have those stubs or in eventfd.c we guard
	irq_bypass_unregister_consumer(&irqfd->consumer);
and
	ret = irq_bypass_register_consumer(&irqfd->consumer);
by

#ifdef CONFIG_HAVE_KVM_IRQ_BYPASS
#endif

This latter solution maybe is better.

  How
> would they work since we call them via function pointers?
Just tested that without the ARM forwarding implementation of kvm_arch
functions and that runs fine.
> 
>> +
>> +static inline int kvm_arch_irq_bypass_add_producer(
>> +			struct irq_bypass_consumer *cons,
>> +			struct irq_bypass_producer *prod)
>> +{
>> +	return -1;
> 
> No reason not to stick with standard errno values, is there?  -EINVAL
> Thanks,
sure

Thanks

Eric
> 
> Alex
> 
>> +}
>> +static inline void kvm_arch_irq_bypass_del_producer(
>> +			struct irq_bypass_consumer *cons,
>> +			struct irq_bypass_producer *prod)
>> +{
>> +}
>> +static inline void kvm_arch_irq_bypass_stop(
>> +			struct irq_bypass_consumer *cons)
>> +{
>> +}
>> +static inline void kvm_arch_irq_bypass_start(
>> +			struct irq_bypass_consumer *cons)
>> +{
>> +}
>> +#endif /* CONFIG_HAVE_KVM_IRQ_BYPASS */
>>  #endif
>>  
>> diff --git a/virt/kvm/Kconfig b/virt/kvm/Kconfig
>> index e2c876d..9f8014d 100644
>> --- a/virt/kvm/Kconfig
>> +++ b/virt/kvm/Kconfig
>> @@ -47,3 +47,6 @@ config KVM_GENERIC_DIRTYLOG_READ_PROTECT
>>  config KVM_COMPAT
>>         def_bool y
>>         depends on COMPAT && !S390
>> +
>> +config HAVE_KVM_IRQ_BYPASS
>> +       bool
> 
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ