lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251002121009.00005899@huawei.com>
Date: Thu, 2 Oct 2025 12:10:09 +0100
From: Jonathan Cameron <jonathan.cameron@...wei.com>
To: Shivank Garg <shivankg@....com>, <lorenzo.stoakes@...cle.com>
CC: <akpm@...ux-foundation.org>, <david@...hat.com>, <ziy@...dia.com>,
	<willy@...radead.org>, <matthew.brost@...el.com>, <joshua.hahnjy@...il.com>,
	<rakie.kim@...com>, <byungchul@...com>, <gourry@...rry.net>,
	<ying.huang@...ux.alibaba.com>, <apopple@...dia.com>,
	<Liam.Howlett@...cle.com>, <vbabka@...e.cz>, <rppt@...nel.org>,
	<surenb@...gle.com>, <mhocko@...e.com>, <vkoul@...nel.org>,
	<lucas.demarchi@...el.com>, <rdunlap@...radead.org>, <jgg@...pe.ca>,
	<kuba@...nel.org>, <justonli@...omium.org>, <ivecera@...hat.com>,
	<dave.jiang@...el.com>, <dan.j.williams@...el.com>, <rientjes@...gle.com>,
	<Raghavendra.KodsaraThimmappa@....com>, <bharata@....com>,
	<alirad.malek@...corp.com>, <yiannis@...corp.com>, <weixugc@...gle.com>,
	<linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>
Subject: Re: [RFC V3 5/9] mm: add support for copy offload for folio
 Migration

On Tue, 23 Sep 2025 17:47:40 +0000
Shivank Garg <shivankg@....com> wrote:

> From: Mike Day <michael.day@....com>
> 
> Offload-Copy drivers should implement following functions to enable folio
> migration offloading:
> migrate_offc() - This function takes src and dst folios list undergoing

Trivial but I'd burn the characters to just spell out offc.
migrate_offload_copy() isn't exactly long.

> migration. It is responsible for transfer of page content between the
> src and dst folios.
> can_migrate_offc() - It performs necessary checks if offload copying
> migration is supported for the give src and dst folios.
> 
> Offload-Copy driver should include a mechanism to call start_offloading and
> stop_offloading for enabling and disabling migration offload respectively.
> 
> Signed-off-by: Mike Day <michael.day@....com>
> Co-developed-by: Shivank Garg <shivankg@....com>
> Signed-off-by: Shivank Garg <shivankg@....com>

Just a trivial comment inline.

Ultimately feels like more complexity will be needed to deal with
multiple providers of copying facilities being available, but I guess
this works for now.

Jonathan

> diff --git a/mm/migrate_offc.c b/mm/migrate_offc.c
> new file mode 100644
> index 000000000000..a6530658a3f7
> --- /dev/null
> +++ b/mm/migrate_offc.c
> @@ -0,0 +1,58 @@


> +
> +struct migrator migrator = {
> +	.name = "kernel",
> +	.migrate_offc = folios_mc_copy,
> +	.srcu_head.func = srcu_mig_cb,
> +	.owner = NULL,

No point in setting this to null explicitly unless intent
is to act as some sort of documentation.


> +};
> +
> +int start_offloading(struct migrator *m)
> +{
> +	int offloading = 0;
> +	int ret;
> +
> +	pr_info("starting migration offload by %s\n", m->name);
> +	ret = offc_update_migrator(m);
> +	if (ret < 0) {
> +		pr_err("failed to start migration offload by %s, err=%d\n",
> +		       m->name, ret);
> +		return ret;
> +	}
> +	atomic_try_cmpxchg(&dispatch_to_offc, &offloading, 1);
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(start_offloading);
> +
> +int stop_offloading(void)
> +{
> +	int offloading = 1;
> +	int ret;
> +
> +	pr_info("stopping migration offload by %s\n", migrator.name);
> +	ret = offc_update_migrator(NULL);
> +	if (ret < 0) {
> +		pr_err("failed to stop migration offload by %s, err=%d\n",
> +		       migrator.name, ret);
> +		return ret;
> +	}
> +	atomic_try_cmpxchg(&dispatch_to_offc, &offloading, 0);
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(stop_offloading);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ