Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1258413 > unrolled thread
| Started by | Alexander Yarygin <yarygin@linux.vnet.ibm.com> |
|---|---|
| First post | 2015-10-28 21:50 +0100 |
| Last post | 2015-10-29 08:10 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v9 1/4] perf,kvm/{x86,s390}: Remove dependency on uapi/kvm_perf.h Alexander Yarygin <yarygin@linux.vnet.ibm.com> - 2015-10-28 21:50 +0100
Re: [PATCH v9 1/4] perf,kvm/{x86,s390}: Remove dependency on uapi/kvm_perf.h Hemant Kumar <hemant@linux.vnet.ibm.com> - 2015-10-29 08:10 +0100
| From | Alexander Yarygin <yarygin@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-10-28 21:50 +0100 |
| Subject | Re: [PATCH v9 1/4] perf,kvm/{x86,s390}: Remove dependency on uapi/kvm_perf.h |
| Message-ID | <qoFPs-7xx-7@gated-at.bofh.it> |
Hemant Kumar writes:
> Hi David,
>
>
> On 10/07/2015 09:41 PM, David Ahern wrote:
>> On 10/6/15 8:25 PM, Hemant Kumar wrote:
>>> @@ -358,7 +357,12 @@ static bool handle_end_event(struct
>>> perf_kvm_stat *kvm,
>>> time_diff = sample->time - time_begin;
>>>
>>> if (kvm->duration && time_diff > kvm->duration) {
>>> - char decode[DECODE_STR_LEN];
>>> + char *decode = zalloc(decode_str_len);
>>
>> decode can still be a stack variable even with variable length.
>>
>
> Yeah, we can do that. But, I am not sure whether its a standard way.
>
Well, I also vote for making them variable length arrays. I guess that
wouldn't be a problem because the "variable" here is actually a constant
compile time value, even if it's extern.
But if people are strongly against it, as an alternative I can suggest
to move the 'char *decode' variable to the perf_kvm_stat structure,
allocate it once e.g. in kvm_events_report() and just write to it via
decode_key(). If I'm not mistaken, we always write \0 trimmed strings,
so garbage after \0 shouldn't be a problem.
It's not a real problem anyway :)
For s390 parts:
Acked-by: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
>> -----8<-----
>>
>>> @@ -575,7 +581,7 @@ static void show_timeofday(void)
>>>
>>> static void print_result(struct perf_kvm_stat *kvm)
>>> {
>>> - char decode[DECODE_STR_LEN];
>>> + char *decode;
>>
>> and a stack variable here too.
>>
>
> Same here.
>
>> David
>> _______________________________________________
>> Linuxppc-dev mailing list
>> Linuxppc-dev@lists.ozlabs.org
>> https://lists.ozlabs.org/listinfo/linuxppc-dev
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Hemant Kumar <hemant@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-10-29 08:10 +0100 |
| Message-ID | <qoPvr-5xC-7@gated-at.bofh.it> |
| In reply to | #1258413 |
On 10/29/2015 02:17 AM, Alexander Yarygin wrote:
> Hemant Kumar writes:
>
>> Hi David,
>>
>>
>> On 10/07/2015 09:41 PM, David Ahern wrote:
>>> On 10/6/15 8:25 PM, Hemant Kumar wrote:
>>>> @@ -358,7 +357,12 @@ static bool handle_end_event(struct
>>>> perf_kvm_stat *kvm,
>>>> time_diff = sample->time - time_begin;
>>>>
>>>> if (kvm->duration && time_diff > kvm->duration) {
>>>> - char decode[DECODE_STR_LEN];
>>>> + char *decode = zalloc(decode_str_len);
>>> decode can still be a stack variable even with variable length.
>>>
>> Yeah, we can do that. But, I am not sure whether its a standard way.
>>
> Well, I also vote for making them variable length arrays. I guess that
> wouldn't be a problem because the "variable" here is actually a constant
> compile time value, even if it's extern.
>
> But if people are strongly against it, as an alternative I can suggest
> to move the 'char *decode' variable to the perf_kvm_stat structure,
> allocate it once e.g. in kvm_events_report() and just write to it via
> decode_key(). If I'm not mistaken, we always write \0 trimmed strings,
> so garbage after \0 shouldn't be a problem.
I agree. We can do that. But, since this is a small change (making
the variable a constant compile time value rather than the array being
a run time value), we can do that subsequently. For now, we can go
with the current patchset.
> It's not a real problem anyway :)
Yeah.
> For s390 parts:
> Acked-by: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
Thanks a lot for testing and acking it. :)
>>> -----8<-----
>>>
>>>> @@ -575,7 +581,7 @@ static void show_timeofday(void)
>>>>
>>>> static void print_result(struct perf_kvm_stat *kvm)
>>>> {
>>>> - char decode[DECODE_STR_LEN];
>>>> + char *decode;
>>> and a stack variable here too.
>>>
>> Same here.
>>
>>> David
>>> _______________________________________________
>>> Linuxppc-dev mailing list
>>> Linuxppc-dev@lists.ozlabs.org
>>> https://lists.ozlabs.org/listinfo/linuxppc-dev
--
Thanks,
Hemant Kumar
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web