All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iwlwifi: Deinline iwl_{read,write}{8,32}
@ 2015-07-14 12:22 Denys Vlasenko
  2015-07-14 12:38 ` Sergei Shtylyov
  0 siblings, 1 reply; 6+ messages in thread
From: Denys Vlasenko @ 2015-07-14 12:22 UTC (permalink / raw)
  To: Emmanuel Grumbach
  Cc: Denys Vlasenko, Johannes Berg, John W. Linville,
	Intel Linux Wireless, linux-wireless, netdev, linux-kernel

With CONFIG_IWLWIFI_DEVICE_TRACING=y, these functions are rather large,
too big for inlining.

With this .config: http://busybox.net/~vda/kernel_config,
after uninlining these functions have sizes and callsite counts
as follows:

iwl_read32  475 bytes, 51 callsites
iwl_write32 477 bytes, 90 callsites
iwl_write8  493 bytes, 3 callsites

Reduction in size is about 74,000 bytes:

    text     data      bss       dec     hex filename
90758147 17226024 36659200 144643371 89f152b vmlinux0
90687995 17221928 36659200 144569123 89df323 vmlinux.after

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
CC: Johannes Berg <johannes.berg@intel.com>
CC: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: Intel Linux Wireless <ilw@linux.intel.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
CC: linux-kernel@vger.kernel.org
---
 drivers/net/wireless/iwlwifi/iwl-io.c |  7 +++++++
 drivers/net/wireless/iwlwifi/iwl-io.h | 39 +++++++++++++++++++++--------------
 2 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-io.c b/drivers/net/wireless/iwlwifi/iwl-io.c
index 27c66e4..aed121e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.c
+++ b/drivers/net/wireless/iwlwifi/iwl-io.c
@@ -38,6 +38,13 @@
 
 #define IWL_POLL_INTERVAL 10	/* microseconds */
 
+#if defined(CONFIG_IWLWIFI_DEVICE_TRACING)
+IWL_READ_WRITE( /*not inlined*/ )
+IWL_EXPORT_SYMBOL(iwl_write8);
+IWL_EXPORT_SYMBOL(iwl_write32);
+IWL_EXPORT_SYMBOL(iwl_read32);
+#endif
+
 int iwl_poll_bit(struct iwl_trans *trans, u32 addr,
 		 u32 bits, u32 mask, int timeout)
 {
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h
index 705d12c..3c9d2a8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.h
+++ b/drivers/net/wireless/iwlwifi/iwl-io.h
@@ -32,24 +32,31 @@
 #include "iwl-devtrace.h"
 #include "iwl-trans.h"
 
-static inline void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val)
-{
-	trace_iwlwifi_dev_iowrite8(trans->dev, ofs, val);
-	iwl_trans_write8(trans, ofs, val);
-}
-
-static inline void iwl_write32(struct iwl_trans *trans, u32 ofs, u32 val)
-{
-	trace_iwlwifi_dev_iowrite32(trans->dev, ofs, val);
-	iwl_trans_write32(trans, ofs, val);
+#define IWL_READ_WRITE(static_inline) \
+static_inline void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val) \
+{ \
+	trace_iwlwifi_dev_iowrite8(trans->dev, ofs, val); \
+	iwl_trans_write8(trans, ofs, val); \
+} \
+static_inline void iwl_write32(struct iwl_trans *trans, u32 ofs, u32 val) \
+{ \
+	trace_iwlwifi_dev_iowrite32(trans->dev, ofs, val); \
+	iwl_trans_write32(trans, ofs, val); \
+} \
+static_inline u32 iwl_read32(struct iwl_trans *trans, u32 ofs) \
+{ \
+	u32 val = iwl_trans_read32(trans, ofs); \
+	trace_iwlwifi_dev_ioread32(trans->dev, ofs, val); \
+	return val; \
 }
 
-static inline u32 iwl_read32(struct iwl_trans *trans, u32 ofs)
-{
-	u32 val = iwl_trans_read32(trans, ofs);
-	trace_iwlwifi_dev_ioread32(trans->dev, ofs, val);
-	return val;
-}
+#if !defined(CONFIG_IWLWIFI_DEVICE_TRACING)
+IWL_READ_WRITE(static inline)
+#else
+void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val);
+void iwl_write32(struct iwl_trans *trans, u32 ofs, u32 val);
+u32 iwl_read32(struct iwl_trans *trans, u32 ofs);
+#endif
 
 static inline void iwl_set_bit(struct iwl_trans *trans, u32 reg, u32 mask)
 {
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] iwlwifi: Deinline iwl_{read,write}{8,32}
  2015-07-14 12:22 [PATCH] iwlwifi: Deinline iwl_{read,write}{8,32} Denys Vlasenko
@ 2015-07-14 12:38 ` Sergei Shtylyov
  2015-07-14 12:41   ` Denys Vlasenko
  0 siblings, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2015-07-14 12:38 UTC (permalink / raw)
  To: Denys Vlasenko, Emmanuel Grumbach
  Cc: Johannes Berg, John W. Linville, Intel Linux Wireless,
	linux-wireless, netdev, linux-kernel

Hello.

On 7/14/2015 3:22 PM, Denys Vlasenko wrote:

> With CONFIG_IWLWIFI_DEVICE_TRACING=y, these functions are rather large,
> too big for inlining.

> With this .config: http://busybox.net/~vda/kernel_config,
> after uninlining these functions have sizes and callsite counts
> as follows:

> iwl_read32  475 bytes, 51 callsites
> iwl_write32 477 bytes, 90 callsites
> iwl_write8  493 bytes, 3 callsites

> Reduction in size is about 74,000 bytes:

>      text     data      bss       dec     hex filename
> 90758147 17226024 36659200 144643371 89f152b vmlinux0
> 90687995 17221928 36659200 144569123 89df323 vmlinux.after

> Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
> CC: Johannes Berg <johannes.berg@intel.com>
> CC: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
> Cc: "John W. Linville" <linville@tuxdriver.com>
> Cc: Intel Linux Wireless <ilw@linux.intel.com>
> Cc: linux-wireless@vger.kernel.org
> Cc: netdev@vger.kernel.org
> CC: linux-kernel@vger.kernel.org
> ---
>   drivers/net/wireless/iwlwifi/iwl-io.c |  7 +++++++
>   drivers/net/wireless/iwlwifi/iwl-io.h | 39 +++++++++++++++++++++--------------
>   2 files changed, 30 insertions(+), 16 deletions(-)

[...]
> diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h
> index 705d12c..3c9d2a8 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-io.h
> +++ b/drivers/net/wireless/iwlwifi/iwl-io.h
> @@ -32,24 +32,31 @@
>   #include "iwl-devtrace.h"
>   #include "iwl-trans.h"
>
[...]
> +#define IWL_READ_WRITE(static_inline) \
> +static_inline void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val) \
> +{ \
> +	trace_iwlwifi_dev_iowrite8(trans->dev, ofs, val); \
> +	iwl_trans_write8(trans, ofs, val); \
> +} \
> +static_inline void iwl_write32(struct iwl_trans *trans, u32 ofs, u32 val) \
> +{ \
> +	trace_iwlwifi_dev_iowrite32(trans->dev, ofs, val); \
> +	iwl_trans_write32(trans, ofs, val); \
> +} \
> +static_inline u32 iwl_read32(struct iwl_trans *trans, u32 ofs) \
> +{ \
> +	u32 val = iwl_trans_read32(trans, ofs); \
> +	trace_iwlwifi_dev_ioread32(trans->dev, ofs, val); \
> +	return val; \
>   }
[...]
> +#if !defined(CONFIG_IWLWIFI_DEVICE_TRACING)
> +IWL_READ_WRITE(static inline)

    Not static_inline?

> +#else
> +void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val);
> +void iwl_write32(struct iwl_trans *trans, u32 ofs, u32 val);
> +u32 iwl_read32(struct iwl_trans *trans, u32 ofs);
> +#endif

MBR, Sergei


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] iwlwifi: Deinline iwl_{read,write}{8,32}
  2015-07-14 12:38 ` Sergei Shtylyov
@ 2015-07-14 12:41   ` Denys Vlasenko
  2015-07-15 17:49     ` Emmanuel Grumbach
  0 siblings, 1 reply; 6+ messages in thread
From: Denys Vlasenko @ 2015-07-14 12:41 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Denys Vlasenko, Emmanuel Grumbach, Johannes Berg,
	John W. Linville, Intel Linux Wireless, linux-wireless, netdev,
	Linux Kernel Mailing List

On Tue, Jul 14, 2015 at 2:38 PM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
>> +#define IWL_READ_WRITE(static_inline) \
>> +static_inline void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val) \
>> +{ \
>> +       trace_iwlwifi_dev_iowrite8(trans->dev, ofs, val); \
>> +       iwl_trans_write8(trans, ofs, val); \
>> +} \
> [...]
>>
>> +#if !defined(CONFIG_IWLWIFI_DEVICE_TRACING)
>> +IWL_READ_WRITE(static inline)
>
>    Not static_inline?

Yes. Here we are putting two words, "static inline", in front of every
function definition.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] iwlwifi: Deinline iwl_{read,write}{8,32}
  2015-07-14 12:41   ` Denys Vlasenko
@ 2015-07-15 17:49     ` Emmanuel Grumbach
  2015-08-09 19:38       ` Denys Vlasenko
  0 siblings, 1 reply; 6+ messages in thread
From: Emmanuel Grumbach @ 2015-07-15 17:49 UTC (permalink / raw)
  To: Denys Vlasenko
  Cc: Sergei Shtylyov, Denys Vlasenko, Emmanuel Grumbach, Johannes Berg,
	John W. Linville, Intel Linux Wireless, linux-wireless, netdev,
	Linux Kernel Mailing List

On Tue, Jul 14, 2015 at 3:41 PM, Denys Vlasenko
<vda.linux@googlemail.com> wrote:
> On Tue, Jul 14, 2015 at 2:38 PM, Sergei Shtylyov
> <sergei.shtylyov@cogentembedded.com> wrote:
>>> +#define IWL_READ_WRITE(static_inline) \
>>> +static_inline void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val) \
>>> +{ \
>>> +       trace_iwlwifi_dev_iowrite8(trans->dev, ofs, val); \
>>> +       iwl_trans_write8(trans, ofs, val); \
>>> +} \
>> [...]
>>>
>>> +#if !defined(CONFIG_IWLWIFI_DEVICE_TRACING)
>>> +IWL_READ_WRITE(static inline)
>>
>>    Not static_inline?
>
> Yes. Here we are putting two words, "static inline", in front of every
> function definition.
> --

I'll try to come up with a patch that is easier for me to read, but I
am really busy right now. Ping me in a week if you have heard from me
earlier.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] iwlwifi: Deinline iwl_{read,write}{8,32}
  2015-07-15 17:49     ` Emmanuel Grumbach
@ 2015-08-09 19:38       ` Denys Vlasenko
  2015-08-24  9:53         ` Emmanuel Grumbach
  0 siblings, 1 reply; 6+ messages in thread
From: Denys Vlasenko @ 2015-08-09 19:38 UTC (permalink / raw)
  To: Emmanuel Grumbach, Denys Vlasenko
  Cc: Sergei Shtylyov, Emmanuel Grumbach, Johannes Berg,
	John W. Linville, Intel Linux Wireless, linux-wireless,
	Linux Kernel Mailing List

On 07/15/2015 07:49 PM, Emmanuel Grumbach wrote:
> On Tue, Jul 14, 2015 at 3:41 PM, Denys Vlasenko
> <vda.linux@googlemail.com> wrote:
>> On Tue, Jul 14, 2015 at 2:38 PM, Sergei Shtylyov
>> <sergei.shtylyov@cogentembedded.com> wrote:
>>>> +#define IWL_READ_WRITE(static_inline) \
>>>> +static_inline void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val) \
>>>> +{ \
>>>> +       trace_iwlwifi_dev_iowrite8(trans->dev, ofs, val); \
>>>> +       iwl_trans_write8(trans, ofs, val); \
>>>> +} \
>>> [...]
>>>>
>>>> +#if !defined(CONFIG_IWLWIFI_DEVICE_TRACING)
>>>> +IWL_READ_WRITE(static inline)
>>>
>>>    Not static_inline?
>>
>> Yes. Here we are putting two words, "static inline", in front of every
>> function definition.
>> --
> 
> I'll try to come up with a patch that is easier for me to read, but I
> am really busy right now. Ping me in a week if you have heard from me
> earlier.

So how it is going with this patch?

In hindsight, I would use a different name for the macro parameter here:

#define IWL_READ_WRITE(static_inline) \
+static_inline void iwl_write8(...)

"static_inline" proved to be confusing.
Maybe perform s/static_inline/func_qualifier/ on the patch...


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] iwlwifi: Deinline iwl_{read,write}{8,32}
  2015-08-09 19:38       ` Denys Vlasenko
@ 2015-08-24  9:53         ` Emmanuel Grumbach
  0 siblings, 0 replies; 6+ messages in thread
From: Emmanuel Grumbach @ 2015-08-24  9:53 UTC (permalink / raw)
  To: Denys Vlasenko
  Cc: Denys Vlasenko, Sergei Shtylyov, Emmanuel Grumbach, Johannes Berg,
	John W. Linville, Intel Linux Wireless, linux-wireless,
	Linux Kernel Mailing List

> >
> > I'll try to come up with a patch that is easier for me to read, but I
> > am really busy right now. Ping me in a week if you have heard from me
> > earlier.
>
> So how it is going with this patch?
>
> In hindsight, I would use a different name for the macro parameter here:
>
> #define IWL_READ_WRITE(static_inline) \
> +static_inline void iwl_write8(...)
>
> "static_inline" proved to be confusing.
> Maybe perform s/static_inline/func_qualifier/ on the patch...
>

In the end, I un-inlined these functions unconditionally.
It won't make it for 4.3 though.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-08-24  9:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-14 12:22 [PATCH] iwlwifi: Deinline iwl_{read,write}{8,32} Denys Vlasenko
2015-07-14 12:38 ` Sergei Shtylyov
2015-07-14 12:41   ` Denys Vlasenko
2015-07-15 17:49     ` Emmanuel Grumbach
2015-08-09 19:38       ` Denys Vlasenko
2015-08-24  9:53         ` Emmanuel Grumbach

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.