/* Test context switching to see if the DSCR SPR is correctly preserved * when within a transaction. * * Note: We assume that the DSCR has been left at the default value (0) * for all CPUs. * * Method: * * Set a value into the DSCR. * * Start a transaction, and suspend it (*). * * Hard loop checking to see if the transaction has become doomed. * * Now that we *may* have been preempted, record the DSCR and TEXASR SPRS. * * If the abort was because of a context switch, check the DSCR value. * Otherwise, try again. * * (*) If the transaction is not suspended we can't see the problem because * the transaction abort handler will restore the DSCR to it's checkpointed * value before we regain control. */ #include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <asm/tm.h> #include "utils.h" #include "tm.h" #define SPRN_DSCR 0x03 int test_body(void) { uint64_t rv, dscr1 = 1, dscr2, texasr; SKIP_IF(!have_htm()); printf("Check DSCR TM context switch: "); fflush(stdout); for (;;) { rv = 1; asm __volatile__ ( /* set a known value into the DSCR */ "ld 3, %[dscr1];" "mtspr %[sprn_dscr], 3;" /* start and suspend a transaction */ "tbegin.;" "beq 1f;" "tsuspend.;" /* hard loop until the transaction becomes doomed */ "2: ;" "tcheck 0;" "bc 4, 0, 2b;" /* record DSCR and TEXASR */ "mfspr 3, %[sprn_dscr];" "std 3, %[dscr2];" "mfspr 3, %[sprn_texasr];" "std 3, %[texasr];" "tresume.;" "tend.;" "li %[rv], 0;" "1: ;" : [rv]"=r"(rv), [dscr2]"=m"(dscr2), [texasr]"=m"(texasr) : [dscr1]"m"(dscr1) , [sprn_dscr]"i"(SPRN_DSCR), [sprn_texasr]"i"(SPRN_TEXASR) : "memory", "r3" ); assert(rv); /* make sure the transaction aborted */ if ((texasr >> 56) != TM_CAUSE_RESCHED) { putchar('.'); fflush(stdout); continue; } if (dscr2 != dscr1) { printf(" FAIL\n"); return 1; } else { printf(" OK\n"); return 0; } } } int main(void) { return test_harness(test_body, "tm_resched_dscr"); } /linux/net-next.git/log/net/ipv6'> <input type='hidden' name='id' value='94b5e0f970258828bf163b5ef076da4e4b0802e0'/><select name='qt'> <option value='grep'>log msg</option> <option value='author'>author</option> <option value='committer'>committer</option> <option value='range'>range</option> </select> <input class='txt' type='search' size='10' name='q' value=''/> <input type='submit' value='search'/> </form> </td></tr></table> <div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/commit/?id=94b5e0f970258828bf163b5ef076da4e4b0802e0'>root</a>/<a href='/cgit.cgi/linux/net-next.git/commit/net?id=94b5e0f970258828bf163b5ef076da4e4b0802e0'>net</a>/<a href='/cgit.cgi/linux/net-next.git/commit/net/ipv6?id=94b5e0f970258828bf163b5ef076da4e4b0802e0'>ipv6</a></div><div class='content'><div class='cgit-panel'><b>diff options</b><form method='get'><input type='hidden' name='id' value='94b5e0f970258828bf163b5ef076da4e4b0802e0'/><table><tr><td colspan='2'/></tr><tr><td class='label'>context:</td><td class='ctrl'><select name='context' onchange='this.form.submit();'><option value='1'>1</option><option value='2'>2</option><option value='3' selected='selected'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='15'>15</option><option value='20'>20</option><option value='25'>25</option><option value='30'>30</option><option value='35'>35</option><option value='40'>40</option></select></td></tr><tr><td class='label'>space:</td><td class='ctrl'><select name='ignorews' onchange='this.form.submit();'><option value='0' selected='selected'>include</option><option value='1'>ignore</option></select></td></tr><tr><td class='label'>mode:</td><td class='ctrl'><select name='dt' onchange='this.form.submit();'><option value='0' selected='selected'>unified</option><option value='1'>ssdiff</option><option value='2'>stat only</option></select></td></tr><tr><td/><td class='ctrl'><noscript><input type='submit' value='reload'/></noscript></td></tr></table></form></div><table summary='commit info' class='commit-info'> <tr><th>author</th><td>David Ahern <dsa@cumulusnetworks.com></td><td class='right'>2017-02-02 08:52:21 -0800</td></tr> <tr><th>committer</th><td>David S. Miller <davem@davemloft.net></td><td class='right'>2017-02-03 16:01:44 -0500</td></tr> <tr><th>commit</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/net/ipv6?id=94b5e0f970258828bf163b5ef076da4e4b0802e0'>94b5e0f970258828bf163b5ef076da4e4b0802e0</a> (<a href='/cgit.cgi/linux/net-next.git/patch/net/ipv6?id=94b5e0f970258828bf163b5ef076da4e4b0802e0'>patch</a>)</td></tr> <tr><th>tree</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/tree/?id=94b5e0f970258828bf163b5ef076da4e4b0802e0'>b0fcd7892b00ecdccdc4328a632d98e74d6f265f</a> /<a href='/cgit.cgi/linux/net-next.git/tree/net/ipv6?id=94b5e0f970258828bf163b5ef076da4e4b0802e0'>net/ipv6</a></td></tr> <tr><th>parent</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/net/ipv6?id=3898fac1f488c76e0eef5b5267b4ba8112a82ac4'>3898fac1f488c76e0eef5b5267b4ba8112a82ac4</a> (<a href='/cgit.cgi/linux/net-next.git/diff/net/ipv6?id=94b5e0f970258828bf163b5ef076da4e4b0802e0&id2=3898fac1f488c76e0eef5b5267b4ba8112a82ac4'>diff</a>)</td></tr></table> <div class='commit-subject'>net: ipv6: Set protocol to kernel for local routes</div><div class='commit-msg'>IPv6 stack does not set the protocol for local routes, so those routes show up with proto "none": $ ip -6 ro ls table local local ::1 dev lo proto none metric 0 pref medium local 2100:3:: dev lo proto none metric 0 pref medium local 2100:3::4 dev lo proto none metric 0 pref medium local fe80:: dev lo proto none metric 0 pref medium ... Set rt6i_protocol to RTPROT_KERNEL for consistency with IPv4. Now routes show up with proto "kernel": $ ip -6 ro ls table local local ::1 dev lo proto kernel metric 0 pref medium local 2100:3:: dev lo proto kernel metric 0 pref medium local 2100:3::4 dev lo proto kernel metric 0 pref medium local fe80:: dev lo proto kernel metric 0 pref medium ... Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net> </div><div class='diffstat-header'><a href='/cgit.cgi/linux/net-next.git/diff/?id=94b5e0f970258828bf163b5ef076da4e4b0802e0'>Diffstat</a> (limited to 'net/ipv6')</div><table summary='diffstat' class='diffstat'><tr><td class='mode'>-rw-r--r--</td><td class='upd'><a href='/cgit.cgi/linux/net-next.git/diff/net/ipv6/route.c?id=94b5e0f970258828bf163b5ef076da4e4b0802e0'>net/ipv6/route.c</a></td><td class='right'>1</td><td class='graph'><table summary='file diffstat' width='1%'><tr><td class='add' style='width: 100.0%;'/><td class='rem' style='width: 0.0%;'/><td class='none' style='width: 0.0%;'/></tr></table></td></tr> </table><div class='diffstat-summary'>1 files changed, 1 insertions, 0 deletions</div><table summary='diff' class='diff'><tr><td><div class='head'>diff --git a/net/ipv6/route.c b/net/ipv6/route.c