Re: [PATCH] PPC: bpf_jit_comp: add SKF_AD_PKTTYPE instruction

2014-10-29 Thread Denis Kirjanov
Any feedback from PPC folks?

On 10/26/14, Denis Kirjanov  wrote:
> Cc: Matt Evans 
> Signed-off-by: Denis Kirjanov 
> ---
>  arch/powerpc/include/asm/ppc-opcode.h | 1 +
>  arch/powerpc/net/bpf_jit.h| 7 +++
>  arch/powerpc/net/bpf_jit_comp.c   | 5 +
>  3 files changed, 13 insertions(+)
>
> diff --git a/arch/powerpc/include/asm/ppc-opcode.h
> b/arch/powerpc/include/asm/ppc-opcode.h
> index 6f85362..1a52877 100644
> --- a/arch/powerpc/include/asm/ppc-opcode.h
> +++ b/arch/powerpc/include/asm/ppc-opcode.h
> @@ -204,6 +204,7 @@
>  #define PPC_INST_ERATSX_DOT  0x7c000127
>
>  /* Misc instructions for BPF compiler */
> +#define PPC_INST_LBZ 0x8800
>  #define PPC_INST_LD  0xe800
>  #define PPC_INST_LHZ 0xa000
>  #define PPC_INST_LHBRX   0x7c00062c
> diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
> index 9aee27c..c406aa9 100644
> --- a/arch/powerpc/net/bpf_jit.h
> +++ b/arch/powerpc/net/bpf_jit.h
> @@ -87,6 +87,9 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
>  #define PPC_STD(r, base, i)  EMIT(PPC_INST_STD | ___PPC_RS(r) |\
>___PPC_RA(base) | ((i) & 0xfffc))
>
> +
> +#define PPC_LBZ(r, base, i)  EMIT(PPC_INST_LBZ | ___PPC_RT(r) |\
> +  ___PPC_RA(base) | IMM_L(i))
>  #define PPC_LD(r, base, i)   EMIT(PPC_INST_LD | ___PPC_RT(r) | \
>___PPC_RA(base) | IMM_L(i))
>  #define PPC_LWZ(r, base, i)  EMIT(PPC_INST_LWZ | ___PPC_RT(r) |\
> @@ -96,6 +99,10 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
>  #define PPC_LHBRX(r, base, b)EMIT(PPC_INST_LHBRX | ___PPC_RT(r) |
>   \
>___PPC_RA(base) | ___PPC_RB(b))
>  /* Convenience helpers for the above with 'far' offsets: */
> +#define PPC_LBZ_OFFS(r, base, i) do { if ((i) < 32768) PPC_LBZ(r, base, i);
>   \
> + else {  PPC_ADDIS(r, base, IMM_HA(i));\
> + PPC_LBZ(r, r, IMM_L(i)); } } while(0)
> +
>  #define PPC_LD_OFFS(r, base, i) do { if ((i) < 32768) PPC_LD(r, base, i);
>   \
>   else {  PPC_ADDIS(r, base, IMM_HA(i));\
>   PPC_LD(r, r, IMM_L(i)); } } while(0)
> diff --git a/arch/powerpc/net/bpf_jit_comp.c
> b/arch/powerpc/net/bpf_jit_comp.c
> index cbae2df..d110e28 100644
> --- a/arch/powerpc/net/bpf_jit_comp.c
> +++ b/arch/powerpc/net/bpf_jit_comp.c
> @@ -407,6 +407,11 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32
> *image,
>   PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
> queue_mapping));
>   break;
> + case BPF_ANC | SKF_AD_PKTTYPE:
> + PPC_LBZ_OFFS(r_A, r_skb, PKT_TYPE_OFFSET());
> + PPC_ANDI(r_A, r_A, PKT_TYPE_MAX);
> + PPC_SRWI(r_A, r_A, 5);
> + break;
>   case BPF_ANC | SKF_AD_CPU:
>  #ifdef CONFIG_SMP
>   /*
> --
> 2.1.0
>
>
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH] PPC: bpf_jit_comp: add SKF_AD_PKTTYPE instruction

2014-10-26 Thread Denis Kirjanov
Cc: Matt Evans 
Signed-off-by: Denis Kirjanov 
---
 arch/powerpc/include/asm/ppc-opcode.h | 1 +
 arch/powerpc/net/bpf_jit.h| 7 +++
 arch/powerpc/net/bpf_jit_comp.c   | 5 +
 3 files changed, 13 insertions(+)

diff --git a/arch/powerpc/include/asm/ppc-opcode.h 
b/arch/powerpc/include/asm/ppc-opcode.h
index 6f85362..1a52877 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -204,6 +204,7 @@
 #define PPC_INST_ERATSX_DOT0x7c000127
 
 /* Misc instructions for BPF compiler */
+#define PPC_INST_LBZ   0x8800
 #define PPC_INST_LD0xe800
 #define PPC_INST_LHZ   0xa000
 #define PPC_INST_LHBRX 0x7c00062c
diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
index 9aee27c..c406aa9 100644
--- a/arch/powerpc/net/bpf_jit.h
+++ b/arch/powerpc/net/bpf_jit.h
@@ -87,6 +87,9 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
 #define PPC_STD(r, base, i)EMIT(PPC_INST_STD | ___PPC_RS(r) |\
 ___PPC_RA(base) | ((i) & 0xfffc))
 
+
+#define PPC_LBZ(r, base, i)EMIT(PPC_INST_LBZ | ___PPC_RT(r) |\
+___PPC_RA(base) | IMM_L(i))
 #define PPC_LD(r, base, i) EMIT(PPC_INST_LD | ___PPC_RT(r) | \
 ___PPC_RA(base) | IMM_L(i))
 #define PPC_LWZ(r, base, i)EMIT(PPC_INST_LWZ | ___PPC_RT(r) |\
@@ -96,6 +99,10 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
 #define PPC_LHBRX(r, base, b)  EMIT(PPC_INST_LHBRX | ___PPC_RT(r) |  \
 ___PPC_RA(base) | ___PPC_RB(b))
 /* Convenience helpers for the above with 'far' offsets: */
+#define PPC_LBZ_OFFS(r, base, i) do { if ((i) < 32768) PPC_LBZ(r, base, i);   \
+   else {  PPC_ADDIS(r, base, IMM_HA(i));\
+   PPC_LBZ(r, r, IMM_L(i)); } } while(0)
+
 #define PPC_LD_OFFS(r, base, i) do { if ((i) < 32768) PPC_LD(r, base, i); \
else {  PPC_ADDIS(r, base, IMM_HA(i));\
PPC_LD(r, r, IMM_L(i)); } } while(0)
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index cbae2df..d110e28 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -407,6 +407,11 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 
*image,
PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
  queue_mapping));
break;
+   case BPF_ANC | SKF_AD_PKTTYPE:
+   PPC_LBZ_OFFS(r_A, r_skb, PKT_TYPE_OFFSET());
+   PPC_ANDI(r_A, r_A, PKT_TYPE_MAX);
+   PPC_SRWI(r_A, r_A, 5);
+   break;
case BPF_ANC | SKF_AD_CPU:
 #ifdef CONFIG_SMP
/*
-- 
2.1.0

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: powerpc: Wire up sys_bpf() syscall

2014-10-20 Thread Denis Kirjanov
I don't see any problems with it

On 10/21/14, Michael Ellerman  wrote:
> On Tue, 2014-10-21 at 08:52 +0400, Denis Kirjanov wrote:
>> We have a test suite under samples/bpf/
>
> Thanks.
>
> I looked under tools/testing/selftests, could it move in there?
>
> cheers
>
>
>


-- 
Regards,
Denis
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: powerpc: Wire up sys_bpf() syscall

2014-10-20 Thread Denis Kirjanov
I don't see any problems with it

On 10/21/14, Michael Ellerman  wrote:
> On Tue, 2014-10-21 at 08:52 +0400, Denis Kirjanov wrote:
>> We have a test suite under samples/bpf/
>
> Thanks.
>
> I looked under tools/testing/selftests, could it move in there?
>
> cheers
>
>
>


-- 
Regards,
Denis
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: powerpc: Wire up sys_bpf() syscall

2014-10-20 Thread Denis Kirjanov
We have a test suite under samples/bpf/


On 10/21/14, Michael Ellerman  wrote:
> On Fri, 2014-10-10 at 05:53:45 UTC, Pranith Kumar wrote:
>> This patch wires up the new syscall sys_bpf() on powerpc.
>
> Is there a test suite we can run to verify it works?
>
> cheers
> ___
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev


-- 
Regards,
Denis
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH] powerpc : dma-mapping : Check null condition for dev->archdata.dma_ops

2014-07-18 Thread Denis Kirjanov
On 7/18/14, Nikhil Badola  wrote:
> Modifies get_dma_ops() implementation on ppc arch to check null condition
 which means that dma is not supported.

Could you please describe the use case where the ops is null.

> for dev->archdata.dma_ops; returns common dma_direct_ops structure in
> case its NULL
>
> Signed-off-by: Nikhil Badola 
> ---
>  arch/powerpc/include/asm/dma-mapping.h | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/dma-mapping.h
> b/arch/powerpc/include/asm/dma-mapping.h
> index 150866b..d73bae8 100644
> --- a/arch/powerpc/include/asm/dma-mapping.h
> +++ b/arch/powerpc/include/asm/dma-mapping.h
> @@ -86,10 +86,12 @@ static inline struct dma_map_ops *get_dma_ops(struct
> device *dev)
>*/
>   if (unlikely(dev == NULL))
>   return NULL;
> -
> - return dev->archdata.dma_ops;
> + if (dev->archdata.dma_ops)
> + return dev->archdata.dma_ops;
> + return &dma_direct_ops;
>  }
>
> +
>  static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
>  {
>   dev->archdata.dma_ops = ops;
> --
> 1.7.11.7
>
> ___
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev


-- 
Regards,
Denis
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v2 2/2] powerpc: bpf: Fix the broken LD_VLAN_TAG_PRESENT test

2014-06-26 Thread Denis Kirjanov
On 6/26/14, Michael Ellerman  wrote:
> On Wed, 2014-06-25 at 21:34 +0400, Denis Kirjanov wrote:
>> We have to return the boolean here if the tag presents
>> or not, not just ANDing the TCI with the mask which results to:
>>
>> [  709.412097] test_bpf: #18 LD_VLAN_TAG_PRESENT
>> [  709.412245] ret 4096 != 1
>> [  709.412332] ret 4096 != 1
>> [  709.412333] FAIL (2 times)
>
> Hi Denis,
>
> Is this the same version of test_bpf that is in Linus' tree?

You didn't enable the JIT.
> I don't see any fails with that version, am I missing something?
>
>   [  187.690640] test_bpf: #18 LD_VLAN_TAG_PRESENT 46 50 PASS
>
> cheers
>
>
>
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH v2 2/2] powerpc: bpf: Fix the broken LD_VLAN_TAG_PRESENT test

2014-06-25 Thread Denis Kirjanov
We have to return the boolean here if the tag presents
or not, not just ANDing the TCI with the mask which results to:

[  709.412097] test_bpf: #18 LD_VLAN_TAG_PRESENT
[  709.412245] ret 4096 != 1
[  709.412332] ret 4096 != 1
[  709.412333] FAIL (2 times)

Signed-off-by: Denis Kirjanov 
---
 arch/powerpc/net/bpf_jit_comp.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index 892167b..82e82ca 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -394,10 +394,12 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 
*image,
 
PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
  vlan_tci));
-   if (code == (BPF_ANC | SKF_AD_VLAN_TAG))
+   if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) {
PPC_ANDI(r_A, r_A, ~VLAN_TAG_PRESENT);
-   else
+   } else {
PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT);
+   PPC_SRWI(r_A, r_A, 12);
+   }
break;
case BPF_ANC | SKF_AD_QUEUE:
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
-- 
2.0.0

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH v2 1/2] powerpc: bpf: Use correct mask while accessing the VLAN tag

2014-06-25 Thread Denis Kirjanov
To get a full tag (and not just a VID) we should access the TCI
except the VLAN_TAG_PRESENT field (which means that 802.1q header
is present). Also ensure that the VLAN_TAG_PRESENT stay on its place

Signed-off-by: Denis Kirjanov 
---
 arch/powerpc/net/bpf_jit_comp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index 6dcdade..892167b 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -390,10 +390,12 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 
*image,
case BPF_ANC | SKF_AD_VLAN_TAG:
case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 
2);
+   BUILD_BUG_ON(VLAN_TAG_PRESENT != 0x1000);
+
PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
  vlan_tci));
if (code == (BPF_ANC | SKF_AD_VLAN_TAG))
-   PPC_ANDI(r_A, r_A, VLAN_VID_MASK);
+   PPC_ANDI(r_A, r_A, ~VLAN_TAG_PRESENT);
else
PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT);
break;
-- 
2.0.0

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 2/2] powerpc: bpf: Fix the broken LD_VLAN_TAG_PRESENT test

2014-06-24 Thread Denis Kirjanov
On 6/24/14, Sergei Shtylyov  wrote:
> Hello.
>
> On 06/24/2014 01:59 PM, Denis Kirjanov wrote:
>
>> We have to return the boolean here if the tag presents
>> or not, not jusr ORing the TCI with the mask which results to:
>
>> [  709.412097] test_bpf: #18 LD_VLAN_TAG_PRESENT
>> [  709.412245] ret 4096 != 1
>> [  709.412332] ret 4096 != 1
>> [  709.412333] FAIL (2 times)
>
> You need to sign off on the patch, else it won't be applied.

Oh, right. Moreover I've made a mistake in the description (we're ANDing)

Thanks!

>> ---
>>   arch/powerpc/net/bpf_jit_comp.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>
>> diff --git a/arch/powerpc/net/bpf_jit_comp.c
>> b/arch/powerpc/net/bpf_jit_comp.c
>> index af0ed4d..a3d8f58 100644
>> --- a/arch/powerpc/net/bpf_jit_comp.c
>> +++ b/arch/powerpc/net/bpf_jit_comp.c
>> @@ -394,8 +394,10 @@ static int bpf_jit_build_body(struct sk_filter *fp,
>> u32 *image,
>>vlan_tci));
>>  if (code == (BPF_ANC | SKF_AD_VLAN_TAG))
>>  PPC_ANDI(r_A, r_A, ~VLAN_TAG_PRESENT);
>> -else
>> +else {
>
> All arms of the *if* statement should have {} if one branch has {}.
>
>>  PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT);
>> +PPC_SRWI(r_A, r_A, 12);
>> +}
>>  break;
>>  case BPF_ANC | SKF_AD_QUEUE:
>>  BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
>
> WBR, Sergei
>
>
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 2/2] powerpc: bpf: Fix the broken LD_VLAN_TAG_PRESENT test

2014-06-24 Thread Denis Kirjanov
We have to return the boolean here if the tag presents
or not, not jusr ORing the TCI with the mask which results to:

[  709.412097] test_bpf: #18 LD_VLAN_TAG_PRESENT
[  709.412245] ret 4096 != 1
[  709.412332] ret 4096 != 1
[  709.412333] FAIL (2 times)
---
 arch/powerpc/net/bpf_jit_comp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index af0ed4d..a3d8f58 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -394,8 +394,10 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 
*image,
  vlan_tci));
if (code == (BPF_ANC | SKF_AD_VLAN_TAG))
PPC_ANDI(r_A, r_A, ~VLAN_TAG_PRESENT);
-   else
+   else {
PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT);
+   PPC_SRWI(r_A, r_A, 12);
+   }
break;
case BPF_ANC | SKF_AD_QUEUE:
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
-- 
2.0.0

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 1/2] powerpc: bpf: Use correct mask while accessing the VLAN tag

2014-06-24 Thread Denis Kirjanov
Use the proper mask which is 0xefff
---
 arch/powerpc/net/bpf_jit_comp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index 6dcdade..af0ed4d 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -393,7 +393,7 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 
*image,
PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
  vlan_tci));
if (code == (BPF_ANC | SKF_AD_VLAN_TAG))
-   PPC_ANDI(r_A, r_A, VLAN_VID_MASK);
+   PPC_ANDI(r_A, r_A, ~VLAN_TAG_PRESENT);
else
PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT);
break;
-- 
2.0.0

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: kmemleak: Unable to handle kernel paging request

2014-06-13 Thread Denis Kirjanov
On 6/13/14, Catalin Marinas  wrote:
> On Fri, Jun 13, 2014 at 08:12:08AM +0100, Denis Kirjanov wrote:
>> On 6/12/14, Catalin Marinas  wrote:
>> > On Thu, Jun 12, 2014 at 01:00:57PM +0100, Denis Kirjanov wrote:
>> >> On 6/12/14, Denis Kirjanov  wrote:
>> >> > On 6/12/14, Catalin Marinas  wrote:
>> >> >> On 11 Jun 2014, at 21:04, Denis Kirjanov 
>> >> >> wrote:
>> >> >>> On 6/11/14, Catalin Marinas  wrote:
>> >> >>>> On Wed, Jun 11, 2014 at 04:13:07PM +0400, Denis Kirjanov wrote:
>> >> >>>>> I got a trace while running 3.15.0-08556-gdfb9454:
>> >> >>>>>
>> >> >>>>> [  104.534026] Unable to handle kernel paging request for data
>> >> >>>>> at
>> >> >>>>> address 0xc0007f00
>> >> >>>>
>> >> >>>> Were there any kmemleak messages prior to this, like "kmemleak
>> >> >>>> disabled"? There could be a race when kmemleak is disabled
>> >> >>>> because
>> >> >>>> of
>> >> >>>> some fatal (for kmemleak) error while the scanning is taking
>> >> >>>> place
>> >> >>>> (which needs some more thinking to fix properly).
>> >> >>>
>> >> >>> No. I checked for the similar problem and didn't find anything
>> >> >>> relevant.
>> >> >>> I'll try to bisect it.
>> >> >>
>> >> >> Does this happen soon after boot? I guess it’s the first scan
>> >> >> (scheduled at around 1min after boot). Something seems to be
>> >> >> telling
>> >> >> kmemleak that there is a valid memory block at 0xc0007f00.
>> >> >
>> >> > Yeah, it happens after a while with a booted system so that's the
>> >> > first kmemleak scan.
>> >>
>> >> I've bisected to this commit: d4c54919ed86302094c0ca7d48a8cbd4ee753e92
>> >> "mm: add !pte_present() check on existing hugetlb_entry callbacks".
>> >> Reverting the commit fixes the issue
>> >
>> > I can't figure how this causes the problem but I have more questions.
>> > Is
>> > 0xc0007f00 address always the same in all crashes? If yes, you
>> > could comment out start_scan_thread() in kmemleak_late_init() to avoid
>> > the scanning thread starting. Once booted, you can run:
>> >
>> >   echo dump=0xc0007f00 > /sys/kernel/debug/kmemleak
>> >
>> > and check the dmesg for what kmemleak knows about that address, when it
>> > was allocated and whether it should be mapped or not.
>>
>> The address is always the same.
>>
>> [  179.466239] kmemleak: Object 0xc0007f00 (size 16777216):
>> [  179.466503] kmemleak:   comm "swapper/0", pid 0, jiffies 4294892300
>> [  179.466508] kmemleak:   min_count = 0
>> [  179.466512] kmemleak:   count = 0
>> [  179.466517] kmemleak:   flags = 0x1
>> [  179.466522] kmemleak:   checksum = 0
>> [  179.466526] kmemleak:   backtrace:
>> [  179.466531]  []
>> .memblock_alloc_range_nid+0x68/0x88
>> [  179.466544]  [] .memblock_alloc_base+0x20/0x58
>> [  179.466553]  [] .alloc_dart_table+0x5c/0xb0
>> [  179.466561]  [] .pmac_probe+0x38/0xa0
>> [  179.466569]  [<0002166c>] 0x2166c
>> [  179.466579]  [<00ae0e68>] 0xae0e68
>> [  179.466587]  [<9bc4>] 0x9bc4
>
> OK, so that's the DART table allocated via alloc_dart_table(). Is
> dart_tablebase removed from the kernel linear mapping after allocation?
> If that's the case, we need to tell kmemleak to ignore this block (see
> patch below, untested). But I still can't explain how commit
> d4c54919ed863020 causes this issue.
>
> (also cc'ing the powerpc list and maintainers)

Ok, your path fixes the oops.

Ben, can you shed some light on this issue?

Thanks!
> ---8<--
>
> From 09a7f1c97166c7bdca7ca4e8a4ff2774f3706ea3 Mon Sep 17 00:00:00 2001
> From: Catalin Marinas 
> Date: Fri, 13 Jun 2014 09:44:21 +0100
> Subject: [PATCH] powerpc/kmemleak: Do not scan the DART table
>
> The DART table allocation is registered to kmemleak via the
> memblock_alloc_base() call. However, the DART table is later unmapped
> and dart_tablebase VA no longer accessible. This patch tells kmemleak
&g

Re: Critical Interrupt Input

2013-08-19 Thread Denis Kirjanov
The easy thing is to start to experimenting with scratch/preserve registers :)

On 8/20/13, Benjamin Herrenschmidt  wrote:
> On Mon, 2013-08-19 at 12:00 -0700, Henry Bausley wrote:
>>
>> Support does appear to be present but there is a problem returning
>> back to user space I suspect.
>
> Probably a problem with TLB misses vs. crit interrupts.
>
> A critical interrupt can re-enter a TLB miss.
>
> I can see two potential issues there:
>
>  - A bug where we don't properly restore "something" (I thought we did
> save and restore MMUCR though, but that's worth dbl checking if it works
> properly) accross the crit entry/exit
>
>  - Something in your crit code causing a TLB miss (the
> kernel .text/.data/.bss should be bolted but anything else can). We
> don't currently support re-entering the TLB miss that way.
>
> If we were to support the latter, we'd need to detect on entering a crit
> that the PC is within the TLB miss handler, and setup a return context
> to the original instruction (replay the miss) rather than trying to
> resume it..
>
> Cheers,
> Ben.
>
>> What fails is it causes Linux user space programs to get Segmentation
>> errors.
>> Issuing a simple ls causes a segmentation fault sometimes.  The shell
>> gets terminated
>> and you cannot log back in.  INIT: Id "T0" respawning too fast:
>> disabled for 5 minutes pops up.
>>
>> However, the critical interrupt handler keeps running.  I know this by
>> adding the reading
>> of a physical I/O location in the handler and can see it is being read
>> on the scope.
>>
>>
>> The only code in the handler is below.
>>
>> void critintr_handler(void *dev)
>> {
>>   critintrcount++;  // increment a variable
>>   iodata = *piom;   // read an I/O location
>>   mtdcr(0x0c0, 0x2000); // clear critical interrupt
>> }
>>
>>
>> Below is a log of the type of crashes that occur:
>>
>> root@10.34.9.213:/opt/ppmac/ktest# ls
>> Segmentation fault
>> root@10.34.9.213:/opt/ppmac/ktest# ls
>> Segmentation fault
>> root@10.34.9.213:/opt/ppmac/ktest# ls
>> Makefilektest.cktest.ko ktest.mod.o  modules.order
>> Module.symvers  ktest.cbp  ktest.mod.c  ktest.o
>> root@10.34.9.213:/opt/ppmac/ktest# ls
>>
>> Debian GNU/Linux 7 powerpmac ttyS0
>>
>> powerpmac login: root
>>
>> Debian GNU/Linux 7 powerpmac ttyS0
>>
>> powerpmac login: root
>>
>> Debian GNU/Linux 7 powerpmac ttyS0
>>
>> powerpmac login: root
>>
>> Debian GNU/Linux 7 powerpmac ttyS0
>>
>> powerpmac login: root
>> Password:
>> Last login: Thu Nov 30 20:42:16 UTC 1933 on ttyS0
>> Linux powerpmac 3.2.21-aspen_2.01.09 #10 Mon Aug 19 08:49:12 PDT 2013
>> ppc
>>
>> The programs included with the Debian GNU/Linux system are free
>> software;
>> the exact distribution terms for each program are described in the
>> individual files in /usr/share/doc/*/copyright.
>>
>> Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
>> permitted by applicable law.
>> INIT: Id "T0" respawning too fast: disabled for 5 minutes
>>
>>
>> __
>> From: "Benjamin Herrenschmidt" 
>> Sent: Saturday, August 17, 2013 3:05 PM
>> To: "Kumar Gala" 
>> Cc: linuxppc-dev@lists.ozlabs.org, hbaus...@deltatau.com
>> Subject: Re: Critical Interrupt Input
>>
>> On Fri, 2013-08-16 at 06:04 -0500, Kumar Gala wrote:
>> > The 44x low level code needs to handle exception stacks properly for
>> > this to work. Since its possible to have a critical exception occur
>> > while in a normal exception level, you have to have proper saving of
>> > additional register state and a stack frame for the critical
>> > exception, etc. I'm not sure if that was ever done for 44x.
>>
>> Don't 44x and FSL BookE share the same macros ? I would think 44x does
>> indeed implement the same crit support as e500...
>>
>> What does the crash look like ?
>>
>> Ben.
>>
>>
>> ___
>> Linuxppc-dev mailing list
>> Linuxppc-dev@lists.ozlabs.org
>> https://lists.ozlabs.org/listinfo/linuxppc-dev
>>
>>
>>   ­­
>
>
> ___
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev


-- 
Regards,
Denis
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH v2] Fix a typo in pSeries_lpar_hpte_insert()

2013-07-23 Thread Denis Kirjanov
Commit 801eb73f45371accc78ca9d6d22d647eeb722c11 introduced
a bug while checking PTE flags. We have to drop the _PAGE_COHERENT flag
when __PAGE_NO_CACHE is set and the cache update policy is not write-through
(i.e. _PAGE_WRITETHRU is not set)

Signed-off-by: Denis Kirjanov 
Reviewed-by: Aneesh Kumar K.V 
CC:  Michael Ellerman 
---
v1->v2:
- Updated commit log
---
 arch/powerpc/platforms/pseries/lpar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/lpar.c 
b/arch/powerpc/platforms/pseries/lpar.c
index 02d6e21..8bad880 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -146,7 +146,7 @@ static long pSeries_lpar_hpte_insert(unsigned long 
hpte_group,
flags = 0;
 
/* Make pHyp happy */
-   if ((rflags & _PAGE_NO_CACHE) & !(rflags & _PAGE_WRITETHRU))
+   if ((rflags & _PAGE_NO_CACHE) && !(rflags & _PAGE_WRITETHRU))
hpte_r &= ~_PAGE_COHERENT;
if (firmware_has_feature(FW_FEATURE_XCMO) && !(hpte_r & HPTE_R_N))
flags |= H_COALESCE_CAND;
-- 
1.8.0.2

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] Fix a typo in pSeries_lpar_hpte_insert()

2013-07-22 Thread Denis Kirjanov
Fix a typo in pSeries_lpar_hpte_insert()

Signed-off-by: Denis Kirjanov 
---
 arch/powerpc/platforms/pseries/lpar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/lpar.c 
b/arch/powerpc/platforms/pseries/lpar.c
index 0da39fe..c4112ed 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -136,7 +136,7 @@ static long pSeries_lpar_hpte_insert(unsigned long 
hpte_group,
flags = 0;
 
/* Make pHyp happy */
-   if ((rflags & _PAGE_NO_CACHE) & !(rflags & _PAGE_WRITETHRU))
+   if ((rflags & _PAGE_NO_CACHE) && !(rflags & _PAGE_WRITETHRU))
hpte_r &= ~_PAGE_COHERENT;
if (firmware_has_feature(FW_FEATURE_XCMO) && !(hpte_r & HPTE_R_N))
flags |= H_COALESCE_CAND;
-- 
1.8.0.2

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: Linux kernel 3.x problems on PowerMac G5

2013-03-03 Thread Denis Kirjanov
I'm running 3.7.6 without any problems on my quad core machine. You
have to try to compile with g5_defconfig...

On 3/3/13, Benjamin Herrenschmidt  wrote:
> On Sat, 2013-03-02 at 17:22 +0100, Andreas Schwab wrote:
>> > Thanks. Then i configured something wrongly probably.
>> > I tried Linux 2.6.39.4 and it boots too.
>> > I looked around on the Internet and it seems i'm not the only one
>> > who has problems with Linux 3.x on my PowerMac G5.
>>
>> I have no problem with 3.8 either, but mine is a PowerMac7,3.
>
> Ok. I have a quad core G5 which is also a 11,2, it's even my primary
> workstation in the office :-) So it tends to work fine but I admit I
> haven't updated the kernel on it in a while.
>
> Phileas, send me the .config you're using, there might be an issue
> there, I'll do some tests next week.
>
> Cheers,
> Ben.
>
>
> ___
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>


-- 
Regards,
Denis
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH powerpc] Fix MAX_STACK_TRACE_ENTRIES too low warning for ppc32

2012-12-03 Thread Denis Kirjanov
Could you please provide a more verbose patch description

Thanks.

On 12/3/12, Li Zhong  wrote:
> This patch fixes MAX_STACK_TRACE_ENTRIES too low warning for ppc32,
> which is similar to commit 12660b17.
>
> Reported-by: Christian Kujau 
> Signed-off-by: Li Zhong 
> Tested-by: Christian Kujau 
> ---
>  arch/powerpc/kernel/entry_32.S |2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/powerpc/kernel/entry_32.S
> b/arch/powerpc/kernel/entry_32.S
> index d22e73e..e514de5 100644
> --- a/arch/powerpc/kernel/entry_32.S
> +++ b/arch/powerpc/kernel/entry_32.S
> @@ -439,6 +439,8 @@ ret_from_fork:
>  ret_from_kernel_thread:
>   REST_NVGPRS(r1)
>   bl  schedule_tail
> + li  r3,0
> + stw r3,0(r1)
>   mtlrr14
>   mr  r3,r15
>   PPC440EP_ERR42
> --
> 1.7.9.5
>
> ___
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>


-- 
Regards,
Denis
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] Use is_32bit_task() helper to test 32-bit binary

2010-08-27 Thread Denis Kirjanov
This patch removes all explicit tests for the TIF_32BIT flag

Signed-off-by: Denis Kirjanov 
---
 arch/powerpc/include/asm/compat.h|4 ++--
 arch/powerpc/include/asm/elf.h   |2 +-
 arch/powerpc/include/asm/page_64.h   |4 ++--
 arch/powerpc/include/asm/processor.h |4 ++--
 arch/powerpc/kernel/ptrace.c |2 +-
 arch/powerpc/kernel/vdso.c   |6 +++---
 arch/powerpc/oprofile/backtrace.c|2 +-
 7 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/include/asm/compat.h 
b/arch/powerpc/include/asm/compat.h
index 396d21a..3369e2c 100644
--- a/arch/powerpc/include/asm/compat.h
+++ b/arch/powerpc/include/asm/compat.h
@@ -143,7 +143,7 @@ static inline void __user *compat_alloc_user_space(long len)
 * We cant access below the stack pointer in the 32bit ABI and
 * can access 288 bytes in the 64bit ABI
 */
-   if (!(test_thread_flag(TIF_32BIT)))
+   if (!is_32bit_task())
usp -= 288;
 
return (void __user *) (usp - len);
@@ -213,7 +213,7 @@ struct compat_shmid64_ds {
 
 static inline int is_compat_task(void)
 {
-   return test_thread_flag(TIF_32BIT);
+   return is_32bit_task();
 }
 
 #endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index c376eda..2b917c6 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -250,7 +250,7 @@ do {
\
  * the 64bit ABI has never had these issues dont enable the workaround
  * even if we have an executable stack.
  */
-# define elf_read_implies_exec(ex, exec_stk) (test_thread_flag(TIF_32BIT) ? \
+# define elf_read_implies_exec(ex, exec_stk) (is_32bit_task() ? \
(exec_stk == EXSTACK_DEFAULT) : 0)
 #else 
 # define SET_PERSONALITY(ex) \
diff --git a/arch/powerpc/include/asm/page_64.h 
b/arch/powerpc/include/asm/page_64.h
index 358ff14..932f88d 100644
--- a/arch/powerpc/include/asm/page_64.h
+++ b/arch/powerpc/include/asm/page_64.h
@@ -163,7 +163,7 @@ do {\
 #endif /* !CONFIG_HUGETLB_PAGE */
 
 #define VM_DATA_DEFAULT_FLAGS \
-   (test_thread_flag(TIF_32BIT) ? \
+   (is_32bit_task() ? \
 VM_DATA_DEFAULT_FLAGS32 : VM_DATA_DEFAULT_FLAGS64)
 
 /*
@@ -179,7 +179,7 @@ do {\
 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
 #define VM_STACK_DEFAULT_FLAGS \
-   (test_thread_flag(TIF_32BIT) ? \
+   (is_32bit_task() ? \
 VM_STACK_DEFAULT_FLAGS32 : VM_STACK_DEFAULT_FLAGS64)
 
 #include 
diff --git a/arch/powerpc/include/asm/processor.h 
b/arch/powerpc/include/asm/processor.h
index 19c05b0..4c14187 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -118,7 +118,7 @@ extern struct task_struct *last_task_used_spe;
 #define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4))
 #define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(TASK_SIZE_USER64 / 4))
 
-#define TASK_UNMAPPED_BASE ((test_thread_flag(TIF_32BIT)) ? \
+#define TASK_UNMAPPED_BASE ((is_32bit_task()) ? \
TASK_UNMAPPED_BASE_USER32 : TASK_UNMAPPED_BASE_USER64 )
 #endif
 
@@ -128,7 +128,7 @@ extern struct task_struct *last_task_used_spe;
 #define STACK_TOP_USER64 TASK_SIZE_USER64
 #define STACK_TOP_USER32 TASK_SIZE_USER32
 
-#define STACK_TOP (test_thread_flag(TIF_32BIT) ? \
+#define STACK_TOP (is_32bit_task() ? \
   STACK_TOP_USER32 : STACK_TOP_USER64)
 
 #define STACK_TOP_MAX STACK_TOP_USER64
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 11f3cd9..286d978 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -1681,7 +1681,7 @@ long do_syscall_trace_enter(struct pt_regs *regs)
 
if (unlikely(current->audit_context)) {
 #ifdef CONFIG_PPC64
-   if (!test_thread_flag(TIF_32BIT))
+   if (!is_32bit_task())
audit_syscall_entry(AUDIT_ARCH_PPC64,
regs->gpr[0],
regs->gpr[3], regs->gpr[4],
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 13002fe..fd87287 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -159,7 +159,7 @@ static void dump_vdso_pages(struct vm_area_struct * vma)
 {
int i;
 
-   if (!vma || test_thread_flag(TIF_32BIT)) {
+   if (!vma || is_32bit_task()) {
printk("vDSO32 @ %016lx:\n", (unsigned long)vdso32_kbase);
for (i=0; ihttps://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] Use is_32bit_task() helper to test 32 bit binary

2010-07-30 Thread Denis Kirjanov
Use is_32bit_task() helper to test 32 bit binary.

Signed-off-by: Denis Kirjanov 
---
 arch/powerpc/kernel/process.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 43855c9..e7dffbf 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -692,7 +692,7 @@ int copy_thread(unsigned long clone_flags, unsigned long 
usp,
p->thread.regs = childregs;
if (clone_flags & CLONE_SETTLS) {
 #ifdef CONFIG_PPC64
-   if (!test_thread_flag(TIF_32BIT))
+   if (!is_32bit_task())
childregs->gpr[13] = childregs->gpr[6];
else
 #endif
@@ -787,7 +787,7 @@ void start_thread(struct pt_regs *regs, unsigned long 
start, unsigned long sp)
regs->nip = start;
regs->msr = MSR_USER;
 #else
-   if (!test_thread_flag(TIF_32BIT)) {
+   if (!is_32bit_task()) {
unsigned long entry, toc;
 
/* start is a relocated pointer to the function descriptor for
@@ -959,7 +959,7 @@ int sys_clone(unsigned long clone_flags, unsigned long usp,
if (usp == 0)
usp = regs->gpr[1]; /* stack pointer for child */
 #ifdef CONFIG_PPC64
-   if (test_thread_flag(TIF_32BIT)) {
+   if (is_32bit_task()) {
parent_tidp = TRUNC_PTR(parent_tidp);
child_tidp = TRUNC_PTR(child_tidp);
}
-- 
1.6.4.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] kvm/ppc: fix build warning

2010-06-25 Thread Denis Kirjanov

On 06/25/2010 01:02 PM, Denis Kirjanov wrote:

On 06/25/2010 12:42 AM, Alexander Graf wrote:


On 24.06.2010, at 21:44, Denis Kirjanov wrote:


Fix build warning:
arch/powerpc/kvm/book3s_64_mmu.c: In function
'kvmppc_mmu_book3s_64_esid_to_vsid':
arch/powerpc/kvm/book3s_64_mmu.c:446: warning: 'slb' may be used
uninitialized in this function
Signed-off-by: Denis Kirjanov


Are you sure this isn't a broken compiler? I don't see where it could
be used uninitialized.


I'm using gcc version 4.3.4 (Gentoo 4.3.4 p1.1, pie-10.1.5)
slb pointer initialized inside conditional branch
and used later in the case case MSR_DR|MSR_IR


This is based on linux-next tree (-next-20100623)
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] kvm/ppc: fix build warning

2010-06-25 Thread Denis Kirjanov

On 06/25/2010 12:42 AM, Alexander Graf wrote:


On 24.06.2010, at 21:44, Denis Kirjanov wrote:


Fix build warning:
arch/powerpc/kvm/book3s_64_mmu.c: In function 
'kvmppc_mmu_book3s_64_esid_to_vsid':
arch/powerpc/kvm/book3s_64_mmu.c:446: warning: 'slb' may be used uninitialized 
in this function
Signed-off-by: Denis Kirjanov


Are you sure this isn't a broken compiler? I don't see where it could be used 
uninitialized.


I'm using gcc version 4.3.4 (Gentoo 4.3.4 p1.1, pie-10.1.5)
slb pointer initialized inside conditional branch
and used later in the case case MSR_DR|MSR_IR

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] kvm/ppc: fix build warning

2010-06-24 Thread Denis Kirjanov
Fix build warning:
arch/powerpc/kvm/book3s_64_mmu.c: In function 
'kvmppc_mmu_book3s_64_esid_to_vsid':
arch/powerpc/kvm/book3s_64_mmu.c:446: warning: 'slb' may be used uninitialized 
in this function
Signed-off-by: Denis Kirjanov 
---
arch/powerpc/kvm/book3s_64_mmu.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_64_mmu.c b/arch/powerpc/kvm/book3s_64_mmu.c
index 4025ea2..61f2621 100644
--- a/arch/powerpc/kvm/book3s_64_mmu.c
+++ b/arch/powerpc/kvm/book3s_64_mmu.c
@@ -443,7 +443,7 @@ static int kvmppc_mmu_book3s_64_esid_to_vsid(struct 
kvm_vcpu *vcpu, ulong esid,
 u64 *vsid)
 {
ulong ea = esid << SID_SHIFT;
-   struct kvmppc_slb *slb;
+   struct kvmppc_slb *uninitialized_var(slb);
u64 gvsid = esid;
 
if (vcpu->arch.msr & (MSR_DR|MSR_IR)) {
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] powerpc/iseries: fix possible null pointer dereference in iSeries_pcibios_fixup_resources

2010-06-16 Thread Denis Kirjanov
I don't know if this is a right fix for the problem
since of_get_property can return NULL.
Since iseries_device_information is used only for informational purpose,
we can skip this function without valid HvSubBusNumber number.

Signed-off-by: Denis Kirjanov 
---
arch/powerpc/platforms/iseries/pci.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c 
b/arch/powerpc/platforms/iseries/pci.c
index 3fc2e64..ab3962b 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -445,7 +445,11 @@ void __init iSeries_pcibios_fixup_resources(struct pci_dev 
*pdev)
}
 
allocate_device_bars(pdev);
-   iseries_device_information(pdev, bus, *sub_bus);
+   if (likely(sub_bus))
+   iseries_device_information(pdev, bus, *sub_bus);
+   else
+   printk(KERN_ERR "PCI: Device node %s has missing or invalid "
+   "linux,subbus property\n", node->full_name);
 }
 
 /*
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] powerpc/iseries: fix constant warning

2010-06-16 Thread Denis Kirjanov
Fix smatch warning: constant 0x8000 is so big it is unsigned long

Signed-off-by: Denis Kirjanov 
---
arch/powerpc/include/asm/abs_addr.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/include/asm/abs_addr.h 
b/arch/powerpc/include/asm/abs_addr.h
index 98324c5..c3bffc3 100644
--- a/arch/powerpc/include/asm/abs_addr.h
+++ b/arch/powerpc/include/asm/abs_addr.h
@@ -69,7 +69,7 @@ static inline unsigned long phys_to_abs(unsigned long pa)
  * Legacy iSeries Hypervisor calls
  */
 #define iseries_hv_addr(virtaddr)  \
-   (0x8000 | virt_to_abs(virtaddr))
+   (0x8000UL | virt_to_abs(virtaddr))
 
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_ABS_ADDR_H */
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] powerpc/oprofile: fix potential buffer overrun in op_model_cell.c

2010-06-01 Thread Denis Kirjanov
Fix potential initial_lfsr buffer overrun.
Writing past the end of the buffer could happen when index == ENTRIES

Signed-off-by: Denis Kirjanov 
---
 arch/powerpc/oprofile/op_model_cell.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/oprofile/op_model_cell.c 
b/arch/powerpc/oprofile/op_model_cell.c
index 2c9e522..7fd90d0 100644
--- a/arch/powerpc/oprofile/op_model_cell.c
+++ b/arch/powerpc/oprofile/op_model_cell.c
@@ -1077,7 +1077,7 @@ static int calculate_lfsr(int n)
index = ENTRIES-1;
 
/* make sure index is valid */
-   if ((index > ENTRIES) || (index < 0))
+   if ((index >= ENTRIES) || (index < 0))
index = ENTRIES-1;
 
return initial_lfsr[index];
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] powerpc/cell: Fix integer constant warning

2010-05-27 Thread Denis Kirjanov
Fix smatch warning:  warning: constant 0x8 is so big it is long

Signed-off-by: Denis Kirjanov 
---
arch/powerpc/platforms/cell/iommu.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/cell/iommu.c 
b/arch/powerpc/platforms/cell/iommu.c
index e3ec497..0a33aed 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -1067,7 +1067,7 @@ static int __init cell_iommu_fixed_mapping_init(void)
fbase = _ALIGN_UP(fbase, 1 << IO_SEGMENT_SHIFT);
fsize = lmb_phys_mem_size();
 
-   if ((fbase + fsize) <= 0x8)
+   if ((fbase + fsize) <= 0x8ul)
hbase = 0; /* use the device tree window */
else {
/* If we're over 32 GB we need to cheat. We can't map all of
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


<    1   2   3