{"action":"created","comment":{"url":"https://api.github.com/repos/thesofproject/sof/pulls/comments/226769813","pull_request_review_id":166681229,"id":226769813,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNjc2OTgxMw==","diff_hunk":"@@ -365,34 +365,89 @@ void dma_trace_flush(void *t)\n \tdcache_writeback_invalidate_region((void *)t, size);\n }\n \n-static void dtrace_add_event(const char *e, uint32_t length)\n+static int dtrace_calc_buf_overflow(struct dma_trace_buf *buffer,\n+\tuint32_t length)\n {\n-\tstruct dma_trace_buf *buffer = &trace_data->dmatb;\n-\tint margin;\n+\tuint32_t margin;\n+\tuint32_t overflow_margin;\n+\tuint32_t overflow = 0;\n \n \tmargin = buffer->end_addr - buffer->w_ptr;\n \n-\t/* check for buffer wrap */\n-\tif (margin > length) {\n-\t\t/* no wrap */\n-\t\tmemcpy(buffer->w_ptr, e, length);\n-\t\tdcache_writeback_invalidate_region(buffer->w_ptr, length);\n-\t\tbuffer->w_ptr += length;\n-\t} else {\n+\t/* overflow calculating */\n+\tif (buffer->w_ptr < buffer->r_ptr)\n+\t\toverflow_margin = buffer->r_ptr - buffer->w_ptr;\n+\telse\n+\t\toverflow_margin = margin + buffer->r_ptr - buffer->addr;\n+\n+\tif (overflow_margin < length)\n+\t\toverflow = length - overflow_margin;\n \n-\t\t/* data is bigger than remaining margin so we wrap */\n-\t\tmemcpy(buffer->w_ptr, e, margin);\n-\t\tdcache_writeback_invalidate_region(buffer->w_ptr, margin);\n-\t\tbuffer->w_ptr = buffer->addr;\n+\treturn overflow;\n+}\n \n-\t\tmemcpy(buffer->w_ptr, e + margin, length - margin);\n-\t\tdcache_writeback_invalidate_region(buffer->w_ptr,\n-\t\t\t\t\t\t   length - margin);\n-\t\tbuffer->w_ptr += length - margin;\n+static void dtrace_add_event(const char *e, uint32_t length)\n+{\n+\tstruct dma_trace_buf *buffer = &trace_data->dmatb;\n+\tuint32_t margin;\n+\tuint32_t overflow = 0;\n+\n+\t/* amount of dropped entries */\n+\tstatic uint32_t dropped_entries;","path":"src/lib/dma-trace.c","position":50,"original_position":50,"commit_id":"ebec6aba69ace983f372bf6fd5d845a1c0bba7f9","original_commit_id":"ebec6aba69ace983f372bf6fd5d845a1c0bba7f9","user":{"login":"lgirdwood","id":12020523,"node_id":"MDQ6VXNlcjEyMDIwNTIz","avatar_url":"https://avatars0.githubusercontent.com/u/12020523?v=4","gravatar_id":"","url":"https://api.github.com/users/lgirdwood","html_url":"https://github.com/lgirdwood","followers_url":"https://api.github.com/users/lgirdwood/followers","following_url":"https://api.github.com/users/lgirdwood/following{/other_user}","gists_url":"https://api.github.com/users/lgirdwood/gists{/gist_id}","starred_url":"https://api.github.com/users/lgirdwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lgirdwood/subscriptions","organizations_url":"https://api.github.com/users/lgirdwood/orgs","repos_url":"https://api.github.com/users/lgirdwood/repos","events_url":"https://api.github.com/users/lgirdwood/events{/privacy}","received_events_url":"https://api.github.com/users/lgirdwood/received_events","type":"User","site_admin":false},"body":"static variables should be declared at the top of the file.","created_at":"2018-10-19T20:18:02Z","updated_at":"2018-10-19T20:18:52Z","html_url":"https://github.com/thesofproject/sof/pull/498#discussion_r226769813","pull_request_url":"https://api.github.com/repos/thesofproject/sof/pulls/498","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/thesofproject/sof/pulls/comments/226769813"},"html":{"href":"https://github.com/thesofproject/sof/pull/498#discussion_r226769813"},"pull_request":{"href":"https://api.github.com/repos/thesofproject/sof/pulls/498"}}},"pull_request":{"url":"https://api.github.com/repos/thesofproject/sof/pulls/498","id":224236994,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI0MjM2OTk0","html_url":"https://github.com/thesofproject/sof/pull/498","diff_url":"https://github.com/thesofproject/sof/pull/498.diff","patch_url":"https://github.com/thesofproject/sof/pull/498.patch","issue_url":"https://api.github.com/repos/thesofproject/sof/issues/498","number":498,"state":"open","locked":false,"title":"dma-trace: handling dma trace buffer overflow","user":{"login":"bkokoszx","id":41052777,"node_id":"MDQ6VXNlcjQxMDUyNzc3","avatar_url":"https://avatars3.githubusercontent.com/u/41052777?v=4","gravatar_id":"","url":"https://api.github.com/users/bkokoszx","html_url":"https://github.com/bkokoszx","followers_url":"https://api.github.com/users/bkokoszx/followers","following_url":"https://api.github.com/users/bkokoszx/following{/other_user}","gists_url":"https://api.github.com/users/bkokoszx/gists{/gist_id}","starred_url":"https://api.github.com/users/bkokoszx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bkokoszx/subscriptions","organizations_url":"https://api.github.com/users/bkokoszx/orgs","repos_url":"https://api.github.com/users/bkokoszx/repos","events_url":"https://api.github.com/users/bkokoszx/events{/privacy}","received_events_url":"https://api.github.com/users/bkokoszx/received_events","type":"User","site_admin":false},"body":"In dtrace_add_event function I've added handling\r\ndma trace buffer overflow. If there is not enough\r\nmemory, log will be dropped. Amount of dropped entries\r\nis counted and it will be logged.\r\n\r\nSigned-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>","created_at":"2018-10-19T10:14:44Z","updated_at":"2018-10-19T20:18:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bb7ee0e8fb4b5a55da861e54d6c589fefe1e0b74","assignee":null,"assignees":[],"requested_reviewers":[{"login":"mmaka1","id":40028148,"node_id":"MDQ6VXNlcjQwMDI4MTQ4","avatar_url":"https://avatars3.githubusercontent.com/u/40028148?v=4","gravatar_id":"","url":"https://api.github.com/users/mmaka1","html_url":"https://github.com/mmaka1","followers_url":"https://api.github.com/users/mmaka1/followers","following_url":"https://api.github.com/users/mmaka1/following{/other_user}","gists_url":"https://api.github.com/users/mmaka1/gists{/gist_id}","starred_url":"https://api.github.com/users/mmaka1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmaka1/subscriptions","organizations_url":"https://api.github.com/users/mmaka1/orgs","repos_url":"https://api.github.com/users/mmaka1/repos","events_url":"https://api.github.com/users/mmaka1/events{/privacy}","received_events_url":"https://api.github.com/users/mmaka1/received_events","type":"User","site_admin":false},{"login":"akloniex","id":42469949,"node_id":"MDQ6VXNlcjQyNDY5OTQ5","avatar_url":"https://avatars1.githubusercontent.com/u/42469949?v=4","gravatar_id":"","url":"https://api.github.com/users/akloniex","html_url":"https://github.com/akloniex","followers_url":"https://api.github.com/users/akloniex/followers","following_url":"https://api.github.com/users/akloniex/following{/other_user}","gists_url":"https://api.github.com/users/akloniex/gists{/gist_id}","starred_url":"https://api.github.com/users/akloniex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akloniex/subscriptions","organizations_url":"https://api.github.com/users/akloniex/orgs","repos_url":"https://api.github.com/users/akloniex/repos","events_url":"https://api.github.com/users/akloniex/events{/privacy}","received_events_url":"https://api.github.com/users/akloniex/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/thesofproject/sof/pulls/498/commits","review_comments_url":"https://api.github.com/repos/thesofproject/sof/pulls/498/comments","review_comment_url":"https://api.github.com/repos/thesofproject/sof/pulls/comments{/number}","comments_url":"https://api.github.com/repos/thesofproject/sof/issues/498/comments","statuses_url":"https://api.github.com/repos/thesofproject/sof/statuses/ebec6aba69ace983f372bf6fd5d845a1c0bba7f9","head":{"label":"bkokoszx:dma-buffer-overflow","ref":"dma-buffer-overflow","sha":"ebec6aba69ace983f372bf6fd5d845a1c0bba7f9","user":{"login":"bkokoszx","id":41052777,"node_id":"MDQ6VXNlcjQxMDUyNzc3","avatar_url":"https://avatars3.githubusercontent.com/u/41052777?v=4","gravatar_id":"","url":"https://api.github.com/users/bkokoszx","html_url":"https://github.com/bkokoszx","followers_url":"https://api.github.com/users/bkokoszx/followers","following_url":"https://api.github.com/users/bkokoszx/following{/other_user}","gists_url":"https://api.github.com/users/bkokoszx/gists{/gist_id}","starred_url":"https://api.github.com/users/bkokoszx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bkokoszx/subscriptions","organizations_url":"https://api.github.com/users/bkokoszx/orgs","repos_url":"https://api.github.com/users/bkokoszx/repos","events_url":"https://api.github.com/users/bkokoszx/events{/privacy}","received_events_url":"https://api.github.com/users/bkokoszx/received_events","type":"User","site_admin":false},"repo":{"id":140412184,"node_id":"MDEwOlJlcG9zaXRvcnkxNDA0MTIxODQ=","name":"sof","full_name":"bkokoszx/sof","private":false,"owner":{"login":"bkokoszx","id":41052777,"node_id":"MDQ6VXNlcjQxMDUyNzc3","avatar_url":"https://avatars3.githubusercontent.com/u/41052777?v=4","gravatar_id":"","url":"https://api.github.com/users/bkokoszx","html_url":"https://github.com/bkokoszx","followers_url":"https://api.github.com/users/bkokoszx/followers","following_url":"https://api.github.com/users/bkokoszx/following{/other_user}","gists_url":"https://api.github.com/users/bkokoszx/gists{/gist_id}","starred_url":"https://api.github.com/users/bkokoszx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bkokoszx/subscriptions","organizations_url":"https://api.github.com/users/bkokoszx/orgs","repos_url":"https://api.github.com/users/bkokoszx/repos","events_url":"https://api.github.com/users/bkokoszx/events{/privacy}","received_events_url":"https://api.github.com/users/bkokoszx/received_events","type":"User","site_admin":false},"html_url":"https://github.com/bkokoszx/sof","description":"Sound Open Firmware","fork":true,"url":"https://api.github.com/repos/bkokoszx/sof","forks_url":"https://api.github.com/repos/bkokoszx/sof/forks","keys_url":"https://api.github.com/repos/bkokoszx/sof/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bkokoszx/sof/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bkokoszx/sof/teams","hooks_url":"https://api.github.com/repos/bkokoszx/sof/hooks","issue_events_url":"https://api.github.com/repos/bkokoszx/sof/issues/events{/number}","events_url":"https://api.github.com/repos/bkokoszx/sof/events","assignees_url":"https://api.github.com/repos/bkokoszx/sof/assignees{/user}","branches_url":"https://api.github.com/repos/bkokoszx/sof/branches{/branch}","tags_url":"https://api.github.com/repos/bkokoszx/sof/tags","blobs_url":"https://api.github.com/repos/bkokoszx/sof/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bkokoszx/sof/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bkokoszx/sof/git/refs{/sha}","trees_url":"https://api.github.com/repos/bkokoszx/sof/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bkokoszx/sof/statuses/{sha}","languages_url":"https://api.github.com/repos/bkokoszx/sof/languages","stargazers_url":"https://api.github.com/repos/bkokoszx/sof/stargazers","contributors_url":"https://api.github.com/repos/bkokoszx/sof/contributors","subscribers_url":"https://api.github.com/repos/bkokoszx/sof/subscribers","subscription_url":"https://api.github.com/repos/bkokoszx/sof/subscription","commits_url":"https://api.github.com/repos/bkokoszx/sof/commits{/sha}","git_commits_url":"https://api.github.com/repos/bkokoszx/sof/git/commits{/sha}","comments_url":"https://api.github.com/repos/bkokoszx/sof/comments{/number}","issue_comment_url":"https://api.github.com/repos/bkokoszx/sof/issues/comments{/number}","contents_url":"https://api.github.com/repos/bkokoszx/sof/contents/{+path}","compare_url":"https://api.github.com/repos/bkokoszx/sof/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bkokoszx/sof/merges","archive_url":"https://api.github.com/repos/bkokoszx/sof/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bkokoszx/sof/downloads","issues_url":"https://api.github.com/repos/bkokoszx/sof/issues{/number}","pulls_url":"https://api.github.com/repos/bkokoszx/sof/pulls{/number}","milestones_url":"https://api.github.com/repos/bkokoszx/sof/milestones{/number}","notifications_url":"https://api.github.com/repos/bkokoszx/sof/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bkokoszx/sof/labels{/name}","releases_url":"https://api.github.com/repos/bkokoszx/sof/releases{/id}","deployments_url":"https://api.github.com/repos/bkokoszx/sof/deployments","created_at":"2018-07-10T09:54:02Z","updated_at":"2018-08-21T15:13:30Z","pushed_at":"2018-10-19T07:30:38Z","git_url":"git://github.com/bkokoszx/sof.git","ssh_url":"git@github.com:bkokoszx/sof.git","clone_url":"https://github.com/bkokoszx/sof.git","svn_url":"https://github.com/bkokoszx/sof","homepage":null,"size":3908,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"thesofproject:master","ref":"master","sha":"459ccd2d65b1c869a400972b837f746d545ebb8d","user":{"login":"thesofproject","id":39773507,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5NzczNTA3","avatar_url":"https://avatars1.githubusercontent.com/u/39773507?v=4","gravatar_id":"","url":"https://api.github.com/users/thesofproject","html_url":"https://github.com/thesofproject","followers_url":"https://api.github.com/users/thesofproject/followers","following_url":"https://api.github.com/users/thesofproject/following{/other_user}","gists_url":"https://api.github.com/users/thesofproject/gists{/gist_id}","starred_url":"https://api.github.com/users/thesofproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thesofproject/subscriptions","organizations_url":"https://api.github.com/users/thesofproject/orgs","repos_url":"https://api.github.com/users/thesofproject/repos","events_url":"https://api.github.com/users/thesofproject/events{/privacy}","received_events_url":"https://api.github.com/users/thesofproject/received_events","type":"Organization","site_admin":false},"repo":{"id":135623245,"node_id":"MDEwOlJlcG9zaXRvcnkxMzU2MjMyNDU=","name":"sof","full_name":"thesofproject/sof","private":false,"owner":{"login":"thesofproject","id":39773507,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5NzczNTA3","avatar_url":"https://avatars1.githubusercontent.com/u/39773507?v=4","gravatar_id":"","url":"https://api.github.com/users/thesofproject","html_url":"https://github.com/thesofproject","followers_url":"https://api.github.com/users/thesofproject/followers","following_url":"https://api.github.com/users/thesofproject/following{/other_user}","gists_url":"https://api.github.com/users/thesofproject/gists{/gist_id}","starred_url":"https://api.github.com/users/thesofproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thesofproject/subscriptions","organizations_url":"https://api.github.com/users/thesofproject/orgs","repos_url":"https://api.github.com/users/thesofproject/repos","events_url":"https://api.github.com/users/thesofproject/events{/privacy}","received_events_url":"https://api.github.com/users/thesofproject/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/thesofproject/sof","description":"Sound Open Firmware","fork":false,"url":"https://api.github.com/repos/thesofproject/sof","forks_url":"https://api.github.com/repos/thesofproject/sof/forks","keys_url":"https://api.github.com/repos/thesofproject/sof/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thesofproject/sof/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thesofproject/sof/teams","hooks_url":"https://api.github.com/repos/thesofproject/sof/hooks","issue_events_url":"https://api.github.com/repos/thesofproject/sof/issues/events{/number}","events_url":"https://api.github.com/repos/thesofproject/sof/events","assignees_url":"https://api.github.com/repos/thesofproject/sof/assignees{/user}","branches_url":"https://api.github.com/repos/thesofproject/sof/branches{/branch}","tags_url":"https://api.github.com/repos/thesofproject/sof/tags","blobs_url":"https://api.github.com/repos/thesofproject/sof/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thesofproject/sof/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thesofproject/sof/git/refs{/sha}","trees_url":"https://api.github.com/repos/thesofproject/sof/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thesofproject/sof/statuses/{sha}","languages_url":"https://api.github.com/repos/thesofproject/sof/languages","stargazers_url":"https://api.github.com/repos/thesofproject/sof/stargazers","contributors_url":"https://api.github.com/repos/thesofproject/sof/contributors","subscribers_url":"https://api.github.com/repos/thesofproject/sof/subscribers","subscription_url":"https://api.github.com/repos/thesofproject/sof/subscription","commits_url":"https://api.github.com/repos/thesofproject/sof/commits{/sha}","git_commits_url":"https://api.github.com/repos/thesofproject/sof/git/commits{/sha}","comments_url":"https://api.github.com/repos/thesofproject/sof/comments{/number}","issue_comment_url":"https://api.github.com/repos/thesofproject/sof/issues/comments{/number}","contents_url":"https://api.github.com/repos/thesofproject/sof/contents/{+path}","compare_url":"https://api.github.com/repos/thesofproject/sof/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thesofproject/sof/merges","archive_url":"https://api.github.com/repos/thesofproject/sof/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thesofproject/sof/downloads","issues_url":"https://api.github.com/repos/thesofproject/sof/issues{/number}","pulls_url":"https://api.github.com/repos/thesofproject/sof/pulls{/number}","milestones_url":"https://api.github.com/repos/thesofproject/sof/milestones{/number}","notifications_url":"https://api.github.com/repos/thesofproject/sof/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thesofproject/sof/labels{/name}","releases_url":"https://api.github.com/repos/thesofproject/sof/releases{/id}","deployments_url":"https://api.github.com/repos/thesofproject/sof/deployments","created_at":"2018-05-31T18:51:03Z","updated_at":"2018-10-19T20:16:33Z","pushed_at":"2018-10-19T20:16:30Z","git_url":"git://github.com/thesofproject/sof.git","ssh_url":"git@github.com:thesofproject/sof.git","clone_url":"https://github.com/thesofproject/sof.git","svn_url":"https://github.com/thesofproject/sof","homepage":null,"size":3961,"stargazers_count":19,"watchers_count":19,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":41,"mirror_url":null,"archived":false,"open_issues_count":40,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":41,"open_issues":40,"watchers":19,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/thesofproject/sof/pulls/498"},"html":{"href":"https://github.com/thesofproject/sof/pull/498"},"issue":{"href":"https://api.github.com/repos/thesofproject/sof/issues/498"},"comments":{"href":"https://api.github.com/repos/thesofproject/sof/issues/498/comments"},"review_comments":{"href":"https://api.github.com/repos/thesofproject/sof/pulls/498/comments"},"review_comment":{"href":"https://api.github.com/repos/thesofproject/sof/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/thesofproject/sof/pulls/498/commits"},"statuses":{"href":"https://api.github.com/repos/thesofproject/sof/statuses/ebec6aba69ace983f372bf6fd5d845a1c0bba7f9"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"lgirdwood"}}