linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Leon Romanovsky <leon@kernel.org>
Cc: Doug Ledford <dledford@redhat.com>,
	Yishai Hadas <yishaih@mellanox.com>,
	linux-rdma@vger.kernel.org,
	Michael Guralnik <michaelgur@mellanox.com>
Subject: Re: [PATCH rdma-next] IB/mlx5: Generally use the WC auto detection test result
Date: Tue, 24 Mar 2020 20:23:47 -0300	[thread overview]
Message-ID: <20200324232347.GA16554@ziepe.ca> (raw)
In-Reply-To: <20200318100323.46659-1-leon@kernel.org>

On Wed, Mar 18, 2020 at 12:03:23PM +0200, Leon Romanovsky wrote:
> From: Yishai Hadas <yishaih@mellanox.com>
> 
> Now that we have direct and reliable detection of WC support by the
> system, use is broadly. The only case we have to worry about is when the
> WC autodetector cannot run.
> 
> For this fringe case generally assume that that WC is available, except
> in the well defined case of no PAT support on x86 which is tested by
> calling arch_can_pci_mmap_wc().
> 
> If WC is wrongly assumed to be available then it causes a small
> performance hit on paths in userspace that are tuned to the assumption
> that WC is available. There is no functional loss.
> 
> It is very unlikely that any platforms exist that lack WC and also care
> about the micro optimization of WC in the fringe case where
> autodetection does not work.
> 
> By removing the fairly bogus CONFIG tests this makes WC work broadly on
> all arches and all platforms.
> 
> Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
> Reviewed-by: Michael Guralnik <michaelgur@mellanox.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
>  drivers/infiniband/hw/mlx5/main.c | 16 ++++------------
>  drivers/infiniband/hw/mlx5/mem.c  |  2 +-
>  2 files changed, 5 insertions(+), 13 deletions(-)

Applied to for-next, thanks

> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index 66cd417f5d09..05804e4ba292 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -39,9 +39,6 @@
>  #include <linux/dma-mapping.h>
>  #include <linux/slab.h>
>  #include <linux/bitmap.h>
> -#if defined(CONFIG_X86)
> -#include <asm/memtype.h>
> -#endif
>  #include <linux/sched.h>
>  #include <linux/sched/mm.h>
>  #include <linux/sched/task.h>
> @@ -2146,14 +2143,6 @@ static int uar_mmap(struct mlx5_ib_dev *dev, enum mlx5_ib_mmap_cmd cmd,
>  	switch (cmd) {
>  	case MLX5_IB_MMAP_WC_PAGE:
>  	case MLX5_IB_MMAP_ALLOC_WC:
> -/* Some architectures don't support WC memory */
> -#if defined(CONFIG_X86)
> -		if (!pat_enabled())
> -			return -EPERM;
> -#elif !(defined(CONFIG_PPC) || (defined(CONFIG_ARM) && defined(CONFIG_MMU)))
> -			return -EPERM;
> -#endif
> -	/* fall through */
>  	case MLX5_IB_MMAP_REGULAR_PAGE:
>  		/* For MLX5_IB_MMAP_REGULAR_PAGE do the best effort to get WC */
>  		prot = pgprot_writecombine(vma->vm_page_prot);
> @@ -2299,9 +2288,12 @@ static int mlx5_ib_mmap(struct ib_ucontext *ibcontext, struct vm_area_struct *vm
>  	command = get_command(vma->vm_pgoff);
>  	switch (command) {
>  	case MLX5_IB_MMAP_WC_PAGE:
> +	case MLX5_IB_MMAP_ALLOC_WC:
> +		if (!dev->wc_support)
> +			return -EPERM;
> +		/* fall through */

This is apparently supposed to be spelled as

    fallthrough;

Now. I fixed it

Jason

      reply	other threads:[~2020-03-24 23:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-18 10:03 [PATCH rdma-next] IB/mlx5: Generally use the WC auto detection test result Leon Romanovsky
2020-03-24 23:23 ` Jason Gunthorpe [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=20200324232347.GA16554@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=dledford@redhat.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=michaelgur@mellanox.com \
    --cc=yishaih@mellanox.com \
    /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).