mem-offline: add a knob to allow to skip sending RPM/AOP msg

Many a times RPM/AOP dependencies are not available. This limits the abiity
to verify mem-offline features. Allow an module param to dynamically
enable/disable sending rpm/aop messages for mem offline/online requests.

Add mem_offline.bypass_send_msg=1 to kernel bootargs to enable bypass.

Change-Id: I1489bb0454164015e749459866982a608c211f63
Signed-off-by: Prakash Gupta <guptap@codeaurora.org>
This commit is contained in:
Prakash Gupta 2020-09-09 22:37:09 +05:30
commit ab083043a0

View file

@ -30,6 +30,14 @@
#define AOP_MSG_ADDR_HIGH_SHIFT 32
#define MAX_LEN 96
/**
* bypass_send_msg - skip mem offline/online mesg sent to rpm/aop
*/
static bool bypass_send_msg;
module_param(bypass_send_msg, bool, 0644);
MODULE_PARM_DESC(bypass_send_msg,
"skip mem offline/online mesg sent to rpm/aop.");
static unsigned long start_section_nr, end_section_nr;
static struct kobject *kobj;
static unsigned int sections_per_block;
@ -242,6 +250,9 @@ static int send_msg(struct memory_notify *mn, bool online, int count)
unsigned long start, base_sec_nr, sec_nr, sections_per_segment;
int ret, idx, i;
if (bypass_send_msg)
return 0;
sections_per_segment = get_rounded_sections_per_segment();
sec_nr = pfn_to_section_nr(SECTION_ALIGN_DOWN(mn->start_pfn));
idx = (sec_nr - start_section_nr) / sections_per_segment;
@ -1073,6 +1084,9 @@ static int mem_offline_driver_probe(struct platform_device *pdev)
pr_info("mem-offline: Added memory blocks ranging from mem%lu - mem%lu\n",
start_section_nr, end_section_nr);
if (bypass_send_msg)
pr_info("mem-offline: bypass mode\n");
return 0;
err_sysfs_remove_group: