diff mbox

[03/38] event_notifier: Make event_notifier_init_fd() #ifdef CONFIG_EVENTFD

Message ID 1456771254-17511-4-git-send-email-armbru@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Markus Armbruster Feb. 29, 2016, 6:40 p.m. UTC
Event notifiers are designed for eventfd(2).  They can fall back to
pipes, but according to Paolo, event_notifier_init_fd() really
requires the real thing, and should therefore be under #ifdef
CONFIG_EVENTFD.  Do that.

Its only user is ivshmem, which is currently CONFIG_POSIX.  Narrow it
to CONFIG_EVENTFD.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 default-configs/pci.mak     | 2 +-
 util/event_notifier-posix.c | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Marc-André Lureau March 1, 2016, 10:57 a.m. UTC | #1
Hi

On Mon, Feb 29, 2016 at 7:40 PM, Markus Armbruster <armbru@redhat.com> wrote:
> Event notifiers are designed for eventfd(2).  They can fall back to
> pipes, but according to Paolo, event_notifier_init_fd() really
> requires the real thing, and should therefore be under #ifdef
> CONFIG_EVENTFD.  Do that.
>
> Its only user is ivshmem, which is currently CONFIG_POSIX.  Narrow it
> to CONFIG_EVENTFD.
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  default-configs/pci.mak     | 2 +-
>  util/event_notifier-posix.c | 6 ++++++
>  2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/default-configs/pci.mak b/default-configs/pci.mak
> index 4fa9a28..9c8bc68 100644
> --- a/default-configs/pci.mak
> +++ b/default-configs/pci.mak
> @@ -36,5 +36,5 @@ CONFIG_SDHCI=y
>  CONFIG_EDU=y
>  CONFIG_VGA=y
>  CONFIG_VGA_PCI=y
> -CONFIG_IVSHMEM=$(CONFIG_POSIX)
> +CONFIG_IVSHMEM=$(CONFIG_EVENTFD)

This narrows ivshmem to eventfd os only. Eventually after the split,
it is easier to bring back posix for ivshmem-plain, but it's important
to highlight this change.

>  CONFIG_ROCKER=y
> diff --git a/util/event_notifier-posix.c b/util/event_notifier-posix.c
> index 2e30e74..c9657a6 100644
> --- a/util/event_notifier-posix.c
> +++ b/util/event_notifier-posix.c
> @@ -20,11 +20,17 @@
>  #include <sys/eventfd.h>
>  #endif
>
> +#ifdef CONFIG_EVENTFD
> +/*
> + * Initialize @e with existing file descriptor @fd.
> + * @fd must be a genuine eventfd object, emulation with pipe won't do.
> + */
>  void event_notifier_init_fd(EventNotifier *e, int fd)
>  {
>      e->rfd = fd;
>      e->wfd = fd;
>  }
> +#endif
>
>  int event_notifier_init(EventNotifier *e, int active)
>  {
> --
> 2.4.3
>
>
Paolo Bonzini March 1, 2016, 11:35 a.m. UTC | #2
On 29/02/2016 19:40, Markus Armbruster wrote:
> Event notifiers are designed for eventfd(2).  They can fall back to
> pipes, but according to Paolo, event_notifier_init_fd() really
> requires the real thing, and should therefore be under #ifdef
> CONFIG_EVENTFD.  Do that.
> 
> Its only user is ivshmem, which is currently CONFIG_POSIX.  Narrow it
> to CONFIG_EVENTFD.
> 
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  default-configs/pci.mak     | 2 +-
>  util/event_notifier-posix.c | 6 ++++++
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/default-configs/pci.mak b/default-configs/pci.mak
> index 4fa9a28..9c8bc68 100644
> --- a/default-configs/pci.mak
> +++ b/default-configs/pci.mak
> @@ -36,5 +36,5 @@ CONFIG_SDHCI=y
>  CONFIG_EDU=y
>  CONFIG_VGA=y
>  CONFIG_VGA_PCI=y
> -CONFIG_IVSHMEM=$(CONFIG_POSIX)
> +CONFIG_IVSHMEM=$(CONFIG_EVENTFD)
>  CONFIG_ROCKER=y
> diff --git a/util/event_notifier-posix.c b/util/event_notifier-posix.c
> index 2e30e74..c9657a6 100644
> --- a/util/event_notifier-posix.c
> +++ b/util/event_notifier-posix.c
> @@ -20,11 +20,17 @@
>  #include <sys/eventfd.h>
>  #endif
>  
> +#ifdef CONFIG_EVENTFD
> +/*
> + * Initialize @e with existing file descriptor @fd.
> + * @fd must be a genuine eventfd object, emulation with pipe won't do.
> + */
>  void event_notifier_init_fd(EventNotifier *e, int fd)
>  {
>      e->rfd = fd;
>      e->wfd = fd;
>  }
> +#endif
>  
>  int event_notifier_init(EventNotifier *e, int active)
>  {
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Markus Armbruster March 1, 2016, noon UTC | #3
Marc-André Lureau <marcandre.lureau@gmail.com> writes:

> Hi
>
> On Mon, Feb 29, 2016 at 7:40 PM, Markus Armbruster <armbru@redhat.com> wrote:
>> Event notifiers are designed for eventfd(2).  They can fall back to
>> pipes, but according to Paolo, event_notifier_init_fd() really
>> requires the real thing, and should therefore be under #ifdef
>> CONFIG_EVENTFD.  Do that.
>>
>> Its only user is ivshmem, which is currently CONFIG_POSIX.  Narrow it
>> to CONFIG_EVENTFD.
>>
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>>  default-configs/pci.mak     | 2 +-
>>  util/event_notifier-posix.c | 6 ++++++
>>  2 files changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/default-configs/pci.mak b/default-configs/pci.mak
>> index 4fa9a28..9c8bc68 100644
>> --- a/default-configs/pci.mak
>> +++ b/default-configs/pci.mak
>> @@ -36,5 +36,5 @@ CONFIG_SDHCI=y
>>  CONFIG_EDU=y
>>  CONFIG_VGA=y
>>  CONFIG_VGA_PCI=y
>> -CONFIG_IVSHMEM=$(CONFIG_POSIX)
>> +CONFIG_IVSHMEM=$(CONFIG_EVENTFD)
>
> This narrows ivshmem to eventfd os only. Eventually after the split,
> it is easier to bring back posix for ivshmem-plain,

Good point.

>                                                     but it's important
> to highlight this change.

Yes.  Any ideas on how to highlight it more?

[...]
Paolo Bonzini March 1, 2016, 12:05 p.m. UTC | #4
On 01/03/2016 13:00, Markus Armbruster wrote:
> Marc-André Lureau <marcandre.lureau@gmail.com> writes:
> 
>> Hi
>>
>> On Mon, Feb 29, 2016 at 7:40 PM, Markus Armbruster <armbru@redhat.com> wrote:
>>> Event notifiers are designed for eventfd(2).  They can fall back to
>>> pipes, but according to Paolo, event_notifier_init_fd() really
>>> requires the real thing, and should therefore be under #ifdef
>>> CONFIG_EVENTFD.  Do that.
>>>
>>> Its only user is ivshmem, which is currently CONFIG_POSIX.  Narrow it
>>> to CONFIG_EVENTFD.
>>>
>>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>>> ---
>>>  default-configs/pci.mak     | 2 +-
>>>  util/event_notifier-posix.c | 6 ++++++
>>>  2 files changed, 7 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/default-configs/pci.mak b/default-configs/pci.mak
>>> index 4fa9a28..9c8bc68 100644
>>> --- a/default-configs/pci.mak
>>> +++ b/default-configs/pci.mak
>>> @@ -36,5 +36,5 @@ CONFIG_SDHCI=y
>>>  CONFIG_EDU=y
>>>  CONFIG_VGA=y
>>>  CONFIG_VGA_PCI=y
>>> -CONFIG_IVSHMEM=$(CONFIG_POSIX)
>>> +CONFIG_IVSHMEM=$(CONFIG_EVENTFD)
>>
>> This narrows ivshmem to eventfd os only. Eventually after the split,
>> it is easier to bring back posix for ivshmem-plain,
> 
> Good point.
> 
>>                                                     but it's important
>> to highlight this change.
> 
> Yes.  Any ideas on how to highlight it more?

Release notes should do, under "Build dependencies".

Paolo
diff mbox

Patch

diff --git a/default-configs/pci.mak b/default-configs/pci.mak
index 4fa9a28..9c8bc68 100644
--- a/default-configs/pci.mak
+++ b/default-configs/pci.mak
@@ -36,5 +36,5 @@  CONFIG_SDHCI=y
 CONFIG_EDU=y
 CONFIG_VGA=y
 CONFIG_VGA_PCI=y
-CONFIG_IVSHMEM=$(CONFIG_POSIX)
+CONFIG_IVSHMEM=$(CONFIG_EVENTFD)
 CONFIG_ROCKER=y
diff --git a/util/event_notifier-posix.c b/util/event_notifier-posix.c
index 2e30e74..c9657a6 100644
--- a/util/event_notifier-posix.c
+++ b/util/event_notifier-posix.c
@@ -20,11 +20,17 @@ 
 #include <sys/eventfd.h>
 #endif
 
+#ifdef CONFIG_EVENTFD
+/*
+ * Initialize @e with existing file descriptor @fd.
+ * @fd must be a genuine eventfd object, emulation with pipe won't do.
+ */
 void event_notifier_init_fd(EventNotifier *e, int fd)
 {
     e->rfd = fd;
     e->wfd = fd;
 }
+#endif
 
 int event_notifier_init(EventNotifier *e, int active)
 {