| Summary: | oprofile-viewer connect to oprofile-server takes forever for PPC | ||
|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] Meta-yocto | Reporter: | Jessica <jessica.zhang> |
| Component: | meta-yocto | Assignee: | Lianhao Lu <lianhao.lu> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | Medium | CC: | josh, kevin.tian, lianhao.lu, liping.ke, poky.bs.watcher, poky.watcher, richard.purdie, sgw |
| Version: | 1.0 | ||
| Target Milestone: | 1.0 M2 | ||
| Hardware: | x86 | ||
| OS: | Multiple | ||
| Whiteboard: | |||
| OS type for building Yocto: | --- | Type of Regression: | --- |
| Verified: | Program Management | Documentation change: | --- |
| Attachments: | |||
|
Description
Jessica
2010-10-01 10:27:02 UTC
This is a bug in both oprofile-server & oprofile-viewer. It happens when the host and target architectures have different endians. The protocol used between oprofile-server & oprofile-viewer seems not defines the endian format, so both ther server & viewer treats the integer fields in the protocol packet in their native endian. This incompatibility causes this bug. (In reply to comment #1) > This is a bug in both oprofile-server & oprofile-viewer. It happens when the > host and target architectures have different endians. The protocol used between > oprofile-server & oprofile-viewer seems not defines the endian format, so both > ther server & viewer treats the integer fields in the protocol packet in their > native endian. This incompatibility causes this bug. Thanks a lot to Lianhao's analysis! Let me make the bug's cause clearer: 1) ppc is big-endian system, so the binary oprofile-server in the target is build with big-endian; 2) Lianhao is corss-debugging the ppc target from an i386 system, so he builds a little-endian binary oprofile-viewer and uses it; 3) Because in oprofile-ui, the codes of oprofile-server and oprofile-viewer don't consider the conversion between host byte order and network byte order (Big-endian order) at all, so Lianhao gets the bug. Looks this is a desgin issue of oprofileui -- no cross-debugging was considered at all? Maybe we should implement some macros like cpu_to_be and be_to_cpu and fix every places when oprofile-server/viewer sending/recving data to/from socket? BTW: I heard arm and mips systems could be configured to either big-endian or little-endian? Hi Josh, looks you were a main contributor to oprofile-ui. Could you please give some suggestions? Thanks a lot! Hi Jessia, I saw you changed "Target Milestone" from "1.0 M1" to "0.9 M4". Do you mean we should still fix this bug in 0.9? No, just bring it back to make it documented in the release note. Lianhao would like to fix it, so let me re-assign back to him now. :-) Created attachment 69 [details] 0001-Fixed-bug-382-and-other-critical-errors This patch should be applied to oprofileUI svn rev 197 plus the patch of bug#493.(http://bugzilla.pokylinux.org/attachment.cgi?id=67) 1. Changed packet layout comptible for common network packet layout, and upgraded the protocol version to 5. 2. Changed server/client code to do endian conversion between host/net endian of integer field of protocol packet. 3. In client, fixed an original array dereference error when it needed multiple read operations to get a full response header. 4. In client, fixed an original error happened in the archive->filestat->get command chain. The error happened due to the mismatch of command and response. 5. In both server/code, fixed an error of misusing memset. The patch is put here temporarily until we get it upstreamed. Hi Lianhao, First of all great work, some excellent debugging and bug fixes here. As per bug#493 could you please adapt the patch to follow the style of the rest of the code. Specifically: * the return type of a function should be on the line above the function name * ensure there are spaces before opening brackets, ('s * ensure there are spaces around = * Please use C style (/* foo */) rather than 'C++'/C99 style (//) comments * Ensure there are spaces between the comment symbol and them comment (i.e. // some comment and not //a comment * The comments could be more informative - telling me what the code does is generally not very helpful, please explain why the code does that if there's a need to comment :-) * Braces should be indented two spaces * Please use a space after argument separators (,'s) * As you've used g_warning() to print warning messages it seems right that g_debug() should be used in place of printf() for printing debug messages. That way you get the benefit of not polluting logs with debug messages on most systems. IIRC g_debug() also takes care of newlines Also please check your patches for accidental introduction of inconsistent whitespaces, such as Ln696 in the patched server/opserver.c Created attachment 74 [details] Patch for bug 382 and other critical errors This patch should be applied to oprofileUI svn rev 197 plus the patch of bug#493.(http://bugzilla.pokylinux.org/attachment.cgi?id=73) This patch added coding style fixing to the obsoleted patch which was committed in comment #6. See comment #6 for details. Thanks, this is looking better but you still have some incorrect indentation in places, such as line 112 in utils.c: http://bugzilla.pokylinux.org/attachment.cgi?id=74&action=diff#a/protocol/util.c_sec2 Created attachment 75 [details] Patch for bug 382 and other critical errors This patch should be applied to oprofileUI svn rev 197 plus the patch of bug#493.(http://bugzilla.pokylinux.org/attachment.cgi?id=73) This patch added coding style fixing to the obsoleted patch which was committed in comment #6. Added spaces around "=". Created attachment 77 [details] Patch for bug 382 and other critical errors This patch should be applied to oprofileUI svn rev 197 plus the patch of bug#493.(http://bugzilla.pokylinux.org/attachment.cgi?id=73) This patch added coding style fixing to the obsoleted patch.(using 2 whitespace indentation instead of 4). See comment #6 for details. Merged into the new oprofileui git repo verified 12-13-10 |