165 karma · joined Apr 10, 2015 (11y ago) · 76 submissions
comment 1y ago · link · parent
DECLARE_EVENT_CLASS(sched_wakeup_template,
TP_PROTO(struct task_struct *p),
TP_ARGS(__perf_task(p)),
TP_STRUCT__entry(
__array( char, comm, TASK_COMM_LEN )
__field( pid_t, pid )
__field( int, prio )
__field( int, target_cpu )
),
TP_fast_assign(
memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
__entry->pid = p->pid;
__entry->prio = p->prio; /* XXX SCHED_DEADLINE */
__entry->target_cpu = task_cpu(p);
),
TP_printk("comm=%s pid=%d prio=%d target_cpu=%03d",
__entry->comm, __entry->pid, __entry->prio,
__entry->target_cpu)
);
[1] https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds...4.
Microsoft Was Betting on Unix(twitter.com ↗)
1 points · by senozhatsky · 4y ago · 2 comments
comment 6y ago · link · parent
> printf("%s\n", "Hello, World!");
>
> That's an awful lot of symbolic syntax.
Well... Because it should have been printf("Hello, World!\n");
in the first place?One can do something like
printf("%s,%s%c\n", "Hello", "World", '!');
and claim that C is awful and that displayln("Hello, World!");
is so much better.comment 7y ago · link · parent
> Al Viro asked if there is a plan to allow mounting hand-crafted XFS or ext4
> filesystem images. That is an easy way for an attacker to run their own code
> in ring 0, he said. The filesystems are not written to expect that kind of
> (ab)use. When asked if it really was that easy to crash the kernel with a
> hand-crafted filesystem image, Viro said: "is water wet?"
[0] https://lwn.net/Articles/718639/comment 7y ago · link · parent
[1] https://lore.kernel.org/lkml/alpine.DEB.2.21.1810221406400.1...
[2] https://lore.kernel.org/lkml/20181024155454.4e63191fbfaa0441...
[3] https://lore.kernel.org/lkml/20181023055655.GM18839@dhcp22.s...
comment 7y ago · link · parent
Alternative link, just in case: https://lore.kernel.org/lkml/d9802b6a-949b-b327-c4a6-3dbca48...
comment 7y ago · link · parent
[1] https://www.shutterstock.com/video/clip-7263112-panning-time...
[2] https://www.shutterstock.com/video/clip-27791884-victoria-ha...
Edit: added more links.
comment 7y ago · link · parent
[1] https://www.tripsavvy.com/thmb/SPLQhcPHF_u06LNEFd1qIc4p_3Q=/...
comment 7y ago · link · parent
Good question. My understanding is that (from the article)
The low birthrate is leading to severe labor shortages ... prompting the
country to welcome more foreign workers.
So foreign workers (e.g. from South-East Asia?) make it harder for Koreans
to find a job in SK? But it's all the same (severe labor shortages) in Japan,
if not worse.comment 7y ago · link · parent
Well, I suspect that in any reasonably complex C/C++ application (e.g. firefox) compilers do pass params via stack and probably they do so rather often. Even on x86_64.
/usr/lib/firefox/firefox objdump:
a8b8: 48 83 ec 40 sub $0x40,%rsp
a8bc: 48 89 d3 mov %rdx,%rbx
a8bf: 48 89 f5 mov %rsi,%rbp
a8c2: 49 89 ff mov %rdi,%r15
a8c5: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax
a8cc: 00 00
a8ce: 48 89 44 24 38 mov %rax,0x38(%rsp)
a8d3: 44 8b 76 10 mov 0x10(%rsi),%r14d
a8d7: 44 8b 62 10 mov 0x10(%rdx),%r12d
a8db: 48 89 74 24 20 mov %rsi,0x20(%rsp)
a8e0: 48 89 54 24 28 mov %rdx,0x28(%rsp)
a8e5: c7 44 24 30 02 00 00 movl $0x2,0x30(%rsp)
a8ec: 00
a8ed: 48 8d 7c 24 20 lea 0x20(%rsp),%rdi
a8f2: e8 39 fd ff ff callq a630 <_ZN7mozilla11Compression3LZ417decompressPartialEPKcmPcmPm@@Base+0x2c0>
--
etc.
/usr/lib/firefox/libxul.so objdump: 81cf5e: 48 89 44 24 30 mov %rax,0x30(%rsp)
81cf63: 4c 89 7c 24 58 mov %r15,0x58(%rsp)
81cf68: 4d 89 cf mov %r9,%r15
81cf6b: f2 44 0f 11 64 24 60 movsd %xmm12,0x60(%rsp)
81cf72: e8 a9 00 00 00 callq 81d020 <mont_mulf_noconv@@xul66+0xa30>
--
etc.comment 7y ago · link · parent
> Looks like it's a 5-10% performance hit, but makes it easier to provide good backtrace information
Very interesting indeed.
Well, forcing your compiler to start passing parameters via stack is pretty simple and it's not so uncommon.
And probably (and maybe) the Go team just wanted to make things simple. Otherwise they would need to have two parameter passing implementations and sometimes even use a mixed one - when platform does not have enough registers (e.g. 6 CPU registers and a function which takes 6+ params), so some parameters would be passed via registers, some via stack; or maybe all of them via stack. And so on. So I am byuing the "good backtrace" point.
For example, suppose I have a silly logging function my_func() [C code], which takes 8 params:
__attribute__ ((noinline))
void my_func(const char *module, const char *func, const char *level,
int line, int B, int C,
const char *app, const char *session)
{
printf("%s:%s:%s:%d %d %s %s\n", module, func, level,
line, B + C, app, session);
}
int main()
{
my_func("core", __func__, "error", 1, 2, 3, "a.out", "dummy");
return 0;
}
Let's compile it with gcc (-O2) for ARM and let's take a look at what
main() does: 000103d8 <main>:
103d8: e52de004 push {lr} ; (str lr, [sp, #-4]!)
103dc: e3002630 movw r2, #1584 ; 0x630
103e0: e3402001 movt r2, #1
103e4: e24dd014 sub sp, sp, #20
103e8: e3003638 movw r3, #1592 ; 0x638
103ec: e3403001 movt r3, #1
103f0: e3001600 movw r1, #1536 ; 0x600
103f4: e3401001 movt r1, #1
103f8: e58d200c str r2, [sp, #12]
103fc: e3000628 movw r0, #1576 ; 0x628
10400: e3400001 movt r0, #1
10404: e58d3008 str r3, [sp, #8]
10408: e3a02003 mov r2, #3
1040c: e3a03002 mov r3, #2
10410: e58d2004 str r2, [sp, #4]
10414: e58d3000 str r3, [sp]
10418: e3002620 movw r2, #1568 ; 0x620
1041c: e3402001 movt r2, #1
10420: e3a03001 mov r3, #1
10424: eb00004c bl 1055c <my_func>
10428: e3a00000 mov r0, #0
1042c: e28dd014 add sp, sp, #20
10430: e49df004 pop {pc} ; (ldr pc, [sp], #4)
Looks like a bunch of stores to stack ptr: + 0 bytes; + 4 bytes; + 8 bytes; + 12 bytes.[Edit: should have passed __LINE__ instead of hardcoded 1, but that doesn't change the assembly.]