All of lore.kernel.org
 help / color / mirror / Atom feed
* Deadcode discussion based on Arm NS phys timer
@ 2022-10-24  9:07 Michal Orzel
  2022-10-24 10:51 ` Julien Grall
  0 siblings, 1 reply; 13+ messages in thread
From: Michal Orzel @ 2022-10-24  9:07 UTC (permalink / raw)
  To: xen-devel; +Cc: Julien Grall, Stefano Stabellini, Bertrand Marquis

Hello,

Recently I came across a deadcode in Xen Arm arch timer code. Briefly speaking, we are routing
the NS phys timer (CNTP) IRQ to Xen, even though Xen does not make use of it (as it uses the hypervisor timer CNTHP).
This timer is fully emulated, which means that there is nothing that can trigger such IRQ. This code is
a left over from early days, where the CNTHP was buggy on some models and we had to use the CNTP instead.

As far as the problem itself is not really interesting, it raises a question of what to do with a deadcode,
as there might be/are other deadcode places in Xen. One may say that it is useful to keep it, because one day,
someone might need it when dealing with yet another broken HW. Such person would still need to modify the other
part of the code (e.g. reprogram_timer), but there would be less work required overall. Personally, I'm not in favor of
such approach, because we should not really support possible scenarios with broken HW (except for erratas listing known issues).
Also, as part of the certification/FUSA process, there should be no deadcode and we should have explanation for every block of code.

There are different ways to deal with a deadcode:
1. Get rid of it completely
2. Leave it as it is
3. Admit that it can be useful one day and:
  3.1. protect it with #if 0
  3.2. protect it with a new Kconfig option (disabled by default) using #ifdef
  3.3. protect it with a new Kconfig option (disabled by default) using IS_ENABLED (to make sure code always compile)
  3.4. protect it with a command line option (allowing to choose the timer to be used by Xen)
...

Let me know what you think.

~Michal


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-10-26 15:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-24  9:07 Deadcode discussion based on Arm NS phys timer Michal Orzel
2022-10-24 10:51 ` Julien Grall
2022-10-24 11:41   ` Michal Orzel
2022-10-24 13:29     ` Julien Grall
2022-10-25  1:29       ` Stefano Stabellini
2022-10-25  7:11         ` Michal Orzel
2022-10-25  7:45           ` Bertrand Marquis
2022-10-25  8:07             ` Michal Orzel
2022-10-25  8:20               ` Bertrand Marquis
2022-10-26 11:29                 ` Michal Orzel
2022-10-26 12:20                   ` Bertrand Marquis
2022-10-26 15:30                     ` Stefano Stabellini
2022-10-26 15:53                       ` Michal Orzel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.