[960GM/U3S3 FX] Higher than expected cpu overhead on using multiple cores

Bug #1073148 reported by Removed by request
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linux
Unknown
Unknown
linux (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

I'm using Ubuntu 13.04 dev and have noticed a high cpu overhead if a process is using multiple threads and computing them on different cores. To measure this I have written a little script in Python which I will attach.

The script will create 2 threads which are using only a little time of a cpu core. On my AMD Phenom II X6 1045T the Linux kernel will assign the 2 threads on 2 cores which will use a total cpu time of 40% from a maximum of 600%. But if I'm using "taskset -ap 0x00000001 pid_of_script" the 2 threads will be assigned to 1 core and the total cpu usage will be only 25% from 600%.

I'm wondering why there is a cpu overhead of 60% if the Linux kernel is using 2 cores instead of 1 core.
---
AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.25.
AplayDevices:
 **** List of PLAYBACK Hardware Devices ****
 card 0: SB [HDA ATI SB], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog]
   Subdevices: 0/1
   Subdevice #0: subdevice #0
ApportVersion: 2.6.1-0ubuntu6
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: sworddragon 2374 F.... plugin-containe
 /dev/snd/pcmC0D0p: sworddragon 2374 F...m plugin-containe
 /dev/snd/timer: sworddragon 2374 f.... plugin-containe
CRDA: Error: [Errno 2] No such file or directory
Card0.Amixer.info:
 Card hw:0 'SB'/'HDA ATI SB at 0xf9ff4000 irq 16'
   Mixer name : 'Realtek ALC662 rev1'
   Components : 'HDA:10ec0662,18497662,00100101'
   Controls : 33
   Simple ctrls : 18
CurrentDmesg:
 Error: command ['sh', '-c', 'dmesg | comm -13 --nocheck-order /var/log/dmesg -'] failed with exit code 1: comm: /var/log/dmesg: No such file or directory
 dmesg: write failed: Broken pipe
DistroRelease: Ubuntu 13.04
EcryptfsInUse: Yes
IwConfig: Error: [Errno 2] No such file or directory
Lsusb: Error: [Errno 2] No such file or directory
MachineType: To Be Filled By O.E.M. To Be Filled By O.E.M.
MarkForUpload: True
NonfreeKernelModules: nvidia
Package: linux (not installed)
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 LANG=de_DE.UTF-8
 SHELL=/bin/bash
ProcFB: 0 VESA VGA
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.5.0-17-generic root=UUID=f1ce7323-74dc-46f7-95f7-887cc54403e7 ro
ProcVersionSignature: Ubuntu 3.5.0-17.28-generic 3.5.5
RfKill: Error: [Errno 2] No such file or directory
Tags: raring
Uname: Linux 3.5.0-17-generic x86_64
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dialout lpadmin plugdev sambashare sudo
dmi.bios.date: 05/21/2012
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: P1.20
dmi.board.asset.tag: BC5FF4739C55
dmi.board.name: 960GM/U3S3 FX
dmi.board.vendor: ASRock
dmi.chassis.asset.tag: To Be Filled By O.E.M.
dmi.chassis.type: 3
dmi.chassis.vendor: To Be Filled By O.E.M.
dmi.chassis.version: To Be Filled By O.E.M.
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvrP1.20:bd05/21/2012:svnToBeFilledByO.E.M.:pnToBeFilledByO.E.M.:pvrToBeFilledByO.E.M.:rvnASRock:rn960GM/U3S3FX:rvr:cvnToBeFilledByO.E.M.:ct3:cvrToBeFilledByO.E.M.:
dmi.product.name: To Be Filled By O.E.M.
dmi.product.version: To Be Filled By O.E.M.
dmi.sys.vendor: To Be Filled By O.E.M.

Revision history for this message
Brad Figg (brad-figg) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. From a terminal window please run:

apport-collect 1073148

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Changed in linux (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Joseph Salisbury (jsalisbury) wrote : Re: High cpu overhead on using multiple cores

Would it be possible for you to test the latest upstream kernel? Refer to https://wiki.ubuntu.com/KernelMainlineBuilds . Please test the latest v3.7 kernel[0] (Not a kernel in the daily directory) and install both the linux-image and linux-image-extra .deb packages.

Once you've tested the upstream kernel, please remove the 'needs-upstream-testing' tag. Please only remove that one tag and leave the other tags. This can be done by clicking on the yellow pencil icon next to the tag located at the bottom of the bug description and deleting the 'needs-upstream-testing' text.

If this bug is fixed in the mainline kernel, please add the following tag 'kernel-fixed-upstream'.

If the mainline kernel does not fix this bug, please add the tag: 'kernel-bug-exists-upstream'.

If you are unable to test the mainline kernel, for example it will not boot, please add the tag: 'kernel-unable-to-test-upstream'.
Once testing of the upstream kernel is complete, please mark this bug as "Confirmed".

Thanks in advance.

[0] http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.7-rc2-raring/

tags: added: raring
tags: added: needs-upstream-testing
Revision history for this message
Removed by request (removed3425744) wrote : AlsaDevices.txt

apport information

tags: added: apport-collected
description: updated
Revision history for this message
Removed by request (removed3425744) wrote : ArecordDevices.txt

apport information

Revision history for this message
Removed by request (removed3425744) wrote : Card0.Amixer.values.txt

apport information

Revision history for this message
Removed by request (removed3425744) wrote : Card0.Codecs.codec.0.txt

apport information

Revision history for this message
Removed by request (removed3425744) wrote : Lspci.txt

apport information

Revision history for this message
Removed by request (removed3425744) wrote : PciMultimedia.txt

apport information

Revision history for this message
Removed by request (removed3425744) wrote : ProcCpuinfo.txt

apport information

Revision history for this message
Removed by request (removed3425744) wrote : ProcInterrupts.txt

apport information

Revision history for this message
Removed by request (removed3425744) wrote : ProcModules.txt

apport information

Revision history for this message
Removed by request (removed3425744) wrote : UdevDb.txt

apport information

Revision history for this message
Removed by request (removed3425744) wrote : UdevLog.txt

apport information

Revision history for this message
Removed by request (removed3425744) wrote : WifiSyslog.txt

apport information

tags: added: kernel-unable-to-test-upstream
removed: needs-upstream-testing
Changed in linux (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Removed by request (removed3425744) wrote : Re: High cpu overhead on using multiple cores

I have tested this now with linux-image-3.7.0-0-generic and the bug exists there too.

tags: removed: kernel-unable-to-test-upstream
Revision history for this message
Joseph Salisbury (jsalisbury) wrote :

This issue appears to be an upstream bug, since you tested the latest upstream kernel. Would it be possible for you to open an upstream bug report[0]? That will allow the upstream Developers to examine the issue, and may provide a quicker resolution to the bug.

Please follow the instructions on the wiki page[0]. The first step is to email the appropriate mailing list. If no response is received, then a bug may be opened on bugzilla.kernel.org.

[0] https://wiki.ubuntu.com/Bugs/Upstream/kernel

Changed in linux (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
Removed by request (removed3425744) wrote :

> This issue appears to be an upstream bug, since you tested the latest upstream kernel.

I got the information in another ticket that the kernel from the Ubuntu repository could contain patches which are not in the upstream kernel.

tags: added: kernel-unable-to-test-upstream
Revision history for this message
Joseph Salisbury (jsalisbury) wrote : Unsupported series, setting status to "Won't Fix".

This bug was filed against a series that is no longer supported and so is being marked as Won't Fix. If this issue still exists in a supported series, please file a new bug.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: Triaged → Won't Fix
Revision history for this message
Removed by request (removed3425744) wrote : Re: High cpu overhead on using multiple cores

Is your bot not working correct? The 3.7 kernel is currently the newest kernel.

Changed in linux (Ubuntu):
status: Won't Fix → Triaged
Revision history for this message
Joseph Salisbury (jsalisbury) wrote :

@Sworddragon,

Yes, the script made a mistake in comment #19.

Do you happen to have a link to the other ticket that talks about possible patches in the Ubuntu repositories from comment #18

Revision history for this message
Removed by request (removed3425744) wrote :
Revision history for this message
Joseph Salisbury (jsalisbury) wrote :

@Sworddragon,

I think that comment was only explaining the difference between the upstream kernel, like I mention in comment #3 and the official Ubuntu kernel. There does not appear to be any patches to fix this bug in the Ubuntu repositories.

It's probably best to open an upstream bug, as requested in comment #17.

Revision history for this message
Removed by request (removed3425744) wrote :

I have now opened the upstream ticket: https://bugzilla.kernel.org/show_bug.cgi?id=51691

description: updated
penalvch (penalvch)
tags: added: bios-outdated-1.40
Changed in linux (Ubuntu):
status: Triaged → Incomplete
Revision history for this message
Removed by request (removed3425744) wrote :

The BIOS is now up to date:

sworddragon@ubuntu:~$ sudo dmidecode -s bios-version && sudo dmidecode -s bios-release-date
P1.40
10/02/2013

But the bug still exists on Ubuntu 14.04 dev with linux-image-generic 3.12.0.3.5. I have also updated the testcase: It is now written in C to exclude Python as the source of problems (compiling with "gcc -o threads ./threads.c -lpthread") and instead of creating 2 threads it is creating the number of online cpu cores * 2 as threads (on my processor with 6 cores 12 threads are created) as the overhead gets much higher with more threads.

Here are the results:

Calling ./test will result in a cpu usage of ~185%/600%.
Calling taskset -c 0 ./threads will result in a cpu usage of ~30%/600%.

Changed in linux (Ubuntu):
status: Incomplete → New
tags: removed: bios-outdated-1.40
Revision history for this message
Removed by request (removed3425744) wrote :
penalvch (penalvch)
tags: added: latest-bios-1.40
tags: added: trusty
tags: added: needs-upstream-testing regression-potential
Revision history for this message
Brad Figg (brad-figg) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. From a terminal window please run:

apport-collect 1073148

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Revision history for this message
penalvch (penalvch) wrote :

Please ignore https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1073148/comments/28 as this bot sometimes asks for apport-collects when one either already did it, or was done originally when first filed.

summary: - High cpu overhead on using multiple cores
+ [960GM/U3S3 FX] Higher than expected cpu overhead on using multiple
+ cores
Changed in linux (Ubuntu):
status: Incomplete → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.