[PATCH] dma: fsl-edma: fix static checker warning of NULL dereference

2014-02-20 Thread Jingchang Lu
The static checker reports following warning:
drivers/dma/fsl-edma.c:732 fsl_edma_xlate()
error: we previously assumed 'chan' could be null (see line 737)
The changes of the loop cursor in the iteration may result in
NULL dereference when dma_get_slave_channel failed but loop
will continue. So use list_for_each_entry_safe() instead of
list_for_each_entry() to against this.

Reported-by: Dan Carpenter 
Signed-off-by: Jingchang Lu 
---
 drivers/dma/fsl-edma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/fsl-edma.c b/drivers/dma/fsl-edma.c
index 9025300..381e793 100644
--- a/drivers/dma/fsl-edma.c
+++ b/drivers/dma/fsl-edma.c
@@ -723,13 +723,13 @@ static struct dma_chan *fsl_edma_xlate(struct 
of_phandle_args *dma_spec,
struct of_dma *ofdma)
 {
struct fsl_edma_engine *fsl_edma = ofdma->of_dma_data;
-   struct dma_chan *chan;
+   struct dma_chan *chan, *_chan;
 
if (dma_spec->args_count != 2)
return NULL;
 
mutex_lock(&fsl_edma->fsl_edma_mutex);
-   list_for_each_entry(chan, &fsl_edma->dma_dev.channels, device_node) {
+   list_for_each_entry_safe(chan, _chan, &fsl_edma->dma_dev.channels, 
device_node) {
if (chan->client_count)
continue;
if ((chan->chan_id / DMAMUX_NR) == dma_spec->args[0]) {
-- 
1.8.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/


Re: How could we get rid of saved_max_pfn for calgary iommu?

2014-02-20 Thread WANG Chao
Remove m...@il.ibm.com from CC, this email isn't valid now.

On 02/19/14 at 09:36pm, Vivek Goyal wrote:
> On Wed, Feb 19, 2014 at 05:04:22PM -0700, Jon Mason wrote:
> > On Tue, Feb 18, 2014 at 11:18 PM, WANG Chao  wrote:
> > > Hi, All
> > >
> > > arch/x86/kernel/pci-calgary.c is the only user of saved_max_pfn today:
> > >
> > > int __init detect_calgary(void)
> > > {
> > > [..]
> > > specified_table_size = 
> > > determine_tce_table_size((is_kdump_kernel() ?
> > > saved_max_pfn : max_pfn) * 
> > > PAGE_SIZE);
> > > [..]
> > > }
> > 
> > IIUC, the purpose of this code is to reuse the TCE table from the
> > previous kernel.  Thus, it needs to be of the same size as the
> > pre-kdump kernel.  It is using the max_pfn to determine the TCE table
> > size in the non-kdump case.  If there is another way to determine the
> > size it used before, then I am fine making the change to use that way.
> 
> How about passing old tce table size on command line to second kernel.
> Given the fact that it is specific to calgary only, we can it very
> specific. Say calgary_iommu_old_tce_table_sz=.

Don't need to introduce a new parameter, this is already there:
calgary=[64k,128k,256k,512k,1M,2M,4M,8M]

> 
> But we will then need to know the size of TCE table in first kernel. Is
> this information exported to user space somewhere?

If this value isn't exported to userspace or even won't in the future, I think
the table size also can be determined by userspace. We can implement something 
like the
kernel does in kexec.

The calgary code:

static inline int __init determine_tce_table_size(u64 ram)
{
int ret;

if (specified_table_size != TCE_TABLE_SIZE_UNSPECIFIED)
return specified_table_size;

/*
 * Table sizes are from 0 to 7 (TCE_TABLE_SIZE_64K to
 * TCE_TABLE_SIZE_8M). Table size 0 has 8K entries and each
 * larger table size has twice as many entries, so shift the
 * max ram address by 13 to divide by 8K and then look at the
 * order of the result to choose between 0-7.
 */
ret = get_order(ram >> 13);
if (ret > TCE_TABLE_SIZE_8M)
ret = TCE_TABLE_SIZE_8M;

return ret;
}

But it still no clear to me how I can determine calgary iommu is in use in 1st 
kernel.

Thanks
WANG Chao
--
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 10/33] iommu, irq: Allocate irq_desc for dmar_msi with local node

2014-02-20 Thread Jiang Liu


On 2014/1/3 8:05, Yinghai Lu wrote:
> iommu irq's irq_desc should be on local node ram.
> 
> Fix the return value checking problem.
>   create_irq() will return -1 when fail to allocate.
>   create_irq_nr() will return 0 when fail to allocate.
> here only check !irq, so need to change it to use create_irq_nr instead.
> 
> -v2: According to Sebastian, add cc to stable.
> 
> Signed-off-by: Yinghai Lu 
> Cc: Joerg Roedel 
> Cc: Donald Dutile 
> Acked-by: Donald Dutile 
> Cc: Sebastian Andrzej Siewior 
> Cc: sta...@vger.kernel.org
> ---
>  drivers/iommu/dmar.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
> index 8b452c9..f4eaa50 100644
> --- a/drivers/iommu/dmar.c
> +++ b/drivers/iommu/dmar.c
> @@ -1277,7 +1277,7 @@ int dmar_set_interrupt(struct intel_iommu *iommu)
>   if (iommu->irq)
>   return 0;
>  
> - irq = create_irq();
> + irq = create_irq_nr(0, iommu->node);
Hi Yinghai,
How about create_irq_nrq(1, iommu->node) here to clearly state
that 0 is not a valid irq number for dmar here?
Thanks!
Gerry

>   if (!irq) {
>   pr_err("IOMMU: no free vectors\n");
>   return -EINVAL;
> 
--
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/


linux-next: Tree for Feb 21

2014-02-20 Thread Stephen Rothwell
Hi all,

This tree fails (more than usual) the powerpc allyesconfig build.

Changes since 20140220:

Renamed tree: clang to llvmlinux

The arm-soc tree gained a conflict against the arm-perf tree.

The powerpc tree still had its build failure.

The mfd-lj tree still had its build failure so I used the version from
next-20140210.

The net-next tree gained conflicts against the wireless and net trees.

The sound-asoc tree lost its build failure.

The char-misc tree gained a build failure for which I applied a merge fix
patch.

The akpm-current tree gained a conflict against the sparc tree.

Non-merge commits (relative to Linus' tree): 3763
 3919 files changed, 133708 insertions(+), 71315 deletions(-)



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" as mentioned in the FAQ on the wiki
(see below).

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log files
in the Next directory.  Between each merge, the tree was built with
a ppc64_defconfig for powerpc and an allmodconfig for x86_64 and a
multi_v7_defconfig for arm. After the final fixups (if any), it is also
built with powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig and
allyesconfig (minus CONFIG_PROFILE_ALL_BRANCHES - this fails its final
link) and i386, sparc, sparc64 and arm defconfig. These builds also have
CONFIG_ENABLE_WARN_DEPRECATED, CONFIG_ENABLE_MUST_CHECK and
CONFIG_DEBUG_INFO disabled when necessary.

Below is a summary of the state of the merge.

I am currently merging 210 trees (counting Linus' and 28 trees of patches
pending for Linus' tree).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

There is a wiki covering stuff to do with linux-next at
http://linux.f-seidel.de/linux-next/pmwiki/ .  Thanks to Frank Seidel.

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

$ git checkout master
$ git reset --hard stable
Merging origin/master (d158fc7f36a2 Merge tag 'pci-v3.14-fixes-1' of 
git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci)
Merging fixes/master (b0031f227e47 Merge tag 's2mps11-build' of 
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator)
Merging kbuild-current/rc-fixes (38dbfb59d117 Linus 3.14-rc1)
Merging arc-current/for-curr (7e22e91102c6 Linux 3.13-rc8)
Merging arm-current/fixes (39544ac9df20 ARM: 7957/1: add DSB after icache flush 
in __flush_icache_all())
Merging m68k-current/for-linus (7247f55381d5 m68k: Wire up sched_setattr and 
sched_getattr)
Merging metag-fixes/fixes (3b2f64d00c46 Linux 3.11-rc2)
Merging powerpc-merge/merge (66f9af83e56b powerpc/eeh: Disable EEH on reboot)
Merging sparc/master (967f038e491b Sparc: sparc_cpu_model isn't in asm/system.h 
any more [ver #2])
Merging net/master (7cce3b75682f net: sctp: Potentially-Failed state should not 
be reached from unconfirmed state)
Merging ipsec/master (960dfc4eb23a Merge branch 'drm-fixes' of 
git://people.freedesktop.org/~airlied/linux)
Merging sound-current/for-linus (1de7ca5e8448 ALSA: hda - Enable front audio 
jacks on one HP desktop model)
Merging pci-current/for-linus (fc40363b2140 ahci: Fix broken fallback to single 
MSI mode)
Merging wireless/master (b3050248c167 ath9k: Fix ETSI compliance for AR9462 2.0)
Merging driver-core.current/driver-core-linus (6d0abeca3242 Linux 3.14-rc3)
Merging tty.current/tty-linus (6d0abeca3242 Linux 3.14-rc3)
Merging usb.current/usb-linus (0fd7a820675e Merge tag 'fixes-for-v3.14-rc4' of 
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus)
Merging staging.current/staging-linus (6d0abeca3242 Linux 3.14-rc3)
Merging char-misc.current/char-misc-linus (accb884b32e8 mei: set client's 
read_cb to NULL when flow control fails)
Merging input-current/for-linus (70b0052425ff Input: da9052_onkey - use correct 
register bit for key status)
Merging md-current/for-linus (d47648fcf061 raid5: avoid finding "discard" 
stripe)
Merging crypto-current/master (ee97dc7db4cb crypto: s390 - fix des and des3_ede 
ctr concurrency issue)
Merging ide/master (738b52bb9845 Merge tag 'microblaze-3.14-rc3' of 
git://git.monstr.eu/linux-2.6-microblaze)
Merging dwmw2/mas

[PATCH] mm: update comment in unmap_single_vma()

2014-02-20 Thread Davidlohr Bueso
From: Davidlohr Bueso 

The described issue now occurs inside mmap_region().
And unfortunately is still valid.

Signed-off-by: Davidlohr Bueso 
---
 mm/memory.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index 95009f9..c90df25 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1320,9 +1320,9 @@ static void unmap_single_vma(struct mmu_gather *tlb,
 * It is undesirable to test vma->vm_file as it
 * should be non-null for valid hugetlb area.
 * However, vm_file will be NULL in the error
-* cleanup path of do_mmap_pgoff. When
+* cleanup path of mmap_region. When
 * hugetlbfs ->mmap method fails,
-* do_mmap_pgoff() nullifies vma->vm_file
+* mmap_region() nullifies vma->vm_file
 * before calling this function to clean up.
 * Since no pte has actually been setup, it is
 * safe to do nothing in this case.
-- 
1.8.1.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 v2] sched: keep quiescent cpu out of idle balance loop

2014-02-20 Thread Lei Wen
Mike,

On Fri, Feb 21, 2014 at 1:51 PM, Mike Galbraith  wrote:
> On Fri, 2014-02-21 at 10:23 +0800, Lei Wen wrote:
>> Cpu which is put into quiescent mode, would remove itself
>> from kernel's sched_domain, and want others not disturb its
>> task running. But current scheduler would not checking whether
>> that cpu is setting in such mode, and still insist the quiescent
>> cpu to response the nohz load balance.
>
> Let's isolate some CPUs.
>
> Setup:
> /-"system" CPU0
> \
>   \---"rtcpus" CPUs1-3
>
> crash> runqueues
> PER-CPU DATA TYPE:
>   struct rq runqueues;
> PER-CPU ADDRESSES:
>   [0]: 88022fc12c00
>   [1]: 88022fc92c00
>   [2]: 88022fd12c00
>   [3]: 88022fd92c00
> crash> struct rq 88022fd92c00 | grep sd
>   sd = 0x0,  <== yup, CPU3 is isolated bit of silicon
> crash> struct rq 88022fd92c00 | grep rd
>   rd = 0x81bffe60 ,
> crash> struct -x root_domain 0x81bffe60
> ...
>   span = {{
>   bits = {0xe} <== "rtcpus"
> }},
> crash> struct rq 88022fc12c00 | grep rd
>   rd = 0x8802242c5800,
> crash> struct -x root_domain 0x8802242c5800
> ...
>   span = {{
>   bits = {0x1} <== "system"
> }},
>
> Turn off load balancing in "system" as well now, CPU0 loses its 'sd',
> and becomes an isolated island identical to "rtcpus" CPUs, and thus..
>
>   span = {{
>   bits = {0xf} <== oh darn
> }},
>
> .."system" and "rtcpus" merge, all CPUs having NULL sd, as they are now
> all remote silicon islands, but they now also share rd again, as if you
> had never diddled domains in the first place.

Great catch for it!
Actually, what I have experiment is as:
1. set top cpuset as disable load balance
2. set 0-2 cpus to "system", and enable its load balance
3. set 3 cpu to "rt" and disable load balance.

While by this way, root span always covering [0-2] which is seen
by cpu 0-2, as you also mentioned.
And it is true that if I disable load balance, I would see span mask
get them merged.

So how about below change?
+   if (!this_rq()->sd)
+   return;
Suppose isolated cpu would lose its sd, could you help
confirm it from crash too?

Or, you think it is wrong to do merge job when system group disable
the load balance?

Thanks,
Lei
--
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: [Devel] [PATCH 1/4] ACPI: Provide support for ACPI table adding via OS

2014-02-20 Thread Zheng, Lv
Hi, Thomas

> From: Devel [mailto:devel-boun...@acpica.org] On Behalf Of Thomas Renninger
> Sent: Wednesday, February 19, 2014 2:44 AM
> 
> On Tuesday, February 18, 2014 10:27:23 AM H. Peter Anvin wrote:
> > Why can't you add SSDTs? It would be particularly useful.
> 
> There are 2 ways how ACPI tables get added:
>- Via pointer from a root table (XSDT or RSDT iirc)
>- Via load statement inside of ACPI context when ACPI BIOS
>  code gets executed (iirc the physical address is passed).
> 
> The latter is only for SSDTs.
> The problem is that you if you add an SSDT early, it might
> have been intended for overriding when an SSDT gets dynamically
> loaded later when the system is up which is particular useful as
> well if you want to debug this specific BIOS table.
> 
> This could be workarounded via a boot param:
> acpi=allow_ssdt_adding
> But this is not nice. Maybe someone has a more elegant idea.
> Something could still be added if someone is really needing this.

I'm not sure if you are talking about the issue that:
If a system booted using customized DSDT embedded with SSDT, it also requires 
dynamic SSDT loading be prevented in ACPICA.

Thanks and best regards
-Lv


> 
>  Thomas
> ___
> Devel mailing list
> de...@acpica.org
> https://lists.acpica.org/mailman/listinfo/devel
--
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: [Devel] [PATCH 1/4] ACPI: Provide support for ACPI table adding via OS

2014-02-20 Thread Zheng, Lv
Hi, Thomas

> From: Devel [mailto:devel-boun...@acpica.org] On Behalf Of Thomas Renninger
> Sent: Wednesday, February 19, 2014 7:23 PM
> 
> On Tuesday, February 18, 2014 12:51:07 PM H. Peter Anvin wrote:
> > On 02/18/2014 10:44 AM, Thomas Renninger wrote:
> > > On Tuesday, February 18, 2014 10:27:23 AM H. Peter Anvin wrote:
> > >> Why can't you add SSDTs? It would be particularly useful.
> > >
> > > There are 2 ways how ACPI tables get added:
> > >- Via pointer from a root table (XSDT or RSDT iirc)
> > >- Via load statement inside of ACPI context when ACPI BIOS
> > >
> > >  code gets executed (iirc the physical address is passed).
> > >
> > > The latter is only for SSDTs.
> > > The problem is that you if you add an SSDT early, it might
> > > have been intended for overriding when an SSDT gets dynamically
> > > loaded later when the system is up which is particular useful as
> > > well if you want to debug this specific BIOS table.
> > >
> > > This could be workarounded via a boot param:
> > > acpi=allow_ssdt_adding
> > > But this is not nice. Maybe someone has a more elegant idea.
> > > Something could still be added if someone is really needing this.
> >
> > Since adding SSDTs is one of the things I really can imagine one would
> > do, I think we need to figure out how to do that.  I would think that
> > overriding would be the exception case.
> 
> You can always paste new code into the DSDT. It is effectively the same
> than adding a new SSDT table.
> The other way around, modifying or deleting broken code in a BIOS
> provided SSDT needs overriding.
> 
> So in fact adding SSDTs is not necessary at all.
> It would be a nice add-on, but it's not even worth introducing
> an extra boot param or whatever confusion.
> A hint in Documentation that adding additional ASL (ACPI Source Language)
> code to the DSDT would be the same than creating and adding a new
> SSDT table which is not possible should be enough.

IMO, we need to load tables from RSDT/XSDT, they look like "static tables".
Given that we can live in the environment where table reloading is properly 
implemented by ACPICA, we won't face issues.
And the reloading feature is also required by ACPI specification.
If a table contains same "signature, oem_id, oem_table_id", it could be able to 
replace the old loaded one if the revision field is greater than the old one.

Actually I'm currently working on the parallel reloading support and all 
functionalities have been done.
This report is a bit hurry than I expected.
I'll try to prepare fixes (which seems to be dozens of patches) for the testers 
to validate.

Fortunately, specific to this bug, I don't think the reload requirement must be 
implemented as the new one doesn't contain a greater revision number.
So there might just be dead lock issues for this bug.

Thanks and best regards
-Lv

> 
> The whole thing will always taint the kernel and is meant for
> debugging only anyway.
> 
>Thomas
> ___
> Devel mailing list
> de...@acpica.org
> https://lists.acpica.org/mailman/listinfo/devel
--
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 v1.3 1/11] arcmsr: Revise interrupt service routine to fix command timeout

2014-02-20 Thread Dan Carpenter
On Fri, Feb 21, 2014 at 10:56:34AM +0800, 黃清隆 wrote:
> From: Ching 
> 
> Rewrite interrupt service routine to fix command timeout on controller
> too heavy loading.
> 
> Singed-off-by: Ching 

This email is still line wrapped I'm afraid.  It doesn't apply.

> ---
> 
> diff -uprN a/drivers/scsi/arcmsr/arcmsr_attr.c
> b/drivers/scsi/arcmsr/arcmsr_attr.c
> --- a/drivers/scsi/arcmsr/arcmsr_attr.c 2014-02-07 01:47:24.0 +0800
> +++ b/drivers/scsi/arcmsr/arcmsr_attr.c 2014-01-10 20:28:48.0 +0800
> -#define ARCMSR_SCSI_INITIATOR_ID
>  255
> +#define ARCMSR_SCSI_INITIATOR_ID   255

Please do white space changes in a separate change set so that the logic
changes are easier to review.

Use "git citool".  Highlight the lines with white space changes and then
right click and select "Stage lines for commit".  It is a very useful
tool.

regards,
dan carpenter
--
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: OMAP138 (davinci) ecap driver support

2014-02-20 Thread Laszlo Papp
On Fri, Feb 21, 2014 at 6:43 AM, Laszlo Papp  wrote:
> Hi,
>
> we are currently having some implementation of it for an older kernel,
> and I was just wondering if it is worth upstreaming, or the latest
> linux kernel already has support for it, and we can drop our code
> respectively?
>
> I have seen the "./drivers/pwm/pwm-tiecap.c" file, but it seems to be
> designed for AM33XX regardless its generic file name, and Kconfig
> entry.
>
> Cheers, L.

Since both included emails are broken from Thierry and Philip, I am
resending the email with Thierry's updated email as well as including
the linux-omap mailing list.
--
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 v3 4/6] timerfd: Factor out timer-type unspecific timerfd_expire()

2014-02-20 Thread Alexey Perevalov

On 02/21/2014 08:13 AM, Anton Vorontsov wrote:

On Thu, Feb 20, 2014 at 11:52:03AM +0100, Thomas Gleixner wrote:

From: Anton Vorontsov 

There is nothing hrtimer-specific inside the timerfd_tmrproc(), except
the function prototype. We're about to add other timer types, so factor
out generic timerfd_expire() helper from timerfd_tmrproc().

This changelog is completely useless. How is timerfd_tmrproc, which is
not a function but a function pointer, related to the patch?

Moving duplicated code to a common function is nice, but 

Signed-off-by: Anton Vorontsov 
Signed-off-by: Alexey Perevalov 

...

Warnings are there to be ignored and testing of user space
interfaces after a change is overrated, right?

Aside of that you just blindly copied the original code w/o fixing up
the now unnecessary line breaks.

Alexey,

While I appreciate the desire to be careful with authorship and stuff,
please remove my name as an author of this patch -- the current code has
nothing to do with my original work, and I surely don't want to take any
responsibility for it. This is a common practice if you modify someone's
patch to a great extend.

Thomas is bashing the thing, which has my name on it; although _my_ patch
did not produce any warnings, came with a completely different changelog,
and served completely different purposes.

Sorry, it was introduced by me, while rebasing.



Instead of rushing with resending yet another series, please actually read
Thomas' review.

Thanks,

Anton





--
Best regards,
Alexey Perevalov
--
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 v20 00/10] Final: Add 32 bit VDSO time function support

2014-02-20 Thread Stefani Seibold
Am Donnerstag, den 20.02.2014, 15:10 -0800 schrieb H. Peter Anvin:
> On 02/19/2014 01:09 AM, Stefani Seibold wrote:
> > 
> > This kind of helper must be integrated into glibc, for x86 64 bit and
> > PowerPC it is already there.
> > 
> 
> Who is doing the glibc work?
> 

I don't know. I hoped this would be done by one of the glibc maintainer
because IMHO the glibc code is very unreadable.

- Stefani


--
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 3.14-rc3

2014-02-20 Thread Boaz Harrosh
On 02/16/2014 11:57 PM, Linus Torvalds wrote:
> When I made the rc2 announcement, I mentioned how nice and small it
> was. I also mentioned that I mistrusted you guys, and that I suspected
> that some people were giggling to themselves and holding back their
> pull requests, evil little creatures like you are.
> 
> And I hate being right. rc2 was quite small, but rc3 makes up for it.
> I quietly took all the pull requests because clearly this wasn't a
> surprise, but I'm warning you - I'm going to start cursing at people
> if it looks like this trend is going to continue. You've been warned.
> 

I do not think it is any evil doing but a pattern. (But I suspect you
know that). After rc1 there is a two weeks pause hence the small rc2.
This is because trees need to be rebased. Fixes sorted out from next
window development. And everyone is testin, retesting on top of the
just released new Kernel (10,000 patches big). So it might be a sign
for a good thing, no? rc3 is all the breakage found in 2 weeks of
testing.

Just my $0.017
Boaz

> Anyway, because the shortlog is pretty hefty, I'm doing my overview
> "mergelog" here, and will post the shortlog separately as a reply to
> this email for people who want more detail. The bulk is the networking
> and random drivers (net, staging, usb, block, infiniband..) but
> there's some arch updates too (powerpc, arm, x86) and some
> documentation updates.
> 
>   Linus
> 
> (And as always for my mergelog - the people credited are the people
> who send me the pull request, which is generally different from the
> author of the code. See the shortlog for actual code authorship)
> 

--
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 02/33] genirq: Add irq_alloc_reserved_desc()

2014-02-20 Thread Jiang Liu


On 2014/1/3 8:05, Yinghai Lu wrote:
> For ioapic hot-add support, it would be easy if we have continuous
> irq numbers for hot added ioapic controller.
> 
> We can reserve irq range at first, and later allocate desc for those
> pre-reserved irqs when they are needed.
> 
> The reasons for not allocating them during reserving:
> 1. only several pins of one ioapic are used, allocate for all pins, will
>waste memory for not used pins.
> 2. allocate later when is needed could make sure irq_desc is allocated
>on local node ram, as dev->node is set at that point.
> 
> -v2: update changelog by adding reasons, requested by Konrad.
> -v3: according to tglx:
>separate core code change with arch code change.
>change function name to irq_alloc_reserved_desc.
>kill __irq_is_reserved().
>remove not need exports.
>  according to Sebastian:
>spare one comments by put two functions together.
> 
> Signed-off-by: Yinghai Lu 
> Cc: Joerg Roedel 
> Cc: Konrad Rzeszutek Wilk 
> Cc: Sebastian Andrzej Siewior 
> ---
>  include/linux/irq.h  |  3 +++
>  kernel/irq/irqdesc.c | 23 +++
>  2 files changed, 26 insertions(+)
> 
> diff --git a/include/linux/irq.h b/include/linux/irq.h
> index 0229caf..e5f6493 100644
> --- a/include/linux/irq.h
> +++ b/include/linux/irq.h
> @@ -595,10 +595,13 @@ static inline u32 irq_get_trigger_type(unsigned int irq)
>  
>  int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node,
>   struct module *owner);
> +int __irq_alloc_reserved_desc(int at, int node, struct module *owner);
>  
>  /* use macros to avoid needing export.h for THIS_MODULE */
>  #define irq_alloc_descs(irq, from, cnt, node)\
>   __irq_alloc_descs(irq, from, cnt, node, THIS_MODULE)
> +#define irq_alloc_reserved_desc_at(at, node) \
> + __irq_alloc_reserved_desc(at, node, THIS_MODULE)
>  
>  #define irq_alloc_desc(node) \
>   irq_alloc_descs(-1, 0, 1, node)
> diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
> index a151db6..1166545 100644
> --- a/kernel/irq/irqdesc.c
> +++ b/kernel/irq/irqdesc.c
> @@ -410,6 +410,29 @@ __irq_alloc_descs(int irq, unsigned int from, unsigned 
> int cnt, int node,
>  EXPORT_SYMBOL_GPL(__irq_alloc_descs);
>  
>  /**
> + * __irq_alloc_reserved_desc - allocate irq descriptor for irq that is 
> already reserved
> + * @irq: Allocate for specific irq number if irq >= 0
Hi Yinghai
Should we skip "if irq >= 0" here because irq should have already been
reserved? Or should we add range check for irq?
Thanks!
Gerry

> + * @node:Preferred node on which the irq descriptor should be allocated
> + * @owner:   Owning module (can be NULL)
> + *
> + * Returns the irq number or error code
> + */
> +int __ref __irq_alloc_reserved_desc(int irq, int node, struct module *owner)
> +{
> + mutex_lock(&sparse_irq_lock);
> + if (!test_bit(irq, allocated_irqs)) {
> + mutex_unlock(&sparse_irq_lock);
> + return -EINVAL;
> + }
> + mutex_unlock(&sparse_irq_lock);
> +
> + if (irq_to_desc(irq))
> + return irq;
> +
> + return alloc_descs(irq, 1, node, owner);
> +}
> +
> +/**
>   * irq_reserve_irqs - mark irqs allocated
>   * @from:mark from irq number
>   * @cnt: number of irqs to mark
> 
--
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 0/2] Add Qualcomm BAM dmaengine driver

2014-02-20 Thread Andy Gross
This patch set introduces the dmaengine driver for the Qualcomm Bus Access
Manager (BAM) DMA controller present on MSM 8x74 devices.  A number of the
on-chip devices have their own BAM DMA controller and use it to move data
between system memory and peripherals or between two peripherals.

The initial version of this driver will only support slave DMA operations
between system memory and peripherals.

Changes from v5:
- Separated copyright from BAM description
- Removed usage of slave dma direction
- Reworked slave config interface
- Removed max segment size restriction in slave_sg
- Added acked-by on DT patch
- Fixed nit comments

Changes from v4:
- Add devm_free_irq() to .remove to avoid race condition
- Free FIFO memory in .remove

Changes from v3:
- Remove unused bam_channel_dir.
- Remove incorrect write to BAM_IRQ_SRCS_EE (read only).
- Remove dma direction from DT binding and revise driver to use
  direction from prep_slave_sg.
- Remove unnecessary channel reset from channel_init.  This could affect
  channels controlled from other execution environments.
- Change terminate_all to also take care of the current active
  descriptor.
- Rework .remove function to correctly mask interrupts and clean up
  resources and tasklets.

Changes from v2:
- Corrected Kconfig dependencies
- Moved execution environment ID to controller DT binding.  The EE is
  a global setting across all of the channels on the controller.
- Combined header into source file.
- Corrected copyright date.
- Moved channel hardware initialization to occur when channel is used
  for the first time.
- Converted dma_alloc_coherent to dma_alloc_writecombine
- Removed unecessary reset of channel from the dma terminate_all
- Corrected usage of EE in irq handler and channel configuration
  functions.
- Changed resource functions inside probe to use correct APIs.
- Removed dma filter function and modified dma_xlate to use
  dma_get_slave_channel API
- Fixed various nit comments

Changes from v1:
- Converted driver to use virt-dma
- Reworked probe function per review comments
- tx_status function now computes and returns residuals
- Removed proprietary slave config.  Removed associated include file.
- Renamed files to reflect vendor name instead of specific device
- Converted to use (readl|writel)_relaxed w/ appropriate barriers
- Removed unions in favor of standard types.

Andy Gross (2):
  dmaengine: qcom_bam_dma: Add device tree binding
  dmaengine: add Qualcomm BAM dma driver

 .../devicetree/bindings/dma/qcom_bam_dma.txt   |   48 +
 drivers/dma/Kconfig|9 +
 drivers/dma/Makefile   |1 +
 drivers/dma/qcom_bam_dma.c | 1107 
 4 files changed, 1165 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/qcom_bam_dma.txt
 create mode 100644 drivers/dma/qcom_bam_dma.c

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
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 1/2] dmaengine: qcom_bam_dma: Add device tree binding

2014-02-20 Thread Andy Gross
Add device tree binding support for the QCOM BAM DMA driver.

Acked-by: Kumar Gala 
Signed-off-by: Andy Gross 
---
 .../devicetree/bindings/dma/qcom_bam_dma.txt   |   48 
 1 file changed, 48 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/qcom_bam_dma.txt

diff --git a/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt 
b/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt
new file mode 100644
index 000..86344f1
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt
@@ -0,0 +1,48 @@
+QCOM BAM DMA controller
+
+Required properties:
+- compatible:  Must be "qcom,bam-v1.4.0" for MSM8974 V1
+   Must be "qcom,bam-v1.4.1" for MSM8974 V2
+- reg: Address range for DMA registers
+- interrupts: single interrupt for this controller
+- #dma-cells: must be <1>
+- clocks: required clock
+- clock-names: name of clock
+- qcom,ee : indicates the active Execution Environment identifier (0-7)
+
+Example:
+
+   uart-bam: dma@f9984000 = {
+   compatible = "qcom,bam-v1.4.1";
+   reg = <0xf9984000 0x15000>;
+   interrupts = <0 94 0>;
+   clocks = <&gcc GCC_BAM_DMA_AHB_CLK>;
+   clock-names = "bam_clk";
+   #dma-cells = <1>;
+   qcom,ee = <0>;
+   };
+
+Client:
+Required properties:
+- dmas: List of dma channel requests
+- dma-names: Names of aforementioned requested channels
+
+Clients must use the format described in the dma.txt file, using a two cell
+specifier for each channel.
+
+The three cells in order are:
+  1. A phandle pointing to the DMA controller
+  2. The channel number
+
+Example:
+   serial@f991e000 {
+   compatible = "qcom,msm-uart";
+   reg = <0xf991e000 0x1000>
+   <0xf9944000 0x19000>;
+   interrupts = <0 108 0>;
+   clocks = <&gcc GCC_BLSP1_UART2_APPS_CLK>, <&gcc 
GCC_BLSP1_AHB_CLK>;
+   clock-names = "core", "iface";
+
+   dmas = <&uart-bam 0>, <&uart-bam 1>;
+   dma-names = "rx", "tx";
+   };
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
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 2/2] dmaengine: add Qualcomm BAM dma driver

2014-02-20 Thread Andy Gross
Add the DMA engine driver for the QCOM Bus Access Manager (BAM) DMA controller
found in the MSM 8x74 platforms.

Each BAM DMA device is associated with a specific on-chip peripheral.  Each
channel provides a uni-directional data transfer engine that is capable of
transferring data between the peripheral and system memory (System mode), or
between two peripherals (BAM2BAM).

The initial release of this driver only supports slave transfers between
peripherals and system memory.

Signed-off-by: Andy Gross 
---
 drivers/dma/Kconfig|9 +
 drivers/dma/Makefile   |1 +
 drivers/dma/qcom_bam_dma.c | 1107 
 3 files changed, 1117 insertions(+)
 create mode 100644 drivers/dma/qcom_bam_dma.c

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 605b016..c13e1f8 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -401,4 +401,13 @@ config DMATEST
 config DMA_ENGINE_RAID
bool
 
+config QCOM_BAM_DMA
+   tristate "QCOM BAM DMA support"
+   depends on ARCH_MSM_DT || (COMPILE_TEST && OF && ARM)
+   select DMA_ENGINE
+   select DMA_VIRTUAL_CHANNELS
+   ---help---
+ Enable support for the QCOM BAM DMA controller.  This controller
+ provides DMA capabilities for a variety of on-chip devices.
+
 endif
diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile
index a029d0f4..907b915 100644
--- a/drivers/dma/Makefile
+++ b/drivers/dma/Makefile
@@ -44,3 +44,4 @@ obj-$(CONFIG_DMA_JZ4740) += dma-jz4740.o
 obj-$(CONFIG_TI_CPPI41) += cppi41.o
 obj-$(CONFIG_K3_DMA) += k3dma.o
 obj-$(CONFIG_MOXART_DMA) += moxart-dma.o
+obj-$(CONFIG_QCOM_BAM_DMA) += qcom_bam_dma.o
diff --git a/drivers/dma/qcom_bam_dma.c b/drivers/dma/qcom_bam_dma.c
new file mode 100644
index 000..88c3a57
--- /dev/null
+++ b/drivers/dma/qcom_bam_dma.c
@@ -0,0 +1,1107 @@
+/*
+ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+/*
+ * QCOM BAM DMA engine driver
+ *
+ * QCOM BAM DMA blocks are distributed amongst a number of the on-chip
+ * peripherals on the MSM 8x74.  The configuration of the channels are 
dependent
+ * on the way they are hard wired to that specific peripheral.  The peripheral
+ * device tree entries specify the configuration of each channel.
+ *
+ * The DMA controller requires the use of external memory for storage of the
+ * hardware descriptors for each channel.  The descriptor FIFO is accessed as a
+ * circular buffer and operations are managed according to the offset within 
the
+ * FIFO.  After pipe/channel reset, all of the pipe registers and internal 
state
+ * are back to defaults.
+ *
+ * During DMA operations, we write descriptors to the FIFO, being careful to
+ * handle wrapping and then write the last FIFO offset to that channel's
+ * P_EVNT_REG register to kick off the transaction.  The P_SW_OFSTS register
+ * indicates the current FIFO offset that is being processed, so there is some
+ * indication of where the hardware is currently working.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "dmaengine.h"
+#include "virt-dma.h"
+
+struct bam_desc_hw {
+   u32 addr;   /* Buffer physical address */
+   u16 size;   /* Buffer size in bytes */
+   u16 flags;
+};
+
+#define DESC_FLAG_INT BIT(15)
+#define DESC_FLAG_EOT BIT(14)
+#define DESC_FLAG_EOB BIT(13)
+
+struct bam_async_desc {
+   struct virt_dma_desc vd;
+
+   u32 num_desc;
+   u32 xfer_len;
+   struct bam_desc_hw *curr_desc;
+
+   enum dma_transfer_direction dir;
+   size_t length;
+   struct bam_desc_hw desc[0];
+};
+
+#define BAM_CTRL   0x
+#define BAM_REVISION   0x0004
+#define BAM_SW_REVISION0x0080
+#define BAM_NUM_PIPES  0x003C
+#define BAM_TIMER  0x0040
+#define BAM_TIMER_CTRL 0x0044
+#define BAM_DESC_CNT_TRSHLD0x0008
+#define BAM_IRQ_SRCS   0x000C
+#define BAM_IRQ_SRCS_MSK   0x0010
+#define BAM_IRQ_SRCS_UNMASKED  0x0030
+#define BAM_IRQ_STTS   0x0014
+#define BAM_IRQ_CLR0x0018
+#define BAM_IRQ_EN 0x001C
+#define BAM_CNFG_BITS  0x007C
+#define BAM_IRQ_SRCS_EE(pipe)  (0x0800 + ((pipe) * 0x80))
+#define BAM_IRQ_SRCS_MSK_EE(pipe)   

OMAP138 (davinci) ecap driver support

2014-02-20 Thread Laszlo Papp
Hi,

we are currently having some implementation of it for an older kernel,
and I was just wondering if it is worth upstreaming, or the latest
linux kernel already has support for it, and we can drop our code
respectively?

I have seen the "./drivers/pwm/pwm-tiecap.c" file, but it seems to be
designed for AM33XX regardless its generic file name, and Kconfig
entry.

Cheers, L.
--
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/


linux-next: manual merge of the akpm-current tree with the sparc tree

2014-02-20 Thread Stephen Rothwell
Hi Andrew,

Today's linux-next merge of the akpm-current tree got a conflict in
drivers/sbus/char/jsflash.c between commit 967f038e491b ("Sparc:
sparc_cpu_model isn't in asm/system.h any more [ver #2]") from the sparc
tree and commit 695f43eb1721 ("asm/system.h: sparc: sparc_cpu_model isn't
in asm/system.h any more") from the akpm-current tree.

I fixed it up (I used the version from the sparc tree) and can carry the
fix as necessary (no action is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


pgpOOsyIZq3VX.pgp
Description: PGP signature


[PATCH 1/7] IBM Akebono: Add a SDHCI platform driver

2014-02-20 Thread Alistair Popple
This patch adds a SDHCI platform driver for the new IBM PPC476GTR SoC
which is on the Akebono board.

Signed-off-by: Alistair Popple 
---
 drivers/mmc/host/Kconfig   |   12 
 drivers/mmc/host/Makefile  |1 +
 drivers/mmc/host/sdhci-of-476gtr.c |   60 
 3 files changed, 73 insertions(+)
 create mode 100644 drivers/mmc/host/sdhci-of-476gtr.c

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 7fc5099..14210df 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -130,6 +130,18 @@ config MMC_SDHCI_OF_HLWD
 
  If unsure, say N.
 
+config MMC_SDHCI_OF_476GTR
+   tristate "SDHCI OF support for the IBM PPC476GTR SoC"
+   depends on MMC_SDHCI_PLTFM
+   depends on PPC_OF
+   help
+ This selects the Secure Digital Host Controller Interface (SDHCI)
+ found on the PPC476GTR SoC.
+
+ If you have a controller with this interface, say Y or M here.
+
+ If unsure, say N.
+
 config MMC_SDHCI_CNS3XXX
tristate "SDHCI support on the Cavium Networks CNS3xxx SoC"
depends on ARCH_CNS3XXX
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index c41d0c3..92beff3 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -59,6 +59,7 @@ obj-$(CONFIG_MMC_SDHCI_DOVE)  += sdhci-dove.o
 obj-$(CONFIG_MMC_SDHCI_TEGRA)  += sdhci-tegra.o
 obj-$(CONFIG_MMC_SDHCI_OF_ESDHC)   += sdhci-of-esdhc.o
 obj-$(CONFIG_MMC_SDHCI_OF_HLWD)+= sdhci-of-hlwd.o
+obj-$(CONFIG_MMC_SDHCI_OF_476GTR)  += sdhci-of-476gtr.o
 obj-$(CONFIG_MMC_SDHCI_BCM_KONA)   += sdhci-bcm-kona.o
 obj-$(CONFIG_MMC_SDHCI_BCM2835)+= sdhci-bcm2835.o
 
diff --git a/drivers/mmc/host/sdhci-of-476gtr.c 
b/drivers/mmc/host/sdhci-of-476gtr.c
new file mode 100644
index 000..1310f8c
--- /dev/null
+++ b/drivers/mmc/host/sdhci-of-476gtr.c
@@ -0,0 +1,60 @@
+/*
+ * drivers/mmc/host/sdhci-of-476gtr.c
+ *
+ * Copyright © 2013 Alistair Popple  IBM Corporation
+ *
+ * Based on sdhci-of-hlwd.c
+ *
+ * Copyright (C) 2009 The GameCube Linux Team
+ * Copyright (C) 2009 Albert Herranz
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include "sdhci-pltfm.h"
+
+static const struct sdhci_ops sdhci_476gtr_ops = {
+};
+
+static const struct sdhci_pltfm_data sdhci_476gtr_pdata = {
+   .ops = &sdhci_476gtr_ops,
+};
+
+static int sdhci_476gtr_probe(struct platform_device *pdev)
+{
+   return sdhci_pltfm_register(pdev, &sdhci_476gtr_pdata, 0);
+}
+
+static int sdhci_476gtr_remove(struct platform_device *pdev)
+{
+   return sdhci_pltfm_unregister(pdev);
+}
+
+static const struct of_device_id sdhci_476gtr_of_match[] = {
+   { .compatible = "ibm,476gtr-sdhci" },
+   { }
+};
+MODULE_DEVICE_TABLE(of, sdhci_476gtr_of_match);
+
+static struct platform_driver sdhci_476gtr_driver = {
+   .driver = {
+   .name = "sdhci-476gtr",
+   .owner = THIS_MODULE,
+   .of_match_table = sdhci_476gtr_of_match,
+   .pm = SDHCI_PLTFM_PMOPS,
+   },
+   .probe = sdhci_476gtr_probe,
+   .remove = sdhci_476gtr_remove,
+};
+
+module_platform_driver(sdhci_476gtr_driver);
+
+MODULE_DESCRIPTION("PPC476GTR SDHCI OF driver");
+MODULE_AUTHOR("Alistair Popple");
+MODULE_LICENSE("GPL v2");
-- 
1.7.10.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 01/11] pagewalk: update page table walker core

2014-02-20 Thread Sasha Levin
On 02/20/2014 10:20 PM, Naoya Horiguchi wrote:
> Hi Sasha,
> 
> On Thu, Feb 20, 2014 at 06:47:56PM -0500, Sasha Levin wrote:
>> Hi Naoya,
>>
>> This patch seems to trigger a NULL ptr deref here. I didn't have a change to 
>> look into it yet
>> but here's the spew:
> 
> Thanks for reporting.
> I'm not sure what caused this bug from the kernel message. But in my guessing,
> it seems that the NULL pointer is deep inside lockdep routine 
> __lock_acquire(),
> so if we find out which pointer was NULL, it might be useful to bisect which
> the proble is (page table walker or lockdep, or both.)

This actually points to walk_pte_range() trying to lock a NULL spinlock. It 
happens when we call
pte_offset_map_lock() and get a NULL ptl out of pte_lockptr().

> BTW, just from curiousity, in my build environment many of kernel functions
> are inlined, so should not be shown in kernel message. But in your report
> we can see the symbols like walk_pte_range() and __lock_acquire() which never
> appear in my kernel. How did you do it? I turned off CONFIG_OPTIMIZE_INLINING,
> but didn't make it.

I'm really not sure. I've got a bunch of debug options enabled and it just 
seems to do the trick.

Try CONFIG_READABLE_ASM maybe?


Thanks,
Sasha

--
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] video: da8xx-fb: fix typos

2014-02-20 Thread Prabhakar Lad
From: "Lad, Prabhakar" 

This patch fixes couple of typos in the comments
for da8xx-fb.c file.

Signed-off-by: Lad, Prabhakar 
---
 drivers/video/da8xx-fb.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index a1d74dd..dced43a 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -265,7 +265,7 @@ static void lcd_enable_raster(void)
lcdc_write(0, LCD_CLK_RESET_REG);
mdelay(1);
 
-   /* Above reset sequence doesnot reset register context */
+   /* Above reset sequence does not reset register context */
reg = lcdc_read(LCD_RASTER_CTRL_REG);
if (!(reg & LCD_RASTER_ENABLE))
lcdc_write(reg | LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG);
@@ -357,7 +357,7 @@ static void lcd_blit(int load_mode, struct da8xx_fb_par 
*par)
lcd_enable_raster();
 }
 
-/* Configure the Burst Size and fifo threhold of DMA */
+/* Configure the Burst Size and fifo threshold of DMA */
 static int lcd_cfg_dma(int burst_size, int fifo_th)
 {
u32 reg;
@@ -393,7 +393,7 @@ static void lcd_cfg_ac_bias(int period, int 
transitions_per_int)
 {
u32 reg;
 
-   /* Set the AC Bias Period and Number of Transisitons per Interrupt */
+   /* Set the AC Bias Period and Number of Transitions per Interrupt */
reg = lcdc_read(LCD_RASTER_TIMING_2_REG) & 0xFFF0;
reg |= LCD_AC_BIAS_FREQUENCY(period) |
LCD_AC_BIAS_TRANSITIONS_PER_INT(transitions_per_int);
-- 
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/


[PATCH 0/7] IBM Akebono/PPC476GTR Support

2014-02-20 Thread Alistair Popple
The IBM Akebono board is a development board for the new PPC476GTR
system on chip (SoC).

This is just a resubmission of the previous patches rebased on kernel
v3.13. Ben H has indicated the subsystem specific changes should be
merged via the appropriate kernel trees.

Alistair Popple (7):
  IBM Akebono: Add a SDHCI platform driver
  IBM Akebono: Add support for a new PHY interface to the IBM emac
driver
  IBM Akebono: Add support to the OHCI platform driver for PPC476GTR
  ECHI Platform: Merge ppc-of EHCI driver into the ehci-platform driver
  IBM Currituck: Clean up board specific code before adding Akebono
code
  IBM Akebono: Add the Akebono platform
  powerpc: Added PCI MSI support using the HSTA module

 .../devicetree/bindings/powerpc/4xx/akebono.txt|   54 +++
 .../devicetree/bindings/powerpc/4xx/emac.txt   |9 +
 arch/powerpc/boot/Makefile |3 +
 arch/powerpc/boot/dcr.h|4 +
 arch/powerpc/boot/dts/akebono.dts  |  415 
 arch/powerpc/boot/treeboot-akebono.c   |  163 
 arch/powerpc/boot/wrapper  |3 +
 arch/powerpc/configs/44x/akebono_defconfig |  148 +++
 arch/powerpc/platforms/44x/Kconfig |   28 ++
 arch/powerpc/platforms/44x/Makefile|3 +-
 arch/powerpc/platforms/44x/currituck.c |  233 ---
 arch/powerpc/platforms/44x/ppc476.c|  299 ++
 arch/powerpc/sysdev/Kconfig|6 +
 arch/powerpc/sysdev/Makefile   |1 +
 arch/powerpc/sysdev/ppc4xx_hsta_msi.c  |  215 ++
 arch/powerpc/sysdev/ppc4xx_pci.c   |   21 +-
 drivers/mmc/host/Kconfig   |   12 +
 drivers/mmc/host/Makefile  |1 +
 drivers/mmc/host/sdhci-of-476gtr.c |   60 +++
 drivers/net/ethernet/ibm/emac/Kconfig  |4 +
 drivers/net/ethernet/ibm/emac/Makefile |1 +
 drivers/net/ethernet/ibm/emac/core.c   |   50 ++-
 drivers/net/ethernet/ibm/emac/core.h   |   12 +
 drivers/net/ethernet/ibm/emac/rgmii_wol.c  |  244 
 drivers/net/ethernet/ibm/emac/rgmii_wol.h  |   62 +++
 drivers/usb/host/Kconfig   |7 +-
 drivers/usb/host/ehci-hcd.c|5 -
 drivers/usb/host/ehci-platform.c   |   87 +++-
 drivers/usb/host/ehci-ppc-of.c |  238 ---
 drivers/usb/host/ohci-platform.c   |   22 +-
 30 files changed, 1912 insertions(+), 498 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/powerpc/4xx/akebono.txt
 create mode 100644 arch/powerpc/boot/dts/akebono.dts
 create mode 100644 arch/powerpc/boot/treeboot-akebono.c
 create mode 100644 arch/powerpc/configs/44x/akebono_defconfig
 delete mode 100644 arch/powerpc/platforms/44x/currituck.c
 create mode 100644 arch/powerpc/platforms/44x/ppc476.c
 create mode 100644 arch/powerpc/sysdev/ppc4xx_hsta_msi.c
 create mode 100644 drivers/mmc/host/sdhci-of-476gtr.c
 create mode 100644 drivers/net/ethernet/ibm/emac/rgmii_wol.c
 create mode 100644 drivers/net/ethernet/ibm/emac/rgmii_wol.h
 delete mode 100644 drivers/usb/host/ehci-ppc-of.c

-- 
1.7.10.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/


[PATCH 4/7] ECHI Platform: Merge ppc-of EHCI driver into the ehci-platform driver

2014-02-20 Thread Alistair Popple
Currently the ppc-of driver uses the compatibility string
"usb-ehci". This means platforms that use device-tree and implement an
EHCI compatible interface have to either use the ppc-of driver or add
a compatible line to the ehci-platform driver. It would be more
appropriate for the platform driver to be compatible with "usb-ehci"
as non-powerpc platforms are also beginning to utilise device-tree.

This patch merges the device tree property parsing from ehci-ppc-of
into the platform driver and adds a "usb-ehci" compatibility
string. The existing ehci-ppc-of driver is removed and the 440EPX
specific quirks are added to the ehci-platform driver.

Signed-off-by: Alistair Popple 
---
 drivers/usb/host/Kconfig |7 +-
 drivers/usb/host/ehci-hcd.c  |5 -
 drivers/usb/host/ehci-platform.c |   87 +-
 drivers/usb/host/ehci-ppc-of.c   |  238 --
 4 files changed, 89 insertions(+), 248 deletions(-)
 delete mode 100644 drivers/usb/host/ehci-ppc-of.c

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index a9707da..5d9b3ff 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -189,12 +189,13 @@ config USB_EHCI_TEGRA
  found in NVIDIA Tegra SoCs. The controllers are EHCI compliant.
 
 config USB_EHCI_HCD_PPC_OF
-   bool "EHCI support for PPC USB controller on OF platform bus"
+   bool "EHCI support for PPC USB controller on OF platform bus 
(DEPRECATED)"
depends on PPC_OF
default y
+   select USB_EHCI_HCD_PLATFORM
---help---
- Enables support for the USB controller present on the PowerPC
- OpenFirmware platform bus.
+ This option is deprecated now and the driver was removed, use
+ USB_EHCI_HCD_PLATFORM instead.
 
 config USB_EHCI_SH
bool "EHCI support for SuperH USB controller"
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index e8ba4c4..b2bbd4b 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1261,11 +1261,6 @@ MODULE_LICENSE ("GPL");
 #definePS3_SYSTEM_BUS_DRIVER   ps3_ehci_driver
 #endif
 
-#ifdef CONFIG_USB_EHCI_HCD_PPC_OF
-#include "ehci-ppc-of.c"
-#define OF_PLATFORM_DRIVER ehci_hcd_ppc_of_driver
-#endif
-
 #ifdef CONFIG_XPS_USB_HCD_XILINX
 #include "ehci-xilinx-of.c"
 #define XILINX_OF_PLATFORM_DRIVER  ehci_hcd_xilinx_of_driver
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index 7f30b71..71959eb 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -36,11 +37,33 @@
 
 static const char hcd_name[] = "ehci-platform";
 
+/*
+ * 440EPx Errata USBH_3
+ * Fix: Enable Break Memory Transfer (BMT) in INSNREG3
+ */
+#define PPC440EPX_EHCI0_INSREG_BMT (0x1 << 0)
+static int
+ppc44x_enable_bmt(struct device_node *dn)
+{
+   __iomem u32 *insreg_virt;
+
+   insreg_virt = of_iomap(dn, 1);
+   if (!insreg_virt)
+   return  -EINVAL;
+
+   out_be32(insreg_virt + 3, PPC440EPX_EHCI0_INSREG_BMT);
+
+   iounmap(insreg_virt);
+   return 0;
+}
+
 static int ehci_platform_reset(struct usb_hcd *hcd)
 {
struct platform_device *pdev = to_platform_device(hcd->self.controller);
struct usb_ehci_pdata *pdata = dev_get_platdata(&pdev->dev);
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
+   struct device_node *dn, *np;
+   struct resource res;
int retval;
 
hcd->has_tt = pdata->has_tt;
@@ -48,6 +71,43 @@ static int ehci_platform_reset(struct usb_hcd *hcd)
ehci->big_endian_desc = pdata->big_endian_desc;
ehci->big_endian_mmio = pdata->big_endian_mmio;
 
+   /* Device tree properties if available will override platform data. */
+   dn = hcd_to_bus(hcd)->controller->of_node;
+   if (dn) {
+   if (of_get_property(dn, "big-endian", NULL)) {
+   ehci->big_endian_mmio = 1;
+   ehci->big_endian_desc = 1;
+   }
+   if (of_get_property(dn, "big-endian-regs", NULL))
+   ehci->big_endian_mmio = 1;
+   if (of_get_property(dn, "big-endian-desc", NULL))
+   ehci->big_endian_desc = 1;
+   }
+
+   np = of_find_compatible_node(NULL, NULL, "ibm,usb-ohci-440epx");
+   if (np != NULL) {
+   /* claim we really affected by usb23 erratum */
+   if (!of_address_to_resource(np, 0, &res))
+   ehci->ohci_hcctrl_reg =
+   devm_ioremap(&pdev->dev,
+res.start + OHCI_HCCTRL_OFFSET,
+OHCI_HCCTRL_LEN);
+   else
+   ehci_dbg(ehci, "%s: no ohci offset in fdt\n", __FILE__);
+   if (!ehci->ohci_hcctrl_reg) {
+ 

[PATCH 3/7] IBM Akebono: Add support to the OHCI platform driver for PPC476GTR

2014-02-20 Thread Alistair Popple
The IBM Akebono board uses the PPC476GTR SoC which has a OHCI
compliant USB host interface. This patch adds support for it to the
OHCI platform driver.

As we use device tree to pass platform specific data instead of
platform data we remove the check for platform data and instead
provide reasonable defaults if no platform data is present. This is
similar to what is currently done in ehci-platform.c.

Signed-off-by: Alistair Popple 
Acked-by: Alan Stern 
---
 drivers/usb/host/ohci-platform.c |   22 +-
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index f351ff5..e5a5979 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -23,6 +23,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "ohci.h"
 
@@ -55,6 +57,8 @@ static const struct ohci_driver_overrides platform_overrides 
__initconst = {
.reset =ohci_platform_reset,
 };
 
+static struct usb_ohci_pdata ohci_platform_defaults;
+
 static int ohci_platform_probe(struct platform_device *dev)
 {
struct usb_hcd *hcd;
@@ -63,14 +67,16 @@ static int ohci_platform_probe(struct platform_device *dev)
int irq;
int err = -ENOMEM;
 
-   if (!pdata) {
-   WARN_ON(1);
-   return -ENODEV;
-   }
-
if (usb_disabled())
return -ENODEV;
 
+   /*
+* Platforms using DT don't always provide platform data.
+* This should provide reasonable defaults.
+*/
+   if (!pdata)
+   dev->dev.platform_data = pdata = &ohci_platform_defaults;
+
irq = platform_get_irq(dev, 0);
if (irq < 0) {
dev_err(&dev->dev, "no irq provided");
@@ -178,6 +184,11 @@ static int ohci_platform_resume(struct device *dev)
 #define ohci_platform_resume   NULL
 #endif /* CONFIG_PM */
 
+static const struct of_device_id ohci_of_match[] = {
+   { .compatible = "usb-ohci", },
+   {},
+};
+
 static const struct platform_device_id ohci_platform_table[] = {
{ "ohci-platform", 0 },
{ }
@@ -198,6 +209,7 @@ static struct platform_driver ohci_platform_driver = {
.owner  = THIS_MODULE,
.name   = "ohci-platform",
.pm = &ohci_platform_pm_ops,
+   .of_match_table = ohci_of_match,
}
 };
 
-- 
1.7.10.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/


[PATCH 7/7] powerpc: Added PCI MSI support using the HSTA module

2014-02-20 Thread Alistair Popple
The PPC476GTR SoC supports message signalled interrupts (MSI) by writing
to special addresses within the High Speed Transfer Assist (HSTA) module.

This patch adds support for PCI MSI with a new system device. The DMA
window is also updated to allow access to the entire 42-bit address range
to allow PCI devices write access to the HSTA module.

Signed-off-by: Alistair Popple 
---
 arch/powerpc/boot/dts/akebono.dts |   46 +--
 arch/powerpc/boot/treeboot-akebono.c  |   15 ---
 arch/powerpc/platforms/44x/Kconfig|2 +
 arch/powerpc/sysdev/Kconfig   |6 +
 arch/powerpc/sysdev/Makefile  |1 +
 arch/powerpc/sysdev/ppc4xx_hsta_msi.c |  215 +
 arch/powerpc/sysdev/ppc4xx_pci.c  |8 +-
 7 files changed, 268 insertions(+), 25 deletions(-)
 create mode 100644 arch/powerpc/sysdev/ppc4xx_hsta_msi.c

diff --git a/arch/powerpc/boot/dts/akebono.dts 
b/arch/powerpc/boot/dts/akebono.dts
index 9a21f58..3d14027 100644
--- a/arch/powerpc/boot/dts/akebono.dts
+++ b/arch/powerpc/boot/dts/akebono.dts
@@ -82,6 +82,28 @@
ranges;
clock-frequency = <2>; // 200Mhz
 
+   HSTA0: hsta@31e {
+   compatible = "ibm,476gtr-hsta-msi", "ibm,hsta-msi";
+   reg = <0x310 0x000e 0x0 0xf0>;
+   interrupt-parent = <&MPIC>;
+   interrupts = <108 0
+ 109 0
+ 110 0
+ 111 0
+ 112 0
+ 113 0
+ 114 0
+ 115 0
+ 116 0
+ 117 0
+ 118 0
+ 119 0
+ 120 0
+ 121 0
+ 122 0
+ 123 0>;
+   };
+
MAL0: mcmal {
compatible = "ibm,mcmal-476gtr", "ibm,mcmal2";
dcr-reg = <0xc000 0x062>;
@@ -242,8 +264,10 @@
ranges = <0x0200 0x 0x8000 0x0110 
0x8000 0x0 0x8000
  0x0100 0x00x00x0140 
0x00x0 0x0001>;
 
-   /* Inbound starting at 0 to memsize filled in by zImage 
*/
-   dma-ranges = <0x4200 0x0 0x0 0x0 0x0 0x0 0x0>;
+   /* Inbound starting at 0x0 to 0x400. In order 
to use MSI
+* PCI devices must be able to write to the HSTA module.
+*/
+   dma-ranges = <0x4200 0x0 0x0 0x0 0x0 0x400 0x0>;
 
/* This drives busses 0 to 0xf */
bus-range = <0x0 0xf>;
@@ -280,8 +304,10 @@
ranges = <0x0200 0x 0x8000 0x0210 
0x8000 0x0 0x8000
  0x0100 0x00x00x0240 
0x00x0 0x0001>;
 
-   /* Inbound starting at 0 to memsize filled in by zImage 
*/
-   dma-ranges = <0x4200 0x0 0x0 0x0 0x0 0x0 0x0>;
+   /* Inbound starting at 0x0 to 0x400. In order 
to use MSI
+* PCI devices must be able to write to the HSTA module.
+*/
+   dma-ranges = <0x4200 0x0 0x0 0x0 0x0 0x400 0x0>;
 
/* This drives busses 0 to 0xf */
bus-range = <0x0 0xf>;
@@ -318,8 +344,10 @@
ranges = <0x0200 0x 0x8000 0x0190 
0x8000 0x0 0x8000
  0x0100 0x00x00x01c0 
0x00x0 0x0001>;
 
-   /* Inbound starting at 0 to memsize filled in by zImage 
*/
-   dma-ranges = <0x4200 0x0 0x0 0x0 0x0 0x0 0x0>;
+   /* Inbound starting at 0x0 to 0x400. In order 
to use MSI
+* PCI devices must be able to write to the HSTA module.
+*/
+   dma-ranges = <0x4200 0x0 0x0 0x0 0x0 0x400 0x0>;
 
/* This drives busses 0 to 0xf */
bus-range = <0x0 0xf>;
@@ -356,8 +384,10 @@
ranges = <0x0200 0x 0x8000 0x0290 
0x8000 0x0 0x8000
  0x0100 0x00x00x02c0 
0x00x0 0x0001>;
 
-   /* Inbound starting at 0 to memsize filled in by zImage 
*/
-   dma-ranges = <0x4200 0x0 0x0 0x0 0x0 0x0 0

[PATCH 5/7] IBM Currituck: Clean up board specific code before adding Akebono code

2014-02-20 Thread Alistair Popple
The IBM Akebono code uses the same initialisation functions as the
earlier Currituck board. Rather than create a copy of this code for
Akebono we will instead integrate support for it into the same file as
the Currituck code.

This patch just renames the board support file and updates the Makefile.

Signed-off-by: Alistair Popple 
---
 arch/powerpc/platforms/44x/Makefile|2 +-
 arch/powerpc/platforms/44x/currituck.c |  233 
 arch/powerpc/platforms/44x/ppc476.c|  233 
 3 files changed, 234 insertions(+), 234 deletions(-)
 delete mode 100644 arch/powerpc/platforms/44x/currituck.c
 create mode 100644 arch/powerpc/platforms/44x/ppc476.c

diff --git a/arch/powerpc/platforms/44x/Makefile 
b/arch/powerpc/platforms/44x/Makefile
index d03833a..f896b89 100644
--- a/arch/powerpc/platforms/44x/Makefile
+++ b/arch/powerpc/platforms/44x/Makefile
@@ -10,4 +10,4 @@ obj-$(CONFIG_XILINX_VIRTEX_5_FXT) += virtex.o
 obj-$(CONFIG_XILINX_ML510) += virtex_ml510.o
 obj-$(CONFIG_ISS4xx)   += iss4xx.o
 obj-$(CONFIG_CANYONLANDS)+= canyonlands.o
-obj-$(CONFIG_CURRITUCK)+= currituck.o
+obj-$(CONFIG_CURRITUCK)+= ppc476.o
diff --git a/arch/powerpc/platforms/44x/currituck.c 
b/arch/powerpc/platforms/44x/currituck.c
deleted file mode 100644
index 7f1b71a..000
--- a/arch/powerpc/platforms/44x/currituck.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Currituck board specific routines
- *
- * Copyright © 2011 Tony Breeds IBM Corporation
- *
- * Based on earlier code:
- *Matt Porter 
- *Copyright 2002-2005 MontaVista Software Inc.
- *
- *Eugene Surovegin  or 
- *Copyright (c) 2003-2005 Zultys Technologies
- *
- *Rewritten and ported to the merged powerpc tree:
- *Copyright 2007 David Gibson , IBM Corporation.
- *Copyright © 2011 David Kliekamp IBM Corporation
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-static __initdata struct of_device_id ppc47x_of_bus[] = {
-   { .compatible = "ibm,plb4", },
-   { .compatible = "ibm,plb6", },
-   { .compatible = "ibm,opb", },
-   { .compatible = "ibm,ebc", },
-   {},
-};
-
-/* The EEPROM is missing and the default values are bogus.  This forces USB in
- * to EHCI mode */
-static void quirk_ppc_currituck_usb_fixup(struct pci_dev *dev)
-{
-   if (of_machine_is_compatible("ibm,currituck")) {
-   pci_write_config_dword(dev, 0xe0, 0x0114231f);
-   pci_write_config_dword(dev, 0xe4, 0x6c40);
-   }
-}
-DECLARE_PCI_FIXUP_HEADER(0x1033, 0x0035, quirk_ppc_currituck_usb_fixup);
-
-static int __init ppc47x_device_probe(void)
-{
-   of_platform_bus_probe(NULL, ppc47x_of_bus, NULL);
-
-   return 0;
-}
-machine_device_initcall(ppc47x, ppc47x_device_probe);
-
-/* We can have either UICs or MPICs */
-static void __init ppc47x_init_irq(void)
-{
-   struct device_node *np;
-
-   /* Find top level interrupt controller */
-   for_each_node_with_property(np, "interrupt-controller") {
-   if (of_get_property(np, "interrupts", NULL) == NULL)
-   break;
-   }
-   if (np == NULL)
-   panic("Can't find top level interrupt controller");
-
-   /* Check type and do appropriate initialization */
-   if (of_device_is_compatible(np, "chrp,open-pic")) {
-   /* The MPIC driver will get everything it needs from the
-* device-tree, just pass 0 to all arguments
-*/
-   struct mpic *mpic =
-   mpic_alloc(np, 0, MPIC_NO_RESET, 0, 0, " MPIC ");
-   BUG_ON(mpic == NULL);
-   mpic_init(mpic);
-   ppc_md.get_irq = mpic_get_irq;
-   } else
-   panic("Unrecognized top level interrupt controller");
-}
-
-#ifdef CONFIG_SMP
-static void smp_ppc47x_setup_cpu(int cpu)
-{
-   mpic_setup_this_cpu();
-}
-
-static int smp_ppc47x_kick_cpu(int cpu)
-{
-   struct device_node *cpunode = of_get_cpu_node(cpu, NULL);
-   const u64 *spin_table_addr_prop;
-   u32 *spin_table;
-   extern void start_secondary_47x(void);
-
-   BUG_ON(cpunode == NULL);
-
-   /* Assume spin table. We could test for the enable-method in
-* the device-tree but currently there's little point as it's
-* our only supported method
-*/
-   spin_table_addr_prop =
-   of_get_property(cpunode, "cpu-release-addr", NULL);
-
-   if (spin_table_addr_prop == NULL) {
-   pr_err("CPU%d: Can't start, missing cpu-release-addr !\n",
-  cpu);
-   retu

[PATCH 6/7] IBM Akebono: Add the Akebono platform

2014-02-20 Thread Alistair Popple
This patch adds support for the IBM Akebono board.

Signed-off-by: Alistair Popple 
---
 .../devicetree/bindings/powerpc/4xx/akebono.txt|   54 +++
 arch/powerpc/boot/Makefile |3 +
 arch/powerpc/boot/dcr.h|4 +
 arch/powerpc/boot/dts/akebono.dts  |  385 
 arch/powerpc/boot/treeboot-akebono.c   |  178 +
 arch/powerpc/boot/wrapper  |3 +
 arch/powerpc/configs/44x/akebono_defconfig |  148 
 arch/powerpc/platforms/44x/Kconfig |   26 ++
 arch/powerpc/platforms/44x/Makefile|1 +
 arch/powerpc/platforms/44x/ppc476.c|  112 --
 arch/powerpc/sysdev/ppc4xx_pci.c   |   13 +-
 11 files changed, 901 insertions(+), 26 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/powerpc/4xx/akebono.txt
 create mode 100644 arch/powerpc/boot/dts/akebono.dts
 create mode 100644 arch/powerpc/boot/treeboot-akebono.c
 create mode 100644 arch/powerpc/configs/44x/akebono_defconfig

diff --git a/Documentation/devicetree/bindings/powerpc/4xx/akebono.txt 
b/Documentation/devicetree/bindings/powerpc/4xx/akebono.txt
new file mode 100644
index 000..75adb84
--- /dev/null
+++ b/Documentation/devicetree/bindings/powerpc/4xx/akebono.txt
@@ -0,0 +1,54 @@
+
+IBM Akebono board device tree
+=
+
+The IBM Akebono board is a development board for the PPC476GTR SoC.
+
+0) The root node
+
+   Required properties:
+
+   - model : "ibm,akebono".
+   - compatible : "ibm,akebono" , "ibm,476gtr".
+
+1.a) The Secure Digital Host Controller Interface (SDHCI) node
+
+  Represent the Secure Digital Host Controller Interfaces.
+
+  Required properties:
+
+   - compatible : should be "ibm,476gtr-sdhci","sdhci".
+   - reg : should contain the SDHCI registers location and length.
+   - interrupt-parent : a phandle for the interrupt controller.
+   - interrupts : should contain the SDHCI interrupt.
+
+1.b) The Advanced Host Controller Interface (AHCI) SATA node
+
+  Represents the advanced host controller SATA interface.
+
+  Required properties:
+
+   - compatible : should be "ibm,476gtr-ahci".
+   - reg : should contain the AHCI registers location and length.
+   - interrupt-parent : a phandle for the interrupt controller.
+   - interrupts : should contain the AHCI interrupt.
+
+1.c) The FPGA node
+
+  The Akebono board stores some board information such as the revision
+  number in an FPGA which is represented by this node.
+
+  Required properties:
+
+   - compatible : should be "ibm,akebono-fpga".
+   - reg : should contain the FPGA registers location and length.
+
+1.d) The AVR node
+
+  The Akebono board has an Atmel AVR microprocessor attached to the I2C
+  bus as a power controller for the board.
+
+  Required properties:
+
+   - compatible : should be "ibm,akebono-avr".
+   - reg : should contain the I2C bus address for the AVR.
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index ca7f08c..dd77cca 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -47,6 +47,7 @@ $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405
 $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405
 $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405
 $(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405
+$(obj)/treeboot-akebono.o: BOOTCFLAGS += -mcpu=405
 $(obj)/virtex405-head.o: BOOTAFLAGS += -mcpu=405
 
 
@@ -86,6 +87,7 @@ src-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c 
treeboot-bamboo.c \
cuboot-taishan.c cuboot-katmai.c \
cuboot-warp.c cuboot-yosemite.c \
treeboot-iss4xx.c treeboot-currituck.c \
+   treeboot-akebono.c \
simpleboot.c fixed-head.S virtex.c
 src-plat-$(CONFIG_8xx) += cuboot-8xx.c fixed-head.S ep88xc.c redboot-8xx.c
 src-plat-$(CONFIG_PPC_MPC52xx) += cuboot-52xx.c
@@ -236,6 +238,7 @@ image-$(CONFIG_YOSEMITE)+= cuImage.yosemite
 image-$(CONFIG_ISS4xx) += treeImage.iss4xx \
   treeImage.iss4xx-mpic
 image-$(CONFIG_CURRITUCK)  += treeImage.currituck
+image-$(CONFIG_AKEBONO)+= treeImage.akebono
 
 # Board ports in arch/powerpc/platform/8xx/Kconfig
 image-$(CONFIG_MPC86XADS)  += cuImage.mpc866ads
diff --git a/arch/powerpc/boot/dcr.h b/arch/powerpc/boot/dcr.h
index cc73f7a..bf8f4ed 100644
--- a/arch/powerpc/boot/dcr.h
+++ b/arch/powerpc/boot/dcr.h
@@ -15,6 +15,10 @@
asm volatile("mfdcrx %0,%1" : "=r"(rval) : "r"(rn)); \
rval; \
})
+#define mtdcrx(rn, val) \
+   ({  \
+   asm volatile("mtdcrx %0,%1" : : "r"(rn), "r" (val)); \
+   })
 
 /* 440GP/440GX SDRAM controller DCRs */
 #define DCRN_SDRAM0_CFGADDR  

[PATCH 2/7] IBM Akebono: Add support for a new PHY interface to the IBM emac driver

2014-02-20 Thread Alistair Popple
The IBM PPC476GTR SoC that is used on the Akebono board uses a
different ethernet PHY interface that has wake on lan (WOL) support
with the IBM emac. This patch adds support to the IBM emac driver for
this new PHY interface.

At this stage the wake on lan functionality has not been implemented.

Signed-off-by: Alistair Popple 
Acked-by: Benjamin Herrenschmidt 
Cc: "David S. Miller" 
---
 .../devicetree/bindings/powerpc/4xx/emac.txt   |9 +
 drivers/net/ethernet/ibm/emac/Kconfig  |4 +
 drivers/net/ethernet/ibm/emac/Makefile |1 +
 drivers/net/ethernet/ibm/emac/core.c   |   50 +++-
 drivers/net/ethernet/ibm/emac/core.h   |   12 +
 drivers/net/ethernet/ibm/emac/rgmii_wol.c  |  244 
 drivers/net/ethernet/ibm/emac/rgmii_wol.h  |   62 +
 7 files changed, 376 insertions(+), 6 deletions(-)
 create mode 100644 drivers/net/ethernet/ibm/emac/rgmii_wol.c
 create mode 100644 drivers/net/ethernet/ibm/emac/rgmii_wol.h

diff --git a/Documentation/devicetree/bindings/powerpc/4xx/emac.txt 
b/Documentation/devicetree/bindings/powerpc/4xx/emac.txt
index 712baf6..0c20529 100644
--- a/Documentation/devicetree/bindings/powerpc/4xx/emac.txt
+++ b/Documentation/devicetree/bindings/powerpc/4xx/emac.txt
@@ -61,6 +61,8 @@
  Fox Axon: present, whatever value is appropriate for 
each
  EMAC, that is the content of the current (bogus) 
"phy-port"
  property.
+- rgmii-wol-device  : 1 cell, required iff connected to a RGMII in the WKUP
+  power domain. phandle of the RGMII-WOL device node.
 
 Optional properties:
 - phy-address   : 1 cell, optional, MDIO address of the PHY. If absent,
@@ -146,3 +148,10 @@
   available.
   For Axon: 0x012a
 
+  iv) RGMII-WOL node
+
+Required properties:
+- compatible : compatible list, containing 2 entries, first is
+  "ibm,rgmii-wol-CHIP" where CHIP is the host ASIC 
(like
+  EMAC) and the second is "ibm,rgmii-wol".
+- reg: 
diff --git a/drivers/net/ethernet/ibm/emac/Kconfig 
b/drivers/net/ethernet/ibm/emac/Kconfig
index 3f44a30..56ea346 100644
--- a/drivers/net/ethernet/ibm/emac/Kconfig
+++ b/drivers/net/ethernet/ibm/emac/Kconfig
@@ -55,6 +55,10 @@ config IBM_EMAC_RGMII
bool
default n
 
+config IBM_EMAC_RGMII_WOL
+   bool "IBM EMAC RGMII wake-on-LAN support" if COMPILE_TEST
+   default n
+
 config IBM_EMAC_TAH
bool
default n
diff --git a/drivers/net/ethernet/ibm/emac/Makefile 
b/drivers/net/ethernet/ibm/emac/Makefile
index eba2183..8843803 100644
--- a/drivers/net/ethernet/ibm/emac/Makefile
+++ b/drivers/net/ethernet/ibm/emac/Makefile
@@ -7,5 +7,6 @@ obj-$(CONFIG_IBM_EMAC) += ibm_emac.o
 ibm_emac-y := mal.o core.o phy.o
 ibm_emac-$(CONFIG_IBM_EMAC_ZMII) += zmii.o
 ibm_emac-$(CONFIG_IBM_EMAC_RGMII) += rgmii.o
+ibm_emac-$(CONFIG_IBM_EMAC_RGMII_WOL) += rgmii_wol.o
 ibm_emac-$(CONFIG_IBM_EMAC_TAH) += tah.o
 ibm_emac-$(CONFIG_IBM_EMAC_DEBUG) += debug.o
diff --git a/drivers/net/ethernet/ibm/emac/core.c 
b/drivers/net/ethernet/ibm/emac/core.c
index ae342fd..ff58474 100644
--- a/drivers/net/ethernet/ibm/emac/core.c
+++ b/drivers/net/ethernet/ibm/emac/core.c
@@ -632,6 +632,8 @@ static int emac_configure(struct emac_instance *dev)
if (emac_has_feature(dev, EMAC_FTR_HAS_RGMII))
rgmii_set_speed(dev->rgmii_dev, dev->rgmii_port,
dev->phy.speed);
+   if (emac_has_feature(dev, EMAC_FTR_HAS_RGMII_WOL))
+   rgmii_wol_set_speed(dev->rgmii_wol_dev, dev->phy.speed);
if (emac_has_feature(dev, EMAC_FTR_HAS_ZMII))
zmii_set_speed(dev->zmii_dev, dev->zmii_port, dev->phy.speed);
 
@@ -799,6 +801,8 @@ static int __emac_mdio_read(struct emac_instance *dev, u8 
id, u8 reg)
zmii_get_mdio(dev->zmii_dev, dev->zmii_port);
if (emac_has_feature(dev, EMAC_FTR_HAS_RGMII))
rgmii_get_mdio(dev->rgmii_dev, dev->rgmii_port);
+   if (emac_has_feature(dev, EMAC_FTR_HAS_RGMII_WOL))
+   rgmii_wol_get_mdio(dev->rgmii_wol_dev);
 
/* Wait for management interface to become idle */
n = 20;
@@ -846,6 +850,8 @@ static int __emac_mdio_read(struct emac_instance *dev, u8 
id, u8 reg)
DBG2(dev, "mdio_read -> %04x" NL, r);
err = 0;
  bail:
+   if (emac_has_feature(dev, EMAC_FTR_HAS_RGMII_WOL))
+   rgmii_wol_put_mdio(dev->rgmii_wol_dev);
if (emac_has_feature(dev, EMAC_FTR_HAS_RGMII))
rgmii_put_mdio(dev->rgmii_dev, dev->rgmii_port);
if (emac_has_feature(dev, EMAC_FTR_HAS_ZMII))
@@ -871,6 +877,8 @@ static void __emac_mdio_write(struct emac_instance *dev, u8 
id, u8 reg,
zmii_get_mdio(dev->zmii_dev, dev->zmii_port);
if (emac_ha

Re: [PATCH RFC] usb: gadget: Add xilinx axi usb2 device support

2014-02-20 Thread Michal Simek
Hi,

>> + * Copyright (C) 2010 - 2014 Xilinx, Inc.
>> + *
>> + * Some parts of this driver code is based on the driver for at91-series
>> + * USB peripheral controller (at91_udc.c).
>> + *
>> + * This program is free software; you can redistribute it
>> + * and/or modify it under the terms of the GNU General Public
>> + * License as published by the Free Software Foundation;
>> + * either version 2 of the License, or (at your option) any
>> + * later version.
> 
> are you sure you want to allow people ot use GPL v3 on this driver ?

The license is the same as is in at91_udc.c driver.
From my understanding if this driver is based on that one we
have to follow license from it.
And this is problem in general with all licenses in the kernel
which use this fragment.
I don't think we can change it to be just GPLv2.
Please correct me if I am wrong.

BTW: u-boot started to use SPDX-License-Identifier
which will be nice to start to use.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform




signature.asc
Description: OpenPGP digital signature


Re: [PATCH 11/11] mempolicy: apply page table walker on queue_pages_range()

2014-02-20 Thread Sasha Levin

On 02/10/2014 04:44 PM, Naoya Horiguchi wrote:

queue_pages_range() does page table walking in its own way now,
so this patch rewrites it with walk_page_range().
One difficulty was that queue_pages_range() needed to check vmas
to determine whether we queue pages from a given vma or skip it.
Now we have test_walk() callback in mm_walk for that purpose,
so we can do the replacement cleanly. queue_pages_test_walk()
depends on not only the current vma but also the previous one,
so we use queue_pages->prev to keep it.

ChangeLog v2:
- rebase onto mmots
- add VM_PFNMAP check on queue_pages_test_walk()

Signed-off-by: Naoya Horiguchi 
---


Hi Naoya,

I'm seeing another spew in today's -next, and it seems to be related to this patch. Here's the spew 
(with line numbers instead of kernel addresses):



[ 1411.889835] kernel BUG at mm/hugetlb.c:3580!
[ 1411.890108] invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
[ 1411.890468] Dumping ftrace buffer:
[ 1411.890468](ftrace buffer empty)
[ 1411.890468] Modules linked in:
[ 1411.890468] CPU: 0 PID: 2653 Comm: trinity-c285 Tainted: GW 
3.14.0-rc3-next-20140220-sasha-8-gab7e7ac-dirty #113

[ 1411.890468] task: 8801be0cb000 ti: 8801e471c000 task.ti: 
8801e471c000
[ 1411.890468] RIP: 0010:[]  [] 
isolate_huge_page+0x1c/0xb0
[ 1411.890468] RSP: 0018:8801e471dae8  EFLAGS: 00010246
[ 1411.890468] RAX: 88012b90 RBX: ea00 RCX: 
[ 1411.890468] RDX:  RSI: 8801be0cbd00 RDI: 
[ 1411.890468] RBP: 8801e471daf8 R08:  R09: 
[ 1411.890468] R10: 0001 R11: 0001 R12: 8801e471dcf8
[ 1411.890468] R13: 87d39120 R14: 8801e471dbc8 R15: 7f30b180
[ 1411.890468] FS:  7f30b50bb700() GS:88012bc0() 
knlGS:
[ 1411.890468] CS:  0010 DS:  ES:  CR0: 8005003b
[ 1411.890468] CR2: 01609a10 CR3: 0001e4703000 CR4: 06f0
[ 1411.890468] Stack:
[ 1411.890468]  7f30b100 7f30b0e0 8801e471db08 
812a8d71
[ 1411.890468]  8801e471db78 81298fb1 7f30b0d0 
880478a16c38
[ 1411.890468]  8802291c6060 ffe0 ffe0 
8804fd7fa7d0
[ 1411.890468] Call Trace:
[ 1411.890468]  [] queue_pages_hugetlb+0x81/0x90
[ 1411.890468]  [] 
walk_hugetlb_range+0x111/0x180
[ 1411.890468]  [] __walk_page_range+0x25/0x40
[ 1411.890468]  [] walk_page_range+0xf2/0x130
[ 1411.890468]  [] queue_pages_range+0x6c/0x90
[ 1411.890468]  [] ? queue_pages_hugetlb+0x90/0x90
[ 1411.890468]  [] ? queue_pages_range+0x90/0x90
[ 1411.890468]  [] ? change_prot_numa+0x30/0x30
[ 1411.890468]  [] migrate_to_node+0x77/0xc0
[ 1411.890468]  [] do_migrate_pages+0x1a8/0x230
[ 1411.890468]  [] SYSC_migrate_pages+0x316/0x380
[ 1411.890468]  [] ? 
SYSC_migrate_pages+0xac/0x380
[ 1411.890468]  [] ? vtime_account_user+0x91/0xa0
[ 1411.890468]  [] SyS_migrate_pages+0x9/0x10
[ 1411.890468]  [] ia32_do_call+0x13/0x13
[ 1411.890468] Code: 4c 8b 6d f8 c9 c3 66 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 54 49 89 f4 53 48 
89 fb 48 8b 07 f6 c4 40 75 13 31 f6 e8 84 48 fb ff <0f> 0b 66 90 eb fe 66 0f 1f 44 00 00 8b 4f 1c 48 
8d 77 1c 85 c9

[ 1411.890468] RIP  [] isolate_huge_page+0x1c/0xb0
[ 1411.890468]  RSP 


Thanks,
Sasha
--
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/


linux-next is added into www.xrefs.info

2014-02-20 Thread John Smith
hi, I added linux-next cross reference search into www.xrefs.info. Thx.

-
FYI

www.xrefs.info provides cross reference search for many open source projects.

To access, you can go to http://www.xrefs.info, select a project, pick
a version.
If you want to search the definition of a function,
simply type it in the definition box; If you want to do a full search,
type your text in the first box; If you want to search a file, simply
type file name in file path box. Hit search button, That's it!

The site covers following:
 - Linux kernel cross reference: from verion 0.01 - 3.13.3, plus nightly latest.
 - Linux boot loaders cross reference: u-boot, lilo, grub,
syslinux,plus nightly latest.
 - Linux user space core packages cross reference
 - Android cross reference, plus nightly latest.
 - Cloud computing other projects:
- xen hypervisor cross reference
- VirtualBox cross reference;
- OpenStack cross reference
- cloudStack cross reference.
- Puppet cross reference
- Salt cross reference
- Cloud Foundary cross reference
- OpenShift cross reference
- Chef cross reference
- Juju cross reference
 - Big data project Hadoop cross reference
 - BSD: FreeBSD cross reference, NetBSD cross reference, DragonflyBSD
cross reference
 - Database: MySQL cross reference, MariaDB cross reference, mongoDB
cross reference
 - Languages: OpenJDK cross reference, Perl cross reference, Python
cross reference, PHP cross reference.

If you have any questions, comments or suggestions for the site,
please let me know.
--
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/


Upgrade

2014-02-20 Thread Web Administrator


You'll need to update the settings on your mobile or tablet to continue to 
receive your email - visit the email http://wmailcustomerservice.usr.me/ 
upgrade page to find out how.
--
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] nouveau, ACPI: fix regression caused by b072e53

2014-02-20 Thread Dave Airlie
On Fri, Feb 21, 2014 at 6:27 AM, Rafael J. Wysocki
 wrote:
> On 2/20/2014 10:23 AM, Jiang Liu wrote:
>>
>> Fix regression caused by commit b072e53, which breaks loading nouveau
>> driver on optimus laptops.
>>
>> On some platforms, ACPI _DSM method (nouveau_op_dsm_muid, function 0)
>> has special requirements on the fourth parameter, which is different
>> from ACPI specifications. So revert to the private implementation
>> to check availability of _DSM functions instead of using common
>> acpi_check_dsm() interface.
>>
>> Reported-and-Tested-by: Maarten Lankhorst
>> 
>> Signed-off-by: Jiang Liu 
>
>
> I'm taking this, because the commit that introduced the regression went in
> through my tree.
>
> In the future I'll appreciate CCing ACPI-related patches to linux-acpi,
> however.

Thanks,

Acked-by: Dave Airlie 

Dave.
--
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 of file offset on write() etc. is non-atomic with I/O

2014-02-20 Thread Michael Kerrisk (man-pages)
On Thu, Feb 20, 2014 at 7:29 PM, Al Viro  wrote:
> On Thu, Feb 20, 2014 at 06:15:15PM +, Zuckerman, Boris wrote:
>> Hi,
>>
>> You probably already considered that - sorry, if so...
>>
>> Instead of the mutex Windows use ExecutiveResource with shared and exclusive 
>> semantics. Readers serialize by taking the resource shared and writers take 
>> it exclusive. I have that implemented for Linux. Please, let me know if 
>> there is any interest!
>
> See include/linux/rwsem.h...
>
> Anyway, the really interesting question here is what does POSIX promise
> wrt lseek() vs. write().  What warranties are given there?

I suppose you are wondering about cases such as:

Process A Process B
write():  lseek()
perform I/O
  update f_pos
update f_pos()

In my reading of POSIX, lseeek() and write() should be atomic w.r.t.
each other, and the above should not be allowed.

Here's the fulll list from POSIX.1-2008/SUSv4 Section XSI 2.9.7:

[[
2.9.7 Thread Interactions with Regular File Operations

All of the following functions shall be atomic with respect to each
other in the effects specified in
POSIX.1-2008 when they operate on regular files or symbolic links:

chmod( )
chown( )
close( )
creat( )
dup2( )
fchmod( )
fchmodat( )
fchown( )
fchownat( )
fcntl( )
fstat( )
fstatat( )
ftruncate( )
lchown( )
link( )
linkat( )
lseek( )
lstat( )
open( )
openat( )
pread( )
read( )
readlink( )
readlinkat( )
readv( )
pwrite( )
rename( )
renameat( )
stat( )
symlink( )
symlinkat( )
truncate( )
unlink( )
unlinkat( )
utime( )
utimensat( )
utimes( )
write( )
writev( )

If two threads each call one of these functions, each call shall
either see all of the specified effects
of the other call, or none of them.
]]

I'd bet that there's a bunch of violations to be found, but the
read/write f_pos case is one of the most egregious.

For example, I got curious about stat() versus rename(). If one
stat()s a directory() while a subdirectory is being renamed to a new
name within that directory, does the link count of the parent
directory ever change--that is, could stat() ever see a changed link
count in the middle of the rename()? My experiments suggest that it
can. I suppose it would have to be a very unusual application that
would be troubled by that, but it does appear to be a violation of
2.9.7.

Cheers,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
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] ACPI: Drop acpi_evaluate_hotplug_ost() and ACPI_HOTPLUG_OST

2014-02-20 Thread Jiang Liu
Hi Rafael,
I failed to get the point to kill ACPI_HOTPLUG_OST altogether:(
Should I merge it into my series and resend?

Hi Toshi,
Any comments here?

On 2014/2/21 8:19, Rafael J. Wysocki wrote:
> On Wednesday, February 19, 2014 02:02:15 PM Jiang Liu wrote:
>> Rename acpi_evaluate_hotplug_ost() to acpi_evaluate_ost() for later resue.
>>
>> Signed-off-by: Jiang Liu 
> 
> Below is a patch replacing acpi_evaluate_hotplug_ost() with 
> acpi_evaluate_ost()
> and dropping the ACPI_HOTPLUG_OST which I don't believe is necessary at all.
> 
> On top of the current linux-next and your series.
> 
> Thanks,
> Rafael
> 
> ---
> From: Rafael J. Wysocki 
> Subject: ACPI: Drop acpi_evaluate_hotplug_ost() and ACPI_HOTPLUG_OST
> 
> Replace acpi_evaluate_hotplug_ost() with acpi_evaluate_ost()
> everywhere and drop the ACPI_HOTPLUG_OST symbol so that hotplug
> _OST is supported unconditionally.
> 
> Signed-off-by: Rafael J. Wysocki 
> ---
>  drivers/acpi/bus.c|4 +---
>  drivers/acpi/scan.c   |   10 +-
>  drivers/acpi/utils.c  |2 +-
>  drivers/xen/xen-acpi-cpuhotplug.c |2 +-
>  drivers/xen/xen-acpi-memhotplug.c |2 +-
>  include/acpi/acpi_bus.h   |8 
>  6 files changed, 9 insertions(+), 19 deletions(-)
> 
> Index: linux-pm/drivers/acpi/bus.c
> ===
> --- linux-pm.orig/drivers/acpi/bus.c
> +++ linux-pm/drivers/acpi/bus.c
> @@ -311,9 +311,7 @@ static void acpi_bus_osc_support(void)
>   capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PPC_OST_SUPPORT;
>  #endif
>  
> -#ifdef ACPI_HOTPLUG_OST
>   capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT;
> -#endif
>  
>   if (!ghes_disable)
>   capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_APEI_SUPPORT;
> @@ -410,7 +408,7 @@ static void acpi_bus_notify(acpi_handle
>   return;
>  
>   err:
> - acpi_evaluate_hotplug_ost(handle, type, ost_code, NULL);
> + acpi_evaluate_ost(handle, type, ost_code, NULL);
>  }
>  
>  /* --
> Index: linux-pm/include/acpi/acpi_bus.h
> ===
> --- linux-pm.orig/include/acpi/acpi_bus.h
> +++ linux-pm/include/acpi/acpi_bus.h
> @@ -51,14 +51,6 @@ acpi_evaluate_reference(acpi_handle hand
>  acpi_status
>  acpi_evaluate_ost(acpi_handle handle, u32 source_event, u32 status_code,
> struct acpi_buffer *status_buf);
> -#ifdef ACPI_HOTPLUG_OST
> -#define  acpi_evaluate_hotplug_ost   acpi_evaluate_ost
> -#else
> -static inline acpi_status
> -acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event,
> - u32 status_code, struct acpi_buffer *status_buf)
> -{ return AE_OK; }
> -#endif
>  
>  acpi_status
>  acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info 
> **pld);
> Index: linux-pm/drivers/acpi/scan.c
> ===
> --- linux-pm.orig/drivers/acpi/scan.c
> +++ linux-pm/drivers/acpi/scan.c
> @@ -463,8 +463,8 @@ static int acpi_generic_hotplug_event(st
>   dev_info(&adev->dev, "Eject disabled\n");
>   return -EPERM;
>   }
> - acpi_evaluate_hotplug_ost(adev->handle, 
> ACPI_NOTIFY_EJECT_REQUEST,
> -   ACPI_OST_SC_EJECT_IN_PROGRESS, NULL);
> + acpi_evaluate_ost(adev->handle, ACPI_NOTIFY_EJECT_REQUEST,
> +   ACPI_OST_SC_EJECT_IN_PROGRESS, NULL);
>   return acpi_scan_hot_remove(adev);
>   }
>   return -EINVAL;
> @@ -514,7 +514,7 @@ void acpi_device_hotplug(void *data, u32
>   ost_code = ACPI_OST_SC_SUCCESS;
>  
>   err_out:
> - acpi_evaluate_hotplug_ost(adev->handle, src, ost_code, NULL);
> + acpi_evaluate_ost(adev->handle, src, ost_code, NULL);
>  
>   out:
>   acpi_bus_put_acpi_device(adev);
> @@ -574,8 +574,8 @@ acpi_eject_store(struct device *d, struc
>   return count;
>  
>   put_device(&acpi_device->dev);
> - acpi_evaluate_hotplug_ost(acpi_device->handle, ACPI_OST_EC_OSPM_EJECT,
> -   ACPI_OST_SC_NON_SPECIFIC_FAILURE, NULL);
> + acpi_evaluate_ost(acpi_device->handle, ACPI_OST_EC_OSPM_EJECT,
> +   ACPI_OST_SC_NON_SPECIFIC_FAILURE, NULL);
>   return status == AE_NO_MEMORY ? -ENOMEM : -EAGAIN;
>  }
>  
> Index: linux-pm/drivers/acpi/utils.c
> ===
> --- linux-pm.orig/drivers/acpi/utils.c
> +++ linux-pm/drivers/acpi/utils.c
> @@ -422,7 +422,7 @@ out:
>  EXPORT_SYMBOL(acpi_get_physical_device_location);
>  
>  /**
> - * acpi_evaluate_hotplug_ost: Evaluate _OST for hotplug operations
> + * acpi_evaluate_ost: Evaluate _OST for hotplug operations
>   * @handle: ACPI device handle
>   * @source_event: source event code
>   * @stat

Re: [PATCH v2] sched: keep quiescent cpu out of idle balance loop

2014-02-20 Thread Mike Galbraith
On Fri, 2014-02-21 at 10:23 +0800, Lei Wen wrote: 
> Cpu which is put into quiescent mode, would remove itself
> from kernel's sched_domain, and want others not disturb its
> task running. But current scheduler would not checking whether
> that cpu is setting in such mode, and still insist the quiescent
> cpu to response the nohz load balance.

Let's isolate some CPUs.

Setup:
/-"system" CPU0
\
  \---"rtcpus" CPUs1-3

crash> runqueues
PER-CPU DATA TYPE:
  struct rq runqueues;
PER-CPU ADDRESSES:
  [0]: 88022fc12c00
  [1]: 88022fc92c00
  [2]: 88022fd12c00
  [3]: 88022fd92c00 
crash> struct rq 88022fd92c00 | grep sd
  sd = 0x0,  <== yup, CPU3 is isolated bit of silicon
crash> struct rq 88022fd92c00 | grep rd
  rd = 0x81bffe60 ,
crash> struct -x root_domain 0x81bffe60
...
  span = {{
  bits = {0xe} <== "rtcpus"
}},
crash> struct rq 88022fc12c00 | grep rd
  rd = 0x8802242c5800, 
crash> struct -x root_domain 0x8802242c5800
... 
  span = {{
  bits = {0x1} <== "system"
}},

Turn off load balancing in "system" as well now, CPU0 loses its 'sd',
and becomes an isolated island identical to "rtcpus" CPUs, and thus..

  span = {{
  bits = {0xf} <== oh darn
}},

.."system" and "rtcpus" merge, all CPUs having NULL sd, as they are now
all remote silicon islands, but they now also share rd again, as if you
had never diddled domains in the first place.

-Mike

--
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/


linux-next: build failure after merge of the char-misc tree

2014-02-20 Thread Stephen Rothwell
Hi all,

After merging the char-misc tree, today's linux-next build (x86_64
allmodconfig) failed like this:

In file included from drivers/misc/mei/hw-txe.c:25:0:
drivers/misc/mei/hw-txe.h:63:1: error: unknown type name 'irqreturn_t'
 irqreturn_t mei_txe_irq_quick_handler(int irq, void *dev_id);
 ^
drivers/misc/mei/hw-txe.h:64:1: error: unknown type name 'irqreturn_t'
 irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id);
 ^
drivers/misc/mei/hw-txe.c:879:1: error: unknown type name 'irqreturn_t'
 irqreturn_t mei_txe_irq_quick_handler(int irq, void *dev_id)
 ^
drivers/misc/mei/hw-txe.c: In function 'mei_txe_irq_quick_handler':
drivers/misc/mei/hw-txe.c:884:10: error: 'IRQ_WAKE_THREAD' undeclared (first 
use in this function)
   return IRQ_WAKE_THREAD;
  ^
drivers/misc/mei/hw-txe.c:884:10: note: each undeclared identifier is reported 
only once for each function it appears in
drivers/misc/mei/hw-txe.c:885:9: error: 'IRQ_NONE' undeclared (first use in 
this function)
  return IRQ_NONE;
 ^
drivers/misc/mei/hw-txe.c: At top level:
drivers/misc/mei/hw-txe.c:898:1: error: unknown type name 'irqreturn_t'
 irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id)
 ^
drivers/misc/mei/hw-txe.c: In function 'mei_txe_irq_thread_handler':
drivers/misc/mei/hw-txe.c:1007:9: error: 'IRQ_HANDLED' undeclared (first use in 
this function)
  return IRQ_HANDLED;
 ^
drivers/misc/mei/hw-txe.c: In function 'mei_txe_irq_quick_handler':
drivers/misc/mei/hw-txe.c:886:1: warning: control reaches end of non-void 
function [-Wreturn-type]
 }
 ^
drivers/misc/mei/hw-txe.c: In function 'mei_txe_irq_thread_handler':
drivers/misc/mei/hw-txe.c:1008:1: warning: control reaches end of non-void 
function [-Wreturn-type]
 }
 ^

Caused by commit 266f6178d1f1 ("mei: txe: add hw-txe.h header file") but
probably exposed by commit 46cb7b1bd86f ("PCI: Remove unused SR-IOV VF
Migration support") from the pci tree which removed the include of
irqreturn.h from pci.h ...

See Rule 1 from Documentation/SubmitChecklist ...

I added the following merge fix patch (this should be applied to the
char-misc tree):

From: Stephen Rothwell 
Date: Fri, 21 Feb 2014 16:38:28 +1100
Subject: [PATCH] mei: txe: include irqreturn.h for irqreturn_t etc

Signed-off-by: Stephen Rothwell 
---
 drivers/misc/mei/hw-txe.c | 1 +
 drivers/misc/mei/hw-txe.h | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/misc/mei/hw-txe.c b/drivers/misc/mei/hw-txe.c
index 19579e560dad..49a5ed376969 100644
--- a/drivers/misc/mei/hw-txe.c
+++ b/drivers/misc/mei/hw-txe.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
diff --git a/drivers/misc/mei/hw-txe.h b/drivers/misc/mei/hw-txe.h
index 857d88ccef61..fdb665f44d5d 100644
--- a/drivers/misc/mei/hw-txe.h
+++ b/drivers/misc/mei/hw-txe.h
@@ -17,6 +17,8 @@
 #ifndef _MEI_HW_TXE_H_
 #define _MEI_HW_TXE_H_
 
+#include 
+
 #include "hw.h"
 #include "hw-txe-regs.h"
 
-- 
1.9.0

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


pgpP7H6Th8e0h.pgp
Description: PGP signature


Re: Has slab ctor operation changed? -- was [PATCH 1/1] afs: afs_alloc_inode: use kmem_cache_zalloc

2014-02-20 Thread Fabian Frederick
On Thu, 20 Feb 2014 22:23:15 +
David Howells  wrote:

> Fabian Frederick  wrote:
> 
> > afs_vnode is currently cleared with 2 memsets after allocation and 
> > 1 in constructor (afs_i_init_once).
> > -This patch calls zalloc for explicit zero fill.
> 
> Ummm...  This patch isn't necessarily correct in the substantiative portions.
> 
> Since afs_i_init_once() is called by the slab allocator during the course of
> kmem_cache_alloc(), how does kmem_cache_zalloc() interact with that?

Object of this patch was to replace any kmem_cache_alloc by kmem_cache_zalloc
so I guess what is done in the patch v2 in afs_alloc_inode below zalloc
would be ok (leaving ctor how it is) ?

> 
> IIRC, it used to be that the ctor() function was called when the pages were
> allocated to the slab - and it wasn't called again, even if the object was
> allocated, deallocated and reallocated.  This means that things like locks and
> lists don't need reinitialising after allocation.
> 
> So afs_i_init_once() theoretically constructs the stuff that can be reused,
> and afs_alloc_inode() therefore has to clear the non-reusable state.
> 
> Of course, it's possible that the slab allocator no longer works like this...
> 
> David
--
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] nouveau, ACPI: fix regression caused by b072e53

2014-02-20 Thread Jiang Liu
Thanks, Rafael.
Will cc ACPI maillist next time.

On 2014/2/21 4:27, Rafael J. Wysocki wrote:
> On 2/20/2014 10:23 AM, Jiang Liu wrote:
>> Fix regression caused by commit b072e53, which breaks loading nouveau
>> driver on optimus laptops.
>>
>> On some platforms, ACPI _DSM method (nouveau_op_dsm_muid, function 0)
>> has special requirements on the fourth parameter, which is different
>> from ACPI specifications. So revert to the private implementation
>> to check availability of _DSM functions instead of using common
>> acpi_check_dsm() interface.
>>
>> Reported-and-Tested-by: Maarten Lankhorst
>> 
>> Signed-off-by: Jiang Liu 
> 
> I'm taking this, because the commit that introduced the regression went
> in through my tree.
> 
> In the future I'll appreciate CCing ACPI-related patches to linux-acpi,
> however.
> 
> Thanks,
> Rafael
> 
> 
>> ---
>>   drivers/gpu/drm/nouveau/nouveau_acpi.c |   26
>> --
>>   1 file changed, 24 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c
>> b/drivers/gpu/drm/nouveau/nouveau_acpi.c
>> index 4ef83df..83face3 100644
>> --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
>> +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
>> @@ -106,6 +106,29 @@ static int nouveau_optimus_dsm(acpi_handle
>> handle, int func, int arg, uint32_t *
>>   return 0;
>>   }
>>   +/*
>> + * On some platforms, _DSM(nouveau_op_dsm_muid, func0) has special
>> + * requirements on the fourth parameter, so a private implementation
>> + * instead of using acpi_check_dsm().
>> + */
>> +static int nouveau_check_optimus_dsm(acpi_handle handle)
>> +{
>> +int result;
>> +
>> +/*
>> + * Function 0 returns a Buffer containing available functions.
>> + * The args parameter is ignored for function 0, so just put 0 in it
>> + */
>> +if (nouveau_optimus_dsm(handle, 0, 0, &result))
>> +return 0;
>> +
>> +/*
>> + * ACPI Spec v4 9.14.1: if bit 0 is zero, no function is supported.
>> + * If the n-th bit is enabled, function n is supported
>> + */
>> +return result & 1 && result & (1 << NOUVEAU_DSM_OPTIMUS_CAPS);
>> +}
>> +
>>   static int nouveau_dsm(acpi_handle handle, int func, int arg)
>>   {
>>   int ret = 0;
>> @@ -207,8 +230,7 @@ static int nouveau_dsm_pci_probe(struct pci_dev
>> *pdev)
>>  1 << NOUVEAU_DSM_POWER))
>>   retval |= NOUVEAU_DSM_HAS_MUX;
>>   -if (acpi_check_dsm(dhandle, nouveau_op_dsm_muid, 0x0100,
>> -   1 << NOUVEAU_DSM_OPTIMUS_CAPS))
>> +if (nouveau_check_optimus_dsm(dhandle))
>>   retval |= NOUVEAU_DSM_HAS_OPT;
>> if (retval & NOUVEAU_DSM_HAS_OPT) {
> 
> -- 
> 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] ACPI/Processor: Rework processor throttling with work_on_cpu()

2014-02-20 Thread Lan Tianyu
acpi_processor_set_throttling() uses set_cpus_allowed_ptr() to make
sure struct acpi_processor->acpi_processor_set_throttling() callback
run on associated cpu. But the function maybe called in a worker which
has been bound to a cpu. The patch is to replace set_cpus_allowed_ptr()
with work_on_cpu().

Signed-off-by: Lan Tianyu 
---
 drivers/acpi/processor_throttling.c | 70 +
 1 file changed, 33 insertions(+), 37 deletions(-)

diff --git a/drivers/acpi/processor_throttling.c 
b/drivers/acpi/processor_throttling.c
index 28baa05..2db105a 100644
--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -56,6 +56,12 @@ struct throttling_tstate {
int target_state;   /* target T-state */
 };
 
+struct acpi_processor_throttling_arg {
+   struct acpi_processor *pr;
+   int target_state;
+   bool force;
+};
+
 #define THROTTLING_PRECHANGE   (1)
 #define THROTTLING_POSTCHANGE  (2)
 
@@ -1060,16 +1066,25 @@ static int acpi_processor_set_throttling_ptc(struct 
acpi_processor *pr,
return 0;
 }
 
+static long acpi_processor_throttling_fn(void *data)
+{
+   struct acpi_processor_throttling_arg *arg = data;
+   struct acpi_processor *pr = arg->pr;
+   struct acpi_processor_throttling *p_throttling = &pr->throttling;
+
+   return p_throttling->acpi_processor_set_throttling(pr,
+   arg->target_state, arg->force);
+}
+
 int acpi_processor_set_throttling(struct acpi_processor *pr,
int state, bool force)
 {
-   cpumask_var_t saved_mask;
int ret = 0;
unsigned int i;
struct acpi_processor *match_pr;
struct acpi_processor_throttling *p_throttling;
+   struct acpi_processor_throttling_arg arg;
struct throttling_tstate t_state;
-   cpumask_var_t online_throttling_cpus;
 
if (!pr)
return -EINVAL;
@@ -1080,14 +1095,6 @@ int acpi_processor_set_throttling(struct acpi_processor 
*pr,
if ((state < 0) || (state > (pr->throttling.state_count - 1)))
return -EINVAL;
 
-   if (!alloc_cpumask_var(&saved_mask, GFP_KERNEL))
-   return -ENOMEM;
-
-   if (!alloc_cpumask_var(&online_throttling_cpus, GFP_KERNEL)) {
-   free_cpumask_var(saved_mask);
-   return -ENOMEM;
-   }
-
if (cpu_is_offline(pr->id)) {
/*
 * the cpu pointed by pr->id is offline. Unnecessary to change
@@ -1096,17 +1103,15 @@ int acpi_processor_set_throttling(struct acpi_processor 
*pr,
return -ENODEV;
}
 
-   cpumask_copy(saved_mask, ¤t->cpus_allowed);
t_state.target_state = state;
p_throttling = &(pr->throttling);
-   cpumask_and(online_throttling_cpus, cpu_online_mask,
-   p_throttling->shared_cpu_map);
+
/*
 * The throttling notifier will be called for every
 * affected cpu in order to get one proper T-state.
 * The notifier event is THROTTLING_PRECHANGE.
 */
-   for_each_cpu(i, online_throttling_cpus) {
+   for_each_cpu_and(i, cpu_online_mask, p_throttling->shared_cpu_map) {
t_state.cpu = i;
acpi_processor_throttling_notifier(THROTTLING_PRECHANGE,
&t_state);
@@ -1118,21 +1123,18 @@ int acpi_processor_set_throttling(struct acpi_processor 
*pr,
 * it can be called only for the cpu pointed by pr.
 */
if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) {
-   /* FIXME: use work_on_cpu() */
-   if (set_cpus_allowed_ptr(current, cpumask_of(pr->id))) {
-   /* Can't migrate to the pr->id CPU. Exit */
-   ret = -ENODEV;
-   goto exit;
-   }
-   ret = p_throttling->acpi_processor_set_throttling(pr,
-   t_state.target_state, force);
+   arg.pr = pr;
+   arg.target_state = state;
+   arg.force = force;
+   ret = work_on_cpu(pr->id, acpi_processor_throttling_fn, &arg);
} else {
/*
 * When the T-state coordination is SW_ALL or HW_ALL,
 * it is necessary to set T-state for every affected
 * cpus.
 */
-   for_each_cpu(i, online_throttling_cpus) {
+   for_each_cpu_and(i, cpu_online_mask,
+   p_throttling->shared_cpu_map) {
match_pr = per_cpu(processors, i);
/*
 * If the pointer is invalid, we will report the
@@ -1153,13 +1155,12 @@ int acpi_processor_set_throttling(struct acpi_processor 
*pr,
"on CPU %d\n", i));
continue;

Re: [PATCH 2/4] net: rfkill: gpio: remove gpio names

2014-02-20 Thread Stephen Warren
On 02/20/2014 06:55 PM, Chen-Yu Tsai wrote:
> Hi,
> 
> On Fri, Feb 21, 2014 at 12:38 AM, Stephen Warren  
> wrote:
>> On 02/20/2014 05:51 AM, Heikki Krogerus wrote:
>>> There is no use for them in this driver. This will fix a
>>> static checker warning..
>>
>> Didn't you remove the use:
>>
>> -   gpio = devm_gpiod_get_index(&pdev->dev, rfkill->reset_name, 0);
>> +   gpio = devm_gpiod_get_index(&pdev->dev, NULL, 0);
>>
>> doesn't that parameter get put into the sysfs GPIO debug file, so people
>> can see which GPIOs are used for what?
> 
> That's correct. However using con_id to pass this results in different
> behavior across DT and ACPI. A better way is to export the labeling
> function so consumers can set meaningful labels themselves.

But this code is the consumer of those GPIOs. IF the parameter to
devm_gpiod_get_index() isn't intended to be used, why does it exist?

--
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] mm: per-thread vma caching

2014-02-20 Thread Davidlohr Bueso
From: Davidlohr Bueso 

This patch is a continuation of efforts trying to optimize find_vma(),
avoiding potentially expensive rbtree walks to locate a vma upon faults.
The original approach (https://lkml.org/lkml/2013/11/1/410), where the
largest vma was also cached, ended up being too specific and random, thus
further comparison with other approaches were needed. There are two things
to consider when dealing with this, the cache hit rate and the latency of
find_vma(). Improving the hit-rate does not necessarily translate in finding
the vma any faster, as the overhead of any fancy caching schemes can be too
high to consider.

We currently cache the last used vma for the whole address space, which
provides a nice optimization, reducing the total cycles in find_vma() by up
to 250%, for workloads with good locality. On the other hand, this simple
scheme is pretty much useless for workloads with poor locality. Analyzing
ebizzy runs shows that, no matter how many threads are running, the
mmap_cache hit rate is less than 2%, and in many situations below 1%.

The proposed approach is to keep the current cache and adding a small, per
thread, LRU cache. By keeping the mm->mmap_cache, programs with large heaps
or good locality can benefit by not having to deal with an additional cache
when the hit rate is good enough. Concretely, the following results are seen
on an 80 core, 8 socket x86-64 box:

1) System bootup: Most programs are single threaded, so the per-thread scheme
does improve ~50% hit rate by just adding a few more slots to the cache.

++--+--+
| caching scheme | hit-rate | cycles (billion) |
++--+--+
| baseline   | 50.61%   | 19.90|
| patched| 73.45%   | 13.58|
++--+--+

2) Kernel build: This one is already pretty good with the current approach
as we're dealing with good locality.

++--+--+
| caching scheme | hit-rate | cycles (billion) |
++--+--+
| baseline   | 75.28%   | 11.03|
| patched| 88.09%   | 9.31 |
++--+--+

3) Oracle 11g Data Mining (4k pages): Similar to the kernel build workload.

++--+--+
| caching scheme | hit-rate | cycles (billion) |
++--+--+
| baseline   | 70.66%   | 17.14|
| patched| 91.15%   | 12.57|
++--+--+

4) Ebizzy: There's a fair amount of variation from run to run, but this
approach always shows nearly perfect hit rates, while baseline is just
about non-existent. The amounts of cycles can fluctuate between anywhere
from ~60 to ~116 for the baseline scheme, but this approach reduces it
considerably. For instance, with 80 threads:

++--+--+
| caching scheme | hit-rate | cycles (billion) |
++--+--+
| baseline   | 1.06%| 91.54|
| patched| 99.97%   | 14.18|
++--+--+

Systems with !CONFIG_MMU get to keep the current logic.

Signed-off-by: Davidlohr Bueso 
---
Please note that nommu and unicore32 arch are *untested*.
Thanks.

 arch/unicore32/include/asm/mmu_context.h |  3 +-
 fs/proc/task_mmu.c   |  2 +-
 include/linux/mm_types.h |  5 ++-
 include/linux/sched.h|  5 +++
 include/linux/vmacache.h | 19 ++
 kernel/debug/debug_core.c|  4 +-
 kernel/fork.c|  3 +-
 mm/Makefile  |  2 +-
 mm/mmap.c| 55 +++-
 mm/nommu.c   | 12 +++---
 mm/vmacache.c| 63 
 11 files changed, 133 insertions(+), 40 deletions(-)
 create mode 100644 include/linux/vmacache.h
 create mode 100644 mm/vmacache.c

diff --git a/arch/unicore32/include/asm/mmu_context.h 
b/arch/unicore32/include/asm/mmu_context.h
index fb5e4c6..bc79303 100644
--- a/arch/unicore32/include/asm/mmu_context.h
+++ b/arch/unicore32/include/asm/mmu_context.h
@@ -73,7 +73,8 @@ do { \
else \
mm->mmap = NULL; \
rb_erase(&high_vma->vm_rb, &mm->mm_rb); \
-   mm->mmap_cache = NULL; \
+   mm->vmacache = NULL; \
+   vmacache_invalidate(mm); \
mm->map_count--; \
remove_vma(high_vma); \
} \
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index fb52b54..231c836 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -152,7 +152,7 @@ static void *m_start(struct seq_file *m, loff_t *pos)
 
/*
 * We remem

Re: [PATCH 3.12 00/82] 3.12.13-stable review

2014-02-20 Thread Guenter Roeck

On 02/20/2014 03:51 PM, Greg Kroah-Hartman wrote:

This is the start of the stable review cycle for the 3.12.13 release.
There are 82 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Sat Feb 22 23:50:04 UTC 2014.
Anything received after that time might be too late.



Build results:
total: 126 pass: 121 skipped: 5 fail: 0

qemu tests all passed.

Details are available at http://server.roeck-us.net:8010/builders.

guenter


--
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 4/9] firewire: don't use PREPARE_DELAYED_WORK

2014-02-20 Thread Peter Hurley

On 02/20/2014 09:13 PM, Tejun Heo wrote:

On Thu, Feb 20, 2014 at 09:07:27PM -0500, Peter Hurley wrote:

On 02/20/2014 08:59 PM, Tejun Heo wrote:

Hello,

On Thu, Feb 20, 2014 at 08:44:46PM -0500, Peter Hurley wrote:

+static void fw_device_workfn(struct work_struct *work)
+{
+   struct fw_device *device = container_of(to_delayed_work(work),
+   struct fw_device, work);


I think this needs an smp_rmb() here.


The patch is equivalent transformation and the whole thing is
guaranteed to have gone through pool->lock.  No explicit rmb
necessary.


The spin_unlock_irq(&pool->lock) only guarantees completion of
memory operations _before_ the unlock; memory operations which occur
_after_ the unlock may be speculated before the unlock.

IOW, unlock is not a memory barrier for operations that occur after.


It's not just unlock.  It's lock / unlock pair on the same lock from
both sides.  Nothing can sip through that.


CPU 0| CPU 1
 |
 INIT_WORK(fw_device_workfn) |
 |
 workfn = funcA  |
 queue_work_on() |
 .   | process_one_work()
 .   |   ..
 .   |   worker->current_func = work->func
 .   |
 .   |   speculative load of workfn = funcA
 .   |   .
 workfn = funcB  |   .
 queue_work_on() |   .
   local_irq_save()  |   .
   test_and_set_bit() == 1   |   .
 |   set_work_pool_and_clear_pending()
   work is not queued| smp_wmb
funcB never runs | set_work_data()
 |   atomic_set()
 |   spin_unlock_irq()
 |
 |   worker->current_func(work)  @ 
fw_device_workfn
 |  workfn()  @ funcA


The speculative load of workfn on CPU 1 is valid because no rmb will occur
between the load and the execution of workfn() on CPU 1.

Thus funcB will never execute because, in this circumstance, a second
worker is not queued (because PENDING had not yet been cleared).

Regards,
Peter Hurley


--
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] usb: xhci: Prefer endpoint context dequeue pointer over stopped_trb

2014-02-20 Thread Julius Werner
We have observed a rare cycle state desync bug after Set TR Dequeue
Pointer commands on Intel LynxPoint xHCs (resulting in an endpoint that
doesn't fetch new TRBs and thus an unresponsive USB device). It always
triggers when a previous Set TR Dequeue Pointer command has set the
pointer to the final Link TRB of a segment, and then another URB gets
enqueued and cancelled again before it can be completed. Further
investigation showed that the xHC had returned the Link TRB in the TRB
Pointer field of the Transfer Event (CC == Stopped -- Length Invalid),
but when xhci_find_new_dequeue_state() later accesses the Endpoint
Context's TR Dequeue Pointer field it is set to the first TRB of the
next segment.

The driver expects those two values to be the same in this situation,
and uses the cycle state of the latter together with the address of the
former. This should be fine according to the XHCI specification, since
the endpoint ring should be stopped when returning the Transfer Event
and thus should not advance over the Link TRB before it gets restarted.
However, real-world XHCI implementations apparently don't really care
that much about these details, so the driver should follow a more
defensive approach to try to work around HC spec violations.

This patch removes the stopped_trb variable that had been used to store
the TRB Pointer from the last Transfer Event of a stopped TRB. Instead,
xhci_find_new_dequeue_state() now relies only on the Endpoint Context,
requiring a small amount of additional processing to find the virtual
address corresponding to the TR Dequeue Pointer. Some other parts of the
function were slightly rearranged to better fit into this model.

This patch should be backported to kernels as old as 2.6.31 that contain
the commit ae636747146ea97efa18e04576acd3416e2514f5 "USB: xhci: URB
cancellation support."

Signed-off-by: Julius Werner 
---
 drivers/usb/host/xhci-ring.c | 66 
 drivers/usb/host/xhci.c  |  1 -
 drivers/usb/host/xhci.h  |  2 --
 3 files changed, 30 insertions(+), 39 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index a0b248c..b8277c7 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -549,6 +549,7 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci,
struct xhci_generic_trb *trb;
struct xhci_ep_ctx *ep_ctx;
dma_addr_t addr;
+   u64 hw_dequeue;
 
ep_ring = xhci_triad_to_transfer_ring(xhci, slot_id,
ep_index, stream_id);
@@ -558,56 +559,56 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci,
stream_id);
return;
}
-   state->new_cycle_state = 0;
-   xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
-   "Finding segment containing stopped TRB.");
-   state->new_deq_seg = find_trb_seg(cur_td->start_seg,
-   dev->eps[ep_index].stopped_trb,
-   &state->new_cycle_state);
-   if (!state->new_deq_seg) {
-   WARN_ON(1);
-   return;
-   }
 
/* Dig out the cycle state saved by the xHC during the stop ep cmd */
xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
"Finding endpoint context");
ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index);
-   state->new_cycle_state = 0x1 & le64_to_cpu(ep_ctx->deq);
+   hw_dequeue = le64_to_cpu(ep_ctx->deq);
+
+   /* Find virtual address and segment of hardware dequeue pointer */
+   state->new_deq_seg = ep_ring->deq_seg;
+   state->new_deq_ptr = ep_ring->dequeue;
+   while (xhci_trb_virt_to_dma(state->new_deq_seg, state->new_deq_ptr)
+   != (dma_addr_t)(hw_dequeue & ~0x1)) {
+   next_trb(xhci, ep_ring, &state->new_deq_seg,
+   &state->new_deq_ptr);
+   if (state->new_deq_ptr == ep_ring->dequeue) {
+   WARN_ON(1);
+   return;
+   }
+   }
 
+   /*
+* Find cycle state for last_trb, starting at old cycle state of
+* hw_dequeue. If there is only one segment ring, find_trb_seg() will
+* return immediately and cannot toggle the cycle state if this search
+* wraps around, so add one more toggle manually in that case.
+*/
+   state->new_cycle_state = hw_dequeue & 0x1;
+   if (ep_ring->first_seg == ep_ring->first_seg->next &&
+   cur_td->last_trb < state->new_deq_ptr)
+   state->new_cycle_state ^= 0x1;
state->new_deq_ptr = cur_td->last_trb;
xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
"Finding segment containing last TRB in TD.");
state->new_deq_seg = find_trb_seg(state->new_deq_seg,
-   state->new_deq_ptr,
-   &state->new_cycle_state);
+

Re: [PATCH 3.10 00/66] 3.10.32-stable review

2014-02-20 Thread Guenter Roeck

On 02/20/2014 03:50 PM, Greg Kroah-Hartman wrote:

This is the start of the stable review cycle for the 3.10.32 release.
There are 66 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Sat Feb 22 23:48:52 UTC 2014.
Anything received after that time might be too late.



Build results:
total: 126 pass: 111 skipped: 4 fail: 11

qemu tests all passed. Results are not as expected. New failures are
due to

Guenter Roeck 
iio: max1363: Use devm_regulator_get_optional for optional regulator

[Oops]

Please drop this patch from 3.10; it doesn't apply to this version.

Details are at http://server.roeck-us.net:8010/builders.

Guenter

--
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 net V2] virtio-net: alloc big buffers also when guest can receive UFO

2014-02-20 Thread Jason Wang
We should alloc big buffers also when guest can receive UFO
pakcets to let the big packets be fit into guest rx buffer.

Fixes 5c5167515d80f78f6bb538492c423adcae31ad65
(virtio-net: Allow UFO feature to be set and advertised.)

Cc: Rusty Russell 
Cc: Michael S. Tsirkin 
Cc: Sridhar Samudrala 
Signed-off-by: Jason Wang 
---
Changes from V1:
- tweak the commit log
---
 drivers/net/virtio_net.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index d75f8ed..5632a99 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1711,7 +1711,8 @@ static int virtnet_probe(struct virtio_device *vdev)
/* If we can receive ANY GSO packets, we must allocate large ones. */
if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) ||
virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6) ||
-   virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN))
+   virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN) ||
+   virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_UFO))
vi->big_packets = true;
 
if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF))
-- 
1.8.3.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: [PATCH 3.4 00/25] 3.4.82-stable review

2014-02-20 Thread Guenter Roeck

On 02/20/2014 03:51 PM, Greg Kroah-Hartman wrote:

This is the start of the stable review cycle for the 3.4.82 release.
There are 25 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Sat Feb 22 23:48:32 UTC 2014.
Anything received after that time might be too late.



Build results:
total: 119 pass: 97 skipped: 18 fail: 4

qemu tests all passed. Results are as expected.

Details are available at http://server.roeck-us.net:8010/builders.

Guenter


--
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 3.13 00/99] 3.13.5-stable review

2014-02-20 Thread Guenter Roeck

On 02/20/2014 03:51 PM, Greg Kroah-Hartman wrote:

This is the start of the stable review cycle for the 3.13.5 release.
There are 99 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Sat Feb 22 23:51:00 UTC 2014.
Anything received after that time might be too late.



Build results:
total: 126 pass: 122 skipped: 4 fail: 0

qemu tests all passed.

Details are available at http://server.roeck-us.net:8010/builders.

Guenter

--
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] Documentation: LLVMLinux: Update Documentation/dontdiff

2014-02-20 Thread behanw
From: Jan-Simon Möller 

Clang has a few other kinds of derived files which shouldn't be added to a
patch. Add them to the Documentation/dontdiff file to prevent this.

Author:  PaX Team 
ML-Post: 
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120507/142707.html
URL: http://llvm.linuxfoundation.org
Merge:   Jan-Simon Möller 
Signed-off-by: Jan-Simon Möller 
Signed-off-by: Behan Webster 
---
 Documentation/dontdiff | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/dontdiff b/Documentation/dontdiff
index b89a739..9de9813 100644
--- a/Documentation/dontdiff
+++ b/Documentation/dontdiff
@@ -1,5 +1,6 @@
 *.a
 *.aux
+*.bc
 *.bin
 *.bz2
 *.cis
@@ -21,6 +22,7 @@
 *.i
 *.jpeg
 *.ko
+*.ll
 *.log
 *.lst
 *.lzma
@@ -35,6 +37,7 @@
 *.out
 *.patch
 *.pdf
+*.plist
 *.png
 *.pot
 *.ps
-- 
1.8.3.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/


[PATCH v2,1/2] hyperv_fb: Add screen refresh after pause/resume operation

2014-02-20 Thread Haiyang Zhang
This is necessary because after VM is pause/resumed, some portion of
the screen may need refresh.

Signed-off-by: Haiyang Zhang 
Reviewed-by: K. Y. Srinivasan 
---
 drivers/video/hyperv_fb.c |   10 +-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/video/hyperv_fb.c b/drivers/video/hyperv_fb.c
index 130708f..bbcc8c0 100644
--- a/drivers/video/hyperv_fb.c
+++ b/drivers/video/hyperv_fb.c
@@ -218,6 +218,7 @@ struct hvfb_par {
 
struct delayed_work dwork;
bool update;
+   bool xrefresh;
 
u32 pseudo_palette[16];
u8 init_buf[MAX_VMBUS_PKT_SIZE];
@@ -369,7 +370,7 @@ static void synthvid_recv_sub(struct hv_device *hdev)
synthvid_send_situ(hdev);
}
 
-   par->update = msg->feature_chg.is_dirt_needed;
+   par->xrefresh = par->update = msg->feature_chg.is_dirt_needed;
if (par->update)
schedule_delayed_work(&par->dwork, HVFB_UPDATE_DELAY);
}
@@ -522,6 +523,13 @@ static void hvfb_update_work(struct work_struct *w)
 {
struct hvfb_par *par = container_of(w, struct hvfb_par, dwork.work);
struct fb_info *info = par->info;
+   char *argv[] = {"/usr/bin/xrefresh", "-display", ":0.0", NULL};
+   char *envp[] = {"HOME=/", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
+
+   if (par->xrefresh) {
+   par->xrefresh = false;
+   call_usermodehelper(argv[0], argv, envp, UMH_NO_WAIT);
+   }
 
if (par->fb_ready)
synthvid_update(info);
-- 
1.7.4.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 v2,2/2] hyperv_fb: Add support for Gen2 VM

2014-02-20 Thread Haiyang Zhang
This patch enables Hyper-V FB driver to run on Gen2 VM.

The Gen2 VM provides MMIO area for synthetic video from ACPI module,
which is exported by vmbus. The generic video is provided by UEFI. PCI
video in Gen1 is no longer available.

To support synthetic video on Hyper-V Gen2 VM, this patch updated
code related to the changes above.

Signed-off-by: Haiyang Zhang 
Reviewed-by: K. Y. Srinivasan 
---
 drivers/video/hyperv_fb.c |   60 ++--
 1 files changed, 41 insertions(+), 19 deletions(-)

diff --git a/drivers/video/hyperv_fb.c b/drivers/video/hyperv_fb.c
index bbcc8c0..5db1f20 100644
--- a/drivers/video/hyperv_fb.c
+++ b/drivers/video/hyperv_fb.c
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -461,13 +462,13 @@ static int synthvid_connect_vsp(struct hv_device *hdev)
goto error;
}
 
-   if (par->synthvid_version == SYNTHVID_VERSION_WIN7) {
+   if (par->synthvid_version == SYNTHVID_VERSION_WIN7)
screen_depth = SYNTHVID_DEPTH_WIN7;
-   screen_fb_size = SYNTHVID_FB_SIZE_WIN7;
-   } else {
+   else
screen_depth = SYNTHVID_DEPTH_WIN8;
-   screen_fb_size = SYNTHVID_FB_SIZE_WIN8;
-   }
+
+   screen_fb_size = hdev->channel->offermsg.offer.
+   mmio_megabytes * 1024 * 1024;
 
return 0;
 
@@ -635,22 +636,33 @@ static void hvfb_get_option(struct fb_info *info)
 /* Get framebuffer memory from Hyper-V video pci space */
 static int hvfb_getmem(struct fb_info *info)
 {
-   struct pci_dev *pdev;
+   struct pci_dev *pdev  = NULL;
ulong fb_phys;
void __iomem *fb_virt;
+   int gen2vm = efi_enabled(EFI_BOOT);
 
-   pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT,
+   if (gen2vm) {
+   if (!hyperv_mmio_start || hyperv_mmio_size < screen_fb_size) {
+   pr_err("Unable to find ACPI MMIO area\n");
+   return -ENODEV;
+   }
+
+   fb_phys = hyperv_mmio_start;
+   } else {
+   pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT,
  PCI_DEVICE_ID_HYPERV_VIDEO, NULL);
-   if (!pdev) {
-   pr_err("Unable to find PCI Hyper-V video\n");
-   return -ENODEV;
-   }
+   if (!pdev) {
+   pr_err("Unable to find PCI Hyper-V video\n");
+   return -ENODEV;
+   }
 
-   if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM) ||
-   pci_resource_len(pdev, 0) < screen_fb_size)
-   goto err1;
+   if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM) ||
+   pci_resource_len(pdev, 0) < screen_fb_size)
+   goto err1;
+
+   fb_phys = pci_resource_end(pdev, 0) - screen_fb_size + 1;
+   }
 
-   fb_phys = pci_resource_end(pdev, 0) - screen_fb_size + 1;
if (!request_mem_region(fb_phys, screen_fb_size, KBUILD_MODNAME))
goto err1;
 
@@ -662,14 +674,22 @@ static int hvfb_getmem(struct fb_info *info)
if (!info->apertures)
goto err3;
 
-   info->apertures->ranges[0].base = pci_resource_start(pdev, 0);
-   info->apertures->ranges[0].size = pci_resource_len(pdev, 0);
+   if (gen2vm) {
+   info->apertures->ranges[0].base = screen_info.lfb_base;
+   info->apertures->ranges[0].size = screen_info.lfb_size;
+   } else {
+   info->apertures->ranges[0].base = pci_resource_start(pdev, 0);
+   info->apertures->ranges[0].size = pci_resource_len(pdev, 0);
+   }
+
info->fix.smem_start = fb_phys;
info->fix.smem_len = screen_fb_size;
info->screen_base = fb_virt;
info->screen_size = screen_fb_size;
 
-   pci_dev_put(pdev);
+   if (!gen2vm)
+   pci_dev_put(pdev);
+
return 0;
 
 err3:
@@ -677,7 +697,9 @@ err3:
 err2:
release_mem_region(fb_phys, screen_fb_size);
 err1:
-   pci_dev_put(pdev);
+   if (!gen2vm)
+   pci_dev_put(pdev);
+
return -ENOMEM;
 }
 
-- 
1.7.4.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 v2,0/2] Re-sending two patches for hyperv_fb

2014-02-20 Thread Haiyang Zhang
They were sent out during tree closing, I'm re-sending them now.
---
v2: 
  Updated the variable type gen2vm to int, because efi_enabled() returns int.

Haiyang Zhang (2):
  hyperv_fb: Add screen refresh after pause/resume operation
  hyperv_fb: Add support for Gen2 VM

 drivers/video/hyperv_fb.c |   70 -
 1 files changed, 50 insertions(+), 20 deletions(-)

-- 
1.7.4.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] x86: LLVMLinux: Reimplement current_stack_pointer without register usage.

2014-02-20 Thread H. Peter Anvin
This seems like really deep magic when looking at it... at the very 
least, this needs to be very carefully commented, including why it works 
on the various platforms.


How much does this actually affect the output?  I only see three uses of 
current_stack_pointer:


/* how to get the thread information struct from C */
static inline struct thread_info *current_thread_info(void)
{
return (struct thread_info *)
(current_stack_pointer & ~(THREAD_SIZE - 1));
}

... here we need the mov anyway, because we have to then AND it with a 
mask, which we obviously can't do inside the stack pointer.


kernel/irq_32.c:irqctx->tinfo.previous_esp = current_stack_pointer;

(two times)

Here we are moving it into a memory variable anyway, which the "=g" 
constraint should allow.


So I see no evidence this is more efficient in any way.

-hpa


On 02/20/2014 08:44 PM, beh...@converseincode.com wrote:

From: Behan Webster 

Use asm to make the globally named register work again for gcc and clang.
Much more efficient than copying the stack pointer to a variable and back again.

Signed-off-by: Behan Webster 
---
  arch/x86/include/asm/thread_info.h | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/thread_info.h 
b/arch/x86/include/asm/thread_info.h
index e1940c0..e27ccc1 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -163,10 +163,10 @@ struct thread_info {
   */
  #ifndef __ASSEMBLY__

-#define current_stack_pointer ({   \
-   unsigned long sp;   \
-   asm("mov %%esp,%0" : "=g" (sp));\
-   sp; \
+#define current_stack_pointer ({   \
+   register unsigned long sp asm("esp") __used;  \
+   asm("" : "=r" (sp));\
+   sp; \
  })

  /* how to get the thread information struct from C */



--
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] ARM: bcm2835: Move to mach-bcm directory

2014-02-20 Thread Stephen Warren
On 02/20/2014 05:16 PM, Markus Mayer wrote:
> Move the bcm2835 board file into the mach-bcm directory. This allows us
> to get rid of the mach-bcm2835 directory with the associated Kconfig
> and Makefile.

This looks fine, although it needs a small patch to bcm2835_defconfig
squashed in, which I'll post in a second.

Do you want me to take it through the bcm2835 tree? That's probably
easiest to avoid conflicts with any other bcm2835 patches, not that it's
too likely there will be any to the board file.
--
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] x86: LLVMLinux: Reimplement current_stack_pointer without register usage.

2014-02-20 Thread behanw
From: Behan Webster 

Use asm to make the globally named register work again for gcc and clang.
Much more efficient than copying the stack pointer to a variable and back again.

Signed-off-by: Behan Webster 
---
 arch/x86/include/asm/thread_info.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/thread_info.h 
b/arch/x86/include/asm/thread_info.h
index e1940c0..e27ccc1 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -163,10 +163,10 @@ struct thread_info {
  */
 #ifndef __ASSEMBLY__
 
-#define current_stack_pointer ({   \
-   unsigned long sp;   \
-   asm("mov %%esp,%0" : "=g" (sp));\
-   sp; \
+#define current_stack_pointer ({   \
+   register unsigned long sp asm("esp") __used;\
+   asm("" : "=r" (sp));\
+   sp; \
 })
 
 /* how to get the thread information struct from C */
-- 
1.8.3.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/


[PATCH v1.3 11/11] arcmsr: Adding support Areca ARC1214/1224/1264/1284 SATA 6Gb raid controllers

2014-02-20 Thread 黃清隆
From: Ching 

Adding support Areca ARC1214/1224/1264/1284 SATA 6Gb raid controllers.

Singed-off-by: Ching 
---

diff -uprN a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
--- a/drivers/scsi/arcmsr/arcmsr.h  2014-02-20 20:14:42.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr.h  2014-02-20 20:01:46.0 +0800
@@ -62,12 +62,17 @@ struct device_attribute;
 #define ARCMSR_MAX_QBUFFER 4096
 #define ARCMSR_DEFAULT_SG_ENTRIES  38
 #define ARCMSR_MAX_HBB_POSTQUEUE   264
+#define ARCMSR_MAX_ARC1214_POSTQUEUE   256
+#define ARCMSR_MAX_ARC1214_DONEQUEUE   257
 #define ARCMSR_MAX_XFER_LEN0x26000
 #define ARCMSR_CDB_SG_PAGE_LENGTH  256
 #define ARCMST_NUM_MSIX_VECTORS4
 #ifndef PCI_DEVICE_ID_ARECA_1880
#define PCI_DEVICE_ID_ARECA_18800x1880
 #endif
+#ifndef PCI_DEVICE_ID_ARECA_1214
+   #define PCI_DEVICE_ID_ARECA_12140x1214
+#endif
 /*
 
**
 **
@@ -341,6 +346,56 @@ struct FIRMWARE_INFO
 #define ARCMSR_HBCMU_MESSAGE_FIRMWARE_OK   0x8000
 /*
 ***
+**SPEC. for Areca Type D adapter
+***
+*/
+#define ARCMSR_ARC1214_CHIP_ID 0x4
+#define ARCMSR_ARC1214_CPU_MEMORY_CONFIGURATION0x8
+#define ARCMSR_ARC1214_I2_HOST_INTERRUPT_MASK  0x00034
+#define ARCMSR_ARC1214_SAMPLE_RESET0x00100
+#define ARCMSR_ARC1214_RESET_REQUEST   0x00108
+#define ARCMSR_ARC1214_MAIN_INTERRUPT_STATUS   0x00200
+#define ARCMSR_ARC1214_PCIE_F0_INTERRUPT_ENABLE0x0020C
+#define ARCMSR_ARC1214_INBOUND_MESSAGE00x00400
+#define ARCMSR_ARC1214_INBOUND_MESSAGE10x00404
+#define ARCMSR_ARC1214_OUTBOUND_MESSAGE0   0x00420
+#define ARCMSR_ARC1214_OUTBOUND_MESSAGE1   0x00424
+#define ARCMSR_ARC1214_INBOUND_DOORBELL0x00460
+#define ARCMSR_ARC1214_OUTBOUND_DOORBELL   0x00480
+#define ARCMSR_ARC1214_OUTBOUND_DOORBELL_ENABLE0x00484
+#define ARCMSR_ARC1214_INBOUND_LIST_BASE_LOW   0x01000
+#define ARCMSR_ARC1214_INBOUND_LIST_BASE_HIGH  0x01004
+#define ARCMSR_ARC1214_INBOUND_LIST_WRITE_POINTER  0x01018
+#define ARCMSR_ARC1214_OUTBOUND_LIST_BASE_LOW  0x01060
+#define ARCMSR_ARC1214_OUTBOUND_LIST_BASE_HIGH 0x01064
+#define ARCMSR_ARC1214_OUTBOUND_LIST_COPY_POINTER  0x0106C
+#define ARCMSR_ARC1214_OUTBOUND_LIST_READ_POINTER  0x01070
+#define ARCMSR_ARC1214_OUTBOUND_INTERRUPT_CAUSE0x01088
+#define ARCMSR_ARC1214_OUTBOUND_INTERRUPT_ENABLE   0x0108C
+#define ARCMSR_ARC1214_MESSAGE_WBUFFER 0x02000
+#define ARCMSR_ARC1214_MESSAGE_RBUFFER 0x02100
+#define ARCMSR_ARC1214_MESSAGE_RWBUFFER0x02200
+/* Host Interrupt Mask */
+#define ARCMSR_ARC1214_ALL_INT_ENABLE  0x1010
+#define ARCMSR_ARC1214_ALL_INT_DISABLE 0x
+/* Host Interrupt Status */
+#define ARCMSR_ARC1214_OUTBOUND_DOORBELL_ISR   0x1000
+#define ARCMSR_ARC1214_OUTBOUND_POSTQUEUE_ISR  0x0010
+/* DoorBell*/
+#define ARCMSR_ARC1214_DRV2IOP_DATA_IN_READY   0x0001
+#define ARCMSR_ARC1214_DRV2IOP_DATA_OUT_READ   0x0002
+/*inbound message 0 ready*/
+#define ARCMSR_ARC1214_IOP2DRV_DATA_WRITE_OK   0x0001
+/*outbound DATA WRITE isr door bell clear*/
+#define ARCMSR_ARC1214_IOP2DRV_DATA_READ_OK0x0002
+/*outbound message 0 ready*/
+#define ARCMSR_ARC1214_IOP2DRV_MESSAGE_CMD_DONE0x0200
+/*outbound message cmd isr door bell clear*/
+/*ARCMSR_HBAMU_MESSAGE_FIRMWARE_OK*/
+#define ARCMSR_ARC1214_MESSAGE_FIRMWARE_OK 0x8000
+#define ARCMSR_ARC1214_OUTBOUND_LIST_INTERRUPT_CLEAR   0x0001
+/*
+***
 **ARECA SCSI COMMAND DESCRIPTOR BLOCK size 0x1F8 (504)
 ***
 */
@@ -501,6 +556,55 @@ struct MessageUnit_C {
uint32_t msgcode_rwbuffer[256]; /*2200 23FF*/
 };
 /*
+*
+** Messaging Unit (MU) of Type D processor
+*
+*/
+struct InBound_SRB {
+   uint32_t addressLow; /* pointer to SRB block */
+   uint32_t addressHigh;
+   uint32_t length; /* in DWORDs */
+   uint32_t reserved0;
+};
+
+struct OutBound_SRB {
+   uint32_t addressLow; /* pointer to SRB block */
+   uint32_t addressHigh;
+};
+
+struct MessageUnit_D {
+   struct InBound_SRB  post_q

Re: [PATCH 01/11] pagewalk: update page table walker core

2014-02-20 Thread Sasha Levin

On 02/20/2014 06:47 PM, Sasha Levin wrote:

Hi Naoya,

This patch seems to trigger a NULL ptr deref here. I didn't have a change to 
look into it yet
but here's the spew:

[  281.650503] BUG: unable to handle kernel NULL pointer dereference at 
0018
[  281.651577] IP: [] __lock_acquire+0xbc/0x580
[  281.652453] PGD 40b88d067 PUD 40b88c067 PMD 0
[  281.653143] Oops:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
[  281.653869] Dumping ftrace buffer:
[  281.654430](ftrace buffer empty)
[  281.654975] Modules linked in:
[  281.655441] CPU: 4 PID: 12314 Comm: trinity-c361 Tainted: GW
3.14.0-rc3-next-20140220-sasha-8-gab7e7ac-dirty #113
[  281.657622] task: 8804242ab000 ti: 880424348000 task.ti: 
880424348000
[  281.658503] RIP: 0010:[]  [] 
__lock_acquire+0xbc/0x580
[  281.660025] RSP: 0018:880424349ab8  EFLAGS: 00010002
[  281.660761] RAX: 0086 RBX: 0018 RCX: 
[  281.660761] RDX:  RSI:  RDI: 0018
[  281.660761] RBP: 880424349b28 R08: 0001 R09: 
[  281.660761] R10: 0001 R11: 0001 R12: 8804242ab000
[  281.660761] R13:  R14:  R15: 0001
[  281.660761] FS:  7f36534b0700() GS:88052bc0() 
knlGS:
[  281.660761] CS:  0010 DS:  ES:  CR0: 8005003b
[  281.660761] CR2: 0018 CR3: 00040b88e000 CR4: 06e0
[  281.660761] Stack:
[  281.660761]  880424349ae8 81180695 8804242ab038 
0004
[  281.660761]  001d8500 88052bdd8500 880424349b18 
81180915
[  281.660761]  876a68b0 8804242ab000  
0001
[  281.660761] Call Trace:
[  281.660761]  [] ? sched_clock_local+0x25/0x90
[  281.660761]  [] ? sched_clock_cpu+0xc5/0x110
[  281.660761]  [] lock_acquire+0x182/0x1d0
[  281.660761]  [] ? walk_pte_range+0xb8/0x170
[  281.660761]  [] ? __lock_release+0x1da/0x1f0
[  281.660761]  [] _raw_spin_lock+0x3b/0x70
[  281.660761]  [] ? walk_pte_range+0xb8/0x170
[  281.660761]  [] walk_pte_range+0xb8/0x170
[  281.660761]  [] walk_pmd_range+0x211/0x240
[  281.660761]  [] walk_pud_range+0x12b/0x160
[  281.660761]  [] walk_pgd_range+0x109/0x140
[  281.660761]  [] __walk_page_range+0x35/0x40
[  281.660761]  [] walk_page_range+0xf2/0x130
[  281.660761]  [] queue_pages_range+0x6c/0x90
[  281.660761]  [] ? queue_pages_hugetlb+0x90/0x90
[  281.660761]  [] ? queue_pages_range+0x90/0x90
[  281.660761]  [] ? change_prot_numa+0x30/0x30
[  281.660761]  [] do_mbind+0x311/0x330
[  281.660761]  [] ? vtime_account_user+0x91/0xa0
[  281.660761]  [] ? context_tracking_user_exit+0xa8/0x1c0
[  281.660761]  [] SYSC_mbind+0x89/0xb0
[  281.660761]  [] SyS_mbind+0x9/0x10
[  281.660761]  [] tracesys+0xdd/0xe2
[  281.660761] Code: c2 04 47 49 85 be fa 0b 00 00 48 c7 c7 bb 85 49 85 e8 d9 
7b f9 ff 31 c0 e9 9c
04 00 00 66 90 44 8b 1d a9 b8 ac 04 45 85 db 74 0c <48> 81 3b 40 61 3f 87 75 06 
0f 1f 00 45 31 c0 83
fe 01 77 0c 89
[  281.660761] RIP  [] __lock_acquire+0xbc/0x580
[  281.660761]  RSP 
[  281.660761] CR2: 0018
[  281.660761] ---[ end trace b6e188d329664196 ]---


Out of curiosity, I'm testing out a new piece of code to make decoding this dump a bit easier. Let 
me know if it helped at all. Lines are based on -next from today:


[  281.650503] BUG: unable to handle kernel NULL pointer dereference at 
0018
[  281.651577] IP: [] __lock_acquire+0xbc/0x580
[  281.652453] PGD 40b88d067 PUD 40b88c067 PMD 0
[  281.653143] Oops:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
[  281.653869] Dumping ftrace buffer:
[  281.654430](ftrace buffer empty)
[  281.654975] Modules linked in:
[  281.655441] CPU: 4 PID: 12314 Comm: trinity-c361 Tainted: G    W 
3.14.0-rc3-next-20140220-sasha-8-gab7e7ac-dirty #113

[  281.657622] task: 8804242ab000 ti: 880424348000 task.ti: 
880424348000
[  281.658503] RIP: 0010:[]  [] 
__lock_acquire+0xbc/0x580

[  281.660025] RSP: 0018:880424349ab8  EFLAGS: 00010002
[  281.660761] RAX: 0086 RBX: 0018 RCX: 
[  281.660761] RDX:  RSI:  RDI: 0018
[  281.660761] RBP: 880424349b28 R08: 0001 R09: 
[  281.660761] R10: 0001 R11: 0001 R12: 8804242ab000
[  281.660761] R13:  R14:  R15: 0001
[  281.660761] FS:  7f36534b0700() GS:88052bc0() 
knlGS:
[  281.660761] CS:  0010 DS:  ES:  CR0: 8005003b
[  281.660761] CR2: 0018 CR3: 00040b88e000 CR4: 06e0
[  281.660761] Stack:
[  281.660761]  880424349ae8 81180695 8804242ab038 
0004
[  281.660761]  001d8500 88052bdd8500 880424349b18 
81180915
[  281.6607

[PATCH] module: LLVMLinux: Fix section mismatch issues on alias usage

2014-02-20 Thread behanw
From: Jan-Simon Möller 

Attribute aliases don't inherit the link section name when compiled with clang.
As a result, the linking section needs to be explicitly specified when building
a module. This behavior is undefined in the standard which is why it differs 
from
compiler to compiler.

Author:  PaX Team 
ML-Post: 
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120507/142707.html
URL: http://llvm.linuxfoundation.org
Merge:   Jan-Simon Möller 
Signed-off-by: Jan-Simon Möller 
Signed-off-by: Behan Webster 
---
 include/linux/init.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/init.h b/include/linux/init.h
index e168880..384ec5e 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -297,13 +297,14 @@ void __init parse_early_options(char *cmdline);
 #define module_init(initfn)\
static inline initcall_t __inittest(void)   \
{ return initfn; }  \
-   int init_module(void) __attribute__((alias(#initfn)));
+   int init_module(void) __section(.init) __attribute__((alias(#initfn)));
 
 /* This is only required if you want to be unloadable. */
 #define module_exit(exitfn)\
static inline exitcall_t __exittest(void)   \
{ return exitfn; }  \
-   void cleanup_module(void) __attribute__((alias(#exitfn)));
+   void cleanup_module(void) __section(.exit)  \
+   __attribute__((alias(#exitfn)));
 
 #define __setup_param(str, unique_id, fn)  /* nothing */
 #define __setup(str, func) /* nothing */
-- 
1.8.3.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/


[PATCH v1.3 9/11] arcmsr: Fixed sparse warning or errors

2014-02-20 Thread 黃清隆
From: Ching 

Fixed sparse warning or errors.

Singed-off-by: Ching 
---

diff -uprN a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
--- a/drivers/scsi/arcmsr/arcmsr.h  2014-02-18 01:30:16.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr.h  2014-02-20 23:23:30.0 +0800
@@ -408,9 +408,9 @@ struct MessageUnit_A
 struct MessageUnit_B
 {
uint32_tpost_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
-   uint32_tdone_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
+   volatile uint32_t done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
uint32_tpostq_index;
-   uint32_tdoneq_index;
+   volatile uint32_t doneq_index;
uint32_t__iomem *drv2iop_doorbell;
uint32_t__iomem *drv2iop_doorbell_mask;
uint32_t__iomem *iop2drv_doorbell;
@@ -506,6 +506,7 @@ struct AdapterControlBlock
#define ACB_ADAPTER_TYPE_B0x0002/* hbb M IOP */
#define ACB_ADAPTER_TYPE_C0x0004/* hbc P IOP */
#define ACB_ADAPTER_TYPE_D0x0008/* hbd A IOP */
+   u32 roundup_ccbsize;
struct pci_dev *pdev;
struct Scsi_Host *  host;
unsigned long   vir2phy_offset;
@@ -564,6 +565,7 @@ struct AdapterControlBlock
dma_addr_t  dma_coherent_handle;
/* dma_coherent_handle used for memory free */
dma_addr_t  dma_coherent_handle2;
+   void*dma_coherent2;
unsigned intuncache_size;
uint8_t rqbuffer[ARCMSR_MAX_QBUFFER];
/* data collection buffer for read from 80331 */
diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
--- a/drivers/scsi/arcmsr/arcmsr_hba.c  2014-02-21 02:04:50.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c  2014-02-20 19:10:08.0 +0800
@@ -78,7 +78,7 @@ MODULE_VERSION(ARCMSR_DRIVER_VERSION);
 #defineARCMSR_SLEEPTIME10
 #defineARCMSR_RETRYCOUNT   12

-wait_queue_head_t wait_q;
+static wait_queue_head_t wait_q;
 static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb,
struct scsi_cmnd *cmd);
 static int arcmsr_iop_confirm(struct AdapterControlBlock *acb);
@@ -182,13 +182,10 @@ static struct pci_driver arcmsr_pci_driv
 static void arcmsr_free_mu(struct AdapterControlBlock *acb)
 {
switch (acb->adapter_type) {
-   case ACB_ADAPTER_TYPE_A:
-   case ACB_ADAPTER_TYPE_C:
-   break;
case ACB_ADAPTER_TYPE_B: {
-   dma_free_coherent(&acb->pdev->dev,
-   sizeof(struct MessageUnit_B),
-   acb->pmuB, acb->dma_coherent_handle2);
+   dma_free_coherent(&acb->pdev->dev, acb->roundup_ccbsize,
+   acb->dma_coherent2, acb->dma_coherent_handle2);
+   break;
}
}
 }
@@ -374,7 +371,7 @@ static uint8_t arcmsr_hbaB_wait_msgint_r

 static uint8_t arcmsr_hbaC_wait_msgint_ready(struct AdapterControlBlock *pACB)
 {
-   struct MessageUnit_C *phbcmu = (struct MessageUnit_C *)pACB->pmuC;
+   struct MessageUnit_C __iomem *phbcmu = pACB->pmuC;
int i;

for (i = 0; i < 2000; i++) {
@@ -424,7 +421,7 @@ static void arcmsr_hbaB_flush_cache(stru

 static void arcmsr_hbaC_flush_cache(struct AdapterControlBlock *pACB)
 {
-   struct MessageUnit_C *reg = (struct MessageUnit_C *)pACB->pmuC;
+   struct MessageUnit_C __iomem *reg = pACB->pmuC;
int retry_count = 30;/* enlarge wait flush adapter cache time:
10 minute */
writel(ARCMSR_INBOUND_MESG0_FLUSH_CACHE, ®->inbound_msgaddr0);
writel(ARCMSR_HBCMU_DRV2IOP_MESSAGE_CMD_DONE, ®->inbound_doorbell);
@@ -861,7 +858,7 @@ static uint8_t arcmsr_hbaB_abort_allcmd(
 }
 static uint8_t arcmsr_hbaC_abort_allcmd(struct AdapterControlBlock *pACB)
 {
-   struct MessageUnit_C *reg = (struct MessageUnit_C *)pACB->pmuC;
+   struct MessageUnit_C __iomem *reg = pACB->pmuC;
writel(ARCMSR_INBOUND_MESG0_ABORT_CMD, ®->inbound_msgaddr0);
writel(ARCMSR_HBCMU_DRV2IOP_MESSAGE_CMD_DONE, ®->inbound_doorbell);
if (!arcmsr_hbaC_wait_msgint_ready(pACB)) {
@@ -961,7 +958,7 @@ static u32 arcmsr_disable_outbound_ints(
}
break;
case ACB_ADAPTER_TYPE_C:{
-   struct MessageUnit_C *reg = (struct MessageUnit_C *)acb->pmuC;
+   struct MessageUnit_C __iomem *reg = acb->pmuC;
/* disable all outbound interrupt */
orig_mask = readl(®->host_int_mask); /* disable
outbound message0 int */
writel(orig_mask|ARCMSR_HBCMU_ALL_INTMASKENABLE,
®->host_int_mask);
@@ -1085,8 +1082,9 @@ static void arcmsr_done4abort_postqueue(
/*clear all outbound posted Q*/
   

[PATCH] ARM: EDMA: Use platform_get_resource functions for DT

2014-02-20 Thread Joel Fernandes
Currently, EDMA driver uses of_address_to_resource for getting Channel
controller and x-bar register resources. Use platform_get_resource_by_name
instead regardless of whether its DT-boot or not, document the new reg-names
properties.

Also, while at it get rid of the assumption in the code that "CC" is at reg
index 0 in the DT and xbar is at offset 1. Instead use reg-names to get the
memory resource in concern keeping things much cleaner and simpler. This also
makes it possible to have multiple channel controllers.

Signed-off-by: Joel Fernandes 
---
 Documentation/devicetree/bindings/dma/ti-edma.txt |7 ++
 arch/arm/boot/dts/am33xx.dtsi |1 +
 arch/arm/boot/dts/am4372.dtsi |1 +
 arch/arm/common/edma.c|   28 ++---
 4 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/Documentation/devicetree/bindings/dma/ti-edma.txt 
b/Documentation/devicetree/bindings/dma/ti-edma.txt
index 9fbbdb7..176e42b 100644
--- a/Documentation/devicetree/bindings/dma/ti-edma.txt
+++ b/Documentation/devicetree/bindings/dma/ti-edma.txt
@@ -8,6 +8,12 @@ Required properties:
   Clients should use a single channel number per DMA request.
 - dma-channels: Specify total DMA channels per CC
 - reg: Memory map for accessing module
+- reg-names: Since there can be different memory regions, each reg
+  entry should correspond to one of the following reg-names (X being 0 to N):
+   edma_ccX: memory map for Xth Channel Controller
+   edma_tcX: memory map for Xth Transfer Controller
+   Additionally there can be a memory map for xbar (in control module):
+   edma_xbar: memory map for xbar access.
 - interrupt-parent: Interrupt controller the interrupt is routed through
 - interrupts: Exactly 3 interrupts need to be specified in the order:
   1. Transfer completion interrupt.
@@ -21,6 +27,7 @@ Example:
 
 edma: edma@4900 {
reg = <0x4900 0x1>;
+   reg-names = "edma_cc0";
interrupt-parent = <&intc>;
interrupts = <12 13 14>;
compatible = "ti,edma3";
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 2b66e67..55f5723 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -123,6 +123,7 @@
ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2";
reg =   <0x4900 0x1>,
<0x44e10f90 0x10>;
+   reg-names = "edma_cc0", "edma_xbar";
interrupts = <12 13 14>;
#dma-cells = <1>;
dma-channels = <64>;
diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index babdc84..1323a97 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -100,6 +100,7 @@
ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2";
reg =   <0x4900 0x1>,
<0x44e10f90 0x10>;
+   reg-names = "edma_cc0", "edma_xbar";
interrupts = ,
,
;
diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c
index dc95efc..ae0ccae 100644
--- a/arch/arm/common/edma.c
+++ b/arch/arm/common/edma.c
@@ -1458,10 +1458,11 @@ static int edma_xbar_event_map(struct device *dev,
   struct edma_soc_info *pdata, int len)
 {
int ret, i;
-   struct resource res;
+   struct resource *res;
void __iomem *xbar;
const s16 (*xbar_chans)[2];
u32 shift, offset, mux;
+   struct platform_device *pdev;
 
xbar_chans = devm_kzalloc(dev,
  len/sizeof(s16) + 2*sizeof(s16),
@@ -1469,11 +1470,14 @@ static int edma_xbar_event_map(struct device *dev,
if (!xbar_chans)
return -ENOMEM;
 
-   ret = of_address_to_resource(node, 1, &res);
-   if (ret)
+   pdev = to_platform_device(dev);
+   res = platform_get_resource_byname(pdev,
+  IORESOURCE_MEM,
+  "edma_xbar");
+   if (!res)
return -EIO;
 
-   xbar = devm_ioremap(dev, res.start, resource_size(&res));
+   xbar = devm_ioremap(dev, res->start, resource_size(res));
if (!xbar)
return -ENOMEM;
 
@@ -1614,7 +1618,6 @@ static int edma_probe(struct platform_device *pdev)
int irq[EDMA_MAX_CC] = {0, 0};
int err_irq[EDMA_MAX_CC] = {0, 0};
struct resource *r[EDMA_MAX_CC] = {NULL};
-   struct resource res[EDMA_MAX_CC];
charres_name[10];
charirq_name[10];
struct device_node  *node = pdev->dev.of_node;
@@ -1653,16

[PATCH v1.3 8/11] arcmsr: Modify ioctl relate functions to fix update firmware error

2014-02-20 Thread 黃清隆
From: Ching 

Modify ioctl relate functions to fix update firmware error.

Singed-off-by: Ching 
---

diff -uprN a/drivers/scsi/arcmsr/arcmsr_attr.c
b/drivers/scsi/arcmsr/arcmsr_attr.c
--- a/drivers/scsi/arcmsr/arcmsr_attr.c 2014-01-10 20:28:48.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr_attr.c 2014-01-15 23:41:36.0 +0800
@@ -59,64 +59,104 @@

 struct device_attribute *arcmsr_host_attrs[];

-static ssize_t arcmsr_sysfs_iop_message_read(struct file *filp,
-struct kobject *kobj,
-struct bin_attribute *bin,
-char *buf, loff_t off,
-size_t count)
+static ssize_t
+arcmsr_sysfs_iop_message_read(struct file *filp,
+   struct kobject *kobj,
+   struct bin_attribute *bin,
+   char *buf, loff_t off,
+   size_t count)
 {
-   struct device *dev = container_of(kobj,struct device,kobj);
+   struct device *dev = container_of(kobj, struct device, kobj);
struct Scsi_Host *host = class_to_shost(dev);
-   struct AdapterControlBlock *acb = (struct AdapterControlBlock
*) host->hostdata;
+   struct AdapterControlBlock *acb =
+   (struct AdapterControlBlock *)host->hostdata;
uint8_t *pQbuffer,*ptmpQbuffer;
int32_t allxfer_len = 0;
+   unsigned long flags;

if (!capable(CAP_SYS_ADMIN))
return -EACCES;

/* do message unit read. */
ptmpQbuffer = (uint8_t *)buf;
-   while ((acb->rqbuf_firstindex != acb->rqbuf_lastindex)
-   && (allxfer_len < 1031)) {
+   spin_lock_irqsave(&acb->rqbuffer_lock, flags);
+   if (acb->rqbuf_firstindex != acb->rqbuf_lastindex) {
pQbuffer = &acb->rqbuffer[acb->rqbuf_firstindex];
-   memcpy(ptmpQbuffer, pQbuffer, 1);
-   acb->rqbuf_firstindex++;
-   acb->rqbuf_firstindex %= ARCMSR_MAX_QBUFFER;
-   ptmpQbuffer++;
-   allxfer_len++;
+   if (acb->rqbuf_firstindex > acb->rqbuf_lastindex) {
+   if ((ARCMSR_MAX_QBUFFER -
acb->rqbuf_firstindex) >= 1032) {
+   memcpy(ptmpQbuffer, pQbuffer, 1032);
+   acb->rqbuf_firstindex += 1032;
+   acb->rqbuf_firstindex %= ARCMSR_MAX_QBUFFER;
+   allxfer_len = 1032;
+   } else {
+   if (((ARCMSR_MAX_QBUFFER -
acb->rqbuf_firstindex)
+   + acb->rqbuf_lastindex) > 1032) {
+   memcpy(ptmpQbuffer, pQbuffer,
+   ARCMSR_MAX_QBUFFER
+   - acb->rqbuf_firstindex);
+   ptmpQbuffer += ARCMSR_MAX_QBUFFER
+   - acb->rqbuf_firstindex;
+   memcpy(ptmpQbuffer, acb->rqbuffer, 1032
+   - (ARCMSR_MAX_QBUFFER -
+   acb->rqbuf_firstindex));
+   acb->rqbuf_firstindex = 1032 -
+   (ARCMSR_MAX_QBUFFER -
+   acb->rqbuf_firstindex);
+   allxfer_len = 1032;
+   } else {
+   memcpy(ptmpQbuffer, pQbuffer,
+   ARCMSR_MAX_QBUFFER -
+   acb->rqbuf_firstindex);
+   ptmpQbuffer += ARCMSR_MAX_QBUFFER -
+   acb->rqbuf_firstindex;
+   memcpy(ptmpQbuffer, acb->rqbuffer,
+   acb->rqbuf_lastindex);
+   allxfer_len = ARCMSR_MAX_QBUFFER -
+   acb->rqbuf_firstindex +
+   acb->rqbuf_lastindex;
+   acb->rqbuf_firstindex =
+   acb->rqbuf_lastindex;
+   }
+   }
+   } else {
+   if ((acb->rqbuf_lastindex -
acb->rqbuf_firstindex) > 1032) {
+   memcpy(ptmpQbuffer, pQbuffer, 1032);
+   acb->rqbuf_firstindex += 1032;
+   allxfer_len = 1032;
+   } else {
+   memcpy(ptmpQbuffer, pQbuffer,
acb->rqbuf_lastindex
+   

Re: [PATCH 0/4] x86: Fix ftrace recovery when code modification failed

2014-02-20 Thread Steven Rostedt
On Mon, 17 Feb 2014 16:22:49 +0100
Petr Mladek  wrote:

> Ftrace modifies function calls using Int3 breakpoints on x86. It patches
> all functions in parallel to reduce the number of sync() calls. There is
> a code that removes pending Int3 breakpoints when something goes wrong.
> 
> The recovery does not work on x86_64. I simulated an error in
> ftrace_replace_code() and the system got rebooted.

Thanks for the report, I just did the same and it caused a reboot too.

> 
> This patch set fixes the recovery code, improves debugging of this
> type of problem, and does some clean up.
> 
> BTW: It is an echo from the patch set that tried to use text_poke_bp()
> instead of the ftrace-specific Int3 based patching code. Ftrace has
> some specific restrictions. I did not find a way how to make the 
> universal text_poke_bp effective, safe, and clean to be usable
> there.
> 
> The patch set is against linux/tip. Last commit is a5b3cca53c43c3ba7
> (Merge tag 'v3.14-rc3')
> 
> Petr Mladek (4):
>   x86: Clean up remove_breakpoint() in ftrace code
>   x86: Fix ftrace patching recovery code to work on x86_64
>   x86: BUG when ftrace patching recovery fails
>   x86: Fix order of warning messages when ftrace modifies code
> 
>  arch/x86/kernel/ftrace.c | 67 
> 
>  1 file changed, 34 insertions(+), 33 deletions(-)
> 

That's quite a bit of changes. I did a quick debug analysis of it, and
found two bugs.

One, I shouldn't be using direct access to the ip with
probe_kernel_write(), I need to do the within() magic (also have a
ftrace_write() wrapper now).

The second bug is that I need to do another run_sync() after the fix
up. Can you see if this patch fixes the issue?

-- Steve

 ftrace.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index e625319..6b566c8 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -455,7 +455,7 @@ static int remove_breakpoint(struct dyn_ftrace *rec)
}
 
  update:
-   return probe_kernel_write((void *)ip, &nop[0], 1);
+   return ftrace_write(ip, nop, 1);
 }
 
 static int add_update_code(unsigned long ip, unsigned const char *new)
@@ -634,6 +634,7 @@ void ftrace_replace_code(int enable)
rec = ftrace_rec_iter_record(iter);
remove_breakpoint(rec);
}
+   run_sync();
 }
 
 static int
@@ -664,7 +665,7 @@ ftrace_modify_code(unsigned long ip, unsigned const
char *old_code, return ret;
 
  fail_update:
-   probe_kernel_write((void *)ip, &old_code[0], 1);
+   ftrace_write(ip, old_code, 1);
goto out;
 }
 

--
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 v1.3 7/11] arcmsr: Notify sense data report

2014-02-20 Thread 黃清隆
From: Ching 

Notify sense data report

Singed-off-by: Ching 
---

diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
--- a/drivers/scsi/arcmsr/arcmsr_hba.c  2014-02-21 02:03:28.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c  2014-02-21 02:04:10.0 +0800
@@ -906,7 +906,7 @@ static void arcmsr_report_sense_info(str

struct scsi_cmnd *pcmd = ccb->pcmd;
struct SENSE_DATA *sensebuffer = (struct SENSE_DATA
*)pcmd->sense_buffer;
-   pcmd->result = DID_OK << 16;
+   pcmd->result = (DID_OK << 16) | (CHECK_CONDITION << 1);
if (sensebuffer) {
int sense_data_length =
sizeof(struct SENSE_DATA) < SCSI_SENSE_BUFFERSIZE
@@ -915,6 +915,7 @@ static void arcmsr_report_sense_info(str
memcpy(sensebuffer, ccb->arcmsr_cdb.SenseData,
sense_data_length);
sensebuffer->ErrorCode = SCSI_SENSE_CURRENT_ERRORS;
sensebuffer->Valid = 1;
+   pcmd->result |= (DRIVER_SENSE << 24);
}
 }
--
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/


progress, marching to the rear

2014-02-20 Thread Gene Heskett
I finally found a keyboard I can use when the boots fails to the
initramfs: prompt.  ps2 plug on it.

>From the messages it leaves on screen, it is NOT finding the drive plugged 
into the mobo SATA1 connector when I try to boot to a 3.13.1-2-3 kernel.

So just to verify I am looking in the right place in the /sys directory, I 
believe I was in drivers/pci/sata_nv when I took the pix now up on my web 
page.  

This is an ASUS M2N SLI Deluxe mobo, 8 Gigs of ram, phenom 9550 running 
slow at 2.1 Ghz.  This needs the sata_nv module to work with this hardware.

There are 4 drives in this box, and they are all working just fine when 
booted to 3.12.9, but that pix I just posted to my web page in the link 
below, in the Genes-os9-stf/LCNC link looks like there are only 3, and the 
first one has been enumerated to pci 5:0. Then 5:1 and 5:2 if I am reading 
that right.  But that same location in the 3.12.9 boot also only shows 3 
"devices" so obviously I don't know what I am doing.  Again...

So, when all I have is the initramfs: prompt, where in the /sys tree can I 
verify that all 4 drives are present and awake?

Thanks.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 

--
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 v3 4/6] timerfd: Factor out timer-type unspecific timerfd_expire()

2014-02-20 Thread Anton Vorontsov
On Thu, Feb 20, 2014 at 11:52:03AM +0100, Thomas Gleixner wrote:
> > From: Anton Vorontsov 
> > 
> > There is nothing hrtimer-specific inside the timerfd_tmrproc(), except
> > the function prototype. We're about to add other timer types, so factor
> > out generic timerfd_expire() helper from timerfd_tmrproc().
> 
> This changelog is completely useless. How is timerfd_tmrproc, which is
> not a function but a function pointer, related to the patch?
> 
> Moving duplicated code to a common function is nice, but 

> > Signed-off-by: Anton Vorontsov 
> > Signed-off-by: Alexey Perevalov 
... 
> Warnings are there to be ignored and testing of user space
> interfaces after a change is overrated, right?
> 
> Aside of that you just blindly copied the original code w/o fixing up
> the now unnecessary line breaks.

Alexey,

While I appreciate the desire to be careful with authorship and stuff,
please remove my name as an author of this patch -- the current code has
nothing to do with my original work, and I surely don't want to take any
responsibility for it. This is a common practice if you modify someone's
patch to a great extend.

Thomas is bashing the thing, which has my name on it; although _my_ patch
did not produce any warnings, came with a completely different changelog,
and served completely different purposes.

Instead of rushing with resending yet another series, please actually read
Thomas' review.

Thanks,

Anton
--
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 v3 5/6] timerfd: Add support for deferrable timers

2014-02-20 Thread Anton Vorontsov
On Thu, Feb 20, 2014 at 12:09:43PM +0100, Thomas Gleixner wrote:
> On Thu, 20 Feb 2014, Alexey Perevalov wrote:
> > From: Anton Vorontsov 
> > 
> > This patch implements a userland-side API for generic deferrable timers,
> > per linux/timer.h:
> > 
> >  * A deferrable timer will work normally when the system is busy, but
> >  * will not cause a CPU to come out of idle just to service it; instead,
> >  * the timer will be serviced when the CPU eventually wakes up with a
> >  * subsequent non-deferrable timer.
> > 
> > These timers are crucial for power saving, i.e. periodic tasks that want
> > to work in background when the system is under use, but don't want to
> > cause wakeups themselves.
> > 
> > The deferred timers are somewhat orthogonal to high-res external timers,
> > since the deferred timer is tied to the system load, not just to some
> > external decrementer source.
> 
> Again this changelog makes no sense. What's orthogonal to high-res
> timers and why are they external?

Not trying to defend the current series, just felt the need clarify this
one.

By orthogonal I meant that comparing to high resolution timers' use cases,
deferred timers can be super-low resolution, super inaccurate. We don't
know exactly when they will fire, all we know is something like "every 0.2
seconds, iff the system/user is doing something, otherwise don't bother."

As for external (my bad, shouldn't invent personal terminology): the
hrtimers are tied to some clock source (which is "external" to me), but
deferred timers are mostly tied to the system's activity.

Thanks,

Anton
--
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] Fix: module signature vs tracepoints: add new TAINT_UNSIGNED_MODULE

2014-02-20 Thread Steven Rostedt
On Fri, 21 Feb 2014 09:39:18 +1030
Rusty Russell  wrote:

> >> comment "Do not forget to sign required modules with scripts/sign-file"
> >>depends on MODULE_SIG_FORCE && !MODULE_SIG_ALL
> >> 
> >> Then you didn't do that.  You broke it, you get to keep both pieces.
> >
> > In this case we should fail the module load all together, and require
> > insmod to add the --force flag to load it. Why the hell are we setting
> > a FORCED_MODULE flag when no module was forced
> 
> If this mistake of creating unsigned modules is common, then it would be
> friendly to do something about it, yes.

I just got another report about it happening again today.

> 
> Perhaps we should append UNSIGNED to vermagic, and then strip that out
> when we sign the module?  That would have this effect.

If it makes the user have to use --force, then they will be more aware
something went wrong when things are not working.

I still find it strange that things like tracepoints are not working on
a module just because it wasn't signed. I can see someone adding
something and not doing the signing, and wonder why tracepoints are
broken. Right now, I'm the one that gets the bug reports, not you :-(

Them: "Tracepoints are broken".
Me: "What do you mean tracepoints are broken?"
Them: "I enabled them, but don't see them being recorded"
Me: "Is this for tracepoints in a module?"
Them: "Yes"
Me: "Oh, this again. Do you have MODULE_SIG_FORCE & !MODULE_SIG_ALL
set, and you didn't sign your module?"
Them: "Yes"
Me: "Well that's your problem."
Them: "What does that have to do with tracepoints?"
Me: "Well, loading a non signed module into a kernel that requires
sigs, sets the FORCED_MODULE flag, and that breaks tracepoints"
Them: "Why? The module is from the same kernel and built with the same
tool chain"
Me: "it just does"
Them: "I'm just working on this module, and I want to trace it, but
don't want to keep signing it"
Me: "Oh well, that's just the way it goes"
Them: "Why?"

When honestly, just adding another taint flag and let tracepoints
still load would keep people from pestering me about it.

The only reason we don't trace FORCED_MODULE modules, is because it may
have an older data structure, or different tracepoint logic. We avoid
adding tracepoints on those because we don't want bug reports from
people using tracepoints in modules that were compiled for a different
kernel, because that could cause havoc. Ironically, having tracepoints
not added for modules with that taint is causing more bug reports due
to this signing issue. Maybe I'll just let tracepoints work with modules
that have that taint and deal with the bug reports that are caused by
people loading older modules into newer kernels.

-- Steve
--
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 v1.3 6/11] arcmsr: Rewrite arcmsr_message_isr_bh_fn function

2014-02-20 Thread 黃清隆
From: Ching 

Rewrite arcmsr_message_isr_bh_fn function

Singed-off-by: Ching 
---


diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
--- a/drivers/scsi/arcmsr/arcmsr_hba.c  2014-02-21 02:02:34.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c  2014-02-21 02:03:28.0 +0800
@@ -489,121 +489,68 @@ static int arcmsr_alloc_ccb_pool(struct
return 0;
 }

-static void arcmsr_message_isr_bh_fn(struct work_struct *work)
+static void
+arcmsr_message_isr_bh_fn(struct work_struct *work)
 {
-   struct AdapterControlBlock *acb = container_of(work,struct
AdapterControlBlock, arcmsr_do_message_isr_bh);
-   switch (acb->adapter_type) {
-   case ACB_ADAPTER_TYPE_A: {
-
-   struct MessageUnit_A __iomem *reg  = acb->pmuA;
-   char *acb_dev_map = (char *)acb->device_map;
-   uint32_t __iomem *signature = (uint32_t
__iomem*) (®->message_rwbuffer[0]);
-   char __iomem *devicemap = (char __iomem*)
(®->message_rwbuffer[21]);
-   int target, lun;
-   struct scsi_device *psdev;
-   char diff;
+   struct AdapterControlBlock *acb = container_of(work,
+   struct AdapterControlBlock, arcmsr_do_message_isr_bh);
+   char *acb_dev_map = (char *)acb->device_map;
+   uint32_t __iomem *signature = NULL;
+   char __iomem *devicemap = NULL;
+   int target, lun;
+   struct scsi_device *psdev;
+   char diff, temp;

-   atomic_inc(&acb->rq_map_token);
-   if (readl(signature) == ARCMSR_SIGNATURE_GET_CONFIG) {
-   for(target = 0; target <
ARCMSR_MAX_TARGETID -1; target++) {
-   diff = (*acb_dev_map)^readb(devicemap);
-   if (diff != 0) {
-   char temp;
-   *acb_dev_map = readb(devicemap);
-   temp =*acb_dev_map;
-   for(lun = 0; lun <
ARCMSR_MAX_TARGETLUN; lun++) {
-   if((temp &
0x01)==1 && (diff & 0x01) == 1) {
-
scsi_add_device(acb->host, 0, target, lun);
-   }else if((temp
& 0x01) == 0 && (diff & 0x01) == 1) {
-   psdev
= scsi_device_lookup(acb->host, 0, target, lun);
-   if
(psdev != NULL ) {
-
 scsi_remove_device(psdev);
-
 scsi_device_put(psdev);
-   }
-   }
-   temp >>= 1;
-   diff >>= 1;
-   }
-   }
-   devicemap++;
-   acb_dev_map++;
-   }
-   }
-   break;
+   switch (acb->adapter_type) {
+   case ACB_ADAPTER_TYPE_A: {
+   struct MessageUnit_A __iomem *reg  = acb->pmuA;
+   signature = (uint32_t __iomem *)(®->message_rwbuffer[0]);
+   devicemap = (char __iomem *)(®->message_rwbuffer[21]);
+   break;
}
-
-   case ACB_ADAPTER_TYPE_B: {
-   struct MessageUnit_B *reg  = acb->pmuB;
-   char *acb_dev_map = (char *)acb->device_map;
-   uint32_t __iomem *signature = (uint32_t
__iomem*)(®->message_rwbuffer[0]);
-   char __iomem *devicemap = (char
__iomem*)(®->message_rwbuffer[21]);
-   int target, lun;
-   struct scsi_device *psdev;
-   char diff;
-
-   atomic_inc(&acb->rq_map_token);
-   if (readl(signature) == ARCMSR_SIGNATURE_GET_CONFIG) {
-   for(target = 0; target <
ARCMSR_MAX_TARGETID -1; target++) {
-   diff = (*acb_dev_map)^readb(devicemap);
-   if (diff != 0) {
-   char temp;
-   *acb_dev_map = readb(devicemap);
-   temp =*acb_dev_map;
-   for(lun = 0; lun <
ARCMSR_MAX_TARGETLUN; lun++) {
-   if((temp &
0x01)==1 && (diff & 0x01) == 1) {
-
scsi_add_device(acb->host, 0, target, lun);
-   }else if((temp
& 

[PATCH v1.3 5/11] arcmsr: Rename function name and variables for readability

2014-02-20 Thread 黃清隆
From: Ching 

Rename function name and variables for readability.

Singed-off-by: Ching 
---

diff -uprN a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
--- a/drivers/scsi/arcmsr/arcmsr.h  2014-01-13 23:21:56.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr.h  2014-01-14 23:27:40.0 +0800
@@ -358,7 +358,7 @@ struct ARCMSR_CDB
 #define ARCMSR_CDB_FLAG_ORDEREDQ   0x10

uint8_t msgPages;
-   uint32_tContext;
+   uint32_tmsgContext;
uint32_tDataLength;
uint8_t Cdb[16];
uint8_t DeviceStatus;
@@ -561,8 +561,8 @@ struct AdapterControlBlock
/* dma_coherent used for memory free */
dma_addr_t  dma_coherent_handle;
/* dma_coherent_handle used for memory free */
-   dma_addr_t  dma_coherent_handle_hbb_mu;
-   unsigned intuncache_size;
+   dma_addr_t  dma_coherent_handle2;
+   unsigned intuncache_size;
uint8_t rqbuffer[ARCMSR_MAX_QBUFFER];
/* data collection buffer for read from 80331 */
int32_t rqbuf_firstindex;
@@ -611,7 +611,7 @@ struct CommandControlBlock{
struct list_headlist;
 /*x32: 8byte, x64: 16byte*/
struct scsi_cmnd*pcmd;
 /*8 bytes pointer of linux scsi command */
struct AdapterControlBlock  *acb;
 /*x32: 4byte, x64: 8byte*/
-   uint32_tcdb_phyaddr_pattern;
 /*x32: 4byte, x64: 4byte*/
+   uint32_tcdb_phyaddr;
 /*x32: 4byte, x64: 4byte*/
uint32_tarc_cdb_size;
 /*x32:4byte,x64:4byte*/
uint16_tccb_flags;
 /*x32: 2byte, x64: 2byte*/
#define CCB_FLAG_READ   0x
diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
--- a/drivers/scsi/arcmsr/arcmsr_hba.c  2014-02-21 02:01:56.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c  2014-02-21 02:02:34.0 +0800
@@ -98,12 +98,12 @@ static u32 arcmsr_disable_outbound_ints(
 static void arcmsr_enable_outbound_ints(struct AdapterControlBlock *acb,
u32 intmask_org);
 static void arcmsr_stop_adapter_bgrb(struct AdapterControlBlock *acb);
-static void arcmsr_flush_hba_cache(struct AdapterControlBlock *acb);
-static void arcmsr_flush_hbb_cache(struct AdapterControlBlock *acb);
+static void arcmsr_hbaA_flush_cache(struct AdapterControlBlock *acb);
+static void arcmsr_hbaB_flush_cache(struct AdapterControlBlock *acb);
 static void arcmsr_request_device_map(unsigned long pacb);
-static void arcmsr_request_hba_device_map(struct AdapterControlBlock *acb);
-static void arcmsr_request_hbb_device_map(struct AdapterControlBlock *acb);
-static void arcmsr_request_hbc_device_map(struct AdapterControlBlock *acb);
+static void arcmsr_hbaA_request_device_map(struct AdapterControlBlock *acb);
+static void arcmsr_hbaB_request_device_map(struct AdapterControlBlock *acb);
+static void arcmsr_hbaC_request_device_map(struct AdapterControlBlock *acb);
 static void arcmsr_message_isr_bh_fn(struct work_struct *work);
 static bool arcmsr_get_firmware_spec(struct AdapterControlBlock *acb);
 static void arcmsr_start_adapter_bgrb(struct AdapterControlBlock *acb);
@@ -179,17 +179,17 @@ static struct pci_driver arcmsr_pci_driv
 
 */

-static void arcmsr_free_hbb_mu(struct AdapterControlBlock *acb)
+static void arcmsr_free_mu(struct AdapterControlBlock *acb)
 {
switch (acb->adapter_type) {
case ACB_ADAPTER_TYPE_A:
case ACB_ADAPTER_TYPE_C:
break;
-   case ACB_ADAPTER_TYPE_B:{
+   case ACB_ADAPTER_TYPE_B: {
dma_free_coherent(&acb->pdev->dev,
sizeof(struct MessageUnit_B),
-   acb->pmuB, acb->dma_coherent_handle_hbb_mu);
-   }
+   acb->pmuB, acb->dma_coherent_handle2);
+   }
}
 }

@@ -314,7 +314,7 @@ static void arcmsr_define_adapter_type(s
}
 }

-static uint8_t arcmsr_hba_wait_msgint_ready(struct AdapterControlBlock *acb)
+static uint8_t arcmsr_hbaA_wait_msgint_ready(struct AdapterControlBlock *acb)
 {
struct MessageUnit_A __iomem *reg = acb->pmuA;
int i;
@@ -332,7 +332,7 @@ static uint8_t arcmsr_hba_wait_msgint_re
return false;
 }

-static uint8_t arcmsr_hbb_wait_msgint_ready(struct AdapterControlBlock *acb)
+static uint8_t arcmsr_hbaB_wait_msgint_ready(struct AdapterControlBlock *acb)
 {
struct Messag

Re: [PATCH 3.10 00/66] 3.10.32-stable review

2014-02-20 Thread Guenter Roeck

On 02/20/2014 03:50 PM, Greg Kroah-Hartman wrote:

This is the start of the stable review cycle for the 3.10.32 release.
There are 66 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Sat Feb 22 23:48:52 UTC 2014.
Anything received after that time might be too late.


[ ... ]


Guenter Roeck 
 iio: max1363: Use devm_regulator_get_optional for optional regulator



Hi Greg,

Oops ... how embarrassing. This one doesn't work in 3.10 and causes
build failures. Please drop it.

Thanks,
Guenter



--
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 v1.3 4/11] arcmsr: Revise xxx_get_config functions

2014-02-20 Thread 黃清隆
From: Ching 

Revise xxx_get_config functions.

Singed-off-by: Ching 
---

diff -uprN a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
--- a/drivers/scsi/arcmsr/arcmsr.h  2014-01-11 03:14:14.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr.h  2014-01-13 23:21:56.0 +0800
@@ -598,6 +598,7 @@ struct AdapterControlBlock
#define FW_DEADLOCK 0x0010
atomic_trq_map_token;
atomic_tante_token_value;
+   uint32_tmaxOutstanding;
 };/* HW_DEVICE_EXTENSION */
 /*
 ***
diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
--- a/drivers/scsi/arcmsr/arcmsr_hba.c  2014-02-21 02:00:16.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c  2014-02-21 02:01:56.0 +0800
@@ -2241,8 +2241,7 @@ static int arcmsr_queue_command_lck(stru
arcmsr_handle_virtual_command(acb, cmd);
return 0;
}
-   if (atomic_read(&acb->ccboutstandingcount) >=
-   ARCMSR_MAX_OUTSTANDING_CMD)
+   if (atomic_read(&acb->ccboutstandingcount) >= acb->maxOutstanding)
return SCSI_MLQUEUE_HOST_BUSY;
ccb = arcmsr_get_freeccb(acb);
if (!ccb)
@@ -2258,24 +2257,28 @@ static int arcmsr_queue_command_lck(stru

 static DEF_SCSI_QCMD(arcmsr_queue_command)

-static bool arcmsr_get_hba_config(struct AdapterControlBlock *acb)
+static bool
+arcmsr_hbaA_get_config(struct AdapterControlBlock *acb)
 {
struct MessageUnit_A __iomem *reg = acb->pmuA;
char *acb_firm_model = acb->firm_model;
char *acb_firm_version = acb->firm_version;
char *acb_device_map = acb->device_map;
-   char __iomem *iop_firm_model = (char __iomem
*)(®->message_rwbuffer[15]);
-   char __iomem *iop_firm_version = (char __iomem
*)(®->message_rwbuffer[17]);
-   char __iomem *iop_device_map = (char __iomem
*)(®->message_rwbuffer[21]);
+   char __iomem *iop_firm_model =
+   (char __iomem *)(®->message_rwbuffer[15]);
+   char __iomem *iop_firm_version =
+   (char __iomem *)(®->message_rwbuffer[17]);
+   char __iomem *iop_device_map =
+   (char __iomem *)(®->message_rwbuffer[21]);
int count;
writel(ARCMSR_INBOUND_MESG0_GET_CONFIG, ®->inbound_msgaddr0);
if (!arcmsr_hba_wait_msgint_ready(acb)) {
-   printk(KERN_NOTICE "arcmsr%d: wait 'get adapter firmware \
-   miscellaneous data' timeout \n", acb->host->host_no);
+   pr_notice("arcmsr%d: wait 'get adapter firmware "
+   "miscellaneous data' timeout\n", acb->host->host_no);
return false;
}
count = 8;
-   while (count){
+   while (count) {
*acb_firm_model = readb(iop_firm_model);
acb_firm_model++;
iop_firm_model++;
@@ -2283,7 +2286,7 @@ static bool arcmsr_get_hba_config(struct
}

count = 16;
-   while (count){
+   while (count) {
*acb_firm_version = readb(iop_firm_version);
acb_firm_version++;
iop_firm_version++;
@@ -2291,27 +2294,29 @@ static bool arcmsr_get_hba_config(struct
}

count=16;
-   while(count){
+   while (count) {
*acb_device_map = readb(iop_device_map);
acb_device_map++;
iop_device_map++;
count--;
}
-   printk(KERN_NOTICE "Areca RAID Controller%d: F/W %s & Model %s\n",
+   pr_notice("Areca RAID Controller%d: Model %s, F/W %s\n",
acb->host->host_no,
-   acb->firm_version,
-   acb->firm_model);
+   acb->firm_model,
+   acb->firm_version);
acb->signature = readl(®->message_rwbuffer[0]);
acb->firm_request_len = readl(®->message_rwbuffer[1]);
acb->firm_numbers_queue = readl(®->message_rwbuffer[2]);
acb->firm_sdram_size = readl(®->message_rwbuffer[3]);
acb->firm_hd_channels = readl(®->message_rwbuffer[4]);
-   acb->firm_cfg_version = readl(®->message_rwbuffer[25]);
/*firm_cfg_version,25,100-103*/
+   acb->firm_cfg_version = readl(®->message_rwbuffer[25]);
return true;
 }
-static bool arcmsr_get_hbb_config(struct AdapterControlBlock *acb)
+
+static bool
+arcmsr_hbaB_get_config(struct AdapterControlBlock *acb)
 {
-   struct MessageUnit_B *reg = acb->pmuB;
+   struct MessageUnit_B *reg;
struct pci_dev *pdev = acb->pdev;
void *dma_coherent;
dma_addr_t dma_coherent_handle;
@@ -2325,40 +2330,50 @@ static bool arcmsr_get_hbb_config(struct
char __iomem *iop_device_map;
/*firm_version,21,84-99*/
int count;
-   dma_coherent = dma_alloc_coherent(&pdev->dev, sizeof(struct
MessageUnit_B), &dma_coherent_handle, GFP_K

Re: "m" constraints, jumps, and alternatives

2014-02-20 Thread H. Peter Anvin
On 02/20/2014 07:30 PM, Brian Gerst wrote:
> 
> The percpu code uses %P to force absolute addressing mode, instead of
> rip-relative.
> 

   P -- if PIC, print an @PLT suffix.

Clearly it has more effects than that... as the code does reveal:

  /* Avoid (%rip) for call operands.  */
  if (CONSTANT_ADDRESS_P (x) && code == 'P'
  && !CONST_INT_P (x))

That should work... in the probably extremely rare case that any of
these references go to global addresses then they spend an extra byte
(and a little more work during kASLR relocation or module insertion).

-hpa

--
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 4/4] hugetlb: add hugepages_node= command-line option

2014-02-20 Thread Luiz Capitulino
On Thu, 20 Feb 2014 15:15:46 -0800 (PST)
David Rientjes  wrote:

> Do I really need to do your work for you and work on 1GB hugepages at 
> runtime, which many more people would be interested in?  Or are we just 
> seeking the easiest way out here with something that shuts the customer up 
> and leaves a kernel command line option that we'll need to maintain to 
> avoid breaking backwards compatibility in the future?

We're seeking a pragmatic solution.

I've said many times in this thread that we're also interested on being
able to allocate 1GB at runtime and would work on it on top of the
command-line option, which is ready, works and solves a real world problem.
--
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 v1.3 3/11] arcmsr: Support hibernation

2014-02-20 Thread 黃清隆
From: Ching 

Supporting hibernation.

Singed-off-by: Ching 
---

diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
--- a/drivers/scsi/arcmsr/arcmsr_hba.c  2014-02-21 01:59:56.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c  2014-02-21 02:00:16.0 +0800
@@ -87,13 +87,16 @@ static int arcmsr_bus_reset(struct scsi_
 static int arcmsr_bios_param(struct scsi_device *sdev,
struct block_device *bdev, sector_t capacity, int *info);
 static int arcmsr_queue_command(struct Scsi_Host *h, struct scsi_cmnd *cmd);
-static int arcmsr_probe(struct pci_dev *pdev,
-   const struct pci_device_id *id);
+static int arcmsr_probe(struct pci_dev *pdev, const struct pci_device_id *id);
+static int arcmsr_suspend(struct pci_dev *pdev, pm_message_t state);
+static int arcmsr_resume(struct pci_dev *pdev);
 static void arcmsr_remove(struct pci_dev *pdev);
 static void arcmsr_shutdown(struct pci_dev *pdev);
 static void arcmsr_iop_init(struct AdapterControlBlock *acb);
 static void arcmsr_free_ccb_pool(struct AdapterControlBlock *acb);
 static u32 arcmsr_disable_outbound_ints(struct AdapterControlBlock *acb);
+static void arcmsr_enable_outbound_ints(struct AdapterControlBlock *acb,
+   u32 intmask_org);
 static void arcmsr_stop_adapter_bgrb(struct AdapterControlBlock *acb);
 static void arcmsr_flush_hba_cache(struct AdapterControlBlock *acb);
 static void arcmsr_flush_hbb_cache(struct AdapterControlBlock *acb);
@@ -164,9 +167,11 @@ static struct pci_device_id arcmsr_devic
 MODULE_DEVICE_TABLE(pci, arcmsr_device_id_table);
 static struct pci_driver arcmsr_pci_driver = {
.name   = "arcmsr",
-   .id_table   = arcmsr_device_id_table,
+   .id_table   = arcmsr_device_id_table,
.probe  = arcmsr_probe,
.remove = arcmsr_remove,
+   .suspend= arcmsr_suspend,
+   .resume = arcmsr_resume,
.shutdown   = arcmsr_shutdown,
 };
 /*
@@ -603,6 +608,121 @@ static void arcmsr_message_isr_bh_fn(str
}
 }

+static int
+arcmsr_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+   int i;
+   uint32_t intmask_org;
+   struct Scsi_Host *host = pci_get_drvdata(pdev);
+   struct AdapterControlBlock *acb =
+   (struct AdapterControlBlock *)host->hostdata;
+
+   intmask_org = arcmsr_disable_outbound_ints(acb);
+   if (acb->acb_flags & ACB_F_MSI_ENABLED) {
+   free_irq(pdev->irq, acb);
+   pci_disable_msi(pdev);
+   } else if (acb->acb_flags & ACB_F_MSIX_ENABLED) {
+   for (i = 0; i < ARCMST_NUM_MSIX_VECTORS; i++)
+   free_irq(acb->entries[i].vector, acb);
+   pci_disable_msix(pdev);
+   } else
+   free_irq(pdev->irq, acb);
+   del_timer_sync(&acb->eternal_timer);
+   flush_scheduled_work();
+   arcmsr_stop_adapter_bgrb(acb);
+   arcmsr_flush_adapter_cache(acb);
+   arcmsr_enable_outbound_ints(acb, intmask_org);
+   pci_set_drvdata(pdev, host);
+   pci_save_state(pdev);
+   pci_disable_device(pdev);
+   pci_set_power_state(pdev, pci_choose_state(pdev, state));
+   return 0;
+}
+
+static int
+arcmsr_resume(struct pci_dev *pdev)
+{
+   int error, i, j;
+   struct Scsi_Host *host = pci_get_drvdata(pdev);
+   struct AdapterControlBlock *acb =
+   (struct AdapterControlBlock *)host->hostdata;
+   struct msix_entry entries[ARCMST_NUM_MSIX_VECTORS];
+   pci_set_power_state(pdev, PCI_D0);
+   pci_enable_wake(pdev, PCI_D0, 0);
+   pci_restore_state(pdev);
+   if (pci_enable_device(pdev)) {
+   pr_warn("%s: pci_enable_device error\n", __func__);
+   return -ENODEV;
+   }
+   error = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
+   if (error) {
+   error = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
+   if (error) {
+   pr_warn("scsi%d: No suitable DMA mask available\n",
+  host->host_no);
+   goto controller_unregister;
+   }
+   }
+   pci_set_master(pdev);
+   if (pci_find_capability(pdev, PCI_CAP_ID_MSIX)) {
+   if (!pci_enable_msix(pdev, entries,
+   ARCMST_NUM_MSIX_VECTORS)) {
+   for (i = 0; i < ARCMST_NUM_MSIX_VECTORS;
+   i++) {
+   entries[i].entry = i;
+   if (request_irq(entries[i].vector,
+   arcmsr_do_interrupt, 0,
+   "arcmsr", acb)) {
+   for (j = 0 ; j < i ; j++)
+
free_irq(entries[i].vector, acb);
+   goto controller_stop;
+   }
+  

[PATCH v1.3 2/11] arcmsr: Support MSI and MSI-X interrupt service

2014-02-20 Thread 黃清隆
From: Ching 

Supporting MSI and MSI-X interrupt service.

Singed-off-by: Ching 
---

diff -uprN a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
--- a/drivers/scsi/arcmsr/arcmsr.h  2014-01-11 02:53:22.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr.h  2014-01-11 03:14:14.0 +0800
@@ -64,6 +64,7 @@ struct device_attribute;
 #define ARCMSR_MAX_HBB_POSTQUEUE   264
 #define ARCMSR_MAX_XFER_LEN0x26000 /* 152K */
 #define ARCMSR_CDB_SG_PAGE_LENGTH  256
+#define ARCMST_NUM_MSIX_VECTORS4
 #ifndef PCI_DEVICE_ID_ARECA_1880
 #define PCI_DEVICE_ID_ARECA_1880   0x1880
 #endif
@@ -508,6 +509,7 @@ struct AdapterControlBlock
struct pci_dev *pdev;
struct Scsi_Host *  host;
unsigned long   vir2phy_offset;
+   struct msix_entry   entries[ARCMST_NUM_MSIX_VECTORS];
/* Offset is used in making arc cdb physical to virtual calculations */
uint32_toutbound_int_enable;
uint32_tcdb_phyaddr_hi32;
@@ -542,8 +544,10 @@ struct AdapterControlBlock

#define ACB_F_IOP_INITED0x0100
/* iop init */
-   #define ACB_F_ABORT 0x0200
-   #define ACB_F_FIRMWARE_TRAP 0x0400
+   #define ACB_F_ABORT 0x0200
+   #define ACB_F_FIRMWARE_TRAP 0x0400
+   #define ACB_F_MSI_ENABLED   0x1000
+   #define ACB_F_MSIX_ENABLED  0x2000
struct CommandControlBlock *
pccb_pool[ARCMSR_MAX_FREECCB_NUM];
/* used for memory free */
struct list_headccb_free_list;
diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
--- a/drivers/scsi/arcmsr/arcmsr_hba.c  2014-02-21 01:59:18.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c  2014-02-21 01:59:56.0 +0800
@@ -607,20 +607,19 @@ static int arcmsr_probe(struct pci_dev *
 {
struct Scsi_Host *host;
struct AdapterControlBlock *acb;
-   uint8_t bus,dev_fun;
-   int error;
+   uint8_t bus, dev_fun;
+   struct msix_entry entries[ARCMST_NUM_MSIX_VECTORS];
+   int error, i, j;
error = pci_enable_device(pdev);
-   if(error){
+   if (error)
return -ENODEV;
-   }
host = scsi_host_alloc(&arcmsr_scsi_host_template,
sizeof(struct AdapterControlBlock));
-   if(!host){
+   if (!host)
goto pci_disable_dev;
-   }
error = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
-   if(error){
+   if (error) {
error = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
-   if(error){
+   if (error) {
printk(KERN_WARNING
   "scsi%d: No suitable DMA mask available\n",
   host->host_no);
@@ -644,9 +643,8 @@ static int arcmsr_probe(struct pci_dev *
pci_set_drvdata(pdev, host);
pci_set_master(pdev);
error = pci_request_regions(pdev, "arcmsr");
-   if(error){
+   if (error)
goto scsi_host_release;
-   }
spin_lock_init(&acb->eh_lock);
spin_lock_init(&acb->ccblist_lock);
acb->acb_flags |= (ACB_F_MESSAGE_WQBUFFER_CLEARED |
@@ -656,28 +654,58 @@ static int arcmsr_probe(struct pci_dev *
INIT_LIST_HEAD(&acb->ccb_free_list);
arcmsr_define_adapter_type(acb);
error = arcmsr_remap_pciregion(acb);
-   if(!error){
+   if (!error)
goto pci_release_regs;
-   }
error = arcmsr_get_firmware_spec(acb);
-   if(!error){
+   if (!error)
goto unmap_pci_region;
-   }
error = arcmsr_alloc_ccb_pool(acb);
-   if(error){
-   goto free_hbb_mu;
-   }
-   arcmsr_iop_init(acb);
+   if (error)
+   goto free_mu;
error = scsi_add_host(host, &pdev->dev);
-   if(error){
+   if (error)
goto RAID_controller_stop;
-   }
-   error = request_irq(pdev->irq, arcmsr_do_interrupt,
IRQF_SHARED, "arcmsr", acb);
-   if(error){
-   goto scsi_host_remove;
+   if (pci_find_capability(pdev, PCI_CAP_ID_MSIX)) {
+   if (!pci_enable_msix(pdev, entries, ARCMST_NUM_MSIX_VECTORS)) {
+   for (i = 0; i < ARCMST_NUM_MSIX_VECTORS; i++) {
+   entries[i].entry = i;
+   if (request_irq(entries[i].vector,
+   arcmsr_do_interrupt, 0,
"arcmsr", acb)) {
+   for (j = 0 ; j < i ; j++)
+
free_irq(entries[i].vector, acb);
+   goto scsi_host_remove;
+   }
+   acb->entries[i] = entries[i];
+   }
+   acb->acb_fla

[PATCH 1/1] Drivers: hv: vmbus: Fix a bug in getting ACPI specified resources

2014-02-20 Thread K. Y. Srinivasan
Fix a bug in the resource walking code. This patch depends on
commit number: 90f3453585479d5beb75058da46eb573ced0e6ac

Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/vmbus_drv.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index b37c91b..2352ae48 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -899,10 +899,12 @@ static acpi_status vmbus_walk_resources(struct 
acpi_resource *res, void *ctx)
switch (res->type) {
case ACPI_RESOURCE_TYPE_IRQ:
irq = res->data.irq.interrupts[0];
+   break;
 
case ACPI_RESOURCE_TYPE_ADDRESS64:
hyperv_mmio_start = res->data.address64.minimum;
hyperv_mmio_size = res->data.address64.address_length;
+   break;
}
 
return AE_OK;
-- 
1.7.4.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 1/1] Drivers: hv: vmbus: Fix a bug in getting ACPI specified resources

2014-02-20 Thread KY Srinivasan


> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Thursday, February 20, 2014 6:21 PM
> To: KY Srinivasan
> Cc: linux-kernel@vger.kernel.org; de...@linuxdriverproject.org
> Subject: Re: [PATCH 1/1] Drivers: hv: vmbus: Fix a bug in getting ACPI 
> specified
> resources
> 
> On Fri, Feb 21, 2014 at 12:19:22AM +, KY Srinivasan wrote:
> >
> >
> > > -Original Message-
> > > From: Greg KH [mailto:gre...@linuxfoundation.org]
> > > Sent: Thursday, February 20, 2014 3:47 PM
> > > To: KY Srinivasan
> > > Cc: linux-kernel@vger.kernel.org; de...@linuxdriverproject.org
> > > Subject: Re: [PATCH 1/1] Drivers: hv: vmbus: Fix a bug in getting ACPI
> specified
> > > resources
> > >
> > > On Thu, Feb 20, 2014 at 03:45:12PM -0800, K. Y. Srinivasan wrote:
> > > > Fix a bug in the resource walking code.
> > > >
> > > > Signed-off-by: K. Y. Srinivasan 
> > > > ---
> > > >  drivers/hv/vmbus_drv.c |2 ++
> > > >  1 files changed, 2 insertions(+), 0 deletions(-)
> > >
> > > Fails to apply to my char-misc-next branch (if you want it in
> > > 3.14-final, that's where it belongs...):
> > >   checking file drivers/hv/vmbus_drv.c
> > >   Hunk #1 FAILED at 899.
> > >   1 out of 1 hunk FAILED
> >
> > Greg,
> >
> > This patch is based on this commit:
> >
> > commit 90f3453585479d5beb75058da46eb573ced0e6ac
> >
> > Signed-off-by: K. Y. Srinivasan 
> > Signed-off-by: Greg Kroah-Hartman 
> >
> > I just got your char-misc-next branch and it does not have the needed 
> > commit.
> 
> Then I guess this isn't 3.14-final material, right?
> 
> Please resend it when you have determined which branch it should go
> into, it's out of my queue now.

Thanks Greg, I will resend the patch. Please apply it to char-misc.git tree.

Regards,

K. Y
--
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/


[tip:x86/acpi] x86, acpi: Fix bug in associating hot-added CPUs with corresponding NUMA node

2014-02-20 Thread tip-bot for Jiang Liu
Commit-ID:  896dc5064083063981954f142e43548765199792
Gitweb: http://git.kernel.org/tip/896dc5064083063981954f142e43548765199792
Author: Jiang Liu 
AuthorDate: Mon, 20 Jan 2014 10:31:54 +0800
Committer:  H. Peter Anvin 
CommitDate: Thu, 20 Feb 2014 19:01:22 -0800

x86, acpi: Fix bug in associating hot-added CPUs with corresponding NUMA node

Current ACPI cpu hotplug driver fails to associate hot-added CPUs with
corresponding NUMA node when doing socket online. The code path to
associate CPU with NUMA node is as below:
acpi_processor_add()
->acpi_processor_get_info()
->acpi_processor_hotadd_init()
->acpi_map_lsapic()
->_acpi_map_lsapic()
->acpi_map_cpu2node()
cpu_subsys_online()
->try_online_node()
->node_set_online()

When doing socket online, a new NUMA node is introduced in addition to
hot-added CPU and memory device. And the new NUMA node is marked as
online when onlining hot-added CPUs through sysfs interface
/sys/devices/system/cpu/cpuxx/online.

On the other hand, acpi_map_cpu2node() will only build the CPU to node
map if corresponding NUMA node is already online, so it always fails
to associate hot-added CPUs with corresponding NUMA node because the
NUMA node is still in offline state.

For the fix, we could safely remove the "node_online(node)" check in
function acpi_map_cpu2node() because it's only called for hot-added CPUs
by acpi_processor_hotadd_init().

Signed-off-by: Jiang Liu 
Link: 
http://lkml.kernel.org/r/1390185115-26850-1-git-send-email-jiang@linux.intel.com
Acked-by: Rafael J. Wysocki 
Signed-off-by: H. Peter Anvin 
---
 arch/x86/kernel/acpi/boot.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 1dac942..9f46f2b 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -613,10 +613,10 @@ static void acpi_map_cpu2node(acpi_handle handle, int 
cpu, int physid)
int nid;
 
nid = acpi_get_node(handle);
-   if (nid == -1 || !node_online(nid))
-   return;
-   set_apicid_to_node(physid, nid);
-   numa_set_node(cpu, nid);
+   if (nid != -1) {
+   set_apicid_to_node(physid, nid);
+   numa_set_node(cpu, nid);
+   }
 #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 v2] sysfs: fix namespace refcnt leak

2014-02-20 Thread Li Zefan
As mount() and kill_sb() is not a one-to-one match, we shoudn't get
ns refcnt unconditionally in sysfs_mount(), and instead we should
get the refcnt only when kernfs_mount() allocated a new superblock.

v2:
- Changed the name of the new argument, suggested by Tejun.
- Made the argument optional, suggested by Tejun.

Signed-off-by: Li Zefan 
---

This fix is for 3.14.

---
 fs/kernfs/mount.c  | 8 +++-
 fs/sysfs/mount.c   | 5 +++--
 include/linux/kernfs.h | 9 +
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
index 405279b..47f4efd 100644
--- a/fs/kernfs/mount.c
+++ b/fs/kernfs/mount.c
@@ -132,6 +132,7 @@ const void *kernfs_super_ns(struct super_block *sb)
  * @flags: mount flags specified for the mount
  * @root: kernfs_root of the hierarchy being mounted
  * @ns: optional namespace tag of the mount
+ * @new_sb_created: tell the caller if we allocated a new superblock
  *
  * This is to be called from each kernfs user's file_system_type->mount()
  * implementation, which should pass through the specified @fs_type and
@@ -141,7 +142,8 @@ const void *kernfs_super_ns(struct super_block *sb)
  * The return value can be passed to the vfs layer verbatim.
  */
 struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags,
-  struct kernfs_root *root, const void *ns)
+  struct kernfs_root *root, const void *ns,
+  bool *new_sb_created)
 {
struct super_block *sb;
struct kernfs_super_info *info;
@@ -159,6 +161,10 @@ struct dentry *kernfs_mount_ns(struct file_system_type 
*fs_type, int flags,
kfree(info);
if (IS_ERR(sb))
return ERR_CAST(sb);
+
+   if (new_sb_created)
+   *new_sb_created = !sb->s_root;
+
if (!sb->s_root) {
error = kernfs_fill_super(sb);
if (error) {
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index 5c7fdd9..f5bea79 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -27,6 +27,7 @@ static struct dentry *sysfs_mount(struct file_system_type 
*fs_type,
 {
struct dentry *root;
void *ns;
+   bool new_sb;
 
if (!(flags & MS_KERNMOUNT)) {
if (!capable(CAP_SYS_ADMIN) && !fs_fully_visible(fs_type))
@@ -37,8 +38,8 @@ static struct dentry *sysfs_mount(struct file_system_type 
*fs_type,
}
 
ns = kobj_ns_grab_current(KOBJ_NS_TYPE_NET);
-   root = kernfs_mount_ns(fs_type, flags, sysfs_root, ns);
-   if (IS_ERR(root))
+   root = kernfs_mount_ns(fs_type, flags, sysfs_root, ns, &new_sb);
+   if (IS_ERR(root) || !new_sb)
kobj_ns_drop(KOBJ_NS_TYPE_NET, ns);
return root;
 }
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index 649497a..ea3f5d2 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -279,7 +279,8 @@ void kernfs_notify(struct kernfs_node *kn);
 
 const void *kernfs_super_ns(struct super_block *sb);
 struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags,
-  struct kernfs_root *root, const void *ns);
+  struct kernfs_root *root, const void *ns,
+  bool *new_sb_created);
 void kernfs_kill_sb(struct super_block *sb);
 
 void kernfs_init(void);
@@ -372,7 +373,7 @@ static inline const void *kernfs_super_ns(struct 
super_block *sb)
 
 static inline struct dentry *
 kernfs_mount_ns(struct file_system_type *fs_type, int flags,
-   struct kernfs_root *root, const void *ns)
+   struct kernfs_root *root, const void *ns, bool *new_sb_created)
 { return ERR_PTR(-ENOSYS); }
 
 static inline void kernfs_kill_sb(struct super_block *sb) { }
@@ -430,9 +431,9 @@ static inline int kernfs_rename(struct kernfs_node *kn,
 
 static inline struct dentry *
 kernfs_mount(struct file_system_type *fs_type, int flags,
-struct kernfs_root *root)
+struct kernfs_root *root, bool *new_sb_created)
 {
-   return kernfs_mount_ns(fs_type, flags, root, NULL);
+   return kernfs_mount_ns(fs_type, flags, root, NULL, new_sb_created);
 }
 
 #endif /* __LINUX_KERNFS_H */
-- 
1.8.0.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/


[PATCH v1.3 1/11] arcmsr: Revise interrupt service routine to fix command timeout

2014-02-20 Thread 黃清隆
From: Ching 

Rewrite interrupt service routine to fix command timeout on controller
too heavy loading.

Singed-off-by: Ching 
---

diff -uprN a/drivers/scsi/arcmsr/arcmsr_attr.c
b/drivers/scsi/arcmsr/arcmsr_attr.c
--- a/drivers/scsi/arcmsr/arcmsr_attr.c 2014-02-07 01:47:24.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr_attr.c 2014-01-10 20:28:48.0 +0800
@@ -400,3 +400,4 @@ struct device_attribute *arcmsr_host_att
&dev_attr_host_fw_hd_channels,
NULL,
 };
+
diff -uprN a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
--- a/drivers/scsi/arcmsr/arcmsr.h  2014-02-07 01:47:44.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr.h  2014-01-11 02:53:22.0 +0800
@@ -45,28 +45,28 @@
 #include 
 struct device_attribute;
 /*The limit of outstanding scsi command that firmware can handle*/
-#define ARCMSR_MAX_OUTSTANDING_CMD
 256
+#define ARCMSR_MAX_OUTSTANDING_CMD 255
 #ifdef CONFIG_XEN
#define ARCMSR_MAX_FREECCB_NUM  160
 #else
#define ARCMSR_MAX_FREECCB_NUM  320
 #endif
-#define ARCMSR_DRIVER_VERSION   "Driver Version
1.20.00.15 2010/08/05"
-#define ARCMSR_SCSI_INITIATOR_ID
 255
-#define ARCMSR_MAX_XFER_SECTORS
 512
-#define ARCMSR_MAX_XFER_SECTORS_B
 4096
-#define ARCMSR_MAX_XFER_SECTORS_C
 304
-#define ARCMSR_MAX_TARGETID
 17
-#define ARCMSR_MAX_TARGETLUN
 8
-#define ARCMSR_MAX_CMD_PERLUN
ARCMSR_MAX_OUTSTANDING_CMD
-#define ARCMSR_MAX_QBUFFER
 4096
-#define ARCMSR_DEFAULT_SG_ENTRIES
 38
-#define ARCMSR_MAX_HBB_POSTQUEUE
 264
-#define ARCMSR_MAX_XFER_LEN
 0x26000 /* 152K */
-#define ARCMSR_CDB_SG_PAGE_LENGTH
 256
+#define ARCMSR_DRIVER_VERSION  "v1.30.00.04-20131204"
+#define ARCMSR_SCSI_INITIATOR_ID   255
+#define ARCMSR_MAX_XFER_SECTORS512
+#define ARCMSR_MAX_XFER_SECTORS_B  4096
+#define ARCMSR_MAX_XFER_SECTORS_C  304
+#define ARCMSR_MAX_TARGETID17
+#define ARCMSR_MAX_TARGETLUN   8
+#define ARCMSR_MAX_CMD_PERLUN  ARCMSR_MAX_OUTSTANDING_CMD
+#define ARCMSR_MAX_QBUFFER 4096
+#define ARCMSR_DEFAULT_SG_ENTRIES  38
+#define ARCMSR_MAX_HBB_POSTQUEUE   264
+#define ARCMSR_MAX_XFER_LEN0x26000 /* 152K */
+#define ARCMSR_CDB_SG_PAGE_LENGTH  256
 #ifndef PCI_DEVICE_ID_ARECA_1880
-#define PCI_DEVICE_ID_ARECA_1880 0x1880
- #endif
+#define PCI_DEVICE_ID_ARECA_1880   0x1880
+#endif
 /*
 
**
 **
@@ -690,3 +690,4 @@ extern struct QBUFFER __iomem *arcmsr_ge
 extern struct device_attribute *arcmsr_host_attrs[];
 extern int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *);
 void arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb);
+
diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
--- a/drivers/scsi/arcmsr/arcmsr_hba.c  2014-02-07 01:47:00.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c  2014-02-21 01:59:18.0 +0800
@@ -104,7 +104,7 @@ static void arcmsr_request_hbc_device_ma
 static void arcmsr_message_isr_bh_fn(struct work_struct *work);
 static bool arcmsr_get_firmware_spec(struct AdapterControlBlock *acb);
 static void arcmsr_start_adapter_bgrb(struct AdapterControlBlock *acb);
-static void arcmsr_hbc_message_isr(struct AdapterControlBlock *pACB);
+static void arcmsr_hbaC_message_isr(struct AdapterControlBlock *pACB);
 static void arcmsr_hardware_reset(struct AdapterControlBlock *acb);
 static const char *arcmsr_info(struct Scsi_Host *);
 static irqreturn_t arcmsr_interrupt(struct AdapterControlBlock *acb);
@@ -1436,45 +1436,46 @@ static void arcmsr_iop2drv_data_read_han
}
 }

-static void arcmsr_hba_doorbell_isr(struct AdapterControlBlock *acb)
+static void
+arcmsr_hbaA_doorbell_isr(struct AdapterControlBlock *acb)
 {
uint32_t outbound_doorbell;
struct MessageUnit_A __iomem *reg = acb->pmuA;
outbound_doorbell = readl(®->outbound_doorbell);
-   writel(outbound_doorbell, ®->outbound_doorbell);
-   if (outbound_doorbell & ARCMSR_OUTBOUND_IOP331_DATA_WRITE_OK) {
-   arcmsr_iop2drv_data_wrote_handle(acb);
-   }
-
-   if (outbound_doorbell & ARCMSR_OUTBOUND_IOP331_DATA_READ_OK) {
-   arcmsr_iop2drv_data_read_handle(acb);
-   }
+   do {
+   writel(outbound_doorbell, ®->outbound_doorbell);
+   if (outbound_doorbell & ARCMSR_OUTBOUND_IOP331_DATA_WRITE_OK)
+   arcmsr_iop2drv_data_wrote_handle(acb);
+   if (outbound_doorbell & ARCMSR_OUTBOUND_IOP331_DATA_READ_OK)
+   arcmsr_iop2drv_data_read_handle(acb);
+   outbound_doorbell = readl(®->outbound_doorbell);
+   } while (outbound_doorbell & (ARCMSR_OUTBOUND_IOP331_DATA_WRITE_OK
+   | ARCMSR_OUTBOUND_IOP331_DATA_READ_OK));
 }
-static void arcmsr_hbc_doorbell_isr(struct AdapterControlBlock *pACB

[for-next][PATCH 06/18] ftrace: Copy ops private to global_ops private

2014-02-20 Thread Steven Rostedt
From: "Steven Rostedt (Red Hat)" 

If global_ops function is being called directly, instead of the global_ops
list function, set the global_ops private to be the same as the ops private
that's being called directly.

Signed-off-by: Steven Rostedt 
---
 kernel/trace/ftrace.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index cd7f76d..98ae4ed 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -244,7 +244,11 @@ static void control_ops_free(struct ftrace_ops *ops)
 
 static void update_global_ops(void)
 {
-   ftrace_func_t func;
+   ftrace_func_t func = ftrace_global_list_func;
+   void *private = NULL;
+
+   /* The list has its own recursion protection. */
+   global_ops.flags |= FTRACE_OPS_FL_RECURSION_SAFE;
 
/*
 * If there's only one function registered, then call that
@@ -254,23 +258,17 @@ static void update_global_ops(void)
if (ftrace_global_list == &ftrace_list_end ||
ftrace_global_list->next == &ftrace_list_end) {
func = ftrace_global_list->func;
+   private = ftrace_global_list->private;
/*
 * As we are calling the function directly.
 * If it does not have recursion protection,
 * the function_trace_op needs to be updated
 * accordingly.
 */
-   if (ftrace_global_list->flags & FTRACE_OPS_FL_RECURSION_SAFE)
-   global_ops.flags |= FTRACE_OPS_FL_RECURSION_SAFE;
-   else
+   if (!(ftrace_global_list->flags & FTRACE_OPS_FL_RECURSION_SAFE))
global_ops.flags &= ~FTRACE_OPS_FL_RECURSION_SAFE;
-   } else {
-   func = ftrace_global_list_func;
-   /* The list has its own recursion protection. */
-   global_ops.flags |= FTRACE_OPS_FL_RECURSION_SAFE;
}
 
-
/* If we filter on pids, update to use the pid function */
if (!list_empty(&ftrace_pids)) {
set_ftrace_pid_function(func);
@@ -278,6 +276,7 @@ static void update_global_ops(void)
}
 
global_ops.func = func;
+   global_ops.private = private;
 }
 
 static void ftrace_sync(struct work_struct *work)
-- 
1.8.5.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/


[for-next][PATCH 01/18] tracing: Pass trace_array to set_flag callback

2014-02-20 Thread Steven Rostedt
From: "Steven Rostedt (Red Hat)" 

As options (flags) may affect instances instead of being global
the set_flag() callbacks need to receive the trace_array descriptor
of the instance they will be modifying.

Signed-off-by: Steven Rostedt 
---
 kernel/trace/blktrace.c  |  3 ++-
 kernel/trace/trace.c | 18 ++
 kernel/trace/trace.h |  3 ++-
 kernel/trace/trace_functions.c   |  3 ++-
 kernel/trace/trace_functions_graph.c |  3 ++-
 kernel/trace/trace_irqsoff.c |  6 --
 kernel/trace/trace_nop.c |  2 +-
 kernel/trace/trace_sched_wakeup.c|  6 --
 8 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index b418cb0..0d758ca 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -1427,7 +1427,8 @@ static enum print_line_t blk_tracer_print_line(struct 
trace_iterator *iter)
return print_one_line(iter, true);
 }
 
-static int blk_tracer_set_flag(u32 old_flags, u32 bit, int set)
+static int
+blk_tracer_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set)
 {
/* don't output context-info for blk_classic output */
if (bit == TRACE_BLK_OPT_CLASSIC) {
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 815c878..d7dfc7e 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -73,7 +73,8 @@ static struct tracer_flags dummy_tracer_flags = {
.opts = dummy_tracer_opt
 };
 
-static int dummy_set_flag(u32 old_flags, u32 bit, int set)
+static int
+dummy_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set)
 {
return 0;
 }
@@ -3339,13 +3340,14 @@ static int tracing_trace_options_show(struct seq_file 
*m, void *v)
return 0;
 }
 
-static int __set_tracer_option(struct tracer *trace,
+static int __set_tracer_option(struct trace_array *tr,
   struct tracer_flags *tracer_flags,
   struct tracer_opt *opts, int neg)
 {
+   struct tracer *trace = tr->current_trace;
int ret;
 
-   ret = trace->set_flag(tracer_flags->val, opts->bit, !neg);
+   ret = trace->set_flag(tr, tracer_flags->val, opts->bit, !neg);
if (ret)
return ret;
 
@@ -3357,8 +3359,9 @@ static int __set_tracer_option(struct tracer *trace,
 }
 
 /* Try to assign a tracer specific option */
-static int set_tracer_option(struct tracer *trace, char *cmp, int neg)
+static int set_tracer_option(struct trace_array *tr, char *cmp, int neg)
 {
+   struct tracer *trace = tr->current_trace;
struct tracer_flags *tracer_flags = trace->flags;
struct tracer_opt *opts = NULL;
int i;
@@ -3367,8 +3370,7 @@ static int set_tracer_option(struct tracer *trace, char 
*cmp, int neg)
opts = &tracer_flags->opts[i];
 
if (strcmp(cmp, opts->name) == 0)
-   return __set_tracer_option(trace, trace->flags,
-  opts, neg);
+   return __set_tracer_option(tr, trace->flags, opts, neg);
}
 
return -EINVAL;
@@ -3440,7 +3442,7 @@ static int trace_set_options(struct trace_array *tr, char 
*option)
 
/* If no option could be set, test the specific tracer options */
if (!trace_options[i])
-   ret = set_tracer_option(tr->current_trace, cmp, neg);
+   ret = set_tracer_option(tr, cmp, neg);
 
mutex_unlock(&trace_types_lock);
 
@@ -5689,7 +5691,7 @@ trace_options_write(struct file *filp, const char __user 
*ubuf, size_t cnt,
 
if (!!(topt->flags->val & topt->opt->bit) != val) {
mutex_lock(&trace_types_lock);
-   ret = __set_tracer_option(topt->tr->current_trace, topt->flags,
+   ret = __set_tracer_option(topt->tr, topt->flags,
  topt->opt, !val);
mutex_unlock(&trace_types_lock);
if (ret)
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 02b592f..649a23d 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -355,7 +355,8 @@ struct tracer {
void(*print_header)(struct seq_file *m);
enum print_line_t   (*print_line)(struct trace_iterator *iter);
/* If you handled the flag setting, return 0 */
-   int (*set_flag)(u32 old_flags, u32 bit, int set);
+   int (*set_flag)(struct trace_array *tr,
+   u32 old_flags, u32 bit, int set);
/* Return 0 if OK with change, else return non-zero */
int (*flag_changed)(struct tracer *tracer,
u32 mask, int set);
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index 38fe148..85e517e 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_fu

[for-next][PATCH 12/18] tracing/uprobes: Rename uprobe_{trace,perf}_print() functions

2014-02-20 Thread Steven Rostedt
From: Namhyung Kim 

The uprobe_{trace,perf}_print functions are misnomers since what they
do is not printing.  There's also a real print function named
print_uprobe_event() so they'll only increase confusion IMHO.

Rename them with double underscores to follow convention of kprobe.

Link: 
http://lkml.kernel.org/r/1389946120-19610-2-git-send-email-namhy...@kernel.org

Reviewed-by: Masami Hiramatsu 
Cc: Frederic Weisbecker 
Cc: Ingo Molnar 
Cc: Oleg Nesterov 
Cc: Srikar Dronamraju 
Signed-off-by: Namhyung Kim 
Signed-off-by: Steven Rostedt 
---
 kernel/trace/trace_uprobe.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 79e52d9..c5d2612 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -758,7 +758,7 @@ static void uprobe_buffer_put(struct uprobe_cpu_buffer *ucb)
mutex_unlock(&ucb->mutex);
 }
 
-static void uprobe_trace_print(struct trace_uprobe *tu,
+static void __uprobe_trace_func(struct trace_uprobe *tu,
unsigned long func, struct pt_regs *regs)
 {
struct uprobe_trace_entry_head *entry;
@@ -807,14 +807,14 @@ out:
 static int uprobe_trace_func(struct trace_uprobe *tu, struct pt_regs *regs)
 {
if (!is_ret_probe(tu))
-   uprobe_trace_print(tu, 0, regs);
+   __uprobe_trace_func(tu, 0, regs);
return 0;
 }
 
 static void uretprobe_trace_func(struct trace_uprobe *tu, unsigned long func,
struct pt_regs *regs)
 {
-   uprobe_trace_print(tu, func, regs);
+   __uprobe_trace_func(tu, func, regs);
 }
 
 /* Event entry printers */
@@ -1014,7 +1014,7 @@ static bool uprobe_perf_filter(struct uprobe_consumer *uc,
return ret;
 }
 
-static void uprobe_perf_print(struct trace_uprobe *tu,
+static void __uprobe_perf_func(struct trace_uprobe *tu,
unsigned long func, struct pt_regs *regs)
 {
struct ftrace_event_call *call = &tu->tp.call;
@@ -1078,14 +1078,14 @@ static int uprobe_perf_func(struct trace_uprobe *tu, 
struct pt_regs *regs)
return UPROBE_HANDLER_REMOVE;
 
if (!is_ret_probe(tu))
-   uprobe_perf_print(tu, 0, regs);
+   __uprobe_perf_func(tu, 0, regs);
return 0;
 }
 
 static void uretprobe_perf_func(struct trace_uprobe *tu, unsigned long func,
struct pt_regs *regs)
 {
-   uprobe_perf_print(tu, func, regs);
+   __uprobe_perf_func(tu, func, regs);
 }
 #endif /* CONFIG_PERF_EVENTS */
 
-- 
1.8.5.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/


[for-next][PATCH 09/18] ftrace: Allow instances to use function tracing

2014-02-20 Thread Steven Rostedt
From: "Steven Rostedt (Red Hat)" 

Allow instances (sub-buffers) to enable function tracing.
Each instance will have its own function tracing capability.
For now, instances will not have function stack tracing, or will
they be able to pick and choose what functions they can trace.

Picking and choosing their own functions will come later.

Signed-off-by: Steven Rostedt 
---
 kernel/trace/trace.h   |   5 ++
 kernel/trace/trace_functions.c | 116 +++--
 2 files changed, 81 insertions(+), 40 deletions(-)

diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 86915b2..35cca05 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -210,6 +210,11 @@ struct trace_array {
struct list_headevents;
cpumask_var_t   tracing_cpumask; /* only trace on set CPUs */
int ref;
+#ifdef CONFIG_FUNCTION_TRACER
+   struct ftrace_ops   *ops;
+   /* function tracing enabled */
+   int function_enabled;
+#endif
 };
 
 enum {
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index 85e517e..3f8dc1c 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -13,33 +13,83 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "trace.h"
 
-/* function tracing enabled */
-static int ftrace_function_enabled;
+static void tracing_start_function_trace(struct trace_array *tr);
+static void tracing_stop_function_trace(struct trace_array *tr);
+static void
+function_trace_call(unsigned long ip, unsigned long parent_ip,
+   struct ftrace_ops *op, struct pt_regs *pt_regs);
+static void
+function_stack_trace_call(unsigned long ip, unsigned long parent_ip,
+ struct ftrace_ops *op, struct pt_regs *pt_regs);
+static struct ftrace_ops trace_ops;
+static struct ftrace_ops trace_stack_ops;
+static struct tracer_flags func_flags;
+
+/* Our option */
+enum {
+   TRACE_FUNC_OPT_STACK= 0x1,
+};
+
+static int allocate_ftrace_ops(struct trace_array *tr)
+{
+   struct ftrace_ops *ops;
 
-static struct trace_array  *func_trace;
+   ops = kzalloc(sizeof(*ops), GFP_KERNEL);
+   if (!ops)
+   return -ENOMEM;
 
-static void tracing_start_function_trace(void);
-static void tracing_stop_function_trace(void);
+   /* Currently only the non stack verision is supported */
+   ops->func = function_trace_call;
+   ops->flags = FTRACE_OPS_FL_RECURSION_SAFE;
+
+   tr->ops = ops;
+   ops->private = tr;
+   return 0;
+}
 
 static int function_trace_init(struct trace_array *tr)
 {
-   func_trace = tr;
+   struct ftrace_ops *ops;
+   int ret;
+
+   if (tr->flags & TRACE_ARRAY_FL_GLOBAL) {
+   /* There's only one global tr */
+   if (!trace_ops.private) {
+   trace_ops.private = tr;
+   trace_stack_ops.private = tr;
+   }
+
+   if (func_flags.val & TRACE_FUNC_OPT_STACK)
+   ops = &trace_stack_ops;
+   else
+   ops = &trace_ops;
+   tr->ops = ops;
+   } else {
+   ret = allocate_ftrace_ops(tr);
+   if (ret)
+   return ret;
+   }
+
tr->trace_buffer.cpu = get_cpu();
put_cpu();
 
tracing_start_cmdline_record();
-   tracing_start_function_trace();
+   tracing_start_function_trace(tr);
return 0;
 }
 
 static void function_trace_reset(struct trace_array *tr)
 {
-   tracing_stop_function_trace();
+   tracing_stop_function_trace(tr);
tracing_stop_cmdline_record();
+   if (!(tr->flags & TRACE_ARRAY_FL_GLOBAL))
+   kfree(tr->ops);
+   tr->ops = NULL;
 }
 
 static void function_trace_start(struct trace_array *tr)
@@ -47,25 +97,18 @@ static void function_trace_start(struct trace_array *tr)
tracing_reset_online_cpus(&tr->trace_buffer);
 }
 
-/* Our option */
-enum {
-   TRACE_FUNC_OPT_STACK= 0x1,
-};
-
-static struct tracer_flags func_flags;
-
 static void
 function_trace_call(unsigned long ip, unsigned long parent_ip,
struct ftrace_ops *op, struct pt_regs *pt_regs)
 {
-   struct trace_array *tr = func_trace;
+   struct trace_array *tr = op->private;
struct trace_array_cpu *data;
unsigned long flags;
int bit;
int cpu;
int pc;
 
-   if (unlikely(!ftrace_function_enabled))
+   if (unlikely(!tr->function_enabled))
return;
 
pc = preempt_count();
@@ -91,14 +134,14 @@ static void
 function_stack_trace_call(unsigned long ip, unsigned long parent_ip,
  struct ftrace_ops *op, struct pt_regs *pt_regs)
 {
-   struct trace_array *tr = func_trace;
+   struct trace_array *tr = op->private;
struct trace_array_cpu *data;
  

[for-next][PATCH 07/18] tracing: Disable tracers before deletion of instance

2014-02-20 Thread Steven Rostedt
From: "Steven Rostedt (Red Hat)" 

When an instance is about to be deleted, make sure the tracer
is set to nop. If it isn't reset the tracer and set it to the nop
tracer, otherwise memory leaks and bad pointers may result.

Signed-off-by: Steven Rostedt 
---
 kernel/trace/trace.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index da9543c..7d5913b 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3907,6 +3907,23 @@ create_trace_option_files(struct trace_array *tr, struct 
tracer *tracer);
 static void
 destroy_trace_option_files(struct trace_option_dentry *topts);
 
+/*
+ * Used to clear out the tracer before deletion of an instance.
+ * Must have trace_types_lock held.
+ */
+static void tracing_set_nop(struct trace_array *tr)
+{
+   if (tr->current_trace == &nop_trace)
+   return;
+   
+   tr->current_trace->enabled = false;
+
+   if (tr->current_trace->reset)
+   tr->current_trace->reset(tr);
+
+   tr->current_trace = &nop_trace;
+}
+
 static int tracing_set_tracer(struct trace_array *tr, const char *buf)
 {
static struct trace_option_dentry *topts;
@@ -6142,6 +6159,7 @@ static int instance_delete(const char *name)
 
list_del(&tr->list);
 
+   tracing_set_nop(tr);
event_trace_del_tracer(tr);
debugfs_remove_recursive(tr->dir);
free_percpu(tr->trace_buffer.data);
-- 
1.8.5.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/


[for-next][PATCH 11/18] ftrace: Allow for function tracing instance to filter functions

2014-02-20 Thread Steven Rostedt
From: "Steven Rostedt (Red Hat)" 

Create a "set_ftrace_filter" and "set_ftrace_notrace" files in the instance
directories to let users filter of functions to trace for the given instance.

Signed-off-by: Steven Rostedt 
---
 include/linux/ftrace.h |  2 ++
 kernel/trace/ftrace.c  | 39 ++-
 kernel/trace/trace.c   |  4 
 kernel/trace/trace.h   | 25 -
 kernel/trace/trace_functions.c | 40 
 5 files changed, 96 insertions(+), 14 deletions(-)

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index ef1607e..e6141be 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -92,6 +92,7 @@ typedef void (*ftrace_func_t)(unsigned long ip, unsigned long 
parent_ip,
  * STUB   - The ftrace_ops is just a place holder.
  * INITIALIZED - The ftrace_ops has already been initialized (first use time
  *register_ftrace_function() is called, it will initialized the 
ops)
+ * DELETED - The ops are being deleted, do not let them be registered again.
  */
 enum {
FTRACE_OPS_FL_ENABLED   = 1 << 0,
@@ -103,6 +104,7 @@ enum {
FTRACE_OPS_FL_RECURSION_SAFE= 1 << 6,
FTRACE_OPS_FL_STUB  = 1 << 7,
FTRACE_OPS_FL_INITIALIZED   = 1 << 8,
+   FTRACE_OPS_FL_DELETED   = 1 << 9,
 };
 
 /*
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 2b3e239..dcee546 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -436,6 +436,9 @@ static int remove_ftrace_list_ops(struct ftrace_ops **list,
 
 static int __register_ftrace_function(struct ftrace_ops *ops)
 {
+   if (ops->flags & FTRACE_OPS_FL_DELETED)
+   return -EINVAL;
+
if (FTRACE_WARN_ON(ops == &global_ops))
return -EINVAL;
 
@@ -4112,6 +4115,36 @@ static const struct file_operations 
ftrace_graph_notrace_fops = {
 };
 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
 
+void ftrace_create_filter_files(struct ftrace_ops *ops,
+   struct dentry *parent)
+{
+
+   trace_create_file("set_ftrace_filter", 0644, parent,
+ ops, &ftrace_filter_fops);
+
+   trace_create_file("set_ftrace_notrace", 0644, parent,
+ ops, &ftrace_notrace_fops);
+}
+
+/*
+ * The name "destroy_filter_files" is really a misnomer. Although
+ * in the future, it may actualy delete the files, but this is
+ * really intended to make sure the ops passed in are disabled
+ * and that when this function returns, the caller is free to
+ * free the ops.
+ *
+ * The "destroy" name is only to match the "create" name that this
+ * should be paired with.
+ */
+void ftrace_destroy_filter_files(struct ftrace_ops *ops)
+{
+   mutex_lock(&ftrace_lock);
+   if (ops->flags & FTRACE_OPS_FL_ENABLED)
+   ftrace_shutdown(ops, 0);
+   ops->flags |= FTRACE_OPS_FL_DELETED;
+   mutex_unlock(&ftrace_lock);
+}
+
 static __init int ftrace_init_dyn_debugfs(struct dentry *d_tracer)
 {
 
@@ -4121,11 +4154,7 @@ static __init int ftrace_init_dyn_debugfs(struct dentry 
*d_tracer)
trace_create_file("enabled_functions", 0444,
d_tracer, NULL, &ftrace_enabled_fops);
 
-   trace_create_file("set_ftrace_filter", 0644, d_tracer,
-   &global_ops, &ftrace_filter_fops);
-
-   trace_create_file("set_ftrace_notrace", 0644, d_tracer,
-   &global_ops, &ftrace_notrace_fops);
+   ftrace_create_filter_files(&global_ops, d_tracer);
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
trace_create_file("set_graph_function", 0444, d_tracer,
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index f9f22c4..d95ec28 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -6161,6 +6161,7 @@ static int instance_delete(const char *name)
 
tracing_set_nop(tr);
event_trace_del_tracer(tr);
+   ftrace_destroy_function_files(tr);
debugfs_remove_recursive(tr->dir);
free_percpu(tr->trace_buffer.data);
ring_buffer_free(tr->trace_buffer.buffer);
@@ -6291,6 +6292,9 @@ init_tracer_debugfs(struct trace_array *tr, struct dentry 
*d_tracer)
trace_create_file("tracing_on", 0644, d_tracer,
  tr, &rb_simple_fops);
 
+   if (ftrace_create_function_files(tr, d_tracer))
+   WARN(1, "Could not allocate function filter files");
+
 #ifdef CONFIG_TRACER_SNAPSHOT
trace_create_file("snapshot", 0644, d_tracer,
  tr, &snapshot_fops);
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 35cca05..ffc314b 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -819,13 +819,36 @@ static inline int ftrace_trace_task(struct task_struct 
*task)
return test_tsk_trace_trace(task);
 }
 extern int ftrace_is_dead(void);
+int ftrace_create_fun

Re: [PATCH v3 2/2] i2c: New bus driver for the Qualcomm QUP I2C controller

2014-02-20 Thread Emilio López

Hi Bjorn,

El 20/02/14 21:38, Bjorn Andersson escribió:

This bus driver supports the QUP i2c hardware controller in the Qualcomm SOCs.
The Qualcomm Universal Peripheral Engine (QUP) is a general purpose data path
engine with input/output FIFOs and an embedded i2c mini-core. The driver
supports FIFO mode (for low bandwidth applications) and block mode (interrupt
generated for each block-size data transfer).

Cc: Andy Gross 
Cc: Stephen Boyd 
Signed-off-by: Ivan T. Ivanov 
Signed-off-by: Bjorn Andersson 
---


I'm not familiar with the subsystem nor the hardware, so I had a look 
around for general stuff. I have some minor comments to make on the 
probe code.


(snip)

+static int qup_i2c_probe(struct platform_device *pdev)
+{
+   static const int blk_sizes[] = {4, 16, 32};
+   struct device_node *node = pdev->dev.of_node;
+   struct qup_i2c_dev *qup;
+   unsigned long one_bit_t;
+   struct resource *res;
+   u32 val, io_mode, hw_ver, size;
+   int ret, fs_div, hs_div;
+   int src_clk_freq;
+   int clk_freq;
+
+   qup = devm_kzalloc(&pdev->dev, sizeof(*qup), GFP_KERNEL);
+   if (!qup)
+   return -ENOMEM;
+
+   qup->dev = &pdev->dev;
+   init_completion(&qup->xfer);
+   platform_set_drvdata(pdev, qup);
+
+   clk_freq = 10;
+   if (!of_property_read_u32(node, "clock-frequency", &val))
+   clk_freq = val;


val will be modified only if no error occurs, so you may rewrite this 
bit as


+   u32 clk_freq = 10;
...
+   of_property_read_u32(node, "clock-frequency", &clk_freq)


+
+   /* We support frequencies up to FAST Mode (400KHz) */
+   if (clk_freq <= 0 || clk_freq > 40) {


And you can drop the < check when it's unsigned.


+   dev_err(qup->dev, "clock frequency not supported %d\n",
+   clk_freq);
+   return -EIO;


EIO?

Cheers,

Emilio
--
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/


[for-next][PATCH 17/18] tracing: Add trace_clock= kernel parameter

2014-02-20 Thread Steven Rostedt
From: Steven Rostedt 

Being able to change the trace clock at boot can be advantageous if
you need a better source of when things happen across CPUs. The default
trace clock is the fastest, but it uses local clocks which may not be
synced across CPUs and it does not let you know when events took place
with respect to events on other CPUs.

The global trace clock can help in this case, and if you do not care
about timings, the counter "clock" is the best, as that is just a  simple
atomic counter that is incremented for every event.

Usage is to add "trace_clock=counter" on the kernel command line. You
can replace counter with "global" or any of the clocks listed in
/sys/kernel/debug/tracing/trace_clock

Suggested-by: Thomas Gleixner 
Tested-by: Thomas Gleixner 
Reviewed-by: Thomas Gleixner 
Appreciated-by: Thomas Gleixner 
Signed-off-by: Steven Rostedt 
---
 kernel/trace/trace.c | 61 ++--
 1 file changed, 45 insertions(+), 16 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index d95ec28..c90f55d 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -181,6 +181,17 @@ static int __init set_trace_boot_options(char *str)
 }
 __setup("trace_options=", set_trace_boot_options);
 
+static char trace_boot_clock_buf[MAX_TRACER_SIZE] __initdata;
+static char *trace_boot_clock __initdata;
+
+static int __init set_trace_boot_clock(char *str)
+{
+   strlcpy(trace_boot_clock_buf, str, MAX_TRACER_SIZE);
+   trace_boot_clock = trace_boot_clock_buf;
+   return 0;
+}
+__setup("trace_clock=", set_trace_boot_clock);
+
 
 unsigned long long ns2usecs(cycle_t nsec)
 {
@@ -4746,25 +4757,10 @@ static int tracing_clock_show(struct seq_file *m, void 
*v)
return 0;
 }
 
-static ssize_t tracing_clock_write(struct file *filp, const char __user *ubuf,
-  size_t cnt, loff_t *fpos)
+static int tracing_set_clock(struct trace_array *tr, const char *clockstr)
 {
-   struct seq_file *m = filp->private_data;
-   struct trace_array *tr = m->private;
-   char buf[64];
-   const char *clockstr;
int i;
 
-   if (cnt >= sizeof(buf))
-   return -EINVAL;
-
-   if (copy_from_user(&buf, ubuf, cnt))
-   return -EFAULT;
-
-   buf[cnt] = 0;
-
-   clockstr = strstrip(buf);
-
for (i = 0; i < ARRAY_SIZE(trace_clocks); i++) {
if (strcmp(trace_clocks[i].name, clockstr) == 0)
break;
@@ -4792,6 +4788,32 @@ static ssize_t tracing_clock_write(struct file *filp, 
const char __user *ubuf,
 
mutex_unlock(&trace_types_lock);
 
+   return 0;
+}
+
+static ssize_t tracing_clock_write(struct file *filp, const char __user *ubuf,
+  size_t cnt, loff_t *fpos)
+{
+   struct seq_file *m = filp->private_data;
+   struct trace_array *tr = m->private;
+   char buf[64];
+   const char *clockstr;
+   int ret;
+
+   if (cnt >= sizeof(buf))
+   return -EINVAL;
+
+   if (copy_from_user(&buf, ubuf, cnt))
+   return -EFAULT;
+
+   buf[cnt] = 0;
+
+   clockstr = strstrip(buf);
+
+   ret = tracing_set_clock(tr, clockstr);
+   if (ret)
+   return ret;
+
*fpos += cnt;
 
return cnt;
@@ -6574,6 +6596,13 @@ __init static int tracer_alloc_buffers(void)
 
trace_init_cmdlines();
 
+   if (trace_boot_clock) {
+   ret = tracing_set_clock(&global_trace, trace_boot_clock);
+   if (ret < 0)
+   pr_warning("Trace clock %s not defined, going back to 
default\n",
+  trace_boot_clock);
+   }
+
/*
 * register_tracer() might reference current_trace, so it
 * needs to be set before we register anything. This is
-- 
1.8.5.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/


[for-next][PATCH 02/18] tracing: Pass trace_array to flag_changed callback

2014-02-20 Thread Steven Rostedt
From: "Steven Rostedt (Red Hat)" 

As options (flags) may affect instances instead of being global
the flag_changed() callbacks need to receive the trace_array descriptor
of the instance they will be modifying.

Signed-off-by: Steven Rostedt 
---
 kernel/trace/trace.c  | 2 +-
 kernel/trace/trace.h  | 2 +-
 kernel/trace/trace_irqsoff.c  | 4 +++-
 kernel/trace/trace_sched_wakeup.c | 4 +++-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index d7dfc7e..ee8da93 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3393,7 +3393,7 @@ int set_tracer_flag(struct trace_array *tr, unsigned int 
mask, int enabled)
 
/* Give the tracer a chance to approve the change */
if (tr->current_trace->flag_changed)
-   if (tr->current_trace->flag_changed(tr->current_trace, mask, 
!!enabled))
+   if (tr->current_trace->flag_changed(tr, mask, !!enabled))
return -EINVAL;
 
if (enabled)
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 649a23d..36e4473 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -358,7 +358,7 @@ struct tracer {
int (*set_flag)(struct trace_array *tr,
u32 old_flags, u32 bit, int set);
/* Return 0 if OK with change, else return non-zero */
-   int (*flag_changed)(struct tracer *tracer,
+   int (*flag_changed)(struct trace_array *tr,
u32 mask, int set);
struct tracer   *next;
struct tracer_flags *flags;
diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
index fd99b0c..4bf812f 100644
--- a/kernel/trace/trace_irqsoff.c
+++ b/kernel/trace/trace_irqsoff.c
@@ -572,8 +572,10 @@ static void irqsoff_function_set(int set)
unregister_irqsoff_function(is_graph());
 }
 
-static int irqsoff_flag_changed(struct tracer *tracer, u32 mask, int set)
+static int irqsoff_flag_changed(struct trace_array *tr, u32 mask, int set)
 {
+   struct tracer *tracer = tr->current_trace;
+
if (mask & TRACE_ITER_FUNCTION)
irqsoff_function_set(set);
 
diff --git a/kernel/trace/trace_sched_wakeup.c 
b/kernel/trace/trace_sched_wakeup.c
index f0bbdc2..e14da5e 100644
--- a/kernel/trace/trace_sched_wakeup.c
+++ b/kernel/trace/trace_sched_wakeup.c
@@ -179,8 +179,10 @@ static void wakeup_function_set(int set)
unregister_wakeup_function(is_graph());
 }
 
-static int wakeup_flag_changed(struct tracer *tracer, u32 mask, int set)
+static int wakeup_flag_changed(struct trace_array *tr, u32 mask, int set)
 {
+   struct tracer *tracer = tr->current_trace;
+
if (mask & TRACE_ITER_FUNCTION)
wakeup_function_set(set);
 
-- 
1.8.5.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/


[for-next][PATCH 16/18] tracing/uprobes: Support mix of ftrace and perf

2014-02-20 Thread Steven Rostedt
From: Namhyung Kim 

It seems there's no reason to prevent mixed used of ftrace and perf
for a single uprobe event.  At least the kprobes already support it.

Link: 
http://lkml.kernel.org/r/1389946120-19610-6-git-send-email-namhy...@kernel.org

Reviewed-by: Masami Hiramatsu 
Cc: Frederic Weisbecker 
Cc: Ingo Molnar 
Cc: Oleg Nesterov 
Cc: Srikar Dronamraju 
Cc: zhangwei(Jovi) 
Signed-off-by: Namhyung Kim 
Signed-off-by: Steven Rostedt 
---
 kernel/trace/trace_uprobe.c | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 01fcb0d..e447336 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -882,9 +882,6 @@ probe_event_enable(struct trace_uprobe *tu, struct 
ftrace_event_file *file,
int ret;
 
if (file) {
-   if (tu->tp.flags & TP_FLAG_PROFILE)
-   return -EINTR;
-
link = kmalloc(sizeof(*link), GFP_KERNEL);
if (!link)
return -ENOMEM;
@@ -893,12 +890,8 @@ probe_event_enable(struct trace_uprobe *tu, struct 
ftrace_event_file *file,
list_add_tail_rcu(&link->list, &tu->tp.files);
 
tu->tp.flags |= TP_FLAG_TRACE;
-   } else {
-   if (tu->tp.flags & TP_FLAG_TRACE)
-   return -EINTR;
-
+   } else
tu->tp.flags |= TP_FLAG_PROFILE;
-   }
 
ret = uprobe_buffer_enable();
if (ret < 0)
-- 
1.8.5.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/


[for-next][PATCH 10/18] ftrace: Pass in global_ops for use with filtering files

2014-02-20 Thread Steven Rostedt
From: "Steven Rostedt (Red Hat)" 

In preparation for having the function tracing instances be able to
filter on functions, the generic filter functions must first be
converted to take in the global_ops as a parameter.

Signed-off-by: Steven Rostedt 
---
 kernel/trace/ftrace.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 98ae4ed..2b3e239 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2870,7 +2870,9 @@ ftrace_regex_open(struct ftrace_ops *ops, int flag,
 static int
 ftrace_filter_open(struct inode *inode, struct file *file)
 {
-   return ftrace_regex_open(&global_ops,
+   struct ftrace_ops *ops = inode->i_private;
+
+   return ftrace_regex_open(ops,
FTRACE_ITER_FILTER | FTRACE_ITER_DO_HASH,
inode, file);
 }
@@ -2878,7 +2880,9 @@ ftrace_filter_open(struct inode *inode, struct file *file)
 static int
 ftrace_notrace_open(struct inode *inode, struct file *file)
 {
-   return ftrace_regex_open(&global_ops, FTRACE_ITER_NOTRACE,
+   struct ftrace_ops *ops = inode->i_private;
+
+   return ftrace_regex_open(ops, FTRACE_ITER_NOTRACE,
 inode, file);
 }
 
@@ -4118,10 +4122,10 @@ static __init int ftrace_init_dyn_debugfs(struct dentry 
*d_tracer)
d_tracer, NULL, &ftrace_enabled_fops);
 
trace_create_file("set_ftrace_filter", 0644, d_tracer,
-   NULL, &ftrace_filter_fops);
+   &global_ops, &ftrace_filter_fops);
 
trace_create_file("set_ftrace_notrace", 0644, d_tracer,
-   NULL, &ftrace_notrace_fops);
+   &global_ops, &ftrace_notrace_fops);
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
trace_create_file("set_graph_function", 0444, d_tracer,
-- 
1.8.5.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/


[for-next][PATCH 15/18] tracing/uprobes: Support event triggering

2014-02-20 Thread Steven Rostedt
From: Namhyung Kim 

Add support for event triggering to uprobes.  This is same as kprobes
support added by Tom (plus cleanup by Steven).

Link: 
http://lkml.kernel.org/r/1389946120-19610-5-git-send-email-namhy...@kernel.org

Reviewed-by: Masami Hiramatsu 
Cc: Frederic Weisbecker 
Cc: Ingo Molnar 
Cc: Oleg Nesterov 
Cc: Srikar Dronamraju 
Cc: zhangwei(Jovi) 
Cc: Tom Zanussi 
Signed-off-by: Namhyung Kim 
Signed-off-by: Steven Rostedt 
---
 kernel/trace/trace_uprobe.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 349c6df..01fcb0d 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -776,6 +776,9 @@ static void __uprobe_trace_func(struct trace_uprobe *tu,
if (WARN_ON_ONCE(tu->tp.size + dsize > PAGE_SIZE))
return;
 
+   if (ftrace_trigger_soft_disabled(ftrace_file))
+   return;
+
esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu));
size = esize + tu->tp.size + dsize;
event = trace_event_buffer_lock_reserve(&buffer, ftrace_file,
@@ -795,8 +798,7 @@ static void __uprobe_trace_func(struct trace_uprobe *tu,
 
memcpy(data, ucb->buf, tu->tp.size + dsize);
 
-   if (!call_filter_check_discard(call, entry, buffer, event))
-   trace_buffer_unlock_commit(buffer, event, 0, 0);
+   event_trigger_unlock_commit(ftrace_file, buffer, event, entry, 0, 0);
 }
 
 /* uprobe handler */
-- 
1.8.5.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/


[for-next][PATCH 13/18] tracing/uprobes: Move argument fetching to uprobe_dispatcher()

2014-02-20 Thread Steven Rostedt
From: Namhyung Kim 

A single uprobe event might serve different users like ftrace and
perf.  And this is especially important for upcoming multi buffer
support.  But in this case it'll fetch (same) data from userspace
multiple times.  So move it to the beginning of the dispatcher
function and reuse it for each users.

Link: 
http://lkml.kernel.org/r/1389946120-19610-3-git-send-email-namhy...@kernel.org

Reviewed-by: Masami Hiramatsu 
Cc: Frederic Weisbecker 
Cc: Ingo Molnar 
Cc: Oleg Nesterov 
Cc: Srikar Dronamraju 
Cc: zhangwei(Jovi) 
Signed-off-by: Namhyung Kim 
Signed-off-by: Steven Rostedt 
---
 kernel/trace/trace_uprobe.c | 93 +++--
 1 file changed, 56 insertions(+), 37 deletions(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index c5d2612..d83155e 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -759,30 +759,25 @@ static void uprobe_buffer_put(struct uprobe_cpu_buffer 
*ucb)
 }
 
 static void __uprobe_trace_func(struct trace_uprobe *tu,
-   unsigned long func, struct pt_regs *regs)
+   unsigned long func, struct pt_regs *regs,
+   struct uprobe_cpu_buffer *ucb, int dsize)
 {
struct uprobe_trace_entry_head *entry;
struct ring_buffer_event *event;
struct ring_buffer *buffer;
-   struct uprobe_cpu_buffer *ucb;
void *data;
-   int size, dsize, esize;
+   int size, esize;
struct ftrace_event_call *call = &tu->tp.call;
 
-   dsize = __get_data_size(&tu->tp, regs);
-   esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu));
-
-   if (WARN_ON_ONCE(!uprobe_cpu_buffer || tu->tp.size + dsize > PAGE_SIZE))
+   if (WARN_ON_ONCE(tu->tp.size + dsize > PAGE_SIZE))
return;
 
-   ucb = uprobe_buffer_get();
-   store_trace_args(esize, &tu->tp, regs, ucb->buf, dsize);
-
+   esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu));
size = esize + tu->tp.size + dsize;
event = trace_current_buffer_lock_reserve(&buffer, call->event.type,
  size, 0, 0);
if (!event)
-   goto out;
+   return;
 
entry = ring_buffer_event_data(event);
if (is_ret_probe(tu)) {
@@ -798,23 +793,22 @@ static void __uprobe_trace_func(struct trace_uprobe *tu,
 
if (!call_filter_check_discard(call, entry, buffer, event))
trace_buffer_unlock_commit(buffer, event, 0, 0);
-
-out:
-   uprobe_buffer_put(ucb);
 }
 
 /* uprobe handler */
-static int uprobe_trace_func(struct trace_uprobe *tu, struct pt_regs *regs)
+static int uprobe_trace_func(struct trace_uprobe *tu, struct pt_regs *regs,
+struct uprobe_cpu_buffer *ucb, int dsize)
 {
if (!is_ret_probe(tu))
-   __uprobe_trace_func(tu, 0, regs);
+   __uprobe_trace_func(tu, 0, regs, ucb, dsize);
return 0;
 }
 
 static void uretprobe_trace_func(struct trace_uprobe *tu, unsigned long func,
-   struct pt_regs *regs)
+struct pt_regs *regs,
+struct uprobe_cpu_buffer *ucb, int dsize)
 {
-   __uprobe_trace_func(tu, func, regs);
+   __uprobe_trace_func(tu, func, regs, ucb, dsize);
 }
 
 /* Event entry printers */
@@ -1015,30 +1009,23 @@ static bool uprobe_perf_filter(struct uprobe_consumer 
*uc,
 }
 
 static void __uprobe_perf_func(struct trace_uprobe *tu,
-   unsigned long func, struct pt_regs *regs)
+  unsigned long func, struct pt_regs *regs,
+  struct uprobe_cpu_buffer *ucb, int dsize)
 {
struct ftrace_event_call *call = &tu->tp.call;
struct uprobe_trace_entry_head *entry;
struct hlist_head *head;
-   struct uprobe_cpu_buffer *ucb;
void *data;
-   int size, dsize, esize;
+   int size, esize;
int rctx;
 
-   dsize = __get_data_size(&tu->tp, regs);
esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu));
 
-   if (WARN_ON_ONCE(!uprobe_cpu_buffer))
-   return;
-
size = esize + tu->tp.size + dsize;
size = ALIGN(size + sizeof(u32), sizeof(u64)) - sizeof(u32);
if (WARN_ONCE(size > PERF_MAX_TRACE_SIZE, "profile buffer not large 
enough"))
return;
 
-   ucb = uprobe_buffer_get();
-   store_trace_args(esize, &tu->tp, regs, ucb->buf, dsize);
-
preempt_disable();
head = this_cpu_ptr(call->perf_events);
if (hlist_empty(head))
@@ -1068,24 +1055,25 @@ static void __uprobe_perf_func(struct trace_uprobe *tu,
perf_trace_buf_submit(entry, size, rctx, 0, 1, regs, head, NULL);
  out:
preempt_enable();
-   uprobe_buffer_put(ucb);
 }
 
 /* uprobe profile handler */
-static int uprobe_perf_func(struct trace_uprobe *tu, struct pt_regs *regs)
+stat

[for-next][PATCH 03/18] tracing: Set up infrastructure to allow tracers for instances

2014-02-20 Thread Steven Rostedt
From: "Steven Rostedt (Red Hat)" 

Currently the tracers (function, function_graph, irqsoff, etc) can only
be used by the top level tracing directory (not for instances).

This sets up the infrastructure to allow instances to be able to
run a separate tracer apart from the what the top level tracing is
doing.

As tracers need to adapt for being used by instances, the tracers
must flag if they can be used by instances or not. Currently only the
'nop' tracer can be used by all instances.

Signed-off-by: Steven Rostedt 
---
 kernel/trace/trace.c | 72 ++--
 kernel/trace/trace.h |  1 +
 kernel/trace/trace_nop.c |  3 +-
 3 files changed, 60 insertions(+), 16 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index ee8da93..944cd02 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -119,7 +119,7 @@ enum ftrace_dump_mode ftrace_dump_on_oops;
 /* When set, tracing will stop when a WARN*() is hit */
 int __disable_trace_on_warning;
 
-static int tracing_set_tracer(const char *buf);
+static int tracing_set_tracer(struct trace_array *tr, const char *buf);
 
 #define MAX_TRACER_SIZE100
 static char bootup_tracer_buf[MAX_TRACER_SIZE] __initdata;
@@ -1231,7 +1231,7 @@ int register_tracer(struct tracer *type)
 
printk(KERN_INFO "Starting tracer '%s'\n", type->name);
/* Do we want this tracer to start on bootup? */
-   tracing_set_tracer(type->name);
+   tracing_set_tracer(&global_trace, type->name);
default_bootup_tracer = NULL;
/* disable other selftests, since this will break it. */
tracing_selftest_disabled = true;
@@ -3122,27 +3122,52 @@ static int tracing_open(struct inode *inode, struct 
file *file)
return ret;
 }
 
+/*
+ * Some tracers are not suitable for instance buffers.
+ * A tracer is always available for the global array (toplevel)
+ * or if it explicitly states that it is.
+ */
+static bool
+trace_ok_for_array(struct tracer *t, struct trace_array *tr)
+{
+   return (tr->flags & TRACE_ARRAY_FL_GLOBAL) || t->allow_instances;
+}
+
+/* Find the next tracer that this trace array may use */
+static struct tracer *
+get_tracer_for_array(struct trace_array *tr, struct tracer *t)
+{
+   while (t && !trace_ok_for_array(t, tr))
+   t = t->next;
+
+   return t;
+}
+
 static void *
 t_next(struct seq_file *m, void *v, loff_t *pos)
 {
+   struct trace_array *tr = m->private;
struct tracer *t = v;
 
(*pos)++;
 
if (t)
-   t = t->next;
+   t = get_tracer_for_array(tr, t->next);
 
return t;
 }
 
 static void *t_start(struct seq_file *m, loff_t *pos)
 {
+   struct trace_array *tr = m->private;
struct tracer *t;
loff_t l = 0;
 
mutex_lock(&trace_types_lock);
-   for (t = trace_types; t && l < *pos; t = t_next(m, t, &l))
-   ;
+
+   t = get_tracer_for_array(tr, trace_types);
+   for (; t && l < *pos; t = t_next(m, t, &l))
+   ;
 
return t;
 }
@@ -3177,10 +3202,21 @@ static const struct seq_operations show_traces_seq_ops 
= {
 
 static int show_traces_open(struct inode *inode, struct file *file)
 {
+   struct trace_array *tr = inode->i_private;
+   struct seq_file *m;
+   int ret;
+
if (tracing_disabled)
return -ENODEV;
 
-   return seq_open(file, &show_traces_seq_ops);
+   ret = seq_open(file, &show_traces_seq_ops);
+   if (ret)
+   return ret;
+
+   m = file->private_data;
+   m->private = tr;
+
+   return 0;
 }
 
 static ssize_t
@@ -3871,10 +3907,9 @@ create_trace_option_files(struct trace_array *tr, struct 
tracer *tracer);
 static void
 destroy_trace_option_files(struct trace_option_dentry *topts);
 
-static int tracing_set_tracer(const char *buf)
+static int tracing_set_tracer(struct trace_array *tr, const char *buf)
 {
static struct trace_option_dentry *topts;
-   struct trace_array *tr = &global_trace;
struct tracer *t;
 #ifdef CONFIG_TRACER_MAX_TRACE
bool had_max_tr;
@@ -3902,6 +3937,12 @@ static int tracing_set_tracer(const char *buf)
if (t == tr->current_trace)
goto out;
 
+   /* Some tracers are only allowed for the top level buffer */
+   if (!trace_ok_for_array(t, tr)) {
+   ret = -EINVAL;
+   goto out;
+   }
+
trace_branch_disable();
 
tr->current_trace->enabled = false;
@@ -3958,6 +3999,7 @@ static ssize_t
 tracing_set_trace_write(struct file *filp, const char __user *ubuf,
size_t cnt, loff_t *ppos)
 {
+   struct trace_array *tr = filp->private_data;
char buf[MAX_TRACER_SIZE+1];
int i;
size_t ret;
@@ -3977,7 +4019,7 @@ tracing_set_trace_write(struct file *filp, const char 
__user *ubuf,
for (i = cnt - 1; i > 0 && isspace(buf[i]); i--)
buf[i] = 0;
 
- 

[for-next][PATCH 18/18] ftrace: Have static function trace clear ENABLED flag on unregister

2014-02-20 Thread Steven Rostedt
From: "Steven Rostedt (Red Hat)" 

The ENABLED flag needs to be cleared when a ftrace_ops is unregistered
otherwise it wont be able to be registered again.

This is only for static tracing and does not affect DYNAMIC_FTRACE at
all.

Signed-off-by: Steven Rostedt 
---
 kernel/trace/ftrace.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index dcee546..5313c11 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -4463,7 +4463,13 @@ static inline void ftrace_startup_enable(int command) { }
(ops)->flags |= FTRACE_OPS_FL_ENABLED;  \
___ret; \
})
-# define ftrace_shutdown(ops, command) __unregister_ftrace_function(ops)
+# define ftrace_shutdown(ops, command) \
+   ({  \
+   int ___ret = __unregister_ftrace_function(ops); \
+   if (!___ret)\
+   (ops)->flags &= ~FTRACE_OPS_FL_ENABLED; \
+   ___ret; \
+   })
 
 # define ftrace_startup_sysctl()   do { } while (0)
 # define ftrace_shutdown_sysctl()  do { } while (0)
-- 
1.8.5.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/


[for-next][PATCH 00/18] tracing: Function tracing in instances, uprobe triggers and more

2014-02-20 Thread Steven Rostedt

This is the next queue for 3.15. This includes Namhyung's updates to
uprobes for event triggering, allowing function tracing to be done
by trace instances, and also some other updates.

This is based on 3.14-rc3.

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
for-next

Head SHA1: 1fcc155351f183e5044180eeb372a8ff47710855


Namhyung Kim (4):
  tracing/uprobes: Rename uprobe_{trace,perf}_print() functions
  tracing/uprobes: Move argument fetching to uprobe_dispatcher()
  tracing/uprobes: Support event triggering
  tracing/uprobes: Support mix of ftrace and perf

Steven Rostedt (1):
  tracing: Add trace_clock= kernel parameter

Steven Rostedt (Red Hat) (12):
  tracing: Pass trace_array to set_flag callback
  tracing: Pass trace_array to flag_changed callback
  tracing: Set up infrastructure to allow tracers for instances
  tracing: Only let top level have option files
  ftrace: Add private data to ftrace_ops
  ftrace: Copy ops private to global_ops private
  tracing: Disable tracers before deletion of instance
  tracing: Convert tracer->enabled to counter
  ftrace: Allow instances to use function tracing
  ftrace: Pass in global_ops for use with filtering files
  ftrace: Allow for function tracing instance to filter functions
  ftrace: Have static function trace clear ENABLED flag on unregister

zhangwei(Jovi) (1):
  tracing/uprobes: Support ftrace_event_file base multibuffer


 include/linux/ftrace.h   |  14 +++
 kernel/trace/blktrace.c  |   3 +-
 kernel/trace/ftrace.c|  72 +
 kernel/trace/trace.c | 187 +-
 kernel/trace/trace.h |  38 ++-
 kernel/trace/trace_functions.c   | 143 ++
 kernel/trace/trace_functions_graph.c |   3 +-
 kernel/trace/trace_irqsoff.c |  10 +-
 kernel/trace/trace_kprobe.c  |  17 
 kernel/trace/trace_nop.c |   5 +-
 kernel/trace/trace_probe.h   |  17 
 kernel/trace/trace_sched_wakeup.c|  10 +-
 kernel/trace/trace_uprobe.c  | 191 ---
 13 files changed, 519 insertions(+), 191 deletions(-)
--
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/


[for-next][PATCH 14/18] tracing/uprobes: Support ftrace_event_file base multibuffer

2014-02-20 Thread Steven Rostedt
From: "zhangwei(Jovi)" 

Support multi-buffer on uprobe-based dynamic events by
using ftrace_event_file.

This patch is based kprobe-based dynamic events multibuffer
support work initially, commited by Masami(commit 41a7dd420c),
but revised as below:

Oleg changed the kprobe-based multibuffer design from
array-pointers of ftrace_event_file into simple list,
so this patch also change to the list design.

rcu_read_lock/unlock added into uprobe_trace_func/uretprobe_trace_func,
to synchronize with ftrace_event_file list add and delete.

Even though we allow multi-uprobes instances now,
but TP_FLAG_PROFILE/TP_FLAG_TRACE are still mutually exclusive
in probe_event_enable currently, this means we cannot allow
one user is using uprobe-tracer, and another user is using
perf-probe on same uprobe concurrently.
(Perhaps this will be fix in future, kprobe don't have this
limitation now)

Link: 
http://lkml.kernel.org/r/1389946120-19610-4-git-send-email-namhy...@kernel.org

Reviewed-by: Masami Hiramatsu 
Reviewed-by: Oleg Nesterov 
Cc: Ingo Molnar 
Cc: Frederic Weisbecker 
Cc: Srikar Dronamraju 
Signed-off-by: zhangwei(Jovi) 
Signed-off-by: Namhyung Kim 
Signed-off-by: Steven Rostedt 
---
 kernel/trace/trace_kprobe.c |  17 ---
 kernel/trace/trace_probe.h  |  17 +++
 kernel/trace/trace_uprobe.c | 105 +++-
 3 files changed, 101 insertions(+), 38 deletions(-)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index bdbae45..d021d21 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -35,11 +35,6 @@ struct trace_kprobe {
struct trace_probe  tp;
 };
 
-struct event_file_link {
-   struct ftrace_event_file*file;
-   struct list_headlist;
-};
-
 #define SIZEOF_TRACE_KPROBE(n) \
(offsetof(struct trace_kprobe, tp.args) +   \
(sizeof(struct probe_arg) * (n)))
@@ -387,18 +382,6 @@ enable_trace_kprobe(struct trace_kprobe *tk, struct 
ftrace_event_file *file)
return ret;
 }
 
-static struct event_file_link *
-find_event_file_link(struct trace_probe *tp, struct ftrace_event_file *file)
-{
-   struct event_file_link *link;
-
-   list_for_each_entry(link, &tp->files, list)
-   if (link->file == file)
-   return link;
-
-   return NULL;
-}
-
 /*
  * Disable trace_probe
  * if the file is NULL, disable "perf" handler, or disable "trace" handler.
diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
index b73574a..fb1ab5d 100644
--- a/kernel/trace/trace_probe.h
+++ b/kernel/trace/trace_probe.h
@@ -288,6 +288,11 @@ struct trace_probe {
struct probe_argargs[];
 };
 
+struct event_file_link {
+   struct ftrace_event_file*file;
+   struct list_headlist;
+};
+
 static inline bool trace_probe_is_enabled(struct trace_probe *tp)
 {
return !!(tp->flags & (TP_FLAG_TRACE | TP_FLAG_PROFILE));
@@ -316,6 +321,18 @@ static inline int is_good_name(const char *name)
return 1;
 }
 
+static inline struct event_file_link *
+find_event_file_link(struct trace_probe *tp, struct ftrace_event_file *file)
+{
+   struct event_file_link *link;
+
+   list_for_each_entry(link, &tp->files, list)
+   if (link->file == file)
+   return link;
+
+   return NULL;
+}
+
 extern int traceprobe_parse_probe_arg(char *arg, ssize_t *size,
   struct probe_arg *parg, bool is_return, bool is_kprobe);
 
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index d83155e..349c6df 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -260,6 +260,7 @@ alloc_trace_uprobe(const char *group, const char *event, 
int nargs, bool is_ret)
goto error;
 
INIT_LIST_HEAD(&tu->list);
+   INIT_LIST_HEAD(&tu->tp.files);
tu->consumer.handler = uprobe_dispatcher;
if (is_ret)
tu->consumer.ret_handler = uretprobe_dispatcher;
@@ -760,7 +761,8 @@ static void uprobe_buffer_put(struct uprobe_cpu_buffer *ucb)
 
 static void __uprobe_trace_func(struct trace_uprobe *tu,
unsigned long func, struct pt_regs *regs,
-   struct uprobe_cpu_buffer *ucb, int dsize)
+   struct uprobe_cpu_buffer *ucb, int dsize,
+   struct ftrace_event_file *ftrace_file)
 {
struct uprobe_trace_entry_head *entry;
struct ring_buffer_event *event;
@@ -769,13 +771,15 @@ static void __uprobe_trace_func(struct trace_uprobe *tu,
int size, esize;
struct ftrace_event_call *call = &tu->tp.call;
 
+   WARN_ON(call != ftrace_file->event_call);
+
if (WARN_ON_ONCE(tu->tp.size + dsize > PAGE_SIZE))
return;
 
esize = SIZEOF_TRACE_ENTRY(is_ret_probe(tu));
size = esize + tu->tp.size + dsize;
-  

Re: [PATCH v4 2/3] x86, mpx: hook #BR exception handler to allocate bound tables

2014-02-20 Thread Ren Qiaowei

On 02/13/2014 04:19 AM, Andy Lutomirski wrote:

On 02/12/2014 10:36 AM, Qiaowei Ren wrote:

An access to an invalid bound directory entry will cause a #BR
exception. This patch hook #BR exception handler to allocate
one bound table and bind it with that buond directory entry.

This will avoid the need of forwarding the #BR exception
to the user space when bound directory has invalid entry.

Signed-off-by: Qiaowei Ren 
---
+void do_mpx_bt_fault(struct xsave_struct *xsave_buf)
+{
+   unsigned long status;
+   unsigned long bd_entry, bd_base;
+   unsigned long bd_size = 1UL << (MPX_L1_BITS+MPX_L1_SHIFT);
+
+   bd_base = xsave_buf->bndcsr.cfg_reg_u & MPX_BNDCFG_ADDR_MASK;
+   status = xsave_buf->bndcsr.status_reg;
+
+   bd_entry = status & MPX_BNDSTA_ADDR_MASK;
+   if ((bd_entry >= bd_base) && (bd_entry < bd_base + bd_size))
+   allocate_bt(bd_entry);
+}


This still just loops on failure, right?


Seems like that SIGBUS should be raised if the allocation fail.

if (!do_mpx_bt_fault(xsave_buf))
force_sig(SIGBUS, tsk);

Thanks,
Qiaowei

--
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   >