[PATCH i-g-t 2/2] tests/intel/kms_ccs: add hiberbate test

Rodrigo Vivi rodrigo.vivi at intel.com
Thu Dec 5 21:52:33 UTC 2024


On Tue, Dec 03, 2024 at 11:24:18AM +0200, Juha-Pekka Heikkila wrote:
> Add hibernate test which bring entire system down for short
> hibernate. This mode is added to suspend tests to be run
> manually with '-r' flag because this is not ci friendly test,
> on hibernate ci would lose connection to the hibernated box.
> 
> For this test to work kernel resume point need to be set, from
> kernel command line is checked if there is found something along
> the lines of "resume=/dev/nvme0n1p2" or so to verify hibernate
> will be successful.
> 
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> ---
>  tests/intel/kms_ccs.c | 20 +++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/intel/kms_ccs.c b/tests/intel/kms_ccs.c
> index 3e9a57863..d720de04a 100644
> --- a/tests/intel/kms_ccs.c
> +++ b/tests/intel/kms_ccs.c
> @@ -190,6 +190,7 @@ typedef struct {
>  	bool user_seed;
>  	enum igt_commit_style commit;
>  	int fb_list_length;
> +	bool do_hibernate;
>  	struct {
>  		struct igt_fb fb;
>  		int width, height;
> @@ -839,8 +840,17 @@ static bool try_config(data_t *data, enum test_fb_flags fb_flags,
>  
>  	if (ret == 0 && !(fb_flags & TEST_BAD_ROTATION_90) && crc) {
>  		if (data->flags & TEST_SUSPEND && fb_flags & FB_COMPRESSED) {
> -			igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
> -						      SUSPEND_TEST_NONE);
> +			if (data->do_hibernate) {
> +				igt_require_f(igt_pm_check_hibernation_support(),
> +					      "Kernel is not cofigured for resume\n");
> +				igt_require_f(igt_pm_ensure_grub_boots_same_kernel(),

supposing we find a better more generic way for the grub:

Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>

and no luck with the SUSPEND_STATE_DISK, USPEND_TEST_MEM automatic case?

> +					      "Couldn't find correct kernel in grub.cfg\n");
> +				igt_system_suspend_autoresume(SUSPEND_STATE_DISK,
> +							      SUSPEND_TEST_NONE);
> +			} else {
> +				igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
> +							      SUSPEND_TEST_NONE);
> +			}
>  
>  			/* on resume check flat ccs is still compressed */
>  			if (is_xe_device(data->drm_fd) &&
> @@ -1044,6 +1054,9 @@ static int opt_handler(int opt, int opt_index, void *opt_data)
>  		data->user_seed = true;
>  		data->seed = strtoul(optarg, NULL, 0);
>  		break;
> +	case 'r':
> +		data->do_hibernate = true;
> +		break;
>  	default:
>  		return IGT_OPT_HANDLER_ERROR;
>  	}
> @@ -1056,9 +1069,10 @@ static data_t data;
>  static const char *help_str =
>  "  -c\t\tCheck the presence of compression meta-data\n"
>  "  -s <seed>\tSeed for random number generator\n"
> +"  -r\t\tOn suspend test do full hibernate with reboot\n"
>  ;
>  
> -igt_main_args("cs:", NULL, help_str, opt_handler, &data)
> +igt_main_args("csr:", NULL, help_str, opt_handler, &data)
>  {
>  	igt_fixture {
>  		data.drm_fd = drm_open_driver_master(DRIVER_INTEL | DRIVER_XE);
> -- 
> 2.45.2
> 


More information about the igt-dev mailing list