kpb: merge with cml-005-drop-stable#1672
Conversation
jajanusz
left a comment
There was a problem hiding this comment.
Looks good. It has just few minor style issues.
|
@mrajwa Please fix UT and checkpatch warnings, |
src/audio/kpb.c
Outdated
There was a problem hiding this comment.
Why do we need it? Every generic component API function operates on dev from which you can obtain comp_data, not other way around.
There was a problem hiding this comment.
@tlauda it is stored in component data so functions like buffering or draining can use it to finish requested reset. The reset procedure in KPB is a bit more complicated than it is in other components.
There was a problem hiding this comment.
I see it only used in kpb_buffer_data just to pass it to kpb_reset. You have function kpb_copy, which takes comp_dev and from comp_dev you are getting comp_data, which is passed to kpb_buffer_data, which needs to pass comp_dev retrieved from comp_data. It doesn't seem right to me.
src/audio/kpb.c
Outdated
There was a problem hiding this comment.
It's a little bit misleading. RESET_FINISH, but still we return EBUSY.
There was a problem hiding this comment.
I agree, what about KPB_STATE_RESET_FINISHING ?
src/audio/kpb.c
Outdated
There was a problem hiding this comment.
It would be better to check for ret < 0 in case the function will return some non-error positive status in the future.
There was a problem hiding this comment.
@tlauda but the point is kpb_buffer_data() will return non zero value only if there was some error. Sometimes it will return negative linux codes, sometimes positive sof errors like PPL_STATUS_PATH_STOP.
src/audio/kpb.c
Outdated
src/audio/kpb.c
Outdated
There was a problem hiding this comment.
Can you also add a little more detail in the commit message.
There was a problem hiding this comment.
@jajanusz corrected, @lgirdwood , commit message updated.
src/include/sof/audio/kpb.h
Outdated
There was a problem hiding this comment.
Is it read anywhere? Because in this patch I just saw it being only written to.
There was a problem hiding this comment.
New commits were pushed, there is the answer.
src/audio/kpb.c
Outdated
There was a problem hiding this comment.
Commit message needs to say why you are doing this.
src/audio/kpb.c
Outdated
There was a problem hiding this comment.
Do we have a state transition diagram like we do for generic components ? This is needed given the number of states we have in KPB.
There was a problem hiding this comment.
@lgirdwood, I am afraid we don't have such a diagram. These states are KPB internal, no other component or pipeline should be aware of it. The main purpose of these quite detailed states is to decide if we can reset/free KPB right away or should be postpone after we gracefully terminate current KPB task - draining or buffering states are a good example here. Secondly, since KPB is a heart of KWD its good to have such detailed states in regards to debugging - I am going to add a new patch which records last eight states of KPB. So every time something wrong happened we can check how KPB was changing its states.
src/audio/kpb.c
Outdated
There was a problem hiding this comment.
Probably worth a trace message here for debugability.
src/audio/kpb.c
Outdated
There was a problem hiding this comment.
Can you also add a little more detail in the commit message.
src/audio/kpb.c
Outdated
There was a problem hiding this comment.
checkpatch complains here about multiple blank lines
|
@lgirdwood @jajanusz please review as this is high priority PR which blocks upcoming release. |
This patch renames component data local variables name from 'cd' to 'kpb'. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch passes comp device pointer to buffering and draining function as this pointer is needed to finish reset requests. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
|
I had to temporarily disable cmocka test case regarding to local buffering as it is not capable to handle to do it right with latest changes. I will updated in next PR as there is no time for it before the release. |
jajanusz
left a comment
There was a problem hiding this comment.
please squash UT commit with change-introduction commit to not break git bisect
This change moves history buffer allocation from kpb_new() to kpb_prepare(). This is to folow the calling convention with kernel. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This change unregisters KPB from async notifications during kpb_free(). Additionally reset main history buffer pointer. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This commit adds more detailed states into KPB Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch takes care of secure reset. Now we check in what state KPB currently is. If this state involves some ongoing work like draining or buffering then KPB will register reset request and terminate this job gracefully. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This adds function to reset history buffer key pointers. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch takes care of secure reset while KPB is in buffering state. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch enables draining task to know how much data was buffered since draining task has been started. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch covers calculations of history depth based on sample container size rather than sample width itself. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch checks if KPB is in proper state beforeinitialize draining. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This change dma-copy type from blocking to normal. This is because blocking mode slows down draining considerably and from safety standpoint we cover it by period-interval now. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch introduces and calulates draining intervals as well as bytes limit per interval. It is all needed to synchronize firmware draining speed with host read speed. Basically in one period we fill half of host buffer and give host some time (period_interval) to read the data. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patchs logs requested draining length in milliseconds in kpb_init_draining() procedure. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch checks if host period size and well as host buffer size are sane and can be used for draining calculations. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patches moves the switch of KPB state from RUN to DRAINING at the time draining task starts. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch stops selector copy before draining starts. This is temporary change as driver should take care of it. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch adds a check in draining task for reset request. If it happened while we were draining then draining task shall me carefully terminated. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch makes calculation of time taken to drain history buffer more evident and clear. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch limit the speed of draining to the speed of host reads. We fill half of the host buffer and give a time of one period to read it. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch takes care of changing kpb buffer if last drained size made read pointer equal to buffer end address. This is important since in slow draining cases we might need to update history size by real time stream and therefore continue draining. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch checks if real time stream provided new data while we were draining. If so we need to continue draining that new data which are wainiting in history buffer. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch updates function kpb_drain_samples() which copies samples from history buffer to host buffer to support 24b & 32b samples. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch updates function kpb_copy_samples() which copies samples from KPB source buffer to sink buffer to support 24b & 32b samples. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch adds a check if history depth request is bigger than history buffer size. If so refuse to drain. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Draining task can take a long time depending on various params. This patch disables system agent which raises DSP PANIC in case firmware is hanged. However draining task can look to system agent in exactly the same manner thus we disable it right before draining task and reenable after draining is done. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch switches KPB into RUN state after prepare. This is expected state once KPB was properly initialized. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This patch makes kpb_copy() to return -EIO if it was called while KPB was in wrong state. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
|
@lgirdwood Your requests seem to be addressed |
|
As for checkpatch error, it can be ignored I believe. However the UT fail is a surprise to me as all of them passes on my machine. Looks like some random fail. I have triggered new verification. |
|
I was right it was random UT failure, after I retriggered QB the issue is gone. @jajanusz can we merge now? |
It wasn't UT failure. Py smoke tests failed because of connection problem to DUT platform ;) |
marc-hb
left a comment
There was a problem hiding this comment.
error: array subscript is above array bounds [-Werror=array-bounds]
sof/test/cmocka/src/audio/kpb/kpb_buffer.c:270:7:
tests[1].name = "KPB real time copy and buffering (Double Buffer)";
| int main(void) | ||
| { | ||
| struct CMUnitTest tests[2]; | ||
| struct CMUnitTest tests[1]; |
There was a problem hiding this comment.
error: array subscript is above array bounds [-Werror=array-bounds]
sof/test/cmocka/src/audio/kpb/kpb_buffer.c:270:7:
tests[1].name = "KPB real time copy and buffering (Double Buffer)";
etc.
This PR merges the KPB component to the state from KWD release (cml-005-drop-stable)
Signed-off-by: Marcin Rajwa marcin.rajwa@linux.intel.com