All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Yishai Hadas <yishaih-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org"
	<yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH rdma-core 1/5] util: Add common mmio macros
Date: Tue, 18 Apr 2017 11:28:52 -0600	[thread overview]
Message-ID: <20170418172852.GD7181@obsidianresearch.com> (raw)
In-Reply-To: <b35958cf-5e87-3149-5413-eb754ec89b4d-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>

On Tue, Apr 18, 2017 at 06:52:00PM +0300, Yishai Hadas wrote:

> >+/* When the arch does not have a 32 bit store we provide an emulation that
> You mean a 64 bit store, correct ?

Yep, thanks

> >+write64_fn_t resolve_mmio_write64_be(void)
> >+{
> >+#if defined(__i386__)
> >+	if (have_sse())
> >+		return &sse_mmio_write64_be;
> >+#endif
> >+	return &pthread_mmio_write64_be;
> 
> This will bring in 32 bit systems code that uses global spinlock comparing
> current usage where a specific spinlock is used, isn't it ?

Yes, that is mostly right. libutil is statically linked to each
provider, so every provider gets its own instance of the global lock.

The only case this would seem to matter is if multiple devices using
the same provider are run concurrently.

We could use a hash scheme or something to multiple the lock, but I'm
really not sure that 32 bit performance matters to anyone anymore?

> see mlx4_write64() which is replaced by that code in downstream patches.

Yes, it will be easier to migrate the entire code base if we don't
have to add more special locking. Since this brings back lockless SSE
on ia32 I feel there are very few systems that would actually hit this
lock and care about the performance of the lock ??

> >+/* The first step is to define the 'raw' accessors. To make this very safe
> >+   with sparse we define two versions of each, a le and a be - however the
> >+   code is always identical.
> >+*/

[..]

> >+#define MAKE_WRITE(_NAME_, _SZ_)                                               \
> >+	static inline void _NAME_##_be(void *addr, __be##_SZ_ value)           \
> >+	{                                                                      \
> >+		s390_mmio_write(addr, &value, sizeof(value));                  \
> >+	}                                                                      \
> >+	static inline void _NAME_##_le(void *addr, __le##_SZ_ value)           \
> >+	{                                                                      \
> >+		s390_mmio_write(addr, &value, sizeof(value));                  \
> >+	}
> 
> I believe that you introduced two different versions (i.e. le/be only for
> semantic reasons as code is really similar, is that correct ?

Yes, as the comment above says.

> >+static inline void mmio_read8(void *addr, uint8_t value)
> 
> Did you refer here to mmio_write8 ?

Yep, I can't even compile test the s390 stuff..

> >+#define MAKE_WRITE(_NAME_, _SZ_)                                               \
> >+	static inline void _NAME_##_be(void *addr, __be##_SZ_ value)           \
> >+	{                                                                      \
> >+		atomic_store_explicit((_Atomic(uint##_SZ_##_t) *)addr,         \
> >+				      (__force uint##_SZ_##_t)value,           \
> >+				      memory_order_relaxed);                   \
> 
> Mightn't this code introduce some overhead comparing direct assignment which
> is used (i.e. mlx5_write64) and replaced by that in downstream patches ?

All of the generated assembly I have inspected says this is at least
identical.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-04-18 17:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-13 22:38 [PATCH rdma-core 0/5] Common MMIO accessors for rdma-core Jason Gunthorpe
     [not found] ` <1492123127-6266-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-04-13 22:38   ` [PATCH rdma-core 1/5] util: Add common mmio macros Jason Gunthorpe
     [not found]     ` <1492123127-6266-2-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-04-18 15:52       ` Yishai Hadas
     [not found]         ` <b35958cf-5e87-3149-5413-eb754ec89b4d-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2017-04-18 17:28           ` Jason Gunthorpe [this message]
     [not found]             ` <20170418172852.GD7181-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-04-18 17:38               ` Leon Romanovsky
     [not found]                 ` <20170418173815.GC14088-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-04-18 18:17                   ` Jason Gunthorpe
     [not found]                     ` <20170418181736.GF7181-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-04-19  5:55                       ` Leon Romanovsky
     [not found]                         ` <20170419055517.GH14088-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-04-19 15:33                           ` Jason Gunthorpe
2017-04-13 22:38   ` [PATCH rdma-core 2/5] mlx4: Use util/mmio.h Jason Gunthorpe
2017-04-13 22:38   ` [PATCH rdma-core 3/5] mlx5: " Jason Gunthorpe
2017-04-13 22:38   ` [PATCH rdma-core 4/5] mthca: " Jason Gunthorpe
2017-04-13 22:38   ` [PATCH rdma-core 5/5] Add mmio_memcpy_x64 Jason Gunthorpe
     [not found]     ` <1492123127-6266-6-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-04-18 16:22       ` Yishai Hadas
     [not found]         ` <413a6c23-2bfe-60b6-f179-ddcb82bb19ab-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2017-04-18 18:27           ` Jason Gunthorpe
     [not found]             ` <20170418182703.GG7181-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-04-19 15:54               ` Yishai Hadas
2017-04-14  7:18   ` [PATCH rdma-core 0/5] Common MMIO accessors for rdma-core Majd Dibbiny

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=20170418172852.GD7181@obsidianresearch.com \
    --to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=yishaih-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
    --cc=yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.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.