Re: [PATCH] rtas_errd: Add support for cpu and memory hotplugging via RTAS event

Vasant Hegde <[email protected]> Mon, 10 Nov 2014 10:23:43 +0530
Newsgroups gmane.linux.tools.diag.devel
Message-ID <[email protected]>
On 11/07/2014 10:46 PM, Thomas Falcon wrote:
> On 11/06/2014 11:40 PM, Vasant Hegde wrote:
>> On 11/05/2014 12:03 AM, Thomas Falcon wrote:
>>> This patch adds support for handling RTAS hotplug events for cpus and memory
>>> blocks in addition to such events for pci devices. It includes additional
>>> support for events indicating an addition or a removal of multiple cpus or
>>> logical memory blocks. Finally, for debugging purposes, it includes the option
>>> to handle the event without calling the drmgr command.
>>>
>>
>> Thomas,
>>
>> Patch looks good. Could you please describe how to test this patch?
>
> Thanks.  To test, I used a cpu or memory hotplug event file, and ran rtas_errd with that file as input:
>
> rtas_errd -d -f hotplug_file.txt
>
> You can include the "-R" option if you want to run drmgr.  With that option, it does everything except actually running the drmgr command.
>
> rtas_errd -d -R -f hotplug_file.txt

Thanks!

I'm planning to add testsuite for rtas_errd (and few other tools). Could you 
please pass input file to me (hotplug_file.txt) so that when we write test cases 
we will include this as well.

-Vasant

>
>>
>> @Nathan,
>>
>> Could you please Ack this one ?
>>
>> -Vasant
>>
>>> Signed-off-by: Thomas Falcon <[email protected]>
>>> ---
>>>    rtas_errd/hotplug.c | 16 ++++++++++++++++
>>>    1 file changed, 16 insertions(+)
>>>
>>> diff --git a/rtas_errd/hotplug.c b/rtas_errd/hotplug.c
>>> index 0f84f8d..91036b2 100644
>>> --- a/rtas_errd/hotplug.c
>>> +++ b/rtas_errd/hotplug.c
>>> @@ -24,6 +24,7 @@ void handle_hotplug_event(struct event *re)
>>>            pid_t child;
>>>            int status, rc;
>>>            char drc_index[11];
>>> +    char count[4];
>>>            char *drmgr_args[] = { DRMGR_PROGRAM_NOPATH, "-c", NULL, NULL, NULL,
>>>                            NULL, NULL, "-d4", "-V", NULL};
>>>
>>> @@ -39,6 +40,12 @@ void handle_hotplug_event(struct event *re)
>>>                                    drmgr_args[2] = "pci";
>>>                                    drmgr_args[6] = "-n";
>>>                                    break;
>>> +            case RTAS_HP_TYPE_CPU:
>>> +                drmgr_args[2] = "cpu";
>>> +                break;
>>> +            case RTAS_HP_TYPE_MEMORY:
>>> +                drmgr_args[2] = "mem";
>>> +                                break;
>>>                            default:
>>>                                    dbg("Unknown or unsupported hotplug type %d\n",
>>>                        hotplug->type);
>>> @@ -63,6 +70,11 @@ void handle_hotplug_event(struct event *re)
>>>                                    snprintf(drc_index, 11, "%#x", hotplug->u1.drc_index);
>>>                                    drmgr_args[5] = drc_index;
>>>                                    break;
>>> +            case RTAS_HP_ID_DRC_COUNT:
>>> +                drmgr_args[4] = "-q";
>>> +                snprintf(count, 4, "%u", hotplug->u1.count);
>>> +                drmgr_args[5] = count;
>>> +                break;
>>>                            default:
>>>                                    dbg("Unknown or unsupported hotplug identifier %d\n",
>>>                        hotplug->identifier);
>>> @@ -73,6 +85,10 @@ void handle_hotplug_event(struct event *re)
>>>                            drmgr_args[1], drmgr_args[2], drmgr_args[3],
>>>                            drmgr_args[4], drmgr_args[5], drmgr_args[6]);
>>>
>>> +#ifdef DEBUG
>>> +        if(no_drmgr)
>>> +            return;
>>> +#endif
>>>                    /* invoke drmgr */
>>>                    dbg("Invoke drmgr command\n");
>>>
>>
>


------------------------------------------------------------------------------