linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kani, Toshimitsu" <toshi.kani@hpe.com>
To: "mcgrof@kernel.org" <mcgrof@kernel.org>
Cc: "mingo@kernel.org" <mingo@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"hch@infradead.org" <hch@infradead.org>,
	"bp@suse.de" <bp@suse.de>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"x86@kernel.org" <x86@kernel.org>,
	"dan.j.williams@intel.com" <dan.j.williams@intel.com>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"paulmck@linux.vnet.ibm.com" <paulmck@linux.vnet.ibm.com>,
	"will.deacon@arm.com" <will.deacon@arm.com>,
	"luto@kernel.org" <luto@kernel.org>,
	"julia.lawall@lip6.fr" <julia.lawall@lip6.fr>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	"benh@kernel.crashing.org" <benh@kernel.crashing.org>
Subject: Re: [PATCH] x86/mm: Add warning to ioremap() for conflicting cache type
Date: Wed, 25 May 2016 19:34:27 +0000	[thread overview]
Message-ID: <1464204282.3504.70.camel@hpe.com> (raw)
In-Reply-To: <20160524233318.GC11948@wotan.suse.de>

On Wed, 2016-05-25 at 01:33 +0200, Luis R. Rodriguez wrote:
> On Wed, Apr 27, 2016 at 09:25:57AM -0600, Toshi Kani wrote:
> > 
> > On x86, ioremap() and remap_pfn_range() fail on conflicting cache
> > type of an alias mapping request only if the case is not allowed
> > by the rule set in is_new_memtype_allowed(). While this exemption
> > is necessary for remap_pfn_range() called for /dev/mem mappings,
> > it is not necessary for ioremap().
>
> The wording here is a bit unclear. How about:

I will update the change log according to your suggestions.


> > Link: https://lkml.org/lkml/2016/4/16/54
>
> lkml.org references should be avoided, we have no control over
> that domain. Please instead use:
> 
> http://lkml.kernel.org/r/20160416092018.GA8453@gmail.com

Will do.

> > 
> > Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> > Cc: Ingo Molnar <mingo@kernel.org>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: "H. Peter Anvin" <hpa@zytor.com>
> > Cc: Borislav Petkov <bp@suse.de>
> > Cc: Luis R. Rodriguez <mcgrof@suse.com>
> > Cc: Andy Lutomirski <luto@kernel.org>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > ---
> >  arch/x86/mm/ioremap.c |   10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
> > index 0d8d53d..16c5887 100644
> > --- a/arch/x86/mm/ioremap.c
> > +++ b/arch/x86/mm/ioremap.c
> > @@ -138,14 +138,16 @@ static void __iomem
> > *__ioremap_caller(resource_size_t phys_addr,
> >  	}
> >  
> >  	if (pcm != new_pcm) {
> > -		if (!is_new_memtype_allowed(phys_addr, size, pcm,
> > new_pcm)) {
> > -			printk(KERN_ERR
> > -		"ioremap error for 0x%llx-0x%llx, requested 0x%x, got
> > 0x%x\n",
> > +		retval = is_new_memtype_allowed(phys_addr, size, pcm,
> > new_pcm);
> > +		pr_err(
> > +		    "ioremap %s for 0x%llx-0x%llx, requested 0x%x, got
> > 0x%x\n",
> > +				retval ? "warning" : "error",
> >  				(unsigned long long)phys_addr,
> >  				(unsigned long long)(phys_addr +
> > size),
> >  				pcm, new_pcm);
>
> This doesn't really make it humanly consumable, a pcm_to_str may help,
> such use already exists but not generalized see pat_get_cache_mode().

OK, I will add a pcm_to_str.

> > 
> > +		if (!retval)
> >  			goto err_free_memtype;
> > -		}
> > +
> >  		pcm = new_pcm;
> >  	}
>
> In the future we may be able to proactively hunt for these invalid uses
> semantically but to do so we need first a demo driver with all known
> possible bugs we can think of.

Right.

Thanks,
-Toshi

      parent reply	other threads:[~2016-05-25 20:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1461770757-26817-1-git-send-email-toshi.kani@hpe.com>
2016-05-24 23:33 ` [PATCH] x86/mm: Add warning to ioremap() for conflicting cache type Luis R. Rodriguez
2016-05-24 23:33   ` Luis R. Rodriguez
2016-05-25 19:34   ` Kani, Toshimitsu [this message]

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=1464204282.3504.70.camel@hpe.com \
    --to=toshi.kani@hpe.com \
    --cc=benh@kernel.crashing.org \
    --cc=bp@suse.de \
    --cc=dan.j.williams@intel.com \
    --cc=hch@infradead.org \
    --cc=hpa@zytor.com \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.com \
    --cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).