[dpdk-dev] [PATCH v7 6/7] eal: add failure handle mechanism for hotplug

Jeff Guo jia.guo at intel.com
Tue Jul 10 10:23:18 CEST 2018



On 7/9/2018 9:50 PM, Andrew Rybchenko wrote:
> On 09.07.2018 15:01, Jeff Guo wrote:
>> This patch introduces a failure handle mechanism to handle device
>> hotplug removal event.
>>
>> First it can register sigbus handler when enable device event 
>> monitor. Once
>> sigbus error be captured, it will check the failure address and 
>> accordingly
>> remap the invalid memory for the corresponding device. Besed on this
>> mechanism, it could guaranty the application not crash when the 
>> device be
>> hotplug out.
>>
>> Signed-off-by: Jeff Guo <jia.guo at intel.com>
>> Acked-by: Shaopeng He <shaopeng.he at intel.com>
>> ---
>> v7->v6:
>> delete some unused part.
>> ---
>>   lib/librte_eal/linuxapp/eal/eal_dev.c | 112 
>> +++++++++++++++++++++++++++++++++-
>>   1 file changed, 111 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/librte_eal/linuxapp/eal/eal_dev.c 
>> b/lib/librte_eal/linuxapp/eal/eal_dev.c
>> index 1cf6aeb..0de3fb7 100644
>> --- a/lib/librte_eal/linuxapp/eal/eal_dev.c
>> +++ b/lib/librte_eal/linuxapp/eal/eal_dev.c
>> @@ -4,6 +4,8 @@
>>     #include <string.h>
>>   #include <unistd.h>
>> +#include <fcntl.h>
>> +#include <signal.h>
>>   #include <sys/socket.h>
>>   #include <linux/netlink.h>
>>   @@ -14,6 +16,10 @@
>>   #include <rte_malloc.h>
>>   #include <rte_interrupts.h>
>>   #include <rte_alarm.h>
>> +#include <rte_bus.h>
>> +#include <rte_eal.h>
>> +#include <rte_spinlock.h>
>> +#include <rte_errno.h>
>>     #include "eal_private.h"
>>   @@ -23,6 +29,16 @@ static bool monitor_started;
>>   #define EAL_UEV_MSG_LEN 4096
>>   #define EAL_UEV_MSG_ELEM_LEN 128
>>   +/*
>> + * spinlock for device failure process, protect the bus and the device
>> + * to avoid race condition.
>> + */
>> +static rte_spinlock_t dev_failure_lock = RTE_SPINLOCK_INITIALIZER;
>
> Sorry, it is still too vague why the lock is required. It is just generic
> words. Please, add details and describe circumstance when it is
> required.

let me check if i can do more for that.




More information about the dev mailing list