linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Haren Myneni <haren@linux.ibm.com>
To: mahesh@linux.ibm.com
Cc: linuxppc-dev@lists.ozlabs.org, maddy@linux.ibm.com,
	mpe@ellerman.id.au, msuchanek@suse.de, tyreld@linux.ibm.com,
	npiggin@gmail.com, bjking1@linux.ibm.com
Subject: Re: [PATCH v2 9/9] powerpc/pseries: HVPIPE changes to support migration
Date: Mon, 25 Aug 2025 02:31:04 -0700	[thread overview]
Message-ID: <4433f9a4e8794b546d87e5651dd913e9049f878a.camel@linux.ibm.com> (raw)
In-Reply-To: <kcgdolrl7lpou4pw3wkpqmool2l6rk5lpw744w55imqqg5aokf@6tuzttzzvl7c>

On Mon, 2025-08-25 at 14:10 +0530, Mahesh J Salgaonkar wrote:
> On 2025-08-12 15:57:13 Tue, Haren Myneni wrote:
> > The hypervisor assigns one pipe per partition for all sources and
> > assigns new pipe after migration. Also the partition ID that is
> > used by source as its target ID may be changed after the migration.
> > So disable hvpipe during SUSPEND event with ‘hvpipe enable’ system
> > parameter value = 0 and enable it after migration during RESUME
> > event with  hvpipe enable’ system parameter value = 1.
> > 
> > The user space calls such as ioctl()/ read() / write() / poll()
> > returns  -ENXIO between SUSPEND and RESUME events. The user space
> > process can close FD and reestablish connection with new FD after
> > migration if needed (Example: source IDs are changed).
> > 
> > Signed-off-by: Haren Myneni <haren@linux.ibm.com>
> > ---
> >  arch/powerpc/platforms/pseries/mobility.c    |  3 +
> >  arch/powerpc/platforms/pseries/papr-hvpipe.c | 64
> > ++++++++++++++++++++
> >  arch/powerpc/platforms/pseries/papr-hvpipe.h |  6 ++
> >  3 files changed, 73 insertions(+)
> > 
> > diff --git a/arch/powerpc/platforms/pseries/mobility.c
> > b/arch/powerpc/platforms/pseries/mobility.c
> > index 62bd8e2d5d4c..95fe802ccdfd 100644
> > --- a/arch/powerpc/platforms/pseries/mobility.c
> > +++ b/arch/powerpc/platforms/pseries/mobility.c
> > @@ -28,6 +28,7 @@
> >  #include <asm/rtas.h>
> >  #include "pseries.h"
> >  #include "vas.h"	/* vas_migration_handler() */
> > +#include "papr-hvpipe.h"	/* hvpipe_migration_handler() */
> >  #include "../../kernel/cacheinfo.h"
> >  
> >  static struct kobject *mobility_kobj;
> > @@ -744,6 +745,7 @@ static int pseries_migrate_partition(u64
> > handle)
> >  	 * by closing VAS windows at the beginning of this
> > function.
> >  	 */
> >  	vas_migration_handler(VAS_SUSPEND);
> > +	hvpipe_migration_handler(HVPIPE_SUSPEND);
> >  
> >  	ret = wait_for_vasi_session_suspending(handle);
> >  	if (ret)
> > @@ -770,6 +772,7 @@ static int pseries_migrate_partition(u64
> > handle)
> >  
> >  out:
> >  	vas_migration_handler(VAS_RESUME);
> > +	hvpipe_migration_handler(HVPIPE_RESUME);
> >  
> >  	return ret;
> >  }
> > diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.c
> > b/arch/powerpc/platforms/pseries/papr-hvpipe.c
> > index bc3d1f0b4491..0edc1a29d64d 100644
> > --- a/arch/powerpc/platforms/pseries/papr-hvpipe.c
> > +++ b/arch/powerpc/platforms/pseries/papr-hvpipe.c
> > @@ -27,6 +27,7 @@ static unsigned char
> > hvpipe_ras_buf[RTAS_ERROR_LOG_MAX];
> >  static struct workqueue_struct *papr_hvpipe_wq;
> >  static struct work_struct *papr_hvpipe_work = NULL;
> >  static int hvpipe_check_exception_token;
> > +static bool hvpipe_feature;
> >  
> >  /*
> >   * New PowerPC FW provides support for partitions and various
> > @@ -233,6 +234,12 @@ static ssize_t papr_hvpipe_handle_write(struct
> > file *file,
> >  	unsigned long ret, len;
> >  	char *area_buf;
> >  
> > +	/*
> > +	 * Return -ENXIO during migration
> > +	 */
> > +	if (!hvpipe_feature)
> > +		return -ENXIO;
> > +
> >  	if (!src_info)
> >  		return -EIO;
> >  
> > @@ -325,6 +332,12 @@ static ssize_t papr_hvpipe_handle_read(struct
> > file *file,
> >  	struct papr_hvpipe_hdr hdr;
> >  	long ret;
> >  
> > +	/*
> > +	 * Return -ENXIO during migration
> > +	 */
> > +	if (!hvpipe_feature)
> > +		return -ENXIO;
> > +
> >  	if (!src_info)
> >  		return -EIO;
> >  
> > @@ -401,6 +414,12 @@ static unsigned int
> > papr_hvpipe_handle_poll(struct file *filp,
> >  {
> >  	struct hvpipe_source_info *src_info = filp->private_data;
> >  
> > +	/*
> > +	 * Return -ENXIO during migration
> > +	 */
> > +	if (!hvpipe_feature)
> > +		return -ENXIO;
> > +
> >  	if (!src_info)
> >  		return -EIO;
> >  
> > @@ -530,6 +549,12 @@ static long papr_hvpipe_dev_ioctl(struct file
> > *filp, unsigned int ioctl,
> >  	u32 srcID;
> >  	long ret;
> >  
> > +	/*
> > +	 * Return -ENXIO during migration
> > +	 */
> > +	if (!hvpipe_feature)
> > +		return -ENXIO;
> > +
> >  	if (get_user(srcID, argp))
> >  		return -EFAULT;
> >  
> > @@ -688,6 +713,44 @@ static int __init enable_hvpipe_IRQ(void)
> >  	return 0;
> >  }
> >  
> > +void hvpipe_migration_handler(int action)
> > +{
> > +	pr_info("hvpipe migration event %d\n", action);
> > +
> > +	/*
> > +	 * HVPIPE is not used (Failed to create /dev/papr-hvpipe).
> > +	 * So nothing to do for migration.
> > +	 */
> > +	if (!papr_hvpipe_work)
> > +		return;
> > +
> > +	switch (action) {
> > +	case HVPIPE_SUSPEND:
> > +		if (hvpipe_feature) {
> > +			/*
> > +			 * Disable hvpipe_feature to the user
> > space.
> > +			 * It will be enabled with RESUME event.
> > +			 */
> > +			hvpipe_feature = false;
> > +			/*
> > +			 * set system parameter hvpipe 'disable'
> > +			 */
> > +			set_hvpipe_sys_param(0);
> > +		}
> > +		break;
> > +	case HVPIPE_RESUME:
> > +		/*
> > +		 * set system parameter hvpipe 'enable'
> > +		 */
> > +		if (!set_hvpipe_sys_param(1))
> > +			hvpipe_feature = true;
> > +		else
> > +			pr_err("hvpipe is not enabled after
> > migration\n");
> 
> So we will end up in else condtion if destination partition does not
> have hvpipe capability ?

Yes if the HVPIPE is not supported on the destination partition.

Generally we should not see this error message -  HMC is adding some
checks whether FW supports this capability and limits the migration
before upgrade the FW. But added this printk (else condition) in case.

Thanks
Haren

> 
> Thanks,
> -Mahesh.
> 
> > +
> > +		break;
> > +	}
> > +}
> > +
> >  static const struct file_operations papr_hvpipe_ops = {
> >  	.unlocked_ioctl	=	papr_hvpipe_dev_ioctl,
> >  };
> > @@ -731,6 +794,7 @@ static int __init papr_hvpipe_init(void)
> >  
> >  	if (!ret) {
> >  		pr_info("hvpipe feature is enabled\n");
> > +		hvpipe_feature = true;
> >  		return 0;
> >  	} else
> >  		pr_err("hvpipe feature is not enabled %d\n", ret);
> > diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.h
> > b/arch/powerpc/platforms/pseries/papr-hvpipe.h
> > index aab7f77e087d..c343f4230865 100644
> > --- a/arch/powerpc/platforms/pseries/papr-hvpipe.h
> > +++ b/arch/powerpc/platforms/pseries/papr-hvpipe.h
> > @@ -11,6 +11,11 @@
> >  
> >  #define	HVPIPE_HDR_LEN	sizeof(struct papr_hvpipe_hdr)
> >  
> > +enum hvpipe_migrate_action {
> > +	HVPIPE_SUSPEND,
> > +	HVPIPE_RESUME,
> > +};
> > +
> >  struct hvpipe_source_info {
> >  	struct list_head list;	/* list of sources */
> >  	u32 srcID;
> > @@ -33,4 +38,5 @@ struct hvpipe_event_buf {
> >  				/* with specified src ID */
> >  };
> >  
> > +void hvpipe_migration_handler(int action);
> >  #endif /* _PAPR_HVPIPE_H */
> > -- 
> > 2.43.5
> > 
> > 


      reply	other threads:[~2025-08-25  9:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-12 22:57 [PATCH v2 0/9] powerpc/pseries: Add hypervisor pipe (HVPIPE) suport Haren Myneni
2025-08-12 22:57 ` [PATCH v2 1/9] powerpc/pseries: Define papr-hvpipe ioctl Haren Myneni
2025-08-12 22:57 ` [PATCH v2 2/9] powerpc/pseries: Define HVPIPE specific macros Haren Myneni
2025-08-12 22:57 ` [PATCH v2 3/9] powerpc/pseries: Add papr-hvpipe char driver for HVPIPE interfaces Haren Myneni
2025-08-27 18:15   ` Mahesh J Salgaonkar
2025-08-27 18:56     ` Haren Myneni
2025-08-12 22:57 ` [PATCH v2 4/9] powerpc/pseries: Send payload with ibm,send-hvpipe-msg RTAS Haren Myneni
2025-08-25  5:58   ` Mahesh J Salgaonkar
2025-08-25  6:53     ` Haren Myneni
2025-08-25  8:42       ` Mahesh J Salgaonkar
2025-08-12 22:57 ` [PATCH v2 5/9] powerpc/pseries: Receive payload with ibm,receive-hvpipe-msg RTAS Haren Myneni
2025-08-27 18:24   ` Mahesh J Salgaonkar
2025-08-12 22:57 ` [PATCH v2 6/9] powerpc/pseries: Wakeup hvpipe FD when the payload is pending Haren Myneni
2025-08-12 22:57 ` [PATCH v2 7/9] powerpc/pseries: Enable HVPIPE event message interrupt Haren Myneni
2025-08-12 22:57 ` [PATCH v2 8/9] powerpc/pseries: Enable hvpipe with ibm,set-system-parameter RTAS Haren Myneni
2025-08-12 22:57 ` [PATCH v2 9/9] powerpc/pseries: HVPIPE changes to support migration Haren Myneni
2025-08-25  8:40   ` Mahesh J Salgaonkar
2025-08-25  9:31     ` Haren Myneni [this message]

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=4433f9a4e8794b546d87e5651dd913e9049f878a.camel@linux.ibm.com \
    --to=haren@linux.ibm.com \
    --cc=bjking1@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mahesh@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=msuchanek@suse.de \
    --cc=npiggin@gmail.com \
    --cc=tyreld@linux.ibm.com \
    /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 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).