From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-il1-f170.google.com (mail-il1-f170.google.com [209.85.166.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 911332E11BC for ; Wed, 19 Nov 2025 22:15:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763590507; cv=none; b=XPB0w+IqaBXsrHxHD32UmxNo+4N9bu/O2MwZ4rr+qhW1LPhc6L9B7/Nt9SUbWV/8uyPvbV9eONaFBwmj2jFc3eJVJSrPIK0TXDfw/oXaQPxm8zWJLohr8akJpH+A2+z2MZmFeecJf+cGe8AJI4/n7U0yt6KQjYwgri2fQwLuOEo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763590507; c=relaxed/simple; bh=j4H9NsS8E7ZRyPpH9R8jty2dzY6je+Uj6e6H/cueqDo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=I65jcM2YssYP9jVcBgiYvUyYIJD0N/D6296xwHaGNMWA3WgUlKfYit0uzaZROpEayr+ZssjdD4A5YMHjk5aKXgrJQSWkOPRp0tWK2NtRQPblJCEfXRHYvWdms2yrw+6amV+KMVGB/7BofriL2AuB7/p/Q5GjNWBitfmyobERG1w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fix8vpJc; arc=none smtp.client-ip=209.85.166.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="fix8vpJc" Received: by mail-il1-f170.google.com with SMTP id e9e14a558f8ab-4330d78f935so1159745ab.2 for ; Wed, 19 Nov 2025 14:15:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1763590503; x=1764195303; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=4IZXUfKDogqDo8q32YS7wkxVmudbckY2vpTyXamMUdI=; b=fix8vpJculuQGkwEy/1xPLvyFXZYX7007RMeGW5ZgkPYbCkE1OhhzB0l5Sn54zCn1L vRSDhjTs+eW1AHCbe5QojGZSdtoeRcs+JvtBtRYaYY80/AuDZMmqvdmj7TPY5L2fn8bL W7eumGys46lDSt6UZAM92IgSpAkbbMoYHoJdM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763590503; x=1764195303; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4IZXUfKDogqDo8q32YS7wkxVmudbckY2vpTyXamMUdI=; b=bWpF0d9Zn6X0v24gJLJ7oSeah3HlhB4A4G1vQAB0b/8aSJklsiXKbxwNYePHXhpjoz JBWdlcV5/qp/u8Vbawx4UsT+ZIPIYeaELu4fsWrliup25fsLMv88tWPC/pn7r1J8sUyx giOdJeP5lwWif4IfNrCGQleiqyOfnEgvUwu2kPbHesqqYz3kY0pMWxBcDmu0PdXkng// qc3SnShNVb7VgH3rhtYSzy5hXcJ75117to8rlsJ/ncmfr9F5GWuNPe2HcPNOewd75G/E T9yrueWoWHD2gWyXLzCXXpEwRou6TK2Ya4duPMcWGZFaw1vcNtC9tv6lI/NGgg54nhZ2 vkJQ== X-Forwarded-Encrypted: i=1; AJvYcCUaBplPZhCCsX/lTDuzZ+/jVS5eEbFsKBHIhyhdKww3MdNu7vqJMXFOW0bq0IYB1gIjc8QR6mozMho543w=@vger.kernel.org X-Gm-Message-State: AOJu0YzfyJxBBd2QVmlYJG9Of3baJrVis6GxZC2UDzghehU2EMXb0xef dZVQzFK1fn4rSijw5T3SO0WhY/X5DQQ3n1O+/Bwq70/w3gzx+dYmwWu2ItQurwdbC3c= X-Gm-Gg: ASbGnctJuaX4UnROCZcOQ11sCmN0yFVAV3S8h7vAq4iDCv7UkOcsAmhgj0EkC9zIpiU 4wa1jTFRyZ7al4BuGl8UGZljfvl1ojl4OMy/T9zB7OUlYFFXOf2yhkShWebmgx7lDm4l5VMqzTM YH58MmBAmU6p0x6RV48Nc60Pj49HQzTNs4IMIF5f5CT2tbT3rjr0kFJW3BQ3SSap++plCs15wZf 2HFWBc5ABVfLVFB0g2rplTKO9iSkKV6DS4BNWGXye8HPUzUfOU0BLU+Fb9pd8kY3PAmrBQHT/2D YPWMyZmC9MUgXCKlaBHTpPIc8GVBWD3Wuo0YuEy1l2MvIY+ARDpGuhTOVMVvtCpd6OtWRFHIg/+ a4yAB6UbC0tj2erl2f0zHVqkg5qDTZAg7KXgJpPegxCjWRToNNI+qgcXBFmf785X52GNvBGnuiC pOhUFDu6u79kk1JUxNn3+S0sE= X-Google-Smtp-Source: AGHT+IFR7qfpCL/0t5y1NPFMXv8LSQlZVJqs6UfB1X0Cgp3Mmrxu6YkOHNy2WTrzq93bC4toGuergQ== X-Received: by 2002:a05:6e02:1569:b0:433:2a9b:165c with SMTP id e9e14a558f8ab-435a9e075bfmr4882075ab.27.1763590503603; Wed, 19 Nov 2025 14:15:03 -0800 (PST) Received: from [192.168.1.14] ([38.175.187.108]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-435a9056ba8sm3513515ab.7.2025.11.19.14.15.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Nov 2025 14:15:03 -0800 (PST) Message-ID: Date: Wed, 19 Nov 2025 15:15:02 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] selftests: breakpoints: check RTC wakeup alarm support before test To: Xinyu Zheng , Shuah Khan Cc: Moon Hee Lee , yifei.l.liu@oracle.com, zhujun2@cmss.chinamobile.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, zouyipeng@huawei.com, Shuah Khan References: <20251112061532.2867859-1-zhengxinyu6@huawei.com> Content-Language: en-US From: Shuah Khan In-Reply-To: <20251112061532.2867859-1-zhengxinyu6@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 11/11/25 23:15, Xinyu Zheng wrote: > If RTC wakeup alarm feature is unsupported, this testcase may cause It may cause infinite suspend? Doesn't sound definitive.> infinite suspend if there is no other wakeup source. To solve this > problem, set wakeup alarm up before we trigger suspend. In this case, > we can test if RTC support RTC_FEATURE_ALARM and efi_set_alarm function. > For a "may cause" problem, this change> Signed-off-by: Xinyu Zheng > ---> .../breakpoints/step_after_suspend_test.c | 23 +++++++++++++++++++ > 1 file changed, 23 insertions(+) > > diff --git a/tools/testing/selftests/breakpoints/step_after_suspend_test.c b/tools/testing/selftests/breakpoints/step_after_suspend_test.c > index 8d233ac95696..e738af896ce1 100644 > --- a/tools/testing/selftests/breakpoints/step_after_suspend_test.c > +++ b/tools/testing/selftests/breakpoints/step_after_suspend_test.c > @@ -13,6 +13,8 @@ > #include > #include > #include > +#include > +#include > #include > #include > #include > @@ -159,10 +161,30 @@ void suspend(void) > int count_before; > int count_after; > struct itimerspec spec = {}; > + char *rtc_file = "/dev/rtc0"; > + int rtc_fd; > + struct rtc_wkalrm alarm = { 0 }; > + time_t secs; > > if (getuid() != 0) > ksft_exit_skip("Please run the test as root - Exiting.\n"); > > + rtc_fd = open(rtc_file, O_RDONLY); > + if (rtc_fd < 0) > + ksft_exit_fail_msg("open rtc0 failed\n"); > + > + err = ioctl(rtc_fd, RTC_RD_TIME, &alarm.time); > + if (err < 0) > + ksft_exit_fail_msg("get rtc time failed\n"); > + > + secs = timegm((struct tm *)&alarm.time) + 3; > + gmtime_r(&secs, (struct tm *)&alarm.time); > + alarm.enabled = 1; > + > + err = ioctl(rtc_fd, RTC_WKALM_SET, &alarm); > + if (err < 0) > + ksft_exit_fail_msg("set wake alarm test failed, errno %d\n", errno); Essentially with this change the test doesn't run unless RTC wake is supported. That sounds restrictive - is there another way do do this? > + > timerfd = timerfd_create(CLOCK_BOOTTIME_ALARM, 0); > if (timerfd < 0) > ksft_exit_fail_msg("timerfd_create() failed\n"); > @@ -180,6 +202,7 @@ void suspend(void) > if (count_after <= count_before) > ksft_exit_fail_msg("Failed to enter Suspend state\n"); > > + close(rtc_fd); > close(timerfd); > } > thanks, -- Shuah