lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 11 Aug 2011 12:51:30 -0700
From:	Alex Neronskiy <zakmagnus@...omium.org>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
	Don Zickus <dzickus@...hat.com>,
	Mandeep Singh Baines <msb@...omium.org>,
	Alex Neronskiy <zakmagnus@...omium.com>
Subject: Re: [PATCH v6 2/2] Output stall data in debugfs

On Thu, Aug 11, 2011 at 12:43 PM, Peter Zijlstra <peterz@...radead.org> wrote:
> zakmagnus seems to bounce, so who am I talking to anyway..
>
> On Thu, 2011-08-11 at 21:35 +0200, Peter Zijlstra wrote:
>>
>> static void show_stall_trace(struct seq_file *f, void *v)
>> {
>>         struct stall *s = f->private;
>>         int i, idx = ACCESS_ONCE(s->idx);
>>
>>         mutex_lock(&stall_mutex);
>>
>>         raw_spin_lock(&s->lock[idx]);
>>         seq_printf(f, "stall: %d\n", s->worst);
>>         for (i = 0; i < s->trace[idx].nr_entries; i++) {
>>                 seq_printf(f, "[<%pK>] %pS\n",
>>                         (void *)s->trace->entries[i],
>>                         (void *)s->trace->entries[i]);
>>         }
>>         raw_spin_unlock(&s->lock[idx]);
>>
>>         mutex_unlock(&stall_mutex);
>> }
>>
>>
>> Yes its racy on s->worst, but who cares (if you do care you can keep a
>> copy in s->delay[idx] or so). Also, it might be better to not do the
>> spinlock but simply use an atomic bitop to set an in-use flag, there is
>> no reason to disable preemption over the seq_printf() loop.
>
> That also cures another problem you have, a seq_file buffer is only 1
> page large, you should be using the seqfile iterator interface and print
> one line at a time.. now clearly that won't work with preemption
> disabled either.
I didn't want to hold on to a lock while the lines were iterated over,
and instead just dump it in one go. I guess it's not a big deal to do
that, though. Nonetheless, is one page not enough?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ