lkml.org 
[lkml]   [2021]   [Dec]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [RESEND PATCHv2] tty: hvc: dcc: Bind driver to core0 for reads and writes
From
On 12/8/2021 12:30 PM, Greg Kroah-Hartman wrote:
> On Wed, Dec 08, 2021 at 12:08:47PM +0530, Sai Prakash Ranjan wrote:
>> From: Shanker Donthineni <shankerd@codeaurora.org>
>>
>> Some debuggers, such as Trace32 from Lauterbach GmbH, do not handle
>> reads/writes from/to DCC on secondary cores. Each core has its
>> own DCC device registers, so when a core reads or writes from/to DCC,
>> it only accesses its own DCC device. Since kernel code can run on
>> any core, every time the kernel wants to write to the console, it
>> might write to a different DCC.
>>
>> In SMP mode, Trace32 creates multiple windows, and each window shows
>> the DCC output only from that core's DCC. The result is that console
>> output is either lost or scattered across windows.
>>
>> Selecting this option will enable code that serializes all console
>> input and output to core 0. The DCC driver will create input and
>> output FIFOs that all cores will use. Reads and writes from/to DCC
>> are handled by a workqueue that runs only core 0.
>>
>> Link: https://lore.kernel.org/lkml/1435344756-20901-1-git-send-email-timur@codeaurora.org/
>> Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
>> Acked-by: Adam Wallis <awallis@codeaurora.org>
>> Signed-off-by: Timur Tabi <timur@codeaurora.org>
>> Signed-off-by: Elliot Berman <eberman@codeaurora.org>
>> Signed-off-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
>> ---
>>
>> Resending this v2 since earlier one had a typo in the variable type.
>>
>> Changes in v2:
>> * Checkpatch warning fixes.
>> * Use of IS_ENABLED macros instead of ifdefs.
>>
>> I also thought of making it depends on !HOTPLUG_CPU since it is broken
>> in case core0 is hotplugged off, but apparently HOTPLUG_CPU kconfig
>> has weird dependency issues, i.e., gets selected by CONFIG_PM and others.
>> So it will be almost like this feature won't be selectable at all if
>> I add !HOTPLUG_CPU kconfig dependency. Also HVC_DCC is a debug feature
>> where we need Trace32 like tools to access DCC windows in which case
>> these shortcomings can be expected since manual intervention is required
>> anyways for attaching a core to Trace32, so it won't matter much.
> But your code will break on systems when cpu 0 goes away, so this isn't
> going to work well at all. Please make this work for any cpu or handle
> the case when the cpu it is running on goes away.

It breaks as in we won't see the kernel logs in the userspace tools like
Trace32 when CPU0 goes
off, it isn't any different from detaching cores from Trace32 manually.
There is no way to auto migrate
to other CPU in such tools, you have to manually attach core to
corresponding CPUs anyways.
How do you suppose we write code in kernel such that it auto migrate in
such external tools?
Even if I did migrate to other CPU in kernel handling the hotplug case,
it doesn't change anything,

I can try to handle the !HOTPLUG_CPU, i.e., untangle Kconfig mess
although its out of scope if you
insist, might need some time to get through Kconfig things sorted.

> Also, this REALLY looks like you are trying to fix the kernel for a
> crazy userspace program. Why not fix the userspace program instead?
> Isn't that easier and then that way it will work for any kernel version?

This isn't a bug fix but mostly a feature where we wouldn't want to open
multiple windows to see the logs.
Would you do the same thing for your usual uart console? i.e., open all
the 8 console (for 8 cpus) or 100s in
case of 100s of CPU cores and look through each of them? I think no, so
similarly anyone wouldn't want to
open 8/100 windows of Trace32 or other userspace application which
provides DCC functionality while debugging,
it's not good at all.

Also such feature requests do not go through for such tools, also there
isn't a requirement for them since DCC is per
core which is what they implement, its the **kernel which runs SMP**
which needs to handle this so it makes it easier
for the user to look at **kernel logs**, not Trace32 logs.

Also what would you do for other applications like Trace32? Send this
feature request to all those tools out there?
How would that work?

Thanks,
Sai

\
 
 \ /
  Last update: 2021-12-08 08:22    [W:0.045 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site