Cannot set rustflags target-cpu=native in Cargo.toml (SIMD-JSON) - rust

I'm trying to compile the Rust simd-json package. It complains that the box is not SIMD-compatible:
|
221 | fn please_compile_with_a_simd_compatible_cpu_setting_read_the_simdjsonrs_readme() -> ! {}
| ---------------------------------------------------------------------------- ^ expected `!`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
However, the box is x86 as required:
$ uname -a
Linux ip-172-31-68-220 5.15.0-1011-aws #14-Ubuntu SMP Wed Jun 1 20:54:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
And Cargo.toml contains the required compiler flags:
[build]
rustflags = ["-C", "target-cpu=native"]
[target.wasm32-unknown-unknown]
rustflags = ["-C", "target-feature=+simd128"]
[target.wasm32-wasi]
rustflags = ["-C", "target-feature=+simd128"]
Why is simd-json unhappy?
Full /proc/cpuinfo output below.
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 85
model name : Intel(R) Xeon(R) Platinum 8259CL CPU # 2.50GHz
stepping : 7
microcode : 0x500320a
cpu MHz : 2500.006
cache size : 36608 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves ida arat pku ospke
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips : 5000.01
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 85
model name : Intel(R) Xeon(R) Platinum 8259CL CPU # 2.50GHz
stepping : 7
microcode : 0x500320a
cpu MHz : 2500.006
cache size : 36608 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 2
apicid : 2
initial apicid : 2
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves ida arat pku ospke
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips : 5000.01
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 85
model name : Intel(R) Xeon(R) Platinum 8259CL CPU # 2.50GHz
stepping : 7
microcode : 0x500320a
cpu MHz : 2500.006
cache size : 36608 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 2
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves ida arat pku ospke
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips : 5000.01
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 85
model name : Intel(R) Xeon(R) Platinum 8259CL CPU # 2.50GHz
stepping : 7
microcode : 0x500320a
cpu MHz : 2500.006
cache size : 36608 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 2
apicid : 3
initial apicid : 3
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves ida arat pku ospke
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips : 5000.01
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:

The implementation of that function is defined as follows:
#[cfg(all(
not(feature = "allow-non-simd"),
not(any(
target_feature = "sse4.2",
target_feature = "avx2",
target_feature = "neon",
target_feature = "simd128"
))
))]
fn please_compile_with_a_simd_compatible_cpu_setting_read_the_simdjsonrs_readme() -> ! {}
This means that the Rust compiler thinks your CPU doesn't have sse4.2 or avx2 or neon or simd128.
Your /proc/cpuinfo seems to have avx2, so is a giveaway of something strange going on.
The problem is that rustflags is not valid in your Cargo.toml, it needs to be added to your .cargo/config.toml file instead. The configuration file is meant primarily for global settings for cargo and rustc, but you can make one local to your repository in your project root. (e.g myproject/.cargo/config.toml)
If you look at the example of simd-json, you can see that is what they do.

Related

CentOS 6.5 kernel panic when running a perf process

I'm working on making continuous profiling on running process, so I set a crontab on server. It periodically runs a python script which exec perf subprocess collecting perf data from a daemon process started by supervise
The perf command I use is like this:
perf record -p {target process} -e cycles:u -a -q -g -- sleep {some time}
Everything goes on well except for the running process terminates.We sometimes need to update the target process executable file and restart the process with svc -t. The operation may lead to a kernel panic and we have to reboot the machine
My server's distribution version is CentOS release 6.5 (Final) and linux release version is 2.6.32-431.23.3.el6.x86_64
The core dump log and backtrace is shown as below
general protection fault: 0000 [#1] SMP
last sysfs file: /sys/devices/system/cpu/online
CPU 1
Modules linked in: AliSecGuard(U) AliSecProcFilter64(U) tcp_diag inet_diag joydev microcode virtio_net virtio_balloon shpchp i2c_piix4 i2c_core ext4 jbd2 mbcache virtio_blk virtio_console virtio_pci virtio_ring virtio pata_acpi ata_generic ata_piix dm_mirror dm_region_hash dm_log dm_mod [last unloaded: scsi_wait_scan]
Pid: 22748, comm: server Not tainted 2.6.32-573.22.1.el6.x86_64 #1 Alibaba Cloud Alibaba Cloud ECS
RIP: 0010:[<ffffffff8111db57>] [<ffffffff8111db57>] ring_buffer_put+0x77/0xf0
RSP: 0018:ffff8801afadbda8 EFLAGS: 00010006
RAX: ffff880416d81e60 RBX: ffff8803d335f000 RCX: 63496d6165727473
RDX: 676e697274736f5f RSI: 0000000000000003 RDI: ffff880416d81c00
RBP: ffff8801afadbdd8 R08: 0000000000000001 R09: 00000000ffffffff
R10: 00000000ffffffff R11: dead000000200200 R12: ffff8803d335f058
R13: 676e697274736cff R14: ffff8803d335f060 R15: 0000000000000202
FS: 0000000000000000(0000) GS:ffff880028240000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000004264d70 CR3: 0000000001a8d000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Process gameserver (pid: 22748, threadinfo ffff8801afad8000, task ffff8803a19cd520)
Stack:
ffff8801afadbdf8 ffff8803a1b03800 ffff8804138bf78c ffff8804138bf790
<d> ffff88001a9fb800 ffff8804182a1c80 ffff8801afadbdf8 ffffffff8111e377
<d> ffff8804138bf790 ffff8803a1b03800 ffff8801afadbe28 ffffffff8111fe72
Call Trace:
[<ffffffff8111e377>] free_event+0x37/0x170
[<ffffffff8111fe72>] perf_event_release_kernel+0x72/0xb0
[<ffffffff8111ff49>] put_event+0x99/0xd0
[<ffffffff81123a65>] __perf_event_exit_task+0xf5/0x150
[<ffffffff81123c91>] perf_event_exit_task+0x1d1/0x210
[<ffffffff8107ca24>] do_exit+0x1e4/0x870
[<ffffffff8107d1b7>] sys_exit+0x17/0x20
[<ffffffff8100b0d2>] system_call_fastpath+0x16/0x1b
Code: ff ff 4c 39 f0 48 8b 97 60 02 00 00 74 5f 4c 8d aa a0 fd ff ff eb 08 0f 1f 44 00 00 49 89 cd 48 8b 8f 68 02 00 00 be 03 00 00 00 <48> 89 4a 08 48 89 11 31 c9 48 89 87 60 02 00 00 48 89 87 68 02
RIP [<ffffffff8111db57>] ring_buffer_put+0x77/0xf0
RSP <ffff8801afadbda8>
PID: 22748 TASK: ffff8803a19cd520 CPU: 1 COMMAND: "server"
#0 [ffff8801afadbb30] machine_kexec at ffffffff8103d1fb
#1 [ffff8801afadbb90] crash_kexec at ffffffff810cc882
#2 [ffff8801afadbc60] oops_end at ffffffff8153da20
#3 [ffff8801afadbc90] die at ffffffff81010fab
#4 [ffff8801afadbcc0] do_general_protection at ffffffff8153d512
#5 [ffff8801afadbcf0] general_protection at ffffffff8153cce5
[exception RIP: ring_buffer_put+119]
RIP: ffffffff8111db57 RSP: ffff8801afadbda8 RFLAGS: 00010006
RAX: ffff880416d81e60 RBX: ffff8803d335f000 RCX: 63496d6165727473
RDX: 676e697274736f5f RSI: 0000000000000003 RDI: ffff880416d81c00
RBP: ffff8801afadbdd8 R8: 0000000000000001 R9: 00000000ffffffff
R10: 00000000ffffffff R11: dead000000200200 R12: ffff8803d335f058
R13: 676e697274736cff R14: ffff8803d335f060 R15: 0000000000000202
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
#6 [ffff8801afadbda0] ring_buffer_put at ffffffff8111db20
#7 [ffff8801afadbde0] free_event at ffffffff8111e377
#8 [ffff8801afadbe00] perf_event_release_kernel at ffffffff8111fe72
#9 [ffff8801afadbe30] put_event at ffffffff8111ff49
#10 [ffff8801afadbe60] __perf_event_exit_task at ffffffff81123a65
#11 [ffff8801afadbe90] perf_event_exit_task at ffffffff81123c91
#12 [ffff8801afadbef0] do_exit at ffffffff8107ca24
#13 [ffff8801afadbf70] sys_exit at ffffffff8107d1b7
#14 [ffff8801afadbf80] system_call_fastpath at ffffffff8100b0d2
RIP: 0000003026207c41 RSP: 00007fe4d1e56e50 RFLAGS: 00000246
RAX: 000000000000003c RBX: ffffffff8100b0d2 RCX: 0000000000000001
RDX: 0000000000000004 RSI: 00000000009fb000 RDI: 0000000000000000
RBP: 0000000000000000 R8: 000000000598f280 R9: 00000000000058dc
R10: 00007fe4d259f3ac R11: 0000000000000246 R12: ffffffff8107d1b7
R13: ffff8801afadbf78 R14: 0000000000000003 R15: 0000000000000000
ORIG_RAX: 000000000000003c CS: 0033 SS: 002b
The attached process's thread exit causes the kernel panic and the panic cannot be reproduced every time, so I suppose this may be kind of a race condition bug in kernel?
BTW, the perf process doesn't exit after attached process terminates on my server (because of old version I guess), so perf will continue to work until I interrupt it. I'm not sure whether this can affect the target process exit
Sounds like a bug in that old kernel version; user-space perf shouldn't be able to panic the kernel. Either Linux 2.6.32 was buggy, or maybe CentOS's patch backporting (or the patches themselves) introduced a bug that only happens when perf is active.
I don't think it's plausible to fix this on your own, unless you want to really dig into kernel debugging, so your options are
update your kernel (from CentOS if available, otherwise you'll have to find another source for kernels, e.g. mainline).
update your distro to one that uses newer kernels. (And newer everything else).
stop using perf.
Maybe not possible: find a different set of perf options that doesn't trigger this crash. (Be careful testing, whatever bug is causing this could possibly manifest in other ways like memory corruption, possibly leading to corrupting file data before it's written out to disk if you get unlucky with writing through a wild pointer. The bug might not have that possible failure mode, but you can't be certain until you've found it.)

kernel crash bug caused by ixgbevf kernel module of centos-3.10.0-229.20.1.el7?

I found a bug about ixgbevf kernel module on centos-3.10.0-229.20.1.el7. And I think this bug is fixed in 3.10.0-514.10.2.el7.
So could someone tell me which patch fix this bug, or how to find this patch?
BUG:
[308026.586026] ixgbevf 0000:01:10.0: NIC Link is Down
[308026.586037] ixgbevf 0000:01:10.1: NIC Link is Down
[308026.683724] bonding: bond1: link status definitely down for interface enp1s16, disabling it
[308026.683728] bonding: bond1: now running without any active interface !
[308026.683729] bonding: bond1: link status definitely down for interface enp1s16f1, disabling it
[308028.266060] bonding: bond1: Removing slave enp1s16.
[308028.266135] bonding: bond1: Warning: the permanent HWaddr of enp1s16 - 4e:cd:a6:59:26:2c - is still in use by bond1. Set the HWaddr of enp1s16 to a different address to avoid conflicts.
[308028.266139] bonding: bond1: releasing active interface enp1s16
[308028.359872] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
[308028.361319] IP: [<ffffffffa0494970>] ixgbevf_alloc_rx_buffers+0x60/0x160 [ixgbevf]
[308028.362049] PGD 0
[308028.362777] Oops: 0000 [#1] SMP
[308028.363481] Modules linked in: ixgbevf(OF) igb_uio(OF) iptable_mangle iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_filter nbd(OF) vhost_net macvtap macvlan udp_diag unix_diag af_packet_diag netlink_diag tun tcp_diag inet_diag uio bonding ext4 mbcache jbd2 intel_powerclamp coretemp kvm_intel kvm crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel mgag200 aesni_intel iTCO_wdt lrw dcdbas gf128mul syscopyarea sysfillrect iTCO_vendor_support glue_helper sysimgblt ablk_helper ttm cryptd ipmi_devintf igb ixgbe drm_kms_helper drm i2c_algo_bit ptp i2c_core ipmi_si pps_core sg mdio ipmi_msghandler dca sb_edac mei_me mei shpchp lpc_ich pcspkr mfd_core edac_core wmi acpi_power_meter acpi_pad ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_common ahci libahci
[308028.368487] libata megaraid_sas [last unloaded: ixgbevf]
[308028.369345] CPU: 0 PID: 21971 Comm: kworker/0:1 Tainted: GF W O-------------- 3.10.0-229.el7.x86_64 #1
[308028.370226] Hardware name: Dell Inc. PowerEdge R720/068CDY, BIOS 2.5.2 01/28/2015
[308028.371132] Workqueue: events ixgbevf_service_task [ixgbevf]
[308028.372038] task: ffff88022b0dad80 ti: ffff88010905c000 task.ti: ffff88010905c000
[308028.372965] RIP: 0010:[<ffffffffa0494970>] [<ffffffffa0494970>] ixgbevf_alloc_rx_buffers+0x60/0x160 [ixgbevf]
[308028.373949] RSP: 0018:ffff88010905fd10 EFLAGS: 00010287
[308028.374900] RAX: 0000000000000200 RBX: 0000000000000000 RCX: 0000000000000000
[308028.375895] RDX: 0000000000000000 RSI: 00000000000001ff RDI: ffff8800b82061c0
[308028.376841] RBP: ffff88010905fd48 R08: 0000000000000282 R09: 0000000000000001
[308028.377780] R10: 0000000000000004 R11: 0000000000000005 R12: 0000000000000000
[308028.378702] R13: 00000000fffffe00 R14: 00000000000001ff R15: ffff8800b82061c0
[308028.379628] FS: 0000000000000000(0000) GS:ffff882f7fa00000(0000) knlGS:0000000000000000
[308028.380540] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[308028.381471] CR2: 0000000000000008 CR3: 000000000190a000 CR4: 00000000001427f0
[308028.382376] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[308028.383291] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[308028.384180] Stack:
[308028.385051] ffff8832d1b58bc0 ffff88010905fd28 ffff8832d1b588c0 0000000000000009
[308028.385933] ffff8832d1b58bc0 ffff8800b82061c0 0000000000001028 ffff88010905fdb8
[308028.386804] ffffffffa0496ba3 ffff8832d1b58e58 000000022b1e2000 00000000819e2108
[308028.387693] Call Trace:
[308028.388520] [<ffffffffa0496ba3>] ixgbevf_configure+0x5d3/0x7d0 [ixgbevf]
[308028.389363] [<ffffffffa0498135>] ixgbevf_reinit_locked+0x65/0x90 [ixgbevf]
[308028.390213] [<ffffffffa049a3e4>] ixgbevf_service_task+0x324/0x420 [ixgbevf]
[308028.391043] [<ffffffff8108f1db>] process_one_work+0x17b/0x470
[308028.391888] [<ffffffff8108ffbb>] worker_thread+0x11b/0x400
[308028.392728] [<ffffffff8108fea0>] ? rescuer_thread+0x400/0x400
[308028.393576] [<ffffffff8109739f>] kthread+0xcf/0xe0
[308028.394434] [<ffffffff810972d0>] ? kthread_create_on_node+0x140/0x140
[308028.395339] [<ffffffff8161497c>] ret_from_fork+0x7c/0xb0
[308028.396205] [<ffffffff810972d0>] ? kthread_create_on_node+0x140/0x140
[308028.397068] Code: c5 41 89 f6 49 89 c4 48 8d 14 40 48 8b 47 28 49 c1 e4 04 4c 03 67 20 48 8d 1c d0 0f b7 47 4c 41 29 c5 66 0f 1f 84 00 00 00 00 00 <48> 83 7b 08 00 74 73 8b 53 10 48 8b 03 48 01 d0 49 83 c4 10 48
[308028.398959] RIP [<ffffffffa0494970>] ixgbevf_alloc_rx_buffers+0x60/0x160 [ixgbevf]
[308028.399910] RSP <ffff88010905fd10>
[308028.400846] CR2: 0000000000000008

What are the factor on which PID_MAX depends in Linux

I have checked two linux systems, both were of 64 bit but PID_MAX is different for both of them.
On one system(SYSTEM1)
cat /proc/sys/kernel/pid_max
32768
SYSTEM1 configuration:
dmesg | grep -i smp.*allow
getconf PAGESIZE
4096
cat /proc/cpuinfo | awk '/^processor/{print $3}' | tail -1
11
cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2430 0 # 2.20GHz
stepping : 7
microcode : 1803
cpu MHz : 2201.000
cache size : 15360 KB
physical id : 0
siblings : 6
core id : 0
cpu cores : 6
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips : 4389.48
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2430 0 # 2.20GHz
stepping : 7
microcode : 1803
cpu MHz : 2201.000
cache size : 15360 KB
physical id : 0
siblings : 6
core id : 1
cpu cores : 6
apicid : 2
initial apicid : 2
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips : 4389.48
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2430 0 # 2.20GHz
stepping : 7
microcode : 1803
cpu MHz : 2201.000
cache size : 15360 KB
physical id : 0
siblings : 6
core id : 2
cpu cores : 6
apicid : 4
initial apicid : 4
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips : 4389.48
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2430 0 # 2.20GHz
stepping : 7
microcode : 1803
cpu MHz : 1300.000
cache size : 15360 KB
physical id : 0
siblings : 6
core id : 3
cpu cores : 6
apicid : 6
initial apicid : 6
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips : 4389.48
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
processor : 4
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2430 0 # 2.20GHz
stepping : 7
microcode : 1803
cpu MHz : 2201.000
cache size : 15360 KB
physical id : 0
siblings : 6
core id : 4
cpu cores : 6
apicid : 8
initial apicid : 8
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips : 4389.48
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
processor : 5
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2430 0 # 2.20GHz
stepping : 7
microcode : 1803
cpu MHz : 1200.000
cache size : 15360 KB
physical id : 0
siblings : 6
core id : 5
cpu cores : 6
apicid : 10
initial apicid : 10
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips : 4389.48
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
processor : 6
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2430 0 # 2.20GHz
stepping : 7
microcode : 1803
cpu MHz : 2201.000
cache size : 15360 KB
physical id : 1
siblings : 6
core id : 0
cpu cores : 6
apicid : 32
initial apicid : 32
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips : 4392.34
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
processor : 7
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2430 0 # 2.20GHz
stepping : 7
microcode : 1803
cpu MHz : 2201.000
cache size : 15360 KB
physical id : 1
siblings : 6
core id : 1
cpu cores : 6
apicid : 34
initial apicid : 34
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips : 4392.34
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
processor : 8
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2430 0 # 2.20GHz
stepping : 7
microcode : 1803
cpu MHz : 2201.000
cache size : 15360 KB
physical id : 1
siblings : 6
core id : 2
cpu cores : 6
apicid : 36
initial apicid : 36
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips : 4392.34
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
processor : 9
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2430 0 # 2.20GHz
stepping : 7
microcode : 1803
cpu MHz : 2201.000
cache size : 15360 KB
physical id : 1
siblings : 6
core id : 3
cpu cores : 6
apicid : 38
initial apicid : 38
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips : 4392.34
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
processor : 10
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2430 0 # 2.20GHz
stepping : 7
microcode : 1803
cpu MHz : 1200.000
cache size : 15360 KB
physical id : 1
siblings : 6
core id : 4
cpu cores : 6
apicid : 40
initial apicid : 40
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips : 4392.34
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
processor : 11
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2430 0 # 2.20GHz
stepping : 7
microcode : 1803
cpu MHz : 1200.000
cache size : 15360 KB
physical id : 1
siblings : 6
core id : 5
cpu cores : 6
apicid : 42
initial apicid : 42
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips : 4392.34
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
Whereas on other(SYSTEM2), it was
cat /proc/sys/kernel/pid_max
65536
SYSTEM2 configuration:
dmesg | grep -i smp.*allow
SMP: Allowing 64 CPUs, 61 hotplug CPUs
getconf PAGESIZE
4096
cat /proc/cpuinfo | awk '/^processor/{print $3}' | tail -1
2
cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU X5450 # 3.00GHz
stepping : 6
microcode : 4294967295
cpu MHz : 2992.467
cache size : 6144 KB
physical id : 0
siblings : 3
core id : 0
cpu cores : 3
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good unfair_spinlock pni ssse3 cx16 sse4_1 hypervisor lahf_lm
bogomips : 5984.93
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU X5450 # 3.00GHz
stepping : 6
microcode : 4294967295
cpu MHz : 2992.467
cache size : 6144 KB
physical id : 0
siblings : 3
core id : 1
cpu cores : 3
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good unfair_spinlock pni ssse3 cx16 sse4_1 hypervisor lahf_lm
bogomips : 5984.93
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:
processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU X5450 # 3.00GHz
stepping : 6
microcode : 4294967295
cpu MHz : 2992.467
cache size : 6144 KB
physical id : 0
siblings : 3
core id : 2
cpu cores : 3
apicid : 2
initial apicid : 2
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good unfair_spinlock pni ssse3 cx16 sse4_1 hypervisor lahf_lm
bogomips : 5984.93
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:
From man pages.
proc/sys/kernel/pid_max This file (new in Linux 2.5) specifies the
value at which PIDs wrap around (i.e., the value in this file is one
greater than the maximum PID). The default value for this file,
32768, results in the same range of PIDs as on earlier kernels. On
32-bit platfroms, 32768 is the maximum value for pid_max. On 64-bit
systems, pid_max can be set to any value up to 2^22 (PID_MAX_LIMIT,
approximately 4 million).
Please note, both of these system were having same linux kernel but SYSTEM2 was running on hyper-V.
Now, my question is what are factors which are responsible for changing pid_max?
Thank you in advance.
pid_max is set based on the number of possible CPUs, which you can see in the kernel source in pid.c line 595
pid_max = min(pid_max_max, max_t(int, pid_max,
PIDS_PER_CPU_DEFAULT * num_possible_cpus()));
num_possible_cpus() returns the maximum number of CPUs that could be in the system (including hotplug CPUs that could be plugged in after boot).
As you can see the expression includes a minimum and maximum.
The minimum is the initial value of pid_max, which is derived from the macro PID_MAX_DEFAULT, which will be either 0x1000 or 0x8000 depending on the compile-time configuration setting CONFIG_BASE_SMALL.
The maximum is pid_max_max, which in turn is derived from some kernel compile-time configuration settings, specifically CONFIG_BASE_SMALL and PAGE_SIZE. This is defined in the macro PID_MAX_LIMIT see threads.h line 33:
#define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \
(sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT))
So putting all this together in an example: on my system here (Centos 6):
PAGESIZE is 4096
CONFIG_BASE_SMALL is 0
PID_MAX_DEFAULT would therefore be 0x8000 (32768)
PID_MAX_LIMIT would be 4 * 1024 * 1024 = 4194304
max_pid would therefore be in the range 4194304 >= max_pid >= 32768
From userland, you can inspect the number of possible CPUs in file /sys/devices/system/cpu/possible. The format of the data in this file is a little strange - it will be a string of the form 0-max, for example 0-15 would mean a maximum of 16 CPUs (noting that the number is zero counting).
For more information about this file and the other files in this directory, see cputopology.txt.
For more information about CPU hotplugging in general, see cpu-hotplug.txt
If you want to check the kernel compile time configuration settings, check this answer for some tips.
NB. Kernel line numbers given are valid for Kernel 4.7.10.

Reading debug register produces: "unsupported instruction mov" [duplicate]

I am just trying to compile some simple example code I typed in from a book, and GCC gives me the above error. Here's my code:
$ cat -n test.cpp
1 #define READ_COMMAND 3
2
3 #define MSG_LENGTH 128
4
5 #include <stdlib.h>
6 #include <stdio.h>
7
8 int main(int argc, char *arg[])
9 {
10 int syslog_command = READ_COMMAND;
11 int bytes_to_read = MSG_LENGTH;
12 int retval;
13 char buffer[MSG_LENGTH];
14
15 asm volatile(
16 "movl %1, %%ebx\n\t"
17 "movl %2, %%ecx\n\t"
18 "movl %3, %%edx\n\t"
19 "movl $103, %%eax\n\t"
20 "int $128\n\t"
21 "movl %%eax, %0"
22 :"=r" (retval)
23 :"m"(syslog_command),"r"(buffer),"m"(bytes_to_read)
24 :"%eax","%ebx","%ecx","%edx");
25 if (retval > 0) printf("%s\n", buffer);
26
27 }
28
29
The code is supposed to invoke the syslog() system call to read the last 128 bytes from the kernel printk() ring buffer. Here is some information about my OS and system configuration:
uname -a:
Linux 3.2.0-26-generic #41-Ubuntu SMP Thu Jun 14 17:49:24 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
gcc -v:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
Heres the full error:
$ gcc test.cpp
test.cpp: Assembler messages:
test.cpp:25: Error: unsupported for `mov'
You are attempting to compile 32-bit assembly code on a 64-bit machine. The inline assembly you list compiles to:
movl -24(%rbp), %ebx
movl %rsi, %ecx <--- error here
movl -28(%rbp), %edx
movl $103, %eax
int $128
movl %eax, %r12d
As you can see, you're attempting to store a 64-bit register in a 32-bit register, which is illegal. More importantly, this isn't the 64-bit ABI system call protocol either.
Try compiling with -m32 to force 32-bit ABI.
you should use "movq" to move 64 bits value.
see like this:
int main(void)
{
long str_len = 15;
const char* str = "hello world!\n\r";
asm volatile(
"movl $4, %%eax\n\t"
"movl $1, %%ebx\n\t"
"movq %0, %%rcx\n\t"
"movq %1, %%rdx\n\t"
"int $0x80\n\t"
:
:"r"(str), "r"(str_len)
:"eax","ebx", "rcx", "rdx"
);
return 0;
}

What does the GCC error message, "Error: unsupported for `mov'", mean?

I am just trying to compile some simple example code I typed in from a book, and GCC gives me the above error. Here's my code:
$ cat -n test.cpp
1 #define READ_COMMAND 3
2
3 #define MSG_LENGTH 128
4
5 #include <stdlib.h>
6 #include <stdio.h>
7
8 int main(int argc, char *arg[])
9 {
10 int syslog_command = READ_COMMAND;
11 int bytes_to_read = MSG_LENGTH;
12 int retval;
13 char buffer[MSG_LENGTH];
14
15 asm volatile(
16 "movl %1, %%ebx\n\t"
17 "movl %2, %%ecx\n\t"
18 "movl %3, %%edx\n\t"
19 "movl $103, %%eax\n\t"
20 "int $128\n\t"
21 "movl %%eax, %0"
22 :"=r" (retval)
23 :"m"(syslog_command),"r"(buffer),"m"(bytes_to_read)
24 :"%eax","%ebx","%ecx","%edx");
25 if (retval > 0) printf("%s\n", buffer);
26
27 }
28
29
The code is supposed to invoke the syslog() system call to read the last 128 bytes from the kernel printk() ring buffer. Here is some information about my OS and system configuration:
uname -a:
Linux 3.2.0-26-generic #41-Ubuntu SMP Thu Jun 14 17:49:24 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
gcc -v:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
Heres the full error:
$ gcc test.cpp
test.cpp: Assembler messages:
test.cpp:25: Error: unsupported for `mov'
You are attempting to compile 32-bit assembly code on a 64-bit machine. The inline assembly you list compiles to:
movl -24(%rbp), %ebx
movl %rsi, %ecx <--- error here
movl -28(%rbp), %edx
movl $103, %eax
int $128
movl %eax, %r12d
As you can see, you're attempting to store a 64-bit register in a 32-bit register, which is illegal. More importantly, this isn't the 64-bit ABI system call protocol either.
Try compiling with -m32 to force 32-bit ABI.
you should use "movq" to move 64 bits value.
see like this:
int main(void)
{
long str_len = 15;
const char* str = "hello world!\n\r";
asm volatile(
"movl $4, %%eax\n\t"
"movl $1, %%ebx\n\t"
"movq %0, %%rcx\n\t"
"movq %1, %%rdx\n\t"
"int $0x80\n\t"
:
:"r"(str), "r"(str_len)
:"eax","ebx", "rcx", "rdx"
);
return 0;
}

Resources