Re: [PATCH RFC V10 15/18] kvm : Paravirtual ticketlocks support for linux guests running on KVM hypervisor

2013-07-16 Thread Gleb Natapov
On Tue, Jul 16, 2013 at 09:07:53AM +0530, Raghavendra K T wrote:
 On 07/15/2013 04:06 PM, Gleb Natapov wrote:
 On Mon, Jul 15, 2013 at 03:20:06PM +0530, Raghavendra K T wrote:
 On 07/14/2013 06:42 PM, Gleb Natapov wrote:
 On Mon, Jun 24, 2013 at 06:13:42PM +0530, Raghavendra K T wrote:
 kvm : Paravirtual ticketlocks support for linux guests running on KVM 
 hypervisor
 
 From: Srivatsa Vaddagiri va...@linux.vnet.ibm.com
 
 trimming
 [...]
 +
 +static void kvm_lock_spinning(struct arch_spinlock *lock, __ticket_t 
 want)
 +{
 + struct kvm_lock_waiting *w;
 + int cpu;
 + u64 start;
 + unsigned long flags;
 +
 + w = __get_cpu_var(lock_waiting);
 + cpu = smp_processor_id();
 + start = spin_time_start();
 +
 + /*
 +  * Make sure an interrupt handler can't upset things in a
 +  * partially setup state.
 +  */
 + local_irq_save(flags);
 +
 + /*
 +  * The ordering protocol on this is that the lock pointer
 +  * may only be set non-NULL if the want ticket is correct.
 +  * If we're updating want, we must first clear lock.
 +  */
 + w-lock = NULL;
 + smp_wmb();
 + w-want = want;
 + smp_wmb();
 + w-lock = lock;
 +
 + add_stats(TAKEN_SLOW, 1);
 +
 + /*
 +  * This uses set_bit, which is atomic but we should not rely on its
 +  * reordering gurantees. So barrier is needed after this call.
 +  */
 + cpumask_set_cpu(cpu, waiting_cpus);
 +
 + barrier();
 +
 + /*
 +  * Mark entry to slowpath before doing the pickup test to make
 +  * sure we don't deadlock with an unlocker.
 +  */
 + __ticket_enter_slowpath(lock);
 +
 + /*
 +  * check again make sure it didn't become free while
 +  * we weren't looking.
 +  */
 + if (ACCESS_ONCE(lock-tickets.head) == want) {
 + add_stats(TAKEN_SLOW_PICKUP, 1);
 + goto out;
 + }
 +
 + /* Allow interrupts while blocked */
 + local_irq_restore(flags);
 +
 So what happens if an interrupt comes here and an interrupt handler
 takes another spinlock that goes into the slow path? As far as I see
 lock_waiting will become overwritten and cpu will be cleared from
 waiting_cpus bitmap by nested kvm_lock_spinning(), so when halt is
 called here after returning from the interrupt handler nobody is going
 to wake this lock holder. Next random interrupt will fix it, but it
 may be several milliseconds away, or never. We should probably check
 if interrupt were enabled and call native_safe_halt() here.
 
 
 Okay you mean something like below should be done.
 if irq_enabled()
native_safe_halt()
 else
halt()
 
 It is been a complex stuff for analysis for me.
 
 So in our discussion stack would looking like this.
 
 spinlock()
kvm_lock_spinning()
-- interrupt here
halt()
 
 
  From the halt if we trace
 
 It is to early to trace the halt since it was not executed yet. Guest
 stack trace will look something like this:
 
 spinlock(a)
kvm_lock_spinning(a)
 lock_waiting = a
 set bit in waiting_cpus
  -- interrupt here
  spinlock(b)
kvm_lock_spinning(b)
  lock_waiting = b
  set bit in waiting_cpus
  halt()
  unset bit in waiting_cpus
  lock_waiting = NULL
   -- ret from interrupt
 halt()
 
 Now at the time of the last halt above lock_waiting == NULL and
 waiting_cpus is empty and not interrupt it pending, so who will unhalt
 the waiter?
 
 
 Yes. if an interrupt occurs between
 local_irq_restore() and halt(), this is possible. and since this is
 rarest of rare (possiility of irq entering slowpath and then no
 random irq to do spurious wakeup), we had never hit this problem in
 the past.
I do not think it is very rare to get interrupt between
local_irq_restore() and halt() under load since any interrupt that
occurs between local_irq_save() and local_irq_restore() will be delivered
immediately after local_irq_restore(). Of course the chance of no other
random interrupt waking lock waiter is very low, but waiter can sleep
for much longer then needed and this will be noticeable in performance.

BTW can NMI handler take spinlocks? If it can what happens if NMI is
delivered in a section protected by local_irq_save()/local_irq_restore()?

 
 So I am,
 1. trying to artificially reproduce this.
 
 2. I replaced the halt with below code,
if (arch_irqs_disabled())
 halt();
 
 and ran benchmarks.
 But this results in degradation because, it means we again go back
 and spin in irq enabled case.
 
Yes, this is not what I proposed.

 3. Now I am analyzing the performance overhead of safe_halt in irq
 enabled case.
   if (arch_irqs_disabled())
halt();
   else
safe_halt();
Use of arch_irqs_disabled() is incorrect here. If you are doing it before
local_irq_restore() it will always be false since you disabled interrupt
yourself, if you do it after then it is to late since interrupt can come
between local_irq_restore() and 

Re: splice vs execve lockdep trace.

2013-07-16 Thread Dave Chinner
On Mon, Jul 15, 2013 at 08:25:14PM -0700, Linus Torvalds wrote:
 On Mon, Jul 15, 2013 at 7:38 PM, Dave Jones da...@redhat.com wrote:
 
The recent trinity changes shouldn't have really made
  any notable difference here.
 
 Hmm. I'm not aware pf anything that has changed in this area since
 3.10 - neither in execve, xfs or in splice. Not even since 3.9.

It's been there for years.

 The pipe - cred_guard_mutex lock chain is pretty direct, and can be
 clearly attributed to splicing into /proc. Now, whether that is a
 *good* idea or not is clearly debatable, and I do think that maybe we
 should just not splice to/from proc files, but that doesn't seem to be
 new, and I don't think it's necessarily *broken* per se, it's just
 that splicing into /proc seems somewhat unnecessary, and various proc
 files do end up taking locks that can be interesting.

But this is a new way of triggering the inversion, however

 At the other end of the spectrum, the cred_guard_mutex - FS locks
 thing from execve() is also pretty clear, and probably not fixable or
 necessarily something we'd even want to fix.
 
 But the FS locks - pipe part is a bit questionable. Honestly, I'd
 be much happier if XFS used generic_file_splice_read/write().

 And looking more at that, I'm actually starting to think this is an
 XFS locking problem. XFS really should not call back to splice while
 holding the inode lock.
 
 But that XFS code doesn't seem new either. Is XFS a new thing for you
 to test with?

I posted patches to fix this i_mutex/i_iolock inversion a couple of
years ago (july 2011):

https://lkml.org/lkml/2011/7/18/4

And V2 was posted here and reviewed (aug 2011):

http://xfs.9218.n7.nabble.com/PATCH-0-2-splice-i-mutex-vs-splice-write-deadlock-V2-tt4072.html#none

It didn't get picked up by with a VFS tree, so sat moldering until
somebody else reported it (Nov 2012) and it reposted it again, only
to have it ignored again:

http://oss.sgi.com/archives/xfs/2012-11/msg00671.html

And I recently discussed it again with Al w.r.t. filesystem freeze
problems he was looking at, and I was waiting for that to settle
down before I posted the fixes again

Cheers,

Dave.
-- 
Dave Chinner
da...@fromorbit.com
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Ksummit-2013-discuss] KS Topic request: Handling the Stable kernel, let's dump the cc: stable tag

2013-07-16 Thread James Bottomley
On Mon, 2013-07-15 at 17:06 -0700, Greg KH wrote:
 On Mon, Jul 15, 2013 at 06:01:39PM -0400, Steven Rostedt wrote:
  On Mon, 2013-07-15 at 14:44 -0700, Greg KH wrote:
  
   I don't like this at all, just for the simple reason that it will push
   the majority of the work of stable kernel development on to the
   subsystem maintainers, who have enough work to do as it is.
   
   Stable tree stuff should cause almost _no_ extra burden on the kernel
   developers, because it is something that I, and a few other people, have
   agreed to do with our time.  It has taken me 8 _years_ to finally get
   maintainers to agree to mark stuff for the stable tree, and fine-tune a
   development process that makes it easy for us to do this backport work.
  
  Although, since those 8 years, the stable tree has proven its
  importance.
  
  Is a extra ack also too much to ask?
 
 Maintainers are our most limited resource, I'm getting their ack when
 they themselves tag the patch to be backported with the Cc: line.
 
 I then cc: them when the patch goes into the patch queue.
 
 I then cc: them again when the patch is in the -rc1 phase.
 
 How many times do I need to do this to give people a chance to say
 nak?

Just to pick up on this, the problem from my perspective is that this
cc: goes into my personal inbox.  From a list perspective this just
doesn't work.  The entirety of my workflow is set up to operate from the
mailing lists.  My inbox is for my day job.  It gets about 100 emails or
more a day and anything that goes in there and doesn't get looked at for
a day gets lost.  I sometimes feel guilty about seeing stable reviews
whiz by, but not necessarily guilty enough to go back and try to find
them.  I have thought of using filtering to manually place these into a
deferred mailbox for later use.  However, the problem is that my work
inbox is exchange, and the only tags I could filter on seem to be in the
body (exchange does body filtering about as elegantly as a penguin
flies).

That's where the suggestion to drop cc: stable@ came from.  I realise
the workflow just isn't working for me.

I say we have the discussion at KS then I'll investigate a different
workflow for SCSI.

James


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [ 00/19] 3.10.1-stable review

2013-07-16 Thread Willy Tarreau
Hi Neil,

On Tue, Jul 16, 2013 at 08:40:36AM +1000, NeilBrown wrote:
 On Mon, 15 Jul 2013 21:17:27 +0200 Willy Tarreau w...@1wt.eu wrote:
 
  Communication works two ways.
 
 I understand that to mean (at least) that for communication, every message
 must be both sent and received.  So when constructing a message, it is
 important to think about how others will understand it.

Yes, and I'd say that others here is most of the readers. I've been
using that in some large companies, sometimes people do wrong things and
defend themselves of stupid choices by putting tens of people in copy to
try to cover their ass.

This is where I please myself. I only assemble nice words that everyone
understands to build sentences that several readers will interprete with
a varying degree of aggressivity. The aggressivity is at its top for the
target, but non-existent for the most external readers. You end up with
a person justifying him/herself in public about something apparently not
existing, till the point where someone high asks what are you talking
about, care to elaborate?. You get impressive results this way, wrong
projects being aborted, budgets to fix others. Not a single bad word,
yet it is an extermely unpleasant experience for the target who feels
naked in public and hates me. Quite frankly these persons would prefer
a single hard e-mail from Linus than a week long of chess game like this.
So yes, everyone's understanding is important.

 On a public email list there are an awful lot of others, and it is very
 likely that any possible misunderstanding will be experienced by someone.
 I think it best to minimise opportunities for misunderstanding.

Yes exactly, especially for non-native readers who don't always
understand some cultural jokes. There were a number of non-important
jokes I didn't catch in this thread and that are not important. However
generally when Linus gives someone his appreciation for a given work,
there is very little room for misinterpretation, which is fine. He once
severely scolded me on the sec list for insisting on proposing a fix for
an issue I misunderstood. I had all the colorful details to understand
the issue and to realize that I was lacking some skills in the specific
area subject of the issue.

  Sure it can be hard for newcomers but I don't remember having read him
  scold a newcomer. 
 
 I think that is not relevant.  He is scolding people senior developers in
 front of newcomers.  That is not likely to encourage people to want to become
 senior developers.

I'm not that sure, because instead newcomers think this guy is a bastard, I
don't want to work with him, I'll work with maintainers instead. And that's
what is expected. They start by focusing on a given subsystem, and as years
pass, they realize that the guy with the big mouth is not that naughty,
especially when he helps them design or fix their work.

 Anecdote:  My son (in highschool) is doing a psych assignment where he is
 asking people to complete a survey which, among other things, asks about
 people fear/anxiety response to various situations (it is a fairly standard
 instrument I think[1]).  Last few times he checked, the situation with the
 highest average score was One person bullying another.  Really, it isn't
 nice to watch.

That's an interesting study which very likely matches reality, but here
it's a bit different. The group of people is not just two guys having
words together, imagine a room with hundreds or thousands of people and
two in the middle fighting. They'll just get ignored by newcomers who
will preferably sit down close to people who discuss calmly.

I have another anecdote. A few years ago, one very discrete and respectful
developer used to help me with backports of some security fixes. At some
point I asked him wouldn't you prefer to be on the sec list, it would be
easier, and he replied Linus will never accept, he once scolded me in
public, and I replied quite the opposite then, that's good for you.
And when I asked, Linus said yes of course I want him on the list, he
can certainly help us. So as you see, if some people are impressed first,
they can still be brought in front of the one they fear and realize that
they were thinking wrong.

It can seem counter-producting first (as Sarah thinks) but I think that
the competent people find their way in this simply because they're backed
up by other ones. That's how I think we get that number of skilled people
at the top of each subsystem.

And last, from some feedback I got, I would suspect that some top developers
prefer one e-mail from Linus once in a while to countless e-mails from end
users who repeatedly criticize their work when something does not work like
they expect for whatever reasons (including PEBKAC).

Best regards,
Willy

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ 

Re: splice vs execve lockdep trace.

2013-07-16 Thread Al Viro
On Tue, Jul 16, 2013 at 04:03:51PM +1000, Dave Chinner wrote:

 I posted patches to fix this i_mutex/i_iolock inversion a couple of
 years ago (july 2011):
 
 https://lkml.org/lkml/2011/7/18/4
 
 And V2 was posted here and reviewed (aug 2011):
 
 http://xfs.9218.n7.nabble.com/PATCH-0-2-splice-i-mutex-vs-splice-write-deadlock-V2-tt4072.html#none

Unless I'm misreading the patch, you end up doing file_remove_suid()
without holding i_mutex at all...
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 7/8] cpufreq: Preserve policy structure across suspend/resume

2013-07-16 Thread Viresh Kumar
On 15 July 2013 15:35, Srivatsa S. Bhat
srivatsa.b...@linux.vnet.ibm.com wrote:
 Actually even I was wondering about this while writing the patch and
 I even tested shutdown after multiple suspend/resume cycles, to verify that
 the refcount is messed up. But surprisingly, things worked just fine.

 Logically there should've been a refcount mismatch and things should have
 failed, but everything worked fine during my tests. Apart from suspend/resume
 and shutdown tests, I even tried mixing a few regular CPU hotplug operations
 (echo 0/1 to sysfs online files), but nothing stood out.

 Sorry, I forgot to document this in the patch. Either the patch is wrong
 or something else is silently fixing this up. Not sure what is the exact
 situation.

To understand it I actually applied your patches to get better view of the code.
(Haven't tested it though).. And found that your code is doing the right thing
and we shouldn't get a mismatch.. This is the sequence of events I can draw:

- __cpu_add_dev() for first cpu. sets the refcount to 'x', where x are
the no. of
cpus in its clock domain.
- _cpu_add_dev() for other cpus: doesn't change anything in refcount

- Suspend:
 - cpu_remove_dev() for all cpus, due to frozen flag we don't touch the value
of count
- Resume:
 - cpu_add_dev() for all cpus, due to frozen flag we don't touch the
value of count.

And so things work as expected. That's why your code isn't breaking anything I
believe.

But can no. of cpus change inbetween suspend/resume? Then count would be
tricky as we are using the same policy structure.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/5] perf: add two new features

2013-07-16 Thread Adrian Hunter
On 28/06/13 22:22, Adrian Hunter wrote:
 On 28/06/2013 6:27 p.m., Peter Zijlstra wrote:
 On Fri, Jun 28, 2013 at 04:22:16PM +0300, Adrian Hunter wrote:
 Hi

 Please consider these two new perf features:
x86: add ability to calculate TSC from perf sample timestamps
perf: add 'keep tracking' flag to PERF_EVENT_IOC_DISABLE

 Please explain to us why you'd like to do this..
 
 I will see what information I can dig up.  The short answer is that I need
 to disable and re-enable a perf event but still be able to map IPs to their
 DSOs and symbols - which means not losing mmap events.

Any other comments?

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Ksummit-2013-discuss] KS Topic request: Handling the Stable kernel, let's dump the cc: stable tag

2013-07-16 Thread Greg KH
On Tue, Jul 16, 2013 at 03:30:01AM +0100, Ben Hutchings wrote:
 Anything that's being reviewed on the stable list is public.  I know
 this is an old argument, but if you point out a fix you *know* has a
 security impact then you'll help general distribution maintainers and
 users a lot more than you help the black-hats who are quite capable of
 recognising such a fix (if they haven't already spotted and exploited
 the bug).

I'm sorry, but you know I will not do that, so asking about it isn't
going to change this behavior.

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Ksummit-2013-discuss] KS Topic request: Handling the Stable kernel, let's dump the cc: stable tag

2013-07-16 Thread Greg KH
On Tue, Jul 16, 2013 at 01:27:42PM +1000, Dave Airlie wrote:
 On Tue, Jul 16, 2013 at 12:41 PM, Ben Hutchings b...@decadent.org.uk wrote:
  On Mon, 2013-07-15 at 22:09 -0400, Steven Rostedt wrote:
  [...]
How important is the stable releases? Are maintainers willing to do a
little more work now to make sure their subsystems work fine in older
kernels? This isn't the same stable as it was 8 years ago.
  
   And that annoys the hell out of some Linux companies who feel that the
   stable kernels compete with them.  So people working for those companies
   might not get as much help with doing any additional work for stable
   kernel releases (this is not just idle gossip, I've heard it directly
   from management's mouths.)
 
  Hmm, this is new to me. Really, I thought the whole point of the stable
  releases was to help Linux companies.
  [...]
 
  I also heard some managers decided their kernel source packages should
  have all the patches squashed together to make them harder to cherry-
  pick... could it have been the same company?
 
 Greg loves to tell stories about RH management, but really if he can
 find any engineer who works for RH that says he can't work on stable
 due to being told by management, I'd be surprised. Maybe when stable
 first surfaced there was a hope of it being close to RHEL, but at this
 point stable has little to no usefulness from a RHEL point of view,
 and since nearly all the RH employed maintainers all do stable work, I
 can't see why Greg would think this matters.
 
 In fact Greg how much of stable queue does come from Red Hatters?

I always separate RH managers from engineers in their doings because I
know that one does not feel the same as the other.

My point is, if I start asking developers to do more work for the stable
trees, that has the potential to make people not like the stable trees
more for resource issues, and I don't want to do that at all.

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: KS Topic request: Handling the Stable kernel, let's dump the cc: stable tag

2013-07-16 Thread David Lang

On Mon, 15 Jul 2013, Greg KH wrote:


I don't like this at all, just for the simple reason that it will push
the majority of the work of stable kernel development on to the
subsystem maintainers, who have enough work to do as it is.

Stable tree stuff should cause almost _no_ extra burden on the kernel
developers, because it is something that I, and a few other people, have
agreed to do with our time.  It has taken me 8 _years_ to finally get
maintainers to agree to mark stuff for the stable tree, and fine-tune a
development process that makes it easy for us to do this backport work.


It's important to remember that the subsystem maintainers have essentially no 
input on how many stable trees there are or how long they are maintained.


That is entirely up to the people maintaining the stable trees.

Just because some crazy person ;-) decides to maintain 2.4 for many years 
doesn't mean that every subsystem maintainer needs to worry about backporting 
patches from 3.11 all the way back to 2.4. The fact that they are as willing as 
they are to review the results of the backports for problems in amazing.


David Lang
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: KS Topic request: Handling the Stable kernel, let's dump the cc: stable tag

2013-07-16 Thread Greg KH
On Tue, Jul 16, 2013 at 09:17:32AM +0400, James Bottomley wrote:
 On Mon, 2013-07-15 at 14:44 -0700, Greg KH wrote:
  On Mon, Jul 15, 2013 at 11:27:56PM +0400, James Bottomley wrote:
   Before the 3.10.1-stable review thread degenerated into a disagreement
   about habits of politeness, there were some solid points being made
   which, I think, bear consideration and which may now be lost.
   
   The problem, as Ji Kosina put is succinctly is that the distributions
   are finding stable less useful because it contains to much stuff they'd
   classify as not stable material.

And I'm going to be working on that.

But I need, from the distros, specific examples of what they object to.
So far all I've gotten is one security patch (that was needed), and one
patch for sysfs that I backported too far in the version numbers (my
fault.)

Given the huge number of stable patches over the past few years, only
having 2 patches be an issue sounds like things are working well for
people here.

If I don't get pushback, with specifics, from the distros, I will not
know what to change, so if people can provide me that, it will help out
a lot.

  I don't like this at all, just for the simple reason that it will push
  the majority of the work of stable kernel development on to the
  subsystem maintainers, who have enough work to do as it is.
 
 Well, I think of this as a feature not a bug because it enables scaling,
 but we can certainly debate the topic; it's probably one of the more
 important things that should be discussed.

How does this scale?  It makes the maintainers do more work, which does
not scale at all.

  Stable tree stuff should cause almost _no_ extra burden on the kernel
  developers, because it is something that I, and a few other people, have
  agreed to do with our time.  It has taken me 8 _years_ to finally get
  maintainers to agree to mark stuff for the stable tree, and fine-tune a
  development process that makes it easy for us to do this backport work.
  
  I _want_ the exact same commit that is in Linus's tree for the backport
  because if I have to rely on a maintainer to do the backport and resend
  it, I _know_ it will usually be a changed patch, and the git commit id
  will be lost.
 
 This is fixable with process and tools, surely.

That's crazy, and it implies that there is a problem today with the Cc:
tag.

Is there?  What is the problem that you are seeing that you wish to help
resolve?

I don't think it's the same problem that I am seeing, as adding more
tools and processes sure isn't going to fix that.

  Have I missed anything else that the distros are objecting to?  The
  smaller distros (i.e. ones without lots of kernel developers) have
  been giving me nothing but _thanks_ and appreciation with the way that
  I've been sucking in all of the different fixes.  Do we want to mess
  with a process that is really working out well for them, and only causes
  annoyance at times by the larger ones?
 
 I still think the scaling problem remains plus, if you push back more,
 it's going to increase friction: you aren't necessarily in the best
 position to know what should be a stable fix for a given subsystem, and
 if you push back incorrectly it's going to annoy the maintainer.

Making a subsystem maintainer answer why is this needed is really
going to annoy people?  Seriously?

Let's try it out, and see what happens.

I think the real stable issue that _everyone_ keeps ignoring, is my
original complaint, in that people are using the -rc1 merge window to
get fixes in they should have sent to Linus for .0.

I don't see anything you have written so far that will help resolve that
issue, which is not good, as that needs to be taken care of.

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ALSA: hda - Add new GPU codec ID to snd-hda

2013-07-16 Thread Takashi Iwai
At Fri, 12 Jul 2013 11:01:37 -0700,
Aaron Plattner wrote:
 
 Vendor ID 0x10de0060 is used by a yet-to-be-named GPU chip.
 
 Reviewed-by: Andy Ritger arit...@nvidia.com
 Signed-off-by: Aaron Plattner aplatt...@nvidia.com

Forgot to mention that the patch was applied.

Thanks.


Takashi

 ---
  sound/pci/hda/patch_hdmi.c | 2 ++
  1 file changed, 2 insertions(+)
 
 diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
 index e12f7a0..486def7 100644
 --- a/sound/pci/hda/patch_hdmi.c
 +++ b/sound/pci/hda/patch_hdmi.c
 @@ -2536,6 +2536,7 @@ static const struct hda_codec_preset 
 snd_hda_preset_hdmi[] = {
  { .id = 0x10de0043, .name = GPU 43 HDMI/DP,.patch = 
 patch_generic_hdmi },
  { .id = 0x10de0044, .name = GPU 44 HDMI/DP,.patch = 
 patch_generic_hdmi },
  { .id = 0x10de0051, .name = GPU 51 HDMI/DP,.patch = 
 patch_generic_hdmi },
 +{ .id = 0x10de0060, .name = GPU 60 HDMI/DP,.patch = 
 patch_generic_hdmi },
  { .id = 0x10de0067, .name = MCP67 HDMI,.patch = patch_nvhdmi_2ch },
  { .id = 0x10de8001, .name = MCP73 HDMI,.patch = patch_nvhdmi_2ch },
  { .id = 0x11069f80, .name = VX900 HDMI/DP, .patch = patch_via_hdmi },
 @@ -2588,6 +2589,7 @@ MODULE_ALIAS(snd-hda-codec-id:10de0042);
  MODULE_ALIAS(snd-hda-codec-id:10de0043);
  MODULE_ALIAS(snd-hda-codec-id:10de0044);
  MODULE_ALIAS(snd-hda-codec-id:10de0051);
 +MODULE_ALIAS(snd-hda-codec-id:10de0060);
  MODULE_ALIAS(snd-hda-codec-id:10de0067);
  MODULE_ALIAS(snd-hda-codec-id:10de8001);
  MODULE_ALIAS(snd-hda-codec-id:11069f80);
 -- 
 1.7.12
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 01/11] driver/core: cpu: initialize of_node in cpu's device struture

2013-07-16 Thread Viresh Kumar
On 15 July 2013 15:52,  sudeep.karkadanage...@arm.com wrote:
 From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

 CPUs are also registered as devices but the of_node in these cpu
 devices are not initialized. Currently different drivers requiring
 to access cpu device node are parsing the nodes themselves and
 initialising the of_node in cpu device.

 The of_node in all the cpu devices properly needs to be initialized

s/properly /

 properly and at one place. The best place to update this is CPU
 subsystem driver when registering the cpu devices.

 This patch introduces a new function arch_of_get_cpu_node and uses it
 to assign of_node. The definition of this function can be overridden
 by architecture specific implementation.

 Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
 ---
  drivers/base/cpu.c | 19 +++
  1 file changed, 19 insertions(+)

 diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
 index a16d20e..4b3047a 100644
 --- a/drivers/base/cpu.c
 +++ b/drivers/base/cpu.c
 @@ -28,6 +28,24 @@ static int cpu_subsys_match(struct device *dev, struct 
 device_driver *drv)
 return 0;
  }

 +/**
 + * arch_of_get_cpu_node - Get device node associated with the given logical 
 CPU
 + * @cpu: CPU number(logical index) for which device node is required
 + *
 + * The only purpose of this function is to retrieve the device node for the
 + * given logical CPU index. It should be used to intialise the of_node in
 + * cpu device. Once of_node in cpu device is populated, all the further
 + * references can use that instead.
 + *
 + * CPU logical to physical index mapping is architecure specific and is built
 + * before booting secondary cores. Hence this function is marked __weak and
 + * can be overridden by architecture specific implementation.
 + */
 +struct device_node * __weak arch_of_get_cpu_node(int cpu)
 +{
 +   return NULL;
 +}
 +
  #ifdef CONFIG_HOTPLUG_CPU
  static void change_cpu_under_node(struct cpu *cpu,
 unsigned int from_nid, unsigned int to_nid)
 @@ -289,6 +307,7 @@ int __cpuinit register_cpu(struct cpu *cpu, int num)
 cpu-dev.release = cpu_device_release;
 cpu-dev.offline_disabled = !cpu-hotpluggable;
 cpu-dev.offline = !cpu_online(num);
 +   cpu-dev.of_node = arch_of_get_cpu_node(num);
  #ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE
 cpu-dev.bus-uevent = arch_cpu_uevent;
  #endif
 --
 1.8.1.2


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Ksummit-2013-discuss] KS Topic request: Handling the Stable kernel, let's dump the cc: stable tag

2013-07-16 Thread Greg KH
On Tue, Jul 16, 2013 at 10:10:31AM +0400, James Bottomley wrote:
 On Mon, 2013-07-15 at 17:06 -0700, Greg KH wrote:
  On Mon, Jul 15, 2013 at 06:01:39PM -0400, Steven Rostedt wrote:
   On Mon, 2013-07-15 at 14:44 -0700, Greg KH wrote:
   
I don't like this at all, just for the simple reason that it will push
the majority of the work of stable kernel development on to the
subsystem maintainers, who have enough work to do as it is.

Stable tree stuff should cause almost _no_ extra burden on the kernel
developers, because it is something that I, and a few other people, have
agreed to do with our time.  It has taken me 8 _years_ to finally get
maintainers to agree to mark stuff for the stable tree, and fine-tune a
development process that makes it easy for us to do this backport work.
   
   Although, since those 8 years, the stable tree has proven its
   importance.
   
   Is a extra ack also too much to ask?
  
  Maintainers are our most limited resource, I'm getting their ack when
  they themselves tag the patch to be backported with the Cc: line.
  
  I then cc: them when the patch goes into the patch queue.
  
  I then cc: them again when the patch is in the -rc1 phase.
  
  How many times do I need to do this to give people a chance to say
  nak?
 
 Just to pick up on this, the problem from my perspective is that this
 cc: goes into my personal inbox.  From a list perspective this just
 doesn't work.  The entirety of my workflow is set up to operate from the
 mailing lists.  My inbox is for my day job.  It gets about 100 emails or
 more a day and anything that goes in there and doesn't get looked at for
 a day gets lost.  I sometimes feel guilty about seeing stable reviews
 whiz by, but not necessarily guilty enough to go back and try to find
 them.  I have thought of using filtering to manually place these into a
 deferred mailbox for later use.  However, the problem is that my work
 inbox is exchange, and the only tags I could filter on seem to be in the
 body (exchange does body filtering about as elegantly as a penguin
 flies).
 
 That's where the suggestion to drop cc: stable@ came from.  I realise
 the workflow just isn't working for me.
 
 I say we have the discussion at KS then I'll investigate a different
 workflow for SCSI.

KS is in November, feel free to not tag patches Cc: stable for scsi if
you don't want to use the existing workflow, and try something else now.

All I need, at the least, is a list of git ids to apply to the stable
tree(s), send them to sta...@vger.kernel.org and I can take it from
there with my tools.

If you want to test things separately, send me a tree to pull, or a mbox
to apply, that works as well.  You can do all of these without having to
wait until November.

thanks,

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 02/11] ARM: DT/kernel: define ARM specific arch_of_get_cpu_node

2013-07-16 Thread Viresh Kumar
On 16 July 2013 00:40, Rob Herring robherri...@gmail.com wrote:
 The powermac cpufreq driver could probably also be converted
 (arch/powerpc/platforms/powermac/cpufreq_64.c).

Its called: drivers/cpufreq/pmac64-cpufreq.c now.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] drm/i915: fix long-standing SNB regression in power consumption after resume

2013-07-16 Thread Daniel Vetter
On Sun, Jul 14, 2013 at 09:56:45PM +0400, Konstantin Khlebnikov wrote:
 Daniel Vetter wrote:
 On Sun, Jul 14, 2013 at 6:30 PM, Konstantin Khlebnikov
 khlebni...@openvz.org  wrote:
 This patch fixes regression in power consumtion of sandy bridge gpu, which
 exists since v3.6 Sometimes after resuming from s2ram gpu starts thinking 
 that
 it's extremely busy. After that it never reaches rc6 state.
 
 Bug was introduce by commit b4ae3f22d238617ca11610b29fde16cf8c0bc6e0
 (drm/i915: load boot context at driver init time). Without documentation
 it's not clear what is happening here, probably this breaks internal state 
 of
 hardware ring buffers and confuses RPS engine. Fortunately keeping forcewake
 during whole initialization sequence in gen6_init_clock_gating() fixes this 
 bug.
 
 References: https://bugs.freedesktop.org/show_bug.cgi?id=54089
 Signed-off-by: Konstantin Khlebnikovkhlebni...@openvz.org
 
 We already hold an forcewake reference while setting up the rps stuff,
 should we maybe hold the forcewake for the entire duration, i.e. grab
 it here in clock_gating and release it only in gen6/vlv_enable_rps?
 Can you please test that version, too?
 
 This will be racy because rps stuff is done in separate work which might be 
 canceled
 if intel_disable_gt_powersave() happens before its completion.

Can be fixed with a flush_delayed_work. And since that has the same
requirements wrt locking to prevent deadlocks as cancel_work_sync it would
be a drop-in replacement. Can I volunteer you to look into testing that
out a bit? Otherwise I could volunteer someone from our team.

In any case I think we should apply this trick to all platforms where
we've added the MBCTL write (i.e. snb, ivb, hsw  vlv) since rps/rc6 works
_very_ similar on all of those.

Thanks, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V6 07/12] perf tools: remove references to struct ip_event

2013-07-16 Thread Adrian Hunter
struct ip_event assumes fixeed positions for ip, pid
and tid.  That is no longer true with the addition of
PERF_SAMPLE_IDENTIFIER.  The information is anyway in
struct sample, so use that instead.

Signed-off-by: Adrian Hunter adrian.hun...@intel.com
---
 tools/perf/builtin-inject.c   |  4 ++--
 tools/perf/builtin-kmem.c |  4 ++--
 tools/perf/builtin-mem.c  |  2 +-
 tools/perf/builtin-script.c   |  4 ++--
 tools/perf/builtin-top.c  | 11 ++-
 tools/perf/tests/hists_link.c |  4 
 tools/perf/util/build-id.c|  8 
 tools/perf/util/event.c   |  6 +++---
 tools/perf/util/evsel.c   |  4 ++--
 tools/perf/util/session.c |  8 +---
 10 files changed, 31 insertions(+), 24 deletions(-)

diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 0d4ae1d..ffacd46 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -198,7 +198,7 @@ static int perf_event__inject_buildid(struct perf_tool 
*tool,
 
cpumode = event-header.misc  PERF_RECORD_MISC_CPUMODE_MASK;
 
-   thread = machine__findnew_thread(machine, event-ip.pid, event-ip.pid);
+   thread = machine__findnew_thread(machine, sample-pid, sample-pid);
if (thread == NULL) {
pr_err(problem processing %d event, skipping it.\n,
   event-header.type);
@@ -206,7 +206,7 @@ static int perf_event__inject_buildid(struct perf_tool 
*tool,
}
 
thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION,
- event-ip.ip, al);
+ sample-ip, al);
 
if (al.map != NULL) {
if (!al.map-dso-hit) {
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index c324778..c2dff9c 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -305,8 +305,8 @@ static int process_sample_event(struct perf_tool *tool 
__maybe_unused,
struct perf_evsel *evsel,
struct machine *machine)
 {
-   struct thread *thread = machine__findnew_thread(machine, event-ip.pid,
-   event-ip.pid);
+   struct thread *thread = machine__findnew_thread(machine, sample-pid,
+   sample-pid);
 
if (thread == NULL) {
pr_debug(problem processing %d event, skipping it.\n,
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index a8ff6d2..4274680 100644
--- a/tools/perf/builtin-mem.c
+++ b/tools/perf/builtin-mem.c
@@ -96,7 +96,7 @@ dump_raw_samples(struct perf_tool *tool,
symbol_conf.field_sep,
sample-tid,
symbol_conf.field_sep,
-   event-ip.ip,
+   sample-ip,
symbol_conf.field_sep,
sample-addr,
symbol_conf.field_sep,
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index b094b33..05e1db2 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -480,8 +480,8 @@ static int process_sample_event(struct perf_tool *tool 
__maybe_unused,
struct machine *machine)
 {
struct addr_location al;
-   struct thread *thread = machine__findnew_thread(machine, event-ip.pid,
-   event-ip.tid);
+   struct thread *thread = machine__findnew_thread(machine, sample-pid,
+   sample-tid);
 
if (thread == NULL) {
pr_debug(problem processing %d event, skipping it.\n,
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index bbf4635..0ecec5f 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -690,7 +690,7 @@ static void perf_event__process_sample(struct perf_tool 
*tool,
 {
struct perf_top *top = container_of(tool, struct perf_top, tool);
struct symbol *parent = NULL;
-   u64 ip = event-ip.ip;
+   u64 ip = sample-ip;
struct addr_location al;
int err;
 
@@ -700,10 +700,10 @@ static void perf_event__process_sample(struct perf_tool 
*tool,
if (!seen)
seen = intlist__new(NULL);
 
-   if (!intlist__has_entry(seen, event-ip.pid)) {
+   if (!intlist__has_entry(seen, sample-pid)) {
pr_err(Can't find guest [%d]'s kernel information\n,
-   event-ip.pid);
-   intlist__add(seen, event-ip.pid);
+   sample-pid);
+   intlist__add(seen, sample-pid);
}
return;
}
@@ -838,7 +838,8 @@ static void perf_top__mmap_read_idx(struct perf_top *top, 
int idx)
break;
case PERF_RECORD_MISC_GUEST_KERNEL:

[PATCH V6 06/12] perf tools: remove unnecessary callchain validation

2013-07-16 Thread Adrian Hunter
Now that the sample parsing correctly checks data sizes
there is no reason for it to be done again for callchains.

Signed-off-by: Adrian Hunter adrian.hun...@intel.com
---
 tools/perf/util/callchain.c |  8 
 tools/perf/util/callchain.h |  5 -
 tools/perf/util/session.c   | 20 
 3 files changed, 33 deletions(-)

diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 42b6a63..024162a 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -20,14 +20,6 @@
 
 __thread struct callchain_cursor callchain_cursor;
 
-bool ip_callchain__valid(struct ip_callchain *chain,
-const union perf_event *event)
-{
-   unsigned int chain_size = event-header.size;
-   chain_size -= (unsigned long)event-ip.__more_data - (unsigned 
long)event;
-   return chain-nr * sizeof(u64) = chain_size;
-}
-
 #define chain_for_each_child(child, parent)\
list_for_each_entry(child, parent-children, siblings)
 
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index 3ee9f67..988c1aa 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -103,11 +103,6 @@ int callchain_append(struct callchain_root *root,
 int callchain_merge(struct callchain_cursor *cursor,
struct callchain_root *dst, struct callchain_root *src);
 
-struct ip_callchain;
-union perf_event;
-
-bool ip_callchain__valid(struct ip_callchain *chain,
-const union perf_event *event);
 /*
  * Initialize a cursor before adding entries inside, but keep
  * the previously allocated entries as a cache.
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 708c72b..1b07d7a 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -889,22 +889,6 @@ static int perf_session_deliver_event(struct perf_session 
*session,
}
 }
 
-static int perf_session__preprocess_sample(struct perf_session *session,
-  union perf_event *event, struct 
perf_sample *sample)
-{
-   if (event-header.type != PERF_RECORD_SAMPLE ||
-   !sample-callchain)
-   return 0;
-
-   if (!ip_callchain__valid(sample-callchain, event)) {
-   pr_debug(call-chain problem with event, skipping it.\n);
-   ++session-stats.nr_invalid_chains;
-   session-stats.total_invalid_chains += sample-period;
-   return -EINVAL;
-   }
-   return 0;
-}
-
 static int perf_session__process_user_event(struct perf_session *session, 
union perf_event *event,
struct perf_tool *tool, u64 
file_offset)
 {
@@ -967,10 +951,6 @@ static int perf_session__process_event(struct perf_session 
*session,
if (ret)
return ret;
 
-   /* Preprocess sample records - precheck callchains */
-   if (perf_session__preprocess_sample(session, event, sample))
-   return 0;
-
if (tool-ordered_samples) {
ret = perf_session_queue_event(session, event, sample,
   file_offset);
-- 
1.7.11.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V6 04/12] perf tools: change machine__findnew_thread() to set thread pid

2013-07-16 Thread Adrian Hunter
Add a new parameter for 'pid' to machine__findnew_thread().
Change callers to pass 'pid' when it is known.

Signed-off-by: Adrian Hunter adrian.hun...@intel.com
---
 tools/perf/builtin-inject.c   |  2 +-
 tools/perf/builtin-kmem.c |  3 ++-
 tools/perf/builtin-kvm.c  |  3 ++-
 tools/perf/builtin-lock.c |  3 ++-
 tools/perf/builtin-sched.c| 17 +
 tools/perf/builtin-script.c   |  3 ++-
 tools/perf/builtin-trace.c| 12 +---
 tools/perf/tests/hists_link.c |  3 ++-
 tools/perf/util/build-id.c|  7 +--
 tools/perf/util/event.c   |  3 ++-
 tools/perf/util/machine.c | 23 ---
 tools/perf/util/machine.h |  3 ++-
 tools/perf/util/session.c |  2 +-
 13 files changed, 55 insertions(+), 29 deletions(-)

diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 1d8de2e..0d4ae1d 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -198,7 +198,7 @@ static int perf_event__inject_buildid(struct perf_tool 
*tool,
 
cpumode = event-header.misc  PERF_RECORD_MISC_CPUMODE_MASK;
 
-   thread = machine__findnew_thread(machine, event-ip.pid);
+   thread = machine__findnew_thread(machine, event-ip.pid, event-ip.pid);
if (thread == NULL) {
pr_err(problem processing %d event, skipping it.\n,
   event-header.type);
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index b49f5c5..c324778 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -305,7 +305,8 @@ static int process_sample_event(struct perf_tool *tool 
__maybe_unused,
struct perf_evsel *evsel,
struct machine *machine)
 {
-   struct thread *thread = machine__findnew_thread(machine, event-ip.pid);
+   struct thread *thread = machine__findnew_thread(machine, event-ip.pid,
+   event-ip.pid);
 
if (thread == NULL) {
pr_debug(problem processing %d event, skipping it.\n,
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 24b78ae..ecbbec8 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -691,7 +691,8 @@ static int process_sample_event(struct perf_tool *tool,
struct perf_evsel *evsel,
struct machine *machine)
 {
-   struct thread *thread = machine__findnew_thread(machine, sample-tid);
+   struct thread *thread = machine__findnew_thread(machine, sample-pid,
+   sample-tid);
struct perf_kvm_stat *kvm = container_of(tool, struct perf_kvm_stat,
 tool);
 
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index 76543a4..ee33ba2 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -805,7 +805,8 @@ static int process_sample_event(struct perf_tool *tool 
__maybe_unused,
struct perf_evsel *evsel,
struct machine *machine)
 {
-   struct thread *thread = machine__findnew_thread(machine, sample-tid);
+   struct thread *thread = machine__findnew_thread(machine, sample-pid,
+   sample-tid);
 
if (thread == NULL) {
pr_debug(problem processing %d event, skipping it.\n,
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 948183a..49593a0 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -934,8 +934,8 @@ static int latency_switch_event(struct perf_sched *sched,
return -1;
}
 
-   sched_out = machine__findnew_thread(machine, prev_pid);
-   sched_in = machine__findnew_thread(machine, next_pid);
+   sched_out = machine__findnew_thread(machine, 0, prev_pid);
+   sched_in = machine__findnew_thread(machine, 0, next_pid);
 
out_events = thread_atoms_search(sched-atom_root, sched_out, 
sched-cmp_pid);
if (!out_events) {
@@ -978,7 +978,7 @@ static int latency_runtime_event(struct perf_sched *sched,
 {
const u32 pid  = perf_evsel__intval(evsel, sample, pid);
const u64 runtime  = perf_evsel__intval(evsel, sample, runtime);
-   struct thread *thread = machine__findnew_thread(machine, pid);
+   struct thread *thread = machine__findnew_thread(machine, 0, pid);
struct work_atoms *atoms = thread_atoms_search(sched-atom_root, 
thread, sched-cmp_pid);
u64 timestamp = sample-time;
int cpu = sample-cpu;
@@ -1016,7 +1016,7 @@ static int latency_wakeup_event(struct perf_sched *sched,
if (!success)
return 0;
 
-   wakee = machine__findnew_thread(machine, pid);
+   wakee = machine__findnew_thread(machine, 0, pid);
atoms = thread_atoms_search(sched-atom_root, wakee, 

[PATCH V6 12/12] perf tools: add a sample parsing test

2013-07-16 Thread Adrian Hunter
Add a test that checks that sample parsing is correctly
implemented.

Signed-off-by: Adrian Hunter adrian.hun...@intel.com
---
 tools/perf/Makefile   |   1 +
 tools/perf/tests/builtin-test.c   |   4 +
 tools/perf/tests/sample-parsing.c | 240 ++
 tools/perf/tests/tests.h  |   1 +
 4 files changed, 246 insertions(+)
 create mode 100644 tools/perf/tests/sample-parsing.c

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 5b7c6db..fe20130 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -389,6 +389,7 @@ LIB_OBJS += $(OUTPUT)tests/bp_signal.o
 LIB_OBJS += $(OUTPUT)tests/bp_signal_overflow.o
 LIB_OBJS += $(OUTPUT)tests/task-exit.o
 LIB_OBJS += $(OUTPUT)tests/sw-clock.o
+LIB_OBJS += $(OUTPUT)tests/sample-parsing.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
 BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 35b45f1466..5ee3933 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -94,6 +94,10 @@ static struct test {
.func = test__sw_clock_freq,
},
{
+   .desc = Test sample parsing,
+   .func = test__sample_parsing,
+   },
+   {
.func = NULL,
},
 };
diff --git a/tools/perf/tests/sample-parsing.c 
b/tools/perf/tests/sample-parsing.c
new file mode 100644
index 000..c6e6813
--- /dev/null
+++ b/tools/perf/tests/sample-parsing.c
@@ -0,0 +1,240 @@
+#include stdbool.h
+#include inttypes.h
+
+#include event.h
+#include evsel.h
+
+#include tests.h
+
+#define COMP(m) {  \
+   while (s1-m != s2-m) {\
+   pr_debug(Samples differ at '#m'\n); \
+   return false;   \
+   }   \
+}
+
+#define MCOMP(m) { \
+   while (memcmp(s1-m, s2-m, sizeof(s1-m))) { \
+   pr_debug(Samples differ at '#m'\n); \
+   return false;   \
+   }   \
+}
+
+static bool samples_same(const struct perf_sample *s1,
+const struct perf_sample *s2, u64 type, u64 regs_user)
+{
+   size_t i;
+
+   if (type  PERF_SAMPLE_IDENTIFIER)
+   COMP(id);
+
+   if (type  PERF_SAMPLE_IP)
+   COMP(ip);
+
+   if (type  PERF_SAMPLE_TID) {
+   COMP(pid);
+   COMP(tid);
+   }
+
+   if (type  PERF_SAMPLE_TIME)
+   COMP(time);
+
+   if (type  PERF_SAMPLE_ADDR)
+   COMP(addr);
+
+   if (type  PERF_SAMPLE_ID)
+   COMP(id);
+
+   if (type  PERF_SAMPLE_STREAM_ID)
+   COMP(stream_id);
+
+   if (type  PERF_SAMPLE_CPU)
+   COMP(cpu);
+
+   if (type  PERF_SAMPLE_PERIOD)
+   COMP(period);
+
+   if (type  PERF_SAMPLE_CALLCHAIN) {
+   COMP(callchain-nr);
+   for (i = 0; i  s1-callchain-nr; i++)
+   COMP(callchain-ips[i]);
+   }
+
+   if (type  PERF_SAMPLE_RAW) {
+   COMP(raw_size);
+   if (memcmp(s1-raw_data, s2-raw_data, s1-raw_size)) {
+   pr_debug(Samples differ at 'raw_data'\n);
+   return false;
+   }
+   }
+
+   if (type  PERF_SAMPLE_BRANCH_STACK) {
+   COMP(branch_stack-nr);
+   for (i = 0; i  s1-branch_stack-nr; i++)
+   MCOMP(branch_stack-entries[i]);
+   }
+
+   if (type  PERF_SAMPLE_REGS_USER) {
+   size_t sz = hweight_long(regs_user) * sizeof(u64);
+
+   if ((sz  (!s1-user_regs.regs || !s2-user_regs.regs)) ||
+   memcmp(s1-user_regs.regs, s2-user_regs.regs, sz)) {
+   pr_debug(Samples differ at 'user_regs'\n);
+   return false;
+   }
+   }
+
+   if (type  PERF_SAMPLE_STACK_USER) {
+   COMP(user_stack.size);
+   if (memcmp(s1-user_stack.data, s1-user_stack.data,
+  s1-user_stack.size)) {
+   pr_debug(Samples differ at 'user_stack'\n);
+   return false;
+   }
+   }
+
+   if (type  PERF_SAMPLE_WEIGHT)
+   COMP(weight);
+
+   if (type  PERF_SAMPLE_DATA_SRC)
+   COMP(data_src);
+
+   return true;
+}
+
+static int do_test(u64 sample_type, u64 sample_regs_user)
+{
+   struct perf_evsel evsel = {
+   .needs_swap = false,
+   .attr = {
+   .sample_type = sample_type,
+   .sample_regs_user = sample_regs_user,
+   },
+   };
+   union perf_event event = {
+   .header = {
+   .type = 

[PATCH V6 05/12] perf tools: tidy up sample parsing overflow checking

2013-07-16 Thread Adrian Hunter
The size of data retrieved from a sample event must be
validated to ensure it does not go past the end of the
event.  That was being done sporadically and without
considering integer overflows.

Signed-off-by: Adrian Hunter adrian.hun...@intel.com
---
 tools/perf/util/evsel.c | 102 ++--
 1 file changed, 64 insertions(+), 38 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 724b75a..20e2ed9 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1114,24 +1114,38 @@ static int perf_evsel__parse_id_sample(const struct 
perf_evsel *evsel,
return 0;
 }
 
-static bool sample_overlap(const union perf_event *event,
-  const void *offset, u64 size)
+static inline bool overflow_one(const void *endp, const void *offset)
 {
-   const void *base = event;
-
-   if (offset + size  base + event-header.size)
-   return true;
+   return offset + sizeof(u64)  endp;
+}
 
-   return false;
+static inline bool overflow(const void *endp, u16 max_size, const void *offset,
+   u64 size)
+{
+   return size  max_size || offset + size  endp;
 }
 
+#define OVERFLOW_CHECK_ONE(offset) \
+   do {\
+   if (overflow_one(endp, (offset)))   \
+   return -EFAULT; \
+   } while (0)
+
+#define OVERFLOW_CHECK(offset, size)   \
+   do {\
+   if (overflow(endp, max_size, (offset), (size))) \
+   return -EFAULT; \
+   } while (0)
+
 int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
 struct perf_sample *data)
 {
u64 type = evsel-attr.sample_type;
-   u64 regs_user = evsel-attr.sample_regs_user;
bool swapped = evsel-needs_swap;
const u64 *array;
+   u16 max_size = event-header.size;
+   const void *endp = (void *)event + max_size;
+   u64 sz;
 
/*
 * used for cross-endian analysis. See git commit 65014ab3
@@ -1153,6 +1167,11 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, 
union perf_event *event,
 
array = event-sample.array;
 
+   /*
+* sample_size is based on PERF_SAMPLE_MASK which includes up to
+* PERF_SAMPLE_PERIOD.  After that overflow_one() or overflow() must be
+* used to check the format does not go past the end of the event.
+*/
if (evsel-sample_size + sizeof(event-header)  event-header.size)
return -EFAULT;
 
@@ -1221,20 +1240,19 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, 
union perf_event *event,
}
 
if (type  PERF_SAMPLE_CALLCHAIN) {
-   if (sample_overlap(event, array, sizeof(data-callchain-nr)))
-   return -EFAULT;
-
-   data-callchain = (struct ip_callchain *)array;
+   const u64 max_callchain_nr = UINT64_MAX / sizeof(u64);
 
-   if (sample_overlap(event, array, data-callchain-nr))
+   OVERFLOW_CHECK_ONE(array);
+   data-callchain = (struct ip_callchain *)array++;
+   if (data-callchain-nr  max_callchain_nr)
return -EFAULT;
-
-   array += 1 + data-callchain-nr;
+   sz = data-callchain-nr * sizeof(u64);
+   OVERFLOW_CHECK(array, sz);
+   array = (void *)array + sz;
}
 
if (type  PERF_SAMPLE_RAW) {
-   const u64 *pdata;
-
+   OVERFLOW_CHECK_ONE(array);
u.val64 = *array;
if (WARN_ONCE(swapped,
  Endianness of raw data not corrected!\n)) {
@@ -1243,65 +1261,73 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, 
union perf_event *event,
u.val32[0] = bswap_32(u.val32[0]);
u.val32[1] = bswap_32(u.val32[1]);
}
-
-   if (sample_overlap(event, array, sizeof(u32)))
-   return -EFAULT;
-
data-raw_size = u.val32[0];
-   pdata = (void *) array + sizeof(u32);
+   array = (void *)array + sizeof(u32);
 
-   if (sample_overlap(event, pdata, data-raw_size))
-   return -EFAULT;
-
-   data-raw_data = (void *) pdata;
-
-   array = (void *)array + data-raw_size + sizeof(u32);
+   OVERFLOW_CHECK(array, data-raw_size);
+   data-raw_data = (void *)array;
+   array = (void *)array + data-raw_size;
}
 
if (type  PERF_SAMPLE_BRANCH_STACK) {
-   u64 sz;
+   const u64 max_branch_nr = UINT64_MAX /
+ 

Re: [RFC PATCH 00/11] ARM: DT: update cpu device of_node

2013-07-16 Thread Viresh Kumar
On 15 July 2013 15:52,  sudeep.karkadanage...@arm.com wrote:
 Sudeep KarkadaNagesha (11):
   cpufreq: imx6q-cpufreq: remove device tree parsing for cpu nodes
   cpufreq: cpufreq-cpu0: remove device tree parsing for cpu nodes
   cpufreq: highbank-cpufreq: remove device tree parsing for cpu nodes
   cpufreq: spear-cpufreq: remove device tree parsing for cpu nodes
   cpufreq: kirkwood-cpufreq: remove device tree parsing for cpu nodes
   cpufreq: arm_big_little: remove device tree parsing for cpu nodes

For cpufreq part:

Acked-by: Viresh Kumar viresh.ku...@linaro.org
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V6 01/12] perf tools: add debug prints

2013-07-16 Thread Adrian Hunter
It is useful to see the arguments to perf_event_open
and whether the perf events ring buffer was mmapped
per-cpu or per-thread.  That information will now be
displayed when verbose is 2 i.e option -vv

Signed-off-by: Adrian Hunter adrian.hun...@intel.com
Acked-by: Jiri Olsa jo...@redhat.com
---
 tools/perf/util/evlist.c |  3 +++
 tools/perf/util/evsel.c  | 58 
 2 files changed, 61 insertions(+)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 42ea4e9..2b77b33 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -14,6 +14,7 @@
 #include target.h
 #include evlist.h
 #include evsel.h
+#include debug.h
 #include unistd.h
 
 #include parse-events.h
@@ -454,6 +455,7 @@ static int perf_evlist__mmap_per_cpu(struct perf_evlist 
*evlist, int prot, int m
int nr_cpus = cpu_map__nr(evlist-cpus);
int nr_threads = thread_map__nr(evlist-threads);
 
+   pr_debug2(perf event ring buffer mmapped per cpu\n);
for (cpu = 0; cpu  nr_cpus; cpu++) {
int output = -1;
 
@@ -492,6 +494,7 @@ static int perf_evlist__mmap_per_thread(struct perf_evlist 
*evlist, int prot, in
int thread;
int nr_threads = thread_map__nr(evlist-threads);
 
+   pr_debug2(perf event ring buffer mmapped per thread\n);
for (thread = 0; thread  nr_threads; thread++) {
int output = -1;
 
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index a635461..0b9c4fd 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -21,6 +21,7 @@
 #include thread_map.h
 #include target.h
 #include perf_regs.h
+#include debug.h
 
 static struct {
bool sample_id_all;
@@ -817,6 +818,58 @@ static int get_group_fd(struct perf_evsel *evsel, int cpu, 
int thread)
return fd;
 }
 
+static size_t perf_event_attr__fprintf(struct perf_event_attr *attr, FILE *fp)
+{
+   size_t ret;
+
+   ret = fprintf(fp, 
\n);
+   ret += fprintf(fp, perf_event_attr:\n);
+   ret += fprintf(fp,   type%u\n, attr-type);
+   ret += fprintf(fp,   size%u\n, attr-size);
+   ret += fprintf(fp,   config  %#PRIx64\n, 
(uint64_t)attr-config);
+   ret += fprintf(fp,   sample_period   %PRIu64\n, 
(uint64_t)attr-sample_period);
+   ret += fprintf(fp,   sample_freq %PRIu64\n, 
(uint64_t)attr-sample_freq);
+   ret += fprintf(fp,   sample_type %#PRIx64\n, 
(uint64_t)attr-sample_type);
+   ret += fprintf(fp,   read_format %#PRIx64\n, 
(uint64_t)attr-read_format);
+
+   ret += fprintf(fp,   disabled%u, attr-disabled);
+   ret += fprintf(fp, inherit %u\n, attr-inherit);
+   ret += fprintf(fp,   pinned  %u, attr-pinned);
+   ret += fprintf(fp, exclusive   %u\n, attr-exclusive);
+   ret += fprintf(fp,   exclude_user%u, attr-exclude_user);
+   ret += fprintf(fp, exclude_kernel  %u\n, attr-exclude_kernel);
+   ret += fprintf(fp,   exclude_hv  %u, attr-exclude_hv);
+   ret += fprintf(fp, exclude_idle%u\n, attr-exclude_idle);
+   ret += fprintf(fp,   mmap%u, attr-mmap);
+   ret += fprintf(fp, comm%u\n, attr-comm);
+   ret += fprintf(fp,   freq%u, attr-freq);
+   ret += fprintf(fp, inherit_stat%u\n, attr-inherit_stat);
+   ret += fprintf(fp,   enable_on_exec  %u, 
attr-enable_on_exec);
+   ret += fprintf(fp, task%u\n, attr-task);
+   ret += fprintf(fp,   watermark   %u, attr-watermark);
+   ret += fprintf(fp, precise_ip  %u\n, attr-precise_ip);
+   ret += fprintf(fp,   mmap_data   %u, attr-mmap_data);
+   ret += fprintf(fp, sample_id_all   %u\n, attr-sample_id_all);
+   ret += fprintf(fp,   exclude_host%u, attr-exclude_host);
+   ret += fprintf(fp, exclude_guest   %u\n, attr-exclude_guest);
+   ret += fprintf(fp,   excl.callchain.kern %u, 
attr-exclude_callchain_kernel);
+   ret += fprintf(fp, excl.callchain.user %u\n, 
attr-exclude_callchain_user);
+
+   ret += fprintf(fp,   wakeup_events   %u\n, attr-wakeup_events);
+   ret += fprintf(fp,   wakeup_watermark%u\n, 
attr-wakeup_watermark);
+   ret += fprintf(fp,   bp_type %#x\n, attr-bp_type);
+   ret += fprintf(fp,   bp_addr %#PRIx64\n, 
(uint64_t)attr-bp_addr);
+   ret += fprintf(fp,   config1 %#PRIx64\n, 
(uint64_t)attr-config1);
+   ret += fprintf(fp,   bp_len  %PRIu64\n, 
(uint64_t)attr-bp_len);
+   ret += fprintf(fp,   config2 %#PRIx64\n, 
(uint64_t)attr-config2);
+   ret += fprintf(fp,   branch_sample_type  %#PRIx64\n, 
(uint64_t)attr-branch_sample_type);
+   ret += fprintf(fp,  

[PATCH V6 02/12] perf tools: allow non-matching sample types

2013-07-16 Thread Adrian Hunter
Sample types need not be identical to determine
the sample id from the event.  Only the position
of the sample id needs to be the same.

Compatible sample types are ones in which the bits
defined by PERF_COMPAT_MASK are the same.
'perf_evlist__config()' forces sample types to be
compatible on that basis.

Signed-off-by: Adrian Hunter adrian.hun...@intel.com
---
 tools/perf/builtin-report.c |   2 +-
 tools/perf/util/event.h |  14 +
 tools/perf/util/evlist.c| 136 ++--
 tools/perf/util/evlist.h|   8 ++-
 tools/perf/util/evsel.c |  64 -
 tools/perf/util/evsel.h |  10 
 tools/perf/util/session.c   |   8 ++-
 7 files changed, 231 insertions(+), 11 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index a34c587..7b6a2bb 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -367,7 +367,7 @@ static int process_read_event(struct perf_tool *tool,
 static int perf_report__setup_sample_type(struct perf_report *rep)
 {
struct perf_session *self = rep-session;
-   u64 sample_type = perf_evlist__sample_type(self-evlist);
+   u64 sample_type = perf_evlist__combined_sample_type(self-evlist);
 
if (!self-fd_pipe  !(sample_type  PERF_SAMPLE_CALLCHAIN)) {
if (sort__has_parent) {
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index 1ebb8fb..e60585e 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -65,6 +65,20 @@ struct read_event {
PERF_SAMPLE_ID | PERF_SAMPLE_STREAM_ID |\
 PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD)
 
+/*
+ * Events have compatible sample types if the following bits all have the same
+ * value.  This is because the order of sample members is fixed.  For sample
+ * events the order is: PERF_SAMPLE_IP, PERF_SAMPLE_TID, PERF_SAMPLE_TIME,
+ * PERF_SAMPLE_ADDR, PERF_SAMPLE_ID.  For non-sample events the sample members
+ * are accessed in reverse order.  The order is: PERF_SAMPLE_ID,
+ * PERF_SAMPLE_STREAM_ID, PERF_SAMPLE_CPU.
+ */
+#define PERF_COMPAT_MASK   \
+   (PERF_SAMPLE_IP   | PERF_SAMPLE_TID   | \
+PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR  | \
+PERF_SAMPLE_ID   | PERF_SAMPLE_STREAM_ID | \
+PERF_SAMPLE_CPU)
+
 struct sample_event {
struct perf_event_headerheader;
u64 array[];
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 2b77b33..b8a5a75 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -49,6 +49,46 @@ struct perf_evlist *perf_evlist__new(void)
return evlist;
 }
 
+/**
+ * perf_evlist__set_id_pos - set the positions of event ids.
+ * @evlist: selected event list
+ *
+ * Events with compatible sample types all have the same id_pos
+ * and is_pos.  For convenience, put a copy on evlist.
+ */
+static void perf_evlist__set_id_pos(struct perf_evlist *evlist)
+{
+   struct perf_evsel *first = perf_evlist__first(evlist);
+
+   evlist-id_pos = first-id_pos;
+   evlist-is_pos = first-is_pos;
+}
+
+/**
+ * perf_evlist__make_sample_types_compatible - make sample types compatible.
+ * @evlist: selected event list
+ *
+ * Events with compatible sample types all have the same id_pos and is_pos.
+ * This can be achieved by matching the bits of PERF_COMPAT_MASK.
+ */
+void perf_evlist__make_sample_types_compatible(struct perf_evlist *evlist)
+{
+   struct perf_evsel *evsel;
+   u64 compat = 0;
+
+   list_for_each_entry(evsel, evlist-entries, node)
+   compat |= evsel-attr.sample_type  PERF_COMPAT_MASK;
+
+   list_for_each_entry(evsel, evlist-entries, node) {
+   evsel-attr.sample_type |= compat;
+   evsel-sample_size =
+   __perf_evsel__sample_size(evsel-attr.sample_type);
+   perf_evsel__calc_id_pos(evsel);
+   }
+
+   perf_evlist__set_id_pos(evlist);
+}
+
 void perf_evlist__config(struct perf_evlist *evlist,
struct perf_record_opts *opts)
 {
@@ -69,6 +109,8 @@ void perf_evlist__config(struct perf_evlist *evlist,
if (evlist-nr_entries  1)
perf_evsel__set_sample_id(evsel);
}
+
+   perf_evlist__make_sample_types_compatible(evlist);
 }
 
 static void perf_evlist__purge(struct perf_evlist *evlist)
@@ -102,6 +144,7 @@ void perf_evlist__add(struct perf_evlist *evlist, struct 
perf_evsel *entry)
 {
list_add_tail(entry-node, evlist-entries);
++evlist-nr_entries;
+   perf_evlist__set_id_pos(evlist);
 }
 
 void perf_evlist__splice_list_tail(struct perf_evlist *evlist,
@@ -110,6 +153,7 @@ void perf_evlist__splice_list_tail(struct perf_evlist 
*evlist,
 {
list_splice_tail(list, evlist-entries);
evlist-nr_entries += nr_entries;
+   perf_evlist__set_id_pos(evlist);
 }
 
 void __perf_evlist__set_leader(struct list_head *list)
@@ -339,6 

[PATCH V6 11/12] perf tools: expand perf_event__synthesize_sample()

2013-07-16 Thread Adrian Hunter
Expand perf_event__synthesize_sample() to handle all
sample format bits.

Signed-off-by: Adrian Hunter adrian.hun...@intel.com
---
 tools/perf/builtin-inject.c |  3 +-
 tools/perf/util/event.h |  1 +
 tools/perf/util/evsel.c | 70 -
 3 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index ffacd46..eb33da6 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -301,7 +301,8 @@ found:
sample_sw.period = sample-period;
sample_sw.time   = sample-time;
perf_event__synthesize_sample(event_sw, evsel-attr.sample_type,
- sample_sw, false);
+ evsel-attr.sample_regs_user, sample_sw,
+ false);
build_id__mark_dso_hit(tool, event_sw, sample_sw, evsel, machine);
return perf_event__repipe(tool, event_sw, sample_sw, machine);
 }
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index 82bad0d..7f5c36b 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -228,6 +228,7 @@ int perf_event__preprocess_sample(const union perf_event 
*self,
 const char *perf_event__name(unsigned int id);
 
 int perf_event__synthesize_sample(union perf_event *event, u64 type,
+ u64 sample_regs_user,
  const struct perf_sample *sample,
  bool swapped);
 
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 41cfb21..5efa3ce 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1357,11 +1357,12 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, 
union perf_event *event,
 }
 
 int perf_event__synthesize_sample(union perf_event *event, u64 type,
+ u64 sample_regs_user,
  const struct perf_sample *sample,
  bool swapped)
 {
u64 *array;
-
+   size_t sz;
/*
 * used for cross-endian analysis. See git commit 65014ab3
 * for why this goofiness is needed.
@@ -1434,6 +1435,73 @@ int perf_event__synthesize_sample(union perf_event 
*event, u64 type,
array++;
}
 
+   if (type  PERF_SAMPLE_READ) {
+   fprintf(stderr, PERF_SAMPLE_READ is unsupported for now\n);
+   return -1;
+   }
+
+   if (type  PERF_SAMPLE_CALLCHAIN) {
+   sz = (sample-callchain-nr + 1) * sizeof(u64);
+   memcpy(array, sample-callchain, sz);
+   array = (void *)array + sz;
+   }
+
+   if (type  PERF_SAMPLE_RAW) {
+   u.val32[0] = sample-raw_size;
+   if (WARN_ONCE(swapped,
+ Endianness of raw data not corrected!\n)) {
+   /*
+* Inverse of what is done in perf_evsel__parse_sample
+*/
+   u.val32[0] = bswap_32(u.val32[0]);
+   u.val32[1] = bswap_32(u.val32[1]);
+   u.val64 = bswap_64(u.val64);
+   }
+   *array = u.val64;
+   array = (void *)array + sizeof(u32);
+
+   memcpy(array, sample-raw_data, sample-raw_size);
+   array = (void *)array + sample-raw_size;
+   }
+
+   if (type  PERF_SAMPLE_BRANCH_STACK) {
+   sz = sample-branch_stack-nr * sizeof(struct branch_entry);
+   sz += sizeof(u64);
+   memcpy(array, sample-branch_stack, sz);
+   array = (void *)array + sz;
+   }
+
+   if (type  PERF_SAMPLE_REGS_USER) {
+   if (sample-user_regs.regs  sample_regs_user) {
+   *array++ = sample_regs_user;
+   sz = hweight_long(sample_regs_user) * sizeof(u64);
+   memcpy(array, sample-user_regs.regs, sz);
+   array = (void *)array + sz;
+   } else {
+   *array++ = 0;
+   }
+   }
+
+   if (type  PERF_SAMPLE_STACK_USER) {
+   sz = sample-user_stack.size;
+   *array++ = sz;
+   if (sz) {
+   memcpy(array, sample-user_stack.data, sz);
+   array = (void *)array + sz;
+   *array++ = sz;
+   }
+   }
+
+   if (type  PERF_SAMPLE_WEIGHT) {
+   *array = sample-weight;
+   array++;
+   }
+
+   if (type  PERF_SAMPLE_DATA_SRC) {
+   *array = sample-data_src;
+   array++;
+   }
+
return 0;
 }
 
-- 
1.7.11.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at 

Re: v3.11-rc1 USB regressions

2013-07-16 Thread Daniel Mack
Hi Aaro,

On 16.07.2013 00:56, Aaro Koskinen wrote:
 Hi,
 
 I think USB tree introduced regressions in v3.11-rc1, at least for some
 OMAP devices using legacy boot.

Thanks for checking the tree so early.

 I have only bisected these; I have no
 idea what the real fixes are but the following reverts make Nokia OMAP2+
 boards again usable for kernel development work (they need working USB
 connection for interacting with the device):
 
 1) USB peripheral mode (g_ether) is broken on Nokia N900, N950 and N9
(USB_MUSB_OMAP2PLUS). To make it it work, I need to revert three
commits:
 
   09fc7d22b024692b2fe8a943b246de1af307132b
   usb: musb: fix incorrect usage of resource pointer
   (Reverting this fixes the g_ether probe failure couldn't find
an available UDC)

Can't say much about this one, but I'd like you to only keep this one
reverted and sort out the regressions in the musb core first.

   fe4cb0912f8e737f8e4b8b38b9e692f8062f5423
   usb: musb: gadget: remove hcd initialization
   (Reverting this fixes error cdc_ether: probe of 4-1:1.0 failed
with error -110 seen on the host side.)

Which role does your musb-based hardware have in this case, and which
MUSB_* config symbols do you set? You should have USB_MUSB_GADGET.

   8b125df5b24cfb0ec7fa1971e343cc0badc1827d
   usb: musb: eliminate musb_to_hcd
   (Reverting this fixes compilation error cause by the previous
revert.)

 2) USB peripheral mode (g_ether) is broken also on Nokia N800 and N810
(USB_MUSB_TUSB6010). In addition to the above, I need to also revert
the following:
 
   b7e2e75a8c6062afe1dd88b0b299938e5d36dff8
   usb: gadget: drop unused USB_GADGET_MUSB_HDRC
 
(This commit is clearly incorrect - code checking for this still
remain in the tree (see e.g. N8x0 board file), so it's not unused.)

Good catch, I didn't expect board files to depend on config symbols that
have no effect on the driver itself.

Please check the attached patch and let me know if it helps.


Thanks,
Daniel


From 5f33d42f2dffb82d22b83a030f14fe2331a935b7 Mon Sep 17 00:00:00 2001
From: Daniel Mack zon...@gmail.com
Date: Tue, 16 Jul 2013 08:19:49 +0200
Subject: [PATCH] ARM: omap2: fix musb usage for n8x0

Commit b7e2e75a8c (usb: gadget: drop unused USB_GADGET_MUSB_HDRC)
dropped a config symbol that was unused by the musb core, but it turns
out that board support code still had references to it.

As the core now handles both dual role and host-only modes, we can just
pass MUSB_OTG as mode from board files.

Signed-off-by: Daniel Mack zon...@gmail.com
---
 arch/arm/mach-omap2/board-n8x0.c | 4 
 arch/arm/mach-omap2/usb-musb.c   | 5 +
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index f6eeb87..827d150 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -122,11 +122,7 @@ static struct musb_hdrc_config musb_config = {
 };
 
 static struct musb_hdrc_platform_data tusb_data = {
-#ifdef CONFIG_USB_GADGET_MUSB_HDRC
 	.mode		= MUSB_OTG,
-#else
-	.mode		= MUSB_HOST,
-#endif
 	.set_power	= tusb_set_power,
 	.min_power	= 25,	/* x2 = 50 mA drawn from VBUS as peripheral */
 	.power		= 100,	/* Max 100 mA VBUS for host mode */
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index 8c4de27..bc89723 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -38,11 +38,8 @@ static struct musb_hdrc_config musb_config = {
 };
 
 static struct musb_hdrc_platform_data musb_plat = {
-#ifdef CONFIG_USB_GADGET_MUSB_HDRC
 	.mode		= MUSB_OTG,
-#else
-	.mode		= MUSB_HOST,
-#endif
+
 	/* .clock is set dynamically */
 	.config		= musb_config,
 
-- 
1.8.1.4



[PATCH V6 00/12] perf tools: some fixes and tweaks

2013-07-16 Thread Adrian Hunter
Hi

Here are some fixes and tweaks to perf tools (version 6).

Changes in V6:
Some checkpatch fixes

perf: make events stream always parsable
Add sample format comments

Changes in V5:
Re-based to Arnaldo's tree and dropped already applied patches:
perf tools: remove unused parameter
perf tools: fix missing tool parameter
perf tools: fix missing 'finished_round'
perf tools: fix parse_events_terms() segfault on error path
perf tools: fix new_term() missing free on error path
perf tools: add const specifier to perf_pmu__find name parameter
perf tools: tidy duplicated munmap code
perf tools: validate perf event header size

perf tools: add debug prints
Changed to perf_event_attr__fprintf()
perf tools: add pid to struct thread
Always set the pid, even if a pid is already set
perf tools: change machine__findnew_thread() to set thread pid
Replaces: perf tools: change machine functions to set thread 
pid
perf tools: add support for PERF_SAMPLE_IDENTFIER
Only use PERF_SAMPLE_IDENTFIER if sample types are different
perf tools: expand perf_event__synthesize_sample()
New patch in preparation of a sample parsing test
perf tools: add a sample parsing test
New patch

Changes in V4:
I added kernel support for matching sample types via
PERF_SAMPLE_IDENTIFIER.  perf tools support for that required
first fixing some other things.

perf tools: fix parse_events_terms() freeing local variable on error 
path
Dropped - covered by David Ahern
perf tools: struct thread has a tid not a pid
Added ack by David Ahern
perf tools: add pid to struct thread
Remove unused function
perf tools: fix missing increment in sample parsing
New patch
perf tools: tidy up sample parsing overflow checking
New patch
perf tools: remove unnecessary callchain validation
New patch
perf tools: remove references to struct ip_event
New patch
perf tools: move struct ip_event
New patch
perf: make events stream always parsable
New patch
perf tools: add support for PERF_SAMPLE_IDENTFIER
New patch

Changes in V3:
perf tools: add pid to struct thread
Split into 2 patches
perf tools: fix ppid in thread__fork()
Dropped for now

Changes in V2:
perf tools: fix missing tool parameter
Fixed one extra occurrence
perf tools: fix parse_events_terms() freeing local variable on error 
path
Made freeing code into a new function
perf tools: validate perf event header size
Corrected byte-swapping
perf tools: allow non-matching sample types
Added comments
Fixed id_pos calculation
id_pos/is_pos updated whenever sample_type changes
Removed perf_evlist__sample_type()
Added __perf_evlist__combined_sample_type()
Added perf_evlist__combined_sample_type()
Added perf_evlist__make_sample_types_compatible()
Added ack's to patches acked by Jiri Olsa


Adrian Hunter (12):
  perf tools: add debug prints
  perf tools: allow non-matching sample types
  perf tools: add pid to struct thread
  perf tools: change machine__findnew_thread() to set thread pid
  perf tools: tidy up sample parsing overflow checking
  perf tools: remove unnecessary callchain validation
  perf tools: remove references to struct ip_event
  perf tools: move struct ip_event
  perf: make events stream always parsable
  perf tools: add support for PERF_SAMPLE_IDENTFIER
  perf tools: expand perf_event__synthesize_sample()
  perf tools: add a sample parsing test

 include/uapi/linux/perf_event.h   |  33 +++-
 kernel/events/core.c  |  11 +-
 tools/perf/Makefile   |   1 +
 tools/perf/builtin-inject.c   |   7 +-
 tools/perf/builtin-kmem.c |   3 +-
 tools/perf/builtin-kvm.c  |   3 +-
 tools/perf/builtin-lock.c |   3 +-
 tools/perf/builtin-mem.c  |   2 +-
 tools/perf/builtin-report.c   |   2 +-
 tools/perf/builtin-sched.c|  17 +-
 tools/perf/builtin-script.c   |   3 +-
 tools/perf/builtin-top.c  |  11 +-
 tools/perf/builtin-trace.c|  12 +-
 tools/perf/tests/builtin-test.c   |   4 +
 tools/perf/tests/hists_link.c |  30 +++-
 tools/perf/tests/mmap-basic.c |   2 +-
 tools/perf/tests/sample-parsing.c | 240 +++
 tools/perf/tests/tests.h  |   1 +
 

[PATCH V6 08/12] perf tools: move struct ip_event

2013-07-16 Thread Adrian Hunter
struct ip_event assumes fixed positions for ip, pid
and tid.  That is no longer true with the addition of
PERF_SAMPLE_IDENTIFIER.

struct ip_event is no longer used except by hists_link.c.
Move it there.

Signed-off-by: Adrian Hunter adrian.hun...@intel.com
---
 tools/perf/tests/hists_link.c | 23 +++
 tools/perf/util/event.h   | 11 ---
 2 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
index 7e0ca15..cfdbfd9 100644
--- a/tools/perf/tests/hists_link.c
+++ b/tools/perf/tests/hists_link.c
@@ -195,6 +195,19 @@ static struct sample fake_samples[][5] = {
},
 };
 
+/* PERF_SAMPLE_IP | PERF_SAMPLE_TID | * but not PERF_SAMPLE_IDENTIFIER */
+struct ip_event {
+   struct perf_event_header header;
+   u64 ip;
+   u32 pid, tid;
+   unsigned char __more_data[];
+};
+
+union perf_ip_event {
+   struct ip_event ip;
+   union perf_event event;
+};
+
 static int add_hist_entries(struct perf_evlist *evlist, struct machine 
*machine)
 {
struct perf_evsel *evsel;
@@ -210,7 +223,7 @@ static int add_hist_entries(struct perf_evlist *evlist, 
struct machine *machine)
 */
list_for_each_entry(evsel, evlist-entries, node) {
for (k = 0; k  ARRAY_SIZE(fake_common_samples); k++) {
-   const union perf_event event = {
+   const union perf_ip_event ip_event = {
.ip = {
.header = {
.misc = PERF_RECORD_MISC_USER,
@@ -219,10 +232,11 @@ static int add_hist_entries(struct perf_evlist *evlist, 
struct machine *machine)
.ip  = fake_common_samples[k].ip,
},
};
+   const union perf_event *event = ip_event.event;
 
sample.pid = ip_event.ip.pid;
sample.ip = ip_event.ip.ip;
-   if (perf_event__preprocess_sample(event, machine, al,
+   if (perf_event__preprocess_sample(event, machine, al,
  sample, 0)  0)
goto out;
 
@@ -236,7 +250,7 @@ static int add_hist_entries(struct perf_evlist *evlist, 
struct machine *machine)
}
 
for (k = 0; k  ARRAY_SIZE(fake_samples[i]); k++) {
-   const union perf_event event = {
+   const union perf_ip_event ip_event = {
.ip = {
.header = {
.misc = PERF_RECORD_MISC_USER,
@@ -245,10 +259,11 @@ static int add_hist_entries(struct perf_evlist *evlist, 
struct machine *machine)
.ip  = fake_samples[i][k].ip,
},
};
+   const union perf_event *event = ip_event.event;
 
sample.pid = ip_event.ip.pid;
sample.ip = ip_event.ip.ip;
-   if (perf_event__preprocess_sample(event, machine, al,
+   if (perf_event__preprocess_sample(event, machine, al,
  sample, 0)  0)
goto out;
 
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index e60585e..94f4503 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -8,16 +8,6 @@
 #include map.h
 #include build-id.h
 
-/*
- * PERF_SAMPLE_IP | PERF_SAMPLE_TID | *
- */
-struct ip_event {
-   struct perf_event_header header;
-   u64 ip;
-   u32 pid, tid;
-   unsigned char __more_data[];
-};
-
 struct mmap_event {
struct perf_event_header header;
u32 pid, tid;
@@ -162,7 +152,6 @@ struct tracing_data_event {
 
 union perf_event {
struct perf_event_headerheader;
-   struct ip_event ip;
struct mmap_event   mmap;
struct comm_event   comm;
struct fork_event   fork;
-- 
1.7.11.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V6 10/12] perf tools: add support for PERF_SAMPLE_IDENTFIER

2013-07-16 Thread Adrian Hunter
Enable parsing of samples with sample format bit
PERF_SAMPLE_IDENTFIER.  In addition, if the kernel supports
it, prefer it to selecting PERF_SAMPLE_ID thereby avoiding
the need to force compatible sample types.

Signed-off-by: Adrian Hunter adrian.hun...@intel.com
---
 tools/perf/tests/mmap-basic.c |  2 +-
 tools/perf/util/event.h   |  9 +++--
 tools/perf/util/evlist.c  | 94 +--
 tools/perf/util/evlist.h  |  1 +
 tools/perf/util/evsel.c   | 41 +++
 tools/perf/util/evsel.h   |  3 +-
 6 files changed, 134 insertions(+), 16 deletions(-)

diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c
index 5b1b5ab..c4185b9 100644
--- a/tools/perf/tests/mmap-basic.c
+++ b/tools/perf/tests/mmap-basic.c
@@ -72,7 +72,7 @@ int test__basic_mmap(void)
}
 
evsels[i]-attr.wakeup_events = 1;
-   perf_evsel__set_sample_id(evsels[i]);
+   perf_evsel__set_sample_id(evsels[i], false);
 
perf_evlist__add(evlist, evsels[i]);
 
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index 94f4503..82bad0d 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -53,7 +53,8 @@ struct read_event {
(PERF_SAMPLE_IP | PERF_SAMPLE_TID | \
 PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR |  \
PERF_SAMPLE_ID | PERF_SAMPLE_STREAM_ID |\
-PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD)
+PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD | \
+PERF_SAMPLE_IDENTIFIER)
 
 /*
  * Events have compatible sample types if the following bits all have the same
@@ -61,13 +62,15 @@ struct read_event {
  * events the order is: PERF_SAMPLE_IP, PERF_SAMPLE_TID, PERF_SAMPLE_TIME,
  * PERF_SAMPLE_ADDR, PERF_SAMPLE_ID.  For non-sample events the sample members
  * are accessed in reverse order.  The order is: PERF_SAMPLE_ID,
- * PERF_SAMPLE_STREAM_ID, PERF_SAMPLE_CPU.
+ * PERF_SAMPLE_STREAM_ID, PERF_SAMPLE_CPU.  PERF_SAMPLE_IDENTIFIER is added for
+ * completeness but it should not be used with PERF_SAMPLE_ID.  Sample types
+ * that include PERF_SAMPLE_IDENTIFIER are always compatible.
  */
 #define PERF_COMPAT_MASK   \
(PERF_SAMPLE_IP   | PERF_SAMPLE_TID   | \
 PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR  | \
 PERF_SAMPLE_ID   | PERF_SAMPLE_STREAM_ID | \
-PERF_SAMPLE_CPU)
+PERF_SAMPLE_CPU  | PERF_SAMPLE_IDENTIFIER)
 
 struct sample_event {
struct perf_event_headerheader;
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index b8a5a75..3c53ef0 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -89,10 +89,81 @@ void perf_evlist__make_sample_types_compatible(struct 
perf_evlist *evlist)
perf_evlist__set_id_pos(evlist);
 }
 
+typedef void (*setup_probe_fn_t)(struct perf_evsel *evsel);
+
+static int perf_do_probe_api(setup_probe_fn_t fn, int cpu, const char *str)
+{
+   struct perf_evlist *evlist;
+   struct perf_evsel *evsel;
+   int err = -EAGAIN, fd;
+
+   evlist = perf_evlist__new();
+   if (!evlist)
+   return -ENOMEM;
+
+   if (parse_events(evlist, str))
+   goto out_delete;
+
+   evsel = perf_evlist__first(evlist);
+
+   fd = sys_perf_event_open(evsel-attr, -1, cpu, -1, 0);
+   if (fd  0)
+   goto out_delete;
+   close(fd);
+
+   fn(evsel);
+
+   fd = sys_perf_event_open(evsel-attr, -1, cpu, -1, 0);
+   if (fd  0) {
+   if (errno == EINVAL)
+   err = -EINVAL;
+   goto out_delete;
+   }
+   close(fd);
+   err = 0;
+
+out_delete:
+   perf_evlist__delete(evlist);
+   return err;
+}
+
+static bool perf_probe_api(setup_probe_fn_t fn)
+{
+   const char *try[] = {cycles:u, instructions:u, cpu-clock, NULL};
+   struct cpu_map *cpus;
+   int cpu, ret, i = 0;
+
+   cpus = cpu_map__new(NULL);
+   if (!cpus)
+   return false;
+   cpu = cpus-map[0];
+   cpu_map__delete(cpus);
+
+   do {
+   ret = perf_do_probe_api(fn, cpu, try[i++]);
+   if (!ret)
+   return true;
+   } while (ret == -EAGAIN  try[i]);
+
+   return false;
+}
+
+static void perf_probe_sample_identifier(struct perf_evsel *evsel)
+{
+   evsel-attr.sample_type |= PERF_SAMPLE_IDENTIFIER;
+}
+
+bool perf_can_sample_identifier(void)
+{
+   return perf_probe_api(perf_probe_sample_identifier);
+}
+
 void perf_evlist__config(struct perf_evlist *evlist,
struct perf_record_opts *opts)
 {
struct perf_evsel *evsel;
+   bool use_sample_identifier = false;
+
/*
 * Set the evsel leader links before we configure attributes,
 * since some might depend on this info.
@@ -103,14 +174,26 @@ void perf_evlist__config(struct perf_evlist *evlist,

[PATCH V6 03/12] perf tools: add pid to struct thread

2013-07-16 Thread Adrian Hunter
Record pid on struct thread.  The member is named 'pid_'
to avoid confusion with the 'tid' member which was previously
named 'pid'.

Signed-off-by: Adrian Hunter adrian.hun...@intel.com
---
 tools/perf/util/machine.c | 16 +++-
 tools/perf/util/thread.c  |  3 ++-
 tools/perf/util/thread.h  |  3 ++-
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index f9f9d63..67ba572 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -233,7 +233,8 @@ void machines__set_id_hdr_size(struct machines *machines, 
u16 id_hdr_size)
return;
 }
 
-static struct thread *__machine__findnew_thread(struct machine *machine, pid_t 
tid,
+static struct thread *__machine__findnew_thread(struct machine *machine,
+   pid_t pid, pid_t tid,
bool create)
 {
struct rb_node **p = machine-threads.rb_node;
@@ -245,8 +246,11 @@ static struct thread *__machine__findnew_thread(struct 
machine *machine, pid_t t
 * so most of the time we dont have to look up
 * the full rbtree:
 */
-   if (machine-last_match  machine-last_match-tid == tid)
+   if (machine-last_match  machine-last_match-tid == tid) {
+   if (pid  pid != machine-last_match-pid_)
+   machine-last_match-pid_ = pid;
return machine-last_match;
+   }
 
while (*p != NULL) {
parent = *p;
@@ -254,6 +258,8 @@ static struct thread *__machine__findnew_thread(struct 
machine *machine, pid_t t
 
if (th-tid == tid) {
machine-last_match = th;
+   if (pid  pid != th-pid_)
+   th-pid_ = pid;
return th;
}
 
@@ -266,7 +272,7 @@ static struct thread *__machine__findnew_thread(struct 
machine *machine, pid_t t
if (!create)
return NULL;
 
-   th = thread__new(tid);
+   th = thread__new(pid, tid);
if (th != NULL) {
rb_link_node(th-rb_node, parent, p);
rb_insert_color(th-rb_node, machine-threads);
@@ -278,12 +284,12 @@ static struct thread *__machine__findnew_thread(struct 
machine *machine, pid_t t
 
 struct thread *machine__findnew_thread(struct machine *machine, pid_t tid)
 {
-   return __machine__findnew_thread(machine, tid, true);
+   return __machine__findnew_thread(machine, 0, tid, true);
 }
 
 struct thread *machine__find_thread(struct machine *machine, pid_t tid)
 {
-   return __machine__findnew_thread(machine, tid, false);
+   return __machine__findnew_thread(machine, 0, tid, false);
 }
 
 int machine__process_comm_event(struct machine *machine, union perf_event 
*event)
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index 6feeb88..e3d4a55 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -7,12 +7,13 @@
 #include util.h
 #include debug.h
 
-struct thread *thread__new(pid_t tid)
+struct thread *thread__new(pid_t pid, pid_t tid)
 {
struct thread *self = zalloc(sizeof(*self));
 
if (self != NULL) {
map_groups__init(self-mg);
+   self-pid_ = pid;
self-tid = tid;
self-ppid = -1;
self-comm = malloc(32);
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
index 0fe1f9c..fc464bc 100644
--- a/tools/perf/util/thread.h
+++ b/tools/perf/util/thread.h
@@ -12,6 +12,7 @@ struct thread {
struct list_head node;
};
struct map_groups   mg;
+   pid_t   pid_; /* Not all tools update this */
pid_t   tid;
pid_t   ppid;
charshortname[3];
@@ -24,7 +25,7 @@ struct thread {
 
 struct machine;
 
-struct thread *thread__new(pid_t tid);
+struct thread *thread__new(pid_t pid, pid_t tid);
 void thread__delete(struct thread *self);
 
 int thread__set_comm(struct thread *self, const char *comm);
-- 
1.7.11.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] drm/i915: fix long-standing SNB regression in power consumption after resume

2013-07-16 Thread Daniel Vetter
On Sun, Jul 14, 2013 at 08:30:09PM +0400, Konstantin Khlebnikov wrote:
 This patch fixes regression in power consumtion of sandy bridge gpu, which
 exists since v3.6 Sometimes after resuming from s2ram gpu starts thinking that
 it's extremely busy. After that it never reaches rc6 state.
 
 Bug was introduce by commit b4ae3f22d238617ca11610b29fde16cf8c0bc6e0
 (drm/i915: load boot context at driver init time). Without documentation
 it's not clear what is happening here, probably this breaks internal state of
 hardware ring buffers and confuses RPS engine. Fortunately keeping forcewake
 during whole initialization sequence in gen6_init_clock_gating() fixes this 
 bug.
 
 References: https://bugs.freedesktop.org/show_bug.cgi?id=54089
 Signed-off-by: Konstantin Khlebnikov khlebni...@openvz.org

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=58971
Tested-by: Alexander Kaltsas alexkalt...@gmail.com
Tested-by: rocko rockoreq...@hotmail.com

 ---
  drivers/gpu/drm/i915/intel_pm.c |4 
  1 file changed, 4 insertions(+)
 
 diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
 index aa01128..839a43f 100644
 --- a/drivers/gpu/drm/i915/intel_pm.c
 +++ b/drivers/gpu/drm/i915/intel_pm.c
 @@ -3640,6 +3640,8 @@ static void gen6_init_clock_gating(struct drm_device 
 *dev)
   int pipe;
   uint32_t dspclk_gate = ILK_VRHUNIT_CLOCK_GATE_DISABLE;
  
 + gen6_gt_force_wake_get(dev_priv);
 +
   I915_WRITE(ILK_DSPCLK_GATE_D, dspclk_gate);
  
   I915_WRITE(ILK_DISPLAY_CHICKEN2,
 @@ -3728,6 +3730,8 @@ static void gen6_init_clock_gating(struct drm_device 
 *dev)
   cpt_init_clock_gating(dev);
  
   gen6_check_mch_setup(dev);
 +
 + gen6_gt_force_wake_put(dev_priv);
  }
  
  static void gen7_setup_fixed_func_scheduler(struct drm_i915_private 
 *dev_priv)
 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V6 09/12] perf: make events stream always parsable

2013-07-16 Thread Adrian Hunter
The event stream is not always parsable because the format of a sample
is dependent on the sample_type of the selected event.  When there
is more than one selected event and the sample_types are not the
same then parsing becomes problematic.  A sample can be matched to its
selected event using the ID that is allocated when the event is opened.
Unfortunately, to get the ID from the sample means first parsing it.

This patch adds a new sample format bit PERF_SAMPLE_IDENTIFER that puts
the ID at a fixed position so that the ID can be retrieved without
parsing the sample.  For sample events, that is the first position
immediately after the header.  For non-sample events, that is the last
position.

Signed-off-by: Adrian Hunter adrian.hun...@intel.com
---
 include/uapi/linux/perf_event.h | 33 ++---
 kernel/events/core.c| 11 ++-
 2 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index 0b1df41..627bbcf 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -134,8 +134,9 @@ enum perf_event_sample_format {
PERF_SAMPLE_STACK_USER  = 1U  13,
PERF_SAMPLE_WEIGHT  = 1U  14,
PERF_SAMPLE_DATA_SRC= 1U  15,
+   PERF_SAMPLE_IDENTIFIER  = 1U  16,
 
-   PERF_SAMPLE_MAX = 1U  16, /* non-ABI */
+   PERF_SAMPLE_MAX = 1U  17, /* non-ABI */
 };
 
 /*
@@ -471,12 +472,23 @@ enum perf_event_type {
/*
 * If perf_event_attr.sample_id_all is set then all event types will
 * have the sample_type selected fields related to where/when
-* (identity) an event took place (TID, TIME, ID, CPU, STREAM_ID)
-* described in PERF_RECORD_SAMPLE below, it will be stashed just after
-* the perf_event_header and the fields already present for the existing
-* fields, i.e. at the end of the payload. That way a newer perf.data
-* file will be supported by older perf tools, with these new optional
-* fields being ignored.
+* (identity) an event took place (TID, TIME, ID, STREAM_ID, CPU,
+* IDENTIFIER) described in PERF_RECORD_SAMPLE below, it will be stashed
+* just after the perf_event_header and the fields already present for
+* the existing fields, i.e. at the end of the payload. That way a newer
+* perf.data file will be supported by older perf tools, with these new
+* optional fields being ignored.  The format is:
+*
+*  { u32   pid, tid; }  PERF_SAMPLE_TID
+*  { u64   time; }  PERF_SAMPLE_TIME
+*  { u64   id;   }  PERF_SAMPLE_ID
+*  { u64   stream_id;}  PERF_SAMPLE_STREAM_ID
+*  { u32   cpu, res; }  PERF_SAMPLE_CPU
+*  { u64   id;   }  PERF_SAMPLE_IDENTIFIER
+*
+* Note that PERF_SAMPLE_IDENTIFIER duplicates PERF_SAMPLE_ID.  The
+* advantage of PERF_SAMPLE_IDENTIFIER is that its position is fixed
+* relative to header.size.
 *
 * The MMAP events record the PROT_EXEC mappings so that we can
 * correlate userspace IPs to code. They have the following structure:
@@ -557,6 +569,13 @@ enum perf_event_type {
 * struct {
 *  struct perf_event_headerheader;
 *
+*  #
+*  # Note that PERF_SAMPLE_IDENTIFIER duplicates PERF_SAMPLE_ID.
+*  # The advantage of PERF_SAMPLE_IDENTIFIER is that its position
+*  # is fixed relative to header.
+*  #
+*
+*  { u64   id;   }  PERF_SAMPLE_IDENTIFIER
 *  { u64   ip;   }  PERF_SAMPLE_IP
 *  { u32   pid, tid; }  PERF_SAMPLE_TID
 *  { u64   time; }  PERF_SAMPLE_TIME
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 708ab70..866516b 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -1216,6 +1216,9 @@ static void perf_event__id_header_size(struct perf_event 
*event)
if (sample_type  PERF_SAMPLE_TIME)
size += sizeof(data-time);
 
+   if (sample_type  PERF_SAMPLE_IDENTIFIER)
+   size += sizeof(data-id);
+
if (sample_type  PERF_SAMPLE_ID)
size += sizeof(data-id);
 
@@ -4251,7 +4254,7 @@ static void __perf_event_header__init_id(struct 
perf_event_header *header,
if (sample_type  PERF_SAMPLE_TIME)
data-time = perf_clock();
 
-   if (sample_type  PERF_SAMPLE_ID)
+   if (sample_type  (PERF_SAMPLE_ID | PERF_SAMPLE_IDENTIFIER))
data-id = primary_event_id(event);
 
if (sample_type  PERF_SAMPLE_STREAM_ID)
@@ -4290,6 +4293,9 @@ static 

Re: splice vs execve lockdep trace.

2013-07-16 Thread Dave Chinner
On Tue, Jul 16, 2013 at 07:16:02AM +0100, Al Viro wrote:
 On Tue, Jul 16, 2013 at 04:03:51PM +1000, Dave Chinner wrote:
 
  I posted patches to fix this i_mutex/i_iolock inversion a couple of
  years ago (july 2011):
  
  https://lkml.org/lkml/2011/7/18/4
  
  And V2 was posted here and reviewed (aug 2011):
  
  http://xfs.9218.n7.nabble.com/PATCH-0-2-splice-i-mutex-vs-splice-write-deadlock-V2-tt4072.html#none
 
 Unless I'm misreading the patch, you end up doing file_remove_suid()
 without holding i_mutex at all...

We've been calling file_remove_suid() since at least 2010 without
i_mutex held through the direct IO write path

Cheers,

Dave.
-- 
Dave Chinner
da...@fromorbit.com
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V5 09/12] perf: make events stream always parsable

2013-07-16 Thread Adrian Hunter
On 15/07/13 09:14, Adrian Hunter wrote:
 On 12/07/13 17:55, Peter Zijlstra wrote:
 On Fri, Jul 12, 2013 at 03:56:01PM +0300, Adrian Hunter wrote:
 There's events where this isn't a possible location; take PERF_RECORD_MMAP 
 for
 instance; the tail is the complete filename.

 PERF_RECORD_MMAP falls in the category I have called non-sample events.
 Those events are appended with an ID sample.  perf tools parses the ID
 sample backwards from header.size.  So the ID is at the last position
 relative to header.size

 But why? Why make it different per PERF_RECORD type? 
 
 There have always been two formats:
 
   1. PERF_RECORD_SAMPLE as defined by perf_output_sample()
 
   2. everything else as defined by __perf_event__output_id_sample()
 
 The two formats are not the same, and there is no reason for them to be.
 
 PERF_RECORD_SAMPLE is parsed forwards, so the ID is at the first position.
 
 ID samples are parsed backwards, so the ID is at the last position (i.e. the
 first position parsed).

If you want the ID at the first position in the ID sample, it is do-able.
It means perf tools will have to be changed to calculate the variable start
position of the ID sample, and then parse the ID sample forwards from there.
Please advise.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [alsa-devel] [BUG] 3.10.[01] modprobe snd-... hangs

2013-07-16 Thread Takashi Iwai
At Tue, 16 Jul 2013 15:11:51 +0930,
Rusty Russell wrote:
 
 Philipp Matthias Hahn pmh...@pmhahn.de writes:
  Hello,
 
  My x86_64 systems has some trouble loading some ALSA snd-* modules since
  the upgrade to 3.10.[01]: Several automatic modprobe calls hang, but
  loading snd-intel-hda and snd-audio-usb by hand still works.
 
 Not a known problem to me, at least.  Perhaps it's a dep loop somehow.

I remember that someone reported it being Debian specific snd-seq-oss
loading stuff.

  ...
   1071 ?S  0:00 sh -c /sbin/modprobe --ignore-install snd  { 
  /sbin/modprobe --quiet snd
   1080 ?D  0:00  \_ /sbin/modprobe --quiet snd-seq
 
 This was first, and it's waiting.  Which means it must be doing
 something weird, because snd_seq_oss is loading now:
 
  snd_seq_oss 33717 1 - Loading 0xa041b000
 
 Perhaps in the tangle of modprobe install commands somewhere this gets
 invoked?

Likely, but I wonder what triggered a bug suddenly on 3.10.
There is absolutely no change in sound/core/seq/*, and through a quick
look, I couldn't find any suspicious change in kernel/module.c that
may lead to this problem between 3.9 and 3.10.

Philipp, can you get a sysrq-T trace while the stall?


thanks,

Takashi

  # ps axf
460 ?S  0:00  \_ [kworker/u8:3]
   1087 ?S  0:00  |   \_ [kworker/u8:3]
   1092 ?S  0:00  |   \_ /sbin/modprobe -q -- 
  snd-seq-client-14
 
 On my systems, that's snd-seq-dummy, which depends on snd_seq.  Which,
 in fact, is already loaded.
 
 Lucas, any clues?
 
 Full quote below.
 
 Cheers,
 Rusty.
 
 Philipp Matthias Hahn pmh...@pmhahn.de writes:
  Hello,
 
  My x86_64 systems has some trouble loading some ALSA snd-* modules since
  the upgrade to 3.10.[01]: Several automatic modprobe calls hang, but
  loading snd-intel-hda and snd-audio-usb by hand still works.
 
  # ps axf
460 ?S  0:00  \_ [kworker/u8:3]
   1087 ?S  0:00  |   \_ [kworker/u8:3]
   1092 ?S  0:00  |   \_ /sbin/modprobe -q -- 
  snd-seq-client-14
  ...
   1071 ?S  0:00 sh -c /sbin/modprobe --ignore-install snd  { 
  /sbin/modprobe --quiet snd
   1080 ?D  0:00  \_ /sbin/modprobe --quiet snd-seq
   1115 ?S  0:00 sh -c /sbin/modprobe --ignore-install 
  snd-rawmidi  { /sbin/modprobe --q
   1154 ?S  0:00  \_ /sbin/modprobe --quiet snd-seq-midi
   1119 ?S  0:00 sh -c /sbin/modprobe --ignore-install 
  snd-rawmidi  { /sbin/modprobe --q
   1148 ?S  0:00  \_ /sbin/modprobe --quiet snd-seq-midi
 
  In /var/log/daemon.log I find the following messages:
  Jul 15 19:58:44 scout udevd[912]: timeout: killing '/sbin/modprobe -b 
  usb:vFC08p0101d0250dc00dsc00dp00ic01isc01ip00in00' [1044]
  Jul 15 19:58:56 scout udevd[912]: '/sbin/modprobe -b 
  usb:vFC08p0101d0250dc00dsc00dp00ic01isc01ip00in00' [1044] terminated by 
  signal 9 (Killed)
  Jul 15 19:58:56 scout udevd[919]: timeout: killing '/sbin/modprobe -b 
  pci:v10DEd026Csv1462sd7350bc04sc03i00' [1051]
  Jul 15 19:58:56 scout udevd[914]: timeout: killing '/sbin/modprobe -b 
  usb:vFC08p0101d0250dc00dsc00dp00ic01isc03ip00in01' [1045]
  Jul 15 19:58:56 scout udevd[919]: '/sbin/modprobe -b 
  pci:v10DEd026Csv1462sd7350bc04sc03i00' [1051] terminated by 
  signal 9 (Killed)
  Jul 15 19:58:56 scout udevd[914]: '/sbin/modprobe -b 
  usb:vFC08p0101d0250dc00dsc00dp00ic01isc03ip00in01' [1045] terminated by 
  signal 9 (Killed)
 
 
  This is a Debian sid system
  # modprobe -V
  kmod version 9
 
  # echo t /proc/sysrq-trigger
  produces too much output to include the modprobe processes. I already
  stopped most processes, but that is not enough.
 
 
  # cat /proc/1092/syscall
  175 0x7effcad92000 0xafe8 0x7effca9c2f88 0x7effca6ea3aa 0x0 0x0 
  0x7fff3e3de648 0x7effca6eef8a
 
  # cat /proc/1080/syscall
  175 0x7fe01b25e000 0xafe8 0x7fe01ae8ef88 0x7fe01abb63aa 0x3 0x0 
  0x7fffba8cc748 0x7fe01abbaf8a
 
  # cat /proc/1154/syscall
  175 0x7fc157a7b000 0xafe8 0x7fc1576abf88 0x7fc1573d33aa 0x3 0x0 
  0x7fff05809e58 0x7fc1573d7f8a
 
  # cat /proc/1148/syscall
  175 0x7fc7159d5000 0xafe8 0x7fc715605f88 0x7fc71532d3aa 0x3 0x0 
  0x7fff47a1f3c8 0x7fc715331f8a
 
  Is this a know bug or has someone seen similar problems?
 
  # cat /proc/modules
  ip6table_filter 1575 0 - Live 0xa0893000
  ip6_tables 13784 1 ip6table_filter, Live 0xa088b000
  ebtable_nat 1887 0 - Live 0xa0887000
  ebtables 19917 1 ebtable_nat, Live 0xa087e000
  snd_usb_audio 124196 0 - Live 0xa0851000
  snd_usbmidi_lib 16982 1 snd_usb_audio, Live 0xa0848000
  rfcomm 28731 10 - Live 0xa083a000
  bnep 9786 2 - Live 0xa0833000
  snd_hda_codec_realtek 37669 1 - Live 0xa0823000
  snd_hda_intel 31432 0 - Live 0xa0814000
  snd_hda_codec 140669 2 snd_hda_codec_realtek,snd_hda_intel, Live 
  0xa07e2000
  snd_hwdep 5627 2 snd_usb_audio,snd_hda_codec, Live 

Re: [BUG] 3.10.[01] modprobe snd-... hangs

2013-07-16 Thread Lucas De Marchi
On Tue, Jul 16, 2013 at 2:41 AM, Rusty Russell ru...@rustcorp.com.au wrote:
 Philipp Matthias Hahn pmh...@pmhahn.de writes:
 Hello,

 My x86_64 systems has some trouble loading some ALSA snd-* modules since
 the upgrade to 3.10.[01]: Several automatic modprobe calls hang, but
 loading snd-intel-hda and snd-audio-usb by hand still works.

 Not a known problem to me, at least.  Perhaps it's a dep loop somehow.

First thing to check is the /etc/modprobe.d/*.conf file that contains
these install commands. Did they change besides the kernel upgrade?

[
   Not really related to this, but... people/distros should stop using
install commands for things like this. By using softdeps kmod is smart
enough to detect and (possibly) break loops. With  install commands it
can't because it has no idea what the install command will do.
]


 ...
  1071 ?S  0:00 sh -c /sbin/modprobe --ignore-install snd  { 
 /sbin/modprobe --quiet snd
  1080 ?D  0:00  \_ /sbin/modprobe --quiet snd-seq

 This was first, and it's waiting.  Which means it must be doing
 something weird, because snd_seq_oss is loading now:

 snd_seq_oss 33717 1 - Loading 0xa041b000

Searching kmod's log, I guess Debian still has:

 install snd_seq modprobe --ignore-install snd-seq $CMDLINE_OPTS  {
modprobe --quiet snd-seq-midi ; modprobe --quiet snd-seq-oss ; : ; }


 Perhaps in the tangle of modprobe install commands somewhere this gets
 invoked?

 # ps axf
   460 ?S  0:00  \_ [kworker/u8:3]
  1087 ?S  0:00  |   \_ [kworker/u8:3]
  1092 ?S  0:00  |   \_ /sbin/modprobe -q -- snd-seq-client-14

Weird... this is coming from a request_module(). Greping... this
should only be coming from

git grep request_module | grep snd-seq-client
sound/core/seq/seq_clientmgr.c: request_module(snd-seq-client-%i,

Philipp, which kernel are you upgrading from?  I don't see anything to
blame in the changes for the past releases. Any chance a bad entry in
your .conf was added too? You may want to paste the output of modprobe
-c, at least until # End of configuration files. Dumping indexes
now:


 On my systems, that's snd-seq-dummy, which depends on snd_seq.  Which,
 in fact, is already loaded.

 Lucas, any clues?

I don't think I could help, but we need more data, like the ones above.


Lucas De Marchi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] ASoC: kirkwood-i2s: fix a compilation warning

2013-07-16 Thread Jean-Francois Moine
In the function kirkwood_set_rate, when the rate cannot be satisfied
by the internal nor by an external clock, the clock source in undefined:

 warning: ‘clks_ctrl’ may be used uninitialized in this function

The ALSA subsystem should never gives such a rate because:
- the rates with the internal clock are limited to 44.1, 48 and 96 kHz
  as specified by the kirkwood_i2s_dai structure,
- the other rates are proposed in the structure kirkwood_i2s_dai_extclk
  only when the external clock is present.

In case of programming error (bad rate for internal clock and no
external clock), the function will simply cause a backtrace.

Signed-off-by: Jean-Francois Moine moin...@free.fr
---
v2
- add more explanations
---
 sound/soc/kirkwood/kirkwood-i2s.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sound/soc/kirkwood/kirkwood-i2s.c 
b/sound/soc/kirkwood/kirkwood-i2s.c
index 4c9dad3..c9daf3b 100644
--- a/sound/soc/kirkwood/kirkwood-i2s.c
+++ b/sound/soc/kirkwood/kirkwood-i2s.c
@@ -105,14 +105,16 @@ static void kirkwood_set_rate(struct snd_soc_dai *dai,
uint32_t clks_ctrl;
 
if (rate == 44100 || rate == 48000 || rate == 96000) {
-   /* use internal dco for supported rates */
+   /* use internal dco for the supported rates
+* defined in kirkwood_i2s_dai */
dev_dbg(dai-dev, %s: dco set rate = %lu\n,
__func__, rate);
kirkwood_set_dco(priv-io, rate);
 
clks_ctrl = KIRKWOOD_MCLK_SOURCE_DCO;
-   } else if (!IS_ERR(priv-extclk)) {
-   /* use optional external clk for other rates */
+   } else {
+   /* use the external clock for the other rates
+* defined in kirkwood_i2s_dai_extclk */
dev_dbg(dai-dev, %s: extclk set rate = %lu - %lu\n,
__func__, rate, 256 * rate);
clk_set_rate(priv-extclk, 256 * rate);
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: splice vs execve lockdep trace.

2013-07-16 Thread Dave Chinner
On Tue, Jul 16, 2013 at 07:16:02AM +0100, Al Viro wrote:
 On Tue, Jul 16, 2013 at 04:03:51PM +1000, Dave Chinner wrote:
 
  I posted patches to fix this i_mutex/i_iolock inversion a couple of
  years ago (july 2011):
  
  https://lkml.org/lkml/2011/7/18/4
  
  And V2 was posted here and reviewed (aug 2011):
  
  http://xfs.9218.n7.nabble.com/PATCH-0-2-splice-i-mutex-vs-splice-write-deadlock-V2-tt4072.html#none
 
 Unless I'm misreading the patch, you end up doing file_remove_suid()
 without holding i_mutex at all...

+   xfs_rw_ilock(ip, XFS_IOLOCK_EXCL);
+   ret = file_remove_suid(out);

Actaully, xfs_rw_ilock() takes the i_mutex due to teh exclusive locking ebing
done, so that's all fine.

Cheers,

Dave.
-- 
Dave Chinner
da...@fromorbit.com
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [BUG] 3.10 regression: hang on suspend

2013-07-16 Thread Stanislaw Gruszka
Hi

On Mon, Jul 15, 2013 at 09:40:13PM +0200, Ortwin GlĂ¼ck wrote:
 My Samsung ultrabook hangs when suspending to RAM since this commit
 (bisected). Disabling wifi before suspend works around the issue.
 All works fine with 3.9.y.
 
 12e7f517029dad819c45eca9ca01fdb9ba57616b
 
 Author: Stanislaw Gruszka sgrus...@redhat.com
 
 Date:   Thu Feb 28 10:55:26 2013 +0100
 
 mac80211: cleanup generic suspend/resume procedures
 
 Since now we disconnect before suspend, various code which save
 connection state can now be removed from suspend and resume
 procedure. Cleanup on resume side is smaller as ieee80211_reconfig()
 is also used for H/W restart.
 
 Signed-off-by: Stanislaw Gruszka sgrus...@redhat.com
 Signed-off-by: Johannes Berg johannes.b...@intel.com

Apparently this commit changed suspend procedure on mac80211, but it's
not obvious for me why it hangs :-(

What is your user space configuration (are you using NM or other
software or maybe just wpa_supplicant)? Are you using wowlan?
If you do add no_console_suspend boot parameter does it print some
diagnostic messages during suspend before the hang ?

Thanks
Stanislaw

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH BUGFIX] pkt_sched: sch_qfq: remove a source of high packet delay/jitter

2013-07-16 Thread Paolo Valente
QFQ+ inherits from QFQ a design choice that may cause a high packet
delay/jitter and a severe short-term unfairness. As QFQ, QFQ+ uses a
special quantity, the system virtual time, to track the service
provided by the ideal system it approximates. When a packet is
dequeued, this quantity must be incremented by the size of the packet,
divided by the sum of the weights of the aggregates waiting to be
served. Tracking this sum correctly is a non-trivial task, because, to
preserve tight service guarantees, the decrement of this sum must be
delayed in a special way [1]: this sum can be decremented only after
that its value would decrease also in the ideal system approximated by
QFQ+. For efficiency, QFQ+ keeps track only of the 'instantaneous'
weight sum, increased and decreased immediately as the weight of an
aggregate changes, and as an aggregate is created or destroyed (which,
in its turn, happens as a consequence of some class being
created/destroyed/changed). However, to avoid the problems caused to
service guarantees by these immediate decreases, QFQ+ increments the
system virtual time using the maximum value allowed for the weight
sum, 2^10, in place of the dynamic, instantaneous value. The
instantaneous value of the weight sum is used only to check whether a
request of weight increase or a class creation can be satisfied.

Unfortunately, the problems caused by this choice are worse than the
temporary degradation of the service guarantees that may occur, when a
class is changed or destroyed, if the instantaneous value of the
weight sum was used to update the system virtual time. In fact, the
fraction of the link bandwidth guaranteed by QFQ+ to each aggregate is
equal to the ratio between the weight of the aggregate and the sum of
the weights of the competing aggregates. The packet delay guaranteed
to the aggregate is instead inversely proportional to the guaranteed
bandwidth. By using the maximum possible value, and not the actual
value of the weight sum, QFQ+ provides each aggregate with the worst
possible service guarantees, and not with service guarantees related
to the actual set of competing aggregates. To see the consequences of
this fact, consider the following simple example.

Suppose that only the following aggregates are backlogged, i.e., that
only the classes in the following aggregates have packets to transmit:
one aggregate with weight 10, say A, and ten aggregates with weight 1,
say B1, B2, ..., B10. In particular, suppose that these aggregates are
always backlogged. Given the weight distribution, the smoothest and
fairest service order would be:
A B1 A B2 A B3 A B4 A B5 A B6 A B7 A B8 A B9 A B10 A B1 A B2 ...

QFQ+ would provide exactly this optimal service if it used the actual
value for the weight sum instead of the maximum possible value, i.e.,
11 instead of 2^10. In contrast, since QFQ+ uses the latter value, it
serves aggregates as follows (easy to prove and to reproduce
experimentally):
A B1 B2 B3 B4 B5 B6 B7 B8 B9 B10 A A A A A A A A A A B1 B2 ... B10 A A ...

By replacing 10 with N in the above example, and by increasing N, one
can increase at will the maximum packet delay and the jitter
experienced by the classes in aggregate A.

This patch addresses this issue by just using the above
'instantaneous' value of the weight sum, instead of the maximum
possible value, when updating the system virtual time.  After the
instantaneous weight sum is decreased, QFQ+ may deviate from the ideal
service for a time interval in the order of the time to serve one
maximum-size packet for each backlogged class. The worst-case extent
of the deviation exhibited by QFQ+ during this time interval [1] is
basically the same as of the deviation described above (but, without
this patch, QFQ+ suffers from such a deviation all the time). Finally,
this patch modifies the comment to the function qfq_slot_insert, to
make it coherent with the fact that the weight sum used by QFQ+ can
now be lower than the maximum possible value.

[1] P. Valente, Extending WF2Q+ to support a dynamic traffic mix,
Proceedings of AAA-IDEA'05, June 2005.

Signed-off-by: Paolo Valente paolo.vale...@unimore.it
---
 net/sched/sch_qfq.c | 85 +++--
 1 file changed, 56 insertions(+), 29 deletions(-)

diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c
index a7ab323..8056fb4 100644
--- a/net/sched/sch_qfq.c
+++ b/net/sched/sch_qfq.c
@@ -113,7 +113,6 @@
 
 #define FRAC_BITS  30  /* fixed point arithmetic */
 #define ONE_FP (1UL  FRAC_BITS)
-#define IWSUM  (ONE_FP/QFQ_MAX_WSUM)
 
 #define QFQ_MTU_SHIFT  16  /* to support TSO/GSO */
 #define QFQ_MIN_LMAX   512 /* see qfq_slot_insert */
@@ -189,6 +188,7 @@ struct qfq_sched {
struct qfq_aggregate*in_serv_agg;   /* Aggregate being served. */
u32 num_active_agg; /* Num. of active aggregates */
u32 wsum; 

Re: [PATCH BUGFIX] pkt_sched: sch_qfq: remove a source of high packet delay/jitter

2013-07-16 Thread Paolo Valente

Il 15/07/2013 20:12, Joe Perches ha scritto:

On Mon, 2013-07-15 at 20:01 +0200, Paolo Valente wrote:

QFQ+ inherits from QFQ a design choice that may cause a high packet
delay/jitter and a severe short-term unfairness.

[]

diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c

[]

@@ -189,6 +188,7 @@ struct qfq_sched {
struct qfq_aggregate*in_serv_agg;   /* Aggregate being served. */
u32 num_active_agg; /* Num. of active aggregates */
u32 wsum;   /* weight sum */
+   unsigned long   iwsum;  /* inverse weight sum*/


This is a different size for 32/64 bit compiles
and may be better as u32.



Sending a new version with u32, thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] MAINTAINERS: Change maintainer for cyttsp driver

2013-07-16 Thread Ferruh Yigit

On 07/15/2013 12:41 AM, Javier Martinez Canillas wrote:

I haven't had time to work on this driver for a long time and
Ferruh has been doing a great job making it more generic,
adding support for new hardware and providing bug fixes.

Thank you a lot for your work on cyttsp drivers,
we would like to see your support back whenever you have time again.
Your expertise/know-how on issue is valuable.



So, let's make MAINTAINERS reflect reality and add him as the
cyttsp maintainer instead of me.

Also, since Ferruh works for Cypress, we may change the driver
status from Maintained to Supported.

Signed-off-by: Javier Martinez Canillas jav...@dowhile0.org
---

Ferruh, please send your ack if you are willing to take over
maintainance of this driver.


Acked-by: Ferruh Yigit f...@cypress.com



Also, please confirm that you have been working on behalf of
Cypress instead of doing it on your free time. Otherwise we
should keep the driver status to maintained instead supported.

Right, I am a Cypress employee and working on TrueTouch drivers.


Thanks a lot and best regards,
Javier

  MAINTAINERS |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 9d771d9..4ba996c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2458,9 +2458,9 @@ S:Maintained
  F:drivers/media/common/cypress_firmware*
  
  CYTTSP TOUCHSCREEN DRIVER

-M: Javier Martinez Canillas jav...@dowhile0.org
+M: Ferruh Yigit f...@cypress.com
  L:linux-in...@vger.kernel.org
-S: Maintained
+S: Supported
  F:drivers/input/touchscreen/cyttsp*
  F:include/linux/input/cyttsp.h
  



--

Regards,
ferruh

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: v3.11-rc1 USB regressions

2013-07-16 Thread Kishon Vijay Abraham I
Hi,

On Tuesday 16 July 2013 12:03 PM, Daniel Mack wrote:
 Hi Aaro,
 
 On 16.07.2013 00:56, Aaro Koskinen wrote:
 Hi,

 I think USB tree introduced regressions in v3.11-rc1, at least for some
 OMAP devices using legacy boot.
 
 Thanks for checking the tree so early.
 
 I have only bisected these; I have no
 idea what the real fixes are but the following reverts make Nokia OMAP2+
 boards again usable for kernel development work (they need working USB
 connection for interacting with the device):

 1) USB peripheral mode (g_ether) is broken on Nokia N900, N950 and N9
(USB_MUSB_OMAP2PLUS). To make it it work, I need to revert three
commits:

  09fc7d22b024692b2fe8a943b246de1af307132b
  usb: musb: fix incorrect usage of resource pointer
  (Reverting this fixes the g_ether probe failure couldn't find
   an available UDC)

I've posted a patch fixing the issue
http://comments.gmane.org/gmane.linux.usb.general/89541
There were some comments on it. I'll be posting a new version for it.

Thanks
Kishon
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RESEND] The initmpfs patches.

2013-07-16 Thread Ramkumar Ramachandra
Rob Landley wrote:
 (Balsa is such an incompetent email client I wrote a python script to do
 this via raw smtp, and I'm always convinced it's going to screw up the send.
 But I think I've got it debugged now...)

Use the tried-and-tested git-send-email.perl, perhaps?
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 7/9] mm, hugetlb: add VM_NORESERVE check in vma_has_reserves()

2013-07-16 Thread Joonsoo Kim
On Tue, Jul 16, 2013 at 11:17:23AM +0530, Aneesh Kumar K.V wrote:
 Joonsoo Kim iamjoonsoo@lge.com writes:
 
  On Mon, Jul 15, 2013 at 08:41:12PM +0530, Aneesh Kumar K.V wrote:
  Joonsoo Kim iamjoonsoo@lge.com writes:
  
   If we map the region with MAP_NORESERVE and MAP_SHARED,
   we can skip to check reserve counting and eventually we cannot be ensured
   to allocate a huge page in fault time.
   With following example code, you can easily find this situation.
  
   Assume 2MB, nr_hugepages = 100
  
   fd = hugetlbfs_unlinked_fd();
   if (fd  0)
   return 1;
  
   size = 200 * MB;
   flag = MAP_SHARED;
   p = mmap(NULL, size, PROT_READ|PROT_WRITE, flag, fd, 0);
   if (p == MAP_FAILED) {
   fprintf(stderr, mmap() failed: %s\n, strerror(errno));
   return -1;
   }
  
   size = 2 * MB;
   flag = MAP_ANONYMOUS | MAP_SHARED | MAP_HUGETLB | MAP_NORESERVE;
   p = mmap(NULL, size, PROT_READ|PROT_WRITE, flag, -1, 0);
   if (p == MAP_FAILED) {
   fprintf(stderr, mmap() failed: %s\n, strerror(errno));
   }
   p[0] = '0';
   sleep(10);
  
   During executing sleep(10), run 'cat /proc/meminfo' on another process.
   You'll find a mentioned problem.
  
   Solution is simple. We should check VM_NORESERVE in vma_has_reserves().
   This prevent to use a pre-allocated huge page if free count is under
   the reserve count.
  
  You have a problem with this patch, which i guess you are fixing in
  patch 9. Consider two process
  
  a) MAP_SHARED  on fd
  b) MAP_SHARED | MAP_NORESERVE on fd
  
  We should allow the (b) to access the page even if VM_NORESERVE is set
  and we are out of reserve space .
 
  I can't get your point.
  Please elaborate more on this.
 
 
 One process mmap with MAP_SHARED and another one with MAP_SHARED | 
 MAP_NORESERVE
 Now the first process will result in reserving the pages from the hugtlb
 pool. Now if the second process try to dequeue huge page and we don't
 have free space we will fail because
 
 vma_has_reservers will now return zero because VM_NORESERVE is set 
 and we can have (h-free_huge_pages - h-resv_huge_pages) == 0;

I think that this behavior is correct, because a user who mapped with
VM_NORESERVE should not think their allocation always succeed. With patch 9,
he can be ensured to succeed, but I think it is side-effect.

 The below hunk in your patch 9 handles that
 
  +if (vma-vm_flags  VM_NORESERVE) {
  +/*
  + * This address is already reserved by other process(chg == 0),
  + * so, we should decreament reserved count. Without
  + * decreamenting, reserve count is remained after releasing
  + * inode, because this allocated page will go into page cache
  + * and is regarded as coming from reserved pool in releasing
  + * step. Currently, we don't have any other solution to deal
  + * with this situation properly, so add work-around here.
  + */
  +if (vma-vm_flags  VM_MAYSHARE  chg == 0)
  +return 1;
  +else
  +return 0;
  +}
 
 so may be both of these should be folded ?

I think that these patches should not be folded, because these handle
two separate issues. Reserve count mismatch issue mentioned in patch 9
is not introduced by patch 7.

Thanks.

 
 -aneesh
 
 --
 To unsubscribe, send a message with 'unsubscribe linux-mm' in
 the body to majord...@kvack.org.  For more info on Linux MM,
 see: http://www.linux-mm.org/ .
 Don't email: a href=mailto:d...@kvack.org; em...@kvack.org /a
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: 3.10: discard/trim support on md-raid1?

2013-07-16 Thread NeilBrown
On Sat, 13 Jul 2013 06:34:19 -0400 Justin Piszcz jpis...@lucidpixels.com
wrote:

 Hello,
 
 Running 3.10 and I see the following for an md-raid1 of two SSDs:
 
 Checking /sys/block/md1/queue:
 add_random: 0
 discard_granularity: 512
 discard_max_bytes: 2147450880
 discard_zeroes_data: 0
 hw_sector_size: 512
 iostats: 0
 logical_block_size: 512
 max_hw_sectors_kb: 32767
 max_integrity_segments: 0
 max_sectors_kb: 512
 max_segment_size: 65536
 max_segments: 168
 minimum_io_size: 512
 nomerges: 0
 nr_requests: 128
 optimal_io_size: 0
 physical_block_size: 512
 read_ahead_kb: 8192
 rotational: 1
 rq_affinity: 0
 scheduler: none
 write_same_max_bytes: 0
 
 What should be seen:
 rotational: 0

What has rotational got to do with supports discard?
There may be some correlation, but it isn't causal.

 And possibly:
 discard_zeroes_data: 1

This should be set as the 'or' of the same value from component devices.  And
does not enable or disable the use of discard.

I don't think that does this device support discard appears in sysfs.

I believe trim does work on md/raid1 if the underlying devices all support it.

NeilBrown



 
 Can anyone confirm if there is a workaround to allow TRIM when using
 md-raid1?
 
 Some related discussion here:
 http://us.generation-nt.com/answer/md-rotational-attribute-help-206571222.ht
 ml
 http://www.progtown.com/topic343938-ssd-strange-itself-conducts.html
 
 
 Justin.
 
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-raid in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html



signature.asc
Description: PGP signature


Re: When to push bug fixes to mainline

2013-07-16 Thread David Lang

On Fri, 12 Jul 2013, Willy Tarreau wrote:


And maybe in the end, having 1/10 patch cause a regression is not *that*
dramatic, and probably less than not fixing the 9 other bugs. In one case
we rely on -stable to merge the 10 fixes, and on the other case we'd rely
on -stable to just revert one of them.


Apologies for the late post, I'm catching up on things, but this jumped out at 
me.


We went through a LOT of pain several years ago when people got into the mindset 
that a patch was acceptable if it fixed more people than it broke. eliminating 
that mindset did wonders for kernel stability.


Regressions are a lot more of a negative than bugfixes are a positive, a 10:1 
ratio of fixes to regressions is _not_ good enough.


David Lang
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 0/7] cpufreq:boost: CPU Boost mode support

2013-07-16 Thread Lukasz Majewski
Dear Viresh, Rafael,

 On Thu, 04 Jul 2013 10:50:23 +0200, Lukasz Majewski wrote:
 
 Dear Viresh, Rafael
 
 Do you have any comments/feedback for me regarding those patches?
 

Will you find time to review version 5 of cpufreq boost patch series?



-- 
Best regards,

Lukasz Majewski

Samsung RD Institute Poland (SRPOL) | Linux Platform Group
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 5/7] thermal:boost: Automatic enable/disable of BOOST feature

2013-07-16 Thread Lukasz Majewski
Dear Zhang, Eduardo,

 Dear Zhang, Eduardo
 
 Do you have any comments/feedback for me regarding this thermal
 framework related patch?
 
 I've already received some feedback from Durga for this patch, but I
 think that maintainers are most welcome to express their opinion :-)
 

Will you find time to give me the feedback about proposed changes to
thermal_core.c regarding the cpufreq boost support?

 Thanks in advance.
 


-- 
Best regards,

Lukasz Majewski

Samsung RD Institute Poland (SRPOL) | Linux Platform Group
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [ATTEND] How to act on LKML (was: [ 00/19] 3.10.1-stable review)

2013-07-16 Thread David Lang

On Mon, 15 Jul 2013, Sarah Sharp wrote:


The people who want to work together in a civil manner should get
together and create a Kernel maintainer's code of conduct that
outlines what they expect from fellow kernel developers.  The people who
want to continue acting unprofessionally should document what
behaviors set off their cursing streaks, so that others can avoid that
behavior.  Somewhere in the middle is the community behavior all
developers can thrive in.


By defining your viewpoint as being professional and the other viewpoint as 
being unprofessional you have already started using very loaded terms and 
greatly reduces the probability of actually getting the other group to agree and 
participate.


As has been said elsewhere, almost all the attacks are against code, not people. 
There are occasional outbursts at the more experienced/trusted people along the 
lines of you should know better than to do that, and while there is heat 
there, there is also a lot of truth. If those people can't be trusted not to do 
the wrong things, then we are back to the time when Linus had to review every 
patch himself and we hit that wall quite hard.


People do need to be called out on their mistakes. In companies, if you don't 
fire managers who do the wrong thing soon enough, it can ruin the company. In 
kernel development, you have a very large number of observers and if they don't 
see people being corrected for doing the wrong thing, they will emulate it.


I find that frequently the most educational discussions to read are the 'heated' 
ones, they are the ones where the 'right' and 'wrong' processes are most clearly 
explained, not just in terms of what the processes are, but also the WHY of the 
process being 'right' or 'wrong'.


If Linus just snaps at someone and they say 'oops, missed that', it's no big 
deal for anyone. But when a full argument/discussion takes place, a lot more 
people learn and apply the lessons to their own work.


David Lang
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [BUG] 3.10 regression: hang on suspend

2013-07-16 Thread Ortwin GlĂ¼ck



On 16.07.2013 08:56, Stanislaw Gruszka wrote:

Apparently this commit changed suspend procedure on mac80211, but it's
not obvious for me why it hangs :-(


Hangs are hard :-) It just sits there with a black screen and a white 
cursor in the top left corner...



What is your user space configuration (are you using NM or other
software or maybe just wpa_supplicant)? Are you using wowlan?
If you do add no_console_suspend boot parameter does it print some
diagnostic messages during suspend before the hang ?


Yes, I am using NM under KDE, with KDE triggered suspend. No wowlan 
AFAIK. The last thing I see in the log is something from NetworkManager 
that sees the device switching off. I can try again tonight and give you 
the exact message.


I will also try without NM and bare wpa_supplicant and a plain suspend 
through sysfs.


Any debug options you want me to enable? Netconsole won't work however...

Ortwin
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] fs: 9p: use strlcpy instead of strncpy

2013-07-16 Thread Chen Gang
For 'NULL' terminated string, recommend always to be ended by zero.

Signed-off-by: Chen Gang gang.c...@asianux.com
---
 fs/9p/vfs_inode.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 25b018e..94de6d1 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -146,7 +146,7 @@ static umode_t p9mode2unixmode(struct v9fs_session_info 
*v9ses,
char type = 0, ext[32];
int major = -1, minor = -1;
 
-   strncpy(ext, stat-extension, sizeof(ext));
+   strlcpy(ext, stat-extension, sizeof(ext));
sscanf(ext, %c %u %u, type, major, minor);
switch (type) {
case 'c':
@@ -1186,7 +1186,7 @@ v9fs_stat2inode(struct p9_wstat *stat, struct inode 
*inode,
 * this even with .u extension. So check
 * for non NULL stat-extension
 */
-   strncpy(ext, stat-extension, sizeof(ext));
+   strlcpy(ext, stat-extension, sizeof(ext));
/* HARDLINKCOUNT %u */
sscanf(ext, %13s %u, tag_name, i_nlink);
if (!strncmp(tag_name, HARDLINKCOUNT, 13))
-- 
1.7.7.6
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] logo: Remove trailing whitespace from logo_linux_clut224.ppm

2013-07-16 Thread Geert Uytterhoeven
Hi Linus,

On Tue, Jul 16, 2013 at 3:02 AM, Linus Torvalds
torva...@linux-foundation.org wrote:
 On Mon, Jul 15, 2013 at 1:29 AM, Geert Uytterhoeven
 ge...@linux-m68k.org wrote:
 Commit ad81f0545ef01ea651886dddac4bef6cec930092 (Linux 3.11-rc1)
 replaced the Standard 224-color Linux logo, and introduced lots of
 trailing whitespace. Remove it again.

 The logo is temporary, and I'd rather keep it the way it is so that a
 simple revert will fix things up again..

OK, that's a good reason. But unlike last time with Tuz, you can't revert
the whole commit, as that also reverts the version ;-)

 That said, even if it wasn't temporary, I think we might be better off
 with the raw format that the netpbm tools generate these days. It was
 actually slightly annoying to get that big diff from a small edit, and
 it was the result of either the original logo ASCII representation
 having been cleaned up excessively before, or possibly just the netpbm
 tools having changed their output radically.

It seems there are different versions. My (Ubuntu 12.04 LTS) version of
pnmnoraw doesn't add trailing whitespace, but groups the values per
pixel. The old version used to generate the pre-v3.11-rc1 logo didn't
group the values, but used he same width for all fields.

 Of course, it would be even better if we actually used some saner
 format. I'm not exactly artistic, so making that whole silly logo
 change took more time than it really should have. But what was
 *really* painful was to fight the horrible ppm format conversion
 issues, and how we only accept that legacy ascii version etc.

When the logo conversion code was written (before we just had C header
files with arrays, which were a hell to update), my requirements were:
  1. The format must be easy to generate with commonly used tools,
  2. The format must be ASCII, to allow emailing of patches,
  3. The format must be easily parsable, without relying on external tools and
 libraries.

Thanks to GIT binary patch, 2 is no longer required.
If we switch to e.g. PNG, we may have to rely on one more external library,
upsetting Rob.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Ksummit-2013-discuss] KS Topic request: Handling the Stable kernel, let's dump the cc: stable tag

2013-07-16 Thread James Bottomley
On Mon, 2013-07-15 at 23:20 -0700, Greg KH wrote:
 On Tue, Jul 16, 2013 at 09:17:32AM +0400, James Bottomley wrote:
  On Mon, 2013-07-15 at 14:44 -0700, Greg KH wrote:
   On Mon, Jul 15, 2013 at 11:27:56PM +0400, James Bottomley wrote:
Before the 3.10.1-stable review thread degenerated into a disagreement
about habits of politeness, there were some solid points being made
which, I think, bear consideration and which may now be lost.

The problem, as Ji Kosina put is succinctly is that the 
distributions
are finding stable less useful because it contains to much stuff they'd
classify as not stable material.
 
 And I'm going to be working on that.

OK, I accept that.

 But I need, from the distros, specific examples of what they object to.
 So far all I've gotten is one security patch (that was needed), and one
 patch for sysfs that I backported too far in the version numbers (my
 fault.)
 
 Given the huge number of stable patches over the past few years, only
 having 2 patches be an issue sounds like things are working well for
 people here.
 
 If I don't get pushback, with specifics, from the distros, I will not
 know what to change, so if people can provide me that, it will help out
 a lot.

I agree ... I think JiÅ™Ă­ and his Red Hat equivalent need to pipe up and
give us more examples of the problems they've been having.

   I don't like this at all, just for the simple reason that it will push
   the majority of the work of stable kernel development on to the
   subsystem maintainers, who have enough work to do as it is.
  
  Well, I think of this as a feature not a bug because it enables scaling,
  but we can certainly debate the topic; it's probably one of the more
  important things that should be discussed.
 
 How does this scale?  It makes the maintainers do more work, which does
 not scale at all.

We obviously have different ideas of what scaling means.  Being a
mathematician I think of a process were you review everything as o(1)
and where the maintainers review everything as o(n).  Since the number
of patches (np) tends to grow as the number of maintainers, np/o(n) is
an approximate constant meaning the amount of work per maintainer
scales.  np/o(1) grows.

   Stable tree stuff should cause almost _no_ extra burden on the kernel
   developers, because it is something that I, and a few other people, have
   agreed to do with our time.  It has taken me 8 _years_ to finally get
   maintainers to agree to mark stuff for the stable tree, and fine-tune a
   development process that makes it easy for us to do this backport work.
   
   I _want_ the exact same commit that is in Linus's tree for the backport
   because if I have to rely on a maintainer to do the backport and resend
   it, I _know_ it will usually be a changed patch, and the git commit id
   will be lost.
  
  This is fixable with process and tools, surely.
 
 That's crazy,

Fixing a problem you just complained about with a suggestion involving
process and tools is crazy? I think I want some of what you're on.

  and it implies that there is a problem today with the Cc:
 tag.
 
 Is there?  What is the problem that you are seeing that you wish to help
 resolve?

To repeat: the problem, as I see it, is that the tag gets applied at the
leaves of the tree.  It can't be stripped in a normal git workflow, so
the process for adding it doesn't get enough review to ensure our stable
tree contains the correct patches.

 I don't think it's the same problem that I am seeing, as adding more
 tools and processes sure isn't going to fix that.
 
   Have I missed anything else that the distros are objecting to?  The
   smaller distros (i.e. ones without lots of kernel developers) have
   been giving me nothing but _thanks_ and appreciation with the way that
   I've been sucking in all of the different fixes.  Do we want to mess
   with a process that is really working out well for them, and only causes
   annoyance at times by the larger ones?
  
  I still think the scaling problem remains plus, if you push back more,
  it's going to increase friction: you aren't necessarily in the best
  position to know what should be a stable fix for a given subsystem, and
  if you push back incorrectly it's going to annoy the maintainer.
 
 Making a subsystem maintainer answer why is this needed is really
 going to annoy people?  Seriously?

Pushing back wrongly is, yes, it's just human nature.

From a human nature perspective, the friction to inclusion rises
globally as the current kernel goes through the -rc cycle.  There's no
such natural cadence for stable.  It's the general level of friction
that needs to rise for stable and I'm not sure that individual pushback
does that. 

 Let's try it out, and see what happens.

Well, experiment is the best teacher, yes, let's see how it works out.

 I think the real stable issue that _everyone_ keeps ignoring, is my
 original complaint, in that people are using the -rc1 merge window to
 

Re: [PATCH] drm/i915: fix long-standing SNB regression in power consumption after resume

2013-07-16 Thread Daniel Vetter
On Tue, Jul 16, 2013 at 11:34:25AM +0400, Konstantin Khlebnikov wrote:
 On Tue, Jul 16, 2013 at 10:31 AM, Daniel Vetter dan...@ffwll.ch wrote:
 
  On Sun, Jul 14, 2013 at 09:56:45PM +0400, Konstantin Khlebnikov wrote:
   Daniel Vetter wrote:
   On Sun, Jul 14, 2013 at 6:30 PM, Konstantin Khlebnikov
   khlebni...@openvz.org  wrote:
   This patch fixes regression in power consumtion of sandy bridge gpu,
  which
   exists since v3.6 Sometimes after resuming from s2ram gpu starts
  thinking that
   it's extremely busy. After that it never reaches rc6 state.
   
   Bug was introduce by commit b4ae3f22d238617ca11610b29fde16cf8c0bc6e0
   (drm/i915: load boot context at driver init time). Without
  documentation
   it's not clear what is happening here, probably this breaks internal
  state of
   hardware ring buffers and confuses RPS engine. Fortunately keeping
  forcewake
   during whole initialization sequence in gen6_init_clock_gating() fixes
  this bug.
   
   References: https://bugs.freedesktop.org/show_bug.cgi?id=54089
   Signed-off-by: Konstantin Khlebnikovkhlebni...@openvz.org
   
   We already hold an forcewake reference while setting up the rps stuff,
   should we maybe hold the forcewake for the entire duration, i.e. grab
   it here in clock_gating and release it only in gen6/vlv_enable_rps?
   Can you please test that version, too?
  
   This will be racy because rps stuff is done in separate work which might
  be canceled
   if intel_disable_gt_powersave() happens before its completion.
 
  Can be fixed with a flush_delayed_work. And since that has the same
  requirements wrt locking to prevent deadlocks as cancel_work_sync it would
  be a drop-in replacement. Can I volunteer you to look into testing that
  out a bit? Otherwise I could volunteer someone from our team.
 
  In any case I think we should apply this trick to all platforms where
  we've added the MBCTL write (i.e. snb, ivb, hsw  vlv) since rps/rc6 works
  _very_ similar on all of those.
 
 
 I've tested that patch and it really works for me. If you want change
 something for other hardware or
 extend range where forcewake is held prease do it in a separate patch.
 This will be good for bisecting new bugs in the future.

The issue I have with the current patch is that it looks a bit like
duct-tape since the point where we drop the forcewake references seems to
lack justification. The write to MBCTL itself will temporarily wake up the
chip, so just wrapping that up in with forcewake is very likely not good
enough. So I fear that we'll only hold forcewake long enough on most
systems and still have a bunch of oddball broken systems out there.

Holding forcewake otoh until we've fully set up rps/rc6 makes imo tons of
sense, hence why I've brought up the idea. Same reasoning applies to
extending the w/a to all systems supporting rc6.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Update][PATCH] ACPI / video / i915: Remove ACPI backlight if firmware expects Windows 8

2013-07-16 Thread Igor Gnatenko

On Tue, 2013-07-16 at 01:53 +0200, Rafael J. Wysocki wrote:
 On Monday, July 15, 2013 05:06:09 PM Igor Gnatenko wrote:
  On Sat, 2013-07-13 at 02:46 +0200, Rafael J. Wysocki wrote:
 
 [...]
 
  
  I can't build it. Where did I go wrong?
 
 Probably nowhere, you tried to build the ACPI video driver as a module, that's
 all.  And you need to apply https://patchwork.kernel.org/patch/2812951/
 before.
 
 Please try the appended version (on top of
 https://patchwork.kernel.org/patch/2812951/).
 
 Thanks,
 Rafael
 
Tested-by: Igor Gnatenko i.gnatenko.br...@gmail.com
 
 ---
 From: Rafael J. Wysocki rafael.j.wyso...@intel.com
 Subject: ACPI / video / i915: No ACPI backlight if firmware expects Windows 8
 
 According to Matthew Garrett, Windows 8 leaves backlight control up
 to individual graphics drivers rather than making ACPI calls itself.
 There's plenty of evidence to suggest that the Intel driver for
 Windows [8] doesn't use the ACPI interface, including the fact that
 it's broken on a bunch of machines when the OS claims to support
 Windows 8.  The simplest thing to do appears to be to disable the
 ACPI backlight interface on these systems.
 
 There's a problem with that approach, however, because simply
 avoiding to register the ACPI backlight interface if the firmware
 calls _OSI for Windows 8 may not work in the following situations:
  (1) The ACPI backlight interface actually works on the given system
  and the i915 driver is not loaded (e.g. another graphics driver
  is used).
  (2) The ACPI backlight interface doesn't work on the given system,
  but there is a vendor platform driver that will register its
  own, equally broken, backlight interface if not prevented from
  doing so by the ACPI subsystem.
 Therefore we need to allow the ACPI backlight interface to be
 registered until the i915 driver is loaded which then will unregister
 it if the firmware has called _OSI for Windows 8 (or will register
 the ACPI video driver without backlight support if not already
 present).
 
 For this reason, introduce an alternative function for registering
 ACPI video, acpi_video_register_with_quirks(), that will check
 whether or not the ACPI video driver has already been registered
 and whether or not the backlight Windows 8 quirk has to be applied.
 If the quirk has to be applied, it will block the ACPI backlight
 support and either unregister the backlight interface if the ACPI
 video driver has already been registered, or register the ACPI
 video driver without the backlight interface otherwise.  Make
 the i915 driver use acpi_video_register_with_quirks() instead of
 acpi_video_register() in i915_driver_load().
 
 This change is based on earlier patches from Matthew Garrett,
 Chun-Yi Lee and Seth Forshee and Aaron Lu's comments.
 
 Signed-off-by: Rafael J. Wysocki rafael.j.wyso...@intel.com
 ---
  drivers/acpi/internal.h |   11 ++
  drivers/acpi/video.c|   65 
 
  drivers/acpi/video_detect.c |   21 
  drivers/gpu/drm/i915/i915_dma.c |2 -
  include/acpi/video.h|   11 ++
  include/linux/acpi.h|1 
  6 files changed, 103 insertions(+), 8 deletions(-)
 
 Index: linux-pm/drivers/acpi/video.c
 ===
 --- linux-pm.orig/drivers/acpi/video.c
 +++ linux-pm/drivers/acpi/video.c
 @@ -44,6 +44,8 @@
  #include linux/suspend.h
  #include acpi/video.h
  
 +#include internal.h
 +
  #define PREFIX ACPI: 
  
  #define ACPI_VIDEO_BUS_NAME  Video Bus
 @@ -898,7 +900,7 @@ static void acpi_video_device_find_cap(s
   device-cap._DDC = 1;
   }
  
 - if (acpi_video_backlight_support()) {
 + if (acpi_video_verify_backlight_support()) {
   struct backlight_properties props;
   struct pci_dev *pdev;
   acpi_handle acpi_parent;
 @@ -1854,6 +1856,46 @@ static int acpi_video_bus_remove(struct
   return 0;
  }
  
 +static acpi_status video_unregister_backlight(acpi_handle handle, u32 lvl,
 +   void *context, void **rv)
 +{
 + struct acpi_device *acpi_dev;
 + struct acpi_video_bus *video;
 + struct acpi_video_device *dev, *next;
 +
 + if (acpi_bus_get_device(handle, acpi_dev))
 + return AE_OK;
 +
 + if (acpi_match_device_ids(acpi_dev, video_device_ids))
 + return AE_OK;
 +
 + video = acpi_driver_data(acpi_dev);
 + if (!video)
 + return AE_OK;
 +
 + acpi_video_bus_stop_devices(video);
 + mutex_lock(video-device_list_lock);
 + list_for_each_entry_safe(dev, next, video-video_device_list, entry) {
 + if (dev-backlight) {
 + backlight_device_unregister(dev-backlight);
 + dev-backlight = NULL;
 + kfree(dev-brightness-levels);
 + kfree(dev-brightness);
 + }
 +   

Re: [PATCH -next 2/2] kbuild: fix for updated LZ4 tool with the new streaming format

2013-07-16 Thread Andrew Morton
On Mon, 15 Jul 2013 15:08:20 -0700 H. Peter Anvin h...@zytor.com wrote:

 On 07/15/2013 03:03 PM, Andrew Morton wrote:
  
  I don't know how to do this.  Any suggestions?
  
  It has to be done at `make config' time.  We'd need to probe for the
  presence of lz4c and then  what?
  
  Is there any precedent for this?
  
  I don't think we can just ignore the absence of lz4c - the user has
  selected a config which his system cannot build.  The problem lies
  within randconfig itself.
  
 
 We keep running over the need to be able to have kconfig run tests on
 the build system (for toolchain support or for optional tools needed);
 running them in the Makefiles (i.e. at Kbuild time) is simply too late.
 

Would it make sense to extend Kconfig's `depends'?

depends on $(shell-command)

I don't know how practical that would be to implement...
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [alsa-devel] [BUG] 3.10.[01] modprobe snd-... hangs

2013-07-16 Thread Damien Wyart
* Takashi Iwai ti...@suse.de [2013-07-16 08:43]:
 At Tue, 16 Jul 2013 15:11:51 +0930,
 Rusty Russell wrote:

  Philipp Matthias Hahn pmh...@pmhahn.de writes:
   Hello,

   My x86_64 systems has some trouble loading some ALSA snd-* modules since
   the upgrade to 3.10.[01]: Several automatic modprobe calls hang, but
   loading snd-intel-hda and snd-audio-usb by hand still works.

  Not a known problem to me, at least.  Perhaps it's a dep loop somehow.

 I remember that someone reported it being Debian specific snd-seq-oss
 loading stuff.

There is also additional information here:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=660803

-- 
Damien Wyart
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Build regressions/improvements in v3.11-rc1

2013-07-16 Thread Geert Uytterhoeven
On Tue, 16 Jul 2013, Geert Uytterhoeven wrote:
 *** ERRORS ***
 
 73 regressions:
   + drivers/ata/libata-core.c: error: implicit declaration of function 
 'ioread32' [-Werror=implicit-function-declaration]:  = 6734:2
   + drivers/ata/libata-sff.c: error: implicit declaration of function 
 'ioread16' [-Werror=implicit-function-declaration]:  = 2172:3
   + drivers/ata/libata-sff.c: error: implicit declaration of function 
 'ioread16_rep' [-Werror=implicit-function-declaration]:  = 567:3
   + drivers/ata/libata-sff.c: error: implicit declaration of function 
 'ioread32_rep' [-Werror=implicit-function-declaration]:  = 626:3
   + drivers/ata/libata-sff.c: error: implicit declaration of function 
 'ioread8' [-Werror=implicit-function-declaration]:  = 86:2
   + drivers/ata/libata-sff.c: error: implicit declaration of function 
 'iowrite16_rep' [-Werror=implicit-function-declaration]:  = 569:3
   + drivers/ata/libata-sff.c: error: implicit declaration of function 
 'iowrite32' [-Werror=implicit-function-declaration]:  = 3018:2
   + drivers/ata/libata-sff.c: error: implicit declaration of function 
 'iowrite32_rep' [-Werror=implicit-function-declaration]:  = 628:3
   + drivers/ata/libata-sff.c: error: implicit declaration of function 
 'iowrite8' [-Werror=implicit-function-declaration]:  = 301:3
   + drivers/ata/pata_arasan_cf.c: error: implicit declaration of function 
 'ioread8' [-Werror=implicit-function-declaration]:  = 549:3
   + drivers/ata/sata_mv.c: error: implicit declaration of function 'ioread8' 
 [-Werror=implicit-function-declaration]:  = 1957:3
   + drivers/ata/sata_rcar.c: error: implicit declaration of function 
 'ioread32' [-Werror=implicit-function-declaration]:  = 163:3
   + drivers/ata/sata_rcar.c: error: implicit declaration of function 
 'iowrite32' [-Werror=implicit-function-declaration]:  = 136:2
   + drivers/crypto/amcc/crypto4xx_core.c: error: expected declaration 
 specifiers or '...' before string constant:  = 1299:15, 1300:20, 1298:16
   + drivers/dma/timb_dma.c: error: implicit declaration of function 
 'ioread32' [-Werror=implicit-function-declaration]:  = 130:2
   + drivers/dma/timb_dma.c: error: implicit declaration of function 
 'iowrite32' [-Werror=implicit-function-declaration]:  = 134:2
   + drivers/gpu/drm/drm_bufs.c: error: implicit declaration of function 
 'ioremap_wc' [-Werror=implicit-function-declaration]:  = 219:5
   + drivers/gpu/drm/drm_memory.c: error: implicit declaration of function 
 'ioremap_wc' [-Werror=implicit-function-declaration]:  = 129:3
   + drivers/ipack/devices/ipoctal.c: error: implicit declaration of function 
 'ioread8' [-Werror=implicit-function-declaration]:  = 134:3
   + drivers/ipack/devices/ipoctal.c: error: implicit declaration of function 
 'iowrite8' [-Werror=implicit-function-declaration]:  = 68:2
   + drivers/ipack/ipack.c: error: implicit declaration of function 
 'ioread16be' [-Werror=implicit-function-declaration]:  = 376:3
   + drivers/ipack/ipack.c: error: implicit declaration of function 'ioread8' 
 [-Werror=implicit-function-declaration]:  = 358:2
   + drivers/media/platform/sh_veu.c: error: implicit declaration of function 
 'ioread32' [-Werror=implicit-function-declaration]:  = 228:2
   + drivers/media/platform/sh_veu.c: error: implicit declaration of function 
 'iowrite32' [-Werror=implicit-function-declaration]:  = 234:2
   + drivers/mfd/kempld-core.c: error: implicit declaration of function 
 'ioread8' [-Werror=implicit-function-declaration]:  = 38:2
   + drivers/mfd/kempld-core.c: error: implicit declaration of function 
 'iowrite8' [-Werror=implicit-function-declaration]:  = 45:2
   + drivers/net/ethernet/micrel/ks8842.c: error: implicit declaration of 
 function 'ioread16' [-Werror=implicit-function-declaration]:  = 207:2
   + drivers/net/ethernet/micrel/ks8842.c: error: implicit declaration of 
 function 'ioread32' [-Werror=implicit-function-declaration]:  = 247:2
   + drivers/net/ethernet/micrel/ks8842.c: error: implicit declaration of 
 function 'ioread8' [-Werror=implicit-function-declaration]:  = 233:2
   + drivers/net/ethernet/micrel/ks8842.c: error: implicit declaration of 
 function 'iowrite16' [-Werror=implicit-function-declaration]:  = 185:2
   + drivers/net/ethernet/micrel/ks8842.c: error: implicit declaration of 
 function 'iowrite32' [-Werror=implicit-function-declaration]:  = 180:2
   + drivers/net/ethernet/micrel/ks8842.c: error: implicit declaration of 
 function 'iowrite8' [-Werror=implicit-function-declaration]:  = 192:2
   + drivers/net/ethernet/renesas/sh_eth.h: error: implicit declaration of 
 function 'ioread32' [-Werror=implicit-function-declaration]:  = 548:2
   + drivers/net/ethernet/renesas/sh_eth.h: error: implicit declaration of 
 function 'iowrite32' [-Werror=implicit-function-declaration]:  = 540:2
   + drivers/ptp/ptp_pch.c: error: implicit declaration of function 'ioread32' 
 [-Werror=implicit-function-declaration]:  = 153:2
   + drivers/ptp/ptp_pch.c: error: implicit declaration of function 
 

Re: [PATCH] sh: remove references to CPU_SUBTYPE_SH7764

2013-07-16 Thread Paul Bolle
Paul,

On Tue, 2013-03-12 at 16:57 +0900, Paul Mundt wrote:
 On Mon, Mar 11, 2013 at 12:55:40PM +0100, Paul Bolle wrote:
  Since release v2.6.29 the tree has a few references to the Kconfig
  symbol CPU_SUBTYPE_SH7764 and the Kconfig macro
  CONFIG_CPU_SUBTYPE_SH7764. But the actual symbol CPU_SUBTYPE_SH7764 was
  never added to the tree. Perhaps no one noticed because these references
  were never used alone. Anyhow, these references serve no purpose and
  can be removed.
  
  Signed-off-by: Paul Bolle pebo...@tiscali.nl
 
 Looks fine, I suspect Iwamatsu-san let this trickle in from some vendor
 branch given that these are all his drivers. I'll queue it up, thanks.

This didn't (yet) make it into mainline. Is there an issue with this
patch? Or is it queued somewhere?


Paul Bolle

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH -next 2/2] kbuild: fix for updated LZ4 tool with the new streaming format

2013-07-16 Thread Andrew Morton
On Tue, 16 Jul 2013 00:47:27 -0700 Andrew Morton a...@linux-foundation.org 
wrote:

 On Mon, 15 Jul 2013 15:08:20 -0700 H. Peter Anvin h...@zytor.com wrote:
 
  On 07/15/2013 03:03 PM, Andrew Morton wrote:
   
   I don't know how to do this.  Any suggestions?
   
   It has to be done at `make config' time.  We'd need to probe for the
   presence of lz4c and then  what?
   
   Is there any precedent for this?
   
   I don't think we can just ignore the absence of lz4c - the user has
   selected a config which his system cannot build.  The problem lies
   within randconfig itself.
   
  
  We keep running over the need to be able to have kconfig run tests on
  the build system (for toolchain support or for optional tools needed);
  running them in the Makefiles (i.e. at Kbuild time) is simply too late.
  
 
 Would it make sense to extend Kconfig's `depends'?
 
   depends on $(shell-command)
 
 I don't know how practical that would be to implement...

Or, easier and faster, run some front-end script which generates
once-off Kconfig symbols.

if [ -x /bin/lz4c ]
then
echo CONFIG_HAVE_LZ4C
fi

then munge the output of that script into the Kconfig run and do

depends on HAVE_LZ4C
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH -next 2/2] kbuild: fix for updated LZ4 tool with the new streaming format

2013-07-16 Thread Yann E. MORIN
Andrew, All,

On Tuesday 16 July 2013 09:56:11 Andrew Morton wrote:
 On Tue, 16 Jul 2013 00:47:27 -0700 Andrew Morton a...@linux-foundation.org 
 wrote:
  On Mon, 15 Jul 2013 15:08:20 -0700 H. Peter Anvin h...@zytor.com wrote:
   On 07/15/2013 03:03 PM, Andrew Morton wrote:
[--SNIP--]
   We keep running over the need to be able to have kconfig run tests on
   the build system (for toolchain support or for optional tools needed);
   running them in the Makefiles (i.e. at Kbuild time) is simply too late.
   
  
  Would it make sense to extend Kconfig's `depends'?
  
  depends on $(shell-command)
  
  I don't know how practical that would be to implement...

I'm afraid this will get rather ugly and not trivial.

Can we mix 'depends on SYMBOL' and 'depends on $(command)' ?
Can we mix both in a boolean expression such as 'depends on SYMBOL
 $(command)' ?

What would be the condition for evaluating the dependency rule? Evaluation
at Kconfig read-time might not be enough, given this construct:

config FOO
depends on $(foo)
comment 'foo' is missing, please install it
depends on !$(foo)

Also, I believe Kconfig should stay a config-only language, without
much esoteric features.

 Or, easier and faster, run some front-end script which generates
 once-off Kconfig symbols.
 
   if [ -x /bin/lz4c ]
   then
   echo CONFIG_HAVE_LZ4C
   fi
 
 then munge the output of that script into the Kconfig run and do
 
   depends on HAVE_LZ4C

Yes, this is a better solution.

For what it's worth, this is what I'm doing in crosstool-NG: a script
checks for optional pre-requisites, spits out a Kconfig blob which is
included by the top-level Kconfig file.

Here is a snippet of generated Kconfig blob:
config HAVE_XZ
def_bool y
config HAVE_LZMA
bool

Which means we do have 'xz', but not 'lzma'. This is relatively trivial
to do, so I'll tackle this this evening when I'm back home (unless
someone beats me to it).

Regards,
Yann E. MORIN.

-- 
.-..--..
|  Yann E. MORIN  | Real-Time Embedded | /\ ASCII RIBBON | Erics' conspiracy: |
| +0/33 662376056 | Software  Designer | \ / CAMPAIGN |   ^|
| --== O_o ==-- '.---:  X  AGAINST  |  /e\  There is no  |
| http://ymorin.is-a-geek.org/ | (*_*) | / \ HTML MAIL|conspiracy.  |
'--'---'--''
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: v3.11-rc1 USB regressions

2013-07-16 Thread Felipe Balbi
Hi,

On Tue, Jul 16, 2013 at 12:30:00PM +0530, Kishon Vijay Abraham I wrote:
 On Tuesday 16 July 2013 12:03 PM, Daniel Mack wrote:
  Hi Aaro,
  
  On 16.07.2013 00:56, Aaro Koskinen wrote:
  Hi,
 
  I think USB tree introduced regressions in v3.11-rc1, at least for some
  OMAP devices using legacy boot.
  
  Thanks for checking the tree so early.
  
  I have only bisected these; I have no
  idea what the real fixes are but the following reverts make Nokia OMAP2+
  boards again usable for kernel development work (they need working USB
  connection for interacting with the device):
 
  1) USB peripheral mode (g_ether) is broken on Nokia N900, N950 and N9
 (USB_MUSB_OMAP2PLUS). To make it it work, I need to revert three
 commits:
 
 09fc7d22b024692b2fe8a943b246de1af307132b
 usb: musb: fix incorrect usage of resource pointer
 (Reverting this fixes the g_ether probe failure couldn't find
  an available UDC)
 
 I've posted a patch fixing the issue
 http://comments.gmane.org/gmane.linux.usb.general/89541
 There were some comments on it. I'll be posting a new version for it.

hmm, n8x0 used tusb6010, so perhaps a similar patch needs to be cooked
for that too. Right now, let's to the minimum fix, which is just to
increment the array size to 3 and for v3.12 we do the changes that I
suggested.

-- 
balbi


signature.asc
Description: Digital signature


Re: 3.10: discard/trim support on md-raid1?

2013-07-16 Thread Justin Piszcz
Thanks for the replies,

After some further testing..
When I ran a repair on the md's sync_action, the system would reduce
I/O to the RAID-1 to 14kb/s or even less when it hit a certain number
of blocks and effectively locked the system every time.
It turned out to be a bad SSD (it also failed Intel's Secure Erase), I RMA'd it.
Interesting though that it did not drop out of the array but froze the
system (the failure scenario was odd).

Justin.



On Tue, Jul 16, 2013 at 3:15 AM, NeilBrown ne...@suse.de wrote:
 On Sat, 13 Jul 2013 06:34:19 -0400 Justin Piszcz jpis...@lucidpixels.com
 wrote:

 Hello,

 Running 3.10 and I see the following for an md-raid1 of two SSDs:

 Checking /sys/block/md1/queue:
 add_random: 0
 discard_granularity: 512
 discard_max_bytes: 2147450880
 discard_zeroes_data: 0
 hw_sector_size: 512
 iostats: 0
 logical_block_size: 512
 max_hw_sectors_kb: 32767
 max_integrity_segments: 0
 max_sectors_kb: 512
 max_segment_size: 65536
 max_segments: 168
 minimum_io_size: 512
 nomerges: 0
 nr_requests: 128
 optimal_io_size: 0
 physical_block_size: 512
 read_ahead_kb: 8192
 rotational: 1
 rq_affinity: 0
 scheduler: none
 write_same_max_bytes: 0

 What should be seen:
 rotational: 0

 What has rotational got to do with supports discard?
 There may be some correlation, but it isn't causal.

 And possibly:
 discard_zeroes_data: 1

 This should be set as the 'or' of the same value from component devices.  And
 does not enable or disable the use of discard.

 I don't think that does this device support discard appears in sysfs.

 I believe trim does work on md/raid1 if the underlying devices all support it.

 NeilBrown




 Can anyone confirm if there is a workaround to allow TRIM when using
 md-raid1?

 Some related discussion here:
 http://us.generation-nt.com/answer/md-rotational-attribute-help-206571222.ht
 ml
 http://www.progtown.com/topic343938-ssd-strange-itself-conducts.html


 Justin.


 --
 To unsubscribe from this list: send the line unsubscribe linux-raid in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/3] ptrace.2: explain new commands to work with signals

2013-07-16 Thread Andrey Vagin
Andrey Vagin (3):
  ptrace.2: place GETSIGINFO and SETSIGINFO near each other
  ptrace.2: add description for PTRACE_PEEKSIGINFO
  ptrace.2: add description for PTRACE_{GET,SET}SIGMASK

 man2/ptrace.2 | 78 ++-
 1 file changed, 66 insertions(+), 12 deletions(-)

-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] ptrace.2: add description for PTRACE_{GET,SET}SIGMASK

2013-07-16 Thread Andrey Vagin
These two commands allow to examine and change mask of blocked signals.

Signed-off-by: Andrey Vagin ava...@openvz.org
---
 man2/ptrace.2 | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/man2/ptrace.2 b/man2/ptrace.2
index e74535e..08697ff 100644
--- a/man2/ptrace.2
+++ b/man2/ptrace.2
@@ -356,6 +356,21 @@ If this flag is not set, signals are read from a 
per-thread queue.
 .in
 .PP
 .TP
+.BR PTRACE_GETSIGMASK  (since Linux 3.11)
+.\ commit 29000caecbe87b6b66f144f72111f0d02fbbf0c1
+Retrieve mask of blocked signals to the address
+.I data.
+The
+.I addr
+argument contains the size of mask.
+.TP
+.BR PTRACE_SETSIGMASK  (since Linux 3.11)
+Change mask of blocked signals from the address
+.I data.
+The
+.I addr
+argument contains the size of mask.
+.TP
 .BR PTRACE_SETOPTIONS  (since Linux 2.4.6; see BUGS for caveats)
 Set ptrace options from
 .IR data .
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: 3.10: discard/trim support on md-raid1?

2013-07-16 Thread David Lang
Part of this depends on the exact failure mode. I've seen cases where drives 
fail, and the drive does a bunch of retries, then the OS does a bunch of 
retries, and eventually the read fails, but in the meantime, everything stalls 
for a long time.


I've even seen the same thing in at least one case where there was a hardware 
RAID card in use.


David Lang

On Tue, 16 Jul 2013, Justin Piszcz wrote:


Thanks for the replies,

After some further testing..
When I ran a repair on the md's sync_action, the system would reduce
I/O to the RAID-1 to 14kb/s or even less when it hit a certain number
of blocks and effectively locked the system every time.
It turned out to be a bad SSD (it also failed Intel's Secure Erase), I RMA'd it.
Interesting though that it did not drop out of the array but froze the
system (the failure scenario was odd).

Justin.



On Tue, Jul 16, 2013 at 3:15 AM, NeilBrown ne...@suse.de wrote:

On Sat, 13 Jul 2013 06:34:19 -0400 Justin Piszcz jpis...@lucidpixels.com
wrote:


Hello,

Running 3.10 and I see the following for an md-raid1 of two SSDs:

Checking /sys/block/md1/queue:
add_random: 0
discard_granularity: 512
discard_max_bytes: 2147450880
discard_zeroes_data: 0
hw_sector_size: 512
iostats: 0
logical_block_size: 512
max_hw_sectors_kb: 32767
max_integrity_segments: 0
max_sectors_kb: 512
max_segment_size: 65536
max_segments: 168
minimum_io_size: 512
nomerges: 0
nr_requests: 128
optimal_io_size: 0
physical_block_size: 512
read_ahead_kb: 8192
rotational: 1
rq_affinity: 0
scheduler: none
write_same_max_bytes: 0

What should be seen:
rotational: 0


What has rotational got to do with supports discard?
There may be some correlation, but it isn't causal.


And possibly:
discard_zeroes_data: 1


This should be set as the 'or' of the same value from component devices.  And
does not enable or disable the use of discard.

I don't think that does this device support discard appears in sysfs.

I believe trim does work on md/raid1 if the underlying devices all support it.

NeilBrown





Can anyone confirm if there is a workaround to allow TRIM when using
md-raid1?

Some related discussion here:
http://us.generation-nt.com/answer/md-rotational-attribute-help-206571222.ht
ml
http://www.progtown.com/topic343938-ssd-strange-itself-conducts.html


Justin.


--
To unsubscribe from this list: send the line unsubscribe linux-raid in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] regulator: s2mps11: Add linux/of.h header

2013-07-16 Thread Yadwinder Singh Brar
This patch adds linux/of.h required to fix an error and warning reported by
kbuild test robot for some x86 config file.

Signed-off-by: Yadwinder Singh Brar yadi.b...@samsung.com
---
 drivers/regulator/s2mps11.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index e1aadbd..350e04f 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -17,6 +17,7 @@
 #include linux/slab.h
 #include linux/module.h
 #include linux/regmap.h
+#include linux/of.h
 #include linux/platform_device.h
 #include linux/regulator/driver.h
 #include linux/regulator/machine.h
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 16/18] sched: Avoid overloading CPUs on a preferred NUMA node

2013-07-16 Thread Mel Gorman
On Mon, Jul 15, 2013 at 10:03:21PM +0200, Peter Zijlstra wrote:
 On Mon, Jul 15, 2013 at 04:20:18PM +0100, Mel Gorman wrote:
  ---
   kernel/sched/fair.c | 105 
  +---
   1 file changed, 83 insertions(+), 22 deletions(-)
  
  diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
  index 3f0519c..8ee1c8e 100644
  --- a/kernel/sched/fair.c
  +++ b/kernel/sched/fair.c
  @@ -846,29 +846,92 @@ static inline int task_faults_idx(int nid, int priv)
  return 2 * nid + priv;
   }
   
  -static unsigned long weighted_cpuload(const int cpu);
  +static unsigned long source_load(int cpu, int type);
  +static unsigned long target_load(int cpu, int type);
  +static unsigned long power_of(int cpu);
  +static long effective_load(struct task_group *tg, int cpu, long wl, long 
  wg);
  +
  +static int task_numa_find_cpu(struct task_struct *p, int nid)
  +{
  +   int node_cpu = cpumask_first(cpumask_of_node(nid));
  +   int cpu, src_cpu = task_cpu(p), dst_cpu = src_cpu;
  +   unsigned long src_load, dst_load;
  +   unsigned long min_load = ULONG_MAX;
  +   struct task_group *tg = task_group(p);
  +   s64 src_eff_load, dst_eff_load;
  +   struct sched_domain *sd;
  +   unsigned long weight;
  +   bool balanced;
  +   int imbalance_pct, idx = -1;
   
  +   /* No harm being optimistic */
  +   if (idle_cpu(node_cpu))
  +   return node_cpu;
   
  +   /*
  +* Find the lowest common scheduling domain covering the nodes of both
  +* the CPU the task is currently running on and the target NUMA node.
  +*/
  +   rcu_read_lock();
  +   for_each_domain(src_cpu, sd) {
  +   if (cpumask_test_cpu(node_cpu, sched_domain_span(sd))) {
  +   /*
  +* busy_idx is used for the load decision as it is the
  +* same index used by the regular load balancer for an
  +* active cpu.
  +*/
  +   idx = sd-busy_idx;
  +   imbalance_pct = sd-imbalance_pct;
  +   break;
  +   }
  +   }
  +   rcu_read_unlock();
   
  +   if (WARN_ON_ONCE(idx == -1))
  +   return src_cpu;
   
  +   /*
  +* XXX the below is mostly nicked from wake_affine(); we should
  +* see about sharing a bit if at all possible; also it might want
  +* some per entity weight love.
  +*/
  +   weight = p-se.load.weight;
   
  +   src_load = source_load(src_cpu, idx);
  +
  +   src_eff_load = 100 + (imbalance_pct - 100) / 2;
  +   src_eff_load *= power_of(src_cpu);
  +   src_eff_load *= src_load + effective_load(tg, src_cpu, -weight, 
  -weight);
 
 So did you try with this effective_load() term 'missing'?
 

Yes, it performed worse in tests. Looking at it, I figured that it would
have to perform worse unless effective_load regularly returns negative
values.

-- 
Mel Gorman
SUSE Labs
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: v3.11-rc1 USB regressions

2013-07-16 Thread Felipe Balbi
On Tue, Jul 16, 2013 at 11:08:36AM +0300, Felipe Balbi wrote:
 Hi,
 
 On Tue, Jul 16, 2013 at 12:30:00PM +0530, Kishon Vijay Abraham I wrote:
  On Tuesday 16 July 2013 12:03 PM, Daniel Mack wrote:
   Hi Aaro,
   
   On 16.07.2013 00:56, Aaro Koskinen wrote:
   Hi,
  
   I think USB tree introduced regressions in v3.11-rc1, at least for some
   OMAP devices using legacy boot.
   
   Thanks for checking the tree so early.
   
   I have only bisected these; I have no
   idea what the real fixes are but the following reverts make Nokia OMAP2+
   boards again usable for kernel development work (they need working USB
   connection for interacting with the device):
  
   1) USB peripheral mode (g_ether) is broken on Nokia N900, N950 and N9
  (USB_MUSB_OMAP2PLUS). To make it it work, I need to revert three
  commits:
  
09fc7d22b024692b2fe8a943b246de1af307132b
usb: musb: fix incorrect usage of resource pointer
(Reverting this fixes the g_ether probe failure couldn't find
 an available UDC)
  
  I've posted a patch fixing the issue
  http://comments.gmane.org/gmane.linux.usb.general/89541
  There were some comments on it. I'll be posting a new version for it.
 
 hmm, n8x0 used tusb6010, so perhaps a similar patch needs to be cooked
 for that too. Right now, let's to the minimum fix, which is just to
 increment the array size to 3 and for v3.12 we do the changes that I
 suggested.

this should solve the problem on n900 and n8x0, it's pretty much
kishon's original patch, so I guess it deserves his authorship:

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 6708a3b..f44e8b5 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -481,7 +481,7 @@ static u64 omap2430_dmamask = DMA_BIT_MASK(32);
 
 static int omap2430_probe(struct platform_device *pdev)
 {
-   struct resource musb_resources[2];
+   struct resource musb_resources[3];
struct musb_hdrc_platform_data  *pdata = pdev-dev.platform_data;
struct omap_musb_board_data *data;
struct platform_device  *musb;
@@ -581,6 +581,11 @@ static int omap2430_probe(struct platform_device *pdev)
musb_resources[1].end = pdev-resource[1].end;
musb_resources[1].flags = pdev-resource[1].flags;
 
+   musb_resources[2].name = pdev-resource[2].name;
+   musb_resources[2].start = pdev-resource[2].start;
+   musb_resources[2].end = pdev-resource[2].end;
+   musb_resources[2].flags = pdev-resource[2].flags;
+
ret = platform_device_add_resources(musb, musb_resources,
ARRAY_SIZE(musb_resources));
if (ret) {
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 2c06a89..6f8a9ca 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -1156,7 +1156,7 @@ static u64 tusb_dmamask = DMA_BIT_MASK(32);
 
 static int tusb_probe(struct platform_device *pdev)
 {
-   struct resource musb_resources[2];
+   struct resource musb_resources[3];
struct musb_hdrc_platform_data  *pdata = pdev-dev.platform_data;
struct platform_device  *musb;
struct tusb6010_glue*glue;
@@ -1199,6 +1199,11 @@ static int tusb_probe(struct platform_device *pdev)
musb_resources[1].end = pdev-resource[1].end;
musb_resources[1].flags = pdev-resource[1].flags;
 
+   musb_resources[2].name = pdev-resource[2].name;
+   musb_resources[2].start = pdev-resource[2].start;
+   musb_resources[2].end = pdev-resource[2].end;
+   musb_resources[2].flags = pdev-resource[2].flags;
+
ret = platform_device_add_resources(musb, musb_resources,
ARRAY_SIZE(musb_resources));
if (ret) {

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH] mm/hugetlb: per-vma instantiation mutexes

2013-07-16 Thread David Gibson
On Mon, Jul 15, 2013 at 05:12:31PM -0700, Davidlohr Bueso wrote:
 On Mon, 2013-07-15 at 16:08 -0700, Andrew Morton wrote:
  On Mon, 15 Jul 2013 17:24:32 +1000 David Gibson 
  da...@gibson.dropbear.id.au wrote:
  
   I have previously proposed a correct method of improving scalability,
   although it doesn't eliminate the lock.  That's to use a set of hashed
   mutexes.
  
  Yep - hashing the mutexes is an obvious and nicely localized way of
  improving this.  It's a tweak, not a design change.
  
  The changelog should describe the choice of the hash key with great
  precision, please.  It's important and is the first thing which
  reviewers and readers will zoom in on.

Yeah, that is important.

I no longer have much interest in the result of this patch, so I'll
leave it to others to do the forward port and cleanup.

But I will point out the gotcha here is that the hash key needs to be
based on (address_space  file offset) for MAP_SHARED, but (mm 
address) for MAP_PRIVATE.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


pgpNiJwXnZCrY.pgp
Description: PGP signature


[PATCH] pnp: avoid inaccurate resource name

2013-07-16 Thread shuox . liu
From: Liu ShuoX shuox@intel.com

Set temporary variable as 0 to avoid garbage string output from
/proc/iomem after register resources, and reset to pnp dev name.

Signed-off-by: Liu ShuoX shuox@intel.com
---
 drivers/pnp/pnpacpi/rsparser.c | 2 +-
 drivers/pnp/resource.c | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 9847ab1..167f3d0 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -180,7 +180,7 @@ static acpi_status pnpacpi_allocated_resource(struct 
acpi_resource *res,
struct pnp_dev *dev = data;
struct acpi_resource_dma *dma;
struct acpi_resource_vendor_typed *vendor_typed;
-   struct resource r;
+   struct resource r = {0};
int i, flags;
 
if (acpi_dev_resource_memory(res, r)
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index 3e6db1c..d95e101 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -515,6 +515,7 @@ struct pnp_resource *pnp_add_resource(struct pnp_dev *dev,
}
 
pnp_res-res = *res;
+   pnp_res-res.name = dev-name;
dev_dbg(dev-dev, %pR\n, res);
return pnp_res;
 }
-- 
1.8.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/3] ptrace.2: add description for PTRACE_PEEKSIGINFO

2013-07-16 Thread Andrey Vagin
Retrieve signals without removing them from a queue.

Signed-off-by: Andrey Vagin ava...@openvz.org
---
 man2/ptrace.2 | 39 +++
 1 file changed, 39 insertions(+)

diff --git a/man2/ptrace.2 b/man2/ptrace.2
index 5fcac2b..e74535e 100644
--- a/man2/ptrace.2
+++ b/man2/ptrace.2
@@ -317,6 +317,45 @@ itself.
 .RI ( addr
 is ignored.)
 .TP
+.BR PTRACE_PEEKSIGINFO  (since Linux 3.10)
+.\ commit 84c751bd4aebbaae995fe32279d3dba48327bad4
+Retrieve
+.I siginfo_t
+structures without removing signals from a queue.
+.I addr
+points to a
+.I ptrace_peeksiginfo_args
+structure.
+.I siginfo_t
+structures are copied into the buffer starting at
+.I data.
+The return value contains a number of copied signals (zero indicates
+that a signal with this sequence number doesn't exist).
+A result
+.I siginfo
+contains a kernel part of
+.IR si_code
+(
+.BR __SI_CHLD,
+.BR __SI_FAULT,
+etc), which is not shown in other places.
+.PP
+.in +10n
+.nf
+struct ptrace_peeksiginfo_args {
+   u64 off;/* from which siginfo to start */
+   u32 flags;
+   s32 nr; /* how may siginfos to take */
+};
+.fi
+
+Currently here is only one flag
+.BR PTRACE_PEEKSIGINFO_SHARED
+for dumping signals from process-wide queue.
+If this flag is not set, signals are read from a per-thread queue.
+.in
+.PP
+.TP
 .BR PTRACE_SETOPTIONS  (since Linux 2.4.6; see BUGS for caveats)
 Set ptrace options from
 .IR data .
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] ptrace.2: place GETSIGINFO and SETSIGINFO near each other

2013-07-16 Thread Andrey Vagin
Signed-off-by: Andrey Vagin ava...@openvz.org
---
 man2/ptrace.2 | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/man2/ptrace.2 b/man2/ptrace.2
index 0d77e3f..5fcac2b 100644
--- a/man2/ptrace.2
+++ b/man2/ptrace.2
@@ -255,18 +255,6 @@ On return, the kernel modifies
 .B iov.len
 to indicate the actual number of bytes returned.
 .TP
-.BR PTRACE_GETSIGINFO  (since Linux 2.3.99-pre6)
-Retrieve information about the signal that caused the stop.
-Copy a
-.I siginfo_t
-structure (see
-.BR sigaction (2))
-from the tracee to the address
-.I data
-in the tracer.
-.RI ( addr
-is ignored.)
-.TP
 .BR PTRACE_SETREGS ,  PTRACE_SETFPREGS
 Modify the tracee's general-purpose or floating-point registers,
 respectively, from the address
@@ -301,6 +289,18 @@ and
 is analogous to
 .BR PTRACE_GETREGSET .
 .TP
+.BR PTRACE_GETSIGINFO  (since Linux 2.3.99-pre6)
+Retrieve information about the signal that caused the stop.
+Copy a
+.I siginfo_t
+structure (see
+.BR sigaction (2))
+from the tracee to the address
+.I data
+in the tracer.
+.RI ( addr
+is ignored.)
+.TP
 .BR PTRACE_SETSIGINFO  (since Linux 2.3.99-pre6)
 Set signal information:
 copy a
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mm/hugetlb: per-vma instantiation mutexes

2013-07-16 Thread David Gibson
On Mon, Jul 15, 2013 at 09:51:21PM -0400, Rik van Riel wrote:
 On 07/15/2013 03:24 AM, David Gibson wrote:
 On Sun, Jul 14, 2013 at 08:16:44PM -0700, Davidlohr Bueso wrote:
 
 Reading the existing comment, this change looks very suspicious to me.
 A per-vma mutex is just not going to provide the necessary exclusion, is
 it?  (But I recall next to nothing about these regions and
 reservations.)
 
 A per-VMA lock is definitely wrong.  I think it handles one form of
 the race, between threads sharing a VM on a MAP_PRIVATE mapping.
 However another form of the race can and does occur between different
 MAP_SHARED VMAs in the same or different processes.  I think there may
 be edge cases involving mremap() and MAP_PRIVATE that will also be
 missed by a per-VMA lock.
 
 Note that the libhugetlbfs testsuite contains tests for both PRIVATE
 and SHARED variants of the race.
 
 Can we get away with simply using a mutex in the file?
 Say vma-vm_file-mapping-i_mmap_mutex?

So I don't know the VM well enough to know if this could conflict with
other usages of i_mmap_mutex.  But unfortunately, whether or not its
otherwise correct that approach won't address the scalability issue at
hand here.

In the case where the race matters, we're always dealing with the same
file.  Otherwise, we'd end up with a genuine, rather than spurious,
out-of-memory error, regardless of how the race turned out.

So in the case with the performance bottleneck we're considering, the
i_mmap_mutex approach degenerates to serialization on a single mutex,
just as before.

In order to improve scalability, we need to consider which page within
the file we're instantiating which is what the hash function in my
patch does.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


pgpMTETtH4O71.pgp
Description: PGP signature


Re: [PATCH -next 2/2] kbuild: fix for updated LZ4 tool with the new streaming format

2013-07-16 Thread Andrew Morton
On Tue, 16 Jul 2013 10:08:07 +0200 Yann E. MORIN yann.morin.1...@free.fr 
wrote:

  Or, easier and faster, run some front-end script which generates
  once-off Kconfig symbols.
  
  if [ -x /bin/lz4c ]
  then
  echo CONFIG_HAVE_LZ4C
  fi
  
  then munge the output of that script into the Kconfig run and do
  
  depends on HAVE_LZ4C
 
 Yes, this is a better solution.
 
 For what it's worth, this is what I'm doing in crosstool-NG: a script
 checks for optional pre-requisites, spits out a Kconfig blob which is
 included by the top-level Kconfig file.
 
 Here is a snippet of generated Kconfig blob:
 config HAVE_XZ
 def_bool y
 config HAVE_LZMA
 bool
 
 Which means we do have 'xz', but not 'lzma'. This is relatively trivial
 to do, so I'll tackle this this evening when I'm back home (unless
 someone beats me to it).

Cool, thanks.

It seems a bit inefficient to be evaluating commands in a Kconfig
setting where doesn't need that done.  For example, if someone has
selected LZO compression then they don't need to probe for lz4c.

That example sounds hard to solve in a simple fashion, but what about
the case where the config system is not going to look at an entire
subsystem?  Suppose for example, drivers/media/firewire wants to probe
for some executable, but the user hasn't selected firewire at all.

What I'm angling at is, rather than a single global front-end script,
can we embed the scripts in some fashion within the various Kconfig
files?  Say,

script ./some-script.sh

and the config system will only evaluate that command if it is working
on that Kconfig file.  Obviously that requires a multiple-pass thing.

It's late, but you see what I mean ;)

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] drm/i915: fix long-standing SNB regression in power consumption after resume

2013-07-16 Thread Chris Wilson
On Tue, Jul 16, 2013 at 09:44:59AM +0200, Daniel Vetter wrote:
 The issue I have with the current patch is that it looks a bit like
 duct-tape since the point where we drop the forcewake references seems to
 lack justification. The write to MBCTL itself will temporarily wake up the
 chip, so just wrapping that up in with forcewake is very likely not good
 enough. So I fear that we'll only hold forcewake long enough on most
 systems and still have a bunch of oddball broken systems out there.
 
 Holding forcewake otoh until we've fully set up rps/rc6 makes imo tons of
 sense, hence why I've brought up the idea. Same reasoning applies to
 extending the w/a to all systems supporting rc6.

In which case disable rc6 at the start of init gating and only enable it
at the end of the deferred task. That I think will better test your
hypothesis and make the transistion steps clearer.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [LOCKDEP] cpufreq: possible circular locking dependency detected

2013-07-16 Thread Srivatsa S. Bhat
Hi Peter,

On 07/16/2013 02:19 AM, Peter Wu wrote:
 Hi,
 
 I think I also encountered this similar issue after resume (and possibly a
 real deadlock yesterday before/during suspend?). One message:
 
 [   71.204848] ==
 [   71.204850] [ INFO: possible circular locking dependency detected ]
 [   71.204852] 3.11.0-rc1cold-8-g47188d3 #1 Tainted: GW   
 [   71.204854] ---
 [   71.204855] ondemand/2034 is trying to acquire lock:
 [   71.204857]  (cpu_hotplug.lock){+.+.+.}, at: [8104ba31] 
 get_online_cpus+0x41/0x60
 [   71.204869] 
 [   71.204869] but task is already holding lock:
 [   71.204870]  (per_cpu(cpu_policy_rwsem, cpu)){+.}, at: 
 [8151fba9] lock_policy_rwsem_write+0x39/0x40
 [   71.204879] 
 [   71.204879] which lock already depends on the new lock.
 [   71.204879] 
 [   71.204881] 
 [   71.204881] the existing dependency chain (in reverse order) is:
 [   71.204884] 
 - #1 (per_cpu(cpu_policy_rwsem, cpu)){+.}:
 [   71.204889][810ac130] lock_acquire+0x90/0x140
 [   71.204894][81660fe9] down_write+0x49/0x6b
 [   71.204898][8151fba9] lock_policy_rwsem_write+0x39/0x40
 [   71.204901][815213e0] cpufreq_update_policy+0x40/0x130
 [   71.204904][81522327] cpufreq_stat_cpu_callback+0x27/0x70
 [   71.204907][81668acd] notifier_call_chain+0x4d/0x70
 [   71.204911][8107730e] __raw_notifier_call_chain+0xe/0x10
 [   71.204915][8104b780] __cpu_notify+0x20/0x40
 [   71.204918][8104b916] _cpu_up+0x116/0x170
 [   71.204921][8164d540] enable_nonboot_cpus+0x90/0xe0
 [   71.204926][81098bd1] 
 suspend_devices_and_enter+0x301/0x420
 [   71.204930][81098ec0] pm_suspend+0x1d0/0x230
 [   71.205000][81097b2a] state_store+0x8a/0x100
 [   71.205005][8131559f] kobj_attr_store+0xf/0x30
 [   71.205009][811fac36] sysfs_write_file+0xe6/0x170
 [   71.205014][81183c5e] vfs_write+0xce/0x200
 [   71.205018][81184165] SyS_write+0x55/0xa0
 [   71.205022][8166d3c2] system_call_fastpath+0x16/0x1b
 [   71.205025] 
 - #0 (cpu_hotplug.lock){+.+.+.}:
 [   71.205093][810ab35c] __lock_acquire+0x174c/0x1ed0
 [   71.205096][810ac130] lock_acquire+0x90/0x140
 [   71.205099][8165f7b0] mutex_lock_nested+0x70/0x380
 [   71.205102][8104ba31] get_online_cpus+0x41/0x60
 [   71.205217][815247f8] gov_queue_work+0x28/0xc0
 [   71.205221][81524d97] cpufreq_governor_dbs+0x507/0x710
 [   71.205224][81522a17] od_cpufreq_governor_dbs+0x17/0x20
 [   71.205226][8151fec7] __cpufreq_governor+0x87/0x1c0
 [   71.205230][81520445] __cpufreq_set_policy+0x1b5/0x1e0
 [   71.205232][8152055a] store_scaling_governor+0xea/0x1f0
 [   71.205235][8151fcbd] store+0x6d/0xc0
 [   71.205238][811fac36] sysfs_write_file+0xe6/0x170
 [   71.205305][81183c5e] vfs_write+0xce/0x200
 [   71.205308][81184165] SyS_write+0x55/0xa0
 [   71.205311][8166d3c2] system_call_fastpath+0x16/0x1b
 [   71.205313] 
 [   71.205313] other info that might help us debug this:
 [   71.205313] 
 [   71.205315]  Possible unsafe locking scenario:
 [   71.205315] 
 [   71.205317]CPU0CPU1
 [   71.205318]
 [   71.205383]   lock(per_cpu(cpu_policy_rwsem, cpu));
 [   71.205386]lock(cpu_hotplug.lock);
 [   71.205389]lock(per_cpu(cpu_policy_rwsem, 
 cpu));
 [   71.205392]   lock(cpu_hotplug.lock);
 [   71.205509] 
 [   71.205509]  *** DEADLOCK ***
 [   71.205509] 
 [   71.205511] 4 locks held by ondemand/2034:
 [   71.205512]  #0:  (sb_writers#6){.+.+.+}, at: [81183d63] 
 vfs_write+0x1d3/0x200
 [   71.205520]  #1:  (buffer-mutex){+.+.+.}, at: [811fab94] 
 sysfs_write_file+0x44/0x170
 [   71.205640]  #2:  (s_active#178){.+.+.+}, at: [811fac1d] 
 sysfs_write_file+0xcd/0x170
 [   71.205648]  #3:  (per_cpu(cpu_policy_rwsem, cpu)){+.}, at: 
 [8151fba9] lock_policy_rwsem_write+0x39/0x40
 [   71.205655] 
 [   71.205655] stack backtrace:
 [   71.205658] CPU: 1 PID: 2034 Comm: ondemand Tainted: GW
 3.11.0-rc1cold-8-g47188d3 #1
 [   71.205660] Hardware name: Gigabyte Technology Co., Ltd. To be filled by 
 O.E.M./Z68X-UD3H-B3, BIOS U1l 03/08/2013
 [   71.205773]  8218fd20 8805fc5d38e8 8165b74d 
 
 [   71.205778]  8211f130 8805fc5d3938 81657cef 
 8218fd20
 [   71.205783]  8805fc5d39c0 8805fc5d3938 880603726678 
 

Re: perf documentation: update format and events ABI files

2013-07-16 Thread Jiri Olsa
On Mon, Jul 15, 2013 at 05:04:50PM -0400, Vince Weaver wrote:

SNIP

 diff --git a/Documentation/ABI/testing/sysfs-bus-event_source-devices-events 
 b/Documentation/ABI/testing/sysfs-bus-event_source-devices-events
 index 3c1cc24..43aae08 100644
 --- a/Documentation/ABI/testing/sysfs-bus-event_source-devices-events
 +++ b/Documentation/ABI/testing/sysfs-bus-event_source-devices-events
 @@ -1,30 +1,51 @@
 -What:/sys/devices/cpu/events/
 +What:/sys/bus/event_source/devices/dev/events
 +
 +Date:2013/01/08
 +
 +Contact: Linux kernel mailing list linux-kernel@vger.kernel.org
 +
 +Description: Generic performance monitoring events
 +
 + A collection of performance monitoring events that are
 + supported by the PMU (performance monitoring unit)
 + specified by dev. These events can be monitored
 + using the 'perf(1)' tool.
 +
 + The contents of each file is a list of attribute names
 + (as found in the corresponding
 + /sys/bus/event_source/devices/dev/format
 + file) separated by commas.  Each entry has
 + an optional value (either hex or decimal).  If no
 + value is specified than it is assumed to be a single-bit
 + field with a value of 1.
 +
 + An example of what you might find:
 + event=0x2,inv,ldlat=3
 +
 +
 +What:/sys/devices/cpu/events/branch-instructions
   /sys/devices/cpu/events/branch-misses
 - /sys/devices/cpu/events/cache-references
 + /sys/devices/cpu/events/bus-cycles
   /sys/devices/cpu/events/cache-misses
 - /sys/devices/cpu/events/stalled-cycles-frontend
 - /sys/devices/cpu/events/branch-instructions
 - /sys/devices/cpu/events/stalled-cycles-backend
 - /sys/devices/cpu/events/instructions
 + /sys/devices/cpu/events/cache-references
   /sys/devices/cpu/events/cpu-cycles

missing:
/sys/devices/cpu/events/ref-cycles

 + /sys/devices/cpu/events/instructions
 + /sys/devices/cpu/events/stalled-cycles-backend
 + /sys/devices/cpu/events/stalled-cycles-frontend

SNIP

  
  What:/sys/devices/cpu/events/PM_1PLUS_PPC_CMPL
 diff --git a/Documentation/ABI/testing/sysfs-bus-event_source-devices-format 
 b/Documentation/ABI/testing/sysfs-bus-event_source-devices-format
 index 77f47ff..4f7ee5e 100644
 --- a/Documentation/ABI/testing/sysfs-bus-event_source-devices-format
 +++ b/Documentation/ABI/testing/sysfs-bus-event_source-devices-format
 @@ -15,6 +15,12 @@ Description:
   attr2 = 'config:0-7'
   attr3 = 'config:12-35'
  
 - Example: 'config1:1,6-10,44'
 + Example: event = 'config1:1,6-10,44'
   Defines contents of attribute that occupies bits 1,6-10,44 of
   perf_event_attr::config1.
 +
 + In this example, the events file would have the value 

nit, whitespace at the end of the above line 

 + event=0x7f
 + to set all of the specified bits (they will be split up).
 + You would not use 0x1007c2 (which is what the bits
 + actually passed into config1 would look like).

thanks,
jirka
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


chown: s-Bits: to clear or not to clear

2013-07-16 Thread Ulrich Windl
Hi folks,

I discovered (SLES11 SP2 with kernel  3.0.80) that a chown executed by root 
(from non-root to non-root user) clears any s-Bits that were set for the old 
owner.

The man page (man 2 chown) says:
   When  the  owner  or  group of an executable file are changed by a non-
   superuser, the S_ISUID and S_ISGID mode bits are cleared.   POSIX  does
   not specify whether this also should happen when root does the chown();
   the Linux behavior depends on the kernel version.  In case  of  a  non-
   group-executable  file (i.e., one for which the S_IXGRP bit is not set)
   the S_ISGID bit indicates mandatory locking, and is not  cleared  by  a
   chown().

As there are good arguments for and against clearing the s-Bits during chown, 
there are probably only good arguments for having an option for chown(1) to 
preserve the s-Bits. What do you think? (I know this is the wrong list for 
discussing utils).

Regards,
Ulrich Windl


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH RFT] regulator: as3711: Convert to use linear ranges

2013-07-16 Thread Axel Lin
The SD, ALDO, and DLDO vlotage tables are composed of linear ranges.
This patch converts as3711 to use newly introduced helpers for multiple
linear ranges.

Below is the voltage table on datasheet:

SD:
00h: DC/DC powered down
01h-40h: Volt = 0.6V + sdx_vsel * 12.5mV
41h-70h: Volt = 1.4V + (sdx_vsel - 40h) * 25mV
71h-7Fh: Volt = 2.6V + (sdx_vsel - 70h) * 50mV

ALDO:
0h-0Fh:  1.2V + ldox_vsel * 50mV
10h-1Fh: 1.8V + (ldox_vsel - 10h) * 100mV

DLDO:
00h-10h: Volt = 0.9V + ldox_vsel * 50mV
11h-1fh: Do not use
20h-3fh: Volt = 1.75V + (ldox_vsel - 20h) * 50mV

Note, when convert to use linear ranges APIs, the equation for SD needs below
adjustment because the linear ranges APIs wiil substract range-min_sel when
apply the equation.

SD ( the equation to be used with linear ranges APIs )
01h-40h: Volt = 0.6125V + (sdx_vsel - 1h) * 12.5mV
41h-70h: Volt = 1.425V + (sdx_vsel - 41h) * 25mV
71h-7Fh: Volt = 2.650V + (sdx_vsel - 71h) * 50mV

Signed-off-by: Axel Lin axel@ingics.com
---
 drivers/regulator/as3711-regulator.c | 163 +++
 1 file changed, 31 insertions(+), 132 deletions(-)

diff --git a/drivers/regulator/as3711-regulator.c 
b/drivers/regulator/as3711-regulator.c
index 3da6bd6..7b7da90 100644
--- a/drivers/regulator/as3711-regulator.c
+++ b/drivers/regulator/as3711-regulator.c
@@ -30,102 +30,6 @@ struct as3711_regulator {
struct regulator_dev *rdev;
 };
 
-static int as3711_list_voltage_sd(struct regulator_dev *rdev,
- unsigned int selector)
-{
-   if (selector = rdev-desc-n_voltages)
-   return -EINVAL;
-
-   if (!selector)
-   return 0;
-   if (selector  0x41)
-   return 60 + selector * 12500;
-   if (selector  0x71)
-   return 140 + (selector - 0x40) * 25000;
-   return 260 + (selector - 0x70) * 5;
-}
-
-static int as3711_list_voltage_aldo(struct regulator_dev *rdev,
-   unsigned int selector)
-{
-   if (selector = rdev-desc-n_voltages)
-   return -EINVAL;
-
-   if (selector  0x10)
-   return 120 + selector * 5;
-   return 180 + (selector - 0x10) * 10;
-}
-
-static int as3711_list_voltage_dldo(struct regulator_dev *rdev,
-   unsigned int selector)
-{
-   if (selector = rdev-desc-n_voltages ||
-   (selector  0x10  selector  0x20))
-   return -EINVAL;
-
-   if (selector  0x11)
-   return 90 + selector * 5;
-   return 175 + (selector - 0x20) * 5;
-}
-
-static int as3711_bound_check(struct regulator_dev *rdev,
- int *min_uV, int *max_uV)
-{
-   struct as3711_regulator *reg = rdev_get_drvdata(rdev);
-   struct as3711_regulator_info *info = reg-reg_info;
-
-   dev_dbg(rdev-dev, %s(), %d, %d, %d\n, __func__,
-   *min_uV, rdev-desc-min_uV, info-max_uV);
-
-   if (*max_uV  *min_uV ||
-   *min_uV  info-max_uV || rdev-desc-min_uV  *max_uV)
-   return -EINVAL;
-
-   if (rdev-desc-n_voltages == 1)
-   return 0;
-
-   if (*max_uV  info-max_uV)
-   *max_uV = info-max_uV;
-
-   if (*min_uV  rdev-desc-min_uV)
-   *min_uV = rdev-desc-min_uV;
-
-   return *min_uV;
-}
-
-static int as3711_sel_check(int min, int max, int bottom, int step)
-{
-   int sel, voltage;
-
-   /* Round up min, when dividing: keeps us within the range */
-   sel = DIV_ROUND_UP(min - bottom, step);
-   voltage = sel * step + bottom;
-   pr_debug(%s(): select %d..%d in %d+N*%d: %d\n, __func__,
-  min, max, bottom, step, sel);
-   if (voltage  max)
-   return -EINVAL;
-
-   return sel;
-}
-
-static int as3711_map_voltage_sd(struct regulator_dev *rdev,
-int min_uV, int max_uV)
-{
-   int ret;
-
-   ret = as3711_bound_check(rdev, min_uV, max_uV);
-   if (ret = 0)
-   return ret;
-
-   if (min_uV = 140)
-   return as3711_sel_check(min_uV, max_uV, 60, 12500);
-
-   if (min_uV = 260)
-   return as3711_sel_check(min_uV, max_uV, 140, 25000) + 0x40;
-
-   return as3711_sel_check(min_uV, max_uV, 260, 5) + 0x70;
-}
-
 /*
  * The regulator API supports 4 modes of operataion: FAST, NORMAL, IDLE and
  * STANDBY. We map them in the following way to AS3711 SD1-4 DCDC modes:
@@ -180,44 +84,14 @@ static unsigned int as3711_get_mode_sd(struct 
regulator_dev *rdev)
return -EINVAL;
 }
 
-static int as3711_map_voltage_aldo(struct regulator_dev *rdev,
- int min_uV, int max_uV)
-{
-   int ret;
-
-   ret = as3711_bound_check(rdev, min_uV, max_uV);
-   if (ret = 0)
-   return ret;
-
-   if (min_uV = 180)
-   return as3711_sel_check(min_uV, max_uV, 120, 5);
-
-   

Re: perf documentation: update Documentation/ABI/testing with missing perf-related files

2013-07-16 Thread Jiri Olsa
On Mon, Jul 15, 2013 at 05:38:15PM -0400, Vince Weaver wrote:
 
 Add documentation for various files perf_event creates under
 /sys/bus/event_source/devices/dev/
 
 Signed-off-by: Vince Weaver vincent.wea...@maine.edu
 
 diff --git a/Documentation/ABI/testing/sysfs-bus-event_source-devices 
 b/Documentation/ABI/testing/sysfs-bus-event_source-devices
 new file mode 100644
 index 000..ffa2e4b
 --- /dev/null
 +++ b/Documentation/ABI/testing/sysfs-bus-event_source-devices
 @@ -0,0 +1,50 @@
 +What:/sys/bus/event_source/devices/dev/cpumask
 +
 +Date:2012/09/10
 + 

nit, white space above

 +Contact: Linux kernel mailing list linux-kernel@vger.kernel.org
 +
 +Description: This value holds a representative core for each
 + socket in a system.  It is meant to help when
 + creating a perf_event event for socket-wide events
 + like uncore and northbridge events.
 +
 + The format is a comma separated list of cpu numbers,
 + one for each socket in the system that the PMU in
 + question can run on.
 +
 + For example, on a two-socket Sandybridge-EP machine and
 + the cbox0 uncore the value of the file will be:
 + 0,8
 + 

nit, white space above

 +
 +
 +What:/sys/bus/event_source/devices/cpu/rdpmc
 +
 +Date:2011/11/20
 +
 +Contact: Linux kernel mailing list linux-kernel@vger.kernel.org
 +
 +Description: Indicates whether a CPU allows userspace rdpmc
 + instructions (unprivileged reads of the performance
 + counter MSRs).
 +
 + You can echo 0 to this value to disable user rdpmc
 + access.
 +
 +
 +
 +What:/sys/bus/event_source/devices/dev/type
 +
 +Date:2013/01/08
 +
 +Contact: Linux kernel mailing list linux-kernel@vger.kernel.org
 +
 +Description: This value holds the PMU (Performance Monitor Unit) type
 + value that is passed into the perf_event_open()
 + attr:type field when opening an event.
 +
 + The value is a decimal integer.
 +
 +
 +

Acked-by: Jiri Olsa jo...@redhat.com

thanks,
jirka
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [LOCKDEP] cpufreq: possible circular locking dependency detected

2013-07-16 Thread Srivatsa S. Bhat
On 07/16/2013 04:50 AM, Sergey Senozhatsky wrote:
 On (07/15/13 18:49), Srivatsa S. Bhat wrote:
 [..]
 So here is the solution:

 On 3.11-rc1, apply these patches in the order mentioned below, and check
 whether it fixes _all_ problems (both the warnings about IPI as well as the
 lockdep splat).

 1. Patch given in:  https://lkml.org/lkml/2013/7/11/661
(Just apply patch 1, not the entire patchset).

 2. Apply the patch shown below, on top of the above patch:

 ---

 
 Hello Srivatsa,
 Thanks, I'll test a bit later -- in the morning. (laptop stopped resuming from
 suspend, probably radeon dmp).
 
 

Sure, thanks!

 
 Shouldn't we also kick the console lock?
 
 
  kernel/printk.c | 3 +++
  1 file changed, 3 insertions(+)
 
 diff --git a/kernel/printk.c b/kernel/printk.c
 index d37d45c..3e20233 100644
 --- a/kernel/printk.c
 +++ b/kernel/printk.c
 @@ -1926,8 +1926,11 @@ static int __cpuinit console_cpu_notify(struct 
 notifier_block *self,
  {
   switch (action) {
   case CPU_ONLINE:
 + case CPU_ONLINE_FROZEN:
   case CPU_DEAD:
 + case CPU_DEAD_FROZEN:
   case CPU_DOWN_FAILED:
 + case CPU_DOWN_FAILED_FROZEN:
   case CPU_UP_CANCELED:
   console_lock();
   console_unlock();
 
 

No need. suspend_console() and resume_console() already handle it
properly in the suspend/resume case, from what I can see.

Regards,
Srivatsa S. Bhat

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 0/7] cpufreq:boost: CPU Boost mode support

2013-07-16 Thread Viresh Kumar
On 16 July 2013 12:56, Lukasz Majewski l.majew...@samsung.com wrote:
 Dear Viresh, Rafael,

 On Thu, 04 Jul 2013 10:50:23 +0200, Lukasz Majewski wrote:

 Dear Viresh, Rafael

 Do you have any comments/feedback for me regarding those patches?


 Will you find time to review version 5 of cpufreq boost patch series?

This is a request or an order ?? :)

Yes, I have still kept these mails in my todo list.. Don't worry they wouldn't
be missed.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/4] pinmux: Add TB10x pinmux driver

2013-07-16 Thread Christian Ruppert
On Wed, Jul 10, 2013 at 01:27:52PM -0600, Stephen Warren wrote:
 On 07/08/2013 07:02 AM, Christian Ruppert wrote:
 ...
  OK, a small drawing of our hardware should make this clear, let's take
  an imaginary example of one port with 10 pins, one i2c interface, one
  spi interface and one GPIO bank:
  
| mux N-1|
++
||  2
|+--/-- i2c
||
 10 ||  4
 Pins  --/--+ mux N  +--/-- spi
||
||  10
|+--/-- GPIO
||
++
| mux N+1|
 
  This example shows the mux N inside the pin controller. It controls
  all pins associated to port N through a single register value M. Let's
  assume the pins are configured as follows in function of the register
  value:
  
   pin  M=0   M=1 M=2  M=3
0  GPIO0   SPI_MISO  GPIO0   SPI_MISO
1  GPIO1   SPI_MOSI  GPIO1   SPI_MOSI
2  GPIO2SPI_CK   GPIO2SPI_CK
3  GPIO3SPI_CS   GPIO3SPI_CS
4  GPIO4GPIO4GPIO4GPIO4
5  GPIO5GPIO5GPIO5GPIO5
6  GPIO6GPIO6GPIO6GPIO6
7  GPIO7GPIO7GPIO7GPIO7
8  GPIO8GPIO8   I2C_SDA  I2C_SDA
9  GPIO9GPIO9   I2C_SCL  I2C_SCL
 
 
 In that scenario, in the language of Linux's pinctrl subsystem, what you
 have is:
 
 10 pins, named 0..9
 1 pin group, named perhaps mux N.
 4 different functions; values M==0, 1, 2, 3.
 
  We now have three pin groups defined, corresponding to the chip-side
  ports of the pin controller:
  GPIO = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
  SPI  = {0, 1, 2, 3}
  I2C  = {8, 9}
 
 You would usually only define pin groups for the pin/ball/package side
 of the pinmux HW. IIRC, you're also wanting to define pin groups for the
 intra-chip side of the pinmux HW. However, you're not muxing functions
 onto those pingroups; they're just there to help with naming the
 GPIO-pinmux mapping. You only mux functions onto the pin/ball/package
 side pins/pingroups.

Well, the GPIO-pinmux mapping is not the only reason for defining
these groups wrt. the chip-side of the pin controller. The other reasons
are:
  - Make different interfaces on the same MUX orthogonal wrt. each
other, i.e. make it possible to request one independently of the
other. In the example above, SPI and I2C can be requested completely
independently and the pin controller driver decides which mode to
use.
  - Make pin allocation more fine-grained (in the example above, only
pins 0-4 are allocated in case SPI is requested). This makes
GPIO-interface pin conflict management more natural.
BTW: When managing conflicts between hardware interfaces and GPIOs,
this scheme actually leads to _less_ pin groups than if we defined
one group at the pin side and four different modes:
chip-side groups: GPIO, SPI, I2C
  = 3 groups.
pin-side groups:  MUX_N, GPIOS_M0, GPIOS_M1, GPIOS_M2, GPIOS_M3
  in our special case MUX_N and GPIOS_M0 are the
  same.
  = 4 groups (or 5 in the general case).
It is true that GPIO_Mx don't need to be named but they need to be
defined inside the driver nevertheless.

  abilis,pingrp now specifies one of the three pin groups. Note that I2C
 and SPI can be requested independently in a completely orthogonal
 manner: The information if I2C is reqired or not is confined to
 the I2C request and does not leak into the SPI request as would
 be the case if we configured the entire port at the same time.
 
 The pingrp should represent the pin/ball/package side pins/groups. In
 this case, it should specify N.
 
  abilis,ioport specifies N.
 
 That is replaced be pingrp.
 
  abilis,ioconf specifies M.
 
 That'd be better named function or something like that, in order to
 indicate that it specifies which function is mux'd onto the specified
 pin(s)/pingroup(s).

-- 
  Christian Ruppert  ,  christian.rupp...@abilis.com
/|
  Tel: +41/(0)22 816 19-42 //| 3, Chemin du Pré-Fleuri
 _// | bilis Systems   CH-1228 Plan-les-Ouates
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 1/7] cpufreq: Store cpufreq policies in a list

2013-07-16 Thread Viresh Kumar
On 4 July 2013 14:20, Lukasz Majewski l.majew...@samsung.com wrote:
 diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c

 @@ -2056,6 +2058,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver 
 *driver)
 subsys_interface_unregister(cpufreq_interface);
 unregister_hotcpu_notifier(cpufreq_cpu_notifier);

 +   list_del(cpufreq_policy_list);

You can't delete the list this way... You must have passed the list
entry you wanted to delete. More precisely link from the struct
cpufreq_policy.

Over that, it shouldn't be done at the time of unregistering cpufreq
driver but as and when cpus are removed and _cpu_remove_dev
is called.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: linux-next: Tree for Jul 15 (usb gadget and rdnis)

2013-07-16 Thread Andrzej Pietrasiewicz
Hello, 

On Monday, July 15, 2013 5:55 PM Randy Dunlap wrote:

 On 07/14/13 20:45, Stephen Rothwell wrote:
  Hi all,
 
  The merge window is closed.  Time to clean up all those unclean trees.
  The good among you can just fast forward to v3.11-rc1 ;-)
 
  Changes since 20130712:
 
 
 on x86_64:
 
 ERROR: rndis_msg_parser [drivers/usb/gadget/usb_f_rndis.ko] undefined!
 ERROR: rndis_signal_disconnect [drivers/usb/gadget/usb_f_rndis.ko]
 undefined!
 ERROR: rndis_get_next_response [drivers/usb/gadget/usb_f_rndis.ko]
 undefined!
 ERROR: rndis_signal_connect [drivers/usb/gadget/usb_f_rndis.ko]
 undefined!
 ERROR: rndis_set_param_vendor [drivers/usb/gadget/usb_f_rndis.ko]
 undefined!
 ERROR: rndis_register [drivers/usb/gadget/usb_f_rndis.ko] undefined!
 ERROR: rndis_uninit [drivers/usb/gadget/usb_f_rndis.ko] undefined!
 ERROR: rndis_deregister [drivers/usb/gadget/usb_f_rndis.ko] undefined!
 ERROR: rndis_rm_hdr [drivers/usb/gadget/usb_f_rndis.ko] undefined!
 ERROR: rndis_free_response [drivers/usb/gadget/usb_f_rndis.ko]
undefined!
 ERROR: rndis_add_hdr [drivers/usb/gadget/usb_f_rndis.ko] undefined!
 ERROR: rndis_set_host_mac [drivers/usb/gadget/usb_f_rndis.ko] undefined!
 ERROR: rndis_set_param_medium [drivers/usb/gadget/usb_f_rndis.ko]
 undefined!
 ERROR: rndis_set_param_dev [drivers/usb/gadget/usb_f_rndis.ko]
undefined!
 
 
 Full randconfig file is attached.
 
 

There is a patch for that:

http://www.mail-archive.com/linux-usb@vger.kernel.org/msg24015.html

Andrzej


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC 0/4] Transparent on-demand struct page initialization embedded in the buddy allocator

2013-07-16 Thread Joonsoo Kim
On Fri, Jul 12, 2013 at 10:27:56AM +0200, Ingo Molnar wrote:
 
 * Robin Holt h...@sgi.com wrote:
 
  [...]
  
  With this patch, we did boot a 16TiB machine.  Without the patches, the 
  v3.10 kernel with the same configuration took 407 seconds for 
  free_all_bootmem.  With the patches and operating on 2MiB pages instead 
  of 1GiB, it took 26 seconds so performance was improved.  I have no feel 
  for how the 1GiB chunk size will perform.
 
 That's pretty impressive.
 
 It's still a 15x speedup instead of a 512x speedup, so I'd say there's 
 something else being the current bottleneck, besides page init 
 granularity.
 
 Can you boot with just a few gigs of RAM and stuff the rest into hotplug 
 memory, and then hot-add that memory? That would allow easy profiling of 
 remaining overhead.
 
 Side note:
 
 Robert Richter and Boris Petkov are working on 'persistent events' support 
 for perf, which will eventually allow boot time profiling - I'm not sure 
 if the patches and the tooling support is ready enough yet for your 
 purposes.
 
 Robert, Boris, the following workflow would be pretty intuitive:
 
  - kernel developer sets boot flag: perf=boot,freq=1khz,size=16MB
 
  - we'd get a single (cycles?) event running once the perf subsystem is up
and running, with a sampling frequency of 1 KHz, sending profiling
trace events to a sufficiently sized profiling buffer of 16 MB per
CPU.
 
  - once the system reaches SYSTEM_RUNNING, profiling is stopped either
automatically - or the user stops it via a new tooling command.
 
  - the profiling buffer is extracted into a regular perf.data via a
special 'perf record' call or some other, new perf tooling 
solution/variant.
 
[ Alternatively the kernel could attempt to construct a 'virtual'
  perf.data from the persistent buffer, available via /sys/debug or
  elsewhere in /sys - just like the kernel constructs a 'virtual' 
  /proc/kcore, etc. That file could be copied or used directly. ]

Hello, Robert, Boris, Ingo.

How about executing a perf in usermodehelper and collecting output in
tmpfs? Using this approach, we can start a perf after rootfs
initialization, because we need a perf binary at least. But we can use
almost functionality of perf. If anyone have interest with
this approach, I will send patches implementing this idea.

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] powerpc/8xx: Remove last traces of 8XX_MINIMAL_FPEMU

2013-07-16 Thread Paul Bolle
The Kconfig symbol 8XX_MINIMAL_FPEMU was removed in commit 968219fa33
(powerpc/8xx: Remove 8xx specific minimal FPU emulation). But that
commit didn't remove all code depending on that symbol. Do so now.

Signed-off-by: Paul Bolle pebo...@tiscali.nl
---
Not even compile tested!

 arch/powerpc/include/asm/emulated_ops.h |   2 -
 arch/powerpc/kernel/Makefile|   2 -
 arch/powerpc/kernel/softemu8xx.c| 199 
 3 files changed, 203 deletions(-)
 delete mode 100644 arch/powerpc/kernel/softemu8xx.c

diff --git a/arch/powerpc/include/asm/emulated_ops.h 
b/arch/powerpc/include/asm/emulated_ops.h
index 63f2a22..5a8b82a 100644
--- a/arch/powerpc/include/asm/emulated_ops.h
+++ b/arch/powerpc/include/asm/emulated_ops.h
@@ -46,8 +46,6 @@ extern struct ppc_emulated {
struct ppc_emulated_entry unaligned;
 #ifdef CONFIG_MATH_EMULATION
struct ppc_emulated_entry math;
-#elif defined(CONFIG_8XX_MINIMAL_FPEMU)
-   struct ppc_emulated_entry 8xx;
 #endif
 #ifdef CONFIG_VSX
struct ppc_emulated_entry vsx;
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index a8619bf..d706e58 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -117,8 +117,6 @@ obj-$(CONFIG_DYNAMIC_FTRACE)+= ftrace.o
 obj-$(CONFIG_FUNCTION_GRAPH_TRACER)+= ftrace.o
 obj-$(CONFIG_FTRACE_SYSCALLS)  += ftrace.o
 
-obj-$(CONFIG_8XX_MINIMAL_FPEMU) += softemu8xx.o
-
 ifneq ($(CONFIG_PPC_INDIRECT_IO),y)
 obj-y  += iomap.o
 endif
diff --git a/arch/powerpc/kernel/softemu8xx.c b/arch/powerpc/kernel/softemu8xx.c
deleted file mode 100644
index 29b2f81..000
--- a/arch/powerpc/kernel/softemu8xx.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Software emulation of some PPC instructions for the 8xx core.
- *
- * Copyright (C) 1998 Dan Malek (dma...@jlc.net)
- *
- * Software floating emuation for the MPC8xx processor.  I did this mostly
- * because it was easier than trying to get the libraries compiled for
- * software floating point.  The goal is still to get the libraries done,
- * but I lost patience and needed some hacks to at least get init and
- * shells running.  The first problem is the setjmp/longjmp that save
- * and restore the floating point registers.
- *
- * For this emulation, our working registers are found on the register
- * save area.
- */
-
-#include linux/errno.h
-#include linux/sched.h
-#include linux/kernel.h
-#include linux/mm.h
-#include linux/stddef.h
-#include linux/unistd.h
-#include linux/ptrace.h
-#include linux/user.h
-#include linux/interrupt.h
-
-#include asm/pgtable.h
-#include asm/uaccess.h
-#include asm/io.h
-
-/* Eventually we may need a look-up table, but this works for now.
-*/
-#define LFS48
-#define LFD50
-#define LFDU   51
-#define STFD   54
-#define STFDU  55
-#define FMR63
-
-void print_8xx_pte(struct mm_struct *mm, unsigned long addr)
-{
-   pgd_t *pgd;
-   pmd_t *pmd;
-   pte_t *pte;
-
-   printk( pte @ 0x%8lx: , addr);
-   pgd = pgd_offset(mm, addr  PAGE_MASK);
-   if (pgd) {
-   pmd = pmd_offset(pud_offset(pgd, addr  PAGE_MASK),
-addr  PAGE_MASK);
-   if (pmd  pmd_present(*pmd)) {
-   pte = pte_offset_kernel(pmd, addr  PAGE_MASK);
-   if (pte) {
-   printk( (0x%08lx)-(0x%08lx)-0x%08lx\n,
-   (long)pgd, (long)pte, 
(long)pte_val(*pte));
-#define pp ((long)pte_val(*pte))
-   printk( RPN: %05lx PP: %lx SPS: %lx SH: %lx 
-  CI: %lx v: %lx\n,
-  pp12,/* rpn */
-  (pp10)3, /* pp */
-  (pp3)1, /* small */
-  (pp2)1, /* shared */
-  (pp1)1, /* cache inhibit */
-  pp1   /* valid */
-  );
-#undef pp
-   }
-   else {
-   printk(no pte\n);
-   }
-   }
-   else {
-   printk(no pmd\n);
-   }
-   }
-   else {
-   printk(no pgd\n);
-   }
-}
-
-int get_8xx_pte(struct mm_struct *mm, unsigned long addr)
-{
-   pgd_t *pgd;
-   pmd_t *pmd;
-   pte_t *pte;
-   int retval = 0;
-
-   pgd = pgd_offset(mm, addr  PAGE_MASK);
-   if (pgd) {
-   pmd = pmd_offset(pud_offset(pgd, addr  PAGE_MASK),
-addr  PAGE_MASK);
-   if (pmd  pmd_present(*pmd)) {
-   pte = pte_offset_kernel(pmd, addr  PAGE_MASK);
-   if (pte) {
-   retval = (int)pte_val(*pte);
-   }
-

Re: [PATCH 7/8] cpufreq: Preserve policy structure across suspend/resume

2013-07-16 Thread Srivatsa S. Bhat
On 07/16/2013 11:45 AM, Viresh Kumar wrote:
 On 15 July 2013 15:35, Srivatsa S. Bhat
 srivatsa.b...@linux.vnet.ibm.com wrote:
 Actually even I was wondering about this while writing the patch and
 I even tested shutdown after multiple suspend/resume cycles, to verify that
 the refcount is messed up. But surprisingly, things worked just fine.

 Logically there should've been a refcount mismatch and things should have
 failed, but everything worked fine during my tests. Apart from suspend/resume
 and shutdown tests, I even tried mixing a few regular CPU hotplug operations
 (echo 0/1 to sysfs online files), but nothing stood out.

 Sorry, I forgot to document this in the patch. Either the patch is wrong
 or something else is silently fixing this up. Not sure what is the exact
 situation.
 
 To understand it I actually applied your patches to get better view of the 
 code.
 (Haven't tested it though).. And found that your code is doing the right thing
 and we shouldn't get a mismatch.. This is the sequence of events I can draw:
 
 - __cpu_add_dev() for first cpu. sets the refcount to 'x', where x are
 the no. of
 cpus in its clock domain.
 - _cpu_add_dev() for other cpus: doesn't change anything in refcount
 
 - Suspend:
  - cpu_remove_dev() for all cpus, due to frozen flag we don't touch the value
 of count
 - Resume:
  - cpu_add_dev() for all cpus, due to frozen flag we don't touch the
 value of count.


Actually this one is tricky (I took a look again). So we have this code in the
beginning of _cpufreq_add_dev():


1008 #ifdef CONFIG_SMP
1009 /* check whether a different CPU already registered this
1010  * CPU because it is in the same boat. */
1011 policy = cpufreq_cpu_get(cpu);
1012 if (unlikely(policy)) {
1013 cpufreq_cpu_put(policy);
1014 return 0;
1015 }

The _get() is not controlled by the frozen flag, but it still doesn't take a
refcount because of a subtle reason: per_cpu(cpufreq_cpu_data, cpu) was set to
NULL in __cpufreq_remove_dev() and the memory was saved away in fallback 
storage.
So, when __cpufreq_cpu_get() executes, it sees:

 204 /* get the CPU */
 205 data = per_cpu(cpufreq_cpu_data, cpu);
 206 
 207 if (!data)
 208 goto err_out_put_module;

Thus, since data is NULL, cpufreq_cpu_get() won't take a refcount and will 
return
silently.

Further down in __cpufreq_add_dev(), we restore the original memory, using
the frozen flag:

1037 if (frozen)
1038 /* Restore the saved policy when doing light-weight init */
1039 policy = cpufreq_policy_restore(cpu);
1040 else
1041 policy = cpufreq_policy_alloc();


So that is how we manage to fool cpufreq_cpu_get() into not taking a fresh
refcount while resuming :)
 
 And so things work as expected. That's why your code isn't breaking anything I
 believe.
 

Thanks a lot for the code inspection and your detailed analysis!

 But can no. of cpus change inbetween suspend/resume? Then count would be
 tricky as we are using the same policy structure.
 

No, number of CPUs won't change in between suspend/resume. Even if somebody
tried that, that would be an eccentric case and we won't handle that.
Besides, *many more* things will break than just cpufreq, if somebody actually
tries that out!

Regards,
Srivatsa S. Bhat

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] i2c-omap: always send stop after nack

2013-07-16 Thread Hein Tibosch
Hi Vikram,

On a OMAP4460, i2c-bus-3:

A driver (lm75) is causing many 'timeout waiting for bus ready' errors.
SDA remains high (as it should), but SCL remains low after a NACK.
The bus becomes _unusable for other clients_.

While probing, lm75 writes a command, followed by a read + stop,
but the write command is NACK'd. The chip does accept other writes/reads,
it just refuses to ack invalid commands.

Can you tell me if the patch below would make any sense? Or is it the
responsibility of the client to reset the i2c_smbus?

In case of M_IGNORE_NAK there is no problem, a STOP will follow after the
last command.


Thanks, Hein

Signed-off-by: Hein Tibosch hein_tibo...@yahoo.es

---
 drivers/i2c/busses/i2c-omap.c |8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index e02f9e3..2f7a712 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -615,11 +615,9 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap,
if (dev-cmd_err  OMAP_I2C_STAT_NACK) {
if (msg-flags  I2C_M_IGNORE_NAK)
return 0;
-   if (stop) {
-   w = omap_i2c_read_reg(dev, OMAP_I2C_CON_REG);
-   w |= OMAP_I2C_CON_STP;
-   omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, w);
-   }
+   w = omap_i2c_read_reg(dev, OMAP_I2C_CON_REG);
+   w |= OMAP_I2C_CON_STP;
+   omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, w);
return -EREMOTEIO;
}
return -EIO;
-- 
1.7.9.5


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 02/11] ARM: DT/kernel: define ARM specific arch_of_get_cpu_node

2013-07-16 Thread Sudeep KarkadaNagesha
On 15/07/13 20:10, Rob Herring wrote:
 On 07/15/2013 05:22 AM, sudeep.karkadanage...@arm.com wrote:
 From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

 CPU subsystem now provides architecture specific hook to retrieve the
 of_node. Most of the cpu DT node parsing and initialisation is contained
 in devtree.c. It's better to contain all CPU device node parsing there.

 arch_of_get_cpu_node is mainly used to assign cpu-of_node when CPUs get
 registered. This patch overrides the defination of the same. It can also
 act as the helper function in pre-SMP/early initialisation stages to
 retrieve CPU device node pointers in logical ordering.

 This mainly helps to avoid replication of the code doing CPU node parsing
 and physical(MPIDR) to logical mapping.

 Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
 
 [snip]
 
 +struct device_node * __init arch_of_get_cpu_node(int cpu)
 +{
 +struct device_node *cpun, *cpus;
 +const u32 *cell;
 +u64 hwid;
 +int ac;
 +
 +cpus = of_find_node_by_path(/cpus);
 +if (WARN(!cpus, Missing cpus node, bailing out\n))
 +return NULL;
 +
 +if (WARN_ON(of_property_read_u32(cpus, #address-cells, ac)))
 +ac = of_n_addr_cells(cpus);
 +
 +for_each_child_of_node(cpus, cpun) {
 +if (of_node_cmp(cpun-type, cpu))
 +continue;
 +cell = of_get_property(cpun, reg, NULL);
 +if (WARN(!cell, %s: missing reg property\n, cpun-full_name))
 +continue;
 +
 +hwid = of_read_number(cell, ac);
 +if ((hwid  MPIDR_HWID_BITMASK) == cpu_logical_map(cpu))
 
 Most of this function is not ARM specific, so it would be nice if we
 could shrink the arch specific part down to just this match. A default
 match of reg == logical cpu number might be useful.
 
I completely agree, in fact that was my initial idea too.

But when I had a look at powerpc implementation of of_get_cpu_node in
arch/powerpc/kernel/prom.c, it looked like PPC is using some
compatibles(e.g. ibm,ppc-interrupt-server#s) which are not specified in
ePAPR. I am not sure is that's allowed or not, if allowed then we can't
have generic of_get_cpu_node with just arch specific hwid matching function.

Let me know how would you prefer me to proceed on this.

Regards,
Sudeep

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] i2c-omap: always send stop after nack

2013-07-16 Thread Felipe Balbi
Hi,

On Tue, Jul 16, 2013 at 04:19:35PM +0800, Hein Tibosch wrote:
 Hi Vikram,
 
 On a OMAP4460, i2c-bus-3:
 
 A driver (lm75) is causing many 'timeout waiting for bus ready' errors.
 SDA remains high (as it should), but SCL remains low after a NACK.
 The bus becomes _unusable for other clients_.
 
 While probing, lm75 writes a command, followed by a read + stop,
 but the write command is NACK'd. The chip does accept other writes/reads,
 it just refuses to ack invalid commands.
 
 Can you tell me if the patch below would make any sense? Or is it the
 responsibility of the client to reset the i2c_smbus?

patch below breaks repeated start.

-- 
balbi


signature.asc
Description: Digital signature


[PATCH 3/4] pinctrl: Add support for additional dynamic states

2013-07-16 Thread Tony Lindgren
To toggle dynamic states, let's add the optional active state in
addition to the static default state. Then if the optional active
state is defined, we can require that idle and sleep states cover
the same pingroups as the active state.

Then let's add pinctrl_check_dynamic() and pinctrl_select_dynamic()
to use instead of pinctrl_select() to avoid breaking existing users.

With pinctrl_check_dynamic() we can check that idle and sleep states
match the active state for pingroups during init, and don't need to
do it during runtime.

Then with the states pre-validated, pinctrl_select_dynamic() can
just toggle between the dynamic states without extra checks.

Note that pinctr_select_state() still has valid use cases, such as
changing states when the pins can be shared between two drivers
and don't necessarily cover the same pingroups. For dynamic runtime
toggling of pin states, we should eventually always use just
pinctrl_select_dynamic().

Cc: Stephen Warren swar...@wwwdotorg.org
Signed-off-by: Tony Lindgren t...@atomide.com
---
 drivers/pinctrl/core.c|  189 -
 include/linux/pinctrl/consumer.h  |   46 
 include/linux/pinctrl/devinfo.h   |4 +
 include/linux/pinctrl/pinctrl-state.h |   15 ++-
 4 files changed, 249 insertions(+), 5 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 8da11d5..4f58a97 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -887,6 +887,8 @@ static void pinctrl_free(struct pinctrl *p, bool inlist)
list_for_each_entry_safe(setting, n2, state-settings, node) {
pinctrl_free_setting(state == p-state[PINCTRL_STATIC],
 setting);
+   pinctrl_free_setting(state == p-state[PINCTRL_DYNAMIC],
+setting);
list_del(setting-node);
kfree(setting);
}
@@ -1041,6 +1043,134 @@ unapply_new_state:
 }
 EXPORT_SYMBOL_GPL(pinctrl_select_state);
 
+/**
+ * pinctrl_check_dynamic() - compare two states for the pins
+ * @dev: pinctrl consumer device pointer
+ * @st1: state handle
+ * @st2: state handle
+ *
+ * This function checks that the group pins match between the two
+ * states to avoid runtime checking. Use this to check dynamic pin
+ * states during init.
+ */
+int pinctrl_check_dynamic(struct device *dev, struct pinctrl_state *st1,
+ struct pinctrl_state *st2)
+{
+   struct pinctrl_setting *s1, *s2;
+
+   list_for_each_entry(s1, st1-settings, node) {
+   struct pinctrl_dev *pctldev1;
+   const struct pinctrl_ops *pctlops1;
+   const unsigned *pins1;
+   unsigned num_pins1;
+   int res;
+
+   if (s1-type != PIN_MAP_TYPE_MUX_GROUP)
+   continue;
+
+   pctldev1 = s1-pctldev;
+   pctlops1 = pctldev1-desc-pctlops;
+   res = pctlops1-get_group_pins(pctldev1, s1-data.mux.group,
+  pins1, num_pins1);
+   if (res) {
+   dev_dbg(dev, could not get state1 group pins\n);
+   return -EINVAL;
+   }
+
+   list_for_each_entry(s2, st2-settings, node) {
+   struct pinctrl_dev *pctldev2;
+   const struct pinctrl_ops *pctlops2;
+   const unsigned *pins2;
+   unsigned num_pins2;
+   int i, j, found = 0;
+
+   if (s2-type != PIN_MAP_TYPE_MUX_GROUP)
+   continue;
+
+   pctldev2 = s2-pctldev;
+   if (pctldev1 != pctldev2) {
+   dev_dbg(dev, pctldev must be the same for 
states\n);
+   return -EINVAL;
+   }
+   pctlops2 = pctldev2-desc-pctlops;
+   res = pctlops2-get_group_pins(pctldev2,
+  s2-data.mux.group,
+  pins2, num_pins2);
+   if (res) {
+   dev_dbg(dev, could not get state2 group 
pins\n);
+   return -EINVAL;
+   }
+
+   for (i = 0; i  num_pins1; i++) {
+   int pin1 = pins1[i];
+
+   for (j = 0; j  num_pins2; j++) {
+   int pin2 = pins2[j];
+
+   if (pin1 == pin2) {
+   found++;
+   break;
+   }
+   }
+   }
+
+

[PATCH 4/4] drivers: Add pinctrl handling for dynamic pin states

2013-07-16 Thread Tony Lindgren
We want to have static pin states handled separately from
dynamic pin states, so let's add optional state_active.

Then if state_active is defined, let's check and make sure
state_idle and state_sleep match state_active for the
pin groups to avoid checking them during runtime as the
active and idle pins may need to be toggled for many
devices every time we enter and exit idle.

Cc: Stephen Warren swar...@wwwdotorg.org
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
Signed-off-by: Tony Lindgren t...@atomide.com
---
 drivers/base/pinctrl.c |   39 +--
 1 file changed, 37 insertions(+), 2 deletions(-)

diff --git a/drivers/base/pinctrl.c b/drivers/base/pinctrl.c
index 5fb74b4..49644ed 100644
--- a/drivers/base/pinctrl.c
+++ b/drivers/base/pinctrl.c
@@ -34,6 +34,7 @@ int pinctrl_bind_pins(struct device *dev)
goto cleanup_alloc;
}
 
+   /* Default static pins that don't need to change */
dev-pins-default_state = pinctrl_lookup_state(dev-pins-p,
PINCTRL_STATE_DEFAULT);
if (IS_ERR(dev-pins-default_state)) {
@@ -48,23 +49,57 @@ int pinctrl_bind_pins(struct device *dev)
goto cleanup_get;
}
 
+   /* Optional runtime dynamic pins in addition to the static pins */
+   dev-pins-active_state = pinctrl_lookup_state(dev-pins-p,
+   PINCTRL_STATE_ACTIVE);
+   if (IS_ERR(dev-pins-active_state)) {
+   /* Not supplying this state is perfectly legal */
+   dev_dbg(dev, no active pinctrl state\n);
+   } else {
+   ret = pinctrl_select_dynamic(dev-pins-p,
+   dev-pins-active_state);
+   if (ret) {
+   dev_dbg(dev, failed to select active pinctrl state\n);
+   goto cleanup_get;
+   }
+   }
+
 #ifdef CONFIG_PM
/*
 * If power management is enabled, we also look for the optional
 * sleep and idle pin states, with semantics as defined in
 * linux/pinctrl/pinctrl-state.h
+*
+* Note that if active state is defined, sleep and idle states must
+* cover the same pin groups as active state.
 */
dev-pins-sleep_state = pinctrl_lookup_state(dev-pins-p,
PINCTRL_STATE_SLEEP);
-   if (IS_ERR(dev-pins-sleep_state))
+   if (IS_ERR(dev-pins-sleep_state)) {
/* Not supplying this state is perfectly legal */
dev_dbg(dev, no sleep pinctrl state\n);
+   } else if (!IS_ERR(dev-pins-active_state)) {
+   ret = pinctrl_check_dynamic(dev, dev-pins-active_state,
+   dev-pins-sleep_state);
+   if (ret) {
+   dev_err(dev, sleep state groups do not match active 
state\n);
+   dev-pins-sleep_state = ERR_PTR(-EINVAL);
+   }
+   }
 
dev-pins-idle_state = pinctrl_lookup_state(dev-pins-p,
PINCTRL_STATE_IDLE);
-   if (IS_ERR(dev-pins-idle_state))
+   if (IS_ERR(dev-pins-idle_state)) {
/* Not supplying this state is perfectly legal */
dev_dbg(dev, no idle pinctrl state\n);
+   } else if (!IS_ERR(dev-pins-active_state)) {
+   ret = pinctrl_check_dynamic(dev, dev-pins-active_state,
+   dev-pins-idle_state);
+   if (ret) {
+   dev_err(dev, idle state groups do not match active 
state\n);
+   dev-pins-idle_state = ERR_PTR(-EINVAL);
+   }
+   }
 #endif
 
return 0;

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] pinctrl: Remove duplicate code in pinctrl_pm_select_state functions

2013-07-16 Thread Tony Lindgren
There's no need to duplicate essentially the same functions. Let's
introduce static int pinctrl_pm_select_state() and make the other
related functions call that.

This allows us to add support later on for multiple active states,
and more optimized dynamic remuxing.

Note that we still need to export the various pinctrl_pm_select
functions as we want to keep struct pinctrl_state private to the
pinctrl code, and cannot replace those with inline functions.

Cc: Stephen Warren swar...@wwwdotorg.org
Signed-off-by: Tony Lindgren t...@atomide.com
---
 drivers/pinctrl/core.c |   47 +++
 1 file changed, 19 insertions(+), 28 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 5b272bf..bda2c61 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -1227,23 +1227,34 @@ EXPORT_SYMBOL_GPL(pinctrl_force_default);
 #ifdef CONFIG_PM
 
 /**
- * pinctrl_pm_select_default_state() - select default pinctrl state for PM
+ * pinctrl_pm_select_state() - select pinctrl state for PM
  * @dev: device to select default state for
+ * @state: state to set
  */
-int pinctrl_pm_select_default_state(struct device *dev)
+static int pinctrl_pm_select_state(struct device *dev, struct pinctrl_state 
*state)
 {
struct dev_pin_info *pins = dev-pins;
int ret;
 
if (!pins)
return 0;
-   if (IS_ERR(pins-default_state))
-   return 0; /* No default state */
-   ret = pinctrl_select_state(pins-p, pins-default_state);
+   if (IS_ERR(state))
+   return 0; /* No such state */
+   ret = pinctrl_select_state(pins-p, state);
if (ret)
-   dev_err(dev, failed to activate default pinctrl state\n);
+   dev_err(dev, failed to activate pinctrl state %s\n,
+   state-name);
return ret;
 }
+
+/**
+ * pinctrl_pm_select_default_state() - select default pinctrl state for PM
+ * @dev: device to select default state for
+ */
+int pinctrl_pm_select_default_state(struct device *dev)
+{
+   return pinctrl_pm_select_state(dev, dev-pins-default_state);
+}
 EXPORT_SYMBOL_GPL(pinctrl_pm_select_default_state);
 
 /**
@@ -1252,17 +1263,7 @@ EXPORT_SYMBOL_GPL(pinctrl_pm_select_default_state);
  */
 int pinctrl_pm_select_sleep_state(struct device *dev)
 {
-   struct dev_pin_info *pins = dev-pins;
-   int ret;
-
-   if (!pins)
-   return 0;
-   if (IS_ERR(pins-sleep_state))
-   return 0; /* No sleep state */
-   ret = pinctrl_select_state(pins-p, pins-sleep_state);
-   if (ret)
-   dev_err(dev, failed to activate pinctrl sleep state\n);
-   return ret;
+   return pinctrl_pm_select_state(dev, dev-pins-sleep_state);
 }
 EXPORT_SYMBOL_GPL(pinctrl_pm_select_sleep_state);
 
@@ -1272,17 +1273,7 @@ EXPORT_SYMBOL_GPL(pinctrl_pm_select_sleep_state);
  */
 int pinctrl_pm_select_idle_state(struct device *dev)
 {
-   struct dev_pin_info *pins = dev-pins;
-   int ret;
-
-   if (!pins)
-   return 0;
-   if (IS_ERR(pins-idle_state))
-   return 0; /* No idle state */
-   ret = pinctrl_select_state(pins-p, pins-idle_state);
-   if (ret)
-   dev_err(dev, failed to activate pinctrl idle state\n);
-   return ret;
+   return pinctrl_pm_select_state(dev, dev-pins-idle_state);
 }
 EXPORT_SYMBOL_GPL(pinctrl_pm_select_idle_state);
 #endif

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/4] improved support for runtime muxing for pinctrl

2013-07-16 Thread Tony Lindgren
Hi all,

As discussed earlier, the pinctrl support for changing some of the
consumer device pins during runtime needs some improvment.

Here are the patches to do that, I'll also post a minimal sample
patch as a reply to this thread on how to do the muxing for
runtime PM.

Regards,

Tony

---

Tony Lindgren (4):
  pinctrl: Remove duplicate code in pinctrl_pm_select_state functions
  pinctrl: Allow pinctrl to have multiple active states
  pinctrl: Add support for additional dynamic states
  drivers: Add pinctrl handling for dynamic pin states


 drivers/base/pinctrl.c|   39 +
 drivers/pinctrl/core.c|  250 -
 drivers/pinctrl/core.h|   10 +
 include/linux/pinctrl/consumer.h  |   46 ++
 include/linux/pinctrl/devinfo.h   |4 +
 include/linux/pinctrl/pinctrl-state.h |   15 ++
 6 files changed, 321 insertions(+), 43 deletions(-)

-- 
Signature
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Ksummit-2013-discuss] KS Topic request: Handling the Stable kernel, let's dump the cc: stable tag

2013-07-16 Thread Jiri Kosina
On Mon, 15 Jul 2013, H. Peter Anvin wrote:

 Perhaps the KS topic should be about different stable workflows and what
 the maintainers' options are, rather than about a specific proposal.
 This seems like a good discussion topic.

I agree as well; I believe all the proposals related to -stable can be 
folded into (this) one.

-- 
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/4] pinctrl: Allow pinctrl to have multiple active states

2013-07-16 Thread Tony Lindgren
It's quite common that we need to dynamically change some pins for a
device for runtime PM, or toggle a pin between rx and tx. Changing all
the pins for a device is not efficient way of doing it.

So let's allow setting up multiple active states for pinctrl. Currently
we only need PINCTRL_STATIC and PINCTRL_DYNAMIC, where PINCTRL_STATIC
covers the current default pins, and PINCTRL_DYNAMIC holds the dynamic
pins that need to be toggled.

Cc: Stephen Warren swar...@wwwdotorg.org
Signed-off-by: Tony Lindgren t...@atomide.com
---
 drivers/pinctrl/core.c |   18 ++
 drivers/pinctrl/core.h |   10 --
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index bda2c61..8da11d5 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -885,7 +885,8 @@ static void pinctrl_free(struct pinctrl *p, bool inlist)
mutex_lock(pinctrl_list_mutex);
list_for_each_entry_safe(state, n1, p-states, node) {
list_for_each_entry_safe(setting, n2, state-settings, node) {
-   pinctrl_free_setting(state == p-state, setting);
+   pinctrl_free_setting(state == p-state[PINCTRL_STATIC],
+setting);
list_del(setting-node);
kfree(setting);
}
@@ -955,13 +956,13 @@ EXPORT_SYMBOL_GPL(pinctrl_lookup_state);
 int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state)
 {
struct pinctrl_setting *setting, *setting2;
-   struct pinctrl_state *old_state = p-state;
+   struct pinctrl_state *old_state = p-state[PINCTRL_STATIC];
int ret;
 
-   if (p-state == state)
+   if (old_state == state)
return 0;
 
-   if (p-state) {
+   if (old_state) {
/*
 * The set of groups with a mux configuration in the old state
 * may not be identical to the set of groups with a mux setting
@@ -971,7 +972,7 @@ int pinctrl_select_state(struct pinctrl *p, struct 
pinctrl_state *state)
 * but not in the new state, this code puts that group into a
 * safe/disabled state.
 */
-   list_for_each_entry(setting, p-state-settings, node) {
+   list_for_each_entry(setting, old_state-settings, node) {
bool found = false;
if (setting-type != PIN_MAP_TYPE_MUX_GROUP)
continue;
@@ -989,7 +990,7 @@ int pinctrl_select_state(struct pinctrl *p, struct 
pinctrl_state *state)
}
}
 
-   p-state = NULL;
+   p-state[PINCTRL_STATIC] = NULL;
 
/* Apply all the settings for the new state */
list_for_each_entry(setting, state-settings, node) {
@@ -1011,7 +1012,7 @@ int pinctrl_select_state(struct pinctrl *p, struct 
pinctrl_state *state)
}
}
 
-   p-state = state;
+   p-state[PINCTRL_STATIC] = state;
 
return 0;
 
@@ -1484,7 +1485,8 @@ static int pinctrl_show(struct seq_file *s, void *what)
list_for_each_entry(p, pinctrl_list, node) {
seq_printf(s, device: %s current state: %s\n,
   dev_name(p-dev),
-  p-state ? p-state-name : none);
+  p-state[PINCTRL_STATIC] ?
+  p-state[PINCTRL_STATIC]-name : none);
 
list_for_each_entry(state, p-states, node) {
seq_printf(s,   state: %s\n, state-name);
diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h
index 75476b3..b99e4b3 100644
--- a/drivers/pinctrl/core.h
+++ b/drivers/pinctrl/core.h
@@ -53,12 +53,18 @@ struct pinctrl_dev {
 #endif
 };
 
+enum pinctr_states {
+   PINCTRL_STATIC,
+   PINCTRL_DYNAMIC,
+   PINCTRL_NR_STATES,
+};
+
 /**
  * struct pinctrl - per-device pin control state holder
  * @node: global list node
  * @dev: the device using this pin control handle
  * @states: a list of states for this device
- * @state: the current state
+ * @state: the current state(s)
  * @dt_maps: the mapping table chunks dynamically parsed from device tree for
  * this device, if any
  * @users: reference count
@@ -67,7 +73,7 @@ struct pinctrl {
struct list_head node;
struct device *dev;
struct list_head states;
-   struct pinctrl_state *state;
+   struct pinctrl_state *state[PINCTRL_NR_STATES];
struct list_head dt_maps;
struct kref users;
 };

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC 1/2] ASoC: dmaengine-pcm: Add support for querying DMA capabilities

2013-07-16 Thread Lars-Peter Clausen
On 07/15/2013 09:51 PM, Mark Brown wrote:
 On Mon, Jul 15, 2013 at 08:20:28PM +0200, Lars-Peter Clausen wrote:
 On 07/15/2013 07:57 PM, Mark Brown wrote:
 On Mon, Jul 15, 2013 at 10:27:21PM +0530, Vinod Koul wrote:
 
 Right, we probably want to set an artificial floor here but it still
 seems like we should be checking that the device actually supports this.
 If the hardware can only support 64 bytes then the above code won't work
 properly.
 
 It shouldn't be to hard to extend the dma_caps API with a
 min_sg_len. But is this something you've actually seen in existing
 hardware for that the driver would make use of the dmaengine PCM
 framework? If it is more of theoretical nature we can still easily
 add it later if it becomes necessary.
 
 I'm not aware of anything but equally well I made zero effort to look
 and note that quite a few existing drivers appear to have minimum values
 quite a bit above 16 though I doubt they are all actual restrictions.

I would assume that most of them don't express hardware limitations but
rather are sensible lower limits which allow operation without
over-/underruns. But that's something that doesn't necessarily depend on the
DMA controller, but rather on the system as a whole, e.g. on a slower
machine you'd typically set the limit higher so the CPU has a better chance
to keep up. So this isn't something you'd want to set in the DMA controller
driver. But I'm not sure if there is a good way to calculate a sensible
minimum buffer size based on the whole system's constraints.

- Lars

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   4   5   6   7   8   9   10   >