Re: [PATCH] x86: Add a prompt for HPET_EMULATE_RTC

2021-02-04 Thread Anand K. Mistry
> >
> > Hi,
> >
> > On plain vanilla 5.11-rc6, when I take this (partial) .config file
> > which contains:
> >
> > CONFIG_HPET=y
> > # CONFIG_HPET_EMULATE_RTC is not set
> > # CONFIG_HPET_MMAP is not set
> >
> > and run
> > $ make olddefconfig
> >
> > my new .config file contains
> >
> > CONFIG_HPET_TIMER=y
> > CONFIG_HPET_EMULATE_RTC=y
> > CONFIG_HPET=y
> > # CONFIG_HPET_MMAP is not set
> >
> >
> > Isn't that what you are expecting?
> > or are you trying to keep the opposite?
> >
> > # CONFIG_HPET_EMULATE_RTC is not set
> >
> > Hm, I bet that I misunderstood you and you want to keep
> > it disabled. Is that right?

Yes, I want to keep it disabled. My understanding (from the behaviour
I've seen with other settings, as well as reading the sources) is that
"is not set" is treated the same as "n".

In fact, if you change the old config to CONFIG_HPET_EMULATE_RTC=n,
you get the same before/after behaviour of this patch. Before,
olddefconfig will ignore the old setting and change it to "y". With
this patch, olddefconfig keeps the old setting, but re-writes it to
"is not set". This is even more surprising because the user is
explicit in what the old config setting is, but olddefconfig still
ignores it.

>
> If that's the case, then I agree that your original patch to
> make HPET_EMULATE_RTC user-visible is needed.
>
> Sorry to be so slow about understanding your goal (if I do
> understand it now).
>
> --
> ~Randy
>


-- 
Anand K. Mistry
Software Engineer
Google Australia


Re: [PATCH] x86: Add a prompt for HPET_EMULATE_RTC

2021-02-04 Thread Randy Dunlap
On 2/4/21 9:37 AM, Randy Dunlap wrote:
> On 2/3/21 10:55 PM, Anand K. Mistry wrote:
>> On Thu, 4 Feb 2021 at 17:30, Randy Dunlap  wrote:
>>>
>>> On 2/3/21 10:13 PM, Anand K. Mistry wrote:
> Hi,
>
> When you run "make olddefconfig", should this "depends on"
> line evaluate to true or false?

 True. RTC_DRV_CMOS=y by default on x86 systems and HPET_TIMER also
 appears to default yes (on x86-64 if I'm reading this right).

 Oddly, the RTC config option doesn't appear to exist. Probably a separate 
 issue.
>>>
>>> Yes, just a separate simple patch.
>>>
> I.e., what are the settings of these symbols in the old .config file?
>
>
> depends on HPET_TIMER && (RTC=y || RTC=m || RTC_DRV_CMOS=m || 
> RTC_DRV_CMOS=y)

 Actually, none of these options are set in the old config.
 RTC_DRV_CMOS and HPET_TIMER appear to default to yes.

  % grep HPET .config
 CONFIG_HPET=y
 # CONFIG_HPET_EMULATE_RTC is not set
 # CONFIG_HPET_MMAP is not set
  % grep RTC .config
 CONFIG_RTC_CLASS=y
 # CONFIG_HPET_EMULATE_RTC is not set
 CONFIG_PM_TRACE_RTC=y
 # CONFIG_RTC_HCTOSYS is not set

>
> If not, is there some out-of-tree driver involved?

 No out of tree drivers involved. I tried this on a vanilla 5.11-rc6.

> I'm having a little trouble seeing why this is needed.

 So am I. But this is the magic that lets me keep
 CONFIG_HPET_EMULATE_RTC from the old config. I did manage to trace
 where the option is being overridden in the conf tool, but the
 reasoning why is beyond my knowledge.
>>>
>>> Can you post the .config that you are feeding to 'make olddefconfig', 
>>> please.
>>> I'll take a look (or the x86 guys can do so).
>>
>> Sure. Here it is:
> 
> Hi,
> 
> On plain vanilla 5.11-rc6, when I take this (partial) .config file
> which contains:
> 
> CONFIG_HPET=y
> # CONFIG_HPET_EMULATE_RTC is not set
> # CONFIG_HPET_MMAP is not set
> 
> and run
> $ make olddefconfig
> 
> my new .config file contains
> 
> CONFIG_HPET_TIMER=y
> CONFIG_HPET_EMULATE_RTC=y
> CONFIG_HPET=y
> # CONFIG_HPET_MMAP is not set
> 
> 
> Isn't that what you are expecting?
> or are you trying to keep the opposite?
> 
> # CONFIG_HPET_EMULATE_RTC is not set
> 
> Hm, I bet that I misunderstood you and you want to keep
> it disabled. Is that right?

If that's the case, then I agree that your original patch to
make HPET_EMULATE_RTC user-visible is needed.

Sorry to be so slow about understanding your goal (if I do
understand it now).

-- 
~Randy



Re: [PATCH] x86: Add a prompt for HPET_EMULATE_RTC

2021-02-04 Thread Randy Dunlap
On 2/3/21 10:55 PM, Anand K. Mistry wrote:
> On Thu, 4 Feb 2021 at 17:30, Randy Dunlap  wrote:
>>
>> On 2/3/21 10:13 PM, Anand K. Mistry wrote:
 Hi,

 When you run "make olddefconfig", should this "depends on"
 line evaluate to true or false?
>>>
>>> True. RTC_DRV_CMOS=y by default on x86 systems and HPET_TIMER also
>>> appears to default yes (on x86-64 if I'm reading this right).
>>>
>>> Oddly, the RTC config option doesn't appear to exist. Probably a separate 
>>> issue.
>>
>> Yes, just a separate simple patch.
>>
 I.e., what are the settings of these symbols in the old .config file?


 depends on HPET_TIMER && (RTC=y || RTC=m || RTC_DRV_CMOS=m || 
 RTC_DRV_CMOS=y)
>>>
>>> Actually, none of these options are set in the old config.
>>> RTC_DRV_CMOS and HPET_TIMER appear to default to yes.
>>>
>>>  % grep HPET .config
>>> CONFIG_HPET=y
>>> # CONFIG_HPET_EMULATE_RTC is not set
>>> # CONFIG_HPET_MMAP is not set
>>>  % grep RTC .config
>>> CONFIG_RTC_CLASS=y
>>> # CONFIG_HPET_EMULATE_RTC is not set
>>> CONFIG_PM_TRACE_RTC=y
>>> # CONFIG_RTC_HCTOSYS is not set
>>>

 If not, is there some out-of-tree driver involved?
>>>
>>> No out of tree drivers involved. I tried this on a vanilla 5.11-rc6.
>>>
 I'm having a little trouble seeing why this is needed.
>>>
>>> So am I. But this is the magic that lets me keep
>>> CONFIG_HPET_EMULATE_RTC from the old config. I did manage to trace
>>> where the option is being overridden in the conf tool, but the
>>> reasoning why is beyond my knowledge.
>>
>> Can you post the .config that you are feeding to 'make olddefconfig', please.
>> I'll take a look (or the x86 guys can do so).
> 
> Sure. Here it is:

Hi,

On plain vanilla 5.11-rc6, when I take this (partial) .config file
which contains:

CONFIG_HPET=y
# CONFIG_HPET_EMULATE_RTC is not set
# CONFIG_HPET_MMAP is not set

and run
$ make olddefconfig

my new .config file contains

CONFIG_HPET_TIMER=y
CONFIG_HPET_EMULATE_RTC=y
CONFIG_HPET=y
# CONFIG_HPET_MMAP is not set


Isn't that what you are expecting?
or are you trying to keep the opposite?

# CONFIG_HPET_EMULATE_RTC is not set

Hm, I bet that I misunderstood you and you want to keep
it disabled. Is that right?

-- 
~Randy



Re: [PATCH] x86: Add a prompt for HPET_EMULATE_RTC

2021-02-03 Thread Anand K. Mistry
On Thu, 4 Feb 2021 at 17:30, Randy Dunlap  wrote:
>
> On 2/3/21 10:13 PM, Anand K. Mistry wrote:
> >> Hi,
> >>
> >> When you run "make olddefconfig", should this "depends on"
> >> line evaluate to true or false?
> >
> > True. RTC_DRV_CMOS=y by default on x86 systems and HPET_TIMER also
> > appears to default yes (on x86-64 if I'm reading this right).
> >
> > Oddly, the RTC config option doesn't appear to exist. Probably a separate 
> > issue.
>
> Yes, just a separate simple patch.
>
> >> I.e., what are the settings of these symbols in the old .config file?
> >>
> >>
> >> depends on HPET_TIMER && (RTC=y || RTC=m || RTC_DRV_CMOS=m || 
> >> RTC_DRV_CMOS=y)
> >
> > Actually, none of these options are set in the old config.
> > RTC_DRV_CMOS and HPET_TIMER appear to default to yes.
> >
> >  % grep HPET .config
> > CONFIG_HPET=y
> > # CONFIG_HPET_EMULATE_RTC is not set
> > # CONFIG_HPET_MMAP is not set
> >  % grep RTC .config
> > CONFIG_RTC_CLASS=y
> > # CONFIG_HPET_EMULATE_RTC is not set
> > CONFIG_PM_TRACE_RTC=y
> > # CONFIG_RTC_HCTOSYS is not set
> >
> >>
> >> If not, is there some out-of-tree driver involved?
> >
> > No out of tree drivers involved. I tried this on a vanilla 5.11-rc6.
> >
> >> I'm having a little trouble seeing why this is needed.
> >
> > So am I. But this is the magic that lets me keep
> > CONFIG_HPET_EMULATE_RTC from the old config. I did manage to trace
> > where the option is being overridden in the conf tool, but the
> > reasoning why is beyond my knowledge.
>
> Can you post the .config that you are feeding to 'make olddefconfig', please.
> I'll take a look (or the x86 guys can do so).

Sure. Here it is:

#
# Config options generated by splitconfig
#
CONFIG_ANDROID=y
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ASHMEM=y
CONFIG_AUDIT=y
CONFIG_BFQ_GROUP_IOSCHED=y
CONFIG_BINFMT_MISC=y
CONFIG_BLK_CGROUP=y
# CONFIG_BLK_DEBUG_FS is not set
CONFIG_BLK_DEV_DM=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_BLK_DEV_IO_TRACE=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_SD=y
CONFIG_BLK_DEV_SR=m
CONFIG_BOOTPARAM_HARDLOCKUP_PANIC=y
CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y
CONFIG_BPF_JIT=y
CONFIG_BPF_JIT_ALWAYS_ON=y
CONFIG_BPF_SYSCALL=y
CONFIG_BRIDGE=m
CONFIG_BT=m
CONFIG_BT_FEATURE_DEBUG=y
CONFIG_BT_FEATURE_DEBUG_FUNC_NAMES=y
CONFIG_BT_HCIBFUSB=m
CONFIG_BT_HCIBTUSB=m
CONFIG_BT_HCIBTUSB_AUTOSUSPEND=y
CONFIG_BT_HCIBTUSB_INTERVAL=y
CONFIG_BT_HCIVHCI=m
CONFIG_BT_HIDP=m
CONFIG_BT_RFCOMM=m
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_CFG80211=m
CONFIG_CFG80211_CERTIFICATION_ONUS=y
CONFIG_CFG80211_DEBUGFS=y
# CONFIG_CFG80211_REQUIRE_SIGNED_REGDB is not set
CONFIG_CFG80211_WEXT=y
CONFIG_CFS_BANDWIDTH=y
CONFIG_CGROUPS=y
CONFIG_CGROUP_BPF=y
CONFIG_CGROUP_CPUACCT=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_SCHED=y
CONFIG_CHROME_PLATFORMS=y
CONFIG_CLS_U32_MARK=y
# CONFIG_COMPAT_BRK is not set
CONFIG_CONFIGFS_FS=y
CONFIG_CONNECTOR=y
CONFIG_CPUSETS=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_STAT=y
CONFIG_CPU_IDLE_GOV_LADDER=y
CONFIG_CPU_IDLE_GOV_TEO=y
CONFIG_CRC7=m
CONFIG_CROS_EC=y
CONFIG_CROS_EC_PD_UPDATE=y
CONFIG_CROS_EC_SENSORHUB=m
CONFIG_CROS_EC_SPI=y
CONFIG_CRYPTO_ARC4=y
CONFIG_CRYPTO_DES=y
CONFIG_CRYPTO_USER_API_HASH=m
CONFIG_CRYPTO_USER_API_SKCIPHER=m
CONFIG_DAX=y
CONFIG_DEBUG_ATOMIC_SLEEP=y
CONFIG_DEBUG_CREDENTIALS=y
CONFIG_DEBUG_DEVRES=y
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_INFO_DWARF4=y
# CONFIG_DEBUG_PREEMPT is not set
CONFIG_DEBUG_SPINLOCK=y
CONFIG_DEFAULT_HOSTNAME="localhost"
CONFIG_DEFAULT_MMAP_MIN_ADDR=32768
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_DM_CRYPT=y
CONFIG_DM_FLAKEY=m
CONFIG_DM_INIT=y
CONFIG_DM_INTEGRITY=m
CONFIG_DM_THIN_PROVISIONING=y
CONFIG_DM_VERITY=y
CONFIG_DM_VERITY_CHROMEOS=y
# CONFIG_DNOTIFY is not set
CONFIG_DRM=y
CONFIG_DRM_DP_AUX_CHARDEV=y
CONFIG_DRM_EVDI=m
# CONFIG_DRM_FBDEV_EMULATION is not set
CONFIG_DRM_UDL=y
CONFIG_DRM_VGEM=y
CONFIG_ECRYPT_FS=y
CONFIG_EMBEDDED=y
CONFIG_ENCRYPTED_KEYS=y
CONFIG_ERROR_ON_WARNING=y
CONFIG_ESD_FS=y
CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
CONFIG_FANOTIFY=y
CONFIG_FB=y
CONFIG_FB_MODE_HELPERS=y
CONFIG_FORTIFY_SOURCE=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
CONFIG_FS_ENCRYPTION=y
CONFIG_FS_VERITY=y
CONFIG_FS_VERITY_BUILTIN_SIGNATURES=y
CONFIG_FUNCTION_TRACER=y
CONFIG_FUSE_FS=m
CONFIG_GOOGLE_COREBOOT_TABLE=y
CONFIG_GOOGLE_FIRMWARE=y
CONFIG_GOOGLE_MEMCONSOLE_COREBOOT=y
CONFIG_GOOGLE_VPD=y
CONFIG_HARDENED_USERCOPY=y
CONFIG_HFSPLUS_FS=m
CONFIG_HIDRAW=y
CONFIG_HID_APPLE=m
CONFIG_HID_BATTERY_STRENGTH=y
CONFIG_HID_CHERRY=m
CONFIG_HID_CHICONY=y
CONFIG_HID_HOLTEK=y
CONFIG_HID_KENSINGTON=y
CONFIG_HID_LOGITECH=m
CONFIG_HID_LOGITECH_DJ=m
CONFIG_HID_MAGICMOUSE=m
CONFIG_HID_MICROSOFT=m
CONFIG_HID_MULTITOUCH=y
CONFIG_HID_PLANTRONICS=m
CONFIG_HID_PRIMAX=m
CONFIG_HID_QUICKSTEP=m
CONFIG_HID_SONY=m
CONFIG_HID_THINGM=m
CONFIG_HID_WACOM=m
CONFIG_HID_WIIMOTE=m
CONFIG_HIGH_RES_TIMERS=y
CONFIG_HOSTAP=m
CONFIG_HOSTAP_FIRMWARE=y
CONFIG_HOSTAP_FIRMWARE_NVRAM=y
CONFIG_HW_RANDOM=y

Re: [PATCH] x86: Add a prompt for HPET_EMULATE_RTC

2021-02-03 Thread Randy Dunlap
On 2/3/21 10:13 PM, Anand K. Mistry wrote:
>> Hi,
>>
>> When you run "make olddefconfig", should this "depends on"
>> line evaluate to true or false?
> 
> True. RTC_DRV_CMOS=y by default on x86 systems and HPET_TIMER also
> appears to default yes (on x86-64 if I'm reading this right).
> 
> Oddly, the RTC config option doesn't appear to exist. Probably a separate 
> issue.

Yes, just a separate simple patch.

>> I.e., what are the settings of these symbols in the old .config file?
>>
>>
>> depends on HPET_TIMER && (RTC=y || RTC=m || RTC_DRV_CMOS=m || 
>> RTC_DRV_CMOS=y)
> 
> Actually, none of these options are set in the old config.
> RTC_DRV_CMOS and HPET_TIMER appear to default to yes.
> 
>  % grep HPET .config
> CONFIG_HPET=y
> # CONFIG_HPET_EMULATE_RTC is not set
> # CONFIG_HPET_MMAP is not set
>  % grep RTC .config
> CONFIG_RTC_CLASS=y
> # CONFIG_HPET_EMULATE_RTC is not set
> CONFIG_PM_TRACE_RTC=y
> # CONFIG_RTC_HCTOSYS is not set
> 
>>
>> If not, is there some out-of-tree driver involved?
> 
> No out of tree drivers involved. I tried this on a vanilla 5.11-rc6.
> 
>> I'm having a little trouble seeing why this is needed.
> 
> So am I. But this is the magic that lets me keep
> CONFIG_HPET_EMULATE_RTC from the old config. I did manage to trace
> where the option is being overridden in the conf tool, but the
> reasoning why is beyond my knowledge.

Can you post the .config that you are feeding to 'make olddefconfig', please.
I'll take a look (or the x86 guys can do so).


thanks.
-- 
~Randy



Re: [PATCH] x86: Add a prompt for HPET_EMULATE_RTC

2021-02-03 Thread Anand K. Mistry
> Hi,
>
> When you run "make olddefconfig", should this "depends on"
> line evaluate to true or false?

True. RTC_DRV_CMOS=y by default on x86 systems and HPET_TIMER also
appears to default yes (on x86-64 if I'm reading this right).

Oddly, the RTC config option doesn't appear to exist. Probably a separate issue.

> I.e., what are the settings of these symbols in the old .config file?
>
>
> depends on HPET_TIMER && (RTC=y || RTC=m || RTC_DRV_CMOS=m || 
> RTC_DRV_CMOS=y)

Actually, none of these options are set in the old config.
RTC_DRV_CMOS and HPET_TIMER appear to default to yes.

 % grep HPET .config
CONFIG_HPET=y
# CONFIG_HPET_EMULATE_RTC is not set
# CONFIG_HPET_MMAP is not set
 % grep RTC .config
CONFIG_RTC_CLASS=y
# CONFIG_HPET_EMULATE_RTC is not set
CONFIG_PM_TRACE_RTC=y
# CONFIG_RTC_HCTOSYS is not set

>
> If not, is there some out-of-tree driver involved?

No out of tree drivers involved. I tried this on a vanilla 5.11-rc6.

> I'm having a little trouble seeing why this is needed.

So am I. But this is the magic that lets me keep
CONFIG_HPET_EMULATE_RTC from the old config. I did manage to trace
where the option is being overridden in the conf tool, but the
reasoning why is beyond my knowledge.

-- 
Anand K. Mistry
Software Engineer
Google Australia


Re: [PATCH] x86: Add a prompt for HPET_EMULATE_RTC

2021-02-03 Thread Randy Dunlap
On 2/3/21 6:21 PM, Anand K Mistry wrote:
> This does two things:
> 1. Makes the option visible in menuconfig, allowing the user to easily
>disable this option
> 2. Allows olddefconfig to respoct the option if it is set in the old
>.config file
> 
> It's not clear exactly why the second consequence is true, but it
> appears to be because when the conf tool reads the config file, it only
> respects the existing setting if the option is "visible" (see
> scripts/kconfig/symbol.c:381).
> 
> Signed-off-by: Anand K Mistry 
> ---

Hi,

When you run "make olddefconfig", should this "depends on"
line evaluate to true or false?
I.e., what are the settings of these symbols in the old .config file?


depends on HPET_TIMER && (RTC=y || RTC=m || RTC_DRV_CMOS=m || 
RTC_DRV_CMOS=y)

If not, is there some out-of-tree driver involved?
I'm having a little trouble seeing why this is needed.


>  arch/x86/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 21f851179ff0..28f814493c7b 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -890,6 +890,7 @@ config HPET_TIMER
>  
>  config HPET_EMULATE_RTC
>   def_bool y
> + prompt "HPET RTC emulation"
>   depends on HPET_TIMER && (RTC=y || RTC=m || RTC_DRV_CMOS=m || 
> RTC_DRV_CMOS=y)
>  
>  config APB_TIMER
> 


thanks.
-- 
~Randy


[PATCH] x86: Add a prompt for HPET_EMULATE_RTC

2021-02-03 Thread Anand K Mistry
This does two things:
1. Makes the option visible in menuconfig, allowing the user to easily
   disable this option
2. Allows olddefconfig to respoct the option if it is set in the old
   .config file

It's not clear exactly why the second consequence is true, but it
appears to be because when the conf tool reads the config file, it only
respects the existing setting if the option is "visible" (see
scripts/kconfig/symbol.c:381).

Signed-off-by: Anand K Mistry 
---

 arch/x86/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 21f851179ff0..28f814493c7b 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -890,6 +890,7 @@ config HPET_TIMER
 
 config HPET_EMULATE_RTC
def_bool y
+   prompt "HPET RTC emulation"
depends on HPET_TIMER && (RTC=y || RTC=m || RTC_DRV_CMOS=m || 
RTC_DRV_CMOS=y)
 
 config APB_TIMER
-- 
2.30.0.365.g02bc693789-goog