All of lore.kernel.org
 help / color / mirror / Atom feed
From: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
To: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Cc: "stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: FAILED: patch "[PATCH] ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS" failed to apply to 4.4-stable tree
Date: Sat, 10 Sep 2016 17:50:23 +0200	[thread overview]
Message-ID: <20160910155023.GC12187@kroah.com> (raw)
In-Reply-To: <8219e44d-3444-3f69-22ac-ad7a9f7561b2@synopsys.com>

On Fri, Sep 09, 2016 at 09:47:41AM -0700, Vineet Gupta wrote:
> On 09/09/2016 07:19 AM, gregkh@linuxfoundation.org wrote:
> > On Tue, Sep 06, 2016 at 10:24:29AM -0700, Vineet Gupta wrote:
> >> On 09/05/2016 06:05 AM, gregkh@linuxfoundation.org wrote:
> >>> The patch below does not apply to the 4.4-stable tree.
> >>> If someone wants it applied there, or to any other stable or longterm
> >>> tree, then please email the backport, including the original git commit
> >>> id to <stable@vger.kernel.org>.
> >>>
> >>> thanks,
> >>>
> >>> greg k-h
> >> There were 2 commits after 4.4 which prevent a clean backport.
> >> Reworked patch below. Please apply.
> >>
> >> ---------------->
> >> rom 54607da05b9c3d4c5ee23ce0f21d7f91b83b6c34 Mon Sep 17 00:00:00 2001
> >> From: Vineet Gupta <vgupta@synopsys.com>
> >> Date: Tue, 16 Aug 2016 18:27:07 -0700
> >> Subject: [PATCH] ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS
> >> MIME-Version: 1.0
> >> Content-Type: text/plain; charset=UTF-8
> >> Content-Transfer-Encoding: 8bit
> >>
> >> |  CC      mm/memory.o
> >> | In file included from ../mm/memory.c:53:0:
> >> | ../include/linux/pfn_t.h: In function ‘pfn_t_pte’:
> >> | ../include/linux/pfn_t.h:78:2: error: conversion to non-scalar type requested
> >> |  return pfn_pte(pfn_t_to_pfn(pfn), pgprot);
> >>
> >> With STRICT_MM_TYPECHECKS pte_t is a struct and the offending code
> >> forces a cast which ends up shifting a struct and hence the gcc warning.
> >>
> >> Note that in recent past some of the arches (aarch64, s390) made
> >> STRICT_MM_TYPECHECKS default, but we don't for ARC as this leads to slightly
> >> worse generated code, given ARC ABI definition of returning structs
> >> (which pte_t would become)
> >>
> >> Quoting from ARC ABI...
> >>
> >>   "Results of type struct are returned in a caller-supplied temporary
> >>   variable whose address is passed in r0.
> >>   For such functions, the arguments are shifted so that they are
> >>   passed in r1 and up."
> >>
> >> So
> >>  - struct to be returned would be allocated on stack requiring extra
> >>    code at call sites
> >>  - callee updates stack memory to facilitate the return (vs. simple
> >>    MOV into return reg r0)
> >>
> >> Hence STRICT_MM_TYPECHECKS is not enabled by default for ARC
> >>
> >> Cc: <stable@vger.kernel.org>   #4.4+
> >> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
> >> ---
> >>  arch/arc/include/asm/pgtable.h | 3 +--
> >>  1 file changed, 1 insertion(+), 2 deletions(-)
> >>
> >> diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
> >> index 3cab04255ae0..e5fec320f158 100644
> >> --- a/arch/arc/include/asm/pgtable.h
> >> +++ b/arch/arc/include/asm/pgtable.h
> >> @@ -277,8 +277,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
> >>  
> >>  #define mk_pte(page, prot)    pfn_pte(page_to_pfn(page), prot)
> >>  #define pte_pfn(pte)        (pte_val(pte) >> PAGE_SHIFT)
> >> -#define pfn_pte(pfn, prot)    (__pte(((pte_t)(pfn) << PAGE_SHIFT) | \
> >> -                 pgprot_val(prot)))
> >> +#define pfn_pte(pfn, prot)    (__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)))
> >>  #define __pte_index(addr)    (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
> >>  
> >>  /*
> > This doesn't apply either :(
> 
> Sorry about that. I did verify that the patch was fine, I just clipped the leading
> 'F' when pasting in mailer.
> Can you please retry below - patch itself it is same as before
> 
> ----------->
> >From 7e09fca4b721d81ce7538c6e75f87a9c9c74ef39 Mon Sep 17 00:00:00 2001
> From: Vineet Gupta <vgupta@synopsys.com>
> Date: Tue, 16 Aug 2016 18:27:07 -0700
> Subject: [PATCH] ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> |  CC      mm/memory.o
> | In file included from ../mm/memory.c:53:0:
> | ../include/linux/pfn_t.h: In function ‘pfn_t_pte’:
> | ../include/linux/pfn_t.h:78:2: error: conversion to non-scalar type requested
> |  return pfn_pte(pfn_t_to_pfn(pfn), pgprot);
> 
> With STRICT_MM_TYPECHECKS pte_t is a struct and the offending code
> forces a cast which ends up shifting a struct and hence the gcc warning.
> 
> Note that in recent past some of the arches (aarch64, s390) made
> STRICT_MM_TYPECHECKS default, but we don't for ARC as this leads to slightly
> worse generated code, given ARC ABI definition of returning structs
> (which pte_t would become)
> 
> Quoting from ARC ABI...
> 
>   "Results of type struct are returned in a caller-supplied temporary
>   variable whose address is passed in r0.
>   For such functions, the arguments are shifted so that they are
>   passed in r1 and up."
> 
> So
>  - struct to be returned would be allocated on stack requiring extra
>    code at call sites
>  - callee updates stack memory to facilitate the return (vs. simple
>    MOV into return reg r0)
> 
> Hence STRICT_MM_TYPECHECKS is not enabled by default for ARC
> 
> Cc: <stable@vger.kernel.org>   #4.4+
> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
> ---
>  arch/arc/include/asm/pgtable.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
> index 3cab04255ae0..e5fec320f158 100644
> --- a/arch/arc/include/asm/pgtable.h
> +++ b/arch/arc/include/asm/pgtable.h
> @@ -277,8 +277,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
>  
>  #define mk_pte(page, prot)    pfn_pte(page_to_pfn(page), prot)
>  #define pte_pfn(pte)        (pte_val(pte) >> PAGE_SHIFT)
> -#define pfn_pte(pfn, prot)    (__pte(((pte_t)(pfn) << PAGE_SHIFT) | \
> -                 pgprot_val(prot)))
> +#define pfn_pte(pfn, prot)    (__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)))
>  #define __pte_index(addr)    (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
>  
>  /*
> -- 
> 2.7.4

This patch still fails to apply, I think you are corrupting whitespace,
look closely...

greg k-h

  reply	other threads:[~2016-09-10 15:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-05 13:06 FAILED: patch "[PATCH] ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS" failed to apply to 4.4-stable tree gregkh
2016-09-06 17:24 ` Vineet Gupta
2016-09-09 14:19   ` gregkh
2016-09-09 16:47     ` Vineet Gupta
2016-09-10 15:50       ` gregkh [this message]
2016-09-12 16:32         ` [PATCH] ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS Vineet Gupta
2016-09-12 17:08           ` gregkh @ linuxfoundation . org
2016-09-12 17:39             ` Vineet Gupta
2016-09-12 18:04             ` Vineet Gupta
2016-09-13  6:12               ` gregkh
2016-09-13 16:29                 ` Vineet Gupta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160910155023.GC12187@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=Vineet.Gupta1@synopsys.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.