Re: [PATCH] rtc: Improve performance of rtc_time64_to_tm. Add tests.

From: kernel test robot
Date: Sat May 29 2021 - 16:05:55 EST


Hi Cassio,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on abelloni/rtc-next]
[also build test ERROR on v5.13-rc3 next-20210528]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Cassio-Neri/rtc-Improve-performance-of-rtc_time64_to_tm-Add-tests/20210530-003728
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: i386-randconfig-r012-20210530 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/8747741de658b538ddea6a357747ad5fb9211b45
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Cassio-Neri/rtc-Improve-performance-of-rtc_time64_to_tm-Add-tests/20210530-003728
git checkout 8747741de658b538ddea6a357747ad5fb9211b45
# save the attached .config to linux build tree
make W=1 ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

ld: drivers/rtc/lib_test.o: in function `rtc_time64_to_tm_test_date_range':
>> drivers/rtc/lib_test.c:56: undefined reference to `__divdi3'


vim +56 drivers/rtc/lib_test.c

28
29 /*
30 * Checks every day in a 160000 years interval starting on 1970-01-01
31 * against the expected result.
32 */
33 static void rtc_time64_to_tm_test_date_range(struct kunit *test)
34 {
35 /*
36 * 160000 years = (160000 / 400) * 400 years
37 * = (160000 / 400) * 146097 days
38 * = (160000 / 400) * 146097 * 86400 seconds
39 */
40 time64_t total_secs = ((time64_t) 160000) / 400 * 146097 * 86400;
41 int year = 1970;
42 int month = 1;
43 int mday = 1;
44 int yday = 1;
45
46 struct rtc_time result;
47 time64_t secs;
48
49 for (secs = 0; secs <= total_secs; secs += 86400) {
50
51 rtc_time64_to_tm(secs, &result);
52
53 #define FAIL_MSG "%d/%02d/%02d (%2d) : %ld", \
54 year, month, mday, yday, secs/86400
55
> 56 KUNIT_ASSERT_EQ_MSG(test, year - 1900, result.tm_year, FAIL_MSG);
57 KUNIT_ASSERT_EQ_MSG(test, month - 1, result.tm_mon, FAIL_MSG);
58 KUNIT_ASSERT_EQ_MSG(test, mday, result.tm_mday, FAIL_MSG);
59 KUNIT_ASSERT_EQ_MSG(test, yday, result.tm_yday, FAIL_MSG);
60
61 advance_date(&year, &month, &mday, &yday);
62 }
63 }
64

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip