Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

mali: Avoid splitting lines across multiple printf calls #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

net147
Copy link
Contributor

@net147 net147 commented Mar 22, 2018

Signed-off-by: Jonathan Liu [email protected]

Prevents single lines from being shown as two lines in dmesg output with
newer Linux kernels.

Signed-off-by: Jonathan Liu <[email protected]>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more details about the issue would be nice here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added more details about the issue.

@net147
Copy link
Contributor Author

net147 commented Mar 29, 2018

Updated commit message in patch with more details.


-#define MALI_PRINT(args) do{ \
- MALI_PRINTF(("Mali: ")); \
- MALI_PRINTF(args); \
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MALI_PRINTF seems to be defined to _mali_osk_dbgmsg, which in turn is just a "glorified" printk.

If it's just about printing a prefix, maybe we can just define pr_fmt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is different prefix depending on debug level. Wouldn't that be more complex to handle with pr_fmt?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, indeed. As far as I can see, there's three cases: debug (MALI_DEBUG_PRINT), error (MALI_PRINT_ERROR), and "normal" (MALI_PRINT).

Maybe we can just use pr_err, pr_debug and pr_info, with pr_fmt set? That would simplify things a lot, while keeping the log levels.

Copy link
Contributor Author

@net147 net147 Apr 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ grep -hro 'MALI_DEBUG_PRINT([0-9]' r6p2 | sed 's/[^0-9]*//' | sort -u | xargs
1 2 3 4 5 6 7
Wouldn't we need a big switch statement in MALI_DEBUG_PRINT to call pr_alert, pr_crit, pr_err, pr_warn, pr_notice, pr_info, pr_debug according to the level argument?

The behavior and formatting of the debug level would also be changed by switching to pr_fmt.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if that wasn't really clear, I meant ignoring the log level in MALI_DEBUG_PRINT and just forward everything to pr_debug.

Copy link
Contributor Author

@net147 net147 May 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing MALI_PRINT_ERROR to use pr_debug would change the formatting so that all lines include the Mali prefix (using pr_fmt) instead of just the first line.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that really an issue though? That would cause an issue only with messages that are not ended by a \n, and as you mentionned already PR_CONT is deprecated now, and grepping through it, I don't really see a lot of them.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants