netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next V1 0/3] Make is_kdump_kernel() accessible from modules
@ 2014-08-25 13:06 Amir Vadai
  2014-08-25 13:06 ` [PATCH net-next V1 1/3] crash_dump: " Amir Vadai
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Amir Vadai @ 2014-08-25 13:06 UTC (permalink / raw)
  To: David S. Miller, Andi Kleen
  Cc: netdev, Andrew Morton, Vivek Goyal, Or Gerlitz, Yevgeny Petrilin,
	Amir Vadai

Hi,

I'm re-spinning this patchset. At the begining it was suggested to use a
different name for the parameter, but at the end [3] the resolution was to
leave it as it is in this patch.

Drivers need to know if running from kdump kernel in order to change their
memory profile - since kdump environment is limited by available memory.
Currently there are drivers that are using reset_devices as suggested in [2].
In [2] it was suggested to use reset_devices, but the context was, to enable
driver to know when the hardware device is needed to be reset, and not if this
is a kdump environment. We think that is_kdump_kernel() is better suited to
select between different memory profiles.

The first patch in this patchset exports a needed symbol in order to make
is_kdump_kernel() accessible from the drivers. The rest of the patches change
from reset_devices to is_kdump_kernel() in 2 networking drivers.

The idea of this patchset was suggested by Vivek Goyal.

Tested (only build) and applied on top of commit 8fc54f6: ("net: use
reciprocal_scale() helper")

[1] - ea1c1af: ("net/mlx4_en: Reduce memory consumption on kdump kernel")
[2] - https://lkml.org/lkml/2011/1/27/341
[3] - http://www.spinics.net/lists/netdev/msg291492.html

Thanks,
Amir

Amir Vadai (3):
  crash_dump: Make is_kdump_kernel() accessible from modules
  net/mlx4: Use is_kdump_kernel() to detect kdump kernel
  net/bnx2x: Use is_kdump_kernel() to detect kdump kernel

 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c  | 3 ++-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 3 ++-
 include/linux/mlx4/device.h                      | 3 ++-
 kernel/crash_dump.c                              | 1 +
 4 files changed, 7 insertions(+), 3 deletions(-)

-- 
1.8.3.4

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

* [PATCH net-next V1 1/3] crash_dump: Make is_kdump_kernel() accessible from modules
  2014-08-25 13:06 [PATCH net-next V1 0/3] Make is_kdump_kernel() accessible from modules Amir Vadai
@ 2014-08-25 13:06 ` Amir Vadai
  2014-08-25 13:06 ` [PATCH net-next V1 2/3] net/mlx4: Use is_kdump_kernel() to detect kdump kernel Amir Vadai
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Amir Vadai @ 2014-08-25 13:06 UTC (permalink / raw)
  To: David S. Miller, Andi Kleen
  Cc: netdev, Andrew Morton, Vivek Goyal, Or Gerlitz, Yevgeny Petrilin,
	Amir Vadai

In order to make is_kdump_kernel() accessible from modules, need to
make elfcorehdr_addr exported.
This was rejected in the past [1] because reset_devices was prefered in
that context (reseting the device in kdump kernel), but now there are
some network drivers that need to reduce memory usage when loaded from
a kdump kernel.  And in that context, is_kdump_kernel() suits better.

[1] - https://lkml.org/lkml/2011/1/27/341

CC: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
---
 kernel/crash_dump.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/crash_dump.c b/kernel/crash_dump.c
index c766ee5..b64e238 100644
--- a/kernel/crash_dump.c
+++ b/kernel/crash_dump.c
@@ -18,6 +18,7 @@ unsigned long saved_max_pfn;
  * it under CONFIG_CRASH_DUMP and not CONFIG_PROC_VMCORE.
  */
 unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
+EXPORT_SYMBOL_GPL(elfcorehdr_addr);
 
 /*
  * stores the size of elf header of crash image
-- 
1.8.3.4

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

* [PATCH net-next V1 2/3] net/mlx4: Use is_kdump_kernel() to detect kdump kernel
  2014-08-25 13:06 [PATCH net-next V1 0/3] Make is_kdump_kernel() accessible from modules Amir Vadai
  2014-08-25 13:06 ` [PATCH net-next V1 1/3] crash_dump: " Amir Vadai
@ 2014-08-25 13:06 ` Amir Vadai
  2014-08-25 13:06 ` [PATCH net-next V1 3/3] net/bnx2x: " Amir Vadai
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Amir Vadai @ 2014-08-25 13:06 UTC (permalink / raw)
  To: David S. Miller, Andi Kleen
  Cc: netdev, Andrew Morton, Vivek Goyal, Or Gerlitz, Yevgeny Petrilin,
	Amir Vadai

Use is_kdump_kernel() to detect kdump kernel, instead of reset_devices.

Signed-off-by: Amir Vadai <amirv@mellanox.com>
---
 include/linux/mlx4/device.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 071f6b2..783dd09 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -38,6 +38,7 @@
 #include <linux/completion.h>
 #include <linux/radix-tree.h>
 #include <linux/cpu_rmap.h>
+#include <linux/crash_dump.h>
 
 #include <linux/atomic.h>
 
@@ -1275,7 +1276,7 @@ int mlx4_mr_rereg_mem_write(struct mlx4_dev *dev, struct mlx4_mr *mr,
 /* Returns true if running in low memory profile (kdump kernel) */
 static inline bool mlx4_low_memory_profile(void)
 {
-	return reset_devices;
+	return is_kdump_kernel();
 }
 
 #endif /* MLX4_DEVICE_H */
-- 
1.8.3.4

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

* [PATCH net-next V1 3/3] net/bnx2x: Use is_kdump_kernel() to detect kdump kernel
  2014-08-25 13:06 [PATCH net-next V1 0/3] Make is_kdump_kernel() accessible from modules Amir Vadai
  2014-08-25 13:06 ` [PATCH net-next V1 1/3] crash_dump: " Amir Vadai
  2014-08-25 13:06 ` [PATCH net-next V1 2/3] net/mlx4: Use is_kdump_kernel() to detect kdump kernel Amir Vadai
@ 2014-08-25 13:06 ` Amir Vadai
  2014-08-25 18:06 ` [PATCH net-next V1 0/3] Make is_kdump_kernel() accessible from modules Vivek Goyal
  2014-08-25 22:42 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Amir Vadai @ 2014-08-25 13:06 UTC (permalink / raw)
  To: David S. Miller, Andi Kleen
  Cc: netdev, Andrew Morton, Vivek Goyal, Or Gerlitz, Yevgeny Petrilin,
	Amir Vadai, Ariel Elior, Michal Schmidt

Use is_kdump_kernel() to detect kdump kernel, instead of
reset_devices.

CC: Ariel Elior <ariel.elior@qlogic.com>
CC: Michal Schmidt <mschmidt@redhat.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c  | 3 ++-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 2388144..c99087f 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -21,6 +21,7 @@
 #include <linux/if_vlan.h>
 #include <linux/interrupt.h>
 #include <linux/ip.h>
+#include <linux/crash_dump.h>
 #include <net/tcp.h>
 #include <net/ipv6.h>
 #include <net/ip6_checksum.h>
@@ -64,7 +65,7 @@ static int bnx2x_calc_num_queues(struct bnx2x *bp)
 	int nq = bnx2x_num_queues ? : netif_get_num_default_rss_queues();
 
 	/* Reduce memory usage in kdump environment by using only one queue */
-	if (reset_devices)
+	if (is_kdump_kernel())
 		nq = 1;
 
 	nq = clamp(nq, 1, BNX2X_MAX_QUEUES(bp));
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index a008f48..0728c02 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -41,6 +41,7 @@
 #include <linux/ethtool.h>
 #include <linux/mii.h>
 #include <linux/if_vlan.h>
+#include <linux/crash_dump.h>
 #include <net/ip.h>
 #include <net/ipv6.h>
 #include <net/tcp.h>
@@ -11956,7 +11957,7 @@ static int bnx2x_init_bp(struct bnx2x *bp)
 	bp->disable_tpa = disable_tpa;
 	bp->disable_tpa |= IS_MF_STORAGE_SD(bp) || IS_MF_FCOE_AFEX(bp);
 	/* Reduce memory usage in kdump environment by disabling TPA */
-	bp->disable_tpa |= reset_devices;
+	bp->disable_tpa |= is_kdump_kernel();
 
 	/* Set TPA flags */
 	if (bp->disable_tpa) {
-- 
1.8.3.4

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

* Re: [PATCH net-next V1 0/3] Make is_kdump_kernel() accessible from modules
  2014-08-25 13:06 [PATCH net-next V1 0/3] Make is_kdump_kernel() accessible from modules Amir Vadai
                   ` (2 preceding siblings ...)
  2014-08-25 13:06 ` [PATCH net-next V1 3/3] net/bnx2x: " Amir Vadai
@ 2014-08-25 18:06 ` Vivek Goyal
  2014-08-25 22:42 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Vivek Goyal @ 2014-08-25 18:06 UTC (permalink / raw)
  To: Amir Vadai
  Cc: David S. Miller, Andi Kleen, netdev, Andrew Morton, Or Gerlitz,
	Yevgeny Petrilin

On Mon, Aug 25, 2014 at 04:06:51PM +0300, Amir Vadai wrote:
> Hi,
> 
> I'm re-spinning this patchset. At the begining it was suggested to use a
> different name for the parameter, but at the end [3] the resolution was to
> leave it as it is in this patch.
> 
> Drivers need to know if running from kdump kernel in order to change their
> memory profile - since kdump environment is limited by available memory.
> Currently there are drivers that are using reset_devices as suggested in [2].
> In [2] it was suggested to use reset_devices, but the context was, to enable
> driver to know when the hardware device is needed to be reset, and not if this
> is a kdump environment. We think that is_kdump_kernel() is better suited to
> select between different memory profiles.
> 
> The first patch in this patchset exports a needed symbol in order to make
> is_kdump_kernel() accessible from the drivers. The rest of the patches change
> from reset_devices to is_kdump_kernel() in 2 networking drivers.
> 
> The idea of this patchset was suggested by Vivek Goyal.
> 
> Tested (only build) and applied on top of commit 8fc54f6: ("net: use
> reciprocal_scale() helper")
> 
> [1] - ea1c1af: ("net/mlx4_en: Reduce memory consumption on kdump kernel")
> [2] - https://lkml.org/lkml/2011/1/27/341
> [3] - http://www.spinics.net/lists/netdev/msg291492.html
> 
> Thanks,
> Amir

Looks good to me.

Acked-by: Vivek Goyal <vgoyal@redhat.com>

Vivek

> 
> Amir Vadai (3):
>   crash_dump: Make is_kdump_kernel() accessible from modules
>   net/mlx4: Use is_kdump_kernel() to detect kdump kernel
>   net/bnx2x: Use is_kdump_kernel() to detect kdump kernel
> 
>  drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c  | 3 ++-
>  drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 3 ++-
>  include/linux/mlx4/device.h                      | 3 ++-
>  kernel/crash_dump.c                              | 1 +
>  4 files changed, 7 insertions(+), 3 deletions(-)
> 
> -- 
> 1.8.3.4

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

* Re: [PATCH net-next V1 0/3] Make is_kdump_kernel() accessible from modules
  2014-08-25 13:06 [PATCH net-next V1 0/3] Make is_kdump_kernel() accessible from modules Amir Vadai
                   ` (3 preceding siblings ...)
  2014-08-25 18:06 ` [PATCH net-next V1 0/3] Make is_kdump_kernel() accessible from modules Vivek Goyal
@ 2014-08-25 22:42 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2014-08-25 22:42 UTC (permalink / raw)
  To: amirv; +Cc: andi, netdev, akpm, vgoyal, ogerlitz, yevgenyp

From: Amir Vadai <amirv@mellanox.com>
Date: Mon, 25 Aug 2014 16:06:51 +0300

> I'm re-spinning this patchset. At the begining it was suggested to use a
> different name for the parameter, but at the end [3] the resolution was to
> leave it as it is in this patch.
> 
> Drivers need to know if running from kdump kernel in order to change their
> memory profile - since kdump environment is limited by available memory.
> Currently there are drivers that are using reset_devices as suggested in [2].
> In [2] it was suggested to use reset_devices, but the context was, to enable
> driver to know when the hardware device is needed to be reset, and not if this
> is a kdump environment. We think that is_kdump_kernel() is better suited to
> select between different memory profiles.
> 
> The first patch in this patchset exports a needed symbol in order to make
> is_kdump_kernel() accessible from the drivers. The rest of the patches change
> from reset_devices to is_kdump_kernel() in 2 networking drivers.
> 
> The idea of this patchset was suggested by Vivek Goyal.
> 
> Tested (only build) and applied on top of commit 8fc54f6: ("net: use
> reciprocal_scale() helper")
> 
> [1] - ea1c1af: ("net/mlx4_en: Reduce memory consumption on kdump kernel")
> [2] - https://lkml.org/lkml/2011/1/27/341
> [3] - http://www.spinics.net/lists/netdev/msg291492.html

Series applied, thanks Amir.

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

end of thread, other threads:[~2014-08-25 22:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-25 13:06 [PATCH net-next V1 0/3] Make is_kdump_kernel() accessible from modules Amir Vadai
2014-08-25 13:06 ` [PATCH net-next V1 1/3] crash_dump: " Amir Vadai
2014-08-25 13:06 ` [PATCH net-next V1 2/3] net/mlx4: Use is_kdump_kernel() to detect kdump kernel Amir Vadai
2014-08-25 13:06 ` [PATCH net-next V1 3/3] net/bnx2x: " Amir Vadai
2014-08-25 18:06 ` [PATCH net-next V1 0/3] Make is_kdump_kernel() accessible from modules Vivek Goyal
2014-08-25 22:42 ` David Miller

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).