{"action":"created","issue":{"url":"https://api.github.com/repos/steve-o/openpgm/issues/35","repository_url":"https://api.github.com/repos/steve-o/openpgm","labels_url":"https://api.github.com/repos/steve-o/openpgm/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/steve-o/openpgm/issues/35/comments","events_url":"https://api.github.com/repos/steve-o/openpgm/issues/35/events","html_url":"https://github.com/steve-o/openpgm/issues/35","id":61869728,"number":35,"title":"Division by 0 in set_tsc_mul when /proc/cpuinfo reports 0.000 at cpu MHz","user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/steve-o/openpgm/labels/auto-migrated","name":"auto-migrated","color":"ededed"},{"url":"https://api.github.com/repos/steve-o/openpgm/labels/Priority-Medium","name":"Priority-Medium","color":"ededed"},{"url":"https://api.github.com/repos/steve-o/openpgm/labels/Type-Defect","name":"Type-Defect","color":"ededed"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-03-15T17:16:42Z","updated_at":"2016-02-29T17:13:28Z","closed_at":"2016-02-29T17:12:20Z","body":"```\nWhat steps will reproduce the problem?\n1. Running a kernel under qemu where TSC fails to calibrate against PIT \n(https://bugs.launchpad.net/ubuntu/+source/linux-goldfish/+bug/1318070)\n2. Call pgm_init (pgm_time_init)\n\nWhat is the expected output? What do you see instead?\n\nWhen /proc/cpuinfo contains a valid cpu MHz, it works fine. I know this is a \nkernel issue, but opening this bug here as well as the code shouldn't crash in \ncase MHz is 0.\n\nWhat version of the product are you using? On what operating system?\n\nlibpgm-5.1.118 - Ubuntu 14.10\n\nPlease provide any additional information below.\n\nFrom the code:\npgm_time_init (\n...\n        FILE    *fp = fopen (\"/proc/cpuinfo\", \"r\");\n        if (fp)\n        {\n            char buffer[1024];\n            while (!feof(fp) && fgets (buffer, sizeof(buffer), fp))\n            {\n                if (strstr (buffer, \"cpu MHz\")) {\n                    const char *p = strchr (buffer, ':');\n                    if (p) tsc_mhz = atoi (p + 1) * 1000;\n                    break;\n                }\n            }\n            fclose (fp);\n        }\n...\n#ifndef _WIN32\n/* calibrate */\n        if (0 >= tsc_mhz) {\n            pgm_error_t* sub_error = NULL;\n            if (!pgm_tsc_init (&sub_error)) {\n                pgm_propagate_error (error, sub_error);\n                goto err_cleanup;\n            }\n        }\n#endif\n        pgm_info (_(\"TSC frequency set to %u MHz\"), (unsigned)(tsc_mhz / 1000));\n        set_tsc_mul (tsc_mhz);\n    }\n...\n}\n\nIt calls pgm_tsc_init when tsc_mhz is 0, but that function will not run the \nbenchmark because it'll return before that gets executed (by checking the tsc \nand constant_tsc flags).\n\npgm_tsc_init (\n...\n     if (!flags || !strstr (flags, \" tsc\")) {\n        pgm_warn (_(\"Linux kernel reports no Time Stamp Counter (TSC).\"));\n/* force both to stable clocks even though one might be OK */\n        pgm_time_update_now = pgm_gettimeofday_update;\n        ret = TRUE;\n    } else if (!strstr (flags, \" constant_tsc\")) {\n        pgm_warn (_(\"Linux kernel reports non-constant Time Stamp Counter (TSC).\"));\n/* force both to stable clocks even though one might be OK */\n        pgm_time_update_now = pgm_gettimeofday_update;\n        ret = TRUE;\n    }\n..\n}\n```\n\nOriginal issue reported on code.google.com by `rsalv...@gmail.com` on 9 May 2014 at 10:27"},"comment":{"url":"https://api.github.com/repos/steve-o/openpgm/issues/comments/190295584","html_url":"https://github.com/steve-o/openpgm/issues/35#issuecomment-190295584","issue_url":"https://api.github.com/repos/steve-o/openpgm/issues/35","id":190295584,"user":{"login":"steve-o","id":258627,"avatar_url":"https://avatars.githubusercontent.com/u/258627?v=3","gravatar_id":"","url":"https://api.github.com/users/steve-o","html_url":"https://github.com/steve-o","followers_url":"https://api.github.com/users/steve-o/followers","following_url":"https://api.github.com/users/steve-o/following{/other_user}","gists_url":"https://api.github.com/users/steve-o/gists{/gist_id}","starred_url":"https://api.github.com/users/steve-o/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steve-o/subscriptions","organizations_url":"https://api.github.com/users/steve-o/orgs","repos_url":"https://api.github.com/users/steve-o/repos","events_url":"https://api.github.com/users/steve-o/events{/privacy}","received_events_url":"https://api.github.com/users/steve-o/received_events","type":"User","site_admin":false},"created_at":"2016-02-29T17:13:28Z","updated_at":"2016-02-29T17:13:28Z","body":"I removed the `static` prefix on the two added variables as any previous value is disregarded."}}