Re: [Qemu-devel] [PATCH RFC] qemu-error: introduce error_report_once

2018-05-31 Thread Peter Xu
On Thu, May 31, 2018 at 12:03:17PM +0100, Stefan Hajnoczi wrote: > On Tue, May 15, 2018 at 05:13:56PM +0800, Peter Xu wrote: > > I stole the printk_once() macro. > > > > I always wanted to be able to print some error directly if there is a > > buffer to dump, however we can't use error_report() re

Re: [Qemu-devel] [PATCH RFC] qemu-error: introduce error_report_once

2018-05-31 Thread Stefan Hajnoczi
On Tue, May 15, 2018 at 05:13:56PM +0800, Peter Xu wrote: > I stole the printk_once() macro. > > I always wanted to be able to print some error directly if there is a > buffer to dump, however we can't use error_report() really quite often > when there can be any DDOS attack. To avoid that, we ca

Re: [Qemu-devel] [PATCH RFC] qemu-error: introduce error_report_once

2018-05-16 Thread Peter Xu
On Wed, May 16, 2018 at 09:02:42AM -0500, Eric Blake wrote: > On 05/15/2018 10:07 PM, Peter Xu wrote: > > > > > +static bool __print_once; \ > > > > > > Double-underscore names are reserved for the compiler's use, not ours. > > > Better would be naming this: > > > > > > sta

Re: [Qemu-devel] [PATCH RFC] qemu-error: introduce error_report_once

2018-05-16 Thread Eric Blake
On 05/15/2018 10:07 PM, Peter Xu wrote: +static bool __print_once; \ Double-underscore names are reserved for the compiler's use, not ours. Better would be naming this: static bool print_once_; with a trailing underscore, or at most a single leading underscore. +

Re: [Qemu-devel] [PATCH RFC] qemu-error: introduce error_report_once

2018-05-15 Thread Peter Xu
On Tue, May 15, 2018 at 05:56:34PM +0200, Markus Armbruster wrote: [...] > I see. > > Add a contract comment (suggest to start with the one next to > error_report()), expand the tabs, replace the reserved identifiers > (caught by patchew; you can use foo_ instead of __foo), throw in at > least o

Re: [Qemu-devel] [PATCH RFC] qemu-error: introduce error_report_once

2018-05-15 Thread Peter Xu
On Tue, May 15, 2018 at 10:29:39AM -0500, Eric Blake wrote: > On 05/15/2018 04:13 AM, Peter Xu wrote: > > I stole the printk_once() macro. > > > > I always wanted to be able to print some error directly if there is a > > buffer to dump, however we can't use error_report() really quite often > > wh

Re: [Qemu-devel] [PATCH RFC] qemu-error: introduce error_report_once

2018-05-15 Thread Eric Blake
On 05/15/2018 10:56 AM, Markus Armbruster wrote: One example I can think of is that we can keep some error environment when the first error happens: if (something_wrong_happened) { if (error_report_once("blablabla")) { /* only cache the first error */ error_cmd = xxx;

Re: [Qemu-devel] [PATCH RFC] qemu-error: introduce error_report_once

2018-05-15 Thread Markus Armbruster
Peter Xu writes: > On Tue, May 15, 2018 at 02:02:55PM +0200, Markus Armbruster wrote: >> Peter Xu writes: >> >> > I stole the printk_once() macro. >> > >> > I always wanted to be able to print some error directly if there is a >> > buffer to dump, however we can't use error_report() really quit

Re: [Qemu-devel] [PATCH RFC] qemu-error: introduce error_report_once

2018-05-15 Thread Eric Blake
On 05/15/2018 04:13 AM, Peter Xu wrote: I stole the printk_once() macro. I always wanted to be able to print some error directly if there is a buffer to dump, however we can't use error_report() really quite often when there can be any DDOS attack. To avoid that, we can introduce a print-once f

Re: [Qemu-devel] [PATCH RFC] qemu-error: introduce error_report_once

2018-05-15 Thread Peter Xu
On Tue, May 15, 2018 at 02:02:55PM +0200, Markus Armbruster wrote: > Peter Xu writes: > > > I stole the printk_once() macro. > > > > I always wanted to be able to print some error directly if there is a > > buffer to dump, however we can't use error_report() really quite often > > when there can

Re: [Qemu-devel] [PATCH RFC] qemu-error: introduce error_report_once

2018-05-15 Thread Markus Armbruster
Peter Xu writes: > I stole the printk_once() macro. > > I always wanted to be able to print some error directly if there is a > buffer to dump, however we can't use error_report() really quite often > when there can be any DDOS attack. Got an example? > To av

Re: [Qemu-devel] [PATCH RFC] qemu-error: introduce error_report_once

2018-05-15 Thread no-reply
Hi, This series seems to have some coding style problems. See output below for more information: Type: series Message-id: 20180515091356.24106-1-pet...@redhat.com Subject: [Qemu-devel] [PATCH RFC] qemu-error: introduce error_report_once === TEST SCRIPT BEGIN === #!/bin/bash BASE=base n=1 total

[Qemu-devel] [PATCH RFC] qemu-error: introduce error_report_once

2018-05-15 Thread Peter Xu
I stole the printk_once() macro. I always wanted to be able to print some error directly if there is a buffer to dump, however we can't use error_report() really quite often when there can be any DDOS attack. To avoid that, we can introduce a print-once function for it. CC: Markus Armbruster Si