Skip to content

ipc: remove waiti running in IRQ level higher than passive level - #335

Merged
lgirdwood merged 1 commit into
thesofproject:stable-1.2from
RanderWang:waiti_1.2
Sep 17, 2018
Merged

lgirdwood merged 1 commit into
thesofproject:stable-1.2from
RanderWang:waiti_1.2

Conversation

@RanderWang

Copy link
Copy Markdown
Collaborator

waiti would cause FW panic if it is called in irq level
higher than passive level

Signed-off-by: Rander Wang rander.wang@linux.intel.com

Comment thread src/ipc/ipc.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

you need to idelay(TIMEOUT / TRIES); Make tries a macro.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

PLATFORM_HOST_DMA_TRIES

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ok, I will refine my patch

Comment thread src/ipc/ipc.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

compare this to TRIES macro

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ok, I will refine my patch

Comment thread src/ipc/ipc.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

trace_error needed here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ok, I will refine my patch

@RanderWang

Copy link
Copy Markdown
Collaborator Author

update my patch, thanks for review

Comment thread src/include/sof/wait.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

int clk should be named delay_ms or delay_us depending on time measurement.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yes, I will refine my patch

Comment thread src/include/sof/wait.h Outdated

@lgirdwood lgirdwood Sep 11, 2018 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

clk must be divided by tries. otherwise we will wait for multiples of the timeout and not the timeout.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yes, I will refine my patch

@RanderWang

Copy link
Copy Markdown
Collaborator Author

update my patch, thanks for review

Comment thread src/include/sof/wait.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why not pass the completion_t here instead of a callback, makes it simpler

@RanderWang RanderWang Sep 12, 2018 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

because in some cases, there are no completion, just like waiting for a register idle

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

please refer to my second commit in this PR

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

waiting for a register is called polling, and this is probably better named poll_for_condition_timeout()

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I just want to make a generic solution. Ok, I will refine my patch

@RanderWang

Copy link
Copy Markdown
Collaborator Author

update my patch, thanks for review

Comment thread src/include/sof/wait.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why did you remove the tries ? and while loop ? This will now block for timeout and be horribly inefficient. We need to try an return as soon as condition completes.

@RanderWang
RanderWang force-pushed the waiti_1.2 branch 2 times, most recently from 5c014b8 to 6f355a7 Compare September 13, 2018 08:04
@RanderWang

Copy link
Copy Markdown
Collaborator Author

update my patch, thanks for review

Comment thread src/include/sof/wait.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

while (tries--)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yes, it is good for me

Comment thread src/include/sof/wait.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

how do we guarantee delta is not 0 ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

en, a very tricky corner case, I will refine it.

Comment thread src/include/sof/wait.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

poll_for_completion_delay

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

get it

Comment thread src/include/sof/wait.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

return 0;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

get it

@RanderWang

Copy link
Copy Markdown
Collaborator Author

update my patch, thanks for review

Comment thread src/include/sof/wait.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

us should be unsigned

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

get it

Comment thread src/include/sof/wait.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

clock_us_to_ticks returns a uint64_t

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

get it

Comment thread src/include/sof/wait.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

make tries and delta unsigned

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

get it

Comment thread src/include/sof/wait.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should not delay if completion is initially true. This is better.

while (!wait_is_completed(comp)) {
	
	if (!tries--) {
		trace_error();
		return error
	}
		
	delay();
}

return 0;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

get it

waiti would cause FW panic if it is called in irq level
higher than passive level

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
Comment thread src/include/sof/wait.h

static inline int poll_for_completion_delay(completion_t *comp, uint64_t us)
{
uint64_t tick = clock_us_to_ticks(CLK_CPU, us);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@RanderWang @lgirdwood I think this function won't work correctly, because on cAVS platforms wait_delay function is based on XTAL (e.g. 19.2 MHZ for APL) and CLK_CPU has entirely different freq.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@RanderWang can you fix, use the PLATFORM_CLK thet we use fr work/scheduling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants