From mjacob at FreeBSD.org Sat Aug 1 00:57:35 2009 From: mjacob at FreeBSD.org (Matt Jacob) Date: Sat Aug 1 00:57:43 2009 Subject: svn commit: r196007 - in head/sys: dev/ispfw modules/ispfw modules/ispfw/isp_2400_multi modules/ispfw/isp_2500 modules/ispfw/isp_2500_multi Message-ID: <200908010057.n710vYjb085713@svn.freebsd.org> Author: mjacob Date: Sat Aug 1 00:57:34 2009 New Revision: 196007 URL: http://svn.freebsd.org/changeset/base/196007 Log: Add 8Gb card firmware. Update some 2Gb and 4Gb f/w sets. Split 4Gb and 8Gb into pieces that can be either multi_id capable or not. Reviewed by: scottl, ken Approved by: re Added: head/sys/dev/ispfw/asm_2500.h (contents, props changed) head/sys/modules/ispfw/isp_2400_multi/ head/sys/modules/ispfw/isp_2400_multi/Makefile (contents, props changed) head/sys/modules/ispfw/isp_2500/ head/sys/modules/ispfw/isp_2500/Makefile (contents, props changed) head/sys/modules/ispfw/isp_2500_multi/ head/sys/modules/ispfw/isp_2500_multi/Makefile (contents, props changed) Modified: head/sys/dev/ispfw/asm_2300.h head/sys/dev/ispfw/asm_2400.h head/sys/dev/ispfw/ispfw.c head/sys/modules/ispfw/Makefile Modified: head/sys/dev/ispfw/asm_2300.h ============================================================================== --- head/sys/dev/ispfw/asm_2300.h Fri Jul 31 20:32:55 2009 (r196006) +++ head/sys/dev/ispfw/asm_2300.h Sat Aug 1 00:57:34 2009 (r196007) @@ -29,21 +29,19 @@ * * * --- ISP2300 Initiator/Target Firmware --- * * with Fabric support (Public Loop), with expanded LUN * - * addressing and 2K port logins. * + * addressing and 2K port logins. * * * - ************************************************************************ - */ + ************************************************************************/ /* - * Firmware Version 3.03.19 (09:41 Nov 30, 2005) + * Firmware Version 3.03.26 (16:54 Aug 14, 2007) */ - -static const u_int16_t isp_2300_risc_code[] = { - 0x0470, 0x0000, 0x0000, 0xcd3b, 0x0000, 0x0003, 0x0003, 0x0013, +static const uint16_t isp_2300_risc_code[] = { + 0x0470, 0x0000, 0x0000, 0xd048, 0x0000, 0x0003, 0x0003, 0x001a, 0x0107, 0x2043, 0x4f50, 0x5952, 0x4947, 0x4854, 0x2032, 0x3030, 0x3120, 0x514c, 0x4f47, 0x4943, 0x2043, 0x4f52, 0x504f, 0x5241, 0x5449, 0x4f4e, 0x2049, 0x5350, 0x3233, 0x3030, 0x2046, 0x6972, 0x6d77, 0x6172, 0x6520, 0x2056, 0x6572, 0x7369, 0x6f6e, 0x2030, - 0x332e, 0x3033, 0x2e31, 0x3920, 0x2020, 0x2020, 0x2400, 0x20a9, + 0x332e, 0x3033, 0x2e32, 0x3620, 0x2020, 0x2020, 0x2400, 0x20a9, 0x000f, 0x2001, 0x0000, 0x400f, 0x2091, 0x2200, 0x20a9, 0x000f, 0x2001, 0x0000, 0x400f, 0x2091, 0x2400, 0x20a9, 0x000f, 0x2001, 0x0000, 0x400f, 0x2091, 0x2600, 0x20a9, 0x000f, 0x2001, 0x0000, @@ -52,2670 +50,2711 @@ static const u_int16_t isp_2300_risc_cod 0x2c00, 0x20a9, 0x000f, 0x2001, 0x0000, 0x400f, 0x2091, 0x2e00, 0x20a9, 0x000f, 0x2001, 0x0000, 0x400f, 0x2091, 0x2000, 0x2001, 0x0000, 0x20c1, 0x0004, 0x20c9, 0x1bff, 0x2059, 0x0000, 0x2b78, - 0x7883, 0x0004, 0x2089, 0x2b8d, 0x2051, 0x1800, 0x2a70, 0x20e1, - 0x0001, 0x20e9, 0x0001, 0x2009, 0x0000, 0x080c, 0x0e5f, 0x2029, + 0x7883, 0x0004, 0x2089, 0x2bf2, 0x2051, 0x1800, 0x2a70, 0x20e1, + 0x0001, 0x20e9, 0x0001, 0x2009, 0x0000, 0x080c, 0x0e53, 0x2029, 0x3500, 0x2031, 0xffff, 0x2039, 0x34c8, 0x2021, 0x0200, 0x20e9, 0x0001, 0x20a1, 0x0000, 0x20a9, 0x0800, 0x900e, 0x4104, 0x20e9, 0x0001, 0x20a1, 0x1000, 0x900e, 0x2001, 0x0cc0, 0x9084, 0x0fff, 0x20a8, 0x4104, 0x2001, 0x0000, 0x9086, 0x0000, 0x0120, 0x21a8, 0x4104, 0x8001, 0x1de0, 0x756a, 0x766e, 0x7766, 0x7472, 0x7476, - 0x00e6, 0x2071, 0x1a9d, 0x2472, 0x00ee, 0x20a1, 0x1cc8, 0x716c, + 0x00e6, 0x2071, 0x1aa0, 0x2472, 0x00ee, 0x20a1, 0x1cc8, 0x716c, 0x810d, 0x810d, 0x810d, 0x810d, 0x918c, 0x000f, 0x2001, 0x0001, 0x9112, 0x900e, 0x21a8, 0x4104, 0x8211, 0x1de0, 0x716c, 0x3400, 0x8001, 0x9102, 0x0120, 0x0218, 0x20a8, 0x900e, 0x4104, 0x2009, 0x1800, 0x810d, 0x810d, 0x810d, 0x810d, 0x810d, 0x918c, 0x001f, 0x2001, 0x0001, 0x9112, 0x20e9, 0x0001, 0x20a1, 0x0800, 0x900e, - 0x20a9, 0x0800, 0x4104, 0x8211, 0x1dd8, 0x080c, 0x0f25, 0x080c, - 0x5dbc, 0x080c, 0x9c9e, 0x080c, 0x10dc, 0x080c, 0x12c1, 0x080c, - 0x1a82, 0x080c, 0x0d65, 0x080c, 0x1061, 0x080c, 0x3267, 0x080c, - 0x747e, 0x080c, 0x66c3, 0x080c, 0x80b6, 0x080c, 0x2345, 0x080c, - 0x839c, 0x080c, 0x7ae7, 0x080c, 0x217a, 0x080c, 0x22ae, 0x080c, - 0x233a, 0x2091, 0x3009, 0x7883, 0x0000, 0x1004, 0x091d, 0x7880, + 0x20a9, 0x0800, 0x4104, 0x8211, 0x1dd8, 0x080c, 0x0f19, 0x080c, + 0x5f04, 0x080c, 0x9eae, 0x080c, 0x10d0, 0x080c, 0x12b8, 0x080c, + 0x1a99, 0x080c, 0x0d58, 0x080c, 0x1055, 0x080c, 0x32cc, 0x080c, + 0x75f0, 0x080c, 0x6836, 0x080c, 0x8273, 0x080c, 0x235c, 0x080c, + 0x857b, 0x080c, 0x7c59, 0x080c, 0x2191, 0x080c, 0x22c5, 0x080c, + 0x2351, 0x2091, 0x3009, 0x7883, 0x0000, 0x1004, 0x091d, 0x7880, 0x9086, 0x0002, 0x1190, 0x7883, 0x4000, 0x7837, 0x4000, 0x7833, 0x0010, 0x0e04, 0x0911, 0x2091, 0x5000, 0x2091, 0x4080, 0x2001, - 0x0089, 0x2004, 0xd084, 0x190c, 0x11a9, 0x2071, 0x1800, 0x7003, + 0x0089, 0x2004, 0xd084, 0x190c, 0x119d, 0x2071, 0x1800, 0x7003, 0x0000, 0x2071, 0x1800, 0x7000, 0x908e, 0x0003, 0x1168, 0x080c, - 0x4a50, 0x080c, 0x328e, 0x080c, 0x74ef, 0x080c, 0x6be9, 0x080c, - 0x80e2, 0x080c, 0x2ad7, 0x0c68, 0x000b, 0x0c88, 0x0940, 0x0941, - 0x0ae3, 0x093e, 0x0baa, 0x0d64, 0x0d64, 0x0d64, 0x080c, 0x0dd1, + 0x4b82, 0x080c, 0x32f3, 0x080c, 0x7661, 0x080c, 0x6d5c, 0x080c, + 0x829f, 0x080c, 0x2b09, 0x0c68, 0x000b, 0x0c88, 0x0940, 0x0941, + 0x0ade, 0x093e, 0x0b9e, 0x0d57, 0x0d57, 0x0d57, 0x080c, 0x0dc4, 0x0005, 0x0126, 0x00f6, 0x2091, 0x8000, 0x7000, 0x9086, 0x0001, - 0x1904, 0x0ab6, 0x080c, 0x5469, 0x1130, 0x0026, 0x2011, 0x0080, - 0x080c, 0x0eed, 0x002e, 0x080c, 0x7173, 0x0150, 0x080c, 0x7196, - 0x15a0, 0x2079, 0x0100, 0x7828, 0x9085, 0x1800, 0x782a, 0x0468, - 0x080c, 0x709f, 0x7000, 0x9086, 0x0001, 0x1904, 0x0ab6, 0x7094, - 0x9086, 0x0029, 0x1904, 0x0ab6, 0x080c, 0x809f, 0x080c, 0x8091, - 0x2001, 0x0161, 0x2003, 0x0001, 0x2079, 0x0100, 0x7827, 0xffff, - 0x7a28, 0x9295, 0x5e2f, 0x7a2a, 0x2011, 0x7003, 0x080c, 0x81a1, - 0x2011, 0x6ff6, 0x080c, 0x826d, 0x2011, 0x5c17, 0x080c, 0x81a1, - 0x2011, 0x8030, 0x901e, 0x7392, 0x04d0, 0x080c, 0x54c4, 0x2079, - 0x0100, 0x7844, 0x9005, 0x1904, 0x0ab6, 0x2011, 0x5c17, 0x080c, - 0x81a1, 0x2011, 0x7003, 0x080c, 0x81a1, 0x2011, 0x6ff6, 0x080c, - 0x826d, 0x2001, 0x0265, 0x2001, 0x0205, 0x2003, 0x0000, 0x7840, - 0x9084, 0xfffb, 0x7842, 0x2001, 0x1980, 0x2004, 0x9005, 0x1140, - 0x00c6, 0x2061, 0x0100, 0x080c, 0x5d64, 0x00ce, 0x0804, 0x0ab6, - 0x780f, 0x006b, 0x7a28, 0x080c, 0x717b, 0x0118, 0x9295, 0x5e2f, - 0x0010, 0x9295, 0x402f, 0x7a2a, 0x2011, 0x8010, 0x73d4, 0x2001, - 0x1981, 0x2003, 0x0001, 0x080c, 0x297c, 0x080c, 0x498b, 0x7244, - 0xc284, 0x7246, 0x2001, 0x180c, 0x200c, 0xc1ac, 0xc1cc, 0x2102, - 0x080c, 0x96d5, 0x2011, 0x0004, 0x080c, 0xb6b7, 0x080c, 0x64f6, - 0x080c, 0x7173, 0x1120, 0x080c, 0x29c0, 0x02e0, 0x0400, 0x080c, - 0x5d6b, 0x0140, 0x7093, 0x0001, 0x70cf, 0x0000, 0x080c, 0x5691, - 0x0804, 0x0ab6, 0x080c, 0x545a, 0xd094, 0x0188, 0x2011, 0x180c, - 0x2204, 0xc0cd, 0x2012, 0x080c, 0x545e, 0xd0d4, 0x1118, 0x080c, - 0x29c0, 0x1270, 0x2011, 0x180c, 0x2204, 0xc0bc, 0x00a8, 0x080c, - 0x545e, 0xd0d4, 0x1db8, 0x2011, 0x180c, 0x2204, 0xc0bd, 0x0060, - 0x2011, 0x180c, 0x2204, 0xc0bd, 0x2012, 0x080c, 0x65e2, 0x1128, - 0xd0a4, 0x0118, 0x2204, 0xc0fd, 0x2012, 0x080c, 0x65a8, 0x0120, - 0x7a0c, 0xc2b4, 0x7a0e, 0x00a8, 0x707b, 0x0000, 0x080c, 0x7173, - 0x1130, 0x70ac, 0x9005, 0x1168, 0x080c, 0xb9d1, 0x0050, 0x080c, - 0xb9d1, 0x70d8, 0xd09c, 0x1128, 0x70ac, 0x9005, 0x0110, 0x080c, - 0x5d41, 0x70e3, 0x0000, 0x70df, 0x0000, 0x70a3, 0x0000, 0x080c, - 0x29c8, 0x0228, 0x2011, 0x0101, 0x2204, 0xc0c4, 0x2012, 0x72d8, - 0x080c, 0x7173, 0x1178, 0x9016, 0x0016, 0x080c, 0x2785, 0x2019, - 0x1947, 0x211a, 0x001e, 0x705b, 0xffff, 0x705f, 0x00ef, 0x707f, - 0x0000, 0x0020, 0x2019, 0x1947, 0x201b, 0x0000, 0x2079, 0x185b, - 0x7804, 0xd0ac, 0x0108, 0xc295, 0x72da, 0x080c, 0x7173, 0x0118, - 0x9296, 0x0004, 0x0548, 0x2011, 0x0001, 0x080c, 0xb6b7, 0x70a7, - 0x0000, 0x70ab, 0xffff, 0x7003, 0x0002, 0x2079, 0x0100, 0x7827, - 0x0003, 0x7828, 0x9085, 0x0003, 0x782a, 0x00fe, 0x080c, 0x2dfa, - 0x2011, 0x0005, 0x080c, 0x97e0, 0x080c, 0x8a56, 0x080c, 0x7173, - 0x0148, 0x00c6, 0x2061, 0x0100, 0x0016, 0x080c, 0x2785, 0x61e2, - 0x001e, 0x00ce, 0x012e, 0x0420, 0x70a7, 0x0000, 0x70ab, 0xffff, - 0x7003, 0x0002, 0x00f6, 0x2079, 0x0100, 0x7827, 0x0003, 0x7828, - 0x9085, 0x0003, 0x782a, 0x00fe, 0x2011, 0x0005, 0x080c, 0x97e0, - 0x080c, 0x8a56, 0x080c, 0x7173, 0x0148, 0x00c6, 0x2061, 0x0100, - 0x0016, 0x080c, 0x2785, 0x61e2, 0x001e, 0x00ce, 0x00fe, 0x012e, - 0x0005, 0x00c6, 0x00b6, 0x080c, 0x7173, 0x1118, 0x20a9, 0x0800, - 0x0010, 0x20a9, 0x0782, 0x080c, 0x7173, 0x1110, 0x900e, 0x0010, - 0x2009, 0x007e, 0x86ff, 0x0138, 0x9180, 0x1000, 0x2004, 0x905d, - 0x0110, 0xb800, 0xd0bc, 0x090c, 0x30fd, 0x8108, 0x1f04, 0x0aca, - 0x707b, 0x0000, 0x707c, 0x9084, 0x00ff, 0x707e, 0x70af, 0x0000, - 0x00be, 0x00ce, 0x0005, 0x00b6, 0x0126, 0x2091, 0x8000, 0x7000, - 0x9086, 0x0002, 0x1904, 0x0ba7, 0x70a8, 0x9086, 0xffff, 0x0130, - 0x080c, 0x2dfa, 0x080c, 0x8a56, 0x0804, 0x0ba7, 0x70d8, 0xd0ac, - 0x1110, 0xd09c, 0x0558, 0xd084, 0x0548, 0x0006, 0x2001, 0x0103, - 0x2003, 0x002b, 0x000e, 0xd08c, 0x0508, 0x080c, 0x3160, 0x11d0, - 0x70dc, 0x9086, 0xffff, 0x01b0, 0x080c, 0x2f73, 0x080c, 0x8a56, - 0x70d8, 0xd094, 0x1904, 0x0ba7, 0x2011, 0x0001, 0x080c, 0xbc4c, - 0x0110, 0x2011, 0x0003, 0x901e, 0x080c, 0x2fad, 0x080c, 0x8a56, - 0x0804, 0x0ba7, 0x70e0, 0x9005, 0x1904, 0x0ba7, 0x70a4, 0x9005, - 0x1904, 0x0ba7, 0x70d8, 0xd0a4, 0x0118, 0xd0b4, 0x0904, 0x0ba7, - 0x080c, 0x65a8, 0x1904, 0x0ba7, 0x080c, 0x65fb, 0x1904, 0x0ba7, - 0x080c, 0x65e2, 0x01c0, 0x0156, 0x00c6, 0x20a9, 0x007f, 0x900e, - 0x0016, 0x080c, 0x62f0, 0x1118, 0xb800, 0xd0ec, 0x1138, 0x001e, - 0x8108, 0x1f04, 0x0b40, 0x00ce, 0x015e, 0x0028, 0x001e, 0x00ce, - 0x015e, 0x0804, 0x0ba7, 0x0006, 0x2001, 0x0103, 0x2003, 0x006b, - 0x000e, 0x2011, 0x198d, 0x080c, 0x0f95, 0x2011, 0x19a7, 0x080c, - 0x0f95, 0x7030, 0xc08c, 0x7032, 0x7003, 0x0003, 0x70ab, 0xffff, - 0x080c, 0x5469, 0x1130, 0x0026, 0x2011, 0x0040, 0x080c, 0x0eed, - 0x002e, 0x9006, 0x080c, 0x261a, 0x080c, 0x3160, 0x0118, 0x080c, - 0x4b28, 0x0050, 0x0036, 0x0046, 0x2019, 0xffff, 0x2021, 0x0006, - 0x080c, 0x4b42, 0x004e, 0x003e, 0x00f6, 0x2079, 0x0100, 0x080c, - 0x7196, 0x0150, 0x080c, 0x7173, 0x7828, 0x0118, 0x9084, 0xe1ff, - 0x0010, 0x9084, 0xffdf, 0x782a, 0x00fe, 0x2001, 0x19c2, 0x2004, - 0x9086, 0x0005, 0x1120, 0x2011, 0x0000, 0x080c, 0x97e0, 0x2011, - 0x0000, 0x080c, 0x97ea, 0x080c, 0x8a56, 0x080c, 0x8b2d, 0x012e, - 0x00be, 0x0005, 0x0016, 0x0046, 0x00f6, 0x0126, 0x2091, 0x8000, - 0x2079, 0x0100, 0x7904, 0x918c, 0xfffd, 0x7906, 0x2009, 0x00f7, - 0x080c, 0x5d2a, 0x7940, 0x918c, 0x0010, 0x7942, 0x7924, 0xd1b4, - 0x0110, 0x7827, 0x0040, 0xd19c, 0x0110, 0x7827, 0x0008, 0x0006, - 0x0036, 0x0156, 0x7954, 0xd1ac, 0x1904, 0x0c37, 0x2001, 0x1981, - 0x2004, 0x9005, 0x1518, 0x080c, 0x2a43, 0x1148, 0x2001, 0x0001, - 0x080c, 0x29ab, 0x2001, 0x0001, 0x080c, 0x298e, 0x00b8, 0x080c, - 0x2a4b, 0x1138, 0x9006, 0x080c, 0x29ab, 0x9006, 0x080c, 0x298e, - 0x0068, 0x080c, 0x2a53, 0x1d50, 0x2001, 0x1971, 0x2004, 0xd0fc, - 0x0108, 0x0020, 0x080c, 0x27b9, 0x0804, 0x0d16, 0x080c, 0x7184, - 0x0148, 0x080c, 0x7196, 0x1118, 0x080c, 0x7479, 0x0050, 0x080c, - 0x717b, 0x0dd0, 0x080c, 0x7474, 0x080c, 0x746a, 0x080c, 0x709f, - 0x0058, 0x080c, 0x7173, 0x0140, 0x2009, 0x00f8, 0x080c, 0x5d2a, - 0x7843, 0x0090, 0x7843, 0x0010, 0x20a9, 0x09c4, 0x7820, 0xd09c, - 0x1138, 0x080c, 0x7173, 0x0138, 0x7824, 0xd0ac, 0x1904, 0x0d1b, - 0x1f04, 0x0c16, 0x0070, 0x7824, 0x080c, 0x718d, 0x0118, 0xd0ac, - 0x1904, 0x0d1b, 0x9084, 0x1800, 0x0d98, 0x7003, 0x0001, 0x0804, - 0x0d1b, 0x2001, 0x0001, 0x080c, 0x261a, 0x0804, 0x0d2e, 0x2001, - 0x1981, 0x2004, 0x9005, 0x1518, 0x080c, 0x2a43, 0x1148, 0x2001, - 0x0001, 0x080c, 0x29ab, 0x2001, 0x0001, 0x080c, 0x298e, 0x00b8, - 0x080c, 0x2a4b, 0x1138, 0x9006, 0x080c, 0x29ab, 0x9006, 0x080c, - 0x298e, 0x0068, 0x080c, 0x2a53, 0x1d50, 0x2001, 0x1971, 0x2004, - 0xd0fc, 0x0108, 0x0020, 0x080c, 0x27b9, 0x0804, 0x0d16, 0x7850, - 0x9085, 0x0040, 0x7852, 0x7938, 0x7850, 0x9084, 0xfbcf, 0x7852, - 0x080c, 0x2a5b, 0x9085, 0x2000, 0x7852, 0x793a, 0x20a9, 0x0046, - 0x1d04, 0x0c70, 0x080c, 0x824d, 0x1f04, 0x0c70, 0x7850, 0x9085, - 0x0400, 0x9084, 0xdfbf, 0x7852, 0x793a, 0x080c, 0x7184, 0x0148, - 0x080c, 0x7196, 0x1118, 0x080c, 0x7479, 0x0050, 0x080c, 0x717b, - 0x0dd0, 0x080c, 0x7474, 0x080c, 0x746a, 0x080c, 0x709f, 0x0020, - 0x2009, 0x00f8, 0x080c, 0x5d2a, 0x20a9, 0x0028, 0xa001, 0x1f04, - 0x0c96, 0x7850, 0x9085, 0x1400, 0x7852, 0x080c, 0x7173, 0x0120, - 0x7843, 0x0090, 0x7843, 0x0010, 0x2021, 0xe678, 0x2019, 0xea60, - 0x0d0c, 0x824d, 0x7820, 0xd09c, 0x1580, 0x080c, 0x7173, 0x0904, - 0x0cfb, 0x7824, 0xd0ac, 0x1904, 0x0d1b, 0x080c, 0x7196, 0x1528, - 0x0046, 0x2021, 0x0320, 0x8421, 0x1df0, 0x004e, 0x7827, 0x1800, - 0x080c, 0x2a5b, 0x7824, 0x9084, 0x1800, 0x1160, 0x9484, 0x0fff, - 0x1138, 0x2001, 0x1810, 0x2004, 0xd0fc, 0x0110, 0x080c, 0x0d41, - 0x8421, 0x1158, 0x1d04, 0x0cd6, 0x080c, 0x824d, 0x080c, 0x7474, - 0x080c, 0x746a, 0x7003, 0x0001, 0x04f0, 0x8319, 0x1948, 0x1d04, - 0x0ce3, 0x080c, 0x824d, 0x2009, 0x1974, 0x2104, 0x9005, 0x0118, - 0x8001, 0x200a, 0x1178, 0x200b, 0x000a, 0x7827, 0x0048, 0x20a9, - 0x0002, 0x080c, 0x2a3c, 0x7924, 0x080c, 0x2a5b, 0xd19c, 0x0110, - 0x080c, 0x297c, 0x00d8, 0x080c, 0x7184, 0x1140, 0x94a2, 0x03e8, - 0x1128, 0x080c, 0x714b, 0x7003, 0x0001, 0x00a8, 0x7827, 0x1800, - 0x080c, 0x2a5b, 0x7824, 0x080c, 0x718d, 0x0110, 0xd0ac, 0x1158, - 0x9084, 0x1800, 0x0950, 0x7003, 0x0001, 0x0028, 0x2001, 0x0001, - 0x080c, 0x261a, 0x0078, 0x2009, 0x180c, 0x210c, 0xd19c, 0x1120, - 0x7904, 0x918d, 0x0002, 0x7906, 0x7827, 0x0048, 0x7828, 0x9085, - 0x0028, 0x782a, 0x7850, 0x9085, 0x0400, 0x7852, 0x2001, 0x1981, - 0x2003, 0x0000, 0x9006, 0x78f2, 0x015e, 0x003e, 0x000e, 0x080c, - 0x5469, 0x1110, 0x080c, 0x0e70, 0x012e, 0x00fe, 0x004e, 0x001e, - 0x0005, 0x0006, 0x0016, 0x0036, 0x0046, 0x00b6, 0x00c6, 0x00d6, - 0x00e6, 0x00f6, 0x0156, 0x0069, 0x0d0c, 0x824d, 0x015e, 0x00fe, - 0x00ee, 0x00de, 0x00ce, 0x00be, 0x004e, 0x003e, 0x001e, 0x000e, - 0x0005, 0x00e6, 0x2071, 0x189c, 0x7004, 0x9086, 0x0001, 0x1110, - 0x080c, 0x328e, 0x00ee, 0x0005, 0x0005, 0x2a70, 0x2061, 0x1985, - 0x2063, 0x0003, 0x6007, 0x0003, 0x600b, 0x0013, 0x600f, 0x0107, - 0x2001, 0x1956, 0x900e, 0x2102, 0x7192, 0x2001, 0x0100, 0x2004, - 0x9082, 0x0002, 0x0218, 0x705b, 0xffff, 0x0008, 0x715a, 0x7063, - 0xffff, 0x717a, 0x717e, 0x080c, 0xb9d1, 0x2061, 0x1946, 0x6003, - 0x0909, 0x6106, 0x600b, 0x8800, 0x600f, 0x0200, 0x6013, 0x00ff, - 0x6017, 0x000f, 0x611a, 0x601f, 0x07d0, 0x2061, 0x194e, 0x6003, - 0x8000, 0x6106, 0x610a, 0x600f, 0x0200, 0x6013, 0x00ff, 0x6116, - 0x601b, 0x0001, 0x611e, 0x2061, 0x1962, 0x6003, 0x514c, 0x6007, - 0x4f47, 0x600b, 0x4943, 0x600f, 0x2020, 0x2001, 0x182b, 0x2102, - 0x0005, 0x9016, 0x080c, 0x62f0, 0x1178, 0xb804, 0x90c4, 0x00ff, - 0x98c6, 0x0006, 0x0128, 0x90c4, 0xff00, 0x98c6, 0x0600, 0x1120, - 0x9186, 0x0080, 0x0108, 0x8210, 0x8108, 0x9186, 0x0800, 0x1d50, - 0x2208, 0x0005, 0x2091, 0x8000, 0x2079, 0x0000, 0x000e, 0x00f6, - 0x0010, 0x2091, 0x8000, 0x0e04, 0x0dd3, 0x0006, 0x0016, 0x2001, - 0x8002, 0x0006, 0x2079, 0x0000, 0x000e, 0x7882, 0x7836, 0x001e, - 0x798e, 0x000e, 0x788a, 0x000e, 0x7886, 0x3900, 0x789a, 0x00d6, - 0x2069, 0x0300, 0x6818, 0x78ae, 0x681c, 0x78b2, 0x2001, 0x19e2, - 0x2004, 0x78b6, 0x2001, 0x1a5e, 0x2004, 0x78ba, 0x6808, 0x78be, - 0x00de, 0x7833, 0x0012, 0x2091, 0x5000, 0x0156, 0x00d6, 0x0036, - 0x0026, 0x2079, 0x0300, 0x2069, 0x1a81, 0x7a08, 0x226a, 0x2069, - 0x1a82, 0x7a18, 0x226a, 0x8d68, 0x7a1c, 0x226a, 0x782c, 0x2019, - 0x1a8f, 0x201a, 0x2019, 0x1a92, 0x9016, 0x7808, 0xd09c, 0x0168, - 0x7820, 0x201a, 0x8210, 0x8318, 0x9386, 0x1a9b, 0x0108, 0x0ca8, - 0x7808, 0xd09c, 0x0110, 0x2011, 0xdead, 0x2019, 0x1a90, 0x782c, - 0x201a, 0x8318, 0x221a, 0x7803, 0x0000, 0x2069, 0x1a61, 0x901e, - 0x20a9, 0x0020, 0x7b26, 0x7a28, 0x226a, 0x8d68, 0x8318, 0x1f04, - 0x0e32, 0x002e, 0x003e, 0x00de, 0x015e, 0x2079, 0x1800, 0x7803, - 0x0005, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x0180, - 0x2001, 0x19f5, 0x2004, 0x9005, 0x0128, 0x2001, 0x008b, 0x2004, - 0xd0fc, 0x0dd8, 0x2001, 0x008a, 0x2003, 0x0002, 0x2003, 0x1001, - 0x080c, 0x5469, 0x1110, 0x080c, 0x0ea7, 0x0cd0, 0x0005, 0x918c, - 0x03ff, 0x2001, 0x0003, 0x2004, 0x9084, 0x0600, 0x1118, 0x918d, - 0x2800, 0x0010, 0x918d, 0x2000, 0x2001, 0x017f, 0x2102, 0x0005, - 0x00f6, 0x0006, 0x2079, 0x1826, 0x2f04, 0x8000, 0x207a, 0x080c, - 0x2a53, 0x1150, 0x0006, 0x2001, 0x1971, 0x2004, 0xd0fc, 0x000e, - 0x1118, 0x9082, 0x7530, 0x0010, 0x9082, 0x000f, 0x0258, 0x9006, - 0x207a, 0x2079, 0x1829, 0x2f04, 0x9084, 0x0001, 0x9086, 0x0001, - 0x207a, 0x0090, 0x2079, 0x1829, 0x2f7c, 0x8fff, 0x1138, 0x0026, - 0x2011, 0x0080, 0x080c, 0x0eed, 0x002e, 0x0030, 0x0026, 0x2011, - 0x0000, 0x080c, 0x0eed, 0x002e, 0x000e, 0x00fe, 0x0005, 0x0026, - 0x0126, 0x2011, 0x0080, 0x080c, 0x0eed, 0x20a9, 0x0fff, 0x080c, - 0x0f0e, 0x2011, 0x0040, 0x04c9, 0x20a9, 0x0fff, 0x080c, 0x0f0e, - 0x0c80, 0x7038, 0xd0b4, 0x1128, 0x0026, 0x2011, 0x0040, 0x0469, - 0x002e, 0x0005, 0x7038, 0xd0b4, 0x1128, 0x0026, 0x2011, 0x0080, - 0x0421, 0x002e, 0x0005, 0x0026, 0x70eb, 0x0000, 0x0459, 0x1148, - 0x080c, 0x2a53, 0x1118, 0x2011, 0x8484, 0x0058, 0x2011, 0x8282, - 0x0040, 0x080c, 0x2a53, 0x1118, 0x2011, 0xcdc5, 0x0010, 0x2011, - 0xcac2, 0x00e9, 0x002e, 0x0005, 0xd0b4, 0x0130, 0x0006, 0x3b00, - 0x9084, 0xff3f, 0x20d8, 0x000e, 0x0005, 0x0016, 0x3b08, 0x3a00, - 0x9104, 0x918d, 0x00c0, 0x21d8, 0x9084, 0xff3f, 0x9205, 0x20d0, - 0x001e, 0x0005, 0x2001, 0x1839, 0x2004, 0xd0dc, 0x0005, 0x9e86, - 0x1800, 0x190c, 0x0dd1, 0x70e4, 0xd0e4, 0x0108, 0xc2e5, 0x72e6, - 0xd0e4, 0x1118, 0x9294, 0x00c0, 0x0c01, 0x0005, 0x1d04, 0x0f0e, - 0x2091, 0x6000, 0x1f04, 0x0f0e, 0x0005, 0x890e, 0x810e, 0x810f, - 0x9194, 0x003f, 0x918c, 0xffc0, 0x0005, 0x0006, 0x2200, 0x914d, - 0x894f, 0x894d, 0x894d, 0x000e, 0x0005, 0x01d6, 0x0146, 0x0036, - 0x0096, 0x2061, 0x188b, 0x600b, 0x0000, 0x600f, 0x0000, 0x6003, - 0x0000, 0x6007, 0x0000, 0x2009, 0xffc0, 0x2105, 0x0006, 0x2001, - 0xaaaa, 0x200f, 0x2019, 0x5555, 0x9016, 0x2049, 0x0bff, 0xab02, - 0xa001, 0xa001, 0xa800, 0x9306, 0x1138, 0x2105, 0x9306, 0x0120, - 0x8210, 0x99c8, 0x0400, 0x0c98, 0x000e, 0x200f, 0x2001, 0x189b, - 0x928a, 0x000e, 0x1638, 0x928a, 0x0006, 0x2011, 0x0006, 0x1210, - 0x2011, 0x0000, 0x2202, 0x9006, 0x2008, 0x82ff, 0x01b0, 0x8200, - 0x600a, 0x600f, 0xffff, 0x6003, 0x0002, 0x6007, 0x0000, 0x0026, - 0x2019, 0x0010, 0x9280, 0x0001, 0x20e8, 0x21a0, 0x21a8, 0x4104, - 0x8319, 0x1de0, 0x8211, 0x1da0, 0x002e, 0x009e, 0x003e, 0x014e, - 0x01de, 0x0005, 0x2011, 0x000e, 0x08e8, 0x0016, 0x0026, 0x0096, - 0x3348, 0x080c, 0x0f15, 0x2100, 0x9300, 0x2098, 0x22e0, 0x009e, - 0x002e, 0x001e, 0x0036, 0x3518, 0x20a9, 0x0001, 0x4002, 0x8007, - 0x4004, 0x8319, 0x1dd8, 0x003e, 0x0005, 0x20e9, 0x0001, 0x71b4, - 0x81ff, 0x11c0, 0x9006, 0x2009, 0x0200, 0x20a9, 0x0002, 0x9298, - 0x0018, 0x23a0, 0x4001, 0x2009, 0x0700, 0x20a9, 0x0002, 0x9298, - 0x0008, 0x23a0, 0x4001, 0x7078, 0x8007, 0x717c, 0x810f, 0x20a9, - 0x0002, 0x4001, 0x9298, 0x000c, 0x23a0, 0x900e, 0x080c, 0x0db1, - 0x2001, 0x0000, 0x810f, 0x20a9, 0x0002, 0x4001, 0x0005, 0x89ff, - 0x0140, 0xa804, 0xa807, 0x0000, 0x0006, 0x080c, 0x103f, 0x009e, - 0x0cb0, 0x0005, 0x00e6, 0x2071, 0x1800, 0x080c, 0x10b8, 0x090c, - 0x0dd1, 0x00ee, 0x0005, 0x0086, 0x00e6, 0x0006, 0x0026, 0x0036, - 0x0126, 0x2091, 0x8000, 0x00c9, 0x2071, 0x1800, 0x73bc, 0x702c, - 0x9016, 0x9045, 0x0158, 0x8210, 0x9906, 0x090c, 0x0dd1, 0x2300, - 0x9202, 0x0120, 0x1a0c, 0x0dd1, 0xa000, 0x0c98, 0x012e, 0x003e, - 0x002e, 0x000e, 0x00ee, 0x008e, 0x0005, 0x0086, 0x00e6, 0x0006, - 0x0126, 0x2091, 0x8000, 0x2071, 0x190e, 0x7010, 0x9005, 0x0140, - 0x7018, 0x9045, 0x0128, 0x9906, 0x090c, 0x0dd1, 0xa000, 0x0cc8, - 0x012e, 0x000e, 0x00ee, 0x008e, 0x0005, 0x00e6, 0x2071, 0x1800, - 0x0126, 0x2091, 0x8000, 0x70bc, 0x8001, 0x0270, 0x70be, 0x702c, - 0x2048, 0x9085, 0x0001, 0xa800, 0x702e, 0xa803, 0x0000, 0xa807, - 0x0000, 0x012e, 0x00ee, 0x0005, 0x904e, 0x0cd8, 0x00e6, 0x0126, - 0x2091, 0x8000, 0x2071, 0x1800, 0x70bc, 0x90ca, 0x0040, 0x0268, - 0x8001, 0x70be, 0x702c, 0x2048, 0xa800, 0x702e, 0xa803, 0x0000, - 0xa807, 0x0000, 0x012e, 0x00ee, 0x0005, 0x904e, 0x0cd8, 0x00e6, - 0x0126, 0x2091, 0x8000, 0x0016, 0x890e, 0x810e, 0x810f, 0x9184, - 0x003f, 0xa862, 0x9184, 0xffc0, 0xa85e, 0x001e, 0x0020, 0x00e6, - 0x0126, 0x2091, 0x8000, 0x2071, 0x1800, 0x702c, 0xa802, 0x2900, - 0x702e, 0x70bc, 0x8000, 0x70be, 0x080c, 0x8091, 0x012e, 0x00ee, - 0x0005, 0x2071, 0x1800, 0x9026, 0x2009, 0x0000, 0x2049, 0x0400, - 0x2900, 0x702e, 0x8940, 0x2800, 0xa802, 0xa95e, 0xa863, 0x0001, - 0x8420, 0x9886, 0x0440, 0x0120, 0x2848, 0x9188, 0x0040, 0x0c90, - 0x2071, 0x188b, 0x7000, 0x9005, 0x11a0, 0x2001, 0x04d4, 0xa802, - 0x2048, 0x2009, 0x3500, 0x8940, 0x2800, 0xa802, 0xa95e, 0xa863, - 0x0001, 0x8420, 0x9886, 0x0800, 0x0120, 0x2848, 0x9188, 0x0040, - 0x0c90, 0x2071, 0x188b, 0x7104, 0x7200, 0x82ff, 0x01d0, 0x7308, - 0x8318, 0x831f, 0x831b, 0x831b, 0x7312, 0x8319, 0x2001, 0x0800, - 0xa802, 0x2048, 0x8900, 0xa802, 0x2040, 0xa95e, 0xaa62, 0x8420, - 0x2300, 0x9906, 0x0130, 0x2848, 0x9188, 0x0040, 0x9291, 0x0000, - 0x0c88, 0xa803, 0x0000, 0x2071, 0x1800, 0x74ba, 0x74be, 0x0005, - 0x00e6, 0x0016, 0x9984, 0xfc00, 0x01e8, 0x908c, 0xf800, 0x1168, - 0x9982, 0x0400, 0x02b8, 0x9982, 0x0440, 0x0278, 0x9982, 0x04d4, - 0x0288, 0x9982, 0x0800, 0x1270, 0x0040, 0x9982, 0x0800, 0x0250, - 0x2071, 0x188b, 0x7010, 0x9902, 0x1228, 0x9085, 0x0001, 0x001e, - 0x00ee, 0x0005, 0x9006, 0x0cd8, 0x00e6, 0x2071, 0x19f4, 0x7007, - 0x0000, 0x9006, 0x701e, 0x7022, 0x7002, 0x2071, 0x0000, 0x7010, - 0x9085, 0x8044, 0x7012, 0x2071, 0x0080, 0x9006, 0x20a9, 0x0040, - 0x7022, 0x1f04, 0x10f0, 0x702b, 0x0020, 0x00ee, 0x0005, 0x0126, - 0x2091, 0x8000, 0x00e6, 0xa06f, 0x0000, 0x2071, 0x19f4, 0x701c, - 0x9088, 0x19fe, 0x280a, 0x8000, 0x9084, 0x003f, 0x701e, 0x7120, - 0x9106, 0x090c, 0x0dd1, 0x7004, 0x9005, 0x1128, 0x00f6, 0x2079, - 0x0080, 0x00a9, 0x00fe, 0x00ee, 0x012e, 0x0005, 0x0126, 0x2091, - 0x8000, 0x00e6, 0x2071, 0x19f4, 0x7004, 0x9005, 0x1128, 0x00f6, - 0x2079, 0x0080, 0x0021, 0x00fe, 0x00ee, 0x012e, 0x0005, 0x7004, - 0x9086, 0x0000, 0x1110, 0x7007, 0x0006, 0x7000, 0x0002, 0x1139, - 0x1137, 0x1137, 0x1137, 0x12b0, 0x12b0, 0x12b0, 0x12b0, 0x080c, - 0x0dd1, 0x701c, 0x7120, 0x9106, 0x1148, 0x792c, 0x9184, 0x0001, - 0x1120, 0xd1fc, 0x1110, 0x7007, 0x0000, 0x0005, 0x0096, 0x9180, - 0x19fe, 0x2004, 0x700a, 0x2048, 0x8108, 0x918c, 0x003f, 0x7122, - 0x782b, 0x0026, 0xa88c, 0x7802, 0xa890, 0x7806, 0xa894, 0x780a, - 0xa898, 0x780e, 0xa878, 0x700e, 0xa870, 0x7016, 0xa874, 0x701a, - 0xa868, 0x009e, 0xd084, 0x0120, 0x7007, 0x0001, 0x0029, 0x0005, - 0x7007, 0x0002, 0x00b1, 0x0005, 0x0016, 0x0026, 0x710c, 0x2011, - 0x0040, 0x9182, 0x0040, 0x1210, 0x2110, 0x9006, 0x700e, 0x7212, - 0x8203, 0x7812, 0x782b, 0x0020, 0x782b, 0x0041, 0x002e, 0x001e, - 0x0005, 0x0016, 0x0026, 0x0136, 0x0146, 0x0156, 0x7014, 0x20e0, - 0x7018, 0x2098, 0x20e9, 0x0000, 0x20a1, 0x0088, 0x782b, 0x0026, - 0x710c, 0x2011, 0x0040, 0x9182, 0x0040, 0x1210, 0x2110, 0x9006, - 0x700e, 0x22a8, 0x4006, 0x8203, 0x7812, 0x782b, 0x0020, 0x3300, - 0x701a, 0x782b, 0x0001, 0x015e, 0x014e, 0x013e, 0x002e, 0x001e, - 0x0005, 0x2009, 0x19f4, 0x2104, 0xc095, 0x200a, 0x080c, 0x1116, - 0x0005, 0x0016, 0x00e6, 0x2071, 0x19f4, 0x00f6, 0x2079, 0x0080, - 0x792c, 0xd1bc, 0x190c, 0x0dca, 0x782b, 0x0002, 0xd1fc, 0x0120, - 0x918c, 0x0700, 0x7004, 0x0023, 0x00fe, 0x00ee, 0x001e, 0x0005, - 0x1127, 0x11cf, 0x1203, 0x0dd1, 0x0dd1, 0x12bc, 0x0dd1, 0x918c, - 0x0700, 0x1550, 0x0136, 0x0146, 0x0156, 0x7014, 0x20e8, 0x7018, - 0x20a0, 0x20e1, 0x0000, 0x2099, 0x0088, 0x782b, 0x0040, 0x7010, - 0x20a8, 0x4005, 0x3400, 0x701a, 0x015e, 0x014e, 0x013e, 0x700c, - 0x9005, 0x0578, 0x7800, 0x7802, 0x7804, 0x7806, 0x080c, 0x116c, - 0x0005, 0x7008, 0x0096, 0x2048, 0xa86f, 0x0100, 0x009e, 0x7007, - 0x0000, 0x080c, 0x1127, 0x0005, 0x7008, 0x0096, 0x2048, 0xa86f, - 0x0200, 0x009e, 0x0ca0, 0x918c, 0x0700, 0x1150, 0x700c, 0x9005, - 0x0180, 0x7800, 0x7802, 0x7804, 0x7806, 0x080c, 0x1181, 0x0005, - 0x7008, 0x0096, 0x2048, 0xa86f, 0x0200, 0x009e, 0x7007, 0x0000, - 0x0080, 0x0096, 0x7008, 0x2048, 0x7800, 0xa88e, 0x7804, 0xa892, - 0x7808, 0xa896, 0x780c, 0xa89a, 0xa86f, 0x0100, 0x009e, 0x7007, - 0x0000, 0x0096, 0x00d6, 0x7008, 0x2048, 0x2001, 0x18b7, 0x2004, - 0x9906, 0x1128, 0xa89c, 0x080f, 0x00de, 0x009e, 0x00a0, 0x00de, - 0x009e, 0x0096, 0x00d6, 0x7008, 0x2048, 0x0081, 0x0150, 0xa89c, - 0x0086, 0x2940, 0x080f, 0x008e, 0x00de, 0x009e, 0x080c, 0x1116, - 0x0005, 0x00de, 0x009e, 0x080c, 0x1116, 0x0005, 0xa8a8, 0xd08c, - 0x0005, 0x0096, 0xa0a0, 0x904d, 0x090c, 0x0dd1, 0xa06c, 0x908e, - 0x0100, 0x0130, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897, 0x4002, - 0x080c, 0x699e, 0xa09f, 0x0000, 0xa0a3, 0x0000, 0x2848, 0x080c, - 0x103f, 0x009e, 0x0005, 0x00a6, 0xa0a0, 0x904d, 0x090c, 0x0dd1, - 0xa06c, 0x908e, 0x0100, 0x0128, 0xa87b, 0x0001, 0xa883, 0x0000, - 0x00c0, 0xa80c, 0x2050, 0xb004, 0x9005, 0x0198, 0xa80e, 0x2050, - 0x8006, 0x8006, 0x8007, 0x908c, 0x003f, 0x9084, 0xffc0, 0x9080, - 0x0002, 0xa076, 0xa172, 0xb000, 0xa07a, 0x2810, 0x080c, 0x10f7, - 0x00e8, 0xa97c, 0xa894, 0x0016, 0x0006, 0x080c, 0x699e, 0x000e, - 0x001e, 0xd1fc, 0x1138, 0xd1f4, 0x0128, 0x00c6, 0x2060, 0x080c, - 0x9d08, 0x00ce, 0x7008, 0x2048, 0xa89f, 0x0000, 0xa8a3, 0x0000, - 0x080c, 0x103f, 0x7007, 0x0000, 0x080c, 0x1116, 0x00ae, 0x0005, - 0x0126, 0x2091, 0x8000, 0x782b, 0x1001, 0x7007, 0x0005, 0x7000, - 0xc094, 0x7002, 0x012e, 0x0005, 0x7007, 0x0000, 0x080c, 0x1127, - 0x0005, 0x0126, 0x2091, 0x2200, 0x2079, 0x0300, 0x2071, 0x1a3e, - 0x7003, 0x0000, 0x78bf, 0x00f6, 0x781b, 0x4800, 0x00c1, 0x7803, - 0x0003, 0x780f, 0x0000, 0x20a9, 0x025f, 0x2061, 0xd06e, 0x2c0d, - 0x7912, 0xe104, 0x9ce0, 0x0002, 0x7916, 0x1f04, 0x12d7, 0x7807, - 0x0007, 0x7803, 0x0000, 0x7803, 0x0001, 0x012e, 0x0005, 0x00c6, - 0x7803, 0x0000, 0x7808, 0xd09c, 0x0110, 0x7820, 0x0cd8, 0x2001, - 0x1a3f, 0x2003, 0x0000, 0x78ab, 0x0004, 0x78ac, 0xd0ac, 0x1de8, - 0x78ab, 0x0002, 0x7807, 0x0007, 0x7827, 0x0030, 0x782b, 0x0400, - 0x7827, 0x0031, 0x782b, 0x1a61, 0x781f, 0xff00, 0x781b, 0xb700, - 0x2001, 0x0200, 0x2004, 0xd0dc, 0x0110, 0x781f, 0x0303, 0x2061, - 0x1a61, 0x602f, 0x1cc8, 0x2001, 0x1819, 0x2004, 0x9082, 0x1cc8, - 0x6032, 0x603b, 0x1f59, 0x2001, 0x3167, 0xd0fc, 0x190c, 0x0dd1, - 0x2001, 0x1810, 0x2004, 0xd0c4, 0x1128, 0x2001, 0x0003, 0x2004, - 0xd0d4, 0x1118, 0x783f, 0x3167, 0x0020, 0x9084, 0xc000, 0x783f, - 0xb167, 0x00ce, 0x0005, 0x0126, 0x2091, 0x2200, 0x7908, 0x9184, - 0x0070, 0x190c, 0x0dca, 0xd19c, 0x0158, 0x7820, 0x908c, 0xf000, - 0x15e8, 0x908a, 0x0024, 0x1a0c, 0x0dd1, 0x0023, 0x012e, 0x0005, - 0x012e, 0x0005, 0x136e, 0x136e, 0x1385, 0x138a, 0x138e, 0x1393, - 0x13bb, 0x13bf, 0x13cd, 0x13d1, 0x136e, 0x1454, 0x1458, 0x14c8, - 0x136e, 0x136e, 0x136e, 0x136e, 0x136e, 0x136e, 0x136e, 0x136e, - 0x136e, 0x136e, 0x136e, 0x136e, 0x136e, 0x1395, 0x136e, 0x136e, - 0x136e, 0x136e, 0x136e, 0x136e, 0x1372, 0x1370, 0x080c, 0x0dd1, - 0x080c, 0x0dca, 0x080c, 0x14cf, 0x2009, 0x1a56, 0x2104, 0x8000, - 0x200a, 0x080c, 0x7bb0, 0x080c, 0x1984, 0x0005, 0x2009, 0x0048, - 0x2060, 0x080c, 0x9d7a, 0x012e, 0x0005, 0x7004, 0xc085, 0xc0b5, - 0x7006, 0x0005, 0x7004, 0xc085, 0x7006, 0x0005, 0x080c, 0x14cf, - 0x080c, 0x1628, 0x0005, 0x080c, 0x0dd1, 0x080c, 0x14cf, 0x2060, + 0x1904, 0x0ab1, 0x080c, 0x0ecd, 0x080c, 0x72e5, 0x0150, 0x080c, + 0x7308, 0x15b0, 0x2079, 0x0100, 0x7828, 0x9085, 0x1800, 0x782a, + 0x0478, 0x080c, 0x7212, 0x7000, 0x9086, 0x0001, 0x1904, 0x0ab1, + 0x7094, 0x9086, 0x0029, 0x1904, 0x0ab1, 0x080c, 0x8253, 0x080c, + 0x8245, 0x2079, 0x0100, 0x782f, 0x0008, 0x2001, 0x0161, 0x2003, + 0x0001, 0x7827, 0xffff, 0x7a28, 0x9295, 0x5e2f, 0x7a2a, 0x2011, + 0x7176, 0x080c, 0x835e, 0x2011, 0x7169, 0x080c, 0x8474, 0x2011, + 0x5d5f, 0x080c, 0x835e, 0x2011, 0x8030, 0x901e, 0x7392, 0x04d0, + 0x080c, 0x5607, 0x2079, 0x0100, 0x7844, 0x9005, 0x1904, 0x0ab1, + 0x2011, 0x5d5f, 0x080c, 0x835e, 0x2011, 0x7176, 0x080c, 0x835e, + 0x2011, 0x7169, 0x080c, 0x8474, 0x2001, 0x0265, 0x2001, 0x0205, + 0x2003, 0x0000, 0x7840, 0x9084, 0xfffb, 0x7842, 0x2001, 0x1983, + 0x2004, 0x9005, 0x1140, 0x00c6, 0x2061, 0x0100, 0x080c, 0x5eac, + 0x00ce, 0x0804, 0x0ab1, 0x780f, 0x006b, 0x7a28, 0x080c, 0x72ed, + 0x0118, 0x9295, 0x5e2f, 0x0010, 0x9295, 0x402f, 0x7a2a, 0x2011, + 0x8010, 0x73d4, 0x2001, 0x1984, 0x2003, 0x0001, 0x080c, 0x29ae, + 0x080c, 0x4abd, 0x7244, 0xc284, 0x7246, 0x2001, 0x180c, 0x200c, + 0xc1ac, 0xc1cc, 0x2102, 0x080c, 0x98cb, 0x2011, 0x0004, 0x080c, + 0xb965, 0x080c, 0x664c, 0x080c, 0x72e5, 0x1120, 0x080c, 0x29f2, + 0x02e0, 0x0400, 0x080c, 0x5eb3, 0x0140, 0x7093, 0x0001, 0x70cf, + 0x0000, 0x080c, 0x57d9, 0x0804, 0x0ab1, 0x080c, 0x55a7, 0xd094, + 0x0188, 0x2011, 0x180c, 0x2204, 0xc0cd, 0x2012, 0x080c, 0x55ab, + 0xd0d4, 0x1118, 0x080c, 0x29f2, 0x1270, 0x2011, 0x180c, 0x2204, + 0xc0bc, 0x00a8, 0x080c, 0x55ab, 0xd0d4, 0x1db8, 0x2011, 0x180c, + 0x2204, 0xc0bd, 0x0060, 0x2011, 0x180c, 0x2204, 0xc0bd, 0x2012, + 0x080c, 0x673e, 0x1128, 0xd0a4, 0x0118, 0x2204, 0xc0fd, 0x2012, + 0x080c, 0x6704, 0x0120, 0x7a0c, 0xc2b4, 0x7a0e, 0x00a8, 0x707b, + 0x0000, 0x080c, 0x72e5, 0x1130, 0x70ac, 0x9005, 0x1168, 0x080c, + 0xbc7a, 0x0050, 0x080c, 0xbc7a, 0x70d8, 0xd09c, 0x1128, 0x70ac, + 0x9005, 0x0110, 0x080c, 0x5e89, 0x70e3, 0x0000, 0x70df, 0x0000, + 0x70a3, 0x0000, 0x080c, 0x29fa, 0x0228, 0x2011, 0x0101, 0x2204, + 0xc0c4, 0x2012, 0x72d8, 0x080c, 0x72e5, 0x1178, 0x9016, 0x0016, + 0x080c, 0x27b7, 0x2019, 0x194a, 0x211a, 0x001e, 0x705b, 0xffff, + 0x705f, 0x00ef, 0x707f, 0x0000, 0x0020, 0x2019, 0x194a, 0x201b, + 0x0000, 0x2079, 0x185e, 0x7804, 0xd0ac, 0x0108, 0xc295, 0x72da, + 0x080c, 0x72e5, 0x0118, 0x9296, 0x0004, 0x0548, 0x2011, 0x0001, + 0x080c, 0xb965, 0x70a7, 0x0000, 0x70ab, 0xffff, 0x7003, 0x0002, + 0x2079, 0x0100, 0x7827, 0x0003, 0x7828, 0x9085, 0x0003, 0x782a, + 0x00fe, 0x080c, 0x2e5f, 0x2011, 0x0005, 0x080c, 0x99d6, 0x080c, + 0x8c37, 0x080c, 0x72e5, 0x0148, 0x00c6, 0x2061, 0x0100, 0x0016, + 0x080c, 0x27b7, 0x61e2, 0x001e, 0x00ce, 0x012e, 0x0420, 0x70a7, + 0x0000, 0x70ab, 0xffff, 0x7003, 0x0002, 0x00f6, 0x2079, 0x0100, + 0x7827, 0x0003, 0x7828, 0x9085, 0x0003, 0x782a, 0x00fe, 0x2011, + 0x0005, 0x080c, 0x99d6, 0x080c, 0x8c37, 0x080c, 0x72e5, 0x0148, + 0x00c6, 0x2061, 0x0100, 0x0016, 0x080c, 0x27b7, 0x61e2, 0x001e, + 0x00ce, 0x00fe, 0x012e, 0x0005, 0x00c6, 0x00b6, 0x080c, 0x72e5, + 0x1118, 0x20a9, 0x0800, 0x0010, 0x20a9, 0x0782, 0x080c, 0x72e5, + 0x1110, 0x900e, 0x0010, 0x2009, 0x007e, 0x86ff, 0x0138, 0x9180, + 0x1000, 0x2004, 0x905d, 0x0110, 0xb800, 0xd0bc, 0x090c, 0x3162, + 0x8108, 0x1f04, 0x0ac5, 0x707b, 0x0000, 0x707c, 0x9084, 0x00ff, + 0x707e, 0x70af, 0x0000, 0x00be, 0x00ce, 0x0005, 0x00b6, 0x0126, + 0x2091, 0x8000, 0x7000, 0x9086, 0x0002, 0x1904, 0x0b9b, 0x70a8, + 0x9086, 0xffff, 0x0130, 0x080c, 0x2e5f, 0x080c, 0x8c37, 0x0804, + 0x0b9b, 0x70d8, 0xd0ac, 0x1110, 0xd09c, 0x0558, 0xd084, 0x0548, + 0x0006, 0x2001, 0x0103, 0x2003, 0x002b, 0x000e, 0xd08c, 0x0508, + 0x080c, 0x31c5, 0x11d0, 0x70dc, 0x9086, 0xffff, 0x01b0, 0x080c, + 0x2fd8, 0x080c, 0x8c37, 0x70d8, 0xd094, 0x1904, 0x0b9b, 0x2011, + 0x0001, 0x080c, 0xbef8, 0x0110, 0x2011, 0x0003, 0x901e, 0x080c, + 0x3012, 0x080c, 0x8c37, 0x0804, 0x0b9b, 0x70e0, 0x9005, 0x1904, + 0x0b9b, 0x70a4, 0x9005, 0x1904, 0x0b9b, 0x70d8, 0xd0a4, 0x0118, + 0xd0b4, 0x0904, 0x0b9b, 0x080c, 0x6704, 0x1904, 0x0b9b, 0x080c, + 0x6757, 0x1904, 0x0b9b, 0x080c, 0x673e, 0x01c0, 0x0156, 0x00c6, + 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x6411, 0x1118, 0xb800, + 0xd0ec, 0x1138, 0x001e, 0x8108, 0x1f04, 0x0b3b, 0x00ce, 0x015e, + 0x0028, 0x001e, 0x00ce, 0x015e, 0x0804, 0x0b9b, 0x0006, 0x2001, + 0x0103, 0x2003, 0x006b, 0x000e, 0x2011, 0x1990, 0x080c, 0x0f89, + 0x2011, 0x19aa, 0x080c, 0x0f89, 0x7030, 0xc08c, 0x7032, 0x7003, + 0x0003, 0x70ab, 0xffff, 0x080c, 0x0ecd, 0x9006, 0x080c, 0x264c, + 0x080c, 0x31c5, 0x0118, 0x080c, 0x4c5a, 0x0050, 0x0036, 0x0046, + 0x2019, 0xffff, 0x2021, 0x0006, 0x080c, 0x4c74, 0x004e, 0x003e, + 0x00f6, 0x2079, 0x0100, 0x080c, 0x7308, 0x0150, 0x080c, 0x72e5, + 0x7828, 0x0118, 0x9084, 0xe1ff, 0x0010, 0x9084, 0xffdf, 0x782a, + 0x00fe, 0x2001, 0x19c5, 0x2004, 0x9086, 0x0005, 0x1120, 0x2011, + 0x0000, 0x080c, 0x99d6, 0x2011, 0x0000, 0x080c, 0x99e0, 0x080c, + 0x8c37, 0x080c, 0x8d06, 0x012e, 0x00be, 0x0005, 0x0016, 0x0046, + 0x00f6, 0x0126, 0x2091, 0x8000, 0x2079, 0x0100, 0x7904, 0x918c, + 0xfffd, 0x7906, 0x2009, 0x00f7, 0x080c, 0x5e72, 0x7940, 0x918c, + 0x0010, 0x7942, 0x7924, 0xd1b4, 0x0110, 0x7827, 0x0040, 0xd19c, + 0x0110, 0x7827, 0x0008, 0x0006, 0x0036, 0x0156, 0x7954, 0xd1ac, + 0x1904, 0x0c2b, 0x2001, 0x1984, 0x2004, 0x9005, 0x1518, 0x080c, + 0x2a75, 0x1148, 0x2001, 0x0001, 0x080c, 0x29dd, 0x2001, 0x0001, + 0x080c, 0x29c0, 0x00b8, 0x080c, 0x2a7d, 0x1138, 0x9006, 0x080c, + 0x29dd, 0x9006, 0x080c, 0x29c0, 0x0068, 0x080c, 0x2a85, 0x1d50, + 0x2001, 0x1974, 0x2004, 0xd0fc, 0x0108, 0x0020, 0x080c, 0x27eb, + 0x0804, 0x0d0a, 0x080c, 0x72f6, 0x0148, 0x080c, 0x7308, 0x1118, + 0x080c, 0x75eb, 0x0050, 0x080c, 0x72ed, 0x0dd0, 0x080c, 0x75e6, + 0x080c, 0x75dc, 0x080c, 0x7212, 0x0058, 0x080c, 0x72e5, 0x0140, + 0x2009, 0x00f8, 0x080c, 0x5e72, 0x7843, 0x0090, 0x7843, 0x0010, + 0x20a9, 0x09c4, 0x7820, 0xd09c, 0x1138, 0x080c, 0x72e5, 0x0138, + 0x7824, 0xd0ac, 0x1904, 0x0d0f, 0x1f04, 0x0c0a, 0x0070, 0x7824, + 0x080c, 0x72ff, 0x0118, 0xd0ac, 0x1904, 0x0d0f, 0x9084, 0x1800, + 0x0d98, 0x7003, 0x0001, 0x0804, 0x0d0f, 0x2001, 0x0001, 0x080c, + 0x264c, 0x0804, 0x0d22, 0x2001, 0x1984, 0x2004, 0x9005, 0x1518, + 0x080c, 0x2a75, 0x1148, 0x2001, 0x0001, 0x080c, 0x29dd, 0x2001, + 0x0001, 0x080c, 0x29c0, 0x00b8, 0x080c, 0x2a7d, 0x1138, 0x9006, + 0x080c, 0x29dd, 0x9006, 0x080c, 0x29c0, 0x0068, 0x080c, 0x2a85, + 0x1d50, 0x2001, 0x1974, 0x2004, 0xd0fc, 0x0108, 0x0020, 0x080c, + 0x27eb, 0x0804, 0x0d0a, 0x7850, 0x9085, 0x0040, 0x7852, 0x7938, + 0x7850, 0x9084, 0xfbcf, 0x7852, 0x080c, 0x2a8d, 0x9085, 0x2000, + 0x7852, 0x793a, 0x20a9, 0x0046, 0x1d04, 0x0c64, 0x080c, 0x8454, + 0x1f04, 0x0c64, 0x7850, 0x9085, 0x0400, 0x9084, 0xdfbf, 0x7852, + 0x793a, 0x080c, 0x72f6, 0x0148, 0x080c, 0x7308, 0x1118, 0x080c, + 0x75eb, 0x0050, 0x080c, 0x72ed, 0x0dd0, 0x080c, 0x75e6, 0x080c, + 0x75dc, 0x080c, 0x7212, 0x0020, 0x2009, 0x00f8, 0x080c, 0x5e72, + 0x20a9, 0x0028, 0xa001, 0x1f04, 0x0c8a, 0x7850, 0x9085, 0x1400, + 0x7852, 0x080c, 0x72e5, 0x0120, 0x7843, 0x0090, 0x7843, 0x0010, + 0x2021, 0xe678, 0x2019, 0xea60, 0x0d0c, 0x8454, 0x7820, 0xd09c, + 0x1580, 0x080c, 0x72e5, 0x0904, 0x0cef, 0x7824, 0xd0ac, 0x1904, + 0x0d0f, 0x080c, 0x7308, 0x1528, 0x0046, 0x2021, 0x0320, 0x8421, + 0x1df0, 0x004e, 0x7827, 0x1800, 0x080c, 0x2a8d, 0x7824, 0x9084, + 0x1800, 0x1160, 0x9484, 0x0fff, 0x1138, 0x2001, 0x1810, 0x2004, + 0xd0fc, 0x0110, 0x080c, 0x0d34, 0x8421, 0x1158, 0x1d04, 0x0cca, + 0x080c, 0x8454, 0x080c, 0x75e6, 0x080c, 0x75dc, 0x7003, 0x0001, + 0x04f0, 0x8319, 0x1948, 0x1d04, 0x0cd7, 0x080c, 0x8454, 0x2009, + 0x1977, 0x2104, 0x9005, 0x0118, 0x8001, 0x200a, 0x1178, 0x200b, + 0x000a, 0x7827, 0x0048, 0x20a9, 0x0002, 0x080c, 0x2a6e, 0x7924, + 0x080c, 0x2a8d, 0xd19c, 0x0110, 0x080c, 0x29ae, 0x00d8, 0x080c, + 0x72f6, 0x1140, 0x94a2, 0x03e8, 0x1128, 0x080c, 0x72bd, 0x7003, + 0x0001, 0x00a8, 0x7827, 0x1800, 0x080c, 0x2a8d, 0x7824, 0x080c, + 0x72ff, 0x0110, 0xd0ac, 0x1158, 0x9084, 0x1800, 0x0950, 0x7003, + 0x0001, 0x0028, 0x2001, 0x0001, 0x080c, 0x264c, 0x0078, 0x2009, + 0x180c, 0x210c, 0xd19c, 0x1120, 0x7904, 0x918d, 0x0002, 0x7906, + 0x7827, 0x0048, 0x7828, 0x9085, 0x0028, 0x782a, 0x7850, 0x9085, + 0x0400, 0x7852, 0x2001, 0x1984, 0x2003, 0x0000, 0x9006, 0x78f2, + 0x015e, 0x003e, 0x000e, 0x080c, 0x55b6, 0x090c, 0x0e64, 0x012e, + 0x00fe, 0x004e, 0x001e, 0x0005, 0x0006, 0x0016, 0x0036, 0x0046, + 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x0156, 0x0069, 0x0d0c, + 0x8454, 0x015e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x004e, + 0x003e, 0x001e, 0x000e, 0x0005, 0x00e6, 0x2071, 0x189f, 0x7004, + 0x9086, 0x0001, 0x1110, 0x080c, 0x32f3, 0x00ee, 0x0005, 0x0005, + 0x2a70, 0x2061, 0x1988, 0x2063, 0x0003, 0x6007, 0x0003, 0x600b, + 0x001a, 0x600f, 0x0107, 0x2001, 0x1959, 0x900e, 0x2102, 0x7192, + 0x2001, 0x0100, 0x2004, 0x9082, 0x0002, 0x0218, 0x705b, 0xffff, + 0x0008, 0x715a, 0x7063, 0xffff, 0x717a, 0x717e, 0x080c, 0xbc7a, + 0x2061, 0x1949, 0x6003, 0x0909, 0x6106, 0x600b, 0x8800, 0x600f, + 0x0200, 0x6013, 0x00ff, 0x6017, 0x000f, 0x611a, 0x601f, 0x07d0, + 0x2061, 0x1951, 0x6003, 0x8000, 0x6106, 0x610a, 0x600f, 0x0200, + 0x6013, 0x00ff, 0x6116, 0x601b, 0x0001, 0x611e, 0x2061, 0x1965, + 0x6003, 0x514c, 0x6007, 0x4f47, 0x600b, 0x4943, 0x600f, 0x2020, + 0x2001, 0x182b, 0x2102, 0x0005, 0x9016, 0x080c, 0x6411, 0x1178, + 0xb804, 0x90c4, 0x00ff, 0x98c6, 0x0006, 0x0128, 0x90c4, 0xff00, + 0x98c6, 0x0600, 0x1120, 0x9186, 0x0080, 0x0108, 0x8210, 0x8108, + 0x9186, 0x0800, 0x1d50, 0x2208, 0x0005, 0x2091, 0x8000, 0x2079, + 0x0000, 0x000e, 0x00f6, 0x0010, 0x2091, 0x8000, 0x0e04, 0x0dc6, + 0x0006, 0x0016, 0x2001, 0x8002, 0x0006, 0x2079, 0x0000, 0x000e, + 0x7882, 0x7836, 0x001e, 0x798e, 0x000e, 0x788a, 0x000e, 0x7886, + 0x3900, 0x789a, 0x00d6, 0x2069, 0x0300, 0x6818, 0x78ae, 0x681c, + 0x78b2, 0x2001, 0x19e5, 0x2004, 0x78b6, 0x2001, 0x1a61, 0x2004, + 0x78ba, 0x6808, 0x78be, 0x00de, 0x7833, 0x0012, 0x2091, 0x5000, + 0x0156, 0x00d6, 0x0036, 0x0026, 0x2079, 0x0300, 0x2069, 0x1a84, + 0x7a08, 0x226a, 0x2069, 0x1a85, 0x7a18, 0x226a, 0x8d68, 0x7a1c, + 0x226a, 0x782c, 0x2019, 0x1a92, 0x201a, 0x2019, 0x1a95, 0x9016, + 0x7808, 0xd09c, 0x0168, 0x7820, 0x201a, 0x8210, 0x8318, 0x9386, + 0x1a9e, 0x0108, 0x0ca8, 0x7808, 0xd09c, 0x0110, 0x2011, 0xdead, + 0x2019, 0x1a93, 0x782c, 0x201a, 0x8318, 0x221a, 0x7803, 0x0000, + 0x2069, 0x1a64, 0x901e, 0x20a9, 0x0020, 0x7b26, 0x7a28, 0x226a, + 0x8d68, 0x8318, 0x1f04, 0x0e25, 0x002e, 0x003e, 0x00de, 0x015e, + 0x2079, 0x1800, 0x7803, 0x0005, 0x2091, 0x4080, 0x2001, 0x0089, + 0x2004, 0xd084, 0x0188, 0x2001, 0x19f8, 0x2004, 0x9005, 0x0130, + 0x2001, 0x008b, 0x2004, 0x9084, 0x8004, 0x0dd0, 0x2001, 0x008a, + 0x2003, 0x0002, 0x2003, 0x1001, 0x080c, 0x55b6, 0x1110, 0x080c, + 0x0e9b, 0x0cd0, 0x0005, 0x918c, 0x03ff, 0x2001, 0x0003, 0x2004, + 0x9084, 0x0600, 0x1118, 0x918d, 0x2800, 0x0010, 0x918d, 0x2000, + 0x2001, 0x017f, 0x2102, 0x0005, 0x00f6, 0x0006, 0x2079, 0x1826, + 0x2f04, 0x8000, 0x207a, 0x080c, 0x2a85, 0x1150, 0x0006, 0x2001, + 0x1974, 0x2004, 0xd0fc, 0x000e, 0x1118, 0x9082, 0x7530, 0x0010, + 0x9082, 0x000f, 0x0258, 0x9006, 0x207a, 0x2079, 0x1829, 0x2f04, + 0x9084, 0x0001, 0x9086, 0x0001, 0x207a, 0x0090, 0x2079, 0x1829, + 0x2f7c, 0x8fff, 0x1138, 0x0026, 0x2011, 0x0080, 0x080c, 0x0ee1, + 0x002e, 0x0030, 0x0026, 0x2011, 0x0000, 0x080c, 0x0ee1, 0x002e, + 0x000e, 0x00fe, 0x0005, 0x0026, 0x0126, 0x2011, 0x0080, 0x080c, + 0x0ee1, 0x20a9, 0x0fff, 0x080c, 0x0f02, 0x2011, 0x0040, 0x04c9, + 0x20a9, 0x0fff, 0x080c, 0x0f02, 0x0c80, 0x2011, 0x0040, 0x0488, + 0x2011, 0x0080, 0x0470, 0x0005, 0x0026, 0x70eb, 0x0000, 0x04b1, + 0x1148, 0x080c, 0x2a85, 0x1118, 0x2011, 0x8484, 0x0058, 0x2011, + 0x8282, 0x0040, 0x080c, 0x2a85, 0x1118, 0x2011, 0xcdc5, 0x0010, + 0x2011, 0xcac2, 0x0441, 0x002e, 0x0005, 0x080c, 0x55b6, 0x1140, + 0x0026, 0x2001, 0x1800, 0x2004, 0x9084, 0x0007, 0x0013, 0x002e, + 0x0005, 0x0ecc, 0x0eb0, 0x0eb0, 0x0ead, 0x0e64, 0x0eb0, 0x0eb0, + 0x0e64, 0x0016, 0x3b08, 0x3a00, 0x9104, 0x918d, 0x00c0, 0x21d8, + 0x9084, 0xff3f, 0x9205, 0x20d0, 0x001e, 0x0005, 0x2001, 0x1839, + 0x2004, 0xd0dc, 0x0005, 0x9e86, 0x1800, 0x190c, 0x0dc4, 0x70e4, + 0xd0e4, 0x0108, 0xc2e5, 0x72e6, 0xd0e4, 0x1118, 0x9294, 0x00c0, + 0x0c01, 0x0005, 0x1d04, 0x0f02, 0x2091, 0x6000, 0x1f04, 0x0f02, + 0x0005, 0x890e, 0x810e, 0x810f, 0x9194, 0x003f, 0x918c, 0xffc0, + 0x0005, 0x0006, 0x2200, 0x914d, 0x894f, 0x894d, 0x894d, 0x000e, + 0x0005, 0x01d6, 0x0146, 0x0036, 0x0096, 0x2061, 0x188e, 0x600b, + 0x0000, 0x600f, 0x0000, 0x6003, 0x0000, 0x6007, 0x0000, 0x2009, + 0xffc0, 0x2105, 0x0006, 0x2001, 0xaaaa, 0x200f, 0x2019, 0x5555, + 0x9016, 0x2049, 0x0bff, 0xab02, 0xa001, 0xa001, 0xa800, 0x9306, + 0x1138, 0x2105, 0x9306, 0x0120, 0x8210, 0x99c8, 0x0400, 0x0c98, + 0x000e, 0x200f, 0x2001, 0x189e, 0x928a, 0x000e, 0x1638, 0x928a, + 0x0006, 0x2011, 0x0006, 0x1210, 0x2011, 0x0000, 0x2202, 0x9006, + 0x2008, 0x82ff, 0x01b0, 0x8200, 0x600a, 0x600f, 0xffff, 0x6003, + 0x0002, 0x6007, 0x0000, 0x0026, 0x2019, 0x0010, 0x9280, 0x0001, + 0x20e8, 0x21a0, 0x21a8, 0x4104, 0x8319, 0x1de0, 0x8211, 0x1da0, + 0x002e, 0x009e, 0x003e, 0x014e, 0x01de, 0x0005, 0x2011, 0x000e, + 0x08e8, 0x0016, 0x0026, 0x0096, 0x3348, 0x080c, 0x0f09, 0x2100, + 0x9300, 0x2098, 0x22e0, 0x009e, 0x002e, 0x001e, 0x0036, 0x3518, + 0x20a9, 0x0001, 0x4002, 0x8007, 0x4004, 0x8319, 0x1dd8, 0x003e, + 0x0005, 0x20e9, 0x0001, 0x71b4, 0x81ff, 0x11c0, 0x9006, 0x2009, + 0x0200, 0x20a9, 0x0002, 0x9298, 0x0018, 0x23a0, 0x4001, 0x2009, + 0x0700, 0x20a9, 0x0002, 0x9298, 0x0008, 0x23a0, 0x4001, 0x7078, + 0x8007, 0x717c, 0x810f, 0x20a9, 0x0002, 0x4001, 0x9298, 0x000c, + 0x23a0, 0x900e, 0x080c, 0x0da4, 0x2001, 0x0000, 0x810f, 0x20a9, + 0x0002, 0x4001, 0x0005, 0x89ff, 0x0140, 0xa804, 0xa807, 0x0000, + 0x0006, 0x080c, 0x1033, 0x009e, 0x0cb0, 0x0005, 0x00e6, 0x2071, + 0x1800, 0x080c, 0x10ac, 0x090c, 0x0dc4, 0x00ee, 0x0005, 0x0086, + 0x00e6, 0x0006, 0x0026, 0x0036, 0x0126, 0x2091, 0x8000, 0x00c9, + 0x2071, 0x1800, 0x73bc, 0x702c, 0x9016, 0x9045, 0x0158, 0x8210, + 0x9906, 0x090c, 0x0dc4, 0x2300, 0x9202, 0x0120, 0x1a0c, 0x0dc4, + 0xa000, 0x0c98, 0x012e, 0x003e, 0x002e, 0x000e, 0x00ee, 0x008e, + 0x0005, 0x0086, 0x00e6, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, + 0x1911, 0x7010, 0x9005, 0x0140, 0x7018, 0x9045, 0x0128, 0x9906, + 0x090c, 0x0dc4, 0xa000, 0x0cc8, 0x012e, 0x000e, 0x00ee, 0x008e, + 0x0005, 0x00e6, 0x2071, 0x1800, 0x0126, 0x2091, 0x8000, 0x70bc, + 0x8001, 0x0270, 0x70be, 0x702c, 0x2048, 0x9085, 0x0001, 0xa800, + 0x702e, 0xa803, 0x0000, 0xa807, 0x0000, 0x012e, 0x00ee, 0x0005, + 0x904e, 0x0cd8, 0x00e6, 0x0126, 0x2091, 0x8000, 0x2071, 0x1800, + 0x70bc, 0x90ca, 0x0040, 0x0268, 0x8001, 0x70be, 0x702c, 0x2048, + 0xa800, 0x702e, 0xa803, 0x0000, 0xa807, 0x0000, 0x012e, 0x00ee, + 0x0005, 0x904e, 0x0cd8, 0x00e6, 0x0126, 0x2091, 0x8000, 0x0016, + 0x890e, 0x810e, 0x810f, 0x9184, 0x003f, 0xa862, 0x9184, 0xffc0, + 0xa85e, 0x001e, 0x0020, 0x00e6, 0x0126, 0x2091, 0x8000, 0x2071, + 0x1800, 0x702c, 0xa802, 0x2900, 0x702e, 0x70bc, 0x8000, 0x70be, + 0x080c, 0x8245, 0x012e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x9026, + 0x2009, 0x0000, 0x2049, 0x0400, 0x2900, 0x702e, 0x8940, 0x2800, + 0xa802, 0xa95e, 0xa863, 0x0001, 0x8420, 0x9886, 0x0440, 0x0120, + 0x2848, 0x9188, 0x0040, 0x0c90, 0x2071, 0x188e, 0x7000, 0x9005, + 0x11a0, 0x2001, 0x04d4, 0xa802, 0x2048, 0x2009, 0x3500, 0x8940, + 0x2800, 0xa802, 0xa95e, 0xa863, 0x0001, 0x8420, 0x9886, 0x0800, + 0x0120, 0x2848, 0x9188, 0x0040, 0x0c90, 0x2071, 0x188e, 0x7104, + 0x7200, 0x82ff, 0x01d0, 0x7308, 0x8318, 0x831f, 0x831b, 0x831b, + 0x7312, 0x8319, 0x2001, 0x0800, 0xa802, 0x2048, 0x8900, 0xa802, + 0x2040, 0xa95e, 0xaa62, 0x8420, 0x2300, 0x9906, 0x0130, 0x2848, + 0x9188, 0x0040, 0x9291, 0x0000, 0x0c88, 0xa803, 0x0000, 0x2071, + 0x1800, 0x74ba, 0x74be, 0x0005, 0x00e6, 0x0016, 0x9984, 0xfc00, + 0x01e8, 0x908c, 0xf800, 0x1168, 0x9982, 0x0400, 0x02b8, 0x9982, + 0x0440, 0x0278, 0x9982, 0x04d4, 0x0288, 0x9982, 0x0800, 0x1270, + 0x0040, 0x9982, 0x0800, 0x0250, 0x2071, 0x188e, 0x7010, 0x9902, + 0x1228, 0x9085, 0x0001, 0x001e, 0x00ee, 0x0005, 0x9006, 0x0cd8, + 0x00e6, 0x2071, 0x19f7, 0x7007, 0x0000, 0x9006, 0x701e, 0x7022, + 0x7002, 0x2071, 0x0000, 0x7010, 0x9085, 0x8044, 0x7012, 0x2071, + 0x0080, 0x9006, 0x20a9, 0x0040, 0x7022, 0x1f04, 0x10e4, 0x702b, + 0x0020, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000, 0x00e6, 0xa073, + 0x0000, 0x2071, 0x19f7, 0x701c, 0x9088, 0x1a01, 0x280a, 0x8000, + 0x9084, 0x003f, 0x701e, 0x7120, 0x9106, 0x090c, 0x0dc4, 0x7004, + 0x9005, 0x1128, 0x00f6, 0x2079, 0x0080, 0x00a9, 0x00fe, 0x00ee, + 0x012e, 0x0005, 0x0126, 0x2091, 0x8000, 0x00e6, 0x2071, 0x19f7, + 0x7004, 0x9005, 0x1128, 0x00f6, 0x2079, 0x0080, 0x0021, 0x00fe, + 0x00ee, 0x012e, 0x0005, 0x7004, 0x9086, 0x0000, 0x1110, 0x7007, + 0x0006, 0x7000, 0x0002, 0x112d, 0x112b, 0x112b, 0x112b, 0x12a7, + 0x12a7, 0x12a7, 0x12a7, 0x080c, 0x0dc4, 0x701c, 0x7120, 0x9106, + 0x1148, 0x792c, 0x9184, 0x0001, 0x1120, 0xd1fc, 0x1110, 0x7007, + 0x0000, 0x0005, 0x0096, 0x9180, 0x1a01, 0x2004, 0x700a, 0x2048, + 0x8108, 0x918c, 0x003f, 0x7122, 0x782b, 0x0026, 0xa890, 0x7802, + 0xa894, 0x7806, 0xa898, 0x780a, 0xa89c, 0x780e, 0xa87c, 0x700e, + 0xa874, 0x7016, 0xa878, 0x701a, 0xa86c, 0x009e, 0xd084, 0x0120, + 0x7007, 0x0001, 0x0029, 0x0005, 0x7007, 0x0002, 0x00b1, 0x0005, + 0x0016, 0x0026, 0x710c, 0x2011, 0x0040, 0x9182, 0x0040, 0x1210, + 0x2110, 0x9006, 0x700e, 0x7212, 0x8203, 0x7812, 0x782b, 0x0020, + 0x782b, 0x0041, 0x002e, 0x001e, 0x0005, 0x0016, 0x0026, 0x0136, + 0x0146, 0x0156, 0x7014, 0x20e0, 0x7018, 0x2098, 0x20e9, 0x0000, + 0x20a1, 0x0088, 0x782b, 0x0026, 0x710c, 0x2011, 0x0040, 0x9182, + 0x0040, 0x1210, 0x2110, 0x9006, 0x700e, 0x22a8, 0x4006, 0x8203, + 0x7812, 0x782b, 0x0020, 0x3300, 0x701a, 0x782b, 0x0001, 0x015e, + 0x014e, 0x013e, 0x002e, 0x001e, 0x0005, 0x0016, 0x2009, 0x19f7, + 0x2104, 0xc095, 0x200a, 0x080c, 0x110a, 0x001e, 0x0005, 0x0016, + 0x00e6, 0x2071, 0x19f7, 0x00f6, 0x2079, 0x0080, 0x792c, 0xd1bc, + 0x190c, 0x0dbd, 0x782b, 0x0002, 0xd1fc, 0x0120, 0x918c, 0x0700, + 0x7004, 0x0023, 0x00fe, 0x00ee, 0x001e, 0x0005, 0x111b, 0x11c5, + 0x11f9, 0x0dc4, 0x0dc4, 0x12b3, 0x0dc4, 0x918c, 0x0700, 0x1550, + 0x0136, 0x0146, 0x0156, 0x7014, 0x20e8, 0x7018, 0x20a0, 0x20e1, + 0x0000, 0x2099, 0x0088, 0x782b, 0x0040, 0x7010, 0x20a8, 0x4005, + 0x3400, 0x701a, 0x015e, 0x014e, 0x013e, 0x700c, 0x9005, 0x0578, + 0x7800, 0x7802, 0x7804, 0x7806, 0x080c, 0x1160, 0x0005, 0x7008, + 0x0096, 0x2048, 0xa873, 0x0100, 0x009e, 0x7007, 0x0000, 0x080c, + 0x111b, 0x0005, 0x7008, 0x0096, 0x2048, 0xa873, 0x0200, 0x009e, + 0x0ca0, 0x918c, 0x0700, 0x1150, 0x700c, 0x9005, 0x0180, 0x7800, + 0x7802, 0x7804, 0x7806, 0x080c, 0x1175, 0x0005, 0x7008, 0x0096, + 0x2048, 0xa873, 0x0200, 0x009e, 0x7007, 0x0000, 0x0080, 0x0096, + 0x7008, 0x2048, 0x7800, 0xa892, 0x7804, 0xa896, 0x7808, 0xa89a, + 0x780c, 0xa89e, 0xa873, 0x0100, 0x009e, 0x7007, 0x0000, 0x0096, + 0x00d6, 0x7008, 0x2048, 0x2001, 0x18ba, 0x2004, 0x9906, 0x1128, + 0xa8a0, 0x080f, 0x00de, 0x009e, 0x00a0, 0x00de, 0x009e, 0x0096, + 0x00d6, 0x7008, 0x2048, 0x0081, 0x0150, 0xa8a0, 0x0086, 0x2940, + 0x080f, 0x008e, 0x00de, 0x009e, 0x080c, 0x110a, 0x0005, 0x00de, + 0x009e, 0x080c, 0x110a, 0x0005, 0xa8ac, 0xd08c, 0x0005, 0x0096, + 0xa0a4, 0x904d, 0x090c, 0x0dc4, 0xa070, 0x908e, 0x0100, 0x0130, + 0xa87f, 0x0030, 0xa887, 0x0000, 0xa89b, 0x4002, 0xa898, 0x908e, + 0x006b, 0x090c, 0x469d, 0x080c, 0x6b11, 0xa0a3, 0x0000, 0xa0a7, + 0x0000, 0x2848, 0x080c, 0x1033, 0x009e, 0x0005, 0x00a6, 0xa0a4, + 0x904d, 0x090c, 0x0dc4, 0xa070, 0x908e, 0x0100, 0x0128, 0xa87f, + 0x0001, 0xa887, 0x0000, 0x00c0, 0xa80c, 0x2050, 0xb004, 0x9005, + 0x0198, 0xa80e, 0x2050, 0x8006, 0x8006, 0x8007, 0x908c, 0x003f, + 0x9084, 0xffc0, 0x9080, 0x0002, 0xa07a, 0xa176, 0xb000, 0xa07e, + 0x2810, 0x080c, 0x10eb, 0x00c8, 0xa980, 0xa898, 0x0016, 0x0006, + 0x080c, 0x6b11, 0x000e, 0x001e, 0xd1a4, 0x0128, 0x00c6, 0x2060, + 0x080c, 0x9f18, 0x00ce, 0x7008, 0x2048, 0xa8a3, 0x0000, 0xa8a7, + 0x0000, 0x080c, 0x1033, 0x080c, 0x110a, 0x00ae, 0x0005, 0x0126, + 0x2091, 0x8000, 0x782b, 0x1001, 0x7007, 0x0005, 0x7000, 0xc094, + 0x7002, 0x012e, 0x0005, 0x7007, 0x0000, 0x080c, 0x111b, 0x0005, + 0x0126, 0x2091, 0x2200, 0x2079, 0x0300, 0x2071, 0x1a41, 0x7003, + 0x0000, 0x78bf, 0x00f6, 0x781b, 0x4800, 0x00c1, 0x7803, 0x0003, + 0x780f, 0x0000, 0x20a9, 0x0259, 0x2061, 0xd387, 0x2c0d, 0x7912, + 0xe104, 0x9ce0, 0x0002, 0x7916, 0x1f04, 0x12ce, 0x7807, 0x0007, + 0x7803, 0x0000, 0x7803, 0x0001, 0x012e, 0x0005, 0x00c6, 0x7803, + 0x0000, 0x7808, 0xd09c, 0x0110, 0x7820, 0x0cd8, 0x2001, 0x1a42, + 0x2003, 0x0000, 0x78ab, 0x0004, 0x78ac, 0xd0ac, 0x1de8, 0x78ab, + 0x0002, 0x7807, 0x0007, 0x7827, 0x0030, 0x782b, 0x0400, 0x7827, + 0x0031, 0x782b, 0x1a64, 0x781f, 0xff00, 0x781b, 0xb700, 0x2001, + 0x0200, 0x2004, 0xd0dc, 0x0110, 0x781f, 0x0303, 0x2061, 0x1a64, + 0x602f, 0x1cc8, 0x2001, 0x1819, 0x2004, 0x9082, 0x1cc8, 0x6032, + 0x603b, 0x1f70, 0x2001, 0x31cc, 0xd0fc, 0x190c, 0x0dc4, 0x2001, + 0x1810, 0x2004, 0xd0c4, 0x1128, 0x2001, 0x0003, 0x2004, 0xd0d4, + 0x1118, 0x783f, 0x31cc, 0x0020, 0x9084, 0xc000, 0x783f, 0xb1cc, + 0x00ce, 0x0005, 0x0126, 0x2091, 0x2200, 0x7908, 0x9184, 0x0030, + 0x190c, 0x0dbd, 0xd19c, 0x0158, 0x7820, 0x908c, 0xf000, 0x15f0, + 0x908a, 0x0024, 0x1a0c, 0x0dc4, 0x0023, 0x012e, 0x0005, 0x012e, + 0x0005, 0x1366, 0x1366, 0x137d, 0x1382, 0x1386, 0x138b, 0x13b3, + 0x13b7, 0x13c5, 0x13c9, 0x1366, 0x1452, 0x1456, 0x14c6, 0x1366, + 0x1366, 0x1366, 0x1366, 0x1366, 0x1366, 0x1366, 0x1366, 0x1366, + 0x1366, 0x1366, 0x1366, 0x1366, 0x138d, 0x1366, 0x1366, 0x1366, + 0x1366, 0x1366, 0x1366, 0x136a, 0x1368, 0x1366, 0x080c, 0x0dc4, + 0x080c, 0x0dbd, 0x080c, 0x14cd, 0x2009, 0x1a59, 0x2104, 0x8000, + 0x200a, 0x080c, 0x7d22, 0x080c, 0x199b, 0x0005, 0x2009, 0x0048, + 0x2060, 0x080c, 0x9f88, 0x012e, 0x0005, 0x7004, 0xc085, 0xc0b5, + 0x7006, 0x0005, 0x7004, 0xc085, 0x7006, 0x0005, 0x080c, 0x14cd, + 0x080c, 0x1636, 0x0005, 0x080c, 0x0dc4, 0x080c, 0x14cd, 0x2060, 0x6014, 0x0096, 0x2048, 0xa83b, 0xffff, 0x009e, 0x2009, 0x0048, - 0x080c, 0x9d7a, 0x2001, 0x015d, 0x2003, 0x0000, 0x2009, 0x03e8, + 0x080c, 0x9f88, 0x2001, 0x015d, 0x2003, 0x0000, 0x2009, 0x03e8, 0x8109, 0x0160, 0x2001, 0x0201, 0x2004, 0x9005, 0x0dc8, 0x2001, - 0x0218, 0x2004, 0xd0ec, 0x1110, 0x080c, 0x14d4, 0x2001, 0x0307, + 0x0218, 0x2004, 0xd0ec, 0x1110, 0x080c, 0x14d2, 0x2001, 0x0307, 0x2003, 0x8000, 0x0005, 0x7004, 0xc095, 0x7006, 0x0005, 0x080c, - 0x14cf, 0x2060, 0x6014, 0x0096, 0x2048, 0xa83b, 0xffff, 0x009e, - 0x2009, 0x0048, 0x080c, 0x9d7a, 0x0005, 0x080c, 0x14cf, 0x080c, - 0x0dd1, 0x080c, 0x14cf, 0x080c, 0x143f, 0x7827, 0x0018, 0x79ac, + 0x14cd, 0x2060, 0x6014, 0x0096, 0x2048, 0xa83b, 0xffff, 0x009e, + 0x2009, 0x0048, 0x080c, 0x9f88, 0x0005, 0x080c, 0x14cd, 0x080c, + 0x0dc4, 0x080c, 0x14cd, 0x080c, 0x143d, 0x7827, 0x0018, 0x79ac, 0xd1dc, 0x0540, 0x7827, 0x0015, 0x7828, 0x782b, 0x0000, 0x9065, 0x0138, 0x2001, 0x020d, 0x2003, 0x0050, 0x2003, 0x0020, 0x0400, 0x7004, 0x9005, 0x1180, 0x78ab, 0x0004, 0x7827, 0x0018, 0x782b, - 0x0000, 0xd1bc, 0x090c, 0x0dd1, 0x2001, 0x020d, 0x2003, 0x0050, - 0x2003, 0x0020, 0x0448, 0x78ab, 0x0004, 0x7803, 0x0001, 0x080c, - 0x1458, 0x0005, 0x7828, 0x782b, 0x0000, 0x9065, 0x090c, 0x0dd1, - 0x6014, 0x2048, 0x78ab, 0x0004, 0x918c, 0x0700, 0x01a8, 0x080c, - 0x7bb0, 0x080c, 0x1984, 0x080c, 0xb6a7, 0x0158, 0xa9ac, 0xa936, - 0xa9b0, 0xa93a, 0xa83f, 0xffff, 0xa843, 0xffff, 0xa880, 0xc0bd, - 0xa882, 0x080c, 0xb31a, 0x0005, 0x2029, 0x00c8, 0x8529, 0x0128, - 0x2001, 0x0201, 0x2004, 0x9005, 0x0dc8, 0x7dbc, 0x080c, 0xd017, - 0xd5a4, 0x1118, 0x080c, 0x14d4, 0x0005, 0x080c, 0x7bb0, 0x080c, - 0x1984, 0x0005, 0x781f, 0x0300, 0x7803, 0x0001, 0x0005, 0x0016, - 0x0066, 0x0076, 0x00f6, 0x2079, 0x0300, 0x7908, 0x918c, 0x0007, - 0x9186, 0x0003, 0x0120, 0x2001, 0x0016, 0x080c, 0x1545, 0x00fe, - 0x007e, 0x006e, 0x001e, 0x0005, 0x7004, 0xc09d, 0x7006, 0x0005, - 0x7104, 0x9184, 0x0004, 0x190c, 0x0dd1, 0xd184, 0x11b1, 0xd19c, - 0x0180, 0xc19c, 0x7106, 0x0016, 0x080c, 0x160b, 0x001e, 0x0148, - 0x2001, 0x020d, 0x2003, 0x0050, 0x2003, 0x0020, 0x080c, 0x14d4, - 0x0005, 0x81ff, 0x190c, 0x0dd1, 0x0005, 0x2100, 0xc184, 0xc1b4, - 0x7106, 0xd0b4, 0x0016, 0x00e6, 0x1904, 0x14bd, 0x2071, 0x0200, - 0x080c, 0x15ff, 0x080c, 0x160b, 0x05a8, 0x6014, 0x9005, 0x05a8, - 0x0096, 0x2048, 0xa864, 0x009e, 0x9084, 0x00ff, 0x908e, 0x0029, - 0x0160, 0x908e, 0x0048, 0x1548, 0x601c, 0xd084, 0x11d8, 0x00f6, - 0x2c78, 0x080c, 0x1664, 0x00fe, 0x00a8, 0x00f6, 0x2c78, 0x080c, - 0x17a8, 0x00fe, 0x2009, 0x01f4, 0x8109, 0x0160, 0x2001, 0x0201, - 0x2004, 0x9005, 0x0dc8, 0x2001, 0x0218, 0x2004, 0xd0ec, 0x1110, - 0x0419, 0x0040, 0x2001, 0x020d, 0x2003, 0x0020, 0x080c, 0x12e7, - 0x7803, 0x0001, 0x00ee, 0x001e, 0x0005, 0x080c, 0x160b, 0x0dd0, - 0x2001, 0x020d, 0x2003, 0x0050, 0x2003, 0x0020, 0x0069, 0x0c90, - 0x0031, 0x2060, 0x2009, 0x0053, 0x080c, 0x9d7a, 0x0005, 0x7808, - 0xd09c, 0x0de8, 0x7820, 0x0005, 0x080c, 0x143f, 0x00d6, 0x2069, - 0x0200, 0x2009, 0x01f4, 0x8109, 0x0510, 0x6804, 0x9005, 0x0dd8, - 0x2001, 0x015d, 0x2003, 0x0000, 0x79bc, 0xd1a4, 0x1528, 0x79b8, - 0x918c, 0x0fff, 0x0180, 0x9182, 0x0841, 0x1268, 0x9188, 0x0007, - 0x918c, 0x0ff8, 0x810c, 0x810c, 0x810c, 0x080c, 0x1537, 0x6827, - 0x0001, 0x8109, 0x1dd0, 0x04d9, 0x6827, 0x0002, 0x04c1, 0x6804, - 0x9005, 0x1130, 0x682c, 0xd0e4, 0x1500, 0x6804, 0x9005, 0x0de8, - 0x79b8, 0xd1ec, 0x1130, 0x08c0, 0x080c, 0x7bb0, 0x080c, 0x1984, + 0x0000, 0xd1bc, 0x090c, 0x0dc4, 0x2001, 0x020d, 0x2003, 0x0050, + 0x2003, 0x0020, 0x0478, 0x78ab, 0x0004, 0x7803, 0x0001, 0x080c, + 0x1456, 0x0005, 0x7828, 0x782b, 0x0000, 0x9065, 0x090c, 0x0dc4, + 0x6014, 0x2048, 0x78ab, 0x0004, 0x918c, 0x0700, 0x01d8, 0x080c, + 0x7d22, 0x080c, 0x199b, 0x080c, 0xb955, 0x0158, 0xa9b0, 0xa936, + 0xa9b4, 0xa93a, 0xa83f, 0xffff, 0xa843, 0xffff, 0xa884, 0xc0bd, + 0xa886, 0xa984, 0x9184, 0x0020, 0x1120, 0xc1ad, 0xa986, 0x080c, + 0xb5c5, 0x0005, 0x2029, 0x00c8, 0x8529, 0x0128, 0x2001, 0x0201, + 0x2004, 0x9005, 0x0dc8, 0x7dbc, 0x080c, 0xd314, 0xd5a4, 0x1118, + 0x080c, 0x14d2, 0x0005, 0x080c, 0x7d22, 0x080c, 0x199b, 0x0005, + 0x781f, 0x0300, 0x7803, 0x0001, 0x0005, 0x0016, 0x0066, 0x0076, + 0x00f6, 0x2079, 0x0300, 0x7908, 0x918c, 0x0007, 0x9186, 0x0003, + 0x0120, 0x2001, 0x0016, 0x080c, 0x1553, 0x00fe, 0x007e, 0x006e, + 0x001e, 0x0005, 0x7004, 0xc09d, 0x7006, 0x0005, 0x7104, 0x9184, + 0x0004, 0x190c, 0x0dc4, 0xd184, 0x11b1, 0xd19c, 0x0180, 0xc19c, + 0x7106, 0x0016, 0x080c, 0x1619, 0x001e, 0x0148, 0x2001, 0x020d, + 0x2003, 0x0050, 0x2003, 0x0020, 0x080c, 0x14d2, 0x0005, 0x81ff, + 0x190c, 0x0dc4, 0x0005, 0x2100, 0xc184, 0xc1b4, 0x7106, 0xd0b4, + 0x0016, 0x00e6, 0x1904, 0x14bb, 0x2071, 0x0200, 0x080c, 0x160d, + 0x080c, 0x1619, 0x05a8, 0x6014, 0x9005, 0x05a8, 0x0096, 0x2048, + 0xa868, 0x009e, 0x9084, 0x00ff, 0x908e, 0x0029, 0x0160, 0x908e, + 0x0048, 0x1548, 0x601c, 0xd084, 0x11d8, 0x00f6, 0x2c78, 0x080c, + 0x1679, 0x00fe, 0x00a8, 0x00f6, 0x2c78, 0x080c, 0x17bd, 0x00fe, + 0x2009, 0x01f4, 0x8109, 0x0160, 0x2001, 0x0201, 0x2004, 0x9005, + 0x0dc8, 0x2001, 0x0218, 0x2004, 0xd0ec, 0x1110, 0x0419, 0x0040, + 0x2001, 0x020d, 0x2003, 0x0020, 0x080c, 0x12de, 0x7803, 0x0001, + 0x00ee, 0x001e, 0x0005, 0x080c, 0x1619, 0x0dd0, 0x2001, 0x020d, + 0x2003, 0x0050, 0x2003, 0x0020, 0x0069, 0x0c90, 0x0031, 0x2060, + 0x2009, 0x0053, 0x080c, 0x9f88, 0x0005, 0x7808, 0xd09c, 0x0de8, + 0x7820, 0x0005, 0x080c, 0x143d, 0x00d6, 0x2069, 0x0200, 0x2009, + 0x01f4, 0x8109, 0x0520, 0x6804, 0x9005, 0x0dd8, 0x2001, 0x015d, + 0x2003, 0x0000, 0x79bc, 0xd1a4, 0x1578, 0x79b8, 0x918c, 0x0fff, + 0x0180, 0x9182, 0x0841, 0x1268, 0x9188, 0x0007, 0x918c, 0x0ff8, + 0x810c, 0x810c, 0x810c, 0x080c, 0x153f, 0x6827, 0x0001, 0x8109, + 0x1dd0, 0x080c, 0x153f, 0x6827, 0x0002, 0x080c, 0x153f, 0x6804, + 0x9005, 0x1170, 0x682c, 0xd0e4, 0x1540, 0x691c, 0x9184, 0x0014, + 0x0120, 0x6830, 0x9084, 0x9554, 0x15b9, 0x6804, 0x9005, 0x0da8, + 0x79b8, 0xd1ec, 0x1130, 0x0870, 0x080c, 0x7d22, 0x080c, 0x199b, 0x0090, 0x7827, 0x0015, 0x782b, 0x0000, 0x7827, 0x0018, 0x782b, 0x0000, 0x2001, 0x020d, 0x2003, 0x0020, 0x2001, 0x0307, 0x2003, 0x0300, 0x7803, 0x0001, 0x00de, 0x0005, 0x682c, 0x9084, 0x5400, 0x9086, 0x5400, 0x0d30, 0x7827, 0x0015, 0x782b, 0x0000, 0x7803, 0x0001, 0x6800, 0x9085, 0x1800, 0x6802, 0x00de, 0x0005, 0x6824, - 0x9084, 0x0003, 0x1de0, 0x0005, 0x2001, 0x0030, 0x2c08, 0x621c, - 0x0021, 0x7830, 0x9086, 0x0041, 0x0005, 0x00f6, 0x2079, 0x0300, - 0x0006, 0x7808, 0xd09c, 0x0140, 0x0016, 0x0026, 0x00c6, 0x080c, - 0x1333, 0x00ce, 0x002e, 0x001e, 0x000e, 0x0006, 0x7832, 0x7936, - 0x7a3a, 0x781b, 0x8080, 0x0059, 0x1118, 0x000e, 0x00fe, 0x0005, - 0x000e, 0x792c, 0x3900, 0x8000, 0x2004, 0x080c, 0x0dd1, 0x2009, - 0x180c, 0x2104, 0xc0f4, 0x200a, 0x2009, 0xff00, 0x8109, 0x0904, - 0x15c3, 0x7a18, 0x9284, 0x0030, 0x0904, 0x15be, 0x9284, 0x0048, - 0x9086, 0x0008, 0x1904, 0x15be, 0x2001, 0x0109, 0x2004, 0xd08c, - 0x01f0, 0x0006, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x0126, - 0x2091, 0x2800, 0x00f6, 0x0026, 0x0016, 0x2009, 0x1a59, 0x2104, - 0x8000, 0x0208, 0x200a, 0x080c, 0x84a8, 0x001e, 0x002e, 0x00fe, - 0x012e, 0x015e, 0x014e, 0x013e, 0x01de, 0x01ce, 0x000e, 0x2001, - 0x009b, 0x2004, 0xd0fc, 0x01d0, 0x0006, 0x0126, 0x01c6, 0x01d6, - 0x0136, 0x0146, 0x0156, 0x00f6, 0x0016, 0x2009, 0x1a5a, 0x2104, - 0x8000, 0x0208, 0x200a, 0x080c, 0x1d7d, 0x001e, 0x00fe, 0x015e, - 0x014e, 0x013e, 0x01de, 0x01ce, 0x012e, 0x000e, 0x7818, 0xd0bc, - 0x1904, 0x156e, 0x0005, 0x2001, 0x180c, 0x2004, 0xd0f4, 0x1528, - 0x7a18, 0x9284, 0x0030, 0x0508, 0x9284, 0x0048, 0x9086, 0x0008, - 0x11e0, 0x2001, 0x19d0, 0x2004, 0x9005, 0x01b8, 0x2001, 0x1a41, - 0x2004, 0x9086, 0x0000, 0x0188, 0x2009, 0x1a58, 0x2104, 0x8000, - 0x0208, 0x200a, 0x080c, 0x94c6, 0x2009, 0x180c, 0x2104, 0xc0f5, - 0x200a, 0x2009, 0xff00, 0x0804, 0x156e, 0x9085, 0x0001, 0x0005, - 0x7832, 0x7936, 0x7a3a, 0x781b, 0x8080, 0x080c, 0x1567, 0x1108, - 0x0005, 0x792c, 0x3900, 0x8000, 0x2004, 0x080c, 0x0dd1, 0x7037, - 0x0001, 0x7150, 0x7037, 0x0002, 0x7050, 0x2060, 0xd1bc, 0x1110, - 0x7054, 0x2060, 0x0005, 0x0006, 0x0046, 0x00e6, 0x2071, 0x0200, - 0x7037, 0x0002, 0x7058, 0x9084, 0xff00, 0x8007, 0x9086, 0x00bc, - 0x1158, 0x2021, 0x1a57, 0x2404, 0x8000, 0x0208, 0x2022, 0x080c, - 0x7bb0, 0x080c, 0x1984, 0x9006, 0x00ee, 0x004e, 0x000e, 0x0005, - 0x0c11, 0x1108, 0x0005, 0x00e6, 0x0016, 0x2071, 0x0200, 0x0879, - 0x7358, 0x745c, 0x6014, 0x905d, 0x0520, 0x2b48, 0xab42, 0xac3e, - 0x2001, 0x187d, 0x2004, 0xd0b4, 0x1138, 0x601c, 0xd0e4, 0x1120, - 0xa83b, 0x7fff, 0xa837, 0xffff, 0x080c, 0x1f79, 0x1190, 0x080c, - 0x1805, 0x2a00, 0xa816, 0x0130, 0x2800, 0xa80e, 0x2c05, 0xa80a, - 0x2c00, 0xa812, 0x7037, 0x0020, 0x781f, 0x0300, 0x001e, 0x00ee, - 0x0005, 0x7037, 0x0050, 0x7037, 0x0020, 0x001e, 0x00ee, 0x080c, - 0x14d4, 0x0005, 0x080c, 0x0dd1, 0x2001, 0x180d, 0x2004, 0xd08c, - 0x190c, 0x66a5, 0x2ff0, 0x0126, 0x2091, 0x2200, 0x0016, 0x00c6, - 0x3e60, 0x6014, 0x2048, 0x2940, 0x903e, 0x2730, 0xa864, 0x2068, - 0xa81a, 0x9d84, 0x000f, 0x9088, 0x1f59, 0x2165, 0x0002, 0x1696, - 0x16e3, 0x1696, 0x1696, 0x1696, 0x16c5, 0x1696, 0x169a, 0x168f, - 0x16da, 0x1696, 0x1696, 0x1696, 0x17a0, 0x16ae, 0x16a4, 0xa964, - 0x918c, 0x00ff, 0x918e, 0x0048, 0x0904, 0x16da, 0x9085, 0x0001, - 0x0804, 0x1796, 0xa87c, 0xd0bc, 0x0dc8, 0xa890, 0xa842, 0xa88c, - 0xa83e, 0xa888, 0x0804, 0x16ea, 0xa87c, 0xd0bc, 0x0d78, 0xa890, - 0xa842, 0xa88c, 0xa83e, 0xa888, 0x0804, 0x1739, 0xa87c, 0xd0bc, - 0x0d28, 0xa890, 0xa842, 0xa88c, 0xa83e, 0xa804, 0x9045, 0x090c, - 0x0dd1, 0xa164, 0xa91a, 0x91ec, 0x000f, 0x9d80, 0x1f59, 0x2065, - 0xa888, 0xd19c, 0x1904, 0x1739, 0x0428, 0xa87c, 0xd0ac, 0x0970, - 0xa804, 0x9045, 0x090c, 0x0dd1, 0xa164, 0xa91a, 0x91ec, 0x000f, - 0x9d80, 0x1f59, 0x2065, 0x9006, 0xa842, 0xa83e, 0xd19c, 0x1904, - 0x1739, 0x0080, 0xa87c, 0xd0ac, 0x0904, 0x1696, 0x9006, 0xa842, - 0xa83e, 0x0804, 0x1739, 0xa87c, 0xd0ac, 0x0904, 0x1696, 0x9006, - 0xa842, 0xa83e, 0x2c05, 0x908a, 0x0036, 0x1a0c, 0x0dd1, 0x9082, - 0x001b, 0x0002, 0x170d, 0x170d, 0x170f, 0x170d, 0x170d, 0x170d, - 0x1715, 0x170d, 0x170d, 0x170d, 0x171b, 0x170d, 0x170d, 0x170d, - 0x1721, 0x170d, 0x170d, 0x170d, 0x1727, 0x170d, 0x170d, 0x170d, - 0x172d, 0x170d, 0x170d, 0x170d, 0x1733, 0x080c, 0x0dd1, 0xa574, - 0xa478, 0xa37c, 0xa280, 0x0804, 0x177e, 0xa584, 0xa488, 0xa38c, - 0xa290, 0x0804, 0x177e, 0xa594, 0xa498, 0xa39c, 0xa2a0, 0x0804, - 0x177e, 0xa5a4, 0xa4a8, 0xa3ac, 0xa2b0, 0x0804, 0x177e, 0xa5b4, - 0xa4b8, 0xa3bc, 0xa2c0, 0x0804, 0x177e, 0xa5c4, 0xa4c8, 0xa3cc, - 0xa2d0, 0x0804, 0x177e, 0xa5d4, 0xa4d8, 0xa3dc, 0xa2e0, 0x0804, - 0x177e, 0x2c05, 0x908a, 0x0034, 0x1a0c, 0x0dd1, 0x9082, 0x001b, - 0x0002, 0x175c, 0x175a, 0x175a, 0x175a, 0x175a, 0x175a, 0x1763, - 0x175a, 0x175a, 0x175a, 0x175a, 0x175a, 0x176a, 0x175a, 0x175a, - 0x175a, 0x175a, 0x175a, 0x1771, 0x175a, 0x175a, 0x175a, 0x175a, - 0x175a, 0x1778, 0x080c, 0x0dd1, 0xa56c, 0xa470, 0xa774, 0xa678, - 0xa37c, 0xa280, 0x00d8, 0xa584, 0xa488, 0xa78c, 0xa690, 0xa394, - 0xa298, 0x00a0, 0xa59c, 0xa4a0, 0xa7a4, 0xa6a8, 0xa3ac, 0xa2b0, - 0x0068, 0xa5b4, 0xa4b8, 0xa7bc, 0xa6c0, 0xa3c4, 0xa2c8, 0x0030, - 0xa5cc, 0xa4d0, 0xa7d4, 0xa6d8, 0xa3dc, 0xa2e0, 0xab2e, 0xaa32, - 0xad1e, 0xac22, 0xaf26, 0xae2a, 0xa988, 0x8c60, 0x2c1d, 0xa8ac, - 0xaab0, 0xa836, 0xaa3a, 0x8109, 0xa916, 0x1160, 0x3e60, 0x601c, - 0xc085, 0x601e, 0xa87c, 0xc0dd, 0xa87e, 0x9006, 0x00ce, 0x001e, - 0x012e, 0x0005, 0x2800, 0xa80e, 0xab0a, 0x2c00, 0xa812, 0x0c70, - 0x0804, 0x1696, 0x2001, 0x180d, 0x2004, 0xd08c, 0x190c, 0x66a5, - 0x2ff0, 0x0126, 0x2091, 0x2200, 0x0016, 0x00c6, 0x3e60, 0x6014, - 0x2048, 0x2940, 0xa80e, 0x2061, 0x1f54, 0xa813, 0x1f54, 0x2c05, - 0xa80a, 0xa964, 0xa91a, 0xa87c, 0xd0ac, 0x090c, 0x0dd1, 0x9006, - 0xa842, 0xa83e, 0x2c05, 0x908a, 0x0034, 0x1a0c, 0x0dd1, 0xadcc, - 0xacd0, 0xafd4, 0xaed8, 0xabdc, 0xaae0, 0xab2e, 0xaa32, 0xad1e, - 0xac22, 0xaf26, 0xae2a, 0xa8ac, 0xaab0, 0xa836, 0xaa3a, 0xa988, - 0xa864, 0x9084, 0x00ff, 0x9086, 0x0008, 0x1120, 0x8109, 0xa916, - 0x0128, 0x0080, 0x918a, 0x0002, 0xa916, 0x1160, 0x3e60, 0x601c, - 0xc085, 0x601e, 0xa87c, 0xc0dd, 0xa87e, 0x9006, 0x00ce, 0x001e, - 0x012e, 0x0005, 0xa804, 0x9045, 0x090c, 0x0dd1, 0xa80e, 0xa064, - 0xa81a, 0x9084, 0x000f, 0x9080, 0x1f59, 0x2015, 0x82ff, 0x090c, - 0x0dd1, 0xaa12, 0x2205, 0xa80a, 0x0c08, 0x903e, 0x2730, 0xa880, - 0xd0fc, 0x1190, 0x2d00, 0x0002, 0x18fa, 0x185c, 0x185c, 0x18fa, - 0x18fa, 0x18f4, 0x18fa, 0x185c, 0x18ab, 0x18ab, 0x18ab, 0x18fa, - 0x18fa, 0x18fa, 0x18f1, 0x18ab, 0xc0fc, 0xa882, 0xab2c, 0xaa30, - 0xad1c, 0xac20, 0xdd9c, 0x0904, 0x18fc, 0x2c05, 0x908a, 0x0034, - 0x1a0c, 0x0dd1, 0x9082, 0x001b, 0x0002, 0x1848, 0x1846, 0x1846, - 0x1846, 0x1846, 0x1846, 0x184c, 0x1846, 0x1846, 0x1846, 0x1846, - 0x1846, 0x1850, 0x1846, 0x1846, 0x1846, 0x1846, 0x1846, 0x1854, - 0x1846, 0x1846, 0x1846, 0x1846, 0x1846, 0x1858, 0x080c, 0x0dd1, - 0xa774, 0xa678, 0x0804, 0x18fc, 0xa78c, 0xa690, 0x0804, 0x18fc, - 0xa7a4, 0xa6a8, 0x0804, 0x18fc, 0xa7bc, 0xa6c0, 0x0804, 0x18fc, - 0xa7d4, 0xa6d8, 0x0804, 0x18fc, 0x2c05, 0x908a, 0x0036, 0x1a0c, - 0x0dd1, 0x9082, 0x001b, 0x0002, 0x187f, 0x187f, 0x1881, 0x187f, - 0x187f, 0x187f, 0x1887, 0x187f, 0x187f, 0x187f, 0x188d, 0x187f, - 0x187f, 0x187f, 0x1893, 0x187f, 0x187f, 0x187f, 0x1899, 0x187f, - 0x187f, 0x187f, 0x189f, 0x187f, 0x187f, 0x187f, 0x18a5, 0x080c, - 0x0dd1, 0xa574, 0xa478, 0xa37c, 0xa280, 0x0804, 0x18fc, 0xa584, - 0xa488, 0xa38c, 0xa290, 0x0804, 0x18fc, 0xa594, 0xa498, 0xa39c, - 0xa2a0, 0x0804, 0x18fc, 0xa5a4, 0xa4a8, 0xa3ac, 0xa2b0, 0x0804, - 0x18fc, 0xa5b4, 0xa4b8, 0xa3bc, 0xa2c0, 0x0804, 0x18fc, 0xa5c4, - 0xa4c8, 0xa3cc, 0xa2d0, 0x0804, 0x18fc, 0xa5d4, 0xa4d8, 0xa3dc, - 0xa2e0, 0x0804, 0x18fc, 0x2c05, 0x908a, 0x0034, 0x1a0c, 0x0dd1, - 0x9082, 0x001b, 0x0002, 0x18ce, 0x18cc, 0x18cc, 0x18cc, 0x18cc, - 0x18cc, 0x18d5, 0x18cc, 0x18cc, 0x18cc, 0x18cc, 0x18cc, 0x18dc, - 0x18cc, 0x18cc, 0x18cc, 0x18cc, 0x18cc, 0x18e3, 0x18cc, 0x18cc, - 0x18cc, 0x18cc, 0x18cc, 0x18ea, 0x080c, 0x0dd1, 0xa56c, 0xa470, - 0xa774, 0xa678, 0xa37c, 0xa280, 0x0438, 0xa584, 0xa488, 0xa78c, - 0xa690, 0xa394, 0xa298, 0x0400, 0xa59c, 0xa4a0, 0xa7a4, 0xa6a8, - 0xa3ac, 0xa2b0, 0x00c8, 0xa5b4, 0xa4b8, 0xa7bc, 0xa6c0, 0xa3c4, - 0xa2c8, 0x0090, 0xa5cc, 0xa4d0, 0xa7d4, 0xa6d8, 0xa3dc, 0xa2e0, - 0x0058, 0x9d86, 0x000e, 0x1130, 0x080c, 0x1f11, 0x1904, 0x1805, - 0x900e, 0x0050, 0x080c, 0x0dd1, 0xab2e, 0xaa32, 0xad1e, 0xac22, - 0xaf26, 0xae2a, 0x080c, 0x1f11, 0x0005, 0x6014, 0x2048, 0x6118, - 0x81ff, 0x0148, 0x810c, 0x810c, 0x810c, 0x81ff, 0x1118, 0xa887, - 0x0001, 0x0008, 0xa986, 0x601b, 0x0002, 0xa874, 0x9084, 0x00ff, - 0x9084, 0x0008, 0x0150, 0x00e9, 0x6000, 0x9086, 0x0004, 0x1120, - 0x2009, 0x0048, 0x080c, 0x9d7a, 0x0005, 0xa974, 0xd1dc, 0x1108, - 0x0005, 0xa934, 0xa88c, 0x9106, 0x1158, 0xa938, 0xa890, 0x9106, - 0x1138, 0x601c, 0xc084, 0x601e, 0x2009, 0x0048, 0x0804, 0x9d7a, - 0x0005, 0x0126, 0x00c6, 0x2091, 0x2200, 0x00ce, 0x7908, 0x918c, - 0x0007, 0x9186, 0x0000, 0x05b0, 0x9186, 0x0003, 0x0598, 0x6020, - 0x6023, 0x0000, 0x0006, 0x2031, 0x0008, 0x00c6, 0x781f, 0x0808, - 0x7808, 0xd09c, 0x0120, 0x080c, 0x1333, 0x8631, 0x1db8, 0x00ce, - 0x781f, 0x0800, 0x2031, 0x0168, 0x00c6, 0x7808, 0xd09c, 0x190c, - 0x1333, 0x00ce, 0x2001, 0x0038, 0x080c, 0x1a14, 0x7930, 0x9186, - 0x0040, 0x0160, 0x9186, 0x0042, 0x190c, 0x0dd1, 0x2001, 0x001e, - 0x8001, 0x1df0, 0x8631, 0x1d40, 0x080c, 0x1a23, 0x000e, 0x6022, - 0x012e, 0x0005, 0x080c, 0x1a10, 0x7827, 0x0015, 0x7828, 0x9c06, - 0x1db8, 0x782b, 0x0000, 0x0ca0, 0x00f6, 0x2079, 0x0300, 0x7803, - 0x0000, 0x78ab, 0x0004, 0x2001, 0xf000, 0x8001, 0x090c, 0x0dd1, - 0x7aac, 0xd2ac, 0x1dd0, 0x00fe, 0x080c, 0x7173, 0x1188, 0x2001, - 0x0138, 0x2003, 0x0000, 0x2001, 0x0160, 0x2003, 0x0000, 0x2011, - 0x012c, 0xa001, 0xa001, 0x8211, 0x1de0, 0x0059, 0x0804, 0x7221, - 0x0479, 0x0039, 0x2001, 0x0160, 0x2502, 0x2001, 0x0138, 0x2202, - 0x0005, 0x00e6, 0x2071, 0x0200, 0x080c, 0x2a67, 0x2009, 0x003c, - 0x080c, 0x229b, 0x2001, 0x015d, 0x2003, 0x0000, 0x7000, 0x9084, - 0x003c, 0x1de0, 0x080c, 0x8091, 0x70a0, 0x70a2, 0x7098, 0x709a, - 0x709c, 0x709e, 0x2001, 0x020d, 0x2003, 0x0020, 0x00f6, 0x2079, - 0x0300, 0x080c, 0x12e7, 0x7803, 0x0001, 0x00fe, 0x00ee, 0x0005, - 0x2001, 0x0138, 0x2014, 0x2003, 0x0000, 0x2001, 0x0160, 0x202c, - 0x2003, 0x0000, 0x080c, 0x7173, 0x1108, 0x0005, 0x2021, 0x0260, - 0x2001, 0x0141, 0x201c, 0xd3dc, 0x1168, 0x2001, 0x0109, 0x201c, - 0x939c, 0x0048, 0x1160, 0x2001, 0x0111, 0x201c, 0x83ff, 0x1110, - 0x8421, 0x1d70, 0x2001, 0x015d, 0x2003, 0x0000, 0x0005, 0x0046, - 0x2021, 0x0019, 0x2003, 0x0048, 0xa001, 0xa001, 0x201c, 0x939c, - 0x0048, 0x0120, 0x8421, 0x1db0, 0x004e, 0x0c60, 0x004e, 0x0c40, - 0x601c, 0xc084, 0x601e, 0x0005, 0x2c08, 0x621c, 0x080c, 0x1545, - 0x7930, 0x0005, 0x2c08, 0x621c, 0x080c, 0x15f0, 0x7930, 0x0005, - 0x8001, 0x1df0, 0x0005, 0x2031, 0x0064, 0x781c, 0x9084, 0x0007, - 0x0170, 0x2001, 0x0038, 0x0c41, 0x9186, 0x0040, 0x0904, 0x1a81, - 0x2001, 0x001e, 0x0c69, 0x8631, 0x1d80, 0x080c, 0x0dd1, 0x781f, - 0x0202, 0x2001, 0x015d, 0x2003, 0x0000, 0x2001, 0x0dac, 0x0c01, - 0x781c, 0xd084, 0x0110, 0x0861, 0x04e0, 0x2001, 0x0030, 0x0891, - 0x9186, 0x0040, 0x0568, 0x781c, 0xd084, 0x1da8, 0x781f, 0x0101, - 0x2001, 0x0014, 0x0869, 0x2001, 0x0037, 0x0821, 0x9186, 0x0040, - 0x0140, 0x2001, 0x0030, 0x080c, 0x1a1a, 0x9186, 0x0040, 0x190c, - 0x0dd1, 0x00d6, 0x2069, 0x0200, 0x692c, 0xd1f4, 0x1170, 0xd1c4, - 0x0160, 0xd19c, 0x0130, 0x6800, 0x9085, 0x1800, 0x6802, 0x00de, - 0x0080, 0x6908, 0x9184, 0x0007, 0x1db0, 0x00de, 0x781f, 0x0100, - 0x791c, 0x9184, 0x0007, 0x090c, 0x0dd1, 0xa001, 0xa001, 0x781f, - 0x0200, 0x0005, 0x0126, 0x2091, 0x2400, 0x2071, 0x1a41, 0x2079, - 0x0090, 0x012e, 0x0005, 0x9280, 0x0005, 0x2004, 0x2048, 0xa97c, - 0xd1dc, 0x1904, 0x1b16, 0xa964, 0x9184, 0x0007, 0x0002, 0x1a9f, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From mjacob at FreeBSD.org Sat Aug 1 01:04:26 2009 From: mjacob at FreeBSD.org (Matt Jacob) Date: Sat Aug 1 01:04:41 2009 Subject: svn commit: r196008 - in head/sys: cam dev/isp Message-ID: <200908010104.n7114Qxa085932@svn.freebsd.org> Author: mjacob Date: Sat Aug 1 01:04:26 2009 New Revision: 196008 URL: http://svn.freebsd.org/changeset/base/196008 Log: Add 8Gb support (isp_2500). Fix a fair number of configuration and firmware loading bugs. Target mode support has received some serious attention to make it more usable and stable. Some backward compatible additions to CAM have been made that make target mode async events easier to deal with have also been put into place. Further refinement and better support for NP-IV (N-port Virtualization) is now in place. Code for release prior to RELENG_7 has been stripped away for code clarity. Sponsored by: Copan Systems Reviewed by: scottl, ken, jung-uk kim Approved by: re Modified: head/sys/cam/cam_ccb.h head/sys/cam/cam_xpt.c head/sys/dev/isp/isp.c head/sys/dev/isp/isp_freebsd.c head/sys/dev/isp/isp_freebsd.h head/sys/dev/isp/isp_ioctl.h head/sys/dev/isp/isp_library.c head/sys/dev/isp/isp_library.h head/sys/dev/isp/isp_pci.c head/sys/dev/isp/isp_sbus.c head/sys/dev/isp/isp_stds.h head/sys/dev/isp/isp_target.c head/sys/dev/isp/isp_target.h head/sys/dev/isp/ispmbox.h head/sys/dev/isp/ispreg.h head/sys/dev/isp/ispvar.h Modified: head/sys/cam/cam_ccb.h ============================================================================== --- head/sys/cam/cam_ccb.h Sat Aug 1 00:57:34 2009 (r196007) +++ head/sys/cam/cam_ccb.h Sat Aug 1 01:04:26 2009 (r196008) @@ -173,6 +173,15 @@ typedef enum { XPT_ATA_IO = 0x18 | XPT_FC_DEV_QUEUED, /* Execute the requested ATA I/O operation */ + XPT_GET_SIM_KNOB = 0x18, + /* + * Get SIM specific knob values. + */ + + XPT_SET_SIM_KNOB = 0x19, + /* + * Set SIM specific knob values. + */ /* HBA engine commands 0x20->0x2F */ XPT_ENG_INQ = 0x20 | XPT_FC_XPT_ONLY, /* HBA engine feature inquiry */ @@ -189,8 +198,12 @@ typedef enum { XPT_CONT_TARGET_IO = 0x33 | XPT_FC_DEV_QUEUED, /* Continue Host Target I/O Connection */ XPT_IMMED_NOTIFY = 0x34 | XPT_FC_QUEUED | XPT_FC_USER_CCB, - /* Notify Host Target driver of event */ + /* Notify Host Target driver of event (obsolete) */ XPT_NOTIFY_ACK = 0x35, + /* Acknowledgement of event (obsolete) */ + XPT_IMMEDIATE_NOTIFY = 0x36 | XPT_FC_QUEUED | XPT_FC_USER_CCB, + /* Notify Host Target driver of event */ + XPT_NOTIFY_ACKNOWLEDGE = 0x37 | XPT_FC_QUEUED | XPT_FC_USER_CCB, /* Acknowledgement of event */ /* Vendor Unique codes: 0x80->0x8F */ @@ -531,12 +544,14 @@ typedef enum { struct ccb_pathinq_settings_spi { u_int8_t ppr_options; }; + struct ccb_pathinq_settings_fc { u_int64_t wwnn; /* world wide node name */ u_int64_t wwpn; /* world wide port name */ u_int32_t port; /* 24 bit port id, if known */ u_int32_t bitrate; /* Mbps */ }; + struct ccb_pathinq_settings_sas { u_int32_t bitrate; /* Mbps */ }; @@ -678,6 +693,7 @@ struct ccb_relsim { * Definitions for the asynchronous callback CCB fields. */ typedef enum { + AC_CONTRACT = 0x1000,/* A contractual callback */ AC_GETDEV_CHANGED = 0x800,/* Getdev info might have changed */ AC_INQ_CHANGED = 0x400,/* Inquiry info might have changed */ AC_TRANSFER_NEG = 0x200,/* New transfer settings in effect */ @@ -694,6 +710,26 @@ typedef enum { typedef void ac_callback_t (void *softc, u_int32_t code, struct cam_path *path, void *args); +/* + * Generic Asynchronous callbacks. + * + * Generic arguments passed bac which are then interpreted between a per-system + * contract number. + */ +#define AC_CONTRACT_DATA_MAX (128 - sizeof (u_int64_t)) +struct ac_contract { + u_int64_t contract_number; + u_int8_t contract_data[AC_CONTRACT_DATA_MAX]; +}; + +#define AC_CONTRACT_DEV_CHG 1 +struct ac_device_changed { + u_int64_t wwpn; + u_int32_t port; + target_id_t target; + u_int8_t arrived; +}; + /* Set Asynchronous Callback CCB */ struct ccb_setasync { struct ccb_hdr ccb_h; @@ -823,6 +859,50 @@ struct ccb_calc_geometry { }; /* + * Set or get SIM (and transport) specific knobs + */ + +#define KNOB_VALID_ADDRESS 0x1 +#define KNOB_VALID_ROLE 0x2 + + +#define KNOB_ROLE_NONE 0x0 +#define KNOB_ROLE_INITIATOR 0x1 +#define KNOB_ROLE_TARGET 0x2 +#define KNOB_ROLE_BOTH 0x3 + +struct ccb_sim_knob_settings_spi { + u_int valid; + u_int initiator_id; + u_int role; +}; + +struct ccb_sim_knob_settings_fc { + u_int valid; + u_int64_t wwnn; /* world wide node name */ + u_int64_t wwpn; /* world wide port name */ + u_int role; +}; + +struct ccb_sim_knob_settings_sas { + u_int valid; + u_int64_t wwnn; /* world wide node name */ + u_int role; +}; +#define KNOB_SETTINGS_SIZE 128 + +struct ccb_sim_knob { + struct ccb_hdr ccb_h; + union { + u_int valid; /* Which fields to honor */ + struct ccb_sim_knob_settings_spi spi; + struct ccb_sim_knob_settings_fc fc; + struct ccb_sim_knob_settings_sas sas; + char pad[KNOB_SETTINGS_SIZE]; + } xport_specific; +}; + +/* * Rescan the given bus, or bus/target/lun */ struct ccb_rescan { @@ -847,6 +927,7 @@ struct ccb_en_lun { u_int8_t enable; }; +/* old, barely used immediate notify, binary compatibility */ struct ccb_immed_notify { struct ccb_hdr ccb_h; struct scsi_sense_data sense_data; @@ -861,6 +942,22 @@ struct ccb_notify_ack { u_int8_t event; /* Event flags */ }; +struct ccb_immediate_notify { + struct ccb_hdr ccb_h; + u_int tag_id; /* Tag for immediate notify */ + u_int seq_id; /* Tag for target of notify */ + u_int initiator_id; /* Initiator Identifier */ + u_int arg; /* Function specific */ +}; + +struct ccb_notify_acknowledge { + struct ccb_hdr ccb_h; + u_int tag_id; /* Tag for immediate notify */ + u_int seq_id; /* Tar for target of notify */ + u_int initiator_id; /* Initiator Identifier */ + u_int arg; /* Function specific */ +}; + /* HBA engine structures. */ typedef enum { @@ -935,6 +1032,7 @@ union ccb { struct ccb_dev_match cdm; struct ccb_trans_settings cts; struct ccb_calc_geometry ccg; + struct ccb_sim_knob knob; struct ccb_abort cab; struct ccb_resetbus crb; struct ccb_resetdev crd; @@ -944,6 +1042,8 @@ union ccb { struct ccb_en_lun cel; struct ccb_immed_notify cin; struct ccb_notify_ack cna; + struct ccb_immediate_notify cin1; + struct ccb_notify_acknowledge cna2; struct ccb_eng_inq cei; struct ccb_eng_exec cee; struct ccb_rescan crcn; Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sat Aug 1 00:57:34 2009 (r196007) +++ head/sys/cam/cam_xpt.c Sat Aug 1 01:04:26 2009 (r196008) @@ -2565,6 +2565,10 @@ xpt_action_default(union ccb *start_ccb) case XPT_IMMED_NOTIFY: case XPT_NOTIFY_ACK: case XPT_RESET_BUS: + case XPT_IMMEDIATE_NOTIFY: + case XPT_NOTIFY_ACKNOWLEDGE: + case XPT_GET_SIM_KNOB: + case XPT_SET_SIM_KNOB: { struct cam_sim *sim; Modified: head/sys/dev/isp/isp.c ============================================================================== --- head/sys/dev/isp/isp.c Sat Aug 1 00:57:34 2009 (r196007) +++ head/sys/dev/isp/isp.c Sat Aug 1 01:04:26 2009 (r196008) @@ -1,17 +1,17 @@ /*- - * Copyright (c) 1997-2007 by Matthew Jacob + * Copyright (c) 1997-2009 by Matthew Jacob * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -23,6 +23,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * */ /* @@ -64,51 +65,52 @@ __FBSDID("$FreeBSD$"); */ #define MBOX_DELAY_COUNT 1000000 / 100 -#define ISP_MARK_PORTDB(a, b) \ - isp_prt(isp, ISP_LOGSANCFG, "line %d: markportdb", __LINE__); \ - isp_mark_portdb(a, b) +#define ISP_MARK_PORTDB(a, b, c) \ + isp_prt(isp, ISP_LOGSANCFG, \ + "Chan %d ISP_MARK_PORTDB@LINE %d", b, __LINE__); \ + isp_mark_portdb(a, b, c) /* * Local static data */ -static const char fconf[] = - "PortDB[%d] changed:\n current =(0x%x@0x%06x 0x%08x%08x 0x%08x%08x)\n" - " database=(0x%x@0x%06x 0x%08x%08x 0x%08x%08x)"; -static const char notresp[] = - "Not RESPONSE in RESPONSE Queue (type 0x%x) @ idx %d (next %d) nlooked %d"; -static const char xact1[] = - "HBA attempted queued transaction with disconnect not set for %d.%d.%d"; -static const char xact2[] = - "HBA attempted queued transaction to target routine %d on target %d bus %d"; -static const char xact3[] = - "HBA attempted queued cmd for %d.%d.%d when queueing disabled"; -static const char pskip[] = - "SCSI phase skipped for target %d.%d.%d"; -static const char topology[] = - "HBA PortID 0x%06x N-Port Handle %d, Connection Topology '%s'"; -static const char ourwwn[] = - "HBA WWNN 0x%08x%08x HBA WWPN 0x%08x%08x"; -static const char finmsg[] = - "%d.%d.%d: FIN dl%d resid %d STS 0x%x SKEY %c XS_ERR=0x%x"; -static const char sc0[] = - "%s CHAN %d FTHRSH %d IID %d RESETD %d RETRYC %d RETRYD %d ASD 0x%x"; -static const char sc1[] = - "%s RAAN 0x%x DLAN 0x%x DDMAB 0x%x CDMAB 0x%x SELTIME %d MQD %d"; -static const char sc2[] = "%s CHAN %d TGT %d FLAGS 0x%x 0x%x/0x%x"; -static const char sc3[] = "Generated"; +static const char fconf[] = "Chan %d PortDB[%d] changed:\n current =(0x%x@0x%06x 0x%08x%08x 0x%08x%08x)\n database=(0x%x@0x%06x 0x%08x%08x 0x%08x%08x)"; +static const char notresp[] = "Not RESPONSE in RESPONSE Queue (type 0x%x) @ idx %d (next %d) nlooked %d"; +static const char xact1[] = "HBA attempted queued transaction with disconnect not set for %d.%d.%d"; +static const char xact2[] = "HBA attempted queued transaction to target routine %d on target %d bus %d"; +static const char xact3[] = "HBA attempted queued cmd for %d.%d.%d when queueing disabled"; +static const char pskip[] = "SCSI phase skipped for target %d.%d.%d"; +static const char topology[] = "Chan %d WWPN 0x%08x%08x PortID 0x%06x N-Port Handle %d, Connection '%s'"; +static const char finmsg[] = "%d.%d.%d: FIN dl%d resid %ld STS 0x%x SKEY %c XS_ERR=0x%x"; static const char sc4[] = "NVRAM"; -static const char bun[] = - "bad underrun for %d.%d (count %d, resid %d, status %s)"; +static const char bun[] = "bad underrun for %d.%d (count %d, resid %d, status %s)"; +static const char lipd[] = "Chan %d LIP destroyed %d active commands"; +static const char sacq[] = "unable to acquire scratch area"; + +static const uint8_t alpa_map[] = { + 0xef, 0xe8, 0xe4, 0xe2, 0xe1, 0xe0, 0xdc, 0xda, + 0xd9, 0xd6, 0xd5, 0xd4, 0xd3, 0xd2, 0xd1, 0xce, + 0xcd, 0xcc, 0xcb, 0xca, 0xc9, 0xc7, 0xc6, 0xc5, + 0xc3, 0xbc, 0xba, 0xb9, 0xb6, 0xb5, 0xb4, 0xb3, + 0xb2, 0xb1, 0xae, 0xad, 0xac, 0xab, 0xaa, 0xa9, + 0xa7, 0xa6, 0xa5, 0xa3, 0x9f, 0x9e, 0x9d, 0x9b, + 0x98, 0x97, 0x90, 0x8f, 0x88, 0x84, 0x82, 0x81, + 0x80, 0x7c, 0x7a, 0x79, 0x76, 0x75, 0x74, 0x73, + 0x72, 0x71, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x69, + 0x67, 0x66, 0x65, 0x63, 0x5c, 0x5a, 0x59, 0x56, + 0x55, 0x54, 0x53, 0x52, 0x51, 0x4e, 0x4d, 0x4c, + 0x4b, 0x4a, 0x49, 0x47, 0x46, 0x45, 0x43, 0x3c, + 0x3a, 0x39, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, + 0x2e, 0x2d, 0x2c, 0x2b, 0x2a, 0x29, 0x27, 0x26, + 0x25, 0x23, 0x1f, 0x1e, 0x1d, 0x1b, 0x18, 0x17, + 0x10, 0x0f, 0x08, 0x04, 0x02, 0x01, 0x00 +}; /* * Local function prototypes. */ static int isp_parse_async(ispsoftc_t *, uint16_t); -static int isp_handle_other_response(ispsoftc_t *, int, isphdr_t *, - uint32_t *); -static void -isp_parse_status(ispsoftc_t *, ispstatusreq_t *, XS_T *, long *); -static void +static int isp_handle_other_response(ispsoftc_t *, int, isphdr_t *, uint32_t *); +static void isp_parse_status(ispsoftc_t *, ispstatusreq_t *, XS_T *, long *); static void isp_parse_status_24xx(ispsoftc_t *, isp24xx_statusreq_t *, XS_T *, long *); static void isp_fastpost_complete(ispsoftc_t *, uint16_t); static int isp_mbox_continue(ispsoftc_t *); @@ -116,39 +118,37 @@ static void isp_scsi_init(ispsoftc_t *); static void isp_scsi_channel_init(ispsoftc_t *, int); static void isp_fibre_init(ispsoftc_t *); static void isp_fibre_init_2400(ispsoftc_t *); -static void isp_mark_portdb(ispsoftc_t *, int); -static int isp_plogx(ispsoftc_t *, uint16_t, uint32_t, int, int); +static void isp_mark_portdb(ispsoftc_t *, int, int); +static int isp_plogx(ispsoftc_t *, int, uint16_t, uint32_t, int, int); static int isp_port_login(ispsoftc_t *, uint16_t, uint32_t); static int isp_port_logout(ispsoftc_t *, uint16_t, uint32_t); -static int isp_getpdb(ispsoftc_t *, uint16_t, isp_pdb_t *, int); -static uint64_t isp_get_portname(ispsoftc_t *, int, int); -static int isp_fclink_test(ispsoftc_t *, int); -static const char *ispfc_fw_statename(int); -static int isp_pdb_sync(ispsoftc_t *); -static int isp_scan_loop(ispsoftc_t *); -static int isp_gid_ft_sns(ispsoftc_t *); -static int isp_gid_ft_ct_passthru(ispsoftc_t *); -static int isp_scan_fabric(ispsoftc_t *); -static int isp_login_device(ispsoftc_t *, uint32_t, isp_pdb_t *, uint16_t *); -static int isp_register_fc4_type(ispsoftc_t *); -static int isp_register_fc4_type_24xx(ispsoftc_t *); -static uint16_t isp_nxt_handle(ispsoftc_t *, uint16_t); -static void isp_fw_state(ispsoftc_t *); +static int isp_getpdb(ispsoftc_t *, int, uint16_t, isp_pdb_t *, int); +static void isp_dump_chip_portdb(ispsoftc_t *, int, int); +static uint64_t isp_get_wwn(ispsoftc_t *, int, int, int); +static int isp_fclink_test(ispsoftc_t *, int, int); +static int isp_pdb_sync(ispsoftc_t *, int); +static int isp_scan_loop(ispsoftc_t *, int); +static int isp_gid_ft_sns(ispsoftc_t *, int); +static int isp_gid_ft_ct_passthru(ispsoftc_t *, int); +static int isp_scan_fabric(ispsoftc_t *, int); +static int isp_login_device(ispsoftc_t *, int, uint32_t, isp_pdb_t *, uint16_t *); +static int isp_register_fc4_type(ispsoftc_t *, int); +static int isp_register_fc4_type_24xx(ispsoftc_t *, int); +static uint16_t isp_nxt_handle(ispsoftc_t *, int, uint16_t); +static void isp_fw_state(ispsoftc_t *, int); static void isp_mboxcmd_qnw(ispsoftc_t *, mbreg_t *, int); static void isp_mboxcmd(ispsoftc_t *, mbreg_t *); -static void isp_update(ispsoftc_t *); -static void isp_update_bus(ispsoftc_t *, int); -static void isp_setdfltparm(ispsoftc_t *, int); -static void isp_setdfltfcparm(ispsoftc_t *); -static int isp_read_nvram(ispsoftc_t *); -static int isp_read_nvram_2400(ispsoftc_t *); +static void isp_spi_update(ispsoftc_t *, int); +static void isp_setdfltsdparm(ispsoftc_t *); +static void isp_setdfltfcparm(ispsoftc_t *, int); +static int isp_read_nvram(ispsoftc_t *, int); +static int isp_read_nvram_2400(ispsoftc_t *, uint8_t *); static void isp_rdnvram_word(ispsoftc_t *, int, uint16_t *); static void isp_rd_2400_nvram(ispsoftc_t *, uint32_t, uint32_t *); static void isp_parse_nvram_1020(ispsoftc_t *, uint8_t *); static void isp_parse_nvram_1080(ispsoftc_t *, int, uint8_t *); static void isp_parse_nvram_12160(ispsoftc_t *, int, uint8_t *); -static void isp_fix_nvram_wwns(ispsoftc_t *); static void isp_parse_nvram_2100(ispsoftc_t *, uint8_t *); static void isp_parse_nvram_2400(ispsoftc_t *, uint8_t *); @@ -161,15 +161,20 @@ static void isp_parse_nvram_2400(ispsoft */ void -isp_reset(ispsoftc_t *isp) +isp_reset(ispsoftc_t *isp, int do_load_defaults) { mbreg_t mbs; uint32_t code_org, val; int loops, i, dodnld = 1; - static const char *btype = "????"; + const char *btype = "????"; static const char dcrc[] = "Downloaded RISC Code Checksum Failure"; isp->isp_state = ISP_NILSTATE; + if (isp->isp_dead) { + isp_shutdown(isp); + ISP_DISABLE_INTS(isp); + return; + } /* * Basic types (SCSI, FibreChannel and PCI or SBus) @@ -181,51 +186,6 @@ isp_reset(ispsoftc_t *isp) * for SCSI adapters and do other settings for the 2100. */ - /* - * Get the current running firmware revision out of the - * chip before we hit it over the head (if this is our - * first time through). Note that we store this as the - * 'ROM' firmware revision- which it may not be. In any - * case, we don't really use this yet, but we may in - * the future. - */ - if (isp->isp_touched == 0) { - /* - * First see whether or not we're sitting in the ISP PROM. - * If we've just been reset, we'll have the string "ISP " - * spread through outgoing mailbox registers 1-3. We do - * this for PCI cards because otherwise we really don't - * know what state the card is in and we could hang if - * we try this command otherwise. - * - * For SBus cards, we just do this because they almost - * certainly will be running firmware by now. - */ - if (ISP_READ(isp, OUTMAILBOX1) != 0x4953 || - ISP_READ(isp, OUTMAILBOX2) != 0x5020 || - ISP_READ(isp, OUTMAILBOX3) != 0x2020) { - /* - * Just in case it was paused... - */ - if (IS_24XX(isp)) { - ISP_WRITE(isp, BIU2400_HCCR, - HCCR_2400_CMD_RELEASE); - } else { - ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE); - } - MEMZERO(&mbs, sizeof (mbs)); - mbs.param[0] = MBOX_ABOUT_FIRMWARE; - mbs.logval = MBLOGNONE; - isp_mboxcmd(isp, &mbs); - if (mbs.param[0] == MBOX_COMMAND_COMPLETE) { - isp->isp_romfw_rev[0] = mbs.param[1]; - isp->isp_romfw_rev[1] = mbs.param[2]; - isp->isp_romfw_rev[2] = mbs.param[3]; - } - } - isp->isp_touched = 1; - } - ISP_DISABLE_INTS(isp); /* @@ -244,17 +204,16 @@ isp_reset(ispsoftc_t *isp) } /* - * Set up DMA for the request and result queues. + * Set up DMA for the request and response queues. * * We do this now so we can use the request queue - * for a dma + * for dma to load firmware from. */ if (ISP_MBOXDMASETUP(isp) != 0) { isp_prt(isp, ISP_LOGERR, "Cannot setup DMA"); return; } - /* * Set up default request/response queue in-pointer/out-pointer * register indices. @@ -264,8 +223,6 @@ isp_reset(ispsoftc_t *isp) isp->isp_rqstoutrp = BIU2400_REQOUTP; isp->isp_respinrp = BIU2400_RSPINP; isp->isp_respoutrp = BIU2400_RSPOUTP; - isp->isp_atioinrp = BIU2400_ATIO_RSPINP; - isp->isp_atiooutrp = BIU2400_ATIO_REQINP; } else if (IS_23XX(isp)) { isp->isp_rqstinrp = BIU_REQINP; isp->isp_rqstoutrp = BIU_REQOUTP; @@ -310,6 +267,9 @@ isp_reset(ispsoftc_t *isp) case ISP_HA_FC_2400: btype = "2422"; break; + case ISP_HA_FC_2500: + btype = "2532"; + break; default: break; } @@ -326,11 +286,13 @@ isp_reset(ispsoftc_t *isp) ISP_WRITE(isp, BIU2100_CSR, BIU2100_RISC_REGS); } } else if (IS_1240(isp)) { - sdparam *sdp = isp->isp_param; + sdparam *sdp; + btype = "1240"; isp->isp_clock = 60; + sdp = SDPARAM(isp, 0); sdp->isp_ultramode = 1; - sdp++; + sdp = SDPARAM(isp, 1); sdp->isp_ultramode = 1; /* * XXX: Should probably do some bus sensing. @@ -355,7 +317,7 @@ isp_reset(ispsoftc_t *isp) } else if (IS_ULTRA2(isp)) { static const char m[] = "bus %d is in %s Mode"; uint16_t l; - sdparam *sdp = isp->isp_param; + sdparam *sdp = SDPARAM(isp, 0); isp->isp_clock = 100; @@ -387,10 +349,10 @@ isp_reset(ispsoftc_t *isp) } if (IS_DUALBUS(isp)) { - sdp++; + sdp = SDPARAM(isp, 1); l = ISP_READ(isp, SXP_PINS_DIFF|SXP_BANK1_SELECT); l &= ISP1080_MODE_MASK; - switch(l) { + switch (l) { case ISP1080_LVD_MODE: sdp->isp_lvdmode = 1; isp_prt(isp, ISP_LOGCONFIG, m, 1, "LVD"); @@ -412,7 +374,7 @@ isp_reset(ispsoftc_t *isp) } } } else { - sdparam *sdp = isp->isp_param; + sdparam *sdp = SDPARAM(isp, 0); i = ISP_READ(isp, BIU_CONF0) & BIU_CONF0_HW_MASK; switch (i) { default: @@ -509,7 +471,7 @@ isp_reset(ispsoftc_t *isp) /* * Hit the chip over the head with hammer, - * and give the ISP a chance to recover. + * and give it a chance to recover. */ if (IS_SCSI(isp)) { @@ -517,15 +479,13 @@ isp_reset(ispsoftc_t *isp) /* * A slight delay... */ - USEC_DELAY(100); + ISP_DELAY(100); /* * Clear data && control DMA engines. */ - ISP_WRITE(isp, CDMA_CONTROL, - DMA_CNTRL_CLEAR_CHAN | DMA_CNTRL_RESET_INT); - ISP_WRITE(isp, DDMA_CONTROL, - DMA_CNTRL_CLEAR_CHAN | DMA_CNTRL_RESET_INT); + ISP_WRITE(isp, CDMA_CONTROL, DMA_CNTRL_CLEAR_CHAN | DMA_CNTRL_RESET_INT); + ISP_WRITE(isp, DDMA_CONTROL, DMA_CNTRL_CLEAR_CHAN | DMA_CNTRL_RESET_INT); } else if (IS_24XX(isp)) { @@ -534,12 +494,12 @@ isp_reset(ispsoftc_t *isp) */ ISP_WRITE(isp, BIU2400_CSR, BIU2400_DMA_STOP|(3 << 4)); for (val = loops = 0; loops < 30000; loops++) { - USEC_DELAY(10); + ISP_DELAY(10); val = ISP_READ(isp, BIU2400_CSR); if ((val & BIU2400_DMA_ACTIVE) == 0) { break; } - } + } if (val & BIU2400_DMA_ACTIVE) { ISP_RESET0(isp); isp_prt(isp, ISP_LOGERR, "DMA Failed to Stop on Reset"); @@ -548,11 +508,10 @@ isp_reset(ispsoftc_t *isp) /* * Hold it in SOFT_RESET and STOP state for 100us. */ - ISP_WRITE(isp, BIU2400_CSR, - BIU2400_SOFT_RESET|BIU2400_DMA_STOP|(3 << 4)); - USEC_DELAY(100); + ISP_WRITE(isp, BIU2400_CSR, BIU2400_SOFT_RESET|BIU2400_DMA_STOP|(3 << 4)); + ISP_DELAY(100); for (loops = 0; loops < 10000; loops++) { - USEC_DELAY(5); + ISP_DELAY(5); val = ISP_READ(isp, OUTMAILBOX0); } for (val = loops = 0; loops < 500000; loops ++) { @@ -571,17 +530,14 @@ isp_reset(ispsoftc_t *isp) /* * A slight delay... */ - USEC_DELAY(100); + ISP_DELAY(100); /* * Clear data && control DMA engines. */ - ISP_WRITE(isp, CDMA2100_CONTROL, - DMA_CNTRL2100_CLEAR_CHAN | DMA_CNTRL2100_RESET_INT); - ISP_WRITE(isp, TDMA2100_CONTROL, - DMA_CNTRL2100_CLEAR_CHAN | DMA_CNTRL2100_RESET_INT); - ISP_WRITE(isp, RDMA2100_CONTROL, - DMA_CNTRL2100_CLEAR_CHAN | DMA_CNTRL2100_RESET_INT); + ISP_WRITE(isp, CDMA2100_CONTROL, DMA_CNTRL2100_CLEAR_CHAN | DMA_CNTRL2100_RESET_INT); + ISP_WRITE(isp, TDMA2100_CONTROL, DMA_CNTRL2100_CLEAR_CHAN | DMA_CNTRL2100_RESET_INT); + ISP_WRITE(isp, RDMA2100_CONTROL, DMA_CNTRL2100_CLEAR_CHAN | DMA_CNTRL2100_RESET_INT); } /* @@ -601,7 +557,7 @@ isp_reset(ispsoftc_t *isp) if (!(ISP_READ(isp, BIU2100_CSR) & BIU2100_SOFT_RESET)) break; } - USEC_DELAY(100); + ISP_DELAY(100); if (--loops < 0) { ISP_DUMPREGS(isp, "chip reset timed out"); ISP_RESET0(isp); @@ -629,17 +585,16 @@ isp_reset(ispsoftc_t *isp) ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_CLEAR_RESET); } else { ISP_WRITE(isp, HCCR, HCCR_CMD_RESET); - USEC_DELAY(100); + ISP_DELAY(100); ISP_WRITE(isp, BIU_SEMA, 0); } - /* * Post-RISC Reset stuff. */ if (IS_24XX(isp)) { for (val = loops = 0; loops < 5000000; loops++) { - USEC_DELAY(5); + ISP_DELAY(5); val = ISP_READ(isp, OUTMAILBOX0); if (val == 0) { break; @@ -663,8 +618,8 @@ isp_reset(ispsoftc_t *isp) ISP_SETBITS(isp, CDMA_CONF, DMA_ENABLE_BURST); ISP_SETBITS(isp, DDMA_CONF, DMA_ENABLE_BURST); } - if (SDPARAM(isp)->isp_ptisp) { - if (SDPARAM(isp)->isp_ultramode) { + if (SDPARAM(isp, 0)->isp_ptisp) { + if (SDPARAM(isp, 0)->isp_ultramode) { while (ISP_READ(isp, RISC_MTR) != 0x1313) { ISP_WRITE(isp, RISC_MTR, 0x1313); ISP_WRITE(isp, HCCR, HCCR_CMD_STEP); @@ -692,7 +647,12 @@ isp_reset(ispsoftc_t *isp) ISP_WRITE(isp, isp->isp_rqstoutrp, 0); ISP_WRITE(isp, isp->isp_respinrp, 0); ISP_WRITE(isp, isp->isp_respoutrp, 0); - + if (IS_24XX(isp)) { + ISP_WRITE(isp, BIU2400_PRI_REQINP, 0); + ISP_WRITE(isp, BIU2400_PRI_REQOUTP, 0); + ISP_WRITE(isp, BIU2400_ATIO_RSPINP, 0); + ISP_WRITE(isp, BIU2400_ATIO_RSPOUTP, 0); + } /* * Do MD specific post initialization @@ -702,15 +662,15 @@ isp_reset(ispsoftc_t *isp) /* * Wait for everything to finish firing up. * - * Avoid doing this on the 2312 because you can generate a PCI + * Avoid doing this on early 2312s because you can generate a PCI * parity error (chip breakage). */ - if (IS_2312(isp)) { - USEC_DELAY(100); + if (IS_2312(isp) && isp->isp_revision < 2) { + ISP_DELAY(100); } else { loops = MBOX_DELAY_COUNT; while (ISP_READ(isp, OUTMAILBOX0) == MBOX_BUSY) { - USEC_DELAY(100); + ISP_DELAY(100); if (--loops < 0) { ISP_RESET0(isp); isp_prt(isp, ISP_LOGERR, @@ -727,19 +687,25 @@ isp_reset(ispsoftc_t *isp) */ /* - * Do some sanity checking. + * Do some sanity checking by running a NOP command. + * If it succeeds, the ROM firmware is now running. */ - MEMZERO(&mbs, sizeof (mbs)); + ISP_MEMZERO(&mbs, sizeof (mbs)); mbs.param[0] = MBOX_NO_OP; mbs.logval = MBLOGALL; isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { + isp_prt(isp, ISP_LOGERR, "NOP ommand failed (%x)", mbs.param[0]); ISP_RESET0(isp); return; } + /* + * Do some operational tests + */ + if (IS_SCSI(isp) || IS_24XX(isp)) { - MEMZERO(&mbs, sizeof (mbs)); + ISP_MEMZERO(&mbs, sizeof (mbs)); mbs.param[0] = MBOX_MAILBOX_REG_TEST; mbs.param[1] = 0xdead; mbs.param[2] = 0xbeef; @@ -758,10 +724,7 @@ isp_reset(ispsoftc_t *isp) mbs.param[3] != 0xffff || mbs.param[4] != 0x1111 || mbs.param[5] != 0xa5a5) { ISP_RESET0(isp); - isp_prt(isp, ISP_LOGERR, - "Register Test Failed (0x%x 0x%x 0x%x 0x%x 0x%x)", - mbs.param[1], mbs.param[2], mbs.param[3], - mbs.param[4], mbs.param[5]); + isp_prt(isp, ISP_LOGERR, "Register Test Failed (0x%x 0x%x 0x%x 0x%x 0x%x)", mbs.param[1], mbs.param[2], mbs.param[3], mbs.param[4], mbs.param[5]); return; } @@ -776,8 +739,7 @@ isp_reset(ispsoftc_t *isp) * whether we have f/w at all and whether a config flag * has disabled our download. */ - if ((isp->isp_mdvec->dv_ispfw == NULL) || - (isp->isp_confopts & ISP_CFG_NORELOAD)) { + if ((isp->isp_mdvec->dv_ispfw == NULL) || (isp->isp_confopts & ISP_CFG_NORELOAD)) { dodnld = 0; } @@ -793,13 +755,6 @@ isp_reset(ispsoftc_t *isp) const uint32_t *ptr = isp->isp_mdvec->dv_ispfw; /* - * NB: Whatever you do do, do *not* issue the VERIFY FIRMWARE - * NB: command to the 2400 while loading new firmware. This - * NB: causes the new f/w to start and immediately crash back - * NB: to the ROM. - */ - - /* * Keep loading until we run out of f/w. */ code_org = ptr[2]; /* 1st load address is our start addr */ @@ -807,9 +762,7 @@ isp_reset(ispsoftc_t *isp) for (;;) { uint32_t la, wi, wl; - isp_prt(isp, ISP_LOGDEBUG0, - "load 0x%x words of code at load address 0x%x", - ptr[3], ptr[2]); + isp_prt(isp, ISP_LOGDEBUG0, "load 0x%x words of code at load address 0x%x", ptr[3], ptr[2]); wi = 0; la = ptr[2]; @@ -828,23 +781,31 @@ isp_reset(ispsoftc_t *isp) ISP_IOXPUT_32(isp, ptr[wi++], &cp[i]); wl--; } - MEMORYBARRIER(isp, SYNC_REQUEST, - 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp))); - MEMZERO(&mbs, sizeof (mbs)); - mbs.param[0] = MBOX_LOAD_RISC_RAM; - mbs.param[1] = la; - mbs.param[2] = DMA_WD1(isp->isp_rquest_dma); - mbs.param[3] = DMA_WD0(isp->isp_rquest_dma); - mbs.param[4] = nw >> 16; - mbs.param[5] = nw; - mbs.param[6] = DMA_WD3(isp->isp_rquest_dma); - mbs.param[7] = DMA_WD2(isp->isp_rquest_dma); - mbs.param[8] = la >> 16; + MEMORYBARRIER(isp, SYNC_REQUEST, 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp))); + ISP_MEMZERO(&mbs, sizeof (mbs)); + if (la < 0x10000 && nw < 0x10000) { + mbs.param[0] = MBOX_LOAD_RISC_RAM_2100; + mbs.param[1] = la; + mbs.param[2] = DMA_WD1(isp->isp_rquest_dma); + mbs.param[3] = DMA_WD0(isp->isp_rquest_dma); + mbs.param[4] = nw; + mbs.param[6] = DMA_WD3(isp->isp_rquest_dma); + mbs.param[7] = DMA_WD2(isp->isp_rquest_dma); + } else { + mbs.param[0] = MBOX_LOAD_RISC_RAM; + mbs.param[1] = la; + mbs.param[2] = DMA_WD1(isp->isp_rquest_dma); + mbs.param[3] = DMA_WD0(isp->isp_rquest_dma); + mbs.param[4] = nw >> 16; + mbs.param[5] = nw; + mbs.param[6] = DMA_WD3(isp->isp_rquest_dma); + mbs.param[7] = DMA_WD2(isp->isp_rquest_dma); + mbs.param[8] = la >> 16; + } mbs.logval = MBLOGALL; isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { - isp_prt(isp, ISP_LOGERR, - "F/W Risc Ram Load Failed"); + isp_prt(isp, ISP_LOGERR, "F/W Risc Ram Load Failed"); ISP_RESET0(isp); return; } @@ -855,7 +816,7 @@ isp_reset(ispsoftc_t *isp) break; } ptr += ptr[3]; - } + } isp->isp_loaded_fw = 1; } else if (dodnld && IS_23XX(isp)) { const uint16_t *ptr = isp->isp_mdvec->dv_ispfw; @@ -868,17 +829,15 @@ isp_reset(ispsoftc_t *isp) for (;;) { uint32_t nxtaddr; - isp_prt(isp, ISP_LOGDEBUG0, - "load 0x%x words of code at load address 0x%x", - ptr[3], la); + isp_prt(isp, ISP_LOGDEBUG0, "load 0x%x words of code at load address 0x%x", ptr[3], la); wi = 0; wl = ptr[3]; while (wi < ptr[3]) { uint16_t *cp; - uint32_t nw; - + uint16_t nw; + nw = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)) >> 1; if (nw > wl) { nw = wl; @@ -891,22 +850,30 @@ isp_reset(ispsoftc_t *isp) ISP_IOXPUT_16(isp, ptr[wi++], &cp[i]); wl--; } - MEMORYBARRIER(isp, SYNC_REQUEST, - 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp))); - MEMZERO(&mbs, sizeof (mbs)); - mbs.param[0] = MBOX_LOAD_RISC_RAM; - mbs.param[1] = la; - mbs.param[2] = DMA_WD1(isp->isp_rquest_dma); - mbs.param[3] = DMA_WD0(isp->isp_rquest_dma); - mbs.param[4] = nw; - mbs.param[6] = DMA_WD3(isp->isp_rquest_dma); - mbs.param[7] = DMA_WD2(isp->isp_rquest_dma); - mbs.param[8] = la >> 16; + MEMORYBARRIER(isp, SYNC_REQUEST, 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp))); + ISP_MEMZERO(&mbs, sizeof (mbs)); + if (la < 0x10000) { + mbs.param[0] = MBOX_LOAD_RISC_RAM_2100; + mbs.param[1] = la; + mbs.param[2] = DMA_WD1(isp->isp_rquest_dma); + mbs.param[3] = DMA_WD0(isp->isp_rquest_dma); + mbs.param[4] = nw; + mbs.param[6] = DMA_WD3(isp->isp_rquest_dma); + mbs.param[7] = DMA_WD2(isp->isp_rquest_dma); + } else { + mbs.param[0] = MBOX_LOAD_RISC_RAM; + mbs.param[1] = la; + mbs.param[2] = DMA_WD1(isp->isp_rquest_dma); + mbs.param[3] = DMA_WD0(isp->isp_rquest_dma); + mbs.param[4] = nw; + mbs.param[6] = DMA_WD3(isp->isp_rquest_dma); + mbs.param[7] = DMA_WD2(isp->isp_rquest_dma); + mbs.param[8] = la >> 16; + } mbs.logval = MBLOGALL; isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { - isp_prt(isp, ISP_LOGERR, - "F/W Risc Ram Load Failed"); + isp_prt(isp, ISP_LOGERR, "F/W Risc Ram Load Failed"); ISP_RESET0(isp); return; } @@ -914,19 +881,6 @@ isp_reset(ispsoftc_t *isp) } if (!IS_2322(isp)) { - /* - * Verify that it downloaded correctly. - */ - MEMZERO(&mbs, sizeof (mbs)); - mbs.param[0] = MBOX_VERIFY_CHECKSUM; - mbs.param[1] = code_org; - mbs.logval = MBLOGNONE; - isp_mboxcmd(isp, &mbs); - if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { - isp_prt(isp, ISP_LOGERR, dcrc); - ISP_RESET0(isp); - return; - } break; } @@ -951,41 +905,45 @@ isp_reset(ispsoftc_t *isp) union { const uint16_t *cp; uint16_t *np; - } u; - u.cp = isp->isp_mdvec->dv_ispfw; - isp->isp_mbxworkp = &u.np[1]; - isp->isp_mbxwrk0 = u.np[3] - 1; + } ucd; + ucd.cp = isp->isp_mdvec->dv_ispfw; + isp->isp_mbxworkp = &ucd.np[1]; + isp->isp_mbxwrk0 = ucd.np[3] - 1; isp->isp_mbxwrk1 = code_org + 1; - MEMZERO(&mbs, sizeof (mbs)); + ISP_MEMZERO(&mbs, sizeof (mbs)); mbs.param[0] = MBOX_WRITE_RAM_WORD; mbs.param[1] = code_org; - mbs.param[2] = u.np[0]; + mbs.param[2] = ucd.np[0]; mbs.logval = MBLOGNONE; isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { - isp_prt(isp, ISP_LOGERR, - "F/W download failed at word %d", - isp->isp_mbxwrk1 - code_org); + isp_prt(isp, ISP_LOGERR, "F/W download failed at word %d", isp->isp_mbxwrk1 - code_org); ISP_RESET0(isp); return; } - /* - * Verify that it downloaded correctly. - */ - MEMZERO(&mbs, sizeof (mbs)); + } else { + isp->isp_loaded_fw = 0; + isp_prt(isp, ISP_LOGDEBUG2, "skipping f/w download"); + } + + /* + * If we loaded firmware, verify its checksum + */ + if (isp->isp_loaded_fw) { + ISP_MEMZERO(&mbs, sizeof (mbs)); mbs.param[0] = MBOX_VERIFY_CHECKSUM; - mbs.param[1] = code_org; - mbs.logval = MBLOGNONE; + if (IS_24XX(isp)) { + mbs.param[1] = code_org >> 16; + mbs.param[2] = code_org; + } else { + mbs.param[1] = code_org; + } isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { isp_prt(isp, ISP_LOGERR, dcrc); ISP_RESET0(isp); return; } - isp->isp_loaded_fw = 1; - } else { - isp->isp_loaded_fw = 0; - isp_prt(isp, ISP_LOGDEBUG2, "skipping f/w download"); } /* @@ -996,9 +954,7 @@ isp_reset(ispsoftc_t *isp) */ - MEMZERO(&mbs, sizeof (mbs)); - mbs.timeout = 1000000; - mbs.param[0] = MBOX_EXEC_FIRMWARE; + MBSINIT(&mbs, MBOX_EXEC_FIRMWARE, MBLOGALL, 1000000); if (IS_24XX(isp)) { mbs.param[1] = code_org >> 16; mbs.param[2] = code_org; @@ -1007,6 +963,9 @@ isp_reset(ispsoftc_t *isp) } else { mbs.param[3] = 1; } + if (IS_25XX(isp)) { + mbs.ibits |= 0x10; + } } else if (IS_2322(isp)) { mbs.param[1] = code_org; if (isp->isp_loaded_fw) { @@ -1017,8 +976,6 @@ isp_reset(ispsoftc_t *isp) } else { mbs.param[1] = code_org; } - - mbs.logval = MBLOGALL; isp_mboxcmd(isp, &mbs); if (IS_2322(isp) || IS_24XX(isp)) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From amdmi3 at amdmi3.ru Sat Aug 1 02:53:50 2009 From: amdmi3 at amdmi3.ru (Dmitry Marakasov) Date: Sat Aug 1 02:54:01 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: References: <200907300014.n6U0EZ77086341@svn.freebsd.org> Message-ID: <20090801022914.GB93222@hades.panopticon> * Navdeep Parhar (nparhar@gmail.com) wrote: > This has slowed down core dumps very significantly. What used to take 10-15s on > my system now takes around 3 minutes. Same here. -- Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D amdmi3@amdmi3.ru ..: jabber: amdmi3@jabber.ru http://www.amdmi3.ru From scottl at samsco.org Sat Aug 1 02:58:50 2009 From: scottl at samsco.org (Scott Long) Date: Sat Aug 1 02:59:02 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <20090801022914.GB93222@hades.panopticon> References: <200907300014.n6U0EZ77086341@svn.freebsd.org> <20090801022914.GB93222@hades.panopticon> Message-ID: <4A73AF67.3010508@samsco.org> Dmitry Marakasov wrote: > * Navdeep Parhar (nparhar@gmail.com) wrote: > >> This has slowed down core dumps very significantly. What used to take 10-15s on >> my system now takes around 3 minutes. > > Same here. > Likely because prior to polling being implemented, each i/o was done blindly and completed immediately instead of waiting for actual confirmation from the hardware. Crashdumps have been slow for a number of years, thanks to a fundamental change in how they are done. Until now, USB was cheating and making them look fast. Scott From nparhar at gmail.com Sat Aug 1 04:55:46 2009 From: nparhar at gmail.com (Navdeep Parhar) Date: Sat Aug 1 04:56:23 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <200908010615.02972.hselasky@c2i.net> References: <200907300014.n6U0EZ77086341@svn.freebsd.org> <20090731212140.GK47463@elvis.mu.org> <200908010615.02972.hselasky@c2i.net> Message-ID: <20090801045540.GA8399@doormat.home> On Sat, Aug 01, 2009 at 06:15:01AM +0200, Hans Petter Selasky wrote: > On Friday 31 July 2009 23:21:40 Alfred Perlstein wrote: > > Hans, can you please look into this issue? > > > > * Navdeep Parhar [090731 00:45] wrote: > > > This has slowed down core dumps very significantly. What used to take > > > 10-15s on my system now takes around 3 minutes. A simple test is to > > > break into ddb and "call doadump" with or without this rev. I have a > > > serial console on this machine > > > and so I can use ddb whether the attached USB keyboard works or not. > > It's because there is a DELAY(1000) in the UKBD's polling routine so that key- > repeating will work, no magic. ok. So can something be done about it or are you suggesting that we learn to live with this? Regards, Navdeep From nparhar at gmail.com Sat Aug 1 05:00:58 2009 From: nparhar at gmail.com (Navdeep Parhar) Date: Sat Aug 1 05:01:04 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <4A73AF67.3010508@samsco.org> References: <200907300014.n6U0EZ77086341@svn.freebsd.org> <20090801022914.GB93222@hades.panopticon> <4A73AF67.3010508@samsco.org> Message-ID: <20090801050053.GB8399@doormat.home> On Fri, Jul 31, 2009 at 08:58:47PM -0600, Scott Long wrote: > Dmitry Marakasov wrote: > >* Navdeep Parhar (nparhar@gmail.com) wrote: > > > >>This has slowed down core dumps very significantly. What used to take 10-15s on > >>my system now takes around 3 minutes. > > > >Same here. > > > > Likely because prior to polling being implemented, each i/o was done > blindly and completed immediately instead of waiting for actual > confirmation from the hardware. Crashdumps have been slow for a > number of years, thanks to a fundamental change in how they are done. > Until now, USB was cheating and making them look fast. I'm afraid I did not understand your email. I was talking about crashdump time differences between yesterday and the day before, not "over a number of years." Are there any other issues involved here? Regards, Navdeep From scottl at samsco.org Sat Aug 1 05:12:01 2009 From: scottl at samsco.org (Scott Long) Date: Sat Aug 1 05:12:14 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <20090801050053.GB8399@doormat.home> References: <200907300014.n6U0EZ77086341@svn.freebsd.org> <20090801022914.GB93222@hades.panopticon> <4A73AF67.3010508@samsco.org> <20090801050053.GB8399@doormat.home> Message-ID: <4A73CE7E.9060609@samsco.org> Navdeep Parhar wrote: > On Fri, Jul 31, 2009 at 08:58:47PM -0600, Scott Long wrote: >> Dmitry Marakasov wrote: >>> * Navdeep Parhar (nparhar@gmail.com) wrote: >>> >>>> This has slowed down core dumps very significantly. What used to take 10-15s on >>>> my system now takes around 3 minutes. >>> Same here. >>> >> Likely because prior to polling being implemented, each i/o was done >> blindly and completed immediately instead of waiting for actual >> confirmation from the hardware. Crashdumps have been slow for a >> number of years, thanks to a fundamental change in how they are done. >> Until now, USB was cheating and making them look fast. > > I'm afraid I did not understand your email. I was talking about > crashdump time differences between yesterday and the day before, not > "over a number of years." Are there any other issues involved here? > Crashdumps work by the crashdump routine sending an i/o one-at-a-time to the disk driver, waiting for a completion response between each i/o. Polling in the disk driver is used to detect when the disk hardware has completed each i/o request. Since it is done completely serially and completely synchronously, it's very slow because it has to wait for the hardware to process each i/o, one at a time. Prior to yesterday, the usb2 stack did not implement polling. The umass disk driver completely ignored polling, and always immediately returned success. So instead of waiting for the hardware to complete each crashdump i/o request, it immediately returned success and allowed the crashdump routine to send a new i/o. It was short cutting the required process. Now that polling is in place, the shortcut is gone, and crashdumps on USB are back to being slow, just like on every other disk driver. The shortcut is fast, but it's also unsafe; it's bypassing the guarantee that every i/o is getting written without error and without overrunning the speed of the disk media. I mention "over a number of years" because the crashdump routine wasn't always designed to be so slow. But, that's how it is now, and there isn't much that can be done in the USB driver to fix it, short of going back to the unsafe shortcut. Scott From hselasky at c2i.net Sat Aug 1 05:16:04 2009 From: hselasky at c2i.net (Hans Petter Selasky) Date: Sat Aug 1 05:16:16 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <20090731212140.GK47463@elvis.mu.org> References: <200907300014.n6U0EZ77086341@svn.freebsd.org> <20090731212140.GK47463@elvis.mu.org> Message-ID: <200908010615.02972.hselasky@c2i.net> On Friday 31 July 2009 23:21:40 Alfred Perlstein wrote: > Hans, can you please look into this issue? > > * Navdeep Parhar [090731 00:45] wrote: > > On Wed, Jul 29, 2009 at 5:14 PM, Alfred Perlstein wrote: > > > Author: alfred > > > Date: Thu Jul 30 00:14:34 2009 > > > New Revision: 195960 > > > URL: http://svn.freebsd.org/changeset/base/195960 > > > > > > Log: > > > ?USB CORE: > > > ?- Add minimum polling support to drive UMASS > > > ? ?and UKBD in case of panic. > > > ?- Add extra check to ukbd probe to fix problem about > > > ? ?mouse devices attaching like keyboards. > > > ?- P4 ID: 166148 > > > > > > ?Submitted by: hps > > > ?Approved by: ?re > > > > This has slowed down core dumps very significantly. What used to take > > 10-15s on my system now takes around 3 minutes. A simple test is to > > break into ddb and "call doadump" with or without this rev. I have a > > serial console on this machine > > and so I can use ddb whether the attached USB keyboard works or not. > > > > Here is the usbconfig from the machine: > > ugen0.1: at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) > > pwr=ON ugen1.1: at usbus1, cfg=0 md=HOST spd=FULL > > (12Mbps) pwr=ON ugen2.1: at usbus2, cfg=0 md=HOST > > spd=FULL (12Mbps) pwr=ON ugen3.1: at usbus3, cfg=0 > > md=HOST spd=FULL (12Mbps) pwr=ON ugen4.1: at > > usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON > > ugen1.2: at usbus1, cfg=0 md=HOST > > spd=FULL (12Mbps) pwr=SAVE > > ugen1.3: at usbus1, cfg=0 md=HOST > > spd=LOW (1.5Mbps) pwr=ON > > ugen1.4: at usbus1, cfg=0 md=HOST > > spd=LOW (1.5Mbps) pwr=ON It's because there is a DELAY(1000) in the UKBD's polling routine so that key- repeating will work, no magic. --HPS From nparhar at gmail.com Sat Aug 1 05:36:50 2009 From: nparhar at gmail.com (Navdeep Parhar) Date: Sat Aug 1 05:37:02 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <4A73CE7E.9060609@samsco.org> References: <200907300014.n6U0EZ77086341@svn.freebsd.org> <20090801022914.GB93222@hades.panopticon> <4A73AF67.3010508@samsco.org> <20090801050053.GB8399@doormat.home> <4A73CE7E.9060609@samsco.org> Message-ID: <20090801053644.GA9150@doormat.home> On Fri, Jul 31, 2009 at 11:11:26PM -0600, Scott Long wrote: > Navdeep Parhar wrote: > >On Fri, Jul 31, 2009 at 08:58:47PM -0600, Scott Long wrote: > >>Dmitry Marakasov wrote: > >>>* Navdeep Parhar (nparhar@gmail.com) wrote: > >>> > >>>>This has slowed down core dumps very significantly. What used to take 10-15s on > >>>>my system now takes around 3 minutes. > >>>Same here. > >>> > >>Likely because prior to polling being implemented, each i/o was done > >>blindly and completed immediately instead of waiting for actual > >>confirmation from the hardware. Crashdumps have been slow for a > >>number of years, thanks to a fundamental change in how they are done. > >>Until now, USB was cheating and making them look fast. > > > >I'm afraid I did not understand your email. I was talking about > >crashdump time differences between yesterday and the day before, not > >"over a number of years." Are there any other issues involved here? > > > > Crashdumps work by the crashdump routine sending an i/o one-at-a-time to > the disk driver, waiting for a completion response between each i/o. > Polling in the disk driver is used to detect when the disk hardware has > completed each i/o request. Since it is done completely serially and > completely synchronously, it's very slow because it has to wait for the > hardware to process each i/o, one at a time. > > Prior to yesterday, the usb2 stack did not implement polling. The umass > disk driver completely ignored polling, and always immediately returned > success. So instead of waiting for the hardware to complete each > crashdump i/o request, it immediately returned success and allowed the > crashdump routine to send a new i/o. It was short cutting the required > process. Now that polling is in place, the shortcut is gone, and > crashdumps on USB are back to being slow, just like on every other disk > driver. The shortcut is fast, but it's also unsafe; it's bypassing the > guarantee that every i/o is getting written without error and without > overrunning the speed of the disk media. > > I mention "over a number of years" because the crashdump routine wasn't > always designed to be so slow. But, that's how it is now, and there > isn't much that can be done in the USB driver to fix it, short of going > back to the unsafe shortcut. This is informative, but I think we're talking about totally different things. There is no USB storage involved - the machine has a SATA disk and that's where the core is being written to. The USB _keyboard_ polling seems to be slowing things down. Regards, Navdeep From alfred at freebsd.org Sat Aug 1 09:53:19 2009 From: alfred at freebsd.org (Alfred Perlstein) Date: Sat Aug 1 09:53:26 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <20090801045540.GA8399@doormat.home> References: <200907300014.n6U0EZ77086341@svn.freebsd.org> <20090731212140.GK47463@elvis.mu.org> <200908010615.02972.hselasky@c2i.net> <20090801045540.GA8399@doormat.home> Message-ID: <20090801095318.GP47463@elvis.mu.org> * Navdeep Parhar [090731 21:55] wrote: > On Sat, Aug 01, 2009 at 06:15:01AM +0200, Hans Petter Selasky wrote: > > On Friday 31 July 2009 23:21:40 Alfred Perlstein wrote: > > > Hans, can you please look into this issue? > > > > > > * Navdeep Parhar [090731 00:45] wrote: > > > > This has slowed down core dumps very significantly. What used to take > > > > 10-15s on my system now takes around 3 minutes. A simple test is to > > > > break into ddb and "call doadump" with or without this rev. I have a > > > > serial console on this machine > > > > and so I can use ddb whether the attached USB keyboard works or not. > > > > It's because there is a DELAY(1000) in the UKBD's polling routine so that key- > > repeating will work, no magic. > > ok. So can something be done about it or are you suggesting that we learn to > live with this? Hans, I don't think this is OK. Can you look into a fix? -- - Alfred Perlstein .- AMA, VMOA #5191, 03 vmax, 92 gs500, 85 ch250 .- FreeBSD committer From simon at FreeBSD.org Sat Aug 1 10:13:46 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Sat Aug 1 10:13:51 2009 Subject: svn commit: r196008 - in head/sys: cam dev/isp In-Reply-To: <200908010104.n7114Qxa085932@svn.freebsd.org> References: <200908010104.n7114Qxa085932@svn.freebsd.org> Message-ID: <20090801101343.GA1260@arthur.nitro.dk> On 2009.08.01 01:04:26 +0000, Matt Jacob wrote: > Author: mjacob > Date: Sat Aug 1 01:04:26 2009 > New Revision: 196008 > URL: http://svn.freebsd.org/changeset/base/196008 > > Log: > Add 8Gb support (isp_2500). Fix a fair number of configuration and > firmware loading bugs. Nice! Any chance you could update the isp(4) manual page with which adaptors are supported now, or if you prefer not to play with mdoc, just tell me which adaptors I sould add and I would be happy to update the manual page. -- Simon L. Nielsen From rwatson at FreeBSD.org Sat Aug 1 19:26:29 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sat Aug 1 19:26:37 2009 Subject: svn commit: r196019 - in head: . lib/libkvm sys/arm/arm sys/compat/linprocfs sys/compat/linux sys/compat/svr4 sys/conf sys/contrib/altq/altq sys/contrib/ipfilter/netinet sys/contrib/pf/net sys/cont... Message-ID: <200908011926.n71JQSML090262@svn.freebsd.org> Author: rwatson Date: Sat Aug 1 19:26:27 2009 New Revision: 196019 URL: http://svn.freebsd.org/changeset/base/196019 Log: Merge the remainder of kern_vimage.c and vimage.h into vnet.c and vnet.h, we now use jails (rather than vimages) as the abstraction for virtualization management, and what remained was specific to virtual network stacks. Minor cleanups are done in the process, and comments updated to reflect these changes. Reviewed by: bz Approved by: re (vimage blanket) Deleted: head/sys/kern/kern_vimage.c head/sys/sys/vimage.h Modified: head/ObsoleteFiles.inc head/lib/libkvm/kvm_vnet.c head/sys/arm/arm/minidump_machdep.c head/sys/compat/linprocfs/linprocfs.c head/sys/compat/linux/linux_ioctl.c head/sys/compat/linux/linux_socket.c head/sys/compat/svr4/svr4_sockio.c head/sys/conf/files head/sys/contrib/altq/altq/altq_subr.c head/sys/contrib/ipfilter/netinet/fil.c head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c head/sys/contrib/pf/net/pf.c head/sys/contrib/pf/net/pf_if.c head/sys/contrib/pf/net/pf_ioctl.c head/sys/contrib/pf/net/pf_subr.c head/sys/contrib/rdma/rdma_cma.c head/sys/ddb/db_sym.c head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c head/sys/fs/nfs/nfsport.h head/sys/kern/kern_jail.c head/sys/kern/kern_linker.c head/sys/kern/kern_poll.c head/sys/kern/kern_sysctl.c head/sys/kern/kern_uuid.c head/sys/kern/sys_socket.c head/sys/kern/uipc_domain.c head/sys/kern/uipc_socket.c head/sys/kern/uipc_syscalls.c head/sys/kern/uipc_usrreq.c head/sys/net/bpf.c head/sys/net/bridgestp.c head/sys/net/flowtable.c head/sys/net/if.c head/sys/net/if_bridge.c head/sys/net/if_clone.c head/sys/net/if_ef.c head/sys/net/if_enc.c head/sys/net/if_epair.c head/sys/net/if_ethersubr.c head/sys/net/if_faith.c head/sys/net/if_gif.c head/sys/net/if_gre.c head/sys/net/if_llatbl.c head/sys/net/if_loop.c head/sys/net/if_mib.c head/sys/net/if_spppsubr.c head/sys/net/if_stf.c head/sys/net/if_tun.c head/sys/net/if_vlan.c head/sys/net/netisr.c head/sys/net/raw_cb.c head/sys/net/raw_usrreq.c head/sys/net/route.c head/sys/net/rtsock.c head/sys/net/vnet.c head/sys/net/vnet.h head/sys/net80211/ieee80211_ddb.c head/sys/net80211/ieee80211_freebsd.c head/sys/netgraph/atm/ng_atm.c head/sys/netgraph/ng_base.c head/sys/netgraph/ng_bridge.c head/sys/netgraph/ng_eiface.c head/sys/netgraph/ng_ether.c head/sys/netgraph/ng_gif.c head/sys/netgraph/ng_iface.c head/sys/netgraph/ng_pipe.c head/sys/netgraph/ng_source.c head/sys/netinet/if_ether.c head/sys/netinet/igmp.c head/sys/netinet/in.c head/sys/netinet/in_gif.c head/sys/netinet/in_mcast.c head/sys/netinet/in_pcb.c head/sys/netinet/in_proto.c head/sys/netinet/in_rmx.c head/sys/netinet/ip_carp.c head/sys/netinet/ip_divert.c head/sys/netinet/ip_fastfwd.c head/sys/netinet/ip_icmp.c head/sys/netinet/ip_input.c head/sys/netinet/ip_ipsec.c head/sys/netinet/ip_mroute.c head/sys/netinet/ip_options.c head/sys/netinet/ip_output.c head/sys/netinet/ipfw/ip_fw2.c head/sys/netinet/ipfw/ip_fw_nat.c head/sys/netinet/ipfw/ip_fw_pfil.c head/sys/netinet/raw_ip.c head/sys/netinet/sctp_os_bsd.h head/sys/netinet/tcp_hostcache.c head/sys/netinet/tcp_input.c head/sys/netinet/tcp_offload.c head/sys/netinet/tcp_output.c head/sys/netinet/tcp_reass.c head/sys/netinet/tcp_sack.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_timer.c head/sys/netinet/tcp_timewait.c head/sys/netinet/tcp_usrreq.c head/sys/netinet/udp_usrreq.c head/sys/netinet6/dest6.c head/sys/netinet6/frag6.c head/sys/netinet6/icmp6.c head/sys/netinet6/in6.c head/sys/netinet6/in6_gif.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/in6_mcast.c head/sys/netinet6/in6_pcb.c head/sys/netinet6/in6_proto.c head/sys/netinet6/in6_rmx.c head/sys/netinet6/in6_src.c head/sys/netinet6/ip6_forward.c head/sys/netinet6/ip6_input.c head/sys/netinet6/ip6_ipsec.c head/sys/netinet6/ip6_mroute.c head/sys/netinet6/ip6_output.c head/sys/netinet6/mld6.c head/sys/netinet6/nd6.c head/sys/netinet6/nd6_nbr.c head/sys/netinet6/nd6_rtr.c head/sys/netinet6/raw_ip6.c head/sys/netinet6/route6.c head/sys/netinet6/scope6.c head/sys/netinet6/udp6_usrreq.c head/sys/netipsec/ipsec.c head/sys/netipsec/ipsec_input.c head/sys/netipsec/ipsec_mbuf.c head/sys/netipsec/ipsec_output.c head/sys/netipsec/key.c head/sys/netipsec/keysock.c head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c head/sys/netipsec/xform_ipcomp.c head/sys/netipsec/xform_ipip.c head/sys/netipsec/xform_tcp.c head/sys/nfsclient/bootp_subr.c head/sys/nfsclient/nfs_diskless.c head/sys/nfsclient/nfs_vnops.c Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sat Aug 1 15:40:22 2009 (r196018) +++ head/ObsoleteFiles.inc Sat Aug 1 19:26:27 2009 (r196019) @@ -14,6 +14,8 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20090801: vimage.h removed in favour of vnet.h +OLD_FILES+=usr/include/sys/vimage.h # 20090719: library version bump for 8.0 OLD_LIBS+=lib/libalias.so.6 OLD_LIBS+=lib/libavl.so.1 Modified: head/lib/libkvm/kvm_vnet.c ============================================================================== --- head/lib/libkvm/kvm_vnet.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/lib/libkvm/kvm_vnet.c Sat Aug 1 19:26:27 2009 (r196019) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include Modified: head/sys/arm/arm/minidump_machdep.c ============================================================================== --- head/sys/arm/arm/minidump_machdep.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/arm/arm/minidump_machdep.c Sat Aug 1 19:26:27 2009 (r196019) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/compat/linprocfs/linprocfs.c Sat Aug 1 19:26:27 2009 (r196019) @@ -73,7 +73,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/compat/linux/linux_ioctl.c Sat Aug 1 19:26:27 2009 (r196019) @@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/compat/linux/linux_socket.c Sat Aug 1 19:26:27 2009 (r196019) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/compat/svr4/svr4_sockio.c ============================================================================== --- head/sys/compat/svr4/svr4_sockio.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/compat/svr4/svr4_sockio.c Sat Aug 1 19:26:27 2009 (r196019) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/conf/files Sat Aug 1 19:26:27 2009 (r196019) @@ -1992,7 +1992,6 @@ kern/kern_time.c standard kern/kern_timeout.c standard kern/kern_umtx.c standard kern/kern_uuid.c standard -kern/kern_vimage.c optional vimage kern/kern_xxx.c standard kern/link_elf.c standard kern/linker_if.m standard Modified: head/sys/contrib/altq/altq/altq_subr.c ============================================================================== --- head/sys/contrib/altq/altq/altq_subr.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/contrib/altq/altq/altq_subr.c Sat Aug 1 19:26:27 2009 (r196019) @@ -47,9 +47,6 @@ #include #include #include -#ifdef __FreeBSD__ -#include -#endif #include #include Modified: head/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/fil.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/contrib/ipfilter/netinet/fil.c Sat Aug 1 19:26:27 2009 (r196019) @@ -33,9 +33,6 @@ # if (__FreeBSD_version == 400019) # define CSUM_DELAY_DATA # endif -# if (__FreeBSD_version >= 800044) -# include -# endif # endif # include #else Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sat Aug 1 19:26:27 2009 (r196019) @@ -63,7 +63,6 @@ static const char rcsid[] = "@(#)$Id: ip # include #endif #if __FreeBSD_version >= 800044 -# include # include #else #define V_path_mtu_discovery path_mtu_discovery Modified: head/sys/contrib/pf/net/pf.c ============================================================================== --- head/sys/contrib/pf/net/pf.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/contrib/pf/net/pf.c Sat Aug 1 19:26:27 2009 (r196019) @@ -91,7 +91,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #else #include #endif Modified: head/sys/contrib/pf/net/pf_if.c ============================================================================== --- head/sys/contrib/pf/net/pf_if.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/contrib/pf/net/pf_if.c Sat Aug 1 19:26:27 2009 (r196019) @@ -54,9 +54,6 @@ __FBSDID("$FreeBSD$"); #include #endif #include -#ifdef __FreeBSD__ -#include -#endif #include #include Modified: head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- head/sys/contrib/pf/net/pf_ioctl.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/contrib/pf/net/pf_ioctl.c Sat Aug 1 19:26:27 2009 (r196019) @@ -83,7 +83,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #else #include #include Modified: head/sys/contrib/pf/net/pf_subr.c ============================================================================== --- head/sys/contrib/pf/net/pf_subr.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/contrib/pf/net/pf_subr.c Sat Aug 1 19:26:27 2009 (r196019) @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/contrib/rdma/rdma_cma.c ============================================================================== --- head/sys/contrib/rdma/rdma_cma.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/contrib/rdma/rdma_cma.c Sat Aug 1 19:26:27 2009 (r196019) @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/ddb/db_sym.c ============================================================================== --- head/sys/ddb/db_sym.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/ddb/db_sym.c Sat Aug 1 19:26:27 2009 (r196019) @@ -32,9 +32,9 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include -#include #include Modified: head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c ============================================================================== --- head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c Sat Aug 1 19:26:27 2009 (r196019) @@ -54,9 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include -#if __FreeBSD_version >= 800044 -#include -#else +#if __FreeBSD_version < 800044 #define V_ifnet ifnet #endif Modified: head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c ============================================================================== --- head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c Sat Aug 1 19:26:27 2009 (r196019) @@ -48,9 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include -#if __FreeBSD_version >= 800044 -#include -#else +#if __FreeBSD_version < 800044 #define V_tcp_do_autosndbuf tcp_do_autosndbuf #define V_tcp_autosndbuf_max tcp_autosndbuf_max #define V_tcp_do_rfc1323 tcp_do_rfc1323 Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/fs/nfs/nfsport.h Sat Aug 1 19:26:27 2009 (r196019) @@ -78,7 +78,6 @@ #include #include #include -#include #include #include #include Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/kern/kern_jail.c Sat Aug 1 19:26:27 2009 (r196019) @@ -58,9 +58,12 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include + #include +#include + #include + #ifdef DDB #include #ifdef INET6 Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/kern/kern_linker.c Sat Aug 1 19:26:27 2009 (r196019) @@ -51,7 +51,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include + +#include #include Modified: head/sys/kern/kern_poll.c ============================================================================== --- head/sys/kern/kern_poll.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/kern/kern_poll.c Sat Aug 1 19:26:27 2009 (r196019) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include /* for IFF_* flags */ #include /* for NETISR_POLL */ Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/kern/kern_sysctl.c Sat Aug 1 19:26:27 2009 (r196019) @@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #ifdef KTRACE #include #endif Modified: head/sys/kern/kern_uuid.c ============================================================================== --- head/sys/kern/kern_uuid.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/kern/kern_uuid.c Sat Aug 1 19:26:27 2009 (r196019) @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/kern/sys_socket.c ============================================================================== --- head/sys/kern/sys_socket.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/kern/sys_socket.c Sat Aug 1 19:26:27 2009 (r196019) @@ -48,10 +48,10 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include +#include #include Modified: head/sys/kern/uipc_domain.c ============================================================================== --- head/sys/kern/uipc_domain.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/kern/uipc_domain.c Sat Aug 1 19:26:27 2009 (r196019) @@ -43,7 +43,9 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include + +#include + #include /* Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/kern/uipc_socket.c Sat Aug 1 19:26:27 2009 (r196019) @@ -129,7 +129,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include + +#include #include Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/kern/uipc_syscalls.c Sat Aug 1 19:26:27 2009 (r196019) @@ -64,12 +64,13 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #ifdef KTRACE #include #endif +#include + #include #include Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/kern/uipc_usrreq.c Sat Aug 1 19:26:27 2009 (r196019) @@ -88,7 +88,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include + +#include #ifdef DDB #include Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/bpf.c Sat Aug 1 19:26:27 2009 (r196019) @@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -73,6 +72,7 @@ __FBSDID("$FreeBSD$"); #endif #include #include +#include #include #include Modified: head/sys/net/bridgestp.c ============================================================================== --- head/sys/net/bridgestp.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/bridgestp.c Sat Aug 1 19:26:27 2009 (r196019) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/net/flowtable.c ============================================================================== --- head/sys/net/flowtable.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/flowtable.c Sat Aug 1 19:26:27 2009 (r196019) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if.c Sat Aug 1 19:26:27 2009 (r196019) @@ -59,7 +59,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_bridge.c Sat Aug 1 19:26:27 2009 (r196019) @@ -101,7 +101,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/net/if_clone.c ============================================================================== --- head/sys/net/if_clone.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_clone.c Sat Aug 1 19:26:27 2009 (r196019) @@ -39,7 +39,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/if_ef.c ============================================================================== --- head/sys/net/if_ef.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_ef.c Sat Aug 1 19:26:27 2009 (r196019) @@ -39,7 +39,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/if_enc.c ============================================================================== --- head/sys/net/if_enc.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_enc.c Sat Aug 1 19:26:27 2009 (r196019) @@ -38,7 +38,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/if_epair.c ============================================================================== --- head/sys/net/if_epair.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_epair.c Sat Aug 1 19:26:27 2009 (r196019) @@ -38,7 +38,7 @@ /* * Things to re-think once we have more experience: * - ifp->if_reassign function once we can test with vimage. Depending on - * how if_vomve() is going to be improved. + * how if_vmove() is going to be improved. * - Real random etheraddrs that are checked to be uniquish; we would need * to re-do them in case we move the interface between network stacks * in a private if_reassign function. @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -70,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define EPAIRNAME "epair" Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_ethersubr.c Sat Aug 1 19:26:27 2009 (r196019) @@ -50,7 +50,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/if_faith.c ============================================================================== --- head/sys/net/if_faith.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_faith.c Sat Aug 1 19:26:27 2009 (r196019) @@ -54,7 +54,6 @@ #include #include #include -#include #include #include @@ -62,6 +61,7 @@ #include #include #include +#include #ifdef INET #include Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_gif.c Sat Aug 1 19:26:27 2009 (r196019) @@ -49,7 +49,6 @@ #include #include #include -#include #include #include @@ -58,6 +57,7 @@ #include #include #include +#include #include #include Modified: head/sys/net/if_gre.c ============================================================================== --- head/sys/net/if_gre.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_gre.c Sat Aug 1 19:26:27 2009 (r196019) @@ -64,13 +64,13 @@ #include #include #include -#include #include #include #include #include #include +#include #ifdef INET #include Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_llatbl.c Sat Aug 1 19:26:27 2009 (r196019) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include @@ -51,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: head/sys/net/if_loop.c ============================================================================== --- head/sys/net/if_loop.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_loop.c Sat Aug 1 19:26:27 2009 (r196019) @@ -49,7 +49,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/if_mib.c ============================================================================== --- head/sys/net/if_mib.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_mib.c Sat Aug 1 19:26:27 2009 (r196019) @@ -34,7 +34,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/if_spppsubr.c ============================================================================== --- head/sys/net/if_spppsubr.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_spppsubr.c Sat Aug 1 19:26:27 2009 (r196019) @@ -36,7 +36,6 @@ #include #include #include -#include #include @@ -44,6 +43,7 @@ #include #include #include +#include #include #include #include Modified: head/sys/net/if_stf.c ============================================================================== --- head/sys/net/if_stf.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_stf.c Sat Aug 1 19:26:27 2009 (r196019) @@ -92,7 +92,6 @@ #include #include -#include #include #include @@ -100,6 +99,7 @@ #include #include #include +#include #include #include Modified: head/sys/net/if_tun.c ============================================================================== --- head/sys/net/if_tun.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_tun.c Sat Aug 1 19:26:27 2009 (r196019) @@ -43,13 +43,13 @@ #include #include #include -#include #include #include #include #include #include +#include #ifdef INET #include #endif Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/if_vlan.c Sat Aug 1 19:26:27 2009 (r196019) @@ -55,7 +55,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/netisr.c ============================================================================== --- head/sys/net/netisr.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/netisr.c Sat Aug 1 19:26:27 2009 (r196019) @@ -78,7 +78,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #ifdef DDB #include @@ -87,6 +86,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /*- * Synchronize use and modification of the registered netisr data structures; Modified: head/sys/net/raw_cb.c ============================================================================== --- head/sys/net/raw_cb.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/raw_cb.c Sat Aug 1 19:26:27 2009 (r196019) @@ -42,7 +42,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/raw_usrreq.c ============================================================================== --- head/sys/net/raw_usrreq.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/raw_usrreq.c Sat Aug 1 19:26:27 2009 (r196019) @@ -44,7 +44,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/route.c Sat Aug 1 19:26:27 2009 (r196019) @@ -51,11 +51,11 @@ #include #include #include -#include #include #include #include +#include #ifdef RADIX_MPATH #include Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/rtsock.c Sat Aug 1 19:26:27 2009 (r196019) @@ -50,7 +50,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/vnet.c ============================================================================== --- head/sys/net/vnet.c Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/vnet.c Sat Aug 1 19:26:27 2009 (r196019) @@ -1,4 +1,12 @@ /*- + * Copyright (c) 2004-2009 University of Zagreb + * Copyright (c) 2006-2009 FreeBSD Foundation + * All rights reserved. + * + * This software was developed by the University of Zagreb and the + * FreeBSD Foundation under sponsorship by the Stichting NLnet and the + * FreeBSD Foundation. + * * Copyright (c) 2009 Jeffrey Roberson * Copyright (c) 2009 Robert N. M. Watson * All rights reserved. @@ -28,30 +36,67 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_ddb.h" + #include #include +#include #include #include #include #include #include #include +#include #include #include -#include +#ifdef DDB +#include +#endif + +#include +#include #include /*- * This file implements core functions for virtual network stacks: * + * - Core virtual network stack management functions. + * * - Virtual network stack memory allocator, which virtualized global * variables in the network stack * * - Virtualized SYSINIT's/SYSUNINIT's, which allow network stack subsystems * to register startup/shutdown events to be run for each virtual network * stack instance. - * + */ + +MALLOC_DEFINE(M_VNET, "vnet", "network stack control block"); + +/* + * The virtual network stack list has two read-write locks, one sleepable and + * the other not, so that the list can be stablized and walked in a variety + * of network stack contexts. Both must be acquired exclusively to modify + * the list. + */ +struct rwlock vnet_rwlock; +struct sx vnet_sxlock; + +#define VNET_LIST_WLOCK() do { \ + sx_xlock(&vnet_sxlock); \ + rw_wlock(&vnet_rwlock); \ +} while (0) + +#define VNET_LIST_WUNLOCK() do { \ + rw_wunlock(&vnet_rwlock); \ + sx_xunlock(&vnet_sxlock); \ +} while (0) + +struct vnet_list_head vnet_head; +struct vnet *vnet0; + +/* * The virtual network stack allocator provides storage for virtualized * global variables. These variables are defined/declared using the * VNET_DEFINE()/VNET_DECLARE() macros, which place them in the 'set_vnet' @@ -157,6 +202,114 @@ static TAILQ_HEAD(, vnet_data_free) vnet static struct sx vnet_data_free_lock; /* + * Allocate a virtual network stack. + */ +struct vnet * +vnet_alloc(void) +{ + struct vnet *vnet; + + vnet = malloc(sizeof(struct vnet), M_VNET, M_WAITOK | M_ZERO); + vnet->vnet_magic_n = VNET_MAGIC_N; + vnet_data_init(vnet); + + /* Initialize / attach vnet module instances. */ + CURVNET_SET_QUIET(vnet); + + sx_xlock(&vnet_sxlock); + vnet_sysinit(); + CURVNET_RESTORE(); + + rw_wlock(&vnet_rwlock); + LIST_INSERT_HEAD(&vnet_head, vnet, vnet_le); + VNET_LIST_WUNLOCK(); + + return (vnet); +} + +/* + * Destroy a virtual network stack. + */ +void +vnet_destroy(struct vnet *vnet) +{ + struct ifnet *ifp, *nifp; + + KASSERT(vnet->vnet_sockcnt == 0, + ("%s: vnet still has sockets", __func__)); + + VNET_LIST_WLOCK(); + LIST_REMOVE(vnet, vnet_le); + rw_wunlock(&vnet_rwlock); + + CURVNET_SET_QUIET(vnet); + + /* Return all inherited interfaces to their parent vnets. */ + TAILQ_FOREACH_SAFE(ifp, &V_ifnet, if_link, nifp) { + if (ifp->if_home_vnet != ifp->if_vnet) + if_vmove(ifp, ifp->if_home_vnet); + } + + vnet_sysuninit(); + sx_xunlock(&vnet_sxlock); + + CURVNET_RESTORE(); + + /* Hopefully, we are OK to free the vnet container itself. */ + vnet_data_destroy(vnet); + vnet->vnet_magic_n = 0xdeadbeef; + free(vnet, M_VNET); +} + +static void +vnet_foreach(void (*vnet_foreach_fn)(struct vnet *, void *), void *arg) +{ + struct vnet *vnet; + + VNET_LIST_RLOCK(); + LIST_FOREACH(vnet, &vnet_head, vnet_le) + vnet_foreach_fn(vnet, arg); + VNET_LIST_RUNLOCK(); +} + +/* + * Boot time initialization and allocation of virtual network stacks. + */ +static void +vnet_init_prelink(void *arg) +{ + + rw_init(&vnet_rwlock, "vnet_rwlock"); + sx_init(&vnet_sxlock, "vnet_sxlock"); + LIST_INIT(&vnet_head); +} +SYSINIT(vnet_init_prelink, SI_SUB_VNET_PRELINK, SI_ORDER_FIRST, + vnet_init_prelink, NULL); + +static void +vnet0_init(void *arg) +{ + + /* + * We MUST clear curvnet in vi_init_done() before going SMP, + * otherwise CURVNET_SET() macros would scream about unnecessary + * curvnet recursions. + */ + curvnet = prison0.pr_vnet = vnet0 = vnet_alloc(); +} +SYSINIT(vnet0_init, SI_SUB_VNET, SI_ORDER_FIRST, vnet0_init, NULL); + +static void +vnet_init_done(void *unused) +{ + + curvnet = NULL; +} + +SYSINIT(vnet_init_done, SI_SUB_VNET_DONE, SI_ORDER_FIRST, vnet_init_done, + NULL); + +/* * Allocate storage for virtualized global variables in a new virtual network * stack instance, and copy in initial values from our 'master' copy. */ @@ -490,3 +643,20 @@ vnet_sysuninit(void) vs->func(vs->arg); } } + +#ifdef DDB +DB_SHOW_COMMAND(vnets, db_show_vnets) +{ + VNET_ITERATOR_DECL(vnet_iter); + +#if SIZE_MAX == UINT32_MAX /* 32-bit arch */ + db_printf(" vnet ifs socks\n"); +#else /* 64-bit arch, most probaly... */ + db_printf(" vnet ifs socks\n"); +#endif + VNET_FOREACH(vnet_iter) { + db_printf("%p %3d %5d\n", vnet_iter, vnet_iter->vnet_ifcnt, + vnet_iter->vnet_sockcnt); + } +} +#endif Modified: head/sys/net/vnet.h ============================================================================== --- head/sys/net/vnet.h Sat Aug 1 15:40:22 2009 (r196018) +++ head/sys/net/vnet.h Sat Aug 1 19:26:27 2009 (r196019) @@ -1,4 +1,12 @@ /*- + * Copyright (c) 2006-2009 University of Zagreb + * Copyright (c) 2006-2009 FreeBSD Foundation + * All rights reserved. + * + * This software was developed by the University of Zagreb and the + * FreeBSD Foundation under sponsorship by the Stichting NLnet and the + * FreeBSD Foundation. + * * Copyright (c) 2009 Jeffrey Roberson * Copyright (c) 2009 Robert N. M. Watson * All rights reserved. @@ -31,6 +39,9 @@ * This header file defines several sets of interfaces supporting virtualized * network stacks: * + * - Definition of 'struct vnet' and functions and macros to allocate/free/ + * manipulate it. + * * - A virtual network stack memory allocator, which provides support for * virtualized global variables via a special linker set, set_vnet. * @@ -47,17 +58,133 @@ #define _NET_VNET_H_ /* - * Virtual network stack memory allocator, which allows global variables to - * be automatically instantiated for each network stack instance. + * struct vnet describes a virtualized network stack, and is primarily a + * pointer to storage for virtualized global variables. Expose to userspace + * as required for libkvm. */ #if defined(_KERNEL) || defined(_WANT_VNET) +#include + +struct vnet { + LIST_ENTRY(vnet) vnet_le; /* all vnets list */ + u_int vnet_magic_n; + u_int vnet_ifcnt; + u_int vnet_sockcnt; + void *vnet_data_mem; + uintptr_t vnet_data_base; +}; +#define VNET_MAGIC_N 0x3e0d8f29 + +/* + * These two virtual network stack allocator definitions are also required + * for libkvm so that it can evaluate virtualized global variables. + */ #define VNET_SETNAME "set_vnet" #define VNET_SYMPREFIX "vnet_entry_" #endif #ifdef _KERNEL + #ifdef VIMAGE +#include +#include /* for struct thread */ +#include +#include + +/* + * Functions to allocate and destroy virtual network stacks. + */ +struct vnet *vnet_alloc(void); +void vnet_destroy(struct vnet *vnet); +/* + * The current virtual network stack -- we may wish to move this to struct + * pcpu in the future. + */ +#define curvnet curthread->td_vnet + +/* + * Various macros -- get and set the current network stack, but also + * assertions. + */ +#ifdef INVARIANTS +#define VNET_DEBUG +#endif +#ifdef VNET_DEBUG +#define VNET_ASSERT(condition) \ + if (!(condition)) { \ + printf("VNET_ASSERT @ %s:%d %s():\n", \ + __FILE__, __LINE__, __FUNCTION__); \ + panic(#condition); \ + } + +#define CURVNET_SET_QUIET(arg) \ + VNET_ASSERT((arg)->vnet_magic_n == VNET_MAGIC_N); \ + struct vnet *saved_vnet = curvnet; \ + const char *saved_vnet_lpush = curthread->td_vnet_lpush; \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From rwatson at FreeBSD.org Sat Aug 1 20:24:47 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sat Aug 1 20:24:58 2009 Subject: svn commit: r196020 - head/sys/net Message-ID: <200908012024.n71KOkJK091649@svn.freebsd.org> Author: rwatson Date: Sat Aug 1 20:24:45 2009 New Revision: 196020 URL: http://svn.freebsd.org/changeset/base/196020 Log: Remove vnet_foreach() utility function, which previously allowed vnet.c to iterate virtual network stacks without being aware of the implementation details previously hidden in kern_vimage.c. Now they are in the same file, so remove this added complexity. Reviewed by: bz Approved by: re (vimage blanket) Modified: head/sys/net/vnet.c Modified: head/sys/net/vnet.c ============================================================================== --- head/sys/net/vnet.c Sat Aug 1 19:26:27 2009 (r196019) +++ head/sys/net/vnet.c Sat Aug 1 20:24:45 2009 (r196020) @@ -261,17 +261,6 @@ vnet_destroy(struct vnet *vnet) free(vnet, M_VNET); } -static void -vnet_foreach(void (*vnet_foreach_fn)(struct vnet *, void *), void *arg) -{ - struct vnet *vnet; - - VNET_LIST_RLOCK(); - LIST_FOREACH(vnet, &vnet_head, vnet_le) - vnet_foreach_fn(vnet, arg); - VNET_LIST_RUNLOCK(); -} - /* * Boot time initialization and allocation of virtual network stacks. */ @@ -443,20 +432,6 @@ vnet_data_free(void *start_arg, int size sx_xunlock(&vnet_data_free_lock); } -struct vnet_data_copy_fn_arg { - void *start; - int size; -}; - -static void -vnet_data_copy_fn(struct vnet *vnet, void *arg) -{ - struct vnet_data_copy_fn_arg *varg = arg; - - memcpy((void *)((uintptr_t)vnet->vnet_data_base + - (uintptr_t)varg->start), varg->start, varg->size); -} - /* * When a new virtualized global variable has been allocated, propagate its * initial value to each already-allocated virtual network stack instance. @@ -464,11 +439,13 @@ vnet_data_copy_fn(struct vnet *vnet, voi void vnet_data_copy(void *start, int size) { - struct vnet_data_copy_fn_arg varg; + struct vnet *vnet; - varg.start = start; - varg.size = size; - vnet_foreach(vnet_data_copy_fn, &varg); + VNET_LIST_RLOCK(); + LIST_FOREACH(vnet, &vnet_head, vnet_le) + memcpy((void *)((uintptr_t)vnet->vnet_data_base + + (uintptr_t)start), start, size); + VNET_LIST_RUNLOCK(); } /* From rwatson at FreeBSD.org Sat Aug 1 21:54:16 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sat Aug 1 21:54:28 2009 Subject: svn commit: r196024 - head/sys/net Message-ID: <200908012154.n71LsFBT093646@svn.freebsd.org> Author: rwatson Date: Sat Aug 1 21:54:15 2009 New Revision: 196024 URL: http://svn.freebsd.org/changeset/base/196024 Log: Make the vnet alloc/destroy paths a bit easier to followg by merging vnet_data_init/vnet_data_destroy into vnet_alloc/vnet_destroy. Reviewed by: bz, zec Approved by: re (vimage blanket) Modified: head/sys/net/vnet.c head/sys/net/vnet.h Modified: head/sys/net/vnet.c ============================================================================== --- head/sys/net/vnet.c Sat Aug 1 21:46:55 2009 (r196023) +++ head/sys/net/vnet.c Sat Aug 1 21:54:15 2009 (r196024) @@ -211,7 +211,20 @@ vnet_alloc(void) vnet = malloc(sizeof(struct vnet), M_VNET, M_WAITOK | M_ZERO); vnet->vnet_magic_n = VNET_MAGIC_N; - vnet_data_init(vnet); + + /* + * Allocate storage for virtualized global variables and copy in + * initial values form our 'master' copy. + */ + vnet->vnet_data_mem = malloc(VNET_SIZE, M_VNET_DATA, M_WAITOK); + memcpy(vnet->vnet_data_mem, (void *)VNET_START, VNET_BYTES); + + /* + * All use of vnet-specific data will immediately subtract VNET_START + * from the base memory pointer, so pre-calculate that now to avoid + * it on each use. + */ + vnet->vnet_data_base = (uintptr_t)vnet->vnet_data_mem - VNET_START; /* Initialize / attach vnet module instances. */ CURVNET_SET_QUIET(vnet); @@ -255,8 +268,12 @@ vnet_destroy(struct vnet *vnet) CURVNET_RESTORE(); - /* Hopefully, we are OK to free the vnet container itself. */ - vnet_data_destroy(vnet); + /* + * Release storage for the virtual network stack instance. + */ + free(vnet->vnet_data_mem, M_VNET_DATA); + vnet->vnet_data_mem = NULL; + vnet->vnet_data_base = 0; vnet->vnet_magic_n = 0xdeadbeef; free(vnet, M_VNET); } @@ -299,37 +316,6 @@ SYSINIT(vnet_init_done, SI_SUB_VNET_DONE NULL); /* - * Allocate storage for virtualized global variables in a new virtual network - * stack instance, and copy in initial values from our 'master' copy. - */ -void -vnet_data_init(struct vnet *vnet) -{ - - vnet->vnet_data_mem = malloc(VNET_SIZE, M_VNET_DATA, M_WAITOK); - memcpy(vnet->vnet_data_mem, (void *)VNET_START, VNET_BYTES); - - /* - * All use of vnet-specific data will immediately subtract VNET_START - * from the base memory pointer, so pre-calculate that now to avoid - * it on each use. - */ - vnet->vnet_data_base = (uintptr_t)vnet->vnet_data_mem - VNET_START; -} - -/* - * Release storage for a virtual network stack instance. - */ -void -vnet_data_destroy(struct vnet *vnet) -{ - - free(vnet->vnet_data_mem, M_VNET_DATA); - vnet->vnet_data_mem = NULL; - vnet->vnet_data_base = 0; -} - -/* * Once on boot, initialize the modspace freelist to entirely cover modspace. */ static void Modified: head/sys/net/vnet.h ============================================================================== --- head/sys/net/vnet.h Sat Aug 1 21:46:55 2009 (r196023) +++ head/sys/net/vnet.h Sat Aug 1 21:54:15 2009 (r196024) @@ -217,13 +217,6 @@ void vnet_data_copy(void *start, int si void vnet_data_free(void *start_arg, int size); /* - * Virtual network stack allocator interfaces for vnet setup/teardown. - */ -struct vnet; -void vnet_data_init(struct vnet *vnet); -void vnet_data_destroy(struct vnet *vnet); - -/* * Sysctl variants for vnet-virtualized global variables. Include * to expose these definitions. * From rwatson at FreeBSD.org Sat Aug 1 21:58:32 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sat Aug 1 21:58:39 2009 Subject: svn commit: r196025 - head/sys/net Message-ID: <200908012158.n71LwW2C093777@svn.freebsd.org> Author: rwatson Date: Sat Aug 1 21:58:32 2009 New Revision: 196025 URL: http://svn.freebsd.org/changeset/base/196025 Log: Minor style tweaks. Approved by: re (vimage blanket) Modified: head/sys/net/vnet.c Modified: head/sys/net/vnet.c ============================================================================== --- head/sys/net/vnet.c Sat Aug 1 21:54:15 2009 (r196024) +++ head/sys/net/vnet.c Sat Aug 1 21:58:32 2009 (r196025) @@ -62,9 +62,9 @@ __FBSDID("$FreeBSD$"); /*- * This file implements core functions for virtual network stacks: * - * - Core virtual network stack management functions. + * - Virtual network stack management functions. * - * - Virtual network stack memory allocator, which virtualized global + * - Virtual network stack memory allocator, which virtualizes global * variables in the network stack * * - Virtualized SYSINIT's/SYSUNINIT's, which allow network stack subsystems @@ -78,7 +78,7 @@ MALLOC_DEFINE(M_VNET, "vnet", "network s * The virtual network stack list has two read-write locks, one sleepable and * the other not, so that the list can be stablized and walked in a variety * of network stack contexts. Both must be acquired exclusively to modify - * the list. + * the list, but a read lock of either lock is sufficient to walk the list. */ struct rwlock vnet_rwlock; struct sx vnet_sxlock; @@ -181,9 +181,9 @@ MALLOC_DEFINE(M_VNET_DATA, "vnet_data", static VNET_DEFINE(char, modspace[VNET_MODMIN]); /* - * Global lists of subsystem constructor and destructors for vnets. - * They are registered via VNET_SYSINIT() and VNET_SYSUNINIT(). The - * lists are protected by the vnet_sxlock global lock. + * Global lists of subsystem constructor and destructors for vnets. They are + * registered via VNET_SYSINIT() and VNET_SYSUNINIT(). The lists are + * protected by the vnet_sxlock global lock. */ static TAILQ_HEAD(vnet_sysinit_head, vnet_sysinit) vnet_constructors = TAILQ_HEAD_INITIALIZER(vnet_constructors); @@ -387,15 +387,16 @@ vnet_data_free(void *start_arg, int size if (df->vnd_start > end) break; /* - * If we expand at the end of an entry we may have to - * merge it with the one following it as well. + * If we expand at the end of an entry we may have to merge + * it with the one following it as well. */ if (df->vnd_start + df->vnd_len == start) { df->vnd_len += size; dn = TAILQ_NEXT(df, vnd_link); if (df->vnd_start + df->vnd_len == dn->vnd_start) { df->vnd_len += dn->vnd_len; - TAILQ_REMOVE(&vnet_data_free_head, dn, vnd_link); + TAILQ_REMOVE(&vnet_data_free_head, dn, + vnd_link); free(dn, M_VNET_DATA_FREE); } sx_xunlock(&vnet_data_free_lock); @@ -573,10 +574,9 @@ vnet_deregister_sysuninit(void *arg) } /* - * Invoke all registered vnet constructors on the current vnet. Used - * during vnet construction. The caller is responsible for ensuring - * the new vnet is the current vnet and that the vnet_sxlock lock is - * locked. + * Invoke all registered vnet constructors on the current vnet. Used during + * vnet construction. The caller is responsible for ensuring the new vnet is + * the current vnet and that the vnet_sxlock lock is locked. */ void vnet_sysinit(void) @@ -590,10 +590,9 @@ vnet_sysinit(void) } /* - * Invoke all registered vnet destructors on the current vnet. Used - * during vnet destruction. The caller is responsible for ensuring - * the dying vnet is the current vnet and that the vnet_sxlock lock is - * locked. + * Invoke all registered vnet destructors on the current vnet. Used during + * vnet destruction. The caller is responsible for ensuring the dying vnet + * is the current vnet and that the vnet_sxlock lock is locked. */ void vnet_sysuninit(void) From rwatson at FreeBSD.org Sat Aug 1 22:15:10 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sat Aug 1 22:15:47 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <200908010615.02972.hselasky@c2i.net> References: <200907300014.n6U0EZ77086341@svn.freebsd.org> <20090731212140.GK47463@elvis.mu.org> <200908010615.02972.hselasky@c2i.net> Message-ID: On Sat, 1 Aug 2009, Hans Petter Selasky wrote: >>> This has slowed down core dumps very significantly. What used to take >>> 10-15s on my system now takes around 3 minutes. A simple test is to break >>> into ddb and "call doadump" with or without this rev. I have a serial >>> console on this machine and so I can use ddb whether the attached USB >>> keyboard works or not. > > It's because there is a DELAY(1000) in the UKBD's polling routine so that > key- repeating will work, no magic. Given a choice between dumping 10x faster and having automatic key repeat in DDB, I'd lean towards the former. :-) Robert N M Watson Computer Laboratory University of Cambridge From rwatson at FreeBSD.org Sat Aug 1 22:22:45 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sat Aug 1 22:22:57 2009 Subject: svn commit: r196026 - head/sys/net Message-ID: <200908012222.n71MMjNO094392@svn.freebsd.org> Author: rwatson Date: Sat Aug 1 22:22:45 2009 New Revision: 196026 URL: http://svn.freebsd.org/changeset/base/196026 Log: The colour was red as shall be the letters of this warning to people upon boot if the experimental VIMAGE feature was compiled into the kernel. Submitted by: bz Reviewed by: zec Approved by: re (vimage blanket) Modified: head/sys/net/vnet.c Modified: head/sys/net/vnet.c ============================================================================== --- head/sys/net/vnet.c Sat Aug 1 21:58:32 2009 (r196025) +++ head/sys/net/vnet.c Sat Aug 1 22:22:45 2009 (r196026) @@ -296,6 +296,10 @@ static void vnet0_init(void *arg) { + /* Warn people before take off - in case we crash early. */ + printf("WARNING: VIMAGE (virtualized network stack) is a highly " + "experimental feature.\n"); + /* * We MUST clear curvnet in vi_init_done() before going SMP, * otherwise CURVNET_SET() macros would scream about unnecessary From rwatson at FreeBSD.org Sun Aug 2 10:27:55 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Aug 2 10:28:02 2009 Subject: svn commit: r196031 - in head/contrib/openbsm: . config etc tools Message-ID: <200908021027.n72ARtPi012169@svn.freebsd.org> Author: rwatson Date: Sun Aug 2 10:27:54 2009 New Revision: 196031 URL: http://svn.freebsd.org/changeset/base/196031 Log: Import OpenBSM 1.1p2 from vendor branch to 8-CURRENT. This patch release addresses several minor issues: - Fix audit_event definitions of AUE_OPENAT_RWT and AUE_OPENAT_RWTC. - Fix build on Linux. - Fix printing of class masks in the audump tool. MFC after: 3 weeks Obtained from: TrustedBSD Project Approved by: re (kib) Modified: head/contrib/openbsm/ (props changed) head/contrib/openbsm/NEWS head/contrib/openbsm/README head/contrib/openbsm/VERSION head/contrib/openbsm/config/config.h head/contrib/openbsm/configure head/contrib/openbsm/configure.ac head/contrib/openbsm/etc/audit_event head/contrib/openbsm/tools/audump.c Modified: head/contrib/openbsm/NEWS ============================================================================== --- head/contrib/openbsm/NEWS Sun Aug 2 04:23:12 2009 (r196030) +++ head/contrib/openbsm/NEWS Sun Aug 2 10:27:54 2009 (r196031) @@ -1,5 +1,11 @@ OpenBSM Version History +OpenBSM 1.1p2 + +- Fix audit_event definitions of AUE_OPENAT_RWT and AUE_OPENAT_RWTC. +- Fix build on Linux. +- Fix printing of class masks in the audump tool. + OpenBSM 1.1p1 - Fixes to AUT_SOCKUNIX token parsing. @@ -458,4 +464,4 @@ OpenBSM 1.0 alpha 1 to support reloading of kernel event table. - Allow comments in /etc/security configuration files. -$P4: //depot/projects/trustedbsd/openbsm/NEWS#42 $ +$P4: //depot/projects/trustedbsd/openbsm/NEWS#43 $ Modified: head/contrib/openbsm/README ============================================================================== --- head/contrib/openbsm/README Sun Aug 2 04:23:12 2009 (r196030) +++ head/contrib/openbsm/README Sun Aug 2 10:27:54 2009 (r196031) @@ -1,4 +1,4 @@ -OpenBSM 1.1 +OpenBSM 1.1p2 Introduction @@ -64,4 +64,4 @@ Information on TrustedBSD may be found o http://www.TrustedBSD.org/ -$P4: //depot/projects/trustedbsd/openbsm/README#36 $ +$P4: //depot/projects/trustedbsd/openbsm/README#37 $ Modified: head/contrib/openbsm/VERSION ============================================================================== --- head/contrib/openbsm/VERSION Sun Aug 2 04:23:12 2009 (r196030) +++ head/contrib/openbsm/VERSION Sun Aug 2 10:27:54 2009 (r196031) @@ -1 +1 @@ -OPENBSM_1_1p1 +OPENBSM_1_1p2 Modified: head/contrib/openbsm/config/config.h ============================================================================== --- head/contrib/openbsm/config/config.h Sun Aug 2 04:23:12 2009 (r196030) +++ head/contrib/openbsm/config/config.h Sun Aug 2 10:27:54 2009 (r196031) @@ -164,13 +164,13 @@ #define PACKAGE_NAME "OpenBSM" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "OpenBSM 1.1p1" +#define PACKAGE_STRING "OpenBSM 1.1p2" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "openbsm" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.1p1" +#define PACKAGE_VERSION "1.1p2" /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void @@ -191,7 +191,7 @@ #define USE_NATIVE_INCLUDES /**/ /* Version number of package */ -#define VERSION "1.1p1" +#define VERSION "1.1p2" /* Use extended API on platforms that require it */ #define _GNU_SOURCE /**/ Modified: head/contrib/openbsm/configure ============================================================================== --- head/contrib/openbsm/configure Sun Aug 2 04:23:12 2009 (r196030) +++ head/contrib/openbsm/configure Sun Aug 2 10:27:54 2009 (r196031) @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.ac P4: //depot/projects/trustedbsd/openbsm/configure.ac#52 . +# From configure.ac P4: //depot/projects/trustedbsd/openbsm/configure.ac#53 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.62 for OpenBSM 1.1p1. +# Generated by GNU Autoconf 2.62 for OpenBSM 1.1p2. # # Report bugs to . # @@ -751,8 +751,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='OpenBSM' PACKAGE_TARNAME='openbsm' -PACKAGE_VERSION='1.1p1' -PACKAGE_STRING='OpenBSM 1.1p1' +PACKAGE_VERSION='1.1p2' +PACKAGE_STRING='OpenBSM 1.1p2' PACKAGE_BUGREPORT='trustedbsd-audit@TrustesdBSD.org' ac_unique_file="bin/auditreduce/auditreduce.c" @@ -1492,7 +1492,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures OpenBSM 1.1p1 to adapt to many kinds of systems. +\`configure' configures OpenBSM 1.1p2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1562,7 +1562,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of OpenBSM 1.1p1:";; + short | recursive ) echo "Configuration of OpenBSM 1.1p2:";; esac cat <<\_ACEOF @@ -1671,7 +1671,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -OpenBSM configure 1.1p1 +OpenBSM configure 1.1p2 generated by GNU Autoconf 2.62 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1685,7 +1685,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by OpenBSM $as_me 1.1p1, which was +It was created by OpenBSM $as_me 1.1p2, which was generated by GNU Autoconf 2.62. Invocation command line was $ $0 $@ @@ -19662,7 +19662,7 @@ fi # Define the identity of the package. PACKAGE=OpenBSM - VERSION=1.1p1 + VERSION=1.1p2 cat >>confdefs.h <<_ACEOF @@ -24400,7 +24400,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by OpenBSM $as_me 1.1p1, which was +This file was extended by OpenBSM $as_me 1.1p2, which was generated by GNU Autoconf 2.62. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -24453,7 +24453,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -OpenBSM config.status 1.1p1 +OpenBSM config.status 1.1p2 configured by $0, generated by GNU Autoconf 2.62, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Modified: head/contrib/openbsm/configure.ac ============================================================================== --- head/contrib/openbsm/configure.ac Sun Aug 2 04:23:12 2009 (r196030) +++ head/contrib/openbsm/configure.ac Sun Aug 2 10:27:54 2009 (r196031) @@ -2,8 +2,8 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT([OpenBSM], [1.1p1], [trustedbsd-audit@TrustesdBSD.org],[openbsm]) -AC_REVISION([$P4: //depot/projects/trustedbsd/openbsm/configure.ac#53 $]) +AC_INIT([OpenBSM], [1.1p2], [trustedbsd-audit@TrustesdBSD.org],[openbsm]) +AC_REVISION([$P4: //depot/projects/trustedbsd/openbsm/configure.ac#54 $]) AC_CONFIG_SRCDIR([bin/auditreduce/auditreduce.c]) AC_CONFIG_AUX_DIR(config) AC_CONFIG_HEADER([config/config.h]) Modified: head/contrib/openbsm/etc/audit_event ============================================================================== --- head/contrib/openbsm/etc/audit_event Sun Aug 2 04:23:12 2009 (r196030) +++ head/contrib/openbsm/etc/audit_event Sun Aug 2 10:27:54 2009 (r196031) @@ -1,5 +1,5 @@ # -# $P4: //depot/projects/trustedbsd/openbsm/etc/audit_event#40 $ +# $P4: //depot/projects/trustedbsd/openbsm/etc/audit_event#41 $ # $FreeBSD$ # # The mapping between event identifiers and values is also hard-coded in @@ -272,7 +272,8 @@ 277:AUE_OPENAT_WTC:openat(2) - write,creat,trunc:fc,fd,fw,fa,fm 278:AUE_OPENAT_RW:openat(2) - read,write:fr,fw 279:AUE_OPENAT_RWC:openat(2) - read,write,create:fc,fw,fr,fa,fm -280:AUE_OPENAT_RWTC:openat(2) - read,write,creat,trunc:fc,fd,fw,fr,fa,fm +280:AUE_OPENAT_RWT:openat(2) - read,write,trunc:fd,fw,fr,fa,fm +281:AUE_OPENAT_RWTC:openat(2) - read,write,creat,trunc:fc,fd,fw,fr,fa,fm 282:AUE_RENAMEAT:renameat(2):fc,fd 283:AUE_FSTATAT:fstatat(2):fa 284:AUE_FCHOWNAT:fchownat(2):fm Modified: head/contrib/openbsm/tools/audump.c ============================================================================== --- head/contrib/openbsm/tools/audump.c Sun Aug 2 04:23:12 2009 (r196030) +++ head/contrib/openbsm/tools/audump.c Sun Aug 2 10:27:54 2009 (r196031) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2006 Robert N. M. Watson + * Copyright (c) 2005-2009 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/tools/audump.c#8 $ + * $P4: //depot/projects/trustedbsd/openbsm/tools/audump.c#9 $ */ #include @@ -165,16 +165,16 @@ printf_classmask(au_class_t classmask) first = 1; for (i = 0; i < 32; i++) { - if (classmask & (2 << i)) { + if (classmask & (1 << i)) { if (first) first = 0; else printf(","); - c = getauclassnum(2 << i); + c = getauclassnum(1 << i); if (c != NULL) printf("%s", c->ac_name); else - printf("0x%x", 2 << i); + printf("0x%x", 1 << i); } } } From ed at FreeBSD.org Sun Aug 2 11:26:23 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Sun Aug 2 11:26:35 2009 Subject: svn commit: r196033 - in head/sys: amd64/amd64 i386/i386 Message-ID: <200908021126.n72BQNfU013407@svn.freebsd.org> Author: ed Date: Sun Aug 2 11:26:23 2009 New Revision: 196033 URL: http://svn.freebsd.org/changeset/base/196033 Log: Make the MacBook3,1 boot again. Approved by: re (kib) Modified: head/sys/amd64/amd64/machdep.c head/sys/i386/i386/machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Sun Aug 2 10:48:25 2009 (r196032) +++ head/sys/amd64/amd64/machdep.c Sun Aug 2 11:26:23 2009 (r196033) @@ -214,6 +214,7 @@ cpu_startup(dummy) sysenv = getenv("smbios.system.product"); if (sysenv != NULL) { if (strncmp(sysenv, "MacBook1,1", 10) == 0 || + strncmp(sysenv, "MacBook3,1", 10) == 0 || strncmp(sysenv, "MacBookPro1,1", 13) == 0 || strncmp(sysenv, "MacBookPro1,2", 13) == 0 || strncmp(sysenv, "Macmini1,1", 10) == 0) { Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Sun Aug 2 10:48:25 2009 (r196032) +++ head/sys/i386/i386/machdep.c Sun Aug 2 11:26:23 2009 (r196033) @@ -258,6 +258,7 @@ cpu_startup(dummy) sysenv = getenv("smbios.system.product"); if (sysenv != NULL) { if (strncmp(sysenv, "MacBook1,1", 10) == 0 || + strncmp(sysenv, "MacBook3,1", 10) == 0 || strncmp(sysenv, "MacBookPro1,1", 13) == 0 || strncmp(sysenv, "MacBookPro1,2", 13) == 0 || strncmp(sysenv, "Macmini1,1", 10) == 0) { From ed at FreeBSD.org Sun Aug 2 14:25:27 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Sun Aug 2 14:25:33 2009 Subject: svn commit: r196036 - head/sys/kern Message-ID: <200908021425.n72EPQ8T016871@svn.freebsd.org> Author: ed Date: Sun Aug 2 14:25:26 2009 New Revision: 196036 URL: http://svn.freebsd.org/changeset/base/196036 Log: Fix two bugs related to TTY input: - fix write() on pseudo-terminal masters to return the amount of bytes passed to the TTY, not the amount of bytes read from user. - fix ttydisc_rint_bypass() to set the high watermark when it cannot write all input, just like ttydisc_rint() itself. Approved by: re (kib) Modified: head/sys/kern/tty_pts.c head/sys/kern/tty_ttydisc.c Modified: head/sys/kern/tty_pts.c ============================================================================== --- head/sys/kern/tty_pts.c Sun Aug 2 13:37:00 2009 (r196035) +++ head/sys/kern/tty_pts.c Sun Aug 2 14:25:26 2009 (r196036) @@ -204,8 +204,10 @@ ptsdev_write(struct file *fp, struct uio error = uiomove(ib, iblen, uio); tty_lock(tp); - if (error != 0) + if (error != 0) { + iblen = 0; goto done; + } /* * When possible, avoid the slow path. rint_bypass() @@ -260,6 +262,12 @@ ptsdev_write(struct file *fp, struct uio done: ttydisc_rint_done(tp); tty_unlock(tp); + + /* + * Don't account for the part of the buffer that we couldn't + * pass to the TTY. + */ + uio->uio_resid += iblen; return (error); } Modified: head/sys/kern/tty_ttydisc.c ============================================================================== --- head/sys/kern/tty_ttydisc.c Sun Aug 2 13:37:00 2009 (r196035) +++ head/sys/kern/tty_ttydisc.c Sun Aug 2 14:25:26 2009 (r196036) @@ -1060,6 +1060,8 @@ ttydisc_rint_bypass(struct tty *tp, cons ret = ttyinq_write(&tp->t_inq, buf, len, 0); ttyinq_canonicalize(&tp->t_inq); + if (ret < len) + tty_hiwat_in_block(tp); return (ret); } From attilio at FreeBSD.org Sun Aug 2 14:28:42 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Sun Aug 2 14:28:49 2009 Subject: svn commit: r196037 - in head/sys: dev/aac dev/acpica dev/adb dev/amdtemp dev/amr dev/ata dev/atkbdc dev/bktr dev/drm dev/ips dev/mfi dev/mlx dev/mmc dev/pccbb dev/pst dev/rp dev/sound/pci/hda dev/... Message-ID: <200908021428.n72ESeGr016971@svn.freebsd.org> Author: attilio Date: Sun Aug 2 14:28:40 2009 New Revision: 196037 URL: http://svn.freebsd.org/changeset/base/196037 Log: Make the newbus subsystem Giant free by adding the new newbus sxlock. The newbus lock is responsible for protecting newbus internIal structures, device states and devclass flags. It is necessary to hold it when all such datas are accessed. For the other operations, softc locking should ensure enough protection to avoid races. Newbus lock is automatically held when virtual operations on the device and bus are invoked when loading the driver or when the suspend/resume take place. For other 'spourious' operations trying to access/modify the newbus topology, newbus lock needs to be automatically acquired and dropped. For the moment Giant is also acquired in some key point (modules subsystem) in order to avoid problems before the 8.0 release as module handlers could make assumptions about it. This Giant locking should go just after the release happens. Please keep in mind that the public interface can be expanded in order to provide more support, if there are really necessities at some point and also some bugs could arise as long as the patch needs a bit of further testing. Bump __FreeBSD_version in order to reflect the newbus lock introduction. Reviewed by: ed, hps, jhb, imp, mav, scottl No answer by: ariff, thompsa, yongari Tested by: pho, G. Trematerra , Brandon Gooch Sponsored by: Yahoo! Incorporated Approved by: re (ksmith) Modified: head/sys/dev/aac/aac.c head/sys/dev/acpica/acpi.c head/sys/dev/acpica/acpi_battery.c head/sys/dev/acpica/acpi_cpu.c head/sys/dev/acpica/acpi_dock.c head/sys/dev/acpica/acpi_thermal.c head/sys/dev/adb/adb_bus.c head/sys/dev/amdtemp/amdtemp.c head/sys/dev/amr/amr.c head/sys/dev/ata/ata-all.c head/sys/dev/atkbdc/psm.c head/sys/dev/bktr/bktr_os.c head/sys/dev/drm/drm_drv.c head/sys/dev/ips/ips_pci.c head/sys/dev/mfi/mfi.c head/sys/dev/mlx/mlx.c head/sys/dev/mmc/mmc.c head/sys/dev/pccbb/pccbb.c head/sys/dev/pst/pst-iop.c head/sys/dev/rp/rp.c head/sys/dev/sound/pci/hda/hdac.c head/sys/dev/twe/twe.c head/sys/dev/usb/controller/usb_controller.c head/sys/dev/usb/input/ukbd.c head/sys/dev/usb/net/usb_ethernet.c head/sys/dev/usb/usb_compat_linux.c head/sys/dev/usb/usb_dev.c head/sys/dev/usb/usb_handle_request.c head/sys/dev/usb/usb_hub.c head/sys/dev/usb/wlan/if_upgt.c head/sys/dev/xen/blkback/blkback.c head/sys/dev/xen/netback/netback.c head/sys/i386/acpica/acpi_machdep.c head/sys/i386/bios/smapi.c head/sys/i386/bios/smbios.c head/sys/i386/bios/vpd.c head/sys/kern/subr_bus.c head/sys/pc98/cbus/fdc.c head/sys/sys/bus.h head/sys/sys/param.h head/sys/xen/xenbus/xenbus_probe.c Modified: head/sys/dev/aac/aac.c ============================================================================== --- head/sys/dev/aac/aac.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/aac/aac.c Sun Aug 2 14:28:40 2009 (r196037) @@ -3270,10 +3270,10 @@ aac_handle_aif(struct aac_softc *sc, str while (co != NULL) { if (co->co_found == 0) { mtx_unlock(&sc->aac_io_lock); - mtx_lock(&Giant); + newbus_xlock(); device_delete_child(sc->aac_dev, co->co_disk); - mtx_unlock(&Giant); + newbus_xunlock(); mtx_lock(&sc->aac_io_lock); co_next = TAILQ_NEXT(co, co_link); mtx_lock(&sc->aac_container_lock); @@ -3291,9 +3291,9 @@ aac_handle_aif(struct aac_softc *sc, str /* Attach the newly created containers */ if (added) { mtx_unlock(&sc->aac_io_lock); - mtx_lock(&Giant); + newbus_xlock(); bus_generic_attach(sc->aac_dev); - mtx_unlock(&Giant); + newbus_xunlock(); mtx_lock(&sc->aac_io_lock); } Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/acpica/acpi.c Sun Aug 2 14:28:40 2009 (r196037) @@ -675,8 +675,6 @@ acpi_suspend(device_t dev) device_t child, *devlist; int error, i, numdevs, pstate; - GIANT_REQUIRED; - /* First give child devices a chance to suspend. */ error = bus_generic_suspend(dev); if (error) @@ -719,8 +717,6 @@ acpi_resume(device_t dev) int i, numdevs, error; device_t child, *devlist; - GIANT_REQUIRED; - /* * Put all devices in D0 before resuming them. Call _S0D on each one * since some systems expect this. @@ -745,8 +741,6 @@ static int acpi_shutdown(device_t dev) { - GIANT_REQUIRED; - /* Allow children to shutdown first. */ bus_generic_shutdown(dev); @@ -2534,11 +2528,7 @@ acpi_EnterSleepState(struct acpi_softc * thread_unlock(curthread); #endif - /* - * Be sure to hold Giant across DEVICE_SUSPEND/RESUME since non-MPSAFE - * drivers need this. - */ - mtx_lock(&Giant); + newbus_xlock(); slp_state = ACPI_SS_NONE; @@ -2611,7 +2601,7 @@ backout: if (slp_state >= ACPI_SS_SLEPT) acpi_enable_fixed_events(sc); - mtx_unlock(&Giant); + newbus_xunlock(); #ifdef SMP thread_lock(curthread); Modified: head/sys/dev/acpica/acpi_battery.c ============================================================================== --- head/sys/dev/acpica/acpi_battery.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/acpica/acpi_battery.c Sun Aug 2 14:28:40 2009 (r196037) @@ -329,6 +329,7 @@ acpi_battery_find_dev(u_int logical_unit dev = NULL; found_unit = 0; + newbus_slock(); batt_dc = devclass_find("battery"); maxunit = devclass_get_maxunit(batt_dc); for (i = 0; i < maxunit; i++) { @@ -340,6 +341,7 @@ acpi_battery_find_dev(u_int logical_unit found_unit++; dev = NULL; } + newbus_sunlock(); return (dev); } @@ -369,13 +371,17 @@ acpi_battery_ioctl(u_long cmd, caddr_t a */ switch (cmd) { case ACPIIO_BATT_GET_UNITS: + newbus_slock(); *(int *)addr = acpi_battery_get_units(); + newbus_sunlock(); error = 0; break; case ACPIIO_BATT_GET_BATTINFO: if (dev != NULL || unit == ACPI_BATTERY_ALL_UNITS) { bzero(&ioctl_arg->battinfo, sizeof(ioctl_arg->battinfo)); + newbus_slock(); error = acpi_battery_get_battinfo(dev, &ioctl_arg->battinfo); + newbus_sunlock(); } break; case ACPIIO_BATT_GET_BIF: @@ -416,6 +422,11 @@ acpi_battery_sysctl(SYSCTL_HANDLER_ARGS) { int val, error; + /* + * Tolerate a race here because newbus lock can't be acquired before + * acpi_battery_get_battinfo() as it can create a LOR with the sysctl + * lock. + */ acpi_battery_get_battinfo(NULL, &acpi_battery_battinfo); val = *(u_int *)oidp->oid_arg1; error = sysctl_handle_int(oidp, &val, 0, req); @@ -427,6 +438,10 @@ acpi_battery_units_sysctl(SYSCTL_HANDLER { int count, error; + /* + * Tolerate a race here in order to avoid a LOR between sysctl lock + * and newbus lock. + */ count = acpi_battery_get_units(); error = sysctl_handle_int(oidp, &count, 0, req); return (error); Modified: head/sys/dev/acpica/acpi_cpu.c ============================================================================== --- head/sys/dev/acpica/acpi_cpu.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/acpica/acpi_cpu.c Sun Aug 2 14:28:40 2009 (r196037) @@ -732,7 +732,9 @@ acpi_cpu_startup(void *arg) int i; /* Get set of CPU devices */ + newbus_slock(); devclass_get_devices(acpi_cpu_devclass, &cpu_devices, &cpu_ndevices); + newbus_sunlock(); /* * Setup any quirks that might necessary now that we have probed Modified: head/sys/dev/acpica/acpi_dock.c ============================================================================== --- head/sys/dev/acpica/acpi_dock.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/acpica/acpi_dock.c Sun Aug 2 14:28:40 2009 (r196037) @@ -188,12 +188,12 @@ acpi_dock_attach_later(void *context) dev = (device_t)context; + newbus_xlock(); if (!device_is_enabled(dev)) device_enable(dev); - mtx_lock(&Giant); device_probe_and_attach(dev); - mtx_unlock(&Giant); + newbus_xunlock(); } static ACPI_STATUS @@ -299,11 +299,11 @@ acpi_dock_eject_child(ACPI_HANDLE handle "ejecting device for %s\n", acpi_name(handle)); dev = acpi_get_device(handle); + newbus_xlock(); if (dev != NULL && device_is_attached(dev)) { - mtx_lock(&Giant); device_detach(dev); - mtx_unlock(&Giant); } + newbus_xunlock(); acpi_SetInteger(handle, "_EJ0", 0); out: Modified: head/sys/dev/acpica/acpi_thermal.c ============================================================================== --- head/sys/dev/acpica/acpi_thermal.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/acpica/acpi_thermal.c Sun Aug 2 14:28:40 2009 (r196037) @@ -936,6 +936,8 @@ acpi_tz_thread(void *arg) sc = NULL; for (;;) { + newbus_slock(); + /* If the number of devices has changed, re-evaluate. */ if (devclass_get_count(acpi_tz_devclass) != devcount) { if (devs != NULL) { @@ -948,6 +950,7 @@ acpi_tz_thread(void *arg) for (i = 0; i < devcount; i++) sc[i] = device_get_softc(devs[i]); } + newbus_sunlock(); /* Check for temperature events and act on them. */ for (i = 0; i < devcount; i++) { Modified: head/sys/dev/adb/adb_bus.c ============================================================================== --- head/sys/dev/adb/adb_bus.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/adb/adb_bus.c Sun Aug 2 14:28:40 2009 (r196037) @@ -113,6 +113,7 @@ adb_bus_enumerate(void *xdev) uint8_t i, next_free; uint16_t r3; + newbus_xlock(); sc->sc_dev = dev; sc->parent = device_get_parent(dev); @@ -187,6 +188,7 @@ adb_bus_enumerate(void *xdev) } bus_generic_attach(dev); + newbus_xunlock(); config_intrhook_disestablish(&sc->enum_hook); } Modified: head/sys/dev/amdtemp/amdtemp.c ============================================================================== --- head/sys/dev/amdtemp/amdtemp.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/amdtemp/amdtemp.c Sun Aug 2 14:28:40 2009 (r196037) @@ -269,6 +269,7 @@ amdtemp_intrhook(void *arg) /* * dev.cpu.N.temperature. */ + newbus_xlock(); nexus = device_find_child(root_bus, "nexus", 0); acpi = device_find_child(nexus, "acpi", 0); @@ -285,6 +286,7 @@ amdtemp_intrhook(void *arg) "Max of sensor 0 / 1"); } } + newbus_xunlock(); config_intrhook_disestablish(&sc->sc_ich); } Modified: head/sys/dev/amr/amr.c ============================================================================== --- head/sys/dev/amr/amr.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/amr/amr.c Sun Aug 2 14:28:40 2009 (r196037) @@ -90,6 +90,10 @@ __FBSDID("$FreeBSD$"); SYSCTL_NODE(_hw, OID_AUTO, amr, CTLFLAG_RD, 0, "AMR driver parameters"); +/* + * In order to get rid of Giant, amr_state should be protected by + * a proper softc lock for the cdev operations. + */ static d_open_t amr_open; static d_close_t amr_close; static d_ioctl_t amr_ioctl; @@ -312,9 +316,11 @@ amr_startup(void *arg) config_intrhook_disestablish(&sc->amr_ich); sc->amr_ich.ich_func = NULL; + newbus_xlock(); /* get up-to-date drive information */ if (amr_query_controller(sc)) { device_printf(sc->amr_dev, "can't scan controller for drives\n"); + newbus_xunlock(); return; } @@ -347,6 +353,7 @@ amr_startup(void *arg) /* interrupts will be enabled before we do anything more */ sc->amr_state |= AMR_STATE_INTEN; + newbus_xunlock(); /* * Start the timeout routine. @@ -434,7 +441,11 @@ static int amr_open(struct cdev *dev, int flags, int fmt, struct thread *td) { int unit = dev2unit(dev); - struct amr_softc *sc = devclass_get_softc(devclass_find("amr"), unit); + struct amr_softc *sc; + + newbus_slock(); + sc = devclass_get_softc(devclass_find("amr"), unit); + newbus_sunlock(); debug_called(1); @@ -490,7 +501,11 @@ static int amr_close(struct cdev *dev, int flags, int fmt, struct thread *td) { int unit = dev2unit(dev); - struct amr_softc *sc = devclass_get_softc(devclass_find("amr"), unit); + struct amr_softc *sc; + + newbus_slock(); + sc = devclass_get_softc(devclass_find("amr"), unit); + newbus_sunlock(); debug_called(1); @@ -507,6 +522,7 @@ amr_rescan_drives(struct cdev *dev) struct amr_softc *sc = (struct amr_softc *)dev->si_drv1; int i, error = 0; + newbus_xlock(); sc->amr_state |= AMR_STATE_REMAP_LD; while (sc->amr_busyslots) { device_printf(sc->amr_dev, "idle controller\n"); @@ -530,6 +546,7 @@ amr_rescan_drives(struct cdev *dev) sc->amr_drive[i].al_disk = 0; } } + newbus_xunlock(); shutdown_out: amr_startup(sc); @@ -805,7 +822,9 @@ amr_ioctl(struct cdev *dev, u_long cmd, struct amr_linux_ioctl ali; int adapter, error; + newbus_slock(); devclass = devclass_find("amr"); + newbus_sunlock(); if (devclass == NULL) return (ENOENT); Modified: head/sys/dev/ata/ata-all.c ============================================================================== --- head/sys/dev/ata/ata-all.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/ata/ata-all.c Sun Aug 2 14:28:40 2009 (r196037) @@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$"); static d_ioctl_t ata_ioctl; static struct cdevsw ata_cdevsw = { .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, /* we need this as newbus isn't mpsafe */ .d_ioctl = ata_ioctl, .d_name = "ata", }; @@ -204,7 +203,9 @@ ata_conn_event(void *context, int dummy) { device_t dev = (device_t)context; + newbus_xlock(); ata_reinit(dev); + newbus_xunlock(); } int @@ -246,7 +247,6 @@ ata_reinit(device_t dev) /* reinit the children and delete any that fails */ if (!device_get_children(dev, &children, &nchildren)) { - mtx_lock(&Giant); /* newbus suckage it needs Giant */ for (i = 0; i < nchildren; i++) { /* did any children go missing ? */ if (children[i] && device_is_attached(children[i]) && @@ -269,7 +269,6 @@ ata_reinit(device_t dev) } } free(children, M_TEMP); - mtx_unlock(&Giant); /* newbus suckage dealt with, release Giant */ } /* if we still have a good request put it on the queue again */ @@ -395,6 +394,7 @@ ata_ioctl(struct cdev *dev, u_long cmd, int *value = (int *)data; int i, nchildren, error = ENOTTY; + newbus_xlock(); switch (cmd) { case IOCATAGMAXCHANNEL: /* In case we have channel 0..n this will return n+1. */ @@ -405,32 +405,40 @@ ata_ioctl(struct cdev *dev, u_long cmd, case IOCATAREINIT: if (*value >= devclass_get_maxunit(ata_devclass) || !(device = devclass_get_device(ata_devclass, *value)) || - !device_is_attached(device)) + !device_is_attached(device)) { + newbus_xunlock(); return ENXIO; + } error = ata_reinit(device); break; case IOCATAATTACH: if (*value >= devclass_get_maxunit(ata_devclass) || !(device = devclass_get_device(ata_devclass, *value)) || - !device_is_attached(device)) + !device_is_attached(device)) { + newbus_xunlock(); return ENXIO; + } error = DEVICE_ATTACH(device); break; case IOCATADETACH: if (*value >= devclass_get_maxunit(ata_devclass) || !(device = devclass_get_device(ata_devclass, *value)) || - !device_is_attached(device)) + !device_is_attached(device)) { + newbus_xunlock(); return ENXIO; + } error = DEVICE_DETACH(device); break; case IOCATADEVICES: if (devices->channel >= devclass_get_maxunit(ata_devclass) || !(device = devclass_get_device(ata_devclass, devices->channel)) || - !device_is_attached(device)) + !device_is_attached(device)) { + newbus_xunlock(); return ENXIO; + } bzero(devices->name[0], 32); bzero(&devices->params[0], sizeof(struct ata_params)); bzero(devices->name[1], 32); @@ -465,6 +473,7 @@ ata_ioctl(struct cdev *dev, u_long cmd, if (ata_raid_ioctl_func) error = ata_raid_ioctl_func(cmd, data); } + newbus_xunlock(); return error; } @@ -572,7 +581,7 @@ ata_boot_attach(void) struct ata_channel *ch; int ctlr; - mtx_lock(&Giant); /* newbus suckage it needs Giant */ + newbus_xlock(); /* kick of probe and attach on all channels */ for (ctlr = 0; ctlr < devclass_get_maxunit(ata_devclass); ctlr++) { @@ -587,8 +596,7 @@ ata_boot_attach(void) free(ata_delayed_attach, M_TEMP); ata_delayed_attach = NULL; } - - mtx_unlock(&Giant); /* newbus suckage dealt with, release Giant */ + newbus_xunlock(); } @@ -717,7 +725,6 @@ ata_identify(device_t dev) if (bootverbose) device_printf(dev, "Identifying devices: %08x\n", ch->devices); - mtx_lock(&Giant); /* Skip existing devices. */ if (!device_get_children(dev, &children, &nchildren)) { for (i = 0; i < nchildren; i++) { @@ -729,10 +736,8 @@ ata_identify(device_t dev) /* Create new devices. */ if (bootverbose) device_printf(dev, "New devices: %08x\n", n); - if (n == 0) { - mtx_unlock(&Giant); + if (n == 0) return (0); - } for (i = 0; i < ATA_PM; ++i) { if (n & (((ATA_ATA_MASTER | ATA_ATAPI_MASTER) << i))) { int unit = -1; @@ -775,7 +780,6 @@ ata_identify(device_t dev) } bus_generic_probe(dev); bus_generic_attach(dev); - mtx_unlock(&Giant); return 0; } Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/atkbdc/psm.c Sun Aug 2 14:28:40 2009 (r196037) @@ -1488,7 +1488,9 @@ psmopen(struct cdev *dev, int flag, int if (sc->state & PSM_OPEN) return (EBUSY); + newbus_xlock(); device_busy(devclass_get_device(psm_devclass, unit)); + newbus_xunlock(); /* Initialize state */ sc->mode.level = sc->dflt_mode.level; @@ -1643,7 +1645,9 @@ psmclose(struct cdev *dev, int flag, int /* close is almost always successful */ sc->state &= ~PSM_OPEN; kbdc_lock(sc->kbdc, FALSE); + newbus_xlock(); device_unbusy(devclass_get_device(psm_devclass, unit)); + newbus_xunlock(); return (0); } Modified: head/sys/dev/bktr/bktr_os.c ============================================================================== --- head/sys/dev/bktr/bktr_os.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/bktr/bktr_os.c Sun Aug 2 14:28:40 2009 (r196037) @@ -597,7 +597,9 @@ bktr_open( struct cdev *dev, int flags, return( ENXIO ); /* Record that the device is now busy */ + newbus_xlock(); device_busy(devclass_get_device(bktr_devclass, unit)); + newbus_xunlock(); if (bt848_card != -1) { @@ -668,8 +670,11 @@ bktr_open( struct cdev *dev, int flags, } /* If there was an error opening the device, undo the busy status */ - if (result != 0) + if (result != 0) { + newbus_xlock(); device_unbusy(devclass_get_device(bktr_devclass, unit)); + newbus_xunlock(); + } return( result ); } @@ -689,6 +694,7 @@ bktr_close( struct cdev *dev, int flags, /* Get the device data */ bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit); if (bktr == NULL) { + /* the device is no longer valid/functioning */ return (ENXIO); } @@ -705,10 +711,11 @@ bktr_close( struct cdev *dev, int flags, break; default: return (ENXIO); - break; } + newbus_xlock(); device_unbusy(devclass_get_device(bktr_devclass, unit)); + newbus_xunlock(); return( result ); } Modified: head/sys/dev/drm/drm_drv.c ============================================================================== --- head/sys/dev/drm/drm_drv.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/drm/drm_drv.c Sun Aug 2 14:28:40 2009 (r196037) @@ -614,11 +614,13 @@ int drm_open(struct cdev *kdev, int flag if (!retcode) { atomic_inc(&dev->counts[_DRM_STAT_OPENS]); + newbus_xlock(); DRM_LOCK(); device_busy(dev->device); if (!dev->open_count++) retcode = drm_firstopen(dev); DRM_UNLOCK(); + newbus_xunlock(); } return retcode; @@ -632,6 +634,11 @@ void drm_close(void *data) DRM_DEBUG("open_count = %d\n", dev->open_count); + /* + * We require to lock newbus here for handling device_unbusy() and + * avoid a LOR with DRM_LOCK. + */ + newbus_xlock(); DRM_LOCK(); if (dev->driver->preclose != NULL) @@ -708,6 +715,7 @@ void drm_close(void *data) } DRM_UNLOCK(); + newbus_xunlock(); } /* drm_ioctl is called whenever a process performs an ioctl on /dev/drm. Modified: head/sys/dev/ips/ips_pci.c ============================================================================== --- head/sys/dev/ips/ips_pci.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/ips/ips_pci.c Sun Aug 2 14:28:40 2009 (r196037) @@ -173,10 +173,12 @@ ips_intrhook(void *arg) struct ips_softc *sc = (struct ips_softc *)arg; config_intrhook_disestablish(&sc->ips_ich); + newbus_xlock(); if (ips_adapter_init(sc)) ips_pci_free(sc); else sc->configured = 1; + newbus_xunlock(); } static int ips_pci_free(ips_softc_t *sc) Modified: head/sys/dev/mfi/mfi.c ============================================================================== --- head/sys/dev/mfi/mfi.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/mfi/mfi.c Sun Aug 2 14:28:40 2009 (r196037) @@ -1327,11 +1327,11 @@ mfi_add_ld_complete(struct mfi_command * mfi_release_command(cm); mtx_unlock(&sc->mfi_io_lock); - mtx_lock(&Giant); + newbus_xlock(); if ((child = device_add_child(sc->mfi_dev, "mfid", -1)) == NULL) { device_printf(sc->mfi_dev, "Failed to add logical disk\n"); free(ld_info, M_MFIBUF); - mtx_unlock(&Giant); + newbus_xunlock(); mtx_lock(&sc->mfi_io_lock); return; } @@ -1339,7 +1339,7 @@ mfi_add_ld_complete(struct mfi_command * device_set_ivars(child, ld_info); device_set_desc(child, "MFI Logical Disk"); bus_generic_attach(sc->mfi_dev); - mtx_unlock(&Giant); + newbus_xunlock(); mtx_lock(&sc->mfi_io_lock); } @@ -1805,9 +1805,9 @@ mfi_check_command_post(struct mfi_softc KASSERT(ld != NULL, ("volume dissappeared")); if (cm->cm_frame->header.cmd_status == MFI_STAT_OK) { mtx_unlock(&sc->mfi_io_lock); - mtx_lock(&Giant); + newbus_xlock(); device_delete_child(sc->mfi_dev, ld->ld_dev); - mtx_unlock(&Giant); + newbus_xunlock(); mtx_lock(&sc->mfi_io_lock); } else mfi_disk_enable(ld); @@ -1815,11 +1815,11 @@ mfi_check_command_post(struct mfi_softc case MFI_DCMD_CFG_CLEAR: if (cm->cm_frame->header.cmd_status == MFI_STAT_OK) { mtx_unlock(&sc->mfi_io_lock); - mtx_lock(&Giant); + newbus_xlock(); TAILQ_FOREACH_SAFE(ld, &sc->mfi_ld_tqh, ld_link, ldn) { device_delete_child(sc->mfi_dev, ld->ld_dev); } - mtx_unlock(&Giant); + newbus_xunlock(); mtx_lock(&sc->mfi_io_lock); } else { TAILQ_FOREACH(ld, &sc->mfi_ld_tqh, ld_link) @@ -1985,7 +1985,9 @@ mfi_ioctl(struct cdev *dev, u_long cmd, adapter = ioc->mfi_adapter_no; if (device_get_unit(sc->mfi_dev) == 0 && adapter != 0) { + newbus_slock(); devclass = devclass_find("mfi"); + newbus_sunlock(); sc = devclass_get_softc(devclass, adapter); } mtx_lock(&sc->mfi_io_lock); @@ -2173,7 +2175,9 @@ out: struct mfi_linux_ioc_packet l_ioc; int adapter; + newbus_slock(); devclass = devclass_find("mfi"); + newbus_sunlock(); if (devclass == NULL) return (ENOENT); @@ -2194,7 +2198,9 @@ out: struct mfi_linux_ioc_aen l_aen; int adapter; + newbus_slock(); devclass = devclass_find("mfi"); + newbus_sunlock(); if (devclass == NULL) return (ENOENT); Modified: head/sys/dev/mlx/mlx.c ============================================================================== --- head/sys/dev/mlx/mlx.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/mlx/mlx.c Sun Aug 2 14:28:40 2009 (r196037) @@ -772,7 +772,9 @@ mlx_ioctl(struct cdev *dev, u_long cmd, * Scan the controller to see whether new drives have appeared. */ case MLX_RESCAN_DRIVES: + newbus_xlock(); mlx_startup(sc); + newbus_xunlock(); return(0); /* Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/mmc/mmc.c Sun Aug 2 14:28:40 2009 (r196037) @@ -1496,7 +1496,9 @@ mmc_delayed_attach(void *xsc) { struct mmc_softc *sc = xsc; + newbus_xlock(); mmc_scan(sc); + newbus_xunlock(); config_intrhook_disestablish(&sc->config_intrhook); } Modified: head/sys/dev/pccbb/pccbb.c ============================================================================== --- head/sys/dev/pccbb/pccbb.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/pccbb/pccbb.c Sun Aug 2 14:28:40 2009 (r196037) @@ -464,14 +464,7 @@ cbb_event_thread(void *arg) sc->flags |= CBB_KTHREAD_RUNNING; while ((sc->flags & CBB_KTHREAD_DONE) == 0) { mtx_unlock(&sc->mtx); - /* - * We take out Giant here because we need it deep, - * down in the bowels of the vm system for mapping the - * memory we need to read the CIS. In addition, since - * we are adding/deleting devices from the dev tree, - * and that code isn't MP safe, we have to hold Giant. - */ - mtx_lock(&Giant); + newbus_xlock(); status = cbb_get(sc, CBB_SOCKET_STATE); DPRINTF(("Status is 0x%x\n", status)); if (!CBB_CARD_PRESENT(status)) { @@ -497,7 +490,7 @@ cbb_event_thread(void *arg) not_a_card = 0; /* We know card type */ cbb_insert(sc); } - mtx_unlock(&Giant); + newbus_xunlock(); /* * First time through we need to tell mountroot that we're Modified: head/sys/dev/pst/pst-iop.c ============================================================================== --- head/sys/dev/pst/pst-iop.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/pst/pst-iop.c Sun Aug 2 14:28:40 2009 (r196037) @@ -152,7 +152,9 @@ iop_attach(void *arg) break; case I2O_CLASS_RANDOM_BLOCK_STORAGE: + newbus_xlock(); pst_add_raid(sc, &sc->lct[i]); + newbus_xunlock(); break; } } Modified: head/sys/dev/rp/rp.c ============================================================================== --- head/sys/dev/rp/rp.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/rp/rp.c Sun Aug 2 14:28:40 2009 (r196037) @@ -903,7 +903,9 @@ rpopen(struct tty *tp) rp_callout_handle = timeout(rp_do_poll, (void *)NULL, POLL_INTERVAL); + newbus_xlock(); device_busy(rp->rp_ctlp->dev); + newbus_xunlock(); return(0); } @@ -914,7 +916,9 @@ rpclose(struct tty *tp) rp = tty_softc(tp); rphardclose(tp); + newbus_xlock(); device_unbusy(rp->rp_ctlp->dev); + newbus_xunlock(); } static void Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/sound/pci/hda/hdac.c Sun Aug 2 14:28:40 2009 (r196037) @@ -7435,6 +7435,7 @@ hdac_attach2(void *arg) quirks_on, quirks_off); ); + newbus_xlock(); hdac_lock(sc); /* Remove ourselves from the config hooks */ @@ -7674,6 +7675,7 @@ hdac_attach2(void *arg) SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)), OID_AUTO, "pindump", CTLTYPE_INT | CTLFLAG_RW, sc->dev, sizeof(sc->dev), sysctl_hdac_pindump, "I", "Dump pin states/data"); + newbus_xunlock(); } /**************************************************************************** Modified: head/sys/dev/twe/twe.c ============================================================================== --- head/sys/dev/twe/twe.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/twe/twe.c Sun Aug 2 14:28:40 2009 (r196037) @@ -294,8 +294,10 @@ twe_init(struct twe_softc *sc) /* * Scan for drives */ + newbus_xlock(); for (i = 0; i < TWE_MAX_UNITS; i++) twe_add_unit(sc, i); + newbus_xunlock(); /* * Initialise connection with controller. @@ -621,11 +623,15 @@ twe_ioctl(struct twe_softc *sc, int ioct break; case TWEIO_ADD_UNIT: + newbus_xlock(); error = twe_add_unit(sc, td->td_unit); + newbus_xunlock(); break; case TWEIO_DEL_UNIT: + newbus_xlock(); error = twe_del_unit(sc, td->td_unit); + newbus_xunlock(); break; /* XXX implement ATA PASSTHROUGH */ Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/usb/controller/usb_controller.c Sun Aug 2 14:28:40 2009 (r196037) @@ -143,9 +143,7 @@ usb_attach(device_t dev) } if (usb_post_init_called) { - mtx_lock(&Giant); usb_attach_sub(dev, bus); - mtx_unlock(&Giant); usb_needs_explore(bus, 1); } return (0); /* return success */ @@ -228,20 +226,13 @@ usb_bus_explore(struct usb_proc_msg *pm) } USB_BUS_UNLOCK(bus); - mtx_lock(&Giant); - /* * First update the USB power state! */ usb_bus_powerd(bus); - /* - * Explore the Root USB HUB. This call can sleep, - * exiting Giant, which is actually Giant. - */ - (udev->hub->explore) (udev); - - mtx_unlock(&Giant); + /* Explore the Root USB HUB. */ + (udev->hub->explore) (udev); USB_BUS_LOCK(bus); } if (bus->bus_roothold != NULL) { @@ -269,7 +260,7 @@ usb_bus_detach(struct usb_proc_msg *pm) device_set_softc(dev, NULL); USB_BUS_UNLOCK(bus); - mtx_lock(&Giant); + newbus_xlock(); /* detach children first */ bus_generic_detach(dev); @@ -281,7 +272,7 @@ usb_bus_detach(struct usb_proc_msg *pm) usb_free_device(udev, USB_UNCFG_FLAG_FREE_EP0); - mtx_unlock(&Giant); + newbus_xunlock(); USB_BUS_LOCK(bus); /* clear bdev variable last */ bus->bdev = NULL; @@ -350,7 +341,7 @@ usb_bus_attach(struct usb_proc_msg *pm) } USB_BUS_UNLOCK(bus); - mtx_lock(&Giant); /* XXX not required by USB */ + newbus_xlock(); /* default power_mask value */ bus->hw_power_state = @@ -383,7 +374,7 @@ usb_bus_attach(struct usb_proc_msg *pm) err = USB_ERR_NOMEM; } - mtx_unlock(&Giant); + newbus_xunlock(); USB_BUS_LOCK(bus); if (err) { @@ -472,7 +463,7 @@ usb_post_init(void *arg) int max; int n; - mtx_lock(&Giant); + newbus_xlock(); usb_devclass_ptr = devclass_find("usbus"); @@ -483,11 +474,8 @@ usb_post_init(void *arg) dev = devclass_get_device(dc, n); if (dev && device_is_attached(dev)) { bus = device_get_ivars(dev); - if (bus) { - mtx_lock(&Giant); + if (bus) usb_attach_sub(dev, bus); - mtx_unlock(&Giant); - } } } } else { @@ -499,7 +487,7 @@ usb_post_init(void *arg) usb_needs_explore_all(); - mtx_unlock(&Giant); + newbus_xunlock(); } SYSINIT(usb_post_init, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, usb_post_init, NULL); Modified: head/sys/dev/usb/input/ukbd.c ============================================================================== --- head/sys/dev/usb/input/ukbd.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/usb/input/ukbd.c Sun Aug 2 14:28:40 2009 (r196037) @@ -745,7 +745,7 @@ ukbd_attach(device_t dev) uint16_t n; uint16_t hid_len; - mtx_assert(&Giant, MA_OWNED); + mtx_lock(&Giant); kbd_init_struct(kbd, UKBD_DRIVER_NAME, KB_OTHER, unit, 0, 0, 0); @@ -854,9 +854,6 @@ ukbd_attach(device_t dev) if (bootverbose) { genkbd_diag(kbd, bootverbose); } - /* lock keyboard mutex */ - - mtx_lock(&Giant); /* start the keyboard */ @@ -879,7 +876,7 @@ ukbd_detach(device_t dev) struct ukbd_softc *sc = device_get_softc(dev); int error; - mtx_assert(&Giant, MA_OWNED); + mtx_lock(&Giant); DPRINTF("\n"); @@ -916,6 +913,8 @@ ukbd_detach(device_t dev) usb_callout_drain(&sc->sc_callout); + mtx_unlock(&Giant); + DPRINTF("%s: disconnected\n", device_get_nameunit(dev)); @@ -927,9 +926,9 @@ ukbd_resume(device_t dev) { struct ukbd_softc *sc = device_get_softc(dev); - mtx_assert(&Giant, MA_OWNED); - + mtx_lock(&Giant); ukbd_clear_state(&sc->sc_kbd); + mtx_unlock(&Giant); return (0); } Modified: head/sys/dev/usb/net/usb_ethernet.c ============================================================================== --- head/sys/dev/usb/net/usb_ethernet.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/usb/net/usb_ethernet.c Sun Aug 2 14:28:40 2009 (r196037) @@ -221,10 +221,10 @@ ue_attach_post_task(struct usb_proc_msg if (ue->ue_methods->ue_mii_upd != NULL && ue->ue_methods->ue_mii_sts != NULL) { - mtx_lock(&Giant); /* device_xxx() depends on this */ + newbus_xlock(); error = mii_phy_probe(ue->ue_dev, &ue->ue_miibus, ue_ifmedia_upd, ue->ue_methods->ue_mii_sts); - mtx_unlock(&Giant); + newbus_xunlock(); if (error) { device_printf(ue->ue_dev, "MII without any PHY\n"); goto error; @@ -279,9 +279,12 @@ uether_ifdetach(struct usb_ether *ue) /* detach miibus */ if (ue->ue_miibus != NULL) { - mtx_lock(&Giant); /* device_xxx() depends on this */ + + /* + * It is up to the callers to provide the correct + * newbus locking. + */ device_delete_child(ue->ue_dev, ue->ue_miibus); - mtx_unlock(&Giant); } /* detach ethernet */ Modified: head/sys/dev/usb/usb_compat_linux.c ============================================================================== --- head/sys/dev/usb/usb_compat_linux.c Sun Aug 2 14:25:26 2009 (r196036) +++ head/sys/dev/usb/usb_compat_linux.c Sun Aug 2 14:28:40 2009 (r196037) @@ -215,14 +215,12 @@ usb_linux_probe(device_t dev) if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); } - mtx_lock(&Giant); LIST_FOREACH(udrv, &usb_linux_driver_list, linux_driver_list) { if (usb_linux_lookup_id(udrv->id_table, uaa)) { err = 0; break; } } - mtx_unlock(&Giant); return (err); } @@ -239,9 +237,7 @@ usb_linux_get_usb_driver(struct usb_linu { struct usb_driver *udrv; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From julian at FreeBSD.org Sun Aug 2 16:59:03 2009 From: julian at FreeBSD.org (Julian Elischer) Date: Sun Aug 2 16:59:10 2009 Subject: svn commit: r196038 - head/sys/kern Message-ID: <200908021659.n72Gx23r019861@svn.freebsd.org> Author: julian Date: Sun Aug 2 16:59:02 2009 New Revision: 196038 URL: http://svn.freebsd.org/changeset/base/196038 Log: Stop uuidgen(2) from crashing in vimage kerenels. make curvnet valid when needed. Reviewed by: bz@ Approved by: re (kib) Modified: head/sys/kern/kern_uuid.c Modified: head/sys/kern/kern_uuid.c ============================================================================== --- head/sys/kern/kern_uuid.c Sun Aug 2 14:28:40 2009 (r196037) +++ head/sys/kern/kern_uuid.c Sun Aug 2 16:59:02 2009 (r196038) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -93,6 +94,7 @@ uuid_node(uint16_t *node) struct sockaddr_dl *sdl; int i; + CURVNET_SET(TD_TO_VNET(curthread)); IFNET_RLOCK(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { /* Walk the address list */ @@ -105,6 +107,7 @@ uuid_node(uint16_t *node) bcopy(LLADDR(sdl), node, UUID_NODE_LEN); IF_ADDR_UNLOCK(ifp); IFNET_RUNLOCK(); + CURVNET_RESTORE(); return; } } @@ -115,6 +118,7 @@ uuid_node(uint16_t *node) for (i = 0; i < (UUID_NODE_LEN>>1); i++) node[i] = (uint16_t)arc4random(); *((uint8_t*)node) |= 0x01; + CURVNET_RESTORE(); } /* From alfred at freebsd.org Sun Aug 2 19:29:03 2009 From: alfred at freebsd.org (Alfred Perlstein) Date: Sun Aug 2 19:29:09 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: References: <200907300014.n6U0EZ77086341@svn.freebsd.org> <20090731212140.GK47463@elvis.mu.org> <200908010615.02972.hselasky@c2i.net> Message-ID: <20090802192902.GS47463@elvis.mu.org> * Robert Watson [090801 15:15] wrote: > > On Sat, 1 Aug 2009, Hans Petter Selasky wrote: > > >>>This has slowed down core dumps very significantly. What used to take > >>>10-15s on my system now takes around 3 minutes. A simple test is to > >>>break into ddb and "call doadump" with or without this rev. I have a > >>>serial console on this machine and so I can use ddb whether the attached > >>>USB keyboard works or not. > > > >It's because there is a DELAY(1000) in the UKBD's polling routine so that > >key- repeating will work, no magic. > > Given a choice between dumping 10x faster and having automatic key repeat > in DDB, I'd lean towards the former. :-) > Robert, and *@freebsd.org, Hans should be back in a day or so to address this. If critical I can probably back out the offending code, but I think it makes sense to wait a few days more for a more comprehensive fix. -- - Alfred Perlstein .- AMA, VMOA #5191, 03 vmax, 92 gs500, 85 ch250 .- FreeBSD committer From rwatson at FreeBSD.org Sun Aug 2 19:43:33 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Aug 2 19:43:40 2009 Subject: svn commit: r196039 - in head/sys: contrib/pf/net dev/cxgb/ulp/tom net netinet netinet6 Message-ID: <200908021943.n72JhWKX023102@svn.freebsd.org> Author: rwatson Date: Sun Aug 2 19:43:32 2009 New Revision: 196039 URL: http://svn.freebsd.org/changeset/base/196039 Log: Many network stack subsystems use a single global data structure to hold all pertinent statatistics for the subsystem. These structures are sometimes "borrowed" by kernel modules that require a place to store statistics for similar events. Add KPI accessor functions for statistics structures referenced by kernel modules so that they no longer encode certain specifics of how the data structures are named and stored. This change is intended to make it easier to move to per-CPU network stats following 8.0-RELEASE. The following modules are affected by this change: if_bridge if_cxgb if_gif ip_mroute ipdivert pf In practice, most of these statistics consumers should, in fact, maintain their own statistics data structures rather than borrowing structures from the base network stack. However, that change is too agressive for this point in the release cycle. Reviewed by: bz Approved by: re (kib) Modified: head/sys/contrib/pf/net/pf.c head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c head/sys/net/if_bridge.c head/sys/netinet/icmp6.h head/sys/netinet/icmp_var.h head/sys/netinet/in_gif.c head/sys/netinet/ip_divert.c head/sys/netinet/ip_icmp.c head/sys/netinet/ip_input.c head/sys/netinet/ip_var.h head/sys/netinet/tcp_input.c head/sys/netinet/tcp_var.h head/sys/netinet/udp_usrreq.c head/sys/netinet/udp_var.h head/sys/netinet6/icmp6.c Modified: head/sys/contrib/pf/net/pf.c ============================================================================== --- head/sys/contrib/pf/net/pf.c Sun Aug 2 16:59:02 2009 (r196038) +++ head/sys/contrib/pf/net/pf.c Sun Aug 2 19:43:32 2009 (r196039) @@ -6141,7 +6141,7 @@ pf_route(struct mbuf **m, struct pf_rule if (r->rt == PF_FASTROUTE) { in_rtalloc(ro, 0); if (ro->ro_rt == 0) { - IPSTAT_INC(ips_noroute); + KMOD_IPSTAT_INC(ips_noroute); goto bad; } @@ -6272,16 +6272,16 @@ pf_route(struct mbuf **m, struct pf_rule if ((ifp->if_capabilities & IFCAP_CSUM_IPv4) && ifp->if_bridge == NULL) { m0->m_pkthdr.csum_flags |= M_IPV4_CSUM_OUT; - IPSTAT_INC(ips_outhwcsum); + KMOD_IPSTAT_INC(ips_outhwcsum); } else { ip->ip_sum = 0; ip->ip_sum = in_cksum(m0, ip->ip_hl << 2); } /* Update relevant hardware checksum stats for TCP/UDP */ if (m0->m_pkthdr.csum_flags & M_TCPV4_CSUM_OUT) - TCPSTAT_INC(tcpstat.tcps_outhwcsum); + KMOD_TCPSTAT_INC(tcps_outhwcsum); else if (m0->m_pkthdr.csum_flags & M_UDPV4_CSUM_OUT) - UDPSTAT_INC(udps_outhwcsum); + KMOD_UDPSTAT_INC(udps_outhwcsum); error = (*ifp->if_output)(ifp, m0, sintosa(dst), NULL); goto done; } @@ -6291,7 +6291,7 @@ pf_route(struct mbuf **m, struct pf_rule * Must be able to put at least 8 bytes per fragment. */ if (ip->ip_off & htons(IP_DF)) { - IPSTAT_INC(ips_cantfrag); + KMOD_IPSTAT_INC(ips_cantfrag); if (r->rt != PF_DUPTO) { #ifdef __FreeBSD__ /* icmp_error() expects host byte ordering */ @@ -6348,7 +6348,7 @@ pf_route(struct mbuf **m, struct pf_rule } if (error == 0) - IPSTAT_INC(ips_fragmented); + KMOD_IPSTAT_INC(ips_fragmented); done: if (r->rt != PF_DUPTO) @@ -6622,23 +6622,23 @@ pf_check_proto_cksum(struct mbuf *m, int switch (p) { case IPPROTO_TCP: { - TCPSTAT_INC(tcps_rcvbadsum); + KMOD_TCPSTAT_INC(tcps_rcvbadsum); break; } case IPPROTO_UDP: { - UDPSTAT_INC(udps_badsum); + KMOD_UDPSTAT_INC(udps_badsum); break; } case IPPROTO_ICMP: { - ICMPSTAT_INC(icps_checksum); + KMOD_ICMPSTAT_INC(icps_checksum); break; } #ifdef INET6 case IPPROTO_ICMPV6: { - ICMP6STAT_INC(icp6s_checksum); + KMOD_ICMP6STAT_INC(icp6s_checksum); break; } #endif /* INET6 */ @@ -6725,17 +6725,17 @@ pf_check_proto_cksum(struct mbuf *m, int m->m_pkthdr.csum_flags |= flag_bad; switch (p) { case IPPROTO_TCP: - TCPSTAT_INC(tcps_rcvbadsum); + KMOD_TCPSTAT_INC(tcps_rcvbadsum); break; case IPPROTO_UDP: - UDPSTAT_INC(udps_badsum); + KMOD_UDPSTAT_INC(udps_badsum); break; case IPPROTO_ICMP: - ICMPSTAT_INC(icps_checksum); + KMOD_ICMPSTAT_INC(icps_checksum); break; #ifdef INET6 case IPPROTO_ICMPV6: - ICMP6STAT_INC(icp6s_checksum); + KMOD_ICMP6STAT_INC(icp6s_checksum); break; #endif /* INET6 */ } Modified: head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c ============================================================================== --- head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c Sun Aug 2 16:59:02 2009 (r196038) +++ head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c Sun Aug 2 19:43:32 2009 (r196039) @@ -3821,7 +3821,7 @@ socket_act_establish(struct socket *so, #endif toep->tp_state = tp->t_state; - TCPSTAT_INC(tcps_connects); + KMOD_TCPSTAT_INC(tcps_connects); } Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Sun Aug 2 16:59:02 2009 (r196038) +++ head/sys/net/if_bridge.c Sun Aug 2 19:43:32 2009 (r196039) @@ -3244,12 +3244,12 @@ bridge_ip_checkbasic(struct mbuf **mp) if ((m = m_copyup(m, sizeof(struct ip), (max_linkhdr + 3) & ~3)) == NULL) { /* XXXJRT new stat, please */ - IPSTAT_INC(ips_toosmall); + KMOD_IPSTAT_INC(ips_toosmall); goto bad; } } else if (__predict_false(m->m_len < sizeof (struct ip))) { if ((m = m_pullup(m, sizeof (struct ip))) == NULL) { - IPSTAT_INC(ips_toosmall); + KMOD_IPSTAT_INC(ips_toosmall); goto bad; } } @@ -3257,17 +3257,17 @@ bridge_ip_checkbasic(struct mbuf **mp) if (ip == NULL) goto bad; if (ip->ip_v != IPVERSION) { - IPSTAT_INC(ips_badvers); + KMOD_IPSTAT_INC(ips_badvers); goto bad; } hlen = ip->ip_hl << 2; if (hlen < sizeof(struct ip)) { /* minimum header length */ - IPSTAT_INC(ips_badhlen); + KMOD_IPSTAT_INC(ips_badhlen); goto bad; } if (hlen > m->m_len) { if ((m = m_pullup(m, hlen)) == 0) { - IPSTAT_INC(ips_badhlen); + KMOD_IPSTAT_INC(ips_badhlen); goto bad; } ip = mtod(m, struct ip *); @@ -3284,7 +3284,7 @@ bridge_ip_checkbasic(struct mbuf **mp) } } if (sum) { - IPSTAT_INC(ips_badsum); + KMOD_IPSTAT_INC(ips_badsum); goto bad; } @@ -3295,7 +3295,7 @@ bridge_ip_checkbasic(struct mbuf **mp) * Check for additional length bogosity */ if (len < hlen) { - IPSTAT_INC(ips_badlen); + KMOD_IPSTAT_INC(ips_badlen); goto bad; } @@ -3305,7 +3305,7 @@ bridge_ip_checkbasic(struct mbuf **mp) * Drop packet if shorter than we expect. */ if (m->m_pkthdr.len < len) { - IPSTAT_INC(ips_tooshort); + KMOD_IPSTAT_INC(ips_tooshort); goto bad; } @@ -3418,7 +3418,7 @@ bridge_fragment(struct ifnet *ifp, struc } if (error == 0) - IPSTAT_INC(ips_fragmented); + KMOD_IPSTAT_INC(ips_fragmented); return (error); Modified: head/sys/netinet/icmp6.h ============================================================================== --- head/sys/netinet/icmp6.h Sun Aug 2 16:59:02 2009 (r196038) +++ head/sys/netinet/icmp6.h Sun Aug 2 19:43:32 2009 (r196039) @@ -600,8 +600,19 @@ struct icmp6stat { }; #ifdef _KERNEL +/* + * In-kernel consumers can use these accessor macros directly to update + * stats. + */ #define ICMP6STAT_ADD(name, val) V_icmp6stat.name += (val) #define ICMP6STAT_INC(name) ICMP6STAT_ADD(name, 1) + +/* + * Kernel module consumers must use this accessor macro. + */ +void kmod_icmp6stat_inc(int statnum); +#define KMOD_ICMP6STAT_INC(name) \ + kmod_icmp6stat_inc(offsetof(struct icmp6stat, name) / sizeof(u_quad_t)) #endif /* Modified: head/sys/netinet/icmp_var.h ============================================================================== --- head/sys/netinet/icmp_var.h Sun Aug 2 16:59:02 2009 (r196038) +++ head/sys/netinet/icmp_var.h Sun Aug 2 19:43:32 2009 (r196039) @@ -58,8 +58,19 @@ struct icmpstat { }; #ifdef _KERNEL +/* + * In-kernel consumers can use these accessor macros directly to update + * stats. + */ #define ICMPSTAT_ADD(name, val) V_icmpstat.name += (val) #define ICMPSTAT_INC(name) ICMPSTAT_ADD(name, 1) + +/* + * Kernel module consumers must use this accessor macro. + */ +void kmod_icmpstat_inc(int statnum); +#define KMOD_ICMPSTAT_INC(name) \ + kmod_icmpstat_inc(offsetof(struct icmpstat, name) / sizeof(u_long)) #endif /* Modified: head/sys/netinet/in_gif.c ============================================================================== --- head/sys/netinet/in_gif.c Sun Aug 2 16:59:02 2009 (r196038) +++ head/sys/netinet/in_gif.c Sun Aug 2 19:43:32 2009 (r196039) @@ -281,14 +281,14 @@ in_gif_input(struct mbuf *m, int off) sc = (struct gif_softc *)encap_getarg(m); if (sc == NULL) { m_freem(m); - IPSTAT_INC(ips_nogif); + KMOD_IPSTAT_INC(ips_nogif); return; } gifp = GIF2IFP(sc); if (gifp == NULL || (gifp->if_flags & IFF_UP) == 0) { m_freem(m); - IPSTAT_INC(ips_nogif); + KMOD_IPSTAT_INC(ips_nogif); return; } @@ -348,7 +348,7 @@ in_gif_input(struct mbuf *m, int off) break; default: - IPSTAT_INC(ips_nogif); + KMOD_IPSTAT_INC(ips_nogif); m_freem(m); return; } Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Sun Aug 2 16:59:02 2009 (r196038) +++ head/sys/netinet/ip_divert.c Sun Aug 2 19:43:32 2009 (r196039) @@ -186,7 +186,7 @@ void div_input(struct mbuf *m, int off) { - IPSTAT_INC(ips_noproto); + KMOD_IPSTAT_INC(ips_noproto); m_freem(m); } @@ -310,8 +310,8 @@ divert_packet(struct mbuf *m, int incomi INP_INFO_RUNLOCK(&V_divcbinfo); if (sa == NULL) { m_freem(m); - IPSTAT_INC(ips_noproto); - IPSTAT_DEC(ips_delivered); + KMOD_IPSTAT_INC(ips_noproto); + KMOD_IPSTAT_DEC(ips_delivered); } } @@ -396,7 +396,7 @@ div_output(struct socket *so, struct mbu ip->ip_off = ntohs(ip->ip_off); /* Send packet to output processing */ - IPSTAT_INC(ips_rawout); /* XXX */ + KMOD_IPSTAT_INC(ips_rawout); /* XXX */ #ifdef MAC mac_inpcb_create_mbuf(inp, m); @@ -567,7 +567,7 @@ div_send(struct socket *so, int flags, s /* Packet must have a header (but that's about it) */ if (m->m_len < sizeof (struct ip) && (m = m_pullup(m, sizeof (struct ip))) == 0) { - IPSTAT_INC(ips_toosmall); + KMOD_IPSTAT_INC(ips_toosmall); m_freem(m); return EINVAL; } Modified: head/sys/netinet/ip_icmp.c ============================================================================== --- head/sys/netinet/ip_icmp.c Sun Aug 2 16:59:02 2009 (r196038) +++ head/sys/netinet/ip_icmp.c Sun Aug 2 19:43:32 2009 (r196039) @@ -172,6 +172,20 @@ icmp_init(void) } /* + * Kernel module interface for updating icmpstat. The argument is an index + * into icmpstat treated as an array of u_long. While this encodes the + * general layout of icmpstat into the caller, it doesn't encode its + * location, so that future changes to add, for example, per-CPU stats + * support won't cause binary compatibility problems for kernel modules. + */ +void +kmod_icmpstat_inc(int statnum) +{ + + (*((u_long *)&V_icmpstat + statnum))++; +} + +/* * Generate an error packet of type error * in response to bad packet ip. */ Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Sun Aug 2 16:59:02 2009 (r196038) +++ head/sys/netinet/ip_input.c Sun Aug 2 19:43:32 2009 (r196039) @@ -235,6 +235,27 @@ VNET_DEFINE(int, fw_one_pass) = 1; static void ip_freef(struct ipqhead *, struct ipq *); +/* + * Kernel module interface for updating ipstat. The argument is an index + * into ipstat treated as an array of u_long. While this encodes the general + * layout of ipstat into the caller, it doesn't encode its location, so that + * future changes to add, for example, per-CPU stats support won't cause + * binary compatibility problems for kernel modules. + */ +void +kmod_ipstat_inc(int statnum) +{ + + (*((u_long *)&V_ipstat + statnum))++; +} + +void +kmod_ipstat_dec(int statnum) +{ + + (*((u_long *)&V_ipstat + statnum))--; +} + static int sysctl_netinet_intr_queue_maxlen(SYSCTL_HANDLER_ARGS) { Modified: head/sys/netinet/ip_var.h ============================================================================== --- head/sys/netinet/ip_var.h Sun Aug 2 16:59:02 2009 (r196038) +++ head/sys/netinet/ip_var.h Sun Aug 2 19:43:32 2009 (r196039) @@ -131,11 +131,25 @@ struct ipstat { #include +/* + * In-kernel consumers can use these accessor macros directly to update + * stats. + */ #define IPSTAT_ADD(name, val) V_ipstat.name += (val) #define IPSTAT_SUB(name, val) V_ipstat.name -= (val) #define IPSTAT_INC(name) IPSTAT_ADD(name, 1) #define IPSTAT_DEC(name) IPSTAT_SUB(name, 1) +/* + * Kernel module consumers must use this accessor macro. + */ +void kmod_ipstat_inc(int statnum); +#define KMOD_IPSTAT_INC(name) \ + kmod_ipstat_inc(offsetof(struct ipstat, name) / sizeof(u_long)) +void kmod_ipstat_dec(int statnum); +#define KMOD_IPSTAT_DEC(name) \ + kmod_ipstat_dec(offsetof(struct ipstat, name) / sizeof(u_long)) + /* flags passed to ip_output as last parameter */ #define IP_FORWARDING 0x1 /* most of ip header exists */ #define IP_RAWOUTPUT 0x2 /* raw ip header exists */ Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Sun Aug 2 16:59:02 2009 (r196038) +++ head/sys/netinet/tcp_input.c Sun Aug 2 19:43:32 2009 (r196039) @@ -217,6 +217,20 @@ static void tcp_newreno_partial_ack(str static void inline tcp_congestion_exp(struct tcpcb *); +/* + * Kernel module interface for updating tcpstat. The argument is an index + * into tcpstat treated as an array of u_long. While this encodes the + * general layout of tcpstat into the caller, it doesn't encode its location, + * so that future changes to add, for example, per-CPU stats support won't + * cause binary compatibility problems for kernel modules. + */ +void +kmod_tcpstat_inc(int statnum) +{ + + (*((u_long *)&V_tcpstat + statnum))++; +} + static void inline tcp_congestion_exp(struct tcpcb *tp) { Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Sun Aug 2 16:59:02 2009 (r196038) +++ head/sys/netinet/tcp_var.h Sun Aug 2 19:43:32 2009 (r196039) @@ -474,8 +474,19 @@ struct tcpstat { }; #ifdef _KERNEL +/* + * In-kernel consumers can use these accessor macros directly to update + * stats. + */ #define TCPSTAT_ADD(name, val) V_tcpstat.name += (val) #define TCPSTAT_INC(name) TCPSTAT_ADD(name, 1) + +/* + * Kernel module consumers must use this accessor macro. + */ +void kmod_tcpstat_inc(int statnum); +#define KMOD_TCPSTAT_INC(name) \ + kmod_tcpstat_inc(offsetof(struct tcpstat, name) / sizeof(u_long)) #endif /* Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Sun Aug 2 16:59:02 2009 (r196038) +++ head/sys/netinet/udp_usrreq.c Sun Aug 2 19:43:32 2009 (r196039) @@ -203,6 +203,20 @@ udp_init(void) EVENTHANDLER_PRI_ANY); } +/* + * Kernel module interface for updating udpstat. The argument is an index + * into udpstat treated as an array of u_long. While this encodes the + * general layout of udpstat into the caller, it doesn't encode its location, + * so that future changes to add, for example, per-CPU stats support won't + * cause binary compatibility problems for kernel modules. + */ +void +kmod_udpstat_inc(int statnum) +{ + + (*((u_long *)&V_udpstat + statnum))++; +} + int udp_newudpcb(struct inpcb *inp) { Modified: head/sys/netinet/udp_var.h ============================================================================== --- head/sys/netinet/udp_var.h Sun Aug 2 16:59:02 2009 (r196038) +++ head/sys/netinet/udp_var.h Sun Aug 2 19:43:32 2009 (r196039) @@ -91,8 +91,19 @@ struct udpstat { }; #ifdef _KERNEL +/* + * In-kernel consumers can use these accessor macros directly to update + * stats. + */ #define UDPSTAT_ADD(name, val) V_udpstat.name += (val) #define UDPSTAT_INC(name) UDPSTAT_ADD(name, 1) + +/* + * Kernel module consumers must use this accessor macro. + */ +void kmod_udpstat_inc(int statnum); +#define KMOD_UDPSTAT_INC(name) \ + kmod_udpstat_inc(offsetof(struct udpstat, name) / sizeof(u_long)) #endif /* Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Sun Aug 2 16:59:02 2009 (r196038) +++ head/sys/netinet6/icmp6.c Sun Aug 2 19:43:32 2009 (r196039) @@ -152,6 +152,20 @@ icmp6_init(void) V_icmp6errpps_count = 0; } +/* + * Kernel module interface for updating icmp6stat. The argument is an index + * into icmp6stat treated as an array of u_quad_t. While this encodes the + * general layout of icmp6stat into the caller, it doesn't encode its + * location, so that future changes to add, for example, per-CPU stats + * support won't cause binary compatibility problems for kernel modules. + */ +void +kmod_icmp6stat_inc(int statnum) +{ + + (*((u_quad_t *)&V_icmp6stat + statnum))++; +} + static void icmp6_errcount(struct icmp6errstat *stat, int type, int code) { From rwatson at FreeBSD.org Sun Aug 2 19:58:17 2009 From: rwatson at FreeBSD.org (Robert N. M. Watson) Date: Sun Aug 2 19:58:48 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <20090802192902.GS47463@elvis.mu.org> References: <200907300014.n6U0EZ77086341@svn.freebsd.org> <20090731212140.GK47463@elvis.mu.org> <200908010615.02972.hselasky@c2i.net> <20090802192902.GS47463@elvis.mu.org> Message-ID: <134A728D-F2F4-4951-81D8-704CC2DB6F9F@FreeBSD.org> On 2 Aug 2009, at 20:29, Alfred Perlstein wrote: > * Robert Watson [090801 15:15] wrote: >> >> On Sat, 1 Aug 2009, Hans Petter Selasky wrote: >> >>>>> This has slowed down core dumps very significantly. What used >>>>> to take >>>>> 10-15s on my system now takes around 3 minutes. A simple test >>>>> is to >>>>> break into ddb and "call doadump" with or without this rev. I >>>>> have a >>>>> serial console on this machine and so I can use ddb whether the >>>>> attached >>>>> USB keyboard works or not. >>> >>> It's because there is a DELAY(1000) in the UKBD's polling routine >>> so that >>> key- repeating will work, no magic. >> >> Given a choice between dumping 10x faster and having automatic key >> repeat >> in DDB, I'd lean towards the former. :-) >> > > Robert, and *@freebsd.org, > > Hans should be back in a day or so to address this. If critical I can > probably back out the offending code, but I think it makes sense to > wait a few days more for a more comprehensive fix. That's my feeling too -- however, I think it would be useful to generate a small concept test patch that disables the key repeat behavior and see if it restores some/all performance. Scott's argument suggests only some, but perhaps we'd get quite a bit, which is what we're looking for. We wouldn't commit the patch but it would let us know we're on the right track. Robert From rwatson at FreeBSD.org Sun Aug 2 22:47:08 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Aug 2 22:47:15 2009 Subject: svn commit: r196041 - head/sys/netinet Message-ID: <200908022247.n72Ml8n9026826@svn.freebsd.org> Author: rwatson Date: Sun Aug 2 22:47:08 2009 New Revision: 196041 URL: http://svn.freebsd.org/changeset/base/196041 Log: Add padding to struct inpcb, missed during our padding sweep earlier in the release cycle. Approved by: re (kensmith) Modified: head/sys/netinet/in_pcb.h Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Sun Aug 2 21:16:01 2009 (r196040) +++ head/sys/netinet/in_pcb.h Sun Aug 2 22:47:08 2009 (r196041) @@ -169,7 +169,8 @@ struct inpcb { u_char inp_ip_minttl; /* (i) minimum TTL or drop */ uint32_t inp_flowid; /* (x) flow id / queue id */ u_int inp_refcount; /* (i) refcount */ - void *inp_pspare[2]; /* (x) rtentry / general use */ + void *inp_pspare[4]; /* (x) rtentry / general use */ + u_int inp_ispare[4]; /* general use */ /* Local and foreign ports, local and foreign addr. */ struct in_conninfo inp_inc; /* (i/p) list for PCB's local port */ From hselasky at c2i.net Mon Aug 3 07:23:16 2009 From: hselasky at c2i.net (Hans Petter Selasky) Date: Mon Aug 3 07:23:28 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input (regression patch) Message-ID: <200908030923.12867.hselasky@c2i.net> Hi, Here is a patch to address the problem. Please test and report back. Works fine over here. http://perforce.freebsd.org/chv.cgi?CH=166957 MD5 (ukbd.c.diff) = 1e3c143942593b0ed4617d306a9d2ee2 cd /usr/src/sys/dev/usb/input/ cat ukbd.c.diff | patch --HPS -------------- next part -------------- A non-text attachment was scrubbed... Name: ukbd.c.diff Type: text/x-patch Size: 943 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20090803/faeb040b/ukbd.c.bin From imp at bsdimp.com Mon Aug 3 07:24:52 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Mon Aug 3 07:25:03 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <200908030827.21108.hselasky@c2i.net> References: <20090802192902.GS47463@elvis.mu.org> <134A728D-F2F4-4951-81D8-704CC2DB6F9F@FreeBSD.org> <200908030827.21108.hselasky@c2i.net> Message-ID: <20090803.012206.1492586399.imp@bsdimp.com> In message: <200908030827.21108.hselasky@c2i.net> Hans Petter Selasky writes: : On Sunday 02 August 2009 21:58:14 Robert N. M. Watson wrote: : > On 2 Aug 2009, at 20:29, Alfred Perlstein wrote: : > > * Robert Watson [090801 15:15] wrote: : > >> On Sat, 1 Aug 2009, Hans Petter Selasky wrote: : > >>>>> This has slowed down core dumps very significantly. What used : > >>>>> to take : > >>>>> 10-15s on my system now takes around 3 minutes. A simple test : > >>>>> is to : > >>>>> break into ddb and "call doadump" with or without this rev. I : > >>>>> have a : > >>>>> serial console on this machine and so I can use ddb whether the : > >>>>> attached : > >>>>> USB keyboard works or not. : > >>> : > >>> It's because there is a DELAY(1000) in the UKBD's polling routine : > >>> so that : > >>> key- repeating will work, no magic. : > >> : > >> Given a choice between dumping 10x faster and having automatic key : > >> repeat : > >> in DDB, I'd lean towards the former. :-) : > > : > > Robert, and *@freebsd.org, : > > : > > Hans should be back in a day or so to address this. If critical I can : > > probably back out the offending code, but I think it makes sense to : > > wait a few days more for a more comprehensive fix. : > : > That's my feeling too -- however, I think it would be useful to : > generate a small concept test patch that disables the key repeat : > behavior and see if it restores some/all performance. Scott's argument : > suggests only some, but perhaps we'd get quite a bit, which is what : > we're looking for. We wouldn't commit the patch but it would let us : > know we're on the right track. : : Hi, : : I'm back. : : I see two solutions: : : 1) Disable the timekeeping if no keys are pressed. : : 2) Second option is to use getmicrotime. Actually what I need is just a : millisecond time reference so I know when to repeat the last key. : : Any opinions? DELAY() or getmicrotime() ? I'd note the state at each poll, and if > 1ms has passed since the down event, I'd repeat. I wouldn't use DELAY at all to see if you needed to repeat: I'd let the clocking of the polling drive you here (eg, you know that someone else will call it a lot, so leverage that to avoid the delay). Warner From hselasky at c2i.net Mon Aug 3 07:27:28 2009 From: hselasky at c2i.net (Hans Petter Selasky) Date: Mon Aug 3 07:27:39 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <134A728D-F2F4-4951-81D8-704CC2DB6F9F@FreeBSD.org> References: <200907300014.n6U0EZ77086341@svn.freebsd.org> <20090802192902.GS47463@elvis.mu.org> <134A728D-F2F4-4951-81D8-704CC2DB6F9F@FreeBSD.org> Message-ID: <200908030827.21108.hselasky@c2i.net> On Sunday 02 August 2009 21:58:14 Robert N. M. Watson wrote: > On 2 Aug 2009, at 20:29, Alfred Perlstein wrote: > > * Robert Watson [090801 15:15] wrote: > >> On Sat, 1 Aug 2009, Hans Petter Selasky wrote: > >>>>> This has slowed down core dumps very significantly. What used > >>>>> to take > >>>>> 10-15s on my system now takes around 3 minutes. A simple test > >>>>> is to > >>>>> break into ddb and "call doadump" with or without this rev. I > >>>>> have a > >>>>> serial console on this machine and so I can use ddb whether the > >>>>> attached > >>>>> USB keyboard works or not. > >>> > >>> It's because there is a DELAY(1000) in the UKBD's polling routine > >>> so that > >>> key- repeating will work, no magic. > >> > >> Given a choice between dumping 10x faster and having automatic key > >> repeat > >> in DDB, I'd lean towards the former. :-) > > > > Robert, and *@freebsd.org, > > > > Hans should be back in a day or so to address this. If critical I can > > probably back out the offending code, but I think it makes sense to > > wait a few days more for a more comprehensive fix. > > That's my feeling too -- however, I think it would be useful to > generate a small concept test patch that disables the key repeat > behavior and see if it restores some/all performance. Scott's argument > suggests only some, but perhaps we'd get quite a bit, which is what > we're looking for. We wouldn't commit the patch but it would let us > know we're on the right track. Hi, I'm back. I see two solutions: 1) Disable the timekeeping if no keys are pressed. 2) Second option is to use getmicrotime. Actually what I need is just a millisecond time reference so I know when to repeat the last key. Any opinions? DELAY() or getmicrotime() ? --HPS From rwatson at FreeBSD.org Mon Aug 3 08:14:39 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Aug 3 08:14:45 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input (regression patch) In-Reply-To: <200908030923.12867.hselasky@c2i.net> References: <200908030923.12867.hselasky@c2i.net> Message-ID: On Mon, 3 Aug 2009, Hans Petter Selasky wrote: > Here is a patch to address the problem. Please test and report back. Works > fine over here. > > http://perforce.freebsd.org/chv.cgi?CH=166957 > > MD5 (ukbd.c.diff) = 1e3c143942593b0ed4617d306a9d2ee2 > > cd /usr/src/sys/dev/usb/input/ > cat ukbd.c.diff | patch I'm a bit surprised the timed key repeat in this patch would work properly in DDB, as microtime(9) relies on interrupts firing for updated timestamps. The availability of interrupts for polled input consumers varies, but in general this is not true (for example) at the DDB command prompt. Does this code work correctly when time stands still? Robert N M Watson Computer Laboratory University of Cambridge From ed at 80386.nl Mon Aug 3 08:28:40 2009 From: ed at 80386.nl (Ed Schouten) Date: Mon Aug 3 08:28:51 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input (regression patch) In-Reply-To: References: <200908030923.12867.hselasky@c2i.net> Message-ID: <20090803082838.GE1292@hoeg.nl> * Robert Watson wrote: > I'm a bit surprised the timed key repeat in this patch would work > properly in DDB, as microtime(9) relies on interrupts firing for > updated timestamps. The availability of interrupts for polled input > consumers varies, but in general this is not true (for example) at > the DDB command prompt. Does this code work correctly when time > stands still? Apart from that, who gives a *beep* about keyboard repeat while inside the debugger. I have to confess it would be irritating to press backspace multiple times, instead of holding the key pressed, but still, it's not worth it. -- Ed Schouten WWW: http://80386.nl/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20090803/4be7aa8e/attachment.pgp From hselasky at c2i.net Mon Aug 3 09:44:12 2009 From: hselasky at c2i.net (Hans Petter Selasky) Date: Mon Aug 3 09:44:29 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input (regression patch) In-Reply-To: <20090803082838.GE1292@hoeg.nl> References: <200908030923.12867.hselasky@c2i.net> <20090803082838.GE1292@hoeg.nl> Message-ID: <200908031129.06315.hselasky@c2i.net> On Monday 03 August 2009 10:28:38 Ed Schouten wrote: > * Robert Watson wrote: > > I'm a bit surprised the timed key repeat in this patch would work > > properly in DDB, as microtime(9) relies on interrupts firing for > > updated timestamps. The availability of interrupts for polled input > > consumers varies, but in general this is not true (for example) at > > the DDB command prompt. Does this code work correctly when time > > stands still? > > Apart from that, who gives a *beep* about keyboard repeat while inside > the debugger. I have to confess it would be irritating to press > backspace multiple times, instead of holding the key pressed, but still, > it's not worth it. I think getmicrotime relies on interrupts, while microtime doesn't. See "man microtime". --HPS From rwatson at FreeBSD.org Mon Aug 3 09:57:21 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Aug 3 09:57:28 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input (regression patch) In-Reply-To: <200908031129.06315.hselasky@c2i.net> References: <200908030923.12867.hselasky@c2i.net> <20090803082838.GE1292@hoeg.nl> <200908031129.06315.hselasky@c2i.net> Message-ID: On Mon, 3 Aug 2009, Hans Petter Selasky wrote: > On Monday 03 August 2009 10:28:38 Ed Schouten wrote: >> * Robert Watson wrote: >>> I'm a bit surprised the timed key repeat in this patch would work properly >>> in DDB, as microtime(9) relies on interrupts firing for updated >>> timestamps. The availability of interrupts for polled input consumers >>> varies, but in general this is not true (for example) at the DDB command >>> prompt. Does this code work correctly when time stands still? >> >> Apart from that, who gives a *beep* about keyboard repeat while inside the >> debugger. I have to confess it would be irritating to press backspace >> multiple times, instead of holding the key pressed, but still, it's not >> worth it. > > I think getmicrotime relies on interrupts, while microtime doesn't. > > See "man microtime". You're right, but that doesn't make things better :-). Some of the tc_get_timecount() calls are safe in the DDB environment, but several are not. In particular, tick_get_timecount_mp() and i8254_get_timecount() both acquire locks, the former the thread scheduler lock, and the latter a dedicated spinlock. This produces the opportunity for rather nasty deadlocks in DDB, especially tick_get_timecount_mp() on sparc64. This was the bug I was actually looking for in your patch, but then misread microtime() and concluded you had a different one. :-) I would much rather not have DDB rely on, for example, not contending thread_lock(), than have key repeat in DDB. Robert N M Watson Computer Laboratory University of Cambridge From brde at optusnet.com.au Mon Aug 3 17:46:32 2009 From: brde at optusnet.com.au (Bruce Evans) Date: Mon Aug 3 17:46:38 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <20090803.012206.1492586399.imp@bsdimp.com> References: <20090802192902.GS47463@elvis.mu.org> <134A728D-F2F4-4951-81D8-704CC2DB6F9F@FreeBSD.org> <200908030827.21108.hselasky@c2i.net> <20090803.012206.1492586399.imp@bsdimp.com> Message-ID: <20090804032402.J21599@delplex.bde.org> On Mon, 3 Aug 2009, M. Warner Losh wrote: > In message: <200908030827.21108.hselasky@c2i.net> > : I see two solutions: > : > : 1) Disable the timekeeping if no keys are pressed. > : > : 2) Second option is to use getmicrotime. Actually what I need is just a > : millisecond time reference so I know when to repeat the last key. > : > : Any opinions? DELAY() or getmicrotime() ? DELAY(1) is somewhet usable. getmicrotime() is unusable because apart from the problems from it using microtime() (actually binuptime()), getmicrotime() has is only updated every 1/HZ seconds and depends on interrupts for the update. 1/HZ may usefully be as high as 1/10 seconds, and the update would never occur in ddb mode. microtime() is not a supported API in ddb or panic mode, but it works for short delays in most cases. Short means however long it takes for the hardware counter to wrap. See another reply for more details. binuptime() is better than microtime() for most purposes. Another problem with microtime() is that it is not guaranteed to be monotonic. The patch using microtime() has mounds of style bugs (mainly an empty line after almost every comment and statement). > I'd note the state at each poll, and if > 1ms has passed since the > down event, I'd repeat. I wouldn't use DELAY at all to see if you > needed to repeat: I'd let the clocking of the polling drive you here > (eg, you know that someone else will call it a lot, so leverage that > to avoid the delay). Determining whether 1 mS has elapsed is not supported in ddb or panic mode by any API, except microtime() usually works (see above). For polled console input (not necessarily in ddb or panic mode). It shouldn't be necessary for the low-level driver to spin internally, since cngetc() spins externally. ddb mode is the only mode that actually works almost right here: ddb disables all interrupts and stops all other CPUs, so interrupts and other CPUs can't eat the input. However, state changes to set up for polling, if any, should occur at a higher level (on entry to ddb for ddb mode), not on every call to cncheckc() or even on every call to cngetc(). The changes would be device-specific and wouldn't depend on disabling all interrupts and stopping all other CPUs. Then all modes would work (of fail) similarly to ddb mode. Bruce From brde at optusnet.com.au Mon Aug 3 18:20:18 2009 From: brde at optusnet.com.au (Bruce Evans) Date: Mon Aug 3 18:20:30 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input (regression patch) In-Reply-To: References: <200908030923.12867.hselasky@c2i.net> <20090803082838.GE1292@hoeg.nl> <200908031129.06315.hselasky@c2i.net> Message-ID: <20090804034625.I21599@delplex.bde.org> On Mon, 3 Aug 2009, Robert Watson wrote: > On Mon, 3 Aug 2009, Hans Petter Selasky wrote: >> I think getmicrotime relies on interrupts, while microtime doesn't. >> >> See "man microtime". > > You're right, but that doesn't make things better :-). Some of the > tc_get_timecount() calls are safe in the DDB environment, but several are > not. In particular, tick_get_timecount_mp() and i8254_get_timecount() both > acquire locks, the former the thread scheduler lock, and the latter a > dedicated spinlock. This produces the opportunity for rather nasty deadlocks > in DDB, especially tick_get_timecount_mp() on sparc64. Hmm, why does tick_get_timecount_mp() need to bind curthread? (I don't understand sparc64.) Any hardware clock potentially needs locking like that in i8254_get_timecount(), but most hardware is not so bad. DELAY() also wants to use the i8254 in some configurations. On amd64 and i386, it uses a hack to avoid the lock in ddb mode. Deadlock from not doing this rarely occurred, and deadlock on the thread lock would be more common. tc_get_timecount() calls could do something similar in some cases. E.g., tick_get_timecount_mp() can just skip the locking since entering ddb mode is stronger than sched binding, but i8254_get_timecount() cannot do this safely so easily since it needs to write to the hardware and the hardware has write-only state (the state would have to be shadowed in memory). Another problem with using microtime() is that the timecounter hardware might wrap after a short time. Again the i8254 timecounter is a problem. At HZ=1000, it wraps after 1mS. This can be handled by polling spinloops if necessary by calling microtime() enough to detect all wraps and adding up deltas of microtime()s to get the elapsed time. Apart from deadlock, just calling mutex locking code from within ddb is not supported (but it happens anywyay :-()). > This was the bug I was actually looking for in your patch, but then misread > microtime() and concluded you had a different one. :-) I would much rather > not have DDB rely on, for example, not contending thread_lock(), than have > key repeat in DDB. If cngetc() worked right then you would also not have key repeat for polled input outside of ddb :-), but polled input is probably used more in ddb than anywhere else (e.g., for booting), so you would probably miss it mainly in ddb. Bruce From hselasky at c2i.net Mon Aug 3 18:33:13 2009 From: hselasky at c2i.net (Hans Petter Selasky) Date: Mon Aug 3 18:33:19 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <20090804032402.J21599@delplex.bde.org> References: <20090802192902.GS47463@elvis.mu.org> <20090803.012206.1492586399.imp@bsdimp.com> <20090804032402.J21599@delplex.bde.org> Message-ID: <200908032033.08169.hselasky@c2i.net> On Monday 03 August 2009 19:46:16 Bruce Evans wrote: > On Mon, 3 Aug 2009, M. Warner Losh wrote: > > In message: <200908030827.21108.hselasky@c2i.net> > > > > : I see two solutions: > > : > > : 1) Disable the timekeeping if no keys are pressed. > > : > > : 2) Second option is to use getmicrotime. Actually what I need is just a > > : millisecond time reference so I know when to repeat the last key. > > : > > : Any opinions? DELAY() or getmicrotime() ? > > DELAY(1) is somewhet usable. I think DELAY(1) is not accurate enough. I suggest that the DELAY(1000) is only active while a key is actually pressed. See attached patch. Please test and report back. --HPS > > getmicrotime() is unusable because apart from the problems from it using > microtime() (actually binuptime()), getmicrotime() has is only updated > every 1/HZ seconds and depends on interrupts for the update. 1/HZ may > usefully be as high as 1/10 seconds, and the update would never occur > in ddb mode. > > microtime() is not a supported API in ddb or panic mode, but it works > for short delays in most cases. Short means however long it takes for > the hardware counter to wrap. See another reply for more details. > > binuptime() is better than microtime() for most purposes. Another > problem with microtime() is that it is not guaranteed to be monotonic. > > The patch using microtime() has mounds of style bugs (mainly an empty > line after almost every comment and statement). > > > I'd note the state at each poll, and if > 1ms has passed since the > > down event, I'd repeat. I wouldn't use DELAY at all to see if you > > needed to repeat: I'd let the clocking of the polling drive you here > > (eg, you know that someone else will call it a lot, so leverage that > > to avoid the delay). > > Determining whether 1 mS has elapsed is not supported in ddb or panic > mode by any API, except microtime() usually works (see above). > > For polled console input (not necessarily in ddb or panic mode). It > shouldn't be necessary for the low-level driver to spin internally, > since cngetc() spins externally. ddb mode is the only mode that > actually works almost right here: ddb disables all interrupts and stops > all other CPUs, so interrupts and other CPUs can't eat the input. > However, state changes to set up for polling, if any, should occur at > a higher level (on entry to ddb for ddb mode), not on every call to > cncheckc() or even on every call to cngetc(). The changes would be > device-specific and wouldn't depend on disabling all interrupts and > stopping all other CPUs. Then all modes would work (of fail) similarly > to ddb mode. > > Bruce -------------- next part -------------- A non-text attachment was scrubbed... Name: ukbd.c.diff Type: text/x-patch Size: 726 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20090803/39e957dc/ukbd.c.bin From rwatson at FreeBSD.org Mon Aug 3 18:46:26 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Aug 3 18:46:37 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <200908032033.08169.hselasky@c2i.net> References: <20090802192902.GS47463@elvis.mu.org> <20090803.012206.1492586399.imp@bsdimp.com> <20090804032402.J21599@delplex.bde.org> <200908032033.08169.hselasky@c2i.net> Message-ID: On Mon, 3 Aug 2009, Hans Petter Selasky wrote: > On Monday 03 August 2009 19:46:16 Bruce Evans wrote: >> On Mon, 3 Aug 2009, M. Warner Losh wrote: >>> In message: <200908030827.21108.hselasky@c2i.net> >>> >>> : I see two solutions: >>> : >>> : 1) Disable the timekeeping if no keys are pressed. >>> : >>> : 2) Second option is to use getmicrotime. Actually what I need is just a >>> : millisecond time reference so I know when to repeat the last key. >>> : >>> : Any opinions? DELAY() or getmicrotime() ? >> >> DELAY(1) is somewhet usable. > > I think DELAY(1) is not accurate enough. > > I suggest that the DELAY(1000) is only active while a key is actually > pressed. > > See attached patch. Please test and report back. This seems a reasonable middle ground -- avoids use of sensitive time counters in DDB, avoids expensive poll operation most of the time, and allows key repeat to work, which is especially nice for backspace in DDB. :-) Robert From nwhitehorn at freebsd.org Mon Aug 3 18:50:07 2009 From: nwhitehorn at freebsd.org (Nathan Whitehorn) Date: Mon Aug 3 18:50:39 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <200908032033.08169.hselasky@c2i.net> References: <20090802192902.GS47463@elvis.mu.org> <20090803.012206.1492586399.imp@bsdimp.com> <20090804032402.J21599@delplex.bde.org> <200908032033.08169.hselasky@c2i.net> Message-ID: <4A77315A.3050606@freebsd.org> Hans Petter Selasky wrote: > On Monday 03 August 2009 19:46:16 Bruce Evans wrote: > >> On Mon, 3 Aug 2009, M. Warner Losh wrote: >> >>> In message: <200908030827.21108.hselasky@c2i.net> >>> >>> : I see two solutions: >>> : >>> : 1) Disable the timekeeping if no keys are pressed. >>> : >>> : 2) Second option is to use getmicrotime. Actually what I need is just a >>> : millisecond time reference so I know when to repeat the last key. >>> : >>> : Any opinions? DELAY() or getmicrotime() ? >>> >> DELAY(1) is somewhet usable. >> > > I think DELAY(1) is not accurate enough. > > I suggest that the DELAY(1000) is only active while a key is actually pressed. > > See attached patch. Please test and report back. > Having recently written a keyboard driver, it is silly that the keyboard driver itself has to handle key repeat at all -- this kind of thing should be in the general kdb driver, along with AT KBD scancode emulation. Of the four keyboard drivers currently in the tree, three (sunkbd, akbd, ukbd) have a huge amount of code copied and pasted between them in order to emulate an AT keyboard, which are becoming less and less common. -Nathan From sam at errno.com Mon Aug 3 19:02:25 2009 From: sam at errno.com (Sam Leffler) Date: Mon Aug 3 19:02:31 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: References: <20090802192902.GS47463@elvis.mu.org> <20090803.012206.1492586399.imp@bsdimp.com> <20090804032402.J21599@delplex.bde.org> <200908032033.08169.hselasky@c2i.net> Message-ID: <4A773430.2050804@errno.com> Robert Watson wrote: > > On Mon, 3 Aug 2009, Hans Petter Selasky wrote: > >> On Monday 03 August 2009 19:46:16 Bruce Evans wrote: >>> On Mon, 3 Aug 2009, M. Warner Losh wrote: >>>> In message: <200908030827.21108.hselasky@c2i.net> >>>> >>>> : I see two solutions: >>>> : >>>> : 1) Disable the timekeeping if no keys are pressed. >>>> : >>>> : 2) Second option is to use getmicrotime. Actually what I need is >>>> just a >>>> : millisecond time reference so I know when to repeat the last key. >>>> : >>>> : Any opinions? DELAY() or getmicrotime() ? >>> >>> DELAY(1) is somewhet usable. >> >> I think DELAY(1) is not accurate enough. >> >> I suggest that the DELAY(1000) is only active while a key is actually >> pressed. >> >> See attached patch. Please test and report back. > > This seems a reasonable middle ground -- avoids use of sensitive time > counters in DDB, avoids expensive poll operation most of the time, and > allows key repeat to work, which is especially nice for backspace in > DDB. :-) I think we are losing sight of the goal here. We are in a release schedule and trying to find a minimal set of changes that resolves our immediate need. Keyboard repeat is not required and unless there is an obvious and immediate solution it should be considered AFTER the release. Remember we are already behind schedule for 8.0. Sam From np at FreeBSD.org Tue Aug 4 03:14:07 2009 From: np at FreeBSD.org (Navdeep Parhar) Date: Tue Aug 4 03:14:19 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <200908032033.08169.hselasky@c2i.net> References: <20090802192902.GS47463@elvis.mu.org> <20090803.012206.1492586399.imp@bsdimp.com> <20090804032402.J21599@delplex.bde.org> <200908032033.08169.hselasky@c2i.net> Message-ID: <20090804031407.GA8974@hub.freebsd.org> On Mon, Aug 03, 2009 at 08:33:04PM +0200, Hans Petter Selasky wrote: > On Monday 03 August 2009 19:46:16 Bruce Evans wrote: > > On Mon, 3 Aug 2009, M. Warner Losh wrote: > > > In message: <200908030827.21108.hselasky@c2i.net> > > > > > > : I see two solutions: > > > : > > > : 1) Disable the timekeeping if no keys are pressed. > > > : > > > : 2) Second option is to use getmicrotime. Actually what I need is just a > > > : millisecond time reference so I know when to repeat the last key. > > > : > > > : Any opinions? DELAY() or getmicrotime() ? > > > > DELAY(1) is somewhet usable. > > I think DELAY(1) is not accurate enough. > > I suggest that the DELAY(1000) is only active while a key is actually pressed. > > See attached patch. Please test and report back. This patch fixes my problem. The machine is remote and I'm unable to test whether the USB keyboard and keystroke repetition works, but core dumps to a SATA disk are now as fast as they were before r195960. Thanks. Regards, Navdeep From bms at incunabulum.net Tue Aug 4 07:57:41 2009 From: bms at incunabulum.net (Bruce Simpson) Date: Tue Aug 4 07:57:53 2009 Subject: svn commit: r196039 - in head/sys: contrib/pf/net dev/cxgb/ulp/tom net netinet netinet6 In-Reply-To: <200908021943.n72JhWKX023102@svn.freebsd.org> References: <200908021943.n72JhWKX023102@svn.freebsd.org> Message-ID: <4A77E9F1.6040407@incunabulum.net> Hey Robert, I didn't see any changes which directly touched ip_mroute in this rev. Can you clarify how this touches ip_mroute? It wasn't obvious from the diff. thanks, BMS Robert Watson wrote: > Log: > Many network stack subsystems use a single global data structure to hold > all pertinent statatistics for the subsystem. These structures are > sometimes "borrowed" by kernel modules that require a place to store > statistics for similar events. > ... > The following modules are affected by this change: > > if_bridge > if_cxgb > if_gif > ip_mroute > From rwatson at FreeBSD.org Tue Aug 4 08:26:51 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Tue Aug 4 08:27:05 2009 Subject: svn commit: r196039 - in head/sys: contrib/pf/net dev/cxgb/ulp/tom net netinet netinet6 In-Reply-To: <4A77E9F1.6040407@incunabulum.net> References: <200908021943.n72JhWKX023102@svn.freebsd.org> <4A77E9F1.6040407@incunabulum.net> Message-ID: On Tue, 4 Aug 2009, Bruce Simpson wrote: > I didn't see any changes which directly touched ip_mroute in this rev. Can > you clarify how this touches ip_mroute? It wasn't obvious from the diff. You're right, it was included in error. ip_mroute is on the list of modules that uses a stats structure with an accessor macro, but that structure make it onto the list of structures requiring accessor functions because it's accessed only from within ip_mroute (actually, two such functions/macros). I must have made a transcription error when writing up the commit message. My notes on accessor macros and files that consume them below. Robert Defined Used ------- ---- ICMPSTAT_ADD icmp_var.h icmp_var.h ICMPSTAT_INC icmp_var.h ip_icmp.c, *pf.c IGMPSTAT_ADD igmp_var.h igmp_var.h IGMPSTAT_INC igmp_var.h igmp.c MRTSTAT_ADD ip_mroute.h ip_mroute.h MRTSTAT_INC ip_mroute.h *ip_mroute.c IPSTAT_ADD ip_var.h ip_var.h, ip_output.c, IPSTAT_SUB ip_var.h ip_var.h IPSTAT_INC ip_var.h raw_ip.c, *ip_divert.c, ip_output.c, ip_input.c, ip_ipsec.c, *in_gif.c, igmp.c, ip_options.c, ip_fastfwd.c, udp_usrreq.c, *if_bridge.c, *pf.c, ip_var.h IPSTAT_DEC ip_var.h raw_ip.c, *ip_divert.c, ip_var.h PIMSTAT_ADD pim_var.h *ip_mroute.c, pim_var.h PIMSTAT_INC pim_var.h *ip_mroute.c UDPSTAT_ADD udp_var.h udp_var.h UDPSTAT_INC udp_var.h udp_usrreq.c, udp6_usrreq.c, *pf.c TCPSTAT_ADD tcp_var.h tcp_input.c, tcp_reass.c, tcp_output.c, tcp_var.h TCPSTAT_INC tcp_var.h tcp_input.c, tcp_subr.c, tcp_reass.c, tcp_timer.c, tcp_sack.c, tcp_output.c, tcp_hostcache.c, tcp_syncache.c, tcp_usrreq.c, tcp_timewait.c, *cxgb_cpl_io.c, *pf.c IP6STAT_ADD ip6_var.h ip6_var.h IP6STAT_SUB ip6_var.h ip6_var.h IP6STAT_INC ip6_var.h raw_ip6.c, icmp6.c, udp6_usrreq.c, mld6.c, ip6_input.c IP6STAT_DEC ip6_var.h icmp6.c CARPSTATS_ADD ip_carp.h ip_carp.h CARPSTATS_INC ip_carp.h ip_carp.c ICMP6STAT_ADD icmp6.h icmp6.h ICMP6STAT_INC icmp6.h raw_ip6.c icmp6.c nd6.c nd6_nbr.c mld6.c nd6_rtr.c *pf.c * Files that are built into kernel modules. Things that use things they shouldn't: pf.c: ICMPSTAT_INC, IPSTAT_INC, UDPSTAT_INC, TCPSTAT_INC ip_divert.c: IPSTAT_INC, IPSTAT_DEC in_gif.c: IPSTAT_INC if_bridge.c: IPSTAT_INC cxgb_cpl_io.c: TCPSTAT_INC From brde at optusnet.com.au Tue Aug 4 08:55:27 2009 From: brde at optusnet.com.au (Bruce Evans) Date: Tue Aug 4 08:55:39 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <200908032033.08169.hselasky@c2i.net> References: <20090802192902.GS47463@elvis.mu.org> <20090803.012206.1492586399.imp@bsdimp.com> <20090804032402.J21599@delplex.bde.org> <200908032033.08169.hselasky@c2i.net> Message-ID: <20090804183824.J928@besplex.bde.org> On Mon, 3 Aug 2009, Hans Petter Selasky wrote: > On Monday 03 August 2009 19:46:16 Bruce Evans wrote: >> On Mon, 3 Aug 2009, M. Warner Losh wrote: >>> In message: <200908030827.21108.hselasky@c2i.net> >>> >>> : I see two solutions: >>> : >>> : 1) Disable the timekeeping if no keys are pressed. >>> : >>> : 2) Second option is to use getmicrotime. Actually what I need is just a >>> : millisecond time reference so I know when to repeat the last key. >>> : >>> : Any opinions? DELAY() or getmicrotime() ? >> >> DELAY(1) is somewhet usable. > > I think DELAY(1) is not accurate enough. Indeed. But DELAY(10) is probably accurate enough, and certainly efficient enough (though ugly) since the atkbd device has used DELAY(7) and DELAY(20) for a long time without anyone noticing this slowing down disk i/o. It would take about 100 active console input drivers doing DELAY(10)'s to accumulate a delay of 1 mS. > I suggest that the DELAY(1000) is only active while a key is actually pressed. > > See attached patch. Please test and report back. Better. Bruce From bms at incunabulum.net Tue Aug 4 09:34:41 2009 From: bms at incunabulum.net (Bruce Simpson) Date: Tue Aug 4 09:34:47 2009 Subject: svn commit: r196039 - in head/sys: contrib/pf/net dev/cxgb/ulp/tom net netinet netinet6 In-Reply-To: References: <200908021943.n72JhWKX023102@svn.freebsd.org> <4A77E9F1.6040407@incunabulum.net> Message-ID: <4A7800AB.8030907@incunabulum.net> Robert Watson wrote: > > You're right, it was included in error. ip_mroute is on the list of > modules that uses a stats structure with an accessor macro, but that > structure make it onto the list of structures requiring accessor > functions because it's accessed only from within ip_mroute (actually, > two such functions/macros). I must have made a transcription error > when writing up the commit message. My notes on accessor macros and > files that consume them below. No worries, I was just going 'Hurm hah hurm wtf'. :-) From tom at tomjudge.com Thu Aug 6 16:24:04 2009 From: tom at tomjudge.com (Tom Judge) Date: Thu Aug 6 16:24:10 2009 Subject: svn commit: r189117 - head/sys/dev/bce In-Reply-To: <20090721145559.d2cf3f0b.stas@FreeBSD.org> References: <200902271925.n1RJP699080658@svn.freebsd.org> <20090721145559.d2cf3f0b.stas@FreeBSD.org> Message-ID: <4A7AFFC4.5050607@tomjudge.com> Hi, Stanislav Sedov wrote: > On Fri, 27 Feb 2009 19:25:06 +0000 (UTC) > David Christensen mentioned: > > >> Author: davidch >> Date: Fri Feb 27 19:25:06 2009 >> New Revision: 189117 >> URL: http://svn.freebsd.org/changeset/base/189117 >> >> Log: >> - Update copyright to 2009. >> - Only enable split header operation when ZERO_COPY_SOCKETS is enabled in >> the kernel. >> >> > > Hi, David! > > It appears that this change leads to excessive memory fragmentation due to > large number of 9k contiguous buffers allocations performed. I noticed > that under the relatively high load this can quickly lead to inability to send > any packets via bce(4) even on machines with high amount of memory (16 Gb). > I've been running with this change backed out for a long time and I don't > see any problems with this driver with last changes applied. > > I can confirm that we are also seeing this problem on a number of Dell PE2950 systems running the bce driver from 7.2, the bug is more visible/producible on systems that are using Jumbo Frames (in our case 8Kb). The symptoms of this are an increase in the requests for jumbo clusters denied counter at 9k, and then random network stalls which sometimes recover on there own and others require a reboot. We have backed this change and so far it seems to have fixed the issue. Regards Tom Judge From nparhar at gmail.com Thu Aug 6 19:47:20 2009 From: nparhar at gmail.com (Navdeep Parhar) Date: Thu Aug 6 19:47:31 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <20090804031407.GA8974@hub.freebsd.org> References: <20090802192902.GS47463@elvis.mu.org> <20090803.012206.1492586399.imp@bsdimp.com> <20090804032402.J21599@delplex.bde.org> <200908032033.08169.hselasky@c2i.net> <20090804031407.GA8974@hub.freebsd.org> Message-ID: >> >> See attached patch. Please test and report back. > > This patch fixes my problem. ?The machine is remote and I'm unable > to test whether the USB keyboard and keystroke repetition works, but > core dumps to a SATA disk are now as fast as they were before > r195960. ?Thanks. I finally got a chance to try a USB keyboard with ddb, and things did not go too well overall. While inside ddb, keystrokes were recognized properly and repetition worked too. But after exiting ddb, the keyboard wouldn't work - there wasn't any visible response to keystrokes. Also, I kept seeing the login prompt continually scroll up, as if someone was pressing repeatedly. It certainly wasn't me :-) Are you assuming that a user will not resume normal operation after entering the debugger? A panic/reboot isn't the only exit route from ddb..... Simple sequence of steps to reproduce problem: ctrl-alt-esc on the USB keyboard db> c Regards, Navdeep From hselasky at c2i.net Fri Aug 7 06:30:50 2009 From: hselasky at c2i.net (Hans Petter Selasky) Date: Fri Aug 7 06:31:28 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: References: <20090802192902.GS47463@elvis.mu.org> <20090804031407.GA8974@hub.freebsd.org> Message-ID: <200908070830.47894.hselasky@c2i.net> On Thursday 06 August 2009 21:47:16 Navdeep Parhar wrote: > >> See attached patch. Please test and report back. > > > > This patch fixes my problem. The machine is remote and I'm unable > > to test whether the USB keyboard and keystroke repetition works, but > > core dumps to a SATA disk are now as fast as they were before > > r195960. Thanks. > > I finally got a chance to try a USB keyboard with ddb, and things did > not go too well overall. While inside ddb, keystrokes were recognized > properly and repetition worked too. But after exiting ddb, the > keyboard wouldn't work - there wasn't any visible response to > keystrokes. Also, I kept seeing the login prompt continually scroll > up, as if someone was pressing repeatedly. It certainly > wasn't me :-) > > Are you assuming that a user will not resume normal operation after > entering the debugger? A panic/reboot isn't the only exit route from > ddb..... > > Simple sequence of steps to reproduce problem: > ctrl-alt-esc on the USB keyboard > db> c This is like expected. Once paniced, USB operation is blocked on the USB controller which the keyboard belongs to, because USB does not receive any polling-complete call, so that it can clean up the state in the USB controller! This mainly has to do with avoid calling wakeup() during polling. To avoid wakeup() calls, USB sets some bits, which must be cleared when polling is complete, which is currently not done, because USB doesn't know when polling is complete ... --HPS From imp at bsdimp.com Fri Aug 7 06:57:30 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Fri Aug 7 06:57:42 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <200908070830.47894.hselasky@c2i.net> References: <20090804031407.GA8974@hub.freebsd.org> <200908070830.47894.hselasky@c2i.net> Message-ID: <20090807.005400.-1749708164.imp@bsdimp.com> In message: <200908070830.47894.hselasky@c2i.net> Hans Petter Selasky writes: : On Thursday 06 August 2009 21:47:16 Navdeep Parhar wrote: : > >> See attached patch. Please test and report back. : > > : > > This patch fixes my problem. The machine is remote and I'm unable : > > to test whether the USB keyboard and keystroke repetition works, but : > > core dumps to a SATA disk are now as fast as they were before : > > r195960. Thanks. : > : > I finally got a chance to try a USB keyboard with ddb, and things did : > not go too well overall. While inside ddb, keystrokes were recognized : > properly and repetition worked too. But after exiting ddb, the : > keyboard wouldn't work - there wasn't any visible response to : > keystrokes. Also, I kept seeing the login prompt continually scroll : > up, as if someone was pressing repeatedly. It certainly : > wasn't me :-) : > : > Are you assuming that a user will not resume normal operation after : > entering the debugger? A panic/reboot isn't the only exit route from : > ddb..... : > : > Simple sequence of steps to reproduce problem: : > ctrl-alt-esc on the USB keyboard : > db> c : : This is like expected. : : Once paniced, USB operation is blocked on the USB controller which the : keyboard belongs to, because USB does not receive any polling-complete call, : so that it can clean up the state in the USB controller! This mainly has to do : with avoid calling wakeup() during polling. : : To avoid wakeup() calls, USB sets some bits, which must be cleared when : polling is complete, which is currently not done, because USB doesn't know : when polling is complete ... Polling isn't supposed to work like this... The rest of the system effects a poll without these side effects. Warner From nparhar at gmail.com Fri Aug 7 06:57:50 2009 From: nparhar at gmail.com (Navdeep Parhar) Date: Fri Aug 7 06:58:02 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <200908070830.47894.hselasky@c2i.net> References: <20090802192902.GS47463@elvis.mu.org> <20090804031407.GA8974@hub.freebsd.org> <200908070830.47894.hselasky@c2i.net> Message-ID: <20090807065744.GA23942@doormat.home> On Fri, Aug 07, 2009 at 08:30:45AM +0200, Hans Petter Selasky wrote: > On Thursday 06 August 2009 21:47:16 Navdeep Parhar wrote: > > >> See attached patch. Please test and report back. > > > > > > This patch fixes my problem. The machine is remote and I'm unable > > > to test whether the USB keyboard and keystroke repetition works, but > > > core dumps to a SATA disk are now as fast as they were before > > > r195960. Thanks. > > > > I finally got a chance to try a USB keyboard with ddb, and things did > > not go too well overall. While inside ddb, keystrokes were recognized > > properly and repetition worked too. But after exiting ddb, the > > keyboard wouldn't work - there wasn't any visible response to > > keystrokes. Also, I kept seeing the login prompt continually scroll > > up, as if someone was pressing repeatedly. It certainly > > wasn't me :-) > > > > Are you assuming that a user will not resume normal operation after > > entering the debugger? A panic/reboot isn't the only exit route from > > ddb..... > > > > Simple sequence of steps to reproduce problem: > > ctrl-alt-esc on the USB keyboard > > db> c > > This is like expected. > > Once paniced, USB operation is blocked on the USB controller which the > keyboard belongs to Note that I did not enter ddb on a panic. I entered it voluntarily to take a look at some things. After that I was hoping to continue with business as usual. > board belongs to, because USB does not receive any polling-complete > call, so that it can clean up the state in the USB controller! This > mainly has to do with avoid calling wakeup() during polling. > > To avoid wakeup() calls, USB sets some bits, which must be cleared when > polling is complete, which is currently not done, because USB doesn't know > when polling is complete ... ok. And my question, just like with the previous problem, is: Can something be done about it or are we expected to learn to live with this? All of this is much much better than having *no* USB keyboard with ddb, but there definitely are some kinks to be ironed out. Regards, Navdeep From hselasky at c2i.net Fri Aug 7 08:21:10 2009 From: hselasky at c2i.net (Hans Petter Selasky) Date: Fri Aug 7 08:21:21 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <20090807065744.GA23942@doormat.home> References: <20090802192902.GS47463@elvis.mu.org> <200908070830.47894.hselasky@c2i.net> <20090807065744.GA23942@doormat.home> Message-ID: <200908071021.09234.hselasky@c2i.net> On Friday 07 August 2009 08:57:44 Navdeep Parhar wrote: > ok. And my question, just like with the previous problem, is: Can > something be done about it or are we expected to learn to live with > this I will make a fix for this. --HPS From hselasky at c2i.net Fri Aug 7 09:24:50 2009 From: hselasky at c2i.net (Hans Petter Selasky) Date: Fri Aug 7 09:24:57 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <20090807.005400.-1749708164.imp@bsdimp.com> References: <20090804031407.GA8974@hub.freebsd.org> <200908070830.47894.hselasky@c2i.net> <20090807.005400.-1749708164.imp@bsdimp.com> Message-ID: <200908071124.47955.hselasky@c2i.net> On Friday 07 August 2009 08:54:00 M. Warner Losh wrote: > In message: <200908070830.47894.hselasky@c2i.net> > > Hans Petter Selasky writes: > : On Thursday 06 August 2009 21:47:16 Navdeep Parhar wrote: > : > >> See attached patch. Please test and report back. > : > > > : > > This patch fixes my problem. The machine is remote and I'm unable > : > > to test whether the USB keyboard and keystroke repetition works, but > : > > core dumps to a SATA disk are now as fast as they were before > : > > r195960. Thanks. > : > > : > I finally got a chance to try a USB keyboard with ddb, and things did > : > not go too well overall. While inside ddb, keystrokes were recognized > : > properly and repetition worked too. But after exiting ddb, the > : > keyboard wouldn't work - there wasn't any visible response to > : > keystrokes. Also, I kept seeing the login prompt continually scroll > : > up, as if someone was pressing repeatedly. It certainly > : > wasn't me :-) > : > > : > Are you assuming that a user will not resume normal operation after > : > entering the debugger? A panic/reboot isn't the only exit route from > : > ddb..... > : > > : > Simple sequence of steps to reproduce problem: > : > ctrl-alt-esc on the USB keyboard > : > db> c > : > : This is like expected. > : > : Once paniced, USB operation is blocked on the USB controller which the > : keyboard belongs to, because USB does not receive any polling-complete > : call, so that it can clean up the state in the USB controller! This > : mainly has to do with avoid calling wakeup() during polling. > : > : To avoid wakeup() calls, USB sets some bits, which must be cleared when > : polling is complete, which is currently not done, because USB doesn't > : know when polling is complete ... > > Polling isn't supposed to work like this... The rest of the system > effects a poll without these side effects. Please try the following patch and report back. There is some Giant fuzz which you can ignore. I will see if I can followup a patch against -current later today. http://perforce.freebsd.org/chv.cgi?CH=167084 --HPS From brde at optusnet.com.au Fri Aug 7 09:56:22 2009 From: brde at optusnet.com.au (Bruce Evans) Date: Fri Aug 7 09:56:28 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <20090807.005400.-1749708164.imp@bsdimp.com> References: <20090804031407.GA8974@hub.freebsd.org> <200908070830.47894.hselasky@c2i.net> <20090807.005400.-1749708164.imp@bsdimp.com> Message-ID: <20090807181536.P848@besplex.bde.org> On Fri, 7 Aug 2009, M. Warner Losh wrote: > In message: <200908070830.47894.hselasky@c2i.net> > Hans Petter Selasky writes: > : On Thursday 06 August 2009 21:47:16 Navdeep Parhar wrote: > : > ... > : > Simple sequence of steps to reproduce problem: > : > ctrl-alt-esc on the USB keyboard > : > db> c > : > : This is like expected. > : > : Once paniced, USB operation is blocked on the USB controller which the > : keyboard belongs to, because USB does not receive any polling-complete call, > : so that it can clean up the state in the USB controller! This mainly has to do > : with avoid calling wakeup() during polling. > : > : To avoid wakeup() calls, USB sets some bits, which must be cleared when > : polling is complete, which is currently not done, because USB doesn't know > : when polling is complete ... > > Polling isn't supposed to work like this... The rest of the system > effects a poll without these side effects. Yes, polling is complete when the call to the console driver i/o function returns, although this is broken as designed. It requires a full (enough) reentrant (enough) context switch and on every call to a console driver i/o function, with a full (enough) hardware initialization on entry and a switch back to the old context on return. But this is hard to implement for recalcitrant and/or complicated hardware, and it cannot work for the cn_checkc() i/o function (which is now usually misspelled cn_getc()), since switching the context back on return gives up control so other functions (typically interrupt handlers) may eat the console input. Only the sio console driver does it AFAIK. A non-broken design would involve calling a console driver open, close or ioctl function switch to and from console mode at suitable points. For ddb, the suitable points are on entry and exit from interactive mode, at most once each for every entry into ddb (not on every entry point since that would thrash the i/o subsystem unnecessarily for things like stepping to the next return instruction; unnecessary (and necessary) thrashing is most obvious if you have a correctly implemented video console driver which must switch the whole physical screen context unless console output uses a physically separate screen (not supported in FreeBSD). For other uses, the suitable points are unclear. Obviously, single printfs should be atomic, so the output part of the console should be switched to and from at most once per printf, and printf could do this easily, but that is not enough for printing long messages or even for short messages that are built up with multiple printfs. However, nothing better seems practical, since it would be a large burden for all code that wants to use a set of printfs to have to wrap the set with console driver open/close calls. Therefore, the open/close calls belong in printf right next to my uncommitted serialization for printfs. Serialization is closely related to reserving the console output device -- it would be a similarly too-large burden for all code that wants to use printf to have to wrap the printfs with serialization calls. Full context switches for console output (of a single physical screen) are only best for ddb, since for ordinary printfs you want to see the output, so putting it in an inactive virtual console is not so good, and putting it on a separate virtual console and switching to that is also not so good (the difference for ddb is mainly that it is natural to switch the console on entry to interactive mode so as to actually work on it). So non-ddb printf output should go to a virtual console (or just a buffer) even if the console driver doesn't support virtual consoles. printf already has some support for this (buffering so as to do the output later to ptys). The cn_dbctl() console entry point was designed to fix part of this problem, but it was only used by syscons and this use was removed after removing the (needed :-() calls to it. The problem is larger than I noticed when I designed it -- I thought that there was only a problem for ddb mode, and that ddb mode was handled better by requiring the console driver to be reentrant (reentrancy is best it it is possible and works -- the idea is to work in all states, and having open/close functions to switch the state gives even more states). However, problems for non-ddb mode became obvious when the multiple consoles support code was added -- it made the cn_getc() interface useless and the cn_checkc() interface primary, since all active consoles must be polled for input together, and problems for ddb mode would be obvious if syscons correctly context-switched the screen. cn_dbctl() should have been named cn_ioctl() for general ioctls, and it could be abused for open/close with less abuse than having separate open/close entry points, since the needed open/close functions are more like ioctls than userland open/close (since you already have descriptors and want to modify the state of the device). syscons's use of cn_dbctl was simply: - cn_dbctl passes TRUE on entry and FALSE on exit; these can be counted so as to implement full reentrancy, but syscons counts them only so as to avoid state changes except on entries that are not reentries. (Reentries are not supported by ddb so they shouldn't actually occur.) - on entry (not reentry), syscons just stops the screen timer, hides the mouse, unlocks vty switching, switches to vty0, forces an update of the physical screen - on entry (including reentry), syscons increments its private variable `debugger'. - `debugger' is used mainly to avoid abusing ddb's private variable db_active. Various operations that are invalid in ddb mode (not nearly all, and mainly ones involving the screen timer and calling wakeup()) are avoided when `debugger' is set. Now, db_active is replaced by kdb_active and it is abused a lot in other subsystems but not nearly enough here. syscons still uses `debugger', but `debugger' is never initialized (except statically to 0). Bruce From des at des.no Mon Aug 3 20:37:11 2009 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Fri Aug 7 16:55:58 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <4A773430.2050804@errno.com> (Sam Leffler's message of "Mon, 03 Aug 2009 12:02:08 -0700") References: <20090802192902.GS47463@elvis.mu.org> <20090803.012206.1492586399.imp@bsdimp.com> <20090804032402.J21599@delplex.bde.org> <200908032033.08169.hselasky@c2i.net> <4A773430.2050804@errno.com> Message-ID: <8663d463d7.fsf@ds4.des.no> Sam Leffler writes: > I think we are losing sight of the goal here. We are in a release > schedule and trying to find a minimal set of changes that resolves our > immediate need. Keyboard repeat is not required and unless there is > an obvious and immediate solution it should be considered AFTER the > release. Remember we are already behind schedule for 8.0. Hear, hear. DES -- Dag-Erling Sm?rgrav - des@des.no From imp at bsdimp.com Mon Aug 3 20:48:23 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Fri Aug 7 16:56:04 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <8663d463d7.fsf@ds4.des.no> References: <4A773430.2050804@errno.com> <8663d463d7.fsf@ds4.des.no> Message-ID: <20090803.144515.-924279425.imp@bsdimp.com> In message: <8663d463d7.fsf@ds4.des.no> Dag-Erling_Sm?rgrav writes: : Sam Leffler writes: : > I think we are losing sight of the goal here. We are in a release : > schedule and trying to find a minimal set of changes that resolves our : > immediate need. Keyboard repeat is not required and unless there is : > an obvious and immediate solution it should be considered AFTER the : > release. Remember we are already behind schedule for 8.0. : : Hear, hear. Does the patch that Hans posted fit the bill? To my eye I think it does, but I've not tested to see if it works... Warner From des at des.no Mon Aug 3 20:49:19 2009 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Fri Aug 7 16:56:13 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <20090803.144515.-924279425.imp@bsdimp.com> (M. Warner Losh's message of "Mon, 03 Aug 2009 14:45:15 -0600 (MDT)") References: <4A773430.2050804@errno.com> <8663d463d7.fsf@ds4.des.no> <20090803.144515.-924279425.imp@bsdimp.com> Message-ID: <86skg84o8i.fsf@ds4.des.no> "M. Warner Losh" writes: > Does the patch that Hans posted fit the bill? To my eye I think it > does, but I've not tested to see if it works... My point (and Sam's, I think) is simply: drop keyboard repeat support. DES -- Dag-Erling Sm?rgrav - des@des.no From imp at bsdimp.com Mon Aug 3 21:09:27 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Fri Aug 7 16:56:19 2009 Subject: svn commit: r195960 - in head/sys/dev/usb: . controller input In-Reply-To: <86skg84o8i.fsf@ds4.des.no> References: <8663d463d7.fsf@ds4.des.no> <20090803.144515.-924279425.imp@bsdimp.com> <86skg84o8i.fsf@ds4.des.no> Message-ID: <20090803.150637.-861030402.imp@bsdimp.com> In message: <86skg84o8i.fsf@ds4.des.no> Dag-Erling_Sm?rgrav writes: : "M. Warner Losh" writes: : > Does the patch that Hans posted fit the bill? To my eye I think it : > does, but I've not tested to see if it works... : : My point (and Sam's, I think) is simply: drop keyboard repeat support. And my point is that we have a patch that will work now. We should go with it. If it turns out not to work, 86 repeat support. Warner From bz at FreeBSD.org Wed Aug 12 10:26:04 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Wed Aug 12 10:26:16 2009 Subject: svn commit: r196118 - in head/sys: net sys Message-ID: <200908121026.n7CAQ4Me058692@svn.freebsd.org> Author: bz Date: Wed Aug 12 10:26:03 2009 New Revision: 196118 URL: http://svn.freebsd.org/changeset/base/196118 Log: Put minimum alignment on the dpcpu and vnet section so that ld when adding the __start_ symbol knows the expected section alignment and can place the __start_ symbol correctly. These sections will not support symbols with super-cache line alignment requirements. For full details, see posting to freebsd-current, 2009-08-10, Message-ID: <20090810133111.C93661@maildrop.int.zabbadoz.net>. Debugging and testing patches by: Kamigishi Rei (spambox haruhiism.net), np, lstewart, jhb, kib, rwatson Tested by: Kamigishi Rei, lstewart Reviewed by: kib Approved by: re Modified: head/sys/net/vnet.h head/sys/sys/pcpu.h Modified: head/sys/net/vnet.h ============================================================================== --- head/sys/net/vnet.h Wed Aug 12 08:07:24 2009 (r196117) +++ head/sys/net/vnet.h Wed Aug 12 10:26:03 2009 (r196118) @@ -185,12 +185,14 @@ extern struct sx vnet_sxlock; * Virtual network stack memory allocator, which allows global variables to * be automatically instantiated for each network stack instance. */ +__asm__( #if defined(__arm__) -__asm__(".section " VNET_SETNAME ", \"aw\", %progbits"); + ".section " VNET_SETNAME ", \"aw\", %progbits\n" #else -__asm__(".section " VNET_SETNAME ", \"aw\", @progbits"); + ".section " VNET_SETNAME ", \"aw\", @progbits\n" #endif -__asm__(".previous"); + "\t.p2align " __XSTRING(CACHE_LINE_SHIFT) "\n" + "\t.previous"); #define VNET_NAME(n) vnet_entry_##n #define VNET_DECLARE(t, n) extern t VNET_NAME(n) Modified: head/sys/sys/pcpu.h ============================================================================== --- head/sys/sys/pcpu.h Wed Aug 12 08:07:24 2009 (r196117) +++ head/sys/sys/pcpu.h Wed Aug 12 10:26:03 2009 (r196118) @@ -56,12 +56,14 @@ struct thread; extern uintptr_t *__start_set_pcpu; extern uintptr_t *__stop_set_pcpu; +__asm__( #if defined(__arm__) -__asm__(".section set_pcpu, \"aw\", %progbits"); + ".section set_pcpu, \"aw\", %progbits\n" #else -__asm__(".section set_pcpu, \"aw\", @progbits"); + ".section set_pcpu, \"aw\", @progbits\n" #endif -__asm__(".previous"); + "\t.p2align " __XSTRING(CACHE_LINE_SHIFT) "\n" + "\t.previous"); /* * Array of dynamic pcpu base offsets. Indexed by id. From rwatson at FreeBSD.org Wed Aug 12 10:41:38 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Wed Aug 12 10:41:49 2009 Subject: svn commit: r196120 - head/usr.bin/procstat Message-ID: <200908121041.n7CAfbrB059084@svn.freebsd.org> Author: rwatson Date: Wed Aug 12 10:41:37 2009 New Revision: 196120 URL: http://svn.freebsd.org/changeset/base/196120 Log: Update procstat(1) for the fact that devfs paths are no longer unsupported. Approved by: re (kib) Modified: head/usr.bin/procstat/procstat.1 Modified: head/usr.bin/procstat/procstat.1 ============================================================================== --- head/usr.bin/procstat/procstat.1 Wed Aug 12 10:32:20 2009 (r196119) +++ head/usr.bin/procstat/procstat.1 Wed Aug 12 10:41:37 2009 (r196120) @@ -351,10 +351,8 @@ may be mechanically parsed. .Pp The display of open file or memory mapping pathnames is implemented using the kernel's name cache. -It therefore does not work for file systems -that do not use the name cache, such as -.Xr devfs 4 , -or if the name is not present in the cache due to removal. +If a file system does not use the name cache, or the path to a file is not in +the cache, a path will not be displayed. .Pp .Nm currently supports extracting data only from a live kernel, and not from From rwatson at FreeBSD.org Wed Aug 12 10:44:14 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Wed Aug 12 10:44:26 2009 Subject: svn commit: r196121 - head/sys/netatalk Message-ID: <200908121044.n7CAiDxP059175@svn.freebsd.org> Author: rwatson Date: Wed Aug 12 10:44:13 2009 New Revision: 196121 URL: http://svn.freebsd.org/changeset/base/196121 Log: Reverse misordered unlock and lock in at_control for netatalk phase I addresses. Submitted by: Russell Cattelan Approved by: re (kib) Modified: head/sys/netatalk/at_control.c Modified: head/sys/netatalk/at_control.c ============================================================================== --- head/sys/netatalk/at_control.c Wed Aug 12 10:41:37 2009 (r196120) +++ head/sys/netatalk/at_control.c Wed Aug 12 10:44:13 2009 (r196121) @@ -276,7 +276,7 @@ at_control(struct socket *so, u_long cmd * If the request is specifying phase 1, then * only look at a phase one address */ - AT_IFADDR_RUNLOCK(); + AT_IFADDR_RLOCK(); for (oaa = aa; aa; aa = TAILQ_NEXT(aa, aa_link)) { if (aa->aa_ifp == ifp && (aa->aa_flags & AFA_PHASE2) == 0) @@ -286,7 +286,7 @@ at_control(struct socket *so, u_long cmd ifa_free(&oaa->aa_ifa); if (aa != NULL && oaa != aa) ifa_ref(&aa->aa_ifa); - AT_IFADDR_RLOCK(); + AT_IFADDR_RUNLOCK(); } else { struct at_ifaddr *oaa; From rwatson at FreeBSD.org Wed Aug 12 10:45:46 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Wed Aug 12 10:45:58 2009 Subject: svn commit: r196122 - head/sys/security/audit Message-ID: <200908121045.n7CAjjQi059245@svn.freebsd.org> Author: rwatson Date: Wed Aug 12 10:45:45 2009 New Revision: 196122 URL: http://svn.freebsd.org/changeset/base/196122 Log: Correctly audit real gids following changes to the audit record argument interface. Approved by: re (kib) Modified: head/sys/security/audit/audit.h Modified: head/sys/security/audit/audit.h ============================================================================== --- head/sys/security/audit/audit.h Wed Aug 12 10:44:13 2009 (r196121) +++ head/sys/security/audit/audit.h Wed Aug 12 10:45:45 2009 (r196122) @@ -232,7 +232,7 @@ void audit_thread_free(struct thread *t #define AUDIT_ARG_RGID(rgid) do { \ if (AUDITING_TD(curthread)) \ - audit_arg_gid((rgid)); \ + audit_arg_rgid((rgid)); \ } while (0) #define AUDIT_ARG_RUID(ruid) do { \ From rwatson at FreeBSD.org Wed Aug 12 10:46:49 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Wed Aug 12 10:46:56 2009 Subject: svn commit: r196123 - head/lib/libc/posix1e Message-ID: <200908121046.n7CAkmAw059298@svn.freebsd.org> Author: rwatson Date: Wed Aug 12 10:46:48 2009 New Revision: 196123 URL: http://svn.freebsd.org/changeset/base/196123 Log: Update posix1e-related man pages, especially as relates to MAC, to more accurately reflect the last ten years of work. Approved by: re (kib) Modified: head/lib/libc/posix1e/Makefile.inc head/lib/libc/posix1e/mac.3 head/lib/libc/posix1e/mac_free.3 head/lib/libc/posix1e/mac_get.3 head/lib/libc/posix1e/mac_set.3 head/lib/libc/posix1e/mac_text.3 head/lib/libc/posix1e/posix1e.3 Modified: head/lib/libc/posix1e/Makefile.inc ============================================================================== --- head/lib/libc/posix1e/Makefile.inc Wed Aug 12 10:45:45 2009 (r196122) +++ head/lib/libc/posix1e/Makefile.inc Wed Aug 12 10:46:48 2009 (r196123) @@ -106,14 +106,16 @@ MLINKS+=acl_create_entry.3 acl_create_en mac_get.3 mac_get_fd.3 \ mac_get.3 mac_get_file.3 \ mac_get.3 mac_get_link.3 \ + mac_get.3 mac_get_peer.3 \ mac_get.3 mac_get_pid.3 \ mac_get.3 mac_get_proc.3 \ mac_prepare.3 mac_prepare_file_label.3 \ mac_prepare.3 mac_prepare_ifnet_label.3 \ mac_prepare.3 mac_prepare_process_label.3 \ - mac_set.3 mac_set_link.3 \ + mac_prepare.3 mac_prepare_type.3 \ mac_set.3 mac_set_fd.3 \ mac_set.3 mac_set_file.3 \ + mac_set.3 mac_set_link.3 \ mac_set.3 mac_set_proc.3 \ mac_text.3 mac_from_text.3 \ mac_text.3 mac_to_text.3 Modified: head/lib/libc/posix1e/mac.3 ============================================================================== --- head/lib/libc/posix1e/mac.3 Wed Aug 12 10:45:45 2009 (r196122) +++ head/lib/libc/posix1e/mac.3 Wed Aug 12 10:46:48 2009 (r196123) @@ -1,4 +1,5 @@ .\" Copyright (c) 2001, 2003 Networks Associates Technology, Inc. +.\" Copyright (c) 2009 Robert N. M. Watson .\" All rights reserved. .\" .\" This software was developed for the FreeBSD Project by Chris @@ -30,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 19, 2003 +.Dd August 7, 2009 .Dt MAC 3 .Os .Sh NAME @@ -44,81 +45,82 @@ In the kernel configuration file: .Cd "options MAC" .Sh DESCRIPTION -.Fx -permits administrators to define Mandatory Access Control labels -defining levels for the privacy and integrity of data, -overriding discretionary policies -for those objects. -Not all objects currently provide support for MAC labels, -and MAC support must be explicitly enabled by the administrator. -The library calls include routines to retrieve, duplicate, -and set MAC labels associated with files and processes. -.Pp -POSIX.1e describes a set of MAC manipulation routines -to manage the contents of MAC labels, -as well as their relationships with -files and processes; -almost all of these support routines -are implemented in -.Fx . +Mandatory Access Control labels describe confidentiality, integrity, and +other security attributes of operating system objects, overriding +discretionary access control. +Not all system objects support MAC labeling, and MAC policies must be +explicitly enabled by the administrator. +This API, based on POSIX.1e, includes routines to retrieve, manipulate, set, +and convert to and from text the MAC labels on files and processes. +.Pp +MAC labels consist of a set of (name, value) tuples, representing security +attributes from MAC policies. +For example, this label contains security labels defined by two policies, +.Xr mac_biba 4 +and +.Xr mac_mls 4 : +.Bd -literal -offset indent +biba/low,mls/low +.Ed +.Pp +Further syntax and semantics of MAC labels may be found in +.Xr maclabel 7 . +.Pp +Applications operate on labels stored in +.Vt mac_t , +but can convert between this internal format and a text format for the +purposes of presentation to uses or external storage. +When querying a label on an object, a +.Vt mac_t +must first be prepared using the interfaces described in +.Xr mac_prepare 3 , +allowing the application to declare which policies it wishes to interogate. +The application writer can also rely on default label names declared in +.Xr mac.conf 5 . +.Pp +When finished with a +.Vt mac_t , +the application must call +.Xr mac_free 3 +to release its storage. .Pp -Available functions, sorted by behavior, include: +The following functions are defined: .Bl -tag -width indent -.It Fn mac_get_fd -This function is described in +.It Fn mac_is_present +This function, described in +.Xr mac_is_present 3 , +allows applications to test whether MAC is configured, as well as whether +specific policies are configured. +.It Fn mac_get_fd , Fn mac_get_file , Fn mac_get_link , Fn mac_get_peer +These functions, described in .Xr mac_get 3 , -and may be used to retrieve the -MAC label associated with -a specific file descriptor. -.It Fn mac_get_file -This function is described in +retrieve the MAC labels associated with file descriptors, files, and socket +peers. +.It Fn mac_get_pid , Fn mac_get_proc +These functions, described in .Xr mac_get 3 , -and may be used to retrieve the -MAC label associated with -a named file. -.It Fn mac_get_proc -This function is described in -.Xr mac_get 3 , -and may be used to retrieve the -MAC label associated with -the calling process. -.It Fn mac_set_fd -This function is described in -.Xr mac_set 3 , -and may be used to set the -MAC label associated with -a specific file descriptor. -.It Fn mac_set_file -This function is described in +retrieve the MAC labels associated with processes. +.It Fn mac_set_fd , Fn mac_set_file , Fn mac_set_link +These functions, described in .Xr mac_set 3 , -and may be used to set the -MAC label associated with -a named file. +set the MAC labels associated with file descriptors and files. .It Fn mac_set_proc -This function is described in +This function, described in .Xr mac_set 3 , -and may be used to set the -MAC label associated with -the calling process. +sets the MAC label associated with the current process. .It Fn mac_free -This function is described in +This function, desribed in .Xr mac_free 3 , -and may be used to free -userland working MAC label storage. +frees working MAC label storage. .It Fn mac_from_text -This function is described in +This function, described in .Xr mac_text 3 , -and may be used to convert -a text-form MAC label -into a working +converts a text-form MAC label into working MAC label storage, .Vt mac_t . -.It Fn mac_prepare -.It Fn mac_prepare_file_label -.It Fn mac_prepare_ifnet_label -.It Fn mac_prepare_process_label -These functions are described in +.It Fn mac_prepare , Fn mac_prepare_file_label , Fn mac_prepare_ifnet_label , Fn mac_prepare_process_label , Fn mac_prepare_type +These functions, described in .Xr mac_prepare 3 , -and may be used to preallocate storage for MAC label retrieval. +allocate working storage for MAC label operations. .Xr mac_prepare 3 prepares a label based on caller-specified label names; the other calls rely on the default configuration specified in @@ -130,15 +132,6 @@ and may be used to convert a .Vt mac_t into a text-form MAC label. .El -The behavior of some of these calls is influenced by the configuration -settings found in -.Xr mac.conf 5 , -the MAC library run-time configuration file. -.Sh IMPLEMENTATION NOTES -.Fx Ns 's -support for POSIX.1e interfaces and features -is -.Ud . .Sh FILES .Bl -tag -width ".Pa /etc/mac.conf" -compact .It Pa /etc/mac.conf @@ -150,24 +143,20 @@ system objects, but without policy-speci .Sh SEE ALSO .Xr mac_free 3 , .Xr mac_get 3 , +.Xr mac_is_present 3 , .Xr mac_prepare 3 , .Xr mac_set 3 , .Xr mac_text 3 , +.Xr posix1e 3 , .Xr mac 4 , .Xr mac.conf 5 , .Xr mac 9 .Sh STANDARDS -These APIs are loosely based on the APIs described in POSIX.1e. -POSIX.1e is described in IEEE POSIX.1e draft 17. -Discussion of the draft -continues on the cross-platform POSIX.1e implementation mailing list. -To join this list, see the -.Fx -POSIX.1e implementation page -for more information. -However, the resemblance of these APIs to the POSIX APIs is only loose, -as the POSIX APIs were unable to express many notions required for -flexible and extensible access control. +These APIs are loosely based on the APIs described in POSIX.1e, as described +in IEEE POSIX.1e draft 17. +However, the resemblence of these APIS to the POSIX APIs is loose, as the +PSOXI APIS were unable to express some notinos required for flexible and +extensible access control. .Sh HISTORY Support for Mandatory Access Control was introduced in .Fx 5.0 Modified: head/lib/libc/posix1e/mac_free.3 ============================================================================== --- head/lib/libc/posix1e/mac_free.3 Wed Aug 12 10:45:45 2009 (r196122) +++ head/lib/libc/posix1e/mac_free.3 Wed Aug 12 10:46:48 2009 (r196123) @@ -64,6 +64,7 @@ function. .Xr mac_prepare 3 , .Xr mac_set 3 , .Xr mac_text 3 , +.Xr posix1e 3 , .Xr mac 4 , .Xr mac 9 .Sh STANDARDS @@ -91,8 +92,8 @@ is a complex structure in the .Tn TrustedBSD implementation, .Fn mac_free -is specific to that type, and must not be used to free the character -strings returned from +is specific to +.Vt mac_3 , +and must not be used to free the character strings returned from .Fn mac_to_text . -Doing so may result in undefined behavior, -including application failure. +Doing so may result in undefined behavior. Modified: head/lib/libc/posix1e/mac_get.3 ============================================================================== --- head/lib/libc/posix1e/mac_get.3 Wed Aug 12 10:45:45 2009 (r196122) +++ head/lib/libc/posix1e/mac_get.3 Wed Aug 12 10:46:48 2009 (r196123) @@ -133,6 +133,7 @@ is not a directory. .Xr mac_prepare 3 , .Xr mac_set 3 , .Xr mac_text 3 , +.Xr posix1e 3 , .Xr mac 4 , .Xr mac 9 .Sh STANDARDS Modified: head/lib/libc/posix1e/mac_set.3 ============================================================================== --- head/lib/libc/posix1e/mac_set.3 Wed Aug 12 10:45:45 2009 (r196122) +++ head/lib/libc/posix1e/mac_set.3 Wed Aug 12 10:46:48 2009 (r196123) @@ -138,6 +138,7 @@ is not a directory. .Xr mac_is_present 3 , .Xr mac_prepare 3 , .Xr mac_text 3 , +.Xr posix1e 3 , .Xr mac 4 , .Xr mac 9 .Sh HISTORY Modified: head/lib/libc/posix1e/mac_text.3 ============================================================================== --- head/lib/libc/posix1e/mac_text.3 Wed Aug 12 10:45:45 2009 (r196122) +++ head/lib/libc/posix1e/mac_text.3 Wed Aug 12 10:46:48 2009 (r196123) @@ -98,6 +98,7 @@ to allocate internal storage. .Xr mac_is_present 3 , .Xr mac_prepare 3 , .Xr mac_set 3 , +.Xr posix1e 3 , .Xr mac 4 , .Xr maclabel 7 .Sh STANDARDS Modified: head/lib/libc/posix1e/posix1e.3 ============================================================================== --- head/lib/libc/posix1e/posix1e.3 Wed Aug 12 10:45:45 2009 (r196122) +++ head/lib/libc/posix1e/posix1e.3 Wed Aug 12 10:46:48 2009 (r196123) @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 2000 Robert N. M. Watson +.\" Copyright (c) 2000, 2009 Robert N. M. Watson .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 20, 2009 +.Dd August 7, 2009 .Dt POSIX1E 3 .Os .Sh NAME @@ -36,99 +36,77 @@ .Sh SYNOPSIS .In sys/types.h .In sys/acl.h -.\" .In sys/capability.h .In sys/mac.h .Sh DESCRIPTION -The IEEE POSIX.1e specification never left draft form, but the interfaces -it describes are now widely used despite inherent limitations. -Currently, only a few of the interfaces and features are implemented in -.Fx , -although efforts are underway to complete the integration at this time. +POSIX.1e describes five security extensions to the POSIX.1 API: Access +Control Lists (ACLs), Auditing, Capabilities, Mandatory Access Control, and +Information Flow Labels. +While IEEE POSIX.1e D17 specification has not been standardized, several of +its interfaces are widely used. .Pp -POSIX.1e describes five security extensions to the base POSIX.1 API: -Access Control Lists (ACLs), Auditing, Capabilities, Mandatory Access -Control, and Information Flow Labels. .Fx -supports POSIX.1e ACL interfaces, as well as POSIX.1e-like MAC -interfaces. -The TrustedBSD Project has produced but not integrated an implementation -of POSIX.1e Capabilities. -.Pp -POSIX.1e defines both syntax and semantics for these features, but fairly -substantial changes are required to implement these features in the -operating system. -.Pp -As shipped, -.Fx 4.0 -provides API and VFS support for ACLs, but not an implementation on any -native file system. -.Fx 5.0 -includes support for ACLs as part of UFS1 and UFS2, as well as necessary -VFS support for additional file systems to export ACLs as appropriate. -Available API calls relating to ACLs are described in detail in -.Xr acl 3 . -.Pp -As shipped, -.Fx 5.0 -includes support for Mandatory Access Control as well as POSIX.1e-like -APIs for label management. -More information on API calls relating to MAC is available in -.Xr mac 3 . +implements POSIX.1e interface for access control lists, described in +.Xr acl 3 , +and supports ACLs on the +.Xr ffs 7 +file system; ACLs must be administratively enabled using +.Xr tunefs 8 . .Pp -Additional patches supporting POSIX.1e features are provided by the -TrustedBSD project: +.Fx +implements a POSIX.1e-like mandatory access control interface, described in +.Xr mac 3 , +although with a number of extensions and important semantic differences. .Pp -http://www.TrustedBSD.org/ -.Sh IMPLEMENTATION NOTES -.Fx Ns 's -support for POSIX.1e interfaces and features is still under -development at this time, and many of these features are considered new -or experimental. +.Fx +does not implement the POSIX.1e audit, privilege (capability), or information +flow label APIs. +However, +.Fx +does implement the +.Xr libbsm +audit API. .Sh ENVIRONMENT -POSIX.1e assigns security labels to all objects, extending the security +POSIX.1e assigns security attributes to all objects, extending the security functionality described in POSIX.1. -These additional labels provide -fine-grained discretionary access control, fine-grained capabilities, -and labels necessary for mandatory access control. -POSIX.2c describes -a set of userland utilities for manipulating these labels. +These additional attributes store fine-grained discretionary access control +information and mandatory access control labels; for files, they are stored +in extended attributes, described in +.Xr extattr 3 . .Pp -Many of these services are supported by extended attributes, documented -in -.Xr extattr 2 +POSIX.2c describes +a set of userland utilities for manipulating these attributes, including +.Xr getfacl 1 +and +.Xr setfacl 1 +for access control lists, and +.Xr getfmac 8 and -.Xr extattr 9 . -While these APIs are not documented in POSIX.1e, they are similar in -structure. +.Xr setfmac 8 +for mandatory access control labels. .Sh SEE ALSO +.Xr getfacl 1 , +.Xr setfacl 1 , .Xr extattr 2 , .Xr acl 3 , +.Xr extattr 3 , .Xr libbsm 3 , .Xr mac 3 , +.Xr ffs 7 , +.Xr getfmac 8 , +.Xr setfmac 8 , +.Xr tunefs 8 , .Xr acl 9 , .Xr extattr 9 , .Xr mac 9 .Sh STANDARDS POSIX.1e is described in IEEE POSIX.1e draft 17. -Discussion of the draft continues -on the cross-platform POSIX.1e implementation -mailing list. -To join this list, see the -.Fx -POSIX.1e implementation -page for more information. .Sh HISTORY POSIX.1e support was introduced in .Fx 4.0 ; -most of the features are available as of +most features were available as of .Fx 5.0 . -Development continues. .Sh AUTHORS .An Robert N M Watson .An Chris D. Faulhaber .An Thomas Moestl .An Ilmar S Habibulin -.Sh BUGS -Many of these features are considered new or experimental in -.Fx 5.0 -and should be deployed with appropriate caution. From cperciva at FreeBSD.org Wed Aug 12 11:55:27 2009 From: cperciva at FreeBSD.org (Colin Percival) Date: Wed Aug 12 11:55:37 2009 Subject: svn commit: r196128 - head/usr.sbin/ntp/scripts Message-ID: <200908121155.n7CBtQUD063217@svn.freebsd.org> Author: cperciva Date: Wed Aug 12 11:55:26 2009 New Revision: 196128 URL: http://svn.freebsd.org/changeset/base/196128 Log: Apply the ntp-related part of r195626 to the correct part of the tree -- the mkver which is used in builds is the one in usr.sbin/ntp/scripts, not the one in contrib/ntp/scripts. Pointy hat to: cperciva Approved by: re (rwatson) Modified: head/usr.sbin/ntp/scripts/mkver Modified: head/usr.sbin/ntp/scripts/mkver ============================================================================== --- head/usr.sbin/ntp/scripts/mkver Wed Aug 12 11:43:45 2009 (r196127) +++ head/usr.sbin/ntp/scripts/mkver Wed Aug 12 11:55:26 2009 (r196128) @@ -23,8 +23,6 @@ case "" in *) ConfStr="${ConfStr}-r" ;; esac -ConfStr="$ConfStr `LC_ALL=C date`" - if [ ! -f .version ]; then echo 0 > .version fi From bz at FreeBSD.org Wed Aug 12 12:00:23 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Wed Aug 12 12:00:38 2009 Subject: svn commit: r196129 - head/sys/net Message-ID: <200908121200.n7CC0LJr063407@svn.freebsd.org> Author: bz Date: Wed Aug 12 12:00:21 2009 New Revision: 196129 URL: http://svn.freebsd.org/changeset/base/196129 Log: Update DDB show vnet command to print all used and available information. Reviewed by: rwatson, zec Approved by: re Modified: head/sys/net/vnet.c Modified: head/sys/net/vnet.c ============================================================================== --- head/sys/net/vnet.c Wed Aug 12 11:55:26 2009 (r196128) +++ head/sys/net/vnet.c Wed Aug 12 12:00:21 2009 (r196129) @@ -615,14 +615,20 @@ DB_SHOW_COMMAND(vnets, db_show_vnets) { VNET_ITERATOR_DECL(vnet_iter); -#if SIZE_MAX == UINT32_MAX /* 32-bit arch */ - db_printf(" vnet ifs socks\n"); -#else /* 64-bit arch, most probaly... */ - db_printf(" vnet ifs socks\n"); -#endif VNET_FOREACH(vnet_iter) { - db_printf("%p %3d %5d\n", vnet_iter, vnet_iter->vnet_ifcnt, - vnet_iter->vnet_sockcnt); + db_printf("vnet = %p\n", vnet_iter); + db_printf(" vnet_magic_n = 0x%x (%s, orig 0x%x)\n", + vnet_iter->vnet_magic_n, + (vnet_iter->vnet_magic_n == VNET_MAGIC_N) ? + "ok" : "mismatch", VNET_MAGIC_N); + db_printf(" vnet_ifcnt = %u\n", vnet_iter->vnet_ifcnt); + db_printf(" vnet_sockcnt = %u\n", vnet_iter->vnet_sockcnt); + db_printf(" vnet_data_mem = %p\n", vnet_iter->vnet_data_mem); + db_printf(" vnet_data_base = 0x%jx\n", + (uintmax_t)vnet_iter->vnet_data_base); + db_printf("\n"); + if (db_pager_quit) + break; } } #endif From bz at FreeBSD.org Wed Aug 12 12:06:41 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Wed Aug 12 12:06:54 2009 Subject: svn commit: r196132 - head/sys/kern Message-ID: <200908121206.n7CC6Gpn063639@svn.freebsd.org> Author: bz Date: Wed Aug 12 12:06:16 2009 New Revision: 196132 URL: http://svn.freebsd.org/changeset/base/196132 Log: Add ddb show dpcpu_off command to ease dpcpu memory debugging. While show pcpu prints pc_dynamic this also prints the original memory address as well as the maths. Once dpcpu goes NUMA this is considered to help debugging as well. Reviewed by: rwatson Approved by: re Modified: head/sys/kern/subr_pcpu.c Modified: head/sys/kern/subr_pcpu.c ============================================================================== --- head/sys/kern/subr_pcpu.c Wed Aug 12 12:05:07 2009 (r196131) +++ head/sys/kern/subr_pcpu.c Wed Aug 12 12:06:16 2009 (r196132) @@ -313,6 +313,18 @@ sysctl_dpcpu_int(SYSCTL_HANDLER_ARGS) } #ifdef DDB +DB_SHOW_COMMAND(dpcpu_off, db_show_dpcpu_off) +{ + int id; + + for (id = 0; id <= mp_maxid; id++) { + if (CPU_ABSENT(id)) + continue; + db_printf("dpcpu_off[%2d] = 0x%jx (+ DPCPU_START = %p)\n", + id, (uintmax_t)dpcpu_off[id], + (void *)(uintptr_t)(dpcpu_off[id] + DPCPU_START)); + } +} static void show_pcpu(struct pcpu *pc) From simon at FreeBSD.org Wed Aug 12 12:10:11 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Wed Aug 12 12:10:18 2009 Subject: svn commit: r196133 - in head/crypto/openssl: apps test Message-ID: <200908121210.n7CCA0Op063785@svn.freebsd.org> Author: simon Date: Wed Aug 12 12:10:00 2009 New Revision: 196133 URL: http://svn.freebsd.org/changeset/base/196133 Log: Remove symlinks in OpenSSL's testing framework. These are not required for normal build, and doesn't export well to CVS. If they are needed later a script will be added to recreate the symlinks when needed at build time. Approved by: re (rwatson) Deleted: head/crypto/openssl/apps/md4.c head/crypto/openssl/test/bftest.c head/crypto/openssl/test/bntest.c head/crypto/openssl/test/casttest.c head/crypto/openssl/test/destest.c head/crypto/openssl/test/dhtest.c head/crypto/openssl/test/dsatest.c head/crypto/openssl/test/ecdhtest.c head/crypto/openssl/test/ecdsatest.c head/crypto/openssl/test/ectest.c head/crypto/openssl/test/enginetest.c head/crypto/openssl/test/evp_test.c head/crypto/openssl/test/exptest.c head/crypto/openssl/test/fips_aesavs.c head/crypto/openssl/test/fips_desmovs.c head/crypto/openssl/test/fips_dsatest.c head/crypto/openssl/test/fips_dssvs.c head/crypto/openssl/test/fips_hmactest.c head/crypto/openssl/test/fips_randtest.c head/crypto/openssl/test/fips_rngvs.c head/crypto/openssl/test/fips_rsagtest.c head/crypto/openssl/test/fips_rsastest.c head/crypto/openssl/test/fips_rsavtest.c head/crypto/openssl/test/fips_shatest.c head/crypto/openssl/test/fips_test_suite.c head/crypto/openssl/test/hmactest.c head/crypto/openssl/test/ideatest.c head/crypto/openssl/test/jpaketest.c head/crypto/openssl/test/md2test.c head/crypto/openssl/test/md4test.c head/crypto/openssl/test/md5test.c head/crypto/openssl/test/mdc2test.c head/crypto/openssl/test/randtest.c head/crypto/openssl/test/rc2test.c head/crypto/openssl/test/rc4test.c head/crypto/openssl/test/rc5test.c head/crypto/openssl/test/rmdtest.c head/crypto/openssl/test/rsa_test.c head/crypto/openssl/test/sha1test.c head/crypto/openssl/test/sha256t.c head/crypto/openssl/test/sha512t.c head/crypto/openssl/test/shatest.c head/crypto/openssl/test/ssltest.c From bz at FreeBSD.org Wed Aug 12 12:12:26 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Wed Aug 12 12:12:32 2009 Subject: svn commit: r196135 - head/sys/kern Message-ID: <200908121212.n7CCCN85063924@svn.freebsd.org> Author: bz Date: Wed Aug 12 12:12:23 2009 New Revision: 196135 URL: http://svn.freebsd.org/changeset/base/196135 Log: Make the kernel compile without IP networking by moving a variable under a proper #ifdef. Approved by: re (rwatson) Modified: head/sys/kern/kern_jail.c Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Wed Aug 12 12:10:28 2009 (r196134) +++ head/sys/kern/kern_jail.c Wed Aug 12 12:12:23 2009 (r196135) @@ -472,10 +472,11 @@ kern_jail_set(struct thread *td, struct #endif struct vfsopt *opt; struct vfsoptlist *opts; - struct prison *pr, *deadpr, *mypr, *ppr, *tpr, *tppr; + struct prison *pr, *deadpr, *mypr, *ppr, *tpr; struct vnode *root; char *domain, *errmsg, *host, *name, *p, *path, *uuid; #if defined(INET) || defined(INET6) + struct prison *tppr; void *op; #endif unsigned long hid; From bz at FreeBSD.org Wed Aug 12 12:29:18 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Wed Aug 12 12:29:29 2009 Subject: svn commit: r196137 - head/usr.sbin/jls Message-ID: <200908121229.n7CCT7Bw064394@svn.freebsd.org> Author: bz Date: Wed Aug 12 12:29:07 2009 New Revision: 196137 URL: http://svn.freebsd.org/changeset/base/196137 Log: Do not truncate IPv6 addresses when printing them in the jls -av 7.x multi-IP jail backward compat output. Reported by: ed Tested by: ed Reviewed by: rwatson Approved by: re Modified: head/usr.sbin/jls/jls.c Modified: head/usr.sbin/jls/jls.c ============================================================================== --- head/usr.sbin/jls/jls.c Wed Aug 12 12:14:30 2009 (r196136) +++ head/usr.sbin/jls/jls.c Wed Aug 12 12:29:07 2009 (r196137) @@ -359,7 +359,7 @@ print_jail(int pflags, int jflags) ipbuf, sizeof(ipbuf)) == NULL) err(1, "inet_ntop"); else - printf("%6s %-15.15s\n", "", ipbuf); + printf("%6s %s\n", "", ipbuf); } } else if (pflags & PRINT_DEFAULT) printf("%6d %-15.15s %-29.29s %.74s\n", From rnoland at FreeBSD.org Wed Aug 12 12:50:16 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Wed Aug 12 12:50:22 2009 Subject: svn commit: r196141 - head/sys/dev/drm Message-ID: <200908121250.n7CCoFNJ064979@svn.freebsd.org> Author: rnoland Date: Wed Aug 12 12:50:15 2009 New Revision: 196141 URL: http://svn.freebsd.org/changeset/base/196141 Log: Add some additional radeon pci ids to drm. Approved by: re (kib) MFC after: 0 days Modified: head/sys/dev/drm/drm_pciids.h Modified: head/sys/dev/drm/drm_pciids.h ============================================================================== --- head/sys/dev/drm/drm_pciids.h Wed Aug 12 12:49:52 2009 (r196140) +++ head/sys/dev/drm/drm_pciids.h Wed Aug 12 12:50:15 2009 (r196141) @@ -259,9 +259,12 @@ {0x1002, 0x940F, CHIP_R600|RADEON_NEW_MEMMAP, "ATI FireGL V7600"}, \ {0x1002, 0x94A0, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 4830"}, \ {0x1002, 0x94A1, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 4850"}, \ + {0x1002, 0x94A3, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI FirePro M7740"}, \ {0x1002, 0x94B1, CHIP_RV740|RADEON_NEW_MEMMAP, "ATI RV740"}, \ {0x1002, 0x94B3, CHIP_RV740|RADEON_NEW_MEMMAP, "ATI Radeon HD 4770"}, \ + {0x1002, 0x94B4, CHIP_RV740|RADEON_NEW_MEMMAP, "ATI Radeon HD 4700 Series"}, \ {0x1002, 0x94B5, CHIP_RV740|RADEON_NEW_MEMMAP, "ATI Radeon HD 4770"}, \ + {0x1002, 0x94B9, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI FirePro M5750"}, \ {0x1002, 0x94C0, CHIP_RV610|RADEON_NEW_MEMMAP, "RV610"}, \ {0x1002, 0x94C1, CHIP_RV610|RADEON_NEW_MEMMAP, "Radeon HD 2400 XT"}, \ {0x1002, 0x94C3, CHIP_RV610|RADEON_NEW_MEMMAP, "Radeon HD 2400 Pro"}, \ @@ -350,6 +353,7 @@ {0x1002, 0x9487, CHIP_RV730|RADEON_NEW_MEMMAP, "ATI Radeon RV730 (AGP)"}, \ {0x1002, 0x948F, CHIP_RV730|RADEON_NEW_MEMMAP, "ATI Radeon RV730 (AGP)"}, \ {0x1002, 0x9490, CHIP_RV730|RADEON_NEW_MEMMAP, "ATI Radeon HD 4670"}, \ + {0x1002, 0x9495, CHIP_RV730|RADEON_NEW_MEMMAP, "ATI Radeon HD 4600 Series"}, \ {0x1002, 0x9498, CHIP_RV730|RADEON_NEW_MEMMAP, "ATI Radeon HD 4650"}, \ {0x1002, 0x9480, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 4650"}, \ {0x1002, 0x9488, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 4670"}, \ @@ -366,6 +370,7 @@ {0x1002, 0x9552, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon 4300 Series"}, \ {0x1002, 0x9553, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon 4500 Series"}, \ {0x1002, 0x9555, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon 4500 Series"}, \ + {0x1002, 0x9557, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI FirePro RG220"}, \ {0, 0, 0, NULL} #define r128_PCI_IDS \ From rnoland at FreeBSD.org Wed Aug 12 12:57:03 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Wed Aug 12 12:57:14 2009 Subject: svn commit: r196142 - head/sys/dev/drm Message-ID: <200908121257.n7CCv37U065146@svn.freebsd.org> Author: rnoland Date: Wed Aug 12 12:57:02 2009 New Revision: 196142 URL: http://svn.freebsd.org/changeset/base/196142 Log: Add support for radeon RS880 IGP chips to drm. Approved by: re (kib) MFC after: 0 days Modified: head/sys/dev/drm/drm_pciids.h head/sys/dev/drm/r600_cp.c head/sys/dev/drm/radeon_drv.h Modified: head/sys/dev/drm/drm_pciids.h ============================================================================== --- head/sys/dev/drm/drm_pciids.h Wed Aug 12 12:50:15 2009 (r196141) +++ head/sys/dev/drm/drm_pciids.h Wed Aug 12 12:57:02 2009 (r196142) @@ -330,6 +330,11 @@ {0x1002, 0x9614, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon 3300 Graphics"}, \ {0x1002, 0x9615, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon 3200 Graphics"}, \ {0x1002, 0x9616, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon 3000 Graphics"}, \ + {0x1002, 0x9710, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon HD 4200"}, \ + {0x1002, 0x9711, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon 4100"}, \ + {0x1002, 0x9712, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Mobility Radeon HD 4200"}, \ + {0x1002, 0x9713, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Mobility Radeon 4100"}, \ + {0x1002, 0x9714, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI RS880"}, \ {0x1002, 0x9440, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4800 Series"}, \ {0x1002, 0x9441, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4870 X2"}, \ {0x1002, 0x9442, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4800 Series"}, \ Modified: head/sys/dev/drm/r600_cp.c ============================================================================== --- head/sys/dev/drm/r600_cp.c Wed Aug 12 12:50:15 2009 (r196141) +++ head/sys/dev/drm/r600_cp.c Wed Aug 12 12:57:02 2009 (r196142) @@ -318,7 +318,8 @@ static void r600_cp_load_microcode(drm_r pfp = RV670_pfp_microcode; break; case CHIP_RS780: - DRM_INFO("Loading RS780 Microcode\n"); + case CHIP_RS880: + DRM_INFO("Loading RS780/RS880 Microcode\n"); cp = RS780_cp_microcode; pfp = RS780_pfp_microcode; break; @@ -722,6 +723,7 @@ static void r600_gfx_init(struct drm_dev break; case CHIP_RV610: case CHIP_RS780: + case CHIP_RS880: case CHIP_RV620: dev_priv->r600_max_pipes = 1; dev_priv->r600_max_tile_pipes = 1; @@ -856,7 +858,8 @@ static void r600_gfx_init(struct drm_dev ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV630) || ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV610) || ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV620) || - ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780)) + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780) || + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS880)) RADEON_WRITE(R600_DB_DEBUG, R600_PREZ_MUST_WAIT_FOR_POSTZ_DONE); else RADEON_WRITE(R600_DB_DEBUG, 0); @@ -874,7 +877,8 @@ static void r600_gfx_init(struct drm_dev sq_ms_fifo_sizes = RADEON_READ(R600_SQ_MS_FIFO_SIZES); if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV610) || ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV620) || - ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780)) { + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780) || + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS880)) { sq_ms_fifo_sizes = (R600_CACHE_FIFO_SIZE(0xa) | R600_FETCH_FIFO_HIWATER(0xa) | R600_DONE_FIFO_HIWATER(0xe0) | @@ -917,7 +921,8 @@ static void r600_gfx_init(struct drm_dev R600_NUM_ES_STACK_ENTRIES(0)); } else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV610) || ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV620) || - ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780)) { + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780) || + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS880)) { /* no vertex cache */ sq_config &= ~R600_VC_ENABLE; @@ -974,7 +979,8 @@ static void r600_gfx_init(struct drm_dev if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV610) || ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV620) || - ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780)) + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780) || + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS880)) RADEON_WRITE(R600_VGT_CACHE_INVALIDATION, R600_CACHE_INVALIDATION(R600_TC_ONLY)); else RADEON_WRITE(R600_VGT_CACHE_INVALIDATION, R600_CACHE_INVALIDATION(R600_VC_AND_TC)); @@ -1017,6 +1023,7 @@ static void r600_gfx_init(struct drm_dev break; case CHIP_RV610: case CHIP_RS780: + case CHIP_RS880: case CHIP_RV620: gs_prim_buffer_depth = 32; break; @@ -1062,6 +1069,7 @@ static void r600_gfx_init(struct drm_dev switch (dev_priv->flags & RADEON_FAMILY_MASK) { case CHIP_RV610: case CHIP_RS780: + case CHIP_RS880: case CHIP_RV620: tc_cntl = R600_TC_L2_SIZE(8); break; Modified: head/sys/dev/drm/radeon_drv.h ============================================================================== --- head/sys/dev/drm/radeon_drv.h Wed Aug 12 12:50:15 2009 (r196141) +++ head/sys/dev/drm/radeon_drv.h Wed Aug 12 12:57:02 2009 (r196142) @@ -145,6 +145,7 @@ enum radeon_family { CHIP_RV635, CHIP_RV670, CHIP_RS780, + CHIP_RS880, CHIP_RV770, CHIP_RV740, CHIP_RV730, From jhb at FreeBSD.org Wed Aug 12 14:37:58 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Wed Aug 12 14:38:10 2009 Subject: svn commit: r196147 - head/usr.sbin/sysinstall Message-ID: <200908121437.n7CEbwMK067711@svn.freebsd.org> Author: jhb Date: Wed Aug 12 14:37:57 2009 New Revision: 196147 URL: http://svn.freebsd.org/changeset/base/196147 Log: Fix references to the kernel distributions to use the correct names (uppercase). PR: docs/137415 Submitted by: Yuri Gorchakov Approved by: re (rwatson, kib) MFC after: 3 days Modified: head/usr.sbin/sysinstall/install.c head/usr.sbin/sysinstall/sysinstall.8 Modified: head/usr.sbin/sysinstall/install.c ============================================================================== --- head/usr.sbin/sysinstall/install.c Wed Aug 12 13:20:42 2009 (r196146) +++ head/usr.sbin/sysinstall/install.c Wed Aug 12 14:37:57 2009 (r196147) @@ -939,7 +939,7 @@ installFixupKernel(dialogMenuItem *self, if (RunningAsInit) { /* * Install something as /boot/kernel. Prefer SMP - * over generic--this should handle the case where + * over GENERIC--this should handle the case where * both SMP and GENERIC are installed (otherwise we * select the one kernel that was installed). * Modified: head/usr.sbin/sysinstall/sysinstall.8 ============================================================================== --- head/usr.sbin/sysinstall/sysinstall.8 Wed Aug 12 13:20:42 2009 (r196146) +++ head/usr.sbin/sysinstall/sysinstall.8 Wed Aug 12 14:37:57 2009 (r196147) @@ -411,9 +411,9 @@ Possible distribution values are: .Bl -tag -width indentxx .It Li base The base binary distribution. -.It Li generic +.It Li GENERIC The GENERIC kernel. -.It Li smp +.It Li SMP A kernel suitable for multiple processor systems. .It Li doc Miscellaneous documentation From rmacklem at FreeBSD.org Wed Aug 12 16:27:52 2009 From: rmacklem at FreeBSD.org (Rick Macklem) Date: Wed Aug 12 16:28:03 2009 Subject: svn commit: r196149 - head/sys/xdr Message-ID: <200908121627.n7CGRpam070192@svn.freebsd.org> Author: rmacklem Date: Wed Aug 12 16:27:51 2009 New Revision: 196149 URL: http://svn.freebsd.org/changeset/base/196149 Log: Add a check for a NULL mbuf ptr at the beginning of xdrmbuf_inline() so that it returns failure instead of crashing when "m->m_len" is executed and m == NULL. The mbuf ptr can be NULL when a call to xdrmbuf_getbytes() gets the bytes it needs, but they are at the end of a short RPC reply. When this happens, xdrmbuf_getbytes() returns success, but advances the mbuf ptr (xdrs->x_private) to m_next, which is NULL. If this is followed by a call to xdrmbuf_getlong(), it calls xdrmbuf_inline(), which would cause a crash by accessing "m->m_len". Tested by: pho, serenity at exscape dot org Approved by: re (rwatson), kib (mentor) Modified: head/sys/xdr/xdr_mbuf.c Modified: head/sys/xdr/xdr_mbuf.c ============================================================================== --- head/sys/xdr/xdr_mbuf.c Wed Aug 12 14:40:21 2009 (r196148) +++ head/sys/xdr/xdr_mbuf.c Wed Aug 12 16:27:51 2009 (r196149) @@ -282,6 +282,8 @@ xdrmbuf_inline(XDR *xdrs, u_int len) size_t available; char *p; + if (!m) + return (0); if (xdrs->x_op == XDR_ENCODE) { available = M_TRAILINGSPACE(m) + (m->m_len - xdrs->x_handy); } else { From jkim at FreeBSD.org Wed Aug 12 17:28:54 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Wed Aug 12 17:29:01 2009 Subject: svn commit: r196150 - head/sys/net Message-ID: <200908121728.n7CHSrxF071523@svn.freebsd.org> Author: jkim Date: Wed Aug 12 17:28:53 2009 New Revision: 196150 URL: http://svn.freebsd.org/changeset/base/196150 Log: Always embed pointer to BPF JIT function in BPF descriptor to avoid inconsistency when opt_bpf.h is not included. Reviewed by: rwatson Approved by: re (rwatson) Modified: head/sys/net/bpf.c head/sys/net/bpf_buffer.c head/sys/net/bpf_zerocopy.c head/sys/net/bpfdesc.h Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Wed Aug 12 16:27:51 2009 (r196149) +++ head/sys/net/bpf.c Wed Aug 12 17:28:53 2009 (r196150) @@ -1585,6 +1585,9 @@ void bpf_tap(struct bpf_if *bp, u_char *pkt, u_int pktlen) { struct bpf_d *d; +#ifdef BPF_JITTER + bpf_jit_filter *bf; +#endif u_int slen; int gottime; struct timeval tv; @@ -1601,8 +1604,9 @@ bpf_tap(struct bpf_if *bp, u_char *pkt, * the interface pointers on the mbuf to figure it out. */ #ifdef BPF_JITTER - if (bpf_jitter_enable != 0 && d->bd_bfilter != NULL) - slen = (*(d->bd_bfilter->func))(pkt, pktlen, pktlen); + bf = bpf_jitter_enable != 0 ? d->bd_bfilter : NULL; + if (bf != NULL) + slen = (*(bf->func))(pkt, pktlen, pktlen); else #endif slen = bpf_filter(d->bd_rfilter, pkt, pktlen, pktlen); @@ -1634,6 +1638,9 @@ void bpf_mtap(struct bpf_if *bp, struct mbuf *m) { struct bpf_d *d; +#ifdef BPF_JITTER + bpf_jit_filter *bf; +#endif u_int pktlen, slen; int gottime; struct timeval tv; @@ -1655,11 +1662,10 @@ bpf_mtap(struct bpf_if *bp, struct mbuf BPFD_LOCK(d); ++d->bd_rcount; #ifdef BPF_JITTER + bf = bpf_jitter_enable != 0 ? d->bd_bfilter : NULL; /* XXX We cannot handle multiple mbufs. */ - if (bpf_jitter_enable != 0 && d->bd_bfilter != NULL && - m->m_next == NULL) - slen = (*(d->bd_bfilter->func))(mtod(m, u_char *), - pktlen, pktlen); + if (bf != NULL && m->m_next == NULL) + slen = (*(bf->func))(mtod(m, u_char *), pktlen, pktlen); else #endif slen = bpf_filter(d->bd_rfilter, (u_char *)m, pktlen, 0); Modified: head/sys/net/bpf_buffer.c ============================================================================== --- head/sys/net/bpf_buffer.c Wed Aug 12 16:27:51 2009 (r196149) +++ head/sys/net/bpf_buffer.c Wed Aug 12 17:28:53 2009 (r196150) @@ -77,7 +77,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include /* Modified: head/sys/net/bpf_zerocopy.c ============================================================================== --- head/sys/net/bpf_zerocopy.c Wed Aug 12 16:27:51 2009 (r196149) +++ head/sys/net/bpf_zerocopy.c Wed Aug 12 17:28:53 2009 (r196150) @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/net/bpfdesc.h ============================================================================== --- head/sys/net/bpfdesc.h Wed Aug 12 16:27:51 2009 (r196149) +++ head/sys/net/bpfdesc.h Wed Aug 12 17:28:53 2009 (r196150) @@ -72,9 +72,7 @@ struct bpf_d { u_long bd_rtout; /* Read timeout in 'ticks' */ struct bpf_insn *bd_rfilter; /* read filter code */ struct bpf_insn *bd_wfilter; /* write filter code */ -#ifdef BPF_JITTER - bpf_jit_filter *bd_bfilter; /* binary filter code */ -#endif + void *bd_bfilter; /* binary filter code */ u_int64_t bd_rcount; /* number of packets received */ u_int64_t bd_dcount; /* number of packets dropped */ From qingli at FreeBSD.org Wed Aug 12 19:15:28 2009 From: qingli at FreeBSD.org (Qing Li) Date: Wed Aug 12 19:15:39 2009 Subject: svn commit: r196152 - head/sys/netinet6 Message-ID: <200908121915.n7CJFRRu073946@svn.freebsd.org> Author: qingli Date: Wed Aug 12 19:15:26 2009 New Revision: 196152 URL: http://svn.freebsd.org/changeset/base/196152 Log: A piece of code was added to install a host route when an IPv6 interface address is configured with a /128 prefix. This is no longer necessary due to r192011. In fact that code conflicts with r192011. This patch removes the host route installation when detecting the /128 prefix, and instead let the code added by r192011 to install the loopback route for that IPv6 interface address. Reviewed by: bz Approved by: re Modified: head/sys/netinet6/in6.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Wed Aug 12 17:45:55 2009 (r196151) +++ head/sys/netinet6/in6.c Wed Aug 12 19:15:26 2009 (r196152) @@ -1750,21 +1750,12 @@ in6_ifinit(struct ifnet *ifp, struct in6 * interface that share the same destination. */ plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */ - if (!(ia->ia_flags & IFA_ROUTE) && plen == 128) { - struct sockaddr *dstaddr; + if (!(ia->ia_flags & IFA_ROUTE) && plen == 128 && + ia->ia_dstaddr.sin6_family == AF_INET6) { int rtflags = RTF_UP | RTF_HOST; - /* - * use the interface address if configuring an - * interface address with a /128 prefix len - */ - if (ia->ia_dstaddr.sin6_family == AF_INET6) - dstaddr = (struct sockaddr *)&ia->ia_dstaddr; - else - dstaddr = (struct sockaddr *)&ia->ia_addr; - error = rtrequest(RTM_ADD, - (struct sockaddr *)dstaddr, + (struct sockaddr *)&ia->ia_dstaddr, (struct sockaddr *)&ia->ia_addr, (struct sockaddr *)&ia->ia_prefixmask, ia->ia_flags | rtflags, NULL); From stas at FreeBSD.org Wed Aug 12 19:48:27 2009 From: stas at FreeBSD.org (Stanislav Sedov) Date: Wed Aug 12 19:48:38 2009 Subject: svn commit: r189117 - head/sys/dev/bce In-Reply-To: <4A7AFFC4.5050607@tomjudge.com> References: <200902271925.n1RJP699080658@svn.freebsd.org> <20090721145559.d2cf3f0b.stas@FreeBSD.org> <4A7AFFC4.5050607@tomjudge.com> Message-ID: <20090812234935.84e5ac74.stas@FreeBSD.org> On Thu, 06 Aug 2009 11:07:32 -0500 Tom Judge mentioned: > > I can confirm that we are also seeing this problem on a number of Dell > PE2950 systems running the bce driver from 7.2, the bug is more > visible/producible on systems that are using Jumbo Frames (in our case 8Kb). > > The symptoms of this are an increase in the requests for jumbo clusters > denied counter at 9k, and then random network stalls which sometimes > recover on there own and others require a reboot. > > We have backed this change and so far it seems to have fixed the issue. > David, are you OK with reverting this patch? I submitted the patch to re@ for review, and I can commit it if you don't mind doing so. :-) -- Stanislav Sedov ST4096-RIPE -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 801 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20090812/60a4fb62/attachment.pgp From sam at FreeBSD.org Wed Aug 12 21:03:21 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Wed Aug 12 21:03:28 2009 Subject: svn commit: r196155 - head/share/man/man9 Message-ID: <200908122103.n7CL3Hpw076548@svn.freebsd.org> Author: sam Date: Wed Aug 12 21:03:16 2009 New Revision: 196155 URL: http://svn.freebsd.org/changeset/base/196155 Log: First (early) draft of net80211 documentation. Note this is focused on driver writers (as opposed to folks adding to net80211). Reviewed by: wkoszek Approved by: re (rwatson) Added: head/share/man/man9/ieee80211_amrr.9 (contents, props changed) head/share/man/man9/ieee80211_beacon.9 (contents, props changed) head/share/man/man9/ieee80211_bmiss.9 (contents, props changed) head/share/man/man9/ieee80211_ddb.9 (contents, props changed) head/share/man/man9/ieee80211_regdomain.9 (contents, props changed) head/share/man/man9/ieee80211_scan.9 (contents, props changed) head/share/man/man9/ieee80211_vap.9 (contents, props changed) Deleted: head/share/man/man9/ieee80211_ioctl.9 Modified: head/share/man/man9/Makefile head/share/man/man9/ieee80211.9 head/share/man/man9/ieee80211_crypto.9 head/share/man/man9/ieee80211_input.9 head/share/man/man9/ieee80211_node.9 head/share/man/man9/ieee80211_output.9 head/share/man/man9/ieee80211_proto.9 head/share/man/man9/ieee80211_radiotap.9 Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Wed Aug 12 20:48:50 2009 (r196154) +++ head/share/man/man9/Makefile Wed Aug 12 21:03:16 2009 (r196155) @@ -121,13 +121,19 @@ MAN= accept_filter.9 \ hashinit.9 \ hexdump.9 \ ieee80211.9 \ + ieee80211_amrr.9 \ + ieee80211_beacon.9 \ + ieee80211_bmiss.9 \ ieee80211_crypto.9 \ + ieee80211_ddb.9 \ ieee80211_input.9 \ - ieee80211_ioctl.9 \ ieee80211_node.9 \ ieee80211_output.9 \ ieee80211_proto.9 \ ieee80211_radiotap.9 \ + ieee80211_regdomain.9 \ + ieee80211_scan.9 \ + ieee80211_vap.9 \ ifnet.9 \ inittodr.9 \ insmntque.9 \ @@ -627,52 +633,62 @@ MLINKS+=hash.9 hash32.9 \ MLINKS+=hashinit.9 hashdestroy.9 \ hashinit.9 hashinit_flags.9 \ hashinit.9 phashinit.9 -MLINKS+=ieee80211.9 ieee80211_attach.9 \ - ieee80211.9 ieee80211_chan2ieee.9 \ - ieee80211.9 ieee80211_chan2mode.9 \ - ieee80211.9 ieee80211_ieee2mhz.9 \ - ieee80211.9 ieee80211_ifattach.9 \ - ieee80211.9 ieee80211_ifdetach.9 \ - ieee80211.9 ieee80211_media2rate.9 \ - ieee80211.9 ieee80211_media_change.9 \ - ieee80211.9 ieee80211_media_init.9 \ - ieee80211.9 ieee80211_media_status.9 \ - ieee80211.9 ieee80211_mhz2ieee.9 \ - ieee80211.9 ieee80211_rate2media.9 \ - ieee80211.9 ieee80211_setmode.9 \ - ieee80211.9 ieee80211_watchdog.9 -MLINKS+=ieee80211_crypto.9 ieee80211_crypto_attach.9 \ - ieee80211_crypto.9 ieee80211_crypto_detach.9 \ - ieee80211_crypto.9 ieee80211_wep_crypt.9 -MLINKS+=ieee80211_input.9 ieee80211_decap.9 \ - ieee80211_input.9 ieee80211_recv_mgmt.9 -MLINKS+=ieee80211_ioctl.9 ieee80211_cfgget.9 \ - ieee80211_ioctl.9 ieee80211_cfgset.9 -MLINKS+=ieee80211_node.9 ieee80211_alloc_node.9 \ - ieee80211_node.9 ieee80211_begin_scan.9 \ - ieee80211_node.9 ieee80211_create_ibss.9 \ - ieee80211_node.9 ieee80211_dup_bss.9 \ - ieee80211_node.9 ieee80211_end_scan.9 \ - ieee80211_node.9 ieee80211_find_node.9 \ - ieee80211_node.9 ieee80211_free_allnodes.9 \ +MLINKS+=ieee80211.9 ieee80211_ifattach.9 \ + ieee80211.9 ieee80211_ifdetach.9 +MLINKS+=ieee80211_amrr.9 ieee80211_amrr_init.9 \ + ieee80211_amrr.9 ieee80211_amrr_cleanup.9 \ + ieee80211_amrr.9 ieee80211_amrr_setinterval.9 \ + ieee80211_amrr.9 ieee80211_amrr_node_init.9 \ + ieee80211_amrr.9 ieee80211_amrr_tx_complete.9 \ + ieee80211_amrr.9 ieee80211_amrr_tx_update.9 +MLINKS+=ieee80211_beacon.9 ieee80211_beacon_alloc.9 \ + ieee80211_beacon.9 ieee80211_beacon_update.9 \ + ieee80211_beacon.9 ieee80211_beacon_notify.9 +MLINKS+=ieee80211_bmiss.9 ieee80211_beacon_miss.9 +MLINKS+=ieee80211_crypto.9 ieee80211_key_update_begin.9 \ + ieee80211_crypto.9 ieee80211_key_update_end.9 \ + ieee80211_crypto.9 ieee80211_crypto_newkey.9 \ + ieee80211_crypto.9 ieee80211_crypto_setkey.9 \ + ieee80211_crypto.9 ieee80211_crypto_delglobalkeys.9 \ + ieee80211_crypto.9 ieee80211_crypto_reload_keys.9 \ + ieee80211_crypto.9 ieee80211_crypto_decap.9 \ + ieee80211_crypto.9 ieee80211_crypto_encap.9 \ + ieee80211_crypto.9 ieee80211_crypto_demic.9 \ + ieee80211_crypto.9 ieee80211_crypto_enmic.9 \ + ieee80211_crypto.9 ieee80211_notify_michael_failure.9 \ + ieee80211_crypto.9 ieee80211_notify_replay_failure.9 \ + ieee80211_crypto.9 ieee80211_crypto_register.9 \ + ieee80211_crypto.9 ieee80211_crypto_unregister.9 \ + ieee80211_crypto.9 ieee80211_crypto_available.9 +MLINKS+=ieee80211_input.9 ieee80211_input_all.9 +MLINKS+=ieee80211_node.9 ieee80211_find_rxnode.9 \ + ieee80211_node.9 ieee80211_find_rxnode_withkey.9 \ + ieee80211_node.9 ieee80211_ref_node.9 \ + ieee80211_node.9 ieee80211_unref_node.9 \ ieee80211_node.9 ieee80211_free_node.9 \ ieee80211_node.9 ieee80211_iterate_nodes.9 \ - ieee80211_node.9 ieee80211_lookup_node.9 \ - ieee80211_node.9 ieee80211_next_scan.9 \ - ieee80211_node.9 ieee80211_node_attach.9 \ - ieee80211_node.9 ieee80211_node_detach.9 \ - ieee80211_node.9 ieee80211_node_lateattach.9 \ - ieee80211_node.9 ieee80211_timeout_nodes.9 -MLINKS+=ieee80211_output.9 ieee80211_add_rates.9 \ - ieee80211_output.9 ieee80211_add_xrates.9 \ - ieee80211_output.9 ieee80211_encap.9 \ - ieee80211_output.9 ieee80211_send_mgmt.9 -MLINKS+=ieee80211_proto.9 ieee80211_dump_pkt.9 \ - ieee80211_proto.9 ieee80211_fix_rate.9 \ - ieee80211_proto.9 ieee80211_print_essid.9 \ - ieee80211_proto.9 ieee80211_proto_attach.9 \ - ieee80211_proto.9 ieee80211_proto_detach.9 -MLINKS+=ieee80211_radiotap.9 radiotap.9 + ieee80211_node.9 ieee80211_dump_node.9 \ + ieee80211_node.9 ieee80211_dump_nodes.9 +MLINKS+=ieee80211_output.9 M_WME_GETAC.9 \ + ieee80211_output.9 M_SEQNO_GET.9 \ + ieee80211_output.9 ieee80211_process_callback.9 +MLINKS+=ieee80211_proto.9 ieee80211_new_state.9 \ + ieee80211_proto.9 ieee80211_start_all.9 \ + ieee80211_proto.9 ieee80211_stop_all.9 \ + ieee80211_proto.9 ieee80211_suspend_all.9 \ + ieee80211_proto.9 ieee80211_resume_all.9 \ + ieee80211_proto.9 ieee80211_waitfor_parent.9 +MLINKS+=ieee80211_radiotap.9 radiotap.9 \ + ieee80211_radiotap.9 ieee80211_radiotap_attach.9 \ + ieee80211_radiotap.9 ieee80211_radiotap_active_vap.9 \ + ieee80211_radiotap.9 ieee80211_radiotap_active.9 \ + ieee80211_radiotap.9 ieee80211_radiotap_tx.9 +MLINKS+=ieee80211_regdomain.9 ieee80211_init_channels.9 \ + ieee80211_regdomain.9 ieee80211_sort_channels.9 \ + ieee80211_regdomain.9 ieee80211_alloc_countryie.9 +MLINKS+=ieee80211_vap.9 ieee80211_vap_setup.9 \ + ieee80211_vap.9 ieee80211_vap_attach.9 \ + ieee80211_vap.9 ieee80211_vap_detach.9 MLINKS+=ifnet.9 ifaddr.9 \ ifnet.9 if_data.9 \ ifnet.9 ifqueue.9 Modified: head/share/man/man9/ieee80211.9 ============================================================================== --- head/share/man/man9/ieee80211.9 Wed Aug 12 20:48:50 2009 (r196154) +++ head/share/man/man9/ieee80211.9 Wed Aug 12 21:03:16 2009 (r196155) @@ -1,6 +1,5 @@ .\" -.\" Copyright (c) 2004 Bruce M. Simpson -.\" Copyright (c) 2004 Darron Broad +.\" Copyright (c) 2009 Sam Leffler, Errno Consulting .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,236 +24,538 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.\" $Id: ieee80211.9,v 1.5 2004/03/04 12:33:27 bruce Exp $ .\" -.Dd March 2, 2004 -.Dt IEEE80211 9 +.Dd August 4, 2009 +.Dt NET80211 9 .Os .Sh NAME -.Nm ieee80211_ifattach , ieee80211_ifdetach , -.Nm ieee80211_mhz2ieee , ieee80211_chan2ieee , ieee80211_ieee2mhz , -.Nm ieee80211_media_init , ieee80211_media_change , ieee80211_media_status , -.Nm ieee80211_watchdog , -.Nm ieee80211_setmode , ieee80211_chan2mode , -.Nm ieee80211_rate2media , ieee80211_media2rate -.Nd core 802.11 network stack functions +.Nm net80211 +.Nd 802.11 network layer .Sh SYNOPSIS .In net80211/ieee80211_var.h -.In net80211/ieee80211_proto.h .Ft void -.Fn ieee80211_ifattach "struct ifnet *ifp" +.Fn ieee80211_ifattach "struct ieee80211com *ic" "const uint8_t macaddr[IEEE80211_ADDR_LEN]" .Ft void -.Fn ieee80211_ifdetach "struct ifnet *ifp" -.Ft u_int -.Fn ieee80211_mhz2ieee "u_int freq" "u_int flags" -.Ft u_int -.Fn ieee80211_chan2ieee "struct ieee80211com *ic" "struct ieee80211_channel *c" -.Ft u_int -.Fn ieee80211_ieee2mhz "u_int chan" "u_int flags" -.Ft void -.Fo ieee80211_media_init -.Fa "struct ifnet *ifp" "ifm_change_cb_t media_change" -.Fa "ifm_stat_cb_t media_stat" -.Fc -.Fa int -.Fn ieee80211_media_change "struct ifnet *ifp" -.Fa void -.Fn ieee80211_media_status "struct ifnet *ifp" "struct ifmediareq *imr" -.Ft void -.Fn ieee80211_watchdog "struct ifnet *ifp" -.Ft int -.Fn ieee80211_setmode "struct ieee80211com *ic" "enum ieee80211_phymode mode" -.Ft enum ieee80211_phymode -.Fo ieee80211_chan2mode -.Fa "struct ieee80211com *ic" "struct ieee80211_channel *chan" -.Fc -.Ft int -.Fo ieee80211_rate2media -.Fa "struct ieee80211com *ic" "int rate" "enum ieee80211_phymode mode" -.Fc -.Ft int -.Fn ieee80211_media2rate "int mword" +.Fn ieee80211_ifdetach "struct ieee80211com *ic" .Sh DESCRIPTION -The -.Nm ieee80211 -collection of functions are used to manage wireless network interfaces in the -system which use the system's software 802.11 network stack. -Most of these functions require that attachment to the stack is performed -before calling. -Several utility functions are also provided; these are safe to call from -any driver without prior initialization. +IEEE 802.11 device drivers are written to use the infrastructure provided +by the +.Nm +software layer. +This software provides a support framework for drivers that includes +ifnet cloning, state management, and a user management API by which +applications interact with 802.11 devices. +Most drivers depend on the +.Nm +layer for protocol services but devices that off-load functionality +may bypass the layer to connect directly to the device +(e.g. the +.Xr ndis 4 +emulation support does this). +.Pp +A +.Nm +device driver implements a virtual radio API that is exported to +users through network interfaces (aka vaps) that are cloned from the +underlying device. +These interfaces have an operating mode +(station, adhoc, hostap, wds, monitor, etc.) +that is fixed for the lifetime of the interface. +Devices that can support multiple concurrent interfaces allow +multiple vaps to be cloned. +This enables construction of interesting applications such as +an AP vap and one or more WDS vaps +or multiple AP vaps, each with a different security model. +The +.Nm +layer virtualizes most 802.11 state +and coordinates vap state changes including scheduling multiple vaps. +State that is not virtualized includes the current channel and +WME/WMM parameters. +Protocol processing is typically handled entirely in the +.Nm +layer with drivers responsible purely for moving data between the host +and device. +Similarly, +.Nm +handles most +.Xr ioctl 2 +requests without entering the driver; +instead drivers are notified of state changes that +require their involvement. +.Pp +The virtual radio interface defined by the +.Nm +layer means that drivers must be structured to follow specific rules. +Drivers that support only a single interface at any time must still +follow these rules. +.Sh DATA STRUCTURES +The virtual radio architecture splits state between a single per-device +.Vt ieee80211com +structure and one or more +.Vt ieee80211vap +structures. +Drivers are expected to setup various shared state in these structures +at device attach and during vap creation but otherwise should treat them +as read-only. +The +.Vt ieee80211com +structure is allocated by the +.Nm +layer as adjunct data to a device's +.Vt ifnet ; +it is accessed through the +.Vt if_l2com +structure member. +The +.Vt ieee80211vap +structure is allocated by the driver in the +.Dq vap create +method +and should be extended with any driver-private state. +This technique of giving the driver control to allocate data structures +is used for other +.Nm +data structures and should be exploited to maintain driver-private state +together with public +.Nm +state. +.Pp +The other main data structures are the station, or node, table +that tracks peers in the local BSS, and the channel table that defines +the current set of available radio channels. +Both tables are bound to the +.Vt ieee80211com +structure and shared by all vaps. +Long-lasting references to a node are counted to guard against +premature reclamation. +In particular every packet sent/received holds a node reference +(either explicitly for transmit or implicitly on receive). .Pp -.\" -The -.Fn ieee80211_ifattach -function attaches the network interface -.Fa ifp -to the 802.11 network stack layer. -This function must be called before using any of the -.Nm ieee80211 -functions which need to store driver state across invocations; The -.Vt struct ifnet -instance pointed to by -.Fa ifp -MUST be an instance of -.Vt struct ieee80211com , -with various fields initialized to tell -.Nm ieee80211 -about its capabilities. -This function performs Ethernet and BPF attachment (by calling -.Fn ether_ifattach +.Vt ieee80211com and -.Fn bpfattach2 ) -on behalf of the caller. -It also implements the -.Vt ifmedia -interface. +.Vt ieee80211vap +structures also hold a collection of method pointers that drivers +fill-in and/or override to take control of certain operations. +These methods are the primary way drivers are bound to the +.Nm +layer and are described below. +.Sh DRIVER ATTACH/DETACH +Drivers attach to the +.Nm +layer with the +.Fn ieee80211_ifattach +function. +The driver is expected to allocate and setup any device-private +data structures before passing control. +The +.Vt ieee80211com +structure must be pre-initialized with state required to setup the +.Nm +layer: +.Bl -tag -width ic_channels +.It Dv ic_ifp +Backpointer to the physical device's ifnet. +.It Dv ic_caps +Device/driver capabilities; see below for a complete description. +.It Dv ic_channels +Table of channels the device is capable of operating on. +This is initially provided by the driver but may be changed +through calls that change the regulatory state. +.It Dv ic_nchan +Number of entries in +.Dv ic_channels . +.El .Pp -.\" -The +On return from +.Fn ieee80211_ifattach +the driver is expected to override default callback functions in the +.Vt ieee80211com +structure to register it's private routines. +Methods marked with a +.Dq * +must be provided by the driver. +.Bl -tag -width ic_channels +.It Dv ic_vap_create* +Create a vap instance of the specified type (operating mode). +Any fixed BSSID and/or MAC address is provided. +Drivers that support multi-bssid operation may honor the requested BSSID +or assign their own. +.It Dv ic_vap_delete* +Destroy a vap instance created with +.Dv ic_vap_create . +.It Dv ic_getradiocaps +Return the list of calibrated channels for the radio. +The default method returns the current list of channels +(space permitting). +.It Dv ic_setregdomain +Process a request to change regulatory state. +The routine may reject a request or constrain changes (e.g. reduce +transmit power caps). +The default method accepts all proposed changes. +.It Dv ic_send_mgmt +Send an 802.11 management frame. +The default method fabricates the frame using +.Nm +state and passes it to the driver through the +.Dv ic_raw_xmit +method. +.It Dv ic_raw_xmit +Transmit a raw 802.11 frame. +The default method drops the frame and generates a message on the console. +.It Dv ic_updateslot +Update hardware state after an 802.11 IFS slot time change, +There is no default method; the pointer may be NULL in which case +it will not be used. +.It Dv ic_update_mcast +Update hardware for a change in the multicast packet filter, +The default method prints a console message. +.It Dv ic_update_promisc +Update hardware for a change in the promiscuous mode setting. +The default method prints a console message. +.It Dv ic_newassoc +Update driver/device state for association to a new AP (in station mode) +or when a new station associates (e.g. in AP mode). +There is no default method; the pointer may be NULL in which case +it will not be used. +.It Dv ic_node_alloc +Allocate and initialize a +.Vt ieee80211_node +structure. +This method cannot sleep. +The default method allocates zero'd memory using +.Xr malloc 9. +Drivers should override this method to allocate extended storage +for their own needs. +Memory allocated by the driver must be tagged with +.Dv M_80211_NODE +to balance the memory allocation statistics. +.It Dv ic_node_free +Reclaim storage of a node allocated by +.Dv ic_node_alloc . +Drivers are expected to +.Em interpose +their own method to cleanup private state but must call through +this method to allow +.Nm +to reclaim it's private state. +.It Dv ic_node_cleanup +Cleanup state in a +.Vt ieee80211_node +created by +.Dv ic_node_alloc . +This operation is distinguished from +.Dv ic_node_free +in that it may be called long before the node is actually reclaimed +to cleanup adjunct state. +This can happen, for example, when a node must not be reclaimed +due to references held by packets in the transmit queue. +Drivers typically interpose +.Dv ic_node_cleanup +instead of +.Dv ic_node_free . +.It Dv ic_node_age +Age, and potentially reclaim, resources associated with a node. +The default method ages frames on the power-save queue (in AP mode) +and pending frames in the receive reorder queues (for stations using A-MPDU). +.It Dv ic_node_drain +Reclaim all optional resources associated with a node. +This call is used to free up resources when they are in short supply, +.It Dv ic_node_getrssi +Return the Receive Signal Strength Indication (RSSI) in .5 dBm units for +the specified node. +This interface returns a subset of the information +returned by +.Dv ic_node_getsignal , +The default method calculates a filtered average over the last ten +samples passed in to +.Xr ieee80211_input 9 +or +.Xr ieee80211_input_all 9 . +.It Dv ic_node_getsignal +Return the RSSI and noise floor (in .5 dBm units) for a station. +The default method calculates RSSI as described above; +the noise floor returned is the last value supplied to +.Xr ieee80211_input 9 +or +.Xr ieee80211_input_all 9 . +.It Dv ic_node_getmimoinfo +Return MIMO radio state for a station in support of the +.Dv IEEE80211_IOC_STA_INFO +ioctl request. +The default method returns nothing. +.It Dv ic_scan_start* +Prepare driver/hardware state for scanning. +This callback is done in a sleepable context. +.It Dv ic_scan_end* +Restore driver/hardware state after scanning completes. +This callback is done in a sleepable context. +.It Dv ic_set_channel* +Set the current radio channel using +.Vt ic_curchan . +This callback is done in a sleepable context. +.It Dv ic_scan_curchan +Start scanning on a channel. +This method is called immediately after each channel change +and must initiate the work to scan a channel and schedule a timer +to advance to the next channel in the scan list. +This callback is done in a sleepable context. +The default method handles active scan work (e.g. sending ProbRequest +frames), and schedules a call to +.Xr ieee80211_scan_next 9 +according to the maximum dwell time for the channel. +Drivers that off-load scan work to firmware typically use this method +to trigger per-channel scan activity. +.It Dv ic_scan_mindwell +Handle reaching the minimum dwell time on a channel when scanning. +This event is triggered when one or more stations have been found on +a channel and the minimum dwell time has been reached. +This callback is done in a sleepable context. +The default method signals the scan machinery to advance +to the next channel as soon as possible. +Drivers can use this method to preempt further work (e.g. if scanning +is handled by firmware) or ignore the request to force maximum dwell time +on a channel. +.It Dv ic_recv_action +Process a received Action frame. +The default method points to +.Xr ieee80211_recv_action 9 +which provides a mechanism for setting up handlers for each Action frame class. +.It Dv ic_send_action +Transmit an Action frame. +The default method points to +.Xr ieee80211_send_action 9 +which provides a mechanism for setting up handlers for each Action frame class. +.It Dv ic_ampdu_enable +Check if transmit A-MPDU should be enabled for the specified station and AC. +The default method checks a per-AC traffic rate against a per-vap +threshold to decide if A-MPDU should be enabled. +This method also rate-limits ADDBA requests so that requests are not +made too frequently when a receiver has limited resources. +.It Dv ic_addba_request +Request A-MPDU transmit aggregation. +The default method sets up local state and issues an +ADDBA Request Action frame. +Drivers may interpose this method if they need to setup private state +for handling transmit A-MPDU. +.It Dv ic_addb_response +Process a received ADDBA Response Action frame and setup resources as +needed for doing transmit A-MPDU, +.It Dv ic_addb_stop +Shutdown an A-MPDU transmit stream for the specified station and AC. +The default method reclaims local state after sending a DelBA Action frame. +.It Dv ic_bar_response +Process a response to a transmitted BAR control frame. +.It Dv ic_ampdu_rx_start +Prepare to receive A-MPDU data from the specified station for the TID. +.It Dv ic_ampdu_rx_stop +Terminate receipt of A-MPDU data from the specified station for the TID. +.El +.Pp +Once the +.Nm +layer is attached to a driver there are two more steps typically done +to complete the work: +.Bl -enum +.It +Setup +.Dq radiotap support +for capturing raw 802.11 packets that pass through the device. +This is done with a call to +.Xr ieee80211_radiotap_attach 9 . +.It +Do any final device setup like enabling interrupts. +.El +.Pp +State is torn down and reclaimed with a call to +.Fn ieee80211_ifdetach . +Note this call may result in multiple callbacks into the driver +so it should be done before any critical driver state is reclaimed. +On return from .Fn ieee80211_ifdetach -function frees any -.Nm ieee80211 -structures associated with the driver, and performs Ethernet and BPF -detachment on behalf of the caller. -.Pp -.\" -The -.Fn ieee80211_mhz2ieee -utility function converts the frequency -.Fa freq -(specified in MHz) to an IEEE 802.11 channel number. -The -.Fa flags -argument is a hint which specifies whether the frequency is in -the 2GHz ISM band -.Pq Vt IEEE80211_CHAN_2GHZ -or the 5GHz band -.Pq Vt IEEE80211_CHAN_5GHZ ; -appropriate clipping of the result is then performed. -.Pp -.\" -The -.Fn ieee80211_chan2ieee -function converts the channel specified in -.Fa *c -to an IEEE channel number for the driver -.Fa ic . -If the conversion would be invalid, an error message is printed to the -system console. -This function REQUIRES that the driver is hooked up to the -.Nm ieee80211 -subsystem. -.Pp -.\" -The -.Fn ieee80211_ieee2mhz -utility function converts the IEEE channel number -.Ft chan -to a frequency (in MHz). -The -.Fa flags -argument is a hint which specifies whether the frequency is in -the 2GHz ISM band -.Pq Vt IEEE80211_CHAN_2GHZ -or the 5GHz band -.Pq Vt IEEE80211_CHAN_5GHZ ; -appropriate clipping of the result is then performed. -.Pp -.\" -The -.Fn ieee80211_media_init -function initializes media data structures used by the -.Vt ifmedia -interface, for the driver -.Fa ifp . -It must be called by the driver after calling -.Fn ieee80211_attach -and before calling most -.Nm ieee80211 -functions. -The -.Fa media_change -and -.Fa media_stat -arguments specify helper functions which will be invoked by the -.Vt ifmedia -framework when the user changes or queries media options, -using a command such as -.Xr ifconfig 8 . -.Pp -.\" -The -.Fn ieee80211_media_status +all associated vaps and ifnet structures are reclaimed or inaccessible +to user applications so it is safe to teardown driver state without +worry about being re-entered. +The driver is responsible for calling +.Xr if_free 9 +on the ifnet it allocated for the physical device. +.Sh DRIVER CAPABILITIES +Driver/device capabilities are specified using several sets of flags +in the +.Vt ieee80211com +structure. +General capabilities are specified by +.Vt ic_caps . +Hardware cryptographic capabilities are specified by +.Vt ic_cryptocaps . +802.11n capabilities, if any, are specified by +.Vt ic_htcaps . +The +.Nm +layer propagates a subset of these capabilities to each vap through +the equivalent fields: +.Vt iv_caps , +.Vt iv_cryptocaps , and -.Fn ieee80211_media_change -functions are device-independent handlers for -.Vt ifmedia -commands and are not intended to be called directly. -.Pp -.\" -The -.Fn ieee80211_watchdog -function is intended to be called from a driver's -.Va if_watchdog -routine. -It is used to perform periodic cleanup of state within the software 802.11 -stack, as well as timing out scans. -.Pp -.\" -The -.Fn ieee80211_setmode -function is called from within the 802.11 stack to change the mode -of the driver's PHY; it is not intended to be called directly. -.Pp -.\" -The -.Fn ieee80211_chan2mode -function returns the PHY mode required for use with the channel -.Fa chan -on the device -.Fa ic . -This is typically used when selecting a rate set, to be advertised in -beacons, for example. -.Pp -.\" -The -.Fn ieee80211_rate2media -function converts the bit rate -.Fa rate -(measured in units of 0.5Mbps) to an -.Vt ifmedia -sub-type, for the device -.Fa ic -running in PHY mode -.Fa mode . -The -.Fn ieee80211_media2rate -performs the reverse of this conversion, returning the bit rate (in 0.5Mbps -units) corresponding to an -.Vt ifmedia -sub-type. -.\" +.Vt iv_htcaps . +The following general capabilities are defined: +.Bl -tag -width IEEE80211_C_8023ENCAP +.It Dv IEEE80211_C_STA +Device is capable of operating in station (aka Infrastructure) mode. +.It Dv IEEE80211_C_8023ENCAP +Device requires 802.3-encapsulated frames be passed for transmit. +By default +.Nm +will encapsulate all outbound frames as 802.11 frames (without a PLCP header). +.It Dv IEEE80211_C_FF +Device supports Atheros Fast-Frames. +.It Dv IEEE80211_C_TURBOP +Device supports Atheros Dynamic Turbo mode. +.It Dv IEEE80211_C_IBSS +Device is capable of operating in adhoc/IBSS mode. +.It Dv IEEE80211_C_PMGT +Device supports dynamic power-management (aka power save) in station mode. +.It Dv IEEE80211_C_HOSTAP +Device is capable of operating as an Access Point in Infrastructure mode. +.It Dv IEEE80211_C_AHDEMO +Device is capable of operating in Adhoc Demo mode. +In this mode the device is used purely to send/receive raw 802.11 frames. +.It Dv IEEE80211_C_SWRETRY +Device supports software retry of transmitted frames. +.It Dv IEEE80211_C_TXPMGT +Device support dynamic transmit power changes on transmitted frames; +also known as Transmit Power Control (TPC). +.It Dv IEEE80211_C_SHSLOT +Device supports short slot time operation (for 802.11g). +.It Dv IEEE80211_C_SHPREAMBLE +Device supports short preamble operation (for 802.11g). +.It Dv IEEE80211_C_MONITOR +Device is capable of operating in monitor mode. +.It Dv IEEE80211_C_DFS +Device supports radar detection and/or DFS. +DFS protocol support can be handled by +.Nm +but the device must be capable of detecting radar events. +.It Dv IEEE80211_C_MBSS +Device is capable of operating in MeshBSS (MBSS) mode +(as defined by 802.11s Draft 3.0). +.It Dv IEEE80211_C_WPA1 +Device supports WPA1 operation. +.It Dv IEEE80211_C_WPA2 +Device supports WPA2/802.11i operation. +.It Dv IEEE80211_C_BURST +Device supports frame bursting. +.It Dv IEEE80211_C_WME +Device supports WME/WMM operation +(at the moment this is mostly support for sending and receiving +QoS frames with EDCF). +.It Dv IEEE80211_C_WDS +Device supports transmit/receive of 4-address frames. +.It Dv IEEE80211_C_BGSCAN +Device supports background scanning. +.It Dv IEEE80211_C_TXFRAG +Device supports transmit of fragmented 802.11 frames. +.It Dv IEEE80211_C_TDMA +Device is capable of operating in TDMA mode. +.El +.Pp +The follow general crypto capabilities are defined. +In general +.Nm +will fall-back to software support when a device is not capable +of hardware acceleration of a cipher. +This can be done on a per-key basis. +.Nm +can also handle software +.Dv Michael +calculation combined with hardware +.Dv AES +acceleration. +.Bl -tag -width IEEE80211_C_8023ENCAP +.It Dv IEEE80211_CRYPTO_WEP +Device supports hardware WEP cipher. +.It Dv IEEE80211_CRYPTO_TKIP +Device supports hardware TKIP cipher. +.It Dv IEEE80211_CRYPTO_AES_OCB +Device supports hardware AES-OCB cipher. +.It Dv IEEE80211_CRYPTO_AES_CCM +Device supports hardware AES-CCM cipher. +.It Dv IEEE80211_CRYPTO_TKIPMIC +Device supports hardware Michael for use with TKIP. +.It Dv IEEE80211_CRYPTO_CKIP +Devices supports hardware CKIP cipher. +.El +.Pp +The follow general 802.11n capabilities are defined. +The first capabilities are defined exactly as they appear in the +802.11n specification. +Capabilities beginning with IEEE80211_HTC_AMPDU are used soley by the +.Nm +layer. +.Bl -tag -width IEEE80211_C_8023ENCAP +.It Dv IEEE80211_HTCAP_CHWIDTH40 +Device supports 20/40 channel width operation. +.It Dv IEEE80211_HTCAP_SMPS_DYNAMIC +Device supports dynamic SM power save operation. +.It Dv IEEE80211_HTCAP_SMPS_ENA +Device supports static SM power save operation. +.It Dv IEEE80211_HTCAP_GREENFIELD +Device supports Greenfield preamble. +.It Dv IEEE80211_HTCAP_SHORTGI20 +Device supports Short Guard Interval on 20MHz channels. +.It Dv IEEE80211_HTCAP_SHORTGI40 +Device supports Short Guard Interval on 40MHz channels. +.It Dv IEEE80211_HTCAP_TXSTBC +Device supports Space Time Block Convolution (STBC) for transmit. +.It Dv IEEE80211_HTCAP_RXSTBC_1STREAM +Device supports 1 spatial stream for STBC receive. +.It Dv IEEE80211_HTCAP_RXSTBC_2STREAM +Device supports 1-2 spatial streams for STBC receive. +.It Dv IEEE80211_HTCAP_RXSTBC_3STREAM +Device supports 1-3 spatial streams for STBC receive. +.It Dv IEEE80211_HTCAP_MAXAMSDU_7935 +Device supports A-MSDU frames up to 7935 octets. +.It Dv IEEE80211_HTCAP_MAXAMSDU_3839 +Device supports A-MSDU frames up to 3839 octets. +.It Dv IEEE80211_HTCAP_DSSSCCK40 +Device supports use of DSSS/CCK on 40MHz channels. +.It Dv IEEE80211_HTCAP_PSMP +Device supports PSMP. +.It Dv IEEE80211_HTCAP_40INTOLERANT +Device is intolerant of 40MHz wide channel use. +.It Dv IEEE80211_HTCAP_LSIGTXOPPROT +Device supports L-SIG TXOP protection. +.It Dv IEEE80211_HTC_AMPDU +Device supports A-MPDU aggregation. +Note that any 802.11n compliant device must support A-MPDU receive +so this implicitly means support for +.Em transmit +of A-MPDU frames. +.It Dv IEEE80211_HTC_AMSDU +Device supports A-MSDU aggregation. +Note that any 802.11n compliant device must support A-MSDU receive +so this implicitly means support for +.Em transmit +of A-MSDU frames. +.It Dv IEEE80211_HTC_HT +Device supports High Throughput (HT) operation. +This capability must be set to enable 802.11n functionality +in +.Nm . +.It Dv IEEE80211_HTC_SMPS +Device supports MIMO Power Save operation. +.It Dv IEEE80211_HTC_RIFS +Device supports Reduced Inter Frame Spacing (RIFS). +.El .Sh SEE ALSO -.Xr ieee80211_crypto 9 , +.Xr ioctl 2 , +.Xr ndis 4 , .Xr ieee80211_input 9 , -.Xr ieee80211_ioctl 9 , -.Xr ieee80211_node 9 , -.Xr ieee80211_output 9 , -.Xr ieee80211_proto 9 , -.Xr ieee80211_radiotap 9 , -.Xr ifnet 9 -.Sh HISTORY -The -.Nm ieee80211 -series of functions first appeared in -.Nx 1.5 , -and were later ported to -.Fx 4.6 . -.Sh AUTHORS -.An -nosplit -This manual page was written by -.An Bruce M. Simpson Aq bms@FreeBSD.org -and -.An Darron Broad Aq darron@kewl.org . +.Xr ieee80211_input_all 9 , +.Xr ieee80211_scan_next 9 , +.Xr ieee80211_recv_action 9 , +.Xr ieee80211_send_action 9 , +.Xr ieee80211_radiotap_attach 9 , +.Xr ifnet 9 , +.Xr malloc 9 . Added: head/share/man/man9/ieee80211_amrr.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/ieee80211_amrr.9 Wed Aug 12 21:03:16 2009 (r196155) @@ -0,0 +1,194 @@ +.\" +.\" Copyright (c) 2009 Sam Leffler, Errno Consulting +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd August 4, 2009 +.Dt IEEE8021_AMRR 9 +.Os +.Sh NAME +.Nm ieee80211_amrr +.Nd 802.11 network driver transmit rate control support +.Sh SYNOPSIS +.In net80211/ieee80211_amrr.h +.Ft void +.Fo ieee80211_amrr_init +.Fa "struct ieee80211_amrr *" +.Fa "struct ieee80211vap *" +.Fa "int amin" +.Fa "int amax" +.Fa "int interval" +.Fc +.\" +.Ft void +.Fn ieee80211_amrr_cleanup "struct ieee80211_amrr *" +.\" +.Ft void +.Fn ieee80211_amrr_setinterval "struct ieee80211_amrr *" "int interval" +.\" +.Ft void +.Fo ieee80211_amrr_node_init +.Fa "struct ieee80211_amrr *" +.Fa "struct ieee80211_amrr_node *" +.Fa "struct ieee80211_node *" +.Fc +.\" +.Ft int +.Fo ieee80211_amrr_choose +.Fa "struct ieee80211_node *" +.Fa "struct ieee80211_amrr_node *" +.Fc +.\" +.Ft void +.Fo ieee80211_amrr_tx_complete +.Fa "struct ieee80211_amrr_node *" +.Fa "int ok" +.Fa "int retries" +.Fc +.\" +.Ft void +.Fo ieee80211_amrr_tx_update +.Fa "struct ieee80211_amrr_node *" +.Fa "int txnct" +.Fa "int success" +.Fa "int retrycnt" +.Fc +.Sh DESCRIPTION +.Nm +is an implementation of the AMRR transmit rate control algorithm +for drivers that use the +.Nm net80211 +software layer. +A rate control algorithm is responsible for choosing the transmit +rate for each frame. +To maximize throughput algorithms try to use the highest rate that +is appropriate for the operating conditions. +The rate will vary as conditions change; the distance between two stations +may change, transient noise may be present that affects signal quality, +etc. +.Nm +uses very simple information from a driver to do it's job: +whether a frame was successfully delivered and how many transmit +attempts were made. +While this enables its use with virtually any wireless device it +limits it's effectiveness--do not expect it to function well in +difficult environments and/or respond quickly to changing conditions. +.Pp +.Nm +requires per-vap state and per-node state for each station it is to +select rates for. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From sam at FreeBSD.org Wed Aug 12 21:19:21 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Wed Aug 12 21:19:35 2009 Subject: svn commit: r196159 - head/sys/net80211 Message-ID: <200908122119.n7CLJJlk077111@svn.freebsd.org> Author: sam Date: Wed Aug 12 21:19:19 2009 New Revision: 196159 URL: http://svn.freebsd.org/changeset/base/196159 Log: Drain link state event changes posted during vap destroy. This is a band-aid for the general problem that if_link_state_change can be called between if_detach and if_free leaving a task queued that has been free'd. Spotted by: thompsa Reviewed by: rwatson Approved by: re (rwatson) Modified: head/sys/net80211/ieee80211.c Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Wed Aug 12 21:06:43 2009 (r196158) +++ head/sys/net80211/ieee80211.c Wed Aug 12 21:19:19 2009 (r196159) @@ -573,11 +573,13 @@ ieee80211_vap_detach(struct ieee80211vap /* * Flush any deferred vap tasks. - * NB: must be before ether_ifdetach() and removal from ic_vaps list */ ieee80211_draintask(ic, &vap->iv_nstate_task); ieee80211_draintask(ic, &vap->iv_swbmiss_task); + /* XXX band-aid until ifnet handles this for us */ + taskqueue_drain(taskqueue_swi, &ifp->if_linktask); + IEEE80211_LOCK(ic); KASSERT(vap->iv_state == IEEE80211_S_INIT , ("vap still running")); TAILQ_REMOVE(&ic->ic_vaps, vap, iv_next); From delphij at delphij.net Wed Aug 12 21:45:50 2009 From: delphij at delphij.net (Xin LI) Date: Wed Aug 12 21:45:56 2009 Subject: svn commit: r189117 - head/sys/dev/bce In-Reply-To: <20090812234935.84e5ac74.stas@FreeBSD.org> References: <200902271925.n1RJP699080658@svn.freebsd.org> <20090721145559.d2cf3f0b.stas@FreeBSD.org> <4A7AFFC4.5050607@tomjudge.com> <20090812234935.84e5ac74.stas@FreeBSD.org> Message-ID: <4A8337BD.3010700@delphij.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, Stanislav, Stanislav Sedov wrote: > On Thu, 06 Aug 2009 11:07:32 -0500 > Tom Judge mentioned: > >> I can confirm that we are also seeing this problem on a number of Dell >> PE2950 systems running the bce driver from 7.2, the bug is more >> visible/producible on systems that are using Jumbo Frames (in our case 8Kb). >> >> The symptoms of this are an increase in the requests for jumbo clusters >> denied counter at 9k, and then random network stalls which sometimes >> recover on there own and others require a reboot. >> >> We have backed this change and so far it seems to have fixed the issue. >> > > David, > > are you OK with reverting this patch? I submitted the patch to re@ for > review, and I can commit it if you don't mind doing so. :-) I think there was some motivation supporting the SPLIT_HEADER disable in the past (IIRC it was for reliability or data corruption), but I think I have lost the mail archive (at least I couldn't find it at this moment :-/ I'm not very sure if that was fixed by my busdma_sync fix, though, can anyone confirm that? Cheers, - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.12 (FreeBSD) iEYEARECAAYFAkqDN70ACgkQi+vbBBjt66CfiwCeIpYBDxMXZPhW6gLhdXdBYgj4 uIIAoIRnUkEs0n1xTRJb0JzryxR6poD+ =Iuis -----END PGP SIGNATURE----- From rwatson at FreeBSD.org Wed Aug 12 21:55:47 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Wed Aug 12 21:55:54 2009 Subject: svn commit: r196159 - head/sys/net80211 In-Reply-To: <200908122119.n7CLJJlk077111@svn.freebsd.org> References: <200908122119.n7CLJJlk077111@svn.freebsd.org> Message-ID: On Wed, 12 Aug 2009, Sam Leffler wrote: > Drain link state event changes posted during vap destroy. This is a > band-aid for the general problem that if_link_state_change can be > called between if_detach and if_free leaving a task queued that has > been free'd. FYI to others -- we believe the proper fix should be in the ifnet framework, but this change was the lowest-risk way to resolve the problem for 8.0. Following the release we'll investigate having the ifnet framework provide this protection automatically for drivers. Robert N M Watson Computer Laboratory University of Cambridge > Spotted by: thompsa > Reviewed by: rwatson > Approved by: re (rwatson) > > Modified: > head/sys/net80211/ieee80211.c > > Modified: head/sys/net80211/ieee80211.c > ============================================================================== > --- head/sys/net80211/ieee80211.c Wed Aug 12 21:06:43 2009 (r196158) > +++ head/sys/net80211/ieee80211.c Wed Aug 12 21:19:19 2009 (r196159) > @@ -573,11 +573,13 @@ ieee80211_vap_detach(struct ieee80211vap > > /* > * Flush any deferred vap tasks. > - * NB: must be before ether_ifdetach() and removal from ic_vaps list > */ > ieee80211_draintask(ic, &vap->iv_nstate_task); > ieee80211_draintask(ic, &vap->iv_swbmiss_task); > > + /* XXX band-aid until ifnet handles this for us */ > + taskqueue_drain(taskqueue_swi, &ifp->if_linktask); > + > IEEE80211_LOCK(ic); > KASSERT(vap->iv_state == IEEE80211_S_INIT , ("vap still running")); > TAILQ_REMOVE(&ic->ic_vaps, vap, iv_next); > From pyunyh at gmail.com Wed Aug 12 22:58:32 2009 From: pyunyh at gmail.com (Pyun YongHyeon) Date: Wed Aug 12 22:58:39 2009 Subject: svn commit: r189117 - head/sys/dev/bce In-Reply-To: <4A8337BD.3010700@delphij.net> References: <200902271925.n1RJP699080658@svn.freebsd.org> <20090721145559.d2cf3f0b.stas@FreeBSD.org> <4A7AFFC4.5050607@tomjudge.com> <20090812234935.84e5ac74.stas@FreeBSD.org> <4A8337BD.3010700@delphij.net> Message-ID: <20090812225726.GI55129@michelle.cdnetworks.com> On Wed, Aug 12, 2009 at 02:44:29PM -0700, Xin LI wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi, Stanislav, > > Stanislav Sedov wrote: > > On Thu, 06 Aug 2009 11:07:32 -0500 > > Tom Judge mentioned: > > > >> I can confirm that we are also seeing this problem on a number of Dell > >> PE2950 systems running the bce driver from 7.2, the bug is more > >> visible/producible on systems that are using Jumbo Frames (in our case 8Kb). > >> > >> The symptoms of this are an increase in the requests for jumbo clusters > >> denied counter at 9k, and then random network stalls which sometimes > >> recover on there own and others require a reboot. > >> > >> We have backed this change and so far it seems to have fixed the issue. > >> > > > > David, > > > > are you OK with reverting this patch? I submitted the patch to re@ for > > review, and I can commit it if you don't mind doing so. :-) > > I think there was some motivation supporting the SPLIT_HEADER disable in > the past (IIRC it was for reliability or data corruption), but I think I > have lost the mail archive (at least I couldn't find it at this moment > :-/ I'm not very sure if that was fixed by my busdma_sync fix, though, > can anyone confirm that? > Since I don't have bce(4) hardwares I can't confirm it. I think the busdma_sync fix would be prerequisite condition to fix data corruption problem but I think it would not necessarily fix previous data corruption issue. From mjacob at FreeBSD.org Thu Aug 13 01:17:27 2009 From: mjacob at FreeBSD.org (Matt Jacob) Date: Thu Aug 13 01:17:34 2009 Subject: svn commit: r196162 - head/sys/dev/isp Message-ID: <200908130117.n7D1HR7E082170@svn.freebsd.org> Author: mjacob Date: Thu Aug 13 01:17:26 2009 New Revision: 196162 URL: http://svn.freebsd.org/changeset/base/196162 Log: Have at least *some* default WWN to fall back on, otherwise Sun branded FC cards won't configure. Reviewed by: Ken, Scott Approved by: re Modified: head/sys/dev/isp/isp_freebsd.c Modified: head/sys/dev/isp/isp_freebsd.c ============================================================================== --- head/sys/dev/isp/isp_freebsd.c Wed Aug 12 21:34:57 2009 (r196161) +++ head/sys/dev/isp/isp_freebsd.c Thu Aug 13 01:17:26 2009 (r196162) @@ -5280,6 +5280,10 @@ isp_default_wwn(ispsoftc_t * isp, int ch return (seed); } seed = iswwnn ? FCPARAM(isp, chan)->isp_wwnn_nvram : FCPARAM(isp, chan)->isp_wwpn_nvram; + if (seed) { + return (seed); + } + return (0x400000007F000009ull); } else { seed = iswwnn ? fc->def_wwnn : fc->def_wwpn; } From des at FreeBSD.org Thu Aug 13 06:07:40 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Thu Aug 13 06:07:51 2009 Subject: svn commit: r196164 - in head: contrib/bzip2 contrib/netcat contrib/openpam crypto/openssh Message-ID: <200908130607.n7D67dfm089197@svn.freebsd.org> Author: des Date: Thu Aug 13 06:07:38 2009 New Revision: 196164 URL: http://svn.freebsd.org/changeset/base/196164 Log: Update and remove CVS-specific items Approved by: re (kib) Modified: head/contrib/bzip2/FREEBSD-vendor head/contrib/netcat/FREEBSD-vendor head/contrib/openpam/FREEBSD-vendor head/crypto/openssh/FREEBSD-vendor Modified: head/contrib/bzip2/FREEBSD-vendor ============================================================================== --- head/contrib/bzip2/FREEBSD-vendor Thu Aug 13 01:45:26 2009 (r196163) +++ head/contrib/bzip2/FREEBSD-vendor Thu Aug 13 06:07:38 2009 (r196164) @@ -2,6 +2,4 @@ Project: bzip2 ProjectURL: http://www.bzip.org/ Version: 1.0.5 -VendorTag: BZIP2 -VersionTag: v1_0_5 License: BSD Modified: head/contrib/netcat/FREEBSD-vendor ============================================================================== --- head/contrib/netcat/FREEBSD-vendor Thu Aug 13 01:45:26 2009 (r196163) +++ head/contrib/netcat/FREEBSD-vendor Thu Aug 13 06:07:38 2009 (r196164) @@ -2,6 +2,4 @@ Project: netcat (aka src/usr.bin/nc in OpenBSD) ProjectURL: http://www.openbsd.org/ Version: 4.4 -VendorTag: OPENBSD -VersionTag: OPENBSD_4_4 License: BSD Modified: head/contrib/openpam/FREEBSD-vendor ============================================================================== --- head/contrib/openpam/FREEBSD-vendor Thu Aug 13 01:45:26 2009 (r196163) +++ head/contrib/openpam/FREEBSD-vendor Thu Aug 13 06:07:38 2009 (r196164) @@ -2,7 +2,5 @@ Project: OpenPAM ProjectURL: http://www.openpam.org/ Version: Hydrangea (20071221) -VendorTag: OPENPAM -VersionTag: OPENPAM_HYDRANGEA License: BSD Maintainer: des Modified: head/crypto/openssh/FREEBSD-vendor ============================================================================== --- head/crypto/openssh/FREEBSD-vendor Thu Aug 13 01:45:26 2009 (r196163) +++ head/crypto/openssh/FREEBSD-vendor Thu Aug 13 06:07:38 2009 (r196164) @@ -1,8 +1,6 @@ # $FreeBSD$ Project: Portable OpenSSH ProjectURL: http://www.openssh.com/portable.html -Version: 5.1p1 -VendorTag: OPENSSH -VersionTag: OpenSSH_5_1p1 +Version: 5.2p1 License: BSD Maintainer: des From bz at FreeBSD.org Thu Aug 13 09:11:48 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Aug 13 09:12:00 2009 Subject: svn commit: r196172 - head/tools/regression/priv Message-ID: <200908130911.n7D9BmsI094785@svn.freebsd.org> Author: bz Date: Thu Aug 13 09:11:47 2009 New Revision: 196172 URL: http://svn.freebsd.org/changeset/base/196172 Log: Start respecting WITHOUT_INET6. Make regression/priv compile again after the multi-IP jail changes. Note that we are still using the legacy jail(2) rather than the jail_set(2)/jail(3) syscall. Add an IPv4, and an IPv6 loopback address in case we compile with INET6 enabled. Make the priv_vfs_extattr_system compile on amd64 as well using the proper length modifier to printf(3) for ssize_t. Reviewed by: rwatson Approved by: re (kib) Modified: head/tools/regression/priv/Makefile head/tools/regression/priv/main.c head/tools/regression/priv/priv_netinet_ipsec.c head/tools/regression/priv/priv_vfs_extattr_system.c Modified: head/tools/regression/priv/Makefile ============================================================================== --- head/tools/regression/priv/Makefile Thu Aug 13 08:31:15 2009 (r196171) +++ head/tools/regression/priv/Makefile Thu Aug 13 09:11:47 2009 (r196172) @@ -2,6 +2,8 @@ # $FreeBSD$ # +.include + PROG= priv SRCS= main.c \ priv_acct.c \ @@ -49,4 +51,8 @@ WARNS= 3 DPADD+= ${LIBIPSEC} LDADD+= -lipsec +.if ${MK_INET6_SUPPORT} != "no" +CFLAGS+= -DINET6 +.endif + .include Modified: head/tools/regression/priv/main.c ============================================================================== --- head/tools/regression/priv/main.c Thu Aug 13 08:31:15 2009 (r196171) +++ head/tools/regression/priv/main.c Thu Aug 13 09:11:47 2009 (r196172) @@ -142,20 +142,24 @@ static struct test tests[] = { priv_netinet_ipsec_policy4_bypass, priv_netinet_ipsec_policy_bypass_cleanup }, +#ifdef INET6 { "priv_netinet_ipsec_policy6_bypass", priv_netinet_ipsec_policy6_bypass_setup, priv_netinet_ipsec_policy6_bypass, priv_netinet_ipsec_policy_bypass_cleanup }, +#endif { "priv_netinet_ipsec_policy4_entrust", priv_netinet_ipsec_policy4_entrust_setup, priv_netinet_ipsec_policy4_entrust, priv_netinet_ipsec_policy_entrust_cleanup }, +#ifdef INET6 { "priv_netinet_ipsec_policy6_entrust", priv_netinet_ipsec_policy6_entrust_setup, priv_netinet_ipsec_policy6_entrust, priv_netinet_ipsec_policy_entrust_cleanup }, +#endif { "priv_netinet_raw", priv_netinet_raw_setup, priv_netinet_raw, priv_netinet_raw_cleanup }, @@ -420,12 +424,23 @@ static void enter_jail(const char *test) { struct jail j; + struct in_addr ia4; +#ifdef INET6 + struct in6_addr ia6 = IN6ADDR_LOOPBACK_INIT; +#endif bzero(&j, sizeof(j)); - j.version = 0; + j.version = JAIL_API_VERSION; j.path = "/"; j.hostname = "test"; - j.ip_number = htonl(INADDR_LOOPBACK); + j.jailname = "regressions/priv"; + ia4.s_addr = htonl(INADDR_LOOPBACK); + j.ip4s = 1; + j.ip4 = &ia4; +#ifdef INET6 + j.ip6s = 1; + j.ip6 = &ia6; +#endif if (jail(&j) < 0) err(-1, "test %s: jail", test); } Modified: head/tools/regression/priv/priv_netinet_ipsec.c ============================================================================== --- head/tools/regression/priv/priv_netinet_ipsec.c Thu Aug 13 08:31:15 2009 (r196171) +++ head/tools/regression/priv/priv_netinet_ipsec.c Thu Aug 13 09:11:47 2009 (r196172) @@ -69,6 +69,7 @@ priv_netinet_ipsec_policy_bypass_setup_a return (-1); } break; +#ifdef INET6 case AF_INET6: sd = socket(AF_INET6, SOCK_DGRAM, 0); if (sd < 0) { @@ -76,6 +77,7 @@ priv_netinet_ipsec_policy_bypass_setup_a return (-1); } break; +#endif default: warnx("%s: unexpected address family", __func__); return (-1); @@ -92,6 +94,7 @@ priv_netinet_ipsec_policy4_bypass_setup( AF_INET)); } +#ifdef INET6 int priv_netinet_ipsec_policy6_bypass_setup(int asroot, int injail, struct test *test) @@ -100,7 +103,7 @@ priv_netinet_ipsec_policy6_bypass_setup( return (priv_netinet_ipsec_policy_bypass_setup_af(asroot, injail, test, AF_INET6)); } - +#endif static int @@ -121,6 +124,7 @@ priv_netinet_ipsec_policy_entrust_setup_ return (-1); } break; +#ifdef INET6 case AF_INET6: sd = socket(AF_INET6, SOCK_DGRAM, 0); if (sd < 0) { @@ -128,6 +132,7 @@ priv_netinet_ipsec_policy_entrust_setup_ return (-1); } break; +#endif default: warnx("%s: unexpected address family", __func__); return (-1); @@ -144,6 +149,7 @@ priv_netinet_ipsec_policy4_entrust_setup AF_INET)); } +#ifdef INET6 int priv_netinet_ipsec_policy6_entrust_setup(int asroot, int injail, struct test *test) @@ -152,7 +158,7 @@ priv_netinet_ipsec_policy6_entrust_setup return (priv_netinet_ipsec_policy_entrust_setup_af(asroot, injail, test, AF_INET6)); } - +#endif void priv_netinet_ipsec_pfkey(int asroot, int injail, struct test *test) @@ -196,10 +202,12 @@ priv_netinet_ipsec_policy_bypass_af(int level = IPPROTO_IP; optname = IP_IPSEC_POLICY; break; +#ifdef INET6 case AF_INET6: level = IPPROTO_IPV6; optname = IPV6_IPSEC_POLICY; break; +#endif default: warnx("%s: unexpected address family", __func__); return; @@ -227,13 +235,14 @@ priv_netinet_ipsec_policy4_bypass(int as priv_netinet_ipsec_policy_bypass_af(asroot, injail, test, AF_INET); } +#ifdef INET6 void priv_netinet_ipsec_policy6_bypass(int asroot, int injail, struct test *test) { priv_netinet_ipsec_policy_bypass_af(asroot, injail, test, AF_INET6); } - +#endif static void priv_netinet_ipsec_policy_entrust_af(int asroot, int injail, struct test *test, @@ -246,10 +255,12 @@ priv_netinet_ipsec_policy_entrust_af(int level = IPPROTO_IP; optname = IP_IPSEC_POLICY; break; +#ifdef INET6 case AF_INET6: level = IPPROTO_IPV6; optname = IPV6_IPSEC_POLICY; break; +#endif default: warnx("%s: unexpected address family", __func__); return; @@ -277,13 +288,14 @@ priv_netinet_ipsec_policy4_entrust(int a priv_netinet_ipsec_policy_entrust_af(asroot, injail, test, AF_INET); } +#ifdef INET6 void priv_netinet_ipsec_policy6_entrust(int asroot, int injail, struct test *test) { priv_netinet_ipsec_policy_entrust_af(asroot, injail, test, AF_INET6); } - +#endif void priv_netinet_ipsec_policy_bypass_cleanup(int asroot, int injail, Modified: head/tools/regression/priv/priv_vfs_extattr_system.c ============================================================================== --- head/tools/regression/priv/priv_vfs_extattr_system.c Thu Aug 13 08:31:15 2009 (r196171) +++ head/tools/regression/priv/priv_vfs_extattr_system.c Thu Aug 13 09:11:47 2009 (r196172) @@ -80,7 +80,7 @@ priv_vfs_extattr_system(int asroot, int else if (ret == EA_SIZE) error = 0; else - err(-1, "priv_vfs_extattr_system: set returned %d", ret); + err(-1, "priv_vfs_extattr_system: set returned %zd", ret); if (asroot && injail) expect("priv_vfs_extattr_system(asroot, injail)", error, -1, EPERM); From bz at FreeBSD.org Thu Aug 13 09:29:54 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Aug 13 09:30:00 2009 Subject: svn commit: r196174 - head/sys/net Message-ID: <200908130929.n7D9TrGh095296@svn.freebsd.org> Author: bz Date: Thu Aug 13 09:29:52 2009 New Revision: 196174 URL: http://svn.freebsd.org/changeset/base/196174 Log: Put multiple instructions into a block when iterating; unbreaks NET_RT_DUMP, which otherwise only returned information of AF_MAX. This was broken in r193232 (save your time - my bug, my fix). PR: kern/137700 Reported by: Larry Baird (lab gta.com) Tested by: Larry Baird (lab gta.com) Reviewed by: zec, lstewart, qing Approved by: re (kib) Modified: head/sys/net/rtsock.c Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Thu Aug 13 09:17:07 2009 (r196173) +++ head/sys/net/rtsock.c Thu Aug 13 09:29:52 2009 (r196174) @@ -1473,7 +1473,7 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS) /* * take care of routing entries */ - for (error = 0; error == 0 && i <= lim; i++) + for (error = 0; error == 0 && i <= lim; i++) { rnh = rt_tables_get_rnh(req->td->td_proc->p_fibnum, i); if (rnh != NULL) { RADIX_NODE_HEAD_LOCK(rnh); @@ -1482,6 +1482,7 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS) RADIX_NODE_HEAD_UNLOCK(rnh); } else if (af != 0) error = EAFNOSUPPORT; + } break; case NET_RT_IFLIST: From bz at FreeBSD.org Thu Aug 13 10:26:35 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Aug 13 10:26:46 2009 Subject: svn commit: r196176 - in head/sys: kern net sys Message-ID: <200908131026.n7DAQYN1097674@svn.freebsd.org> Author: bz Date: Thu Aug 13 10:26:34 2009 New Revision: 196176 URL: http://svn.freebsd.org/changeset/base/196176 Log: Make it possible to change the vnet sysctl variables on jails with their own virtual network stack. Jails only inheriting a network stack cannot change anything that cannot be changed from within a prison. Reviewed by: rwatson, zec Approved by: re (kib) Modified: head/sys/kern/kern_jail.c head/sys/kern/kern_sysctl.c head/sys/net/vnet.h head/sys/sys/jail.h head/sys/sys/sysctl.h Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Thu Aug 13 09:32:15 2009 (r196175) +++ head/sys/kern/kern_jail.c Thu Aug 13 10:26:34 2009 (r196176) @@ -88,7 +88,11 @@ struct prison prison0 = { .pr_childmax = JAIL_MAX, .pr_hostuuid = DEFAULT_HOSTUUID, .pr_children = LIST_HEAD_INITIALIZER(&prison0.pr_children), +#ifdef VIMAGE + .pr_flags = PR_HOST|PR_VNET, +#else .pr_flags = PR_HOST, +#endif .pr_allow = PR_ALLOW_ALL, }; MTX_SYSINIT(prison0, &prison0.pr_mtx, "jail mutex", MTX_DEF); @@ -3308,6 +3312,25 @@ getcredhostid(struct ucred *cred, unsign mtx_unlock(&cred->cr_prison->pr_mtx); } +#ifdef VIMAGE +/* + * Determine whether the prison represented by cred owns + * its vnet rather than having it inherited. + * + * Returns 1 in case the prison owns the vnet, 0 otherwise. + */ +int +prison_owns_vnet(struct ucred *cred) +{ + + /* + * vnets cannot be added/removed after jail creation, + * so no need to lock here. + */ + return (cred->cr_prison->pr_flags & PR_VNET ? 1 : 0); +} +#endif + /* * Determine whether the subject represented by cred can "see" * status of a mount point. Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Thu Aug 13 09:32:15 2009 (r196175) +++ head/sys/kern/kern_sysctl.c Thu Aug 13 10:26:34 2009 (r196176) @@ -1381,10 +1381,18 @@ sysctl_root(SYSCTL_HANDLER_ARGS) /* Is this sysctl writable by only privileged users? */ if (req->newptr && !(oid->oid_kind & CTLFLAG_ANYBODY)) { + int priv; + if (oid->oid_kind & CTLFLAG_PRISON) - error = priv_check(req->td, PRIV_SYSCTL_WRITEJAIL); + priv = PRIV_SYSCTL_WRITEJAIL; +#ifdef VIMAGE + else if ((oid->oid_kind & CTLFLAG_VNET) && + prison_owns_vnet(req->td->td_ucred)) + priv = PRIV_SYSCTL_WRITEJAIL; +#endif else - error = priv_check(req->td, PRIV_SYSCTL_WRITE); + priv = PRIV_SYSCTL_WRITE; + error = priv_check(req->td, priv); if (error) return (error); } Modified: head/sys/net/vnet.h ============================================================================== --- head/sys/net/vnet.h Thu Aug 13 09:32:15 2009 (r196175) +++ head/sys/net/vnet.h Thu Aug 13 10:26:34 2009 (r196176) @@ -232,21 +232,25 @@ int vnet_sysctl_handle_string(SYSCTL_HAN int vnet_sysctl_handle_uint(SYSCTL_HANDLER_ARGS); #define SYSCTL_VNET_INT(parent, nbr, name, access, ptr, val, descr) \ - SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|CTLFLAG_MPSAFE|(access), \ + SYSCTL_OID(parent, nbr, name, \ + CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_VNET|(access), \ ptr, val, vnet_sysctl_handle_int, "I", descr) #define SYSCTL_VNET_PROC(parent, nbr, name, access, ptr, arg, handler, \ fmt, descr) \ - SYSCTL_OID(parent, nbr, name, access, ptr, arg, handler, fmt, \ - descr) + SYSCTL_OID(parent, nbr, name, CTLFLAG_VNET|(access), ptr, arg, \ + handler, fmt, descr) #define SYSCTL_VNET_STRING(parent, nbr, name, access, arg, len, descr) \ - SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access), arg, \ - len, vnet_sysctl_handle_string, "A", descr) + SYSCTL_OID(parent, nbr, name, \ + CTLTYPE_STRING|CTLFLAG_VNET|(access), \ + arg, len, vnet_sysctl_handle_string, "A", descr) #define SYSCTL_VNET_STRUCT(parent, nbr, name, access, ptr, type, descr) \ - SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), ptr, \ + SYSCTL_OID(parent, nbr, name, \ + CTLTYPE_OPAQUE|CTLFLAG_VNET|(access), ptr, \ sizeof(struct type), vnet_sysctl_handle_opaque, "S," #type, \ descr) #define SYSCTL_VNET_UINT(parent, nbr, name, access, ptr, val, descr) \ - SYSCTL_OID(parent, nbr, name, CTLTYPE_UINT|CTLFLAG_MPSAFE|(access), \ + SYSCTL_OID(parent, nbr, name, \ + CTLTYPE_UINT|CTLFLAG_MPSAFE|CTLFLAG_VNET|(access), \ ptr, val, vnet_sysctl_handle_uint, "IU", descr) #define VNET_SYSCTL_ARG(req, arg1) do { \ if (arg1 != NULL) \ Modified: head/sys/sys/jail.h ============================================================================== --- head/sys/sys/jail.h Thu Aug 13 09:32:15 2009 (r196175) +++ head/sys/sys/jail.h Thu Aug 13 10:26:34 2009 (r196176) @@ -341,6 +341,7 @@ void getcredhostuuid(struct ucred *, cha void getcredhostid(struct ucred *, unsigned long *); int prison_allow(struct ucred *, unsigned); int prison_check(struct ucred *cred1, struct ucred *cred2); +int prison_owns_vnet(struct ucred *); int prison_canseemount(struct ucred *cred, struct mount *mp); void prison_enforce_statfs(struct ucred *cred, struct mount *mp, struct statfs *sp); Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Thu Aug 13 09:32:15 2009 (r196175) +++ head/sys/sys/sysctl.h Thu Aug 13 10:26:34 2009 (r196176) @@ -85,6 +85,7 @@ struct ctlname { #define CTLMASK_SECURE 0x00F00000 /* Secure level */ #define CTLFLAG_TUN 0x00080000 /* Tunable variable */ #define CTLFLAG_MPSAFE 0x00040000 /* Handler is MP safe */ +#define CTLFLAG_VNET 0x00020000 /* Prisons with vnet can fiddle */ #define CTLFLAG_RDTUN (CTLFLAG_RD|CTLFLAG_TUN) /* From trasz at FreeBSD.org Thu Aug 13 12:28:32 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Thu Aug 13 12:28:43 2009 Subject: svn commit: r196179 - head/sys/cddl/compat/opensolaris/kern Message-ID: <200908131228.n7DCSU1o000650@svn.freebsd.org> Author: trasz Date: Thu Aug 13 12:28:30 2009 New Revision: 196179 URL: http://svn.freebsd.org/changeset/base/196179 Log: Remove CDDL warning. Approved by: re (kib), core Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris.c Thu Aug 13 10:31:02 2009 (r196178) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris.c Thu Aug 13 12:28:30 2009 (r196179) @@ -49,10 +49,6 @@ opensolaris_load(void *dummy) { int i; - printf("This module (opensolaris) contains code covered by the\n"); - printf("Common Development and Distribution License (CDDL)\n"); - printf("see http://opensolaris.org/os/licensing/opensolaris_license/\n"); - /* * "Enable" all CPUs even though they may not exist just so * that the asserts work. On FreeBSD, if a CPU exists, it is From bz at FreeBSD.org Thu Aug 13 14:59:05 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Aug 13 14:59:17 2009 Subject: svn commit: r196185 - head/lib/libkvm Message-ID: <200908131459.n7DEx4hf004279@svn.freebsd.org> Author: bz Date: Thu Aug 13 14:59:04 2009 New Revision: 196185 URL: http://svn.freebsd.org/changeset/base/196185 Log: Rather than replicating the maths from the kernel, use the value the kernel calculated directly as we already read it with struct vnet. This will make kvm_vnet.c more resilent in case of possible kernel changes. Reviewed by: rwatson Approved by: re (kib) Modified: head/lib/libkvm/kvm_vnet.c Modified: head/lib/libkvm/kvm_vnet.c ============================================================================== --- head/lib/libkvm/kvm_vnet.c Thu Aug 13 14:50:39 2009 (r196184) +++ head/lib/libkvm/kvm_vnet.c Thu Aug 13 14:59:04 2009 (r196185) @@ -195,7 +195,7 @@ _kvm_vnet_selectpid(kvm_t *kd, pid_t pid kd->vnet_start = nl[NLIST_START_VNET].n_value; kd->vnet_stop = nl[NLIST_STOP_VNET].n_value; kd->vnet_current = (uintptr_t)prison.pr_vnet; - kd->vnet_base = (uintptr_t)vnet.vnet_data_mem - kd->vnet_start; + kd->vnet_base = vnet.vnet_data_base; return (0); } From raj at FreeBSD.org Thu Aug 13 15:56:10 2009 From: raj at FreeBSD.org (Rafal Jaworowski) Date: Thu Aug 13 15:56:21 2009 Subject: svn commit: r196193 - head/sys/arm/arm Message-ID: <200908131556.n7DFu9dE005965@svn.freebsd.org> Author: raj Date: Thu Aug 13 15:56:09 2009 New Revision: 196193 URL: http://svn.freebsd.org/changeset/base/196193 Log: Use correct wbinv operation in pmap_l2cache_wbinv_range(). Submitted by: Michal Hajduk Reviewed by: stas Approved by: re (kib) Obtained from: Semihalf Modified: head/sys/arm/arm/pmap.c Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Thu Aug 13 15:16:30 2009 (r196192) +++ head/sys/arm/arm/pmap.c Thu Aug 13 15:56:09 2009 (r196193) @@ -1212,7 +1212,7 @@ pmap_l2cache_wbinv_range(pmap_t pm, vm_o CTR4(KTR_PMAP, "pmap_l2cache_wbinv_range: pmap %p is_kernel %d " "va 0x%08x len 0x%x ", pm, pm == pmap_kernel(), va, rest); if (pmap_get_pde_pte(pm, va, &pde, &ptep) && l2pte_valid(*ptep)) - cpu_l2cache_wb_range(va, rest); + cpu_l2cache_wbinv_range(va, rest); len -= rest; va += rest; From attilio at FreeBSD.org Thu Aug 13 17:09:47 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Thu Aug 13 17:09:54 2009 Subject: svn commit: r196196 - in head: . sys/amd64/amd64 sys/amd64/conf sys/amd64/include sys/conf sys/i386/conf sys/i386/i386 sys/i386/include sys/i386/xen sys/ia64/ia64 sys/ia64/include sys/kern sys/mips... Message-ID: <200908131709.n7DH9jpC007642@svn.freebsd.org> Author: attilio Date: Thu Aug 13 17:09:45 2009 New Revision: 196196 URL: http://svn.freebsd.org/changeset/base/196196 Log: * Completely Remove the option STOP_NMI from the kernel. This option has proven to have a good effect when entering KDB by using a NMI, but it completely violates all the good rules about interrupts disabled while holding a spinlock in other occasions. This can be the cause of deadlocks on events where a normal IPI_STOP is expected. * Adds an new IPI called IPI_STOP_HARD on all the supported architectures. This IPI is responsible for sending a stop message among CPUs using a privileged channel when disponible. In other cases it just does match a normal IPI_STOP. Right now the IPI_STOP_HARD functionality uses a NMI on ia32 and amd64 architectures, while on the other has a normal IPI_STOP effect. It is responsibility of maintainers to eventually implement an hard stop when necessary and possible. * Use the new IPI facility in order to implement a new userend SMP kernel function called stop_cpus_hard(). That is specular to stop_cpu() but it does use the privileged channel for the stopping facility. * Let KDB use the newly introduced function stop_cpus_hard() and leave stop_cpus() for all the other cases * Disable interrupts on CPU0 when starting the process of APs suspension. * Style cleanup and comments adding This patch should fix the reboot/shutdown deadlocks many users are constantly reporting on mailing lists. Please don't forget to update your config file with the STOP_NMI option removal Reviewed by: jhb Tested by: pho, bz, rink Approved by: re (kib) Modified: head/UPDATING head/sys/amd64/amd64/local_apic.c head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/amd64/trap.c head/sys/amd64/conf/GENERIC head/sys/amd64/conf/NOTES head/sys/amd64/conf/XENHVM head/sys/amd64/include/apicvar.h head/sys/amd64/include/smp.h head/sys/conf/options.amd64 head/sys/conf/options.i386 head/sys/conf/options.pc98 head/sys/i386/conf/GENERIC head/sys/i386/conf/NOTES head/sys/i386/i386/local_apic.c head/sys/i386/i386/mp_machdep.c head/sys/i386/i386/trap.c head/sys/i386/include/apicvar.h head/sys/i386/include/smp.h head/sys/i386/xen/mp_machdep.c head/sys/ia64/ia64/interrupt.c head/sys/ia64/include/smp.h head/sys/kern/kern_shutdown.c head/sys/kern/subr_kdb.c head/sys/kern/subr_smp.c head/sys/mips/include/smp.h head/sys/mips/mips/mp_machdep.c head/sys/pc98/conf/NOTES head/sys/powerpc/include/smp.h head/sys/powerpc/powerpc/mp_machdep.c head/sys/sparc64/include/smp.h head/sys/sun4v/include/smp.h head/sys/sys/smp.h Modified: head/UPDATING ============================================================================== --- head/UPDATING Thu Aug 13 16:08:35 2009 (r196195) +++ head/UPDATING Thu Aug 13 17:09:45 2009 (r196196) @@ -22,6 +22,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20090813: + Remove the option STOP_NMI. The default action is now to use NMI + only for KDB via the newly introduced function stop_cpus_hard() + and maintain stop_cpus() to just use a normal IPI_STOP on ia32 + and amd64. + 20090719: Bump the shared library version numbers for all libraries that do not use symbol versioning as part of the 8.0-RELEASE cycle. Modified: head/sys/amd64/amd64/local_apic.c ============================================================================== --- head/sys/amd64/amd64/local_apic.c Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/amd64/amd64/local_apic.c Thu Aug 13 17:09:45 2009 (r196196) @@ -1238,8 +1238,17 @@ lapic_ipi_vectored(u_int vector, int des KASSERT((vector & ~APIC_VECTOR_MASK) == 0, ("%s: invalid vector %d", __func__, vector)); - icrlo = vector | APIC_DELMODE_FIXED | APIC_DESTMODE_PHY | - APIC_LEVEL_DEASSERT | APIC_TRIGMOD_EDGE; + icrlo = APIC_DESTMODE_PHY | APIC_TRIGMOD_EDGE; + + /* + * IPI_STOP_HARD is just a "fake" vector used to send a NMI. + * Use special rules regard NMI if passed, otherwise specify + * the vector. + */ + if (vector == IPI_STOP_HARD) + icrlo |= APIC_DELMODE_NMI | APIC_LEVEL_ASSERT; + else + icrlo |= vector | APIC_DELMODE_FIXED | APIC_LEVEL_DEASSERT; destfield = 0; switch (dest) { case APIC_IPI_DEST_SELF: Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/amd64/amd64/mp_machdep.c Thu Aug 13 17:09:45 2009 (r196196) @@ -114,31 +114,12 @@ volatile int smp_tlb_wait; extern inthand_t IDTVEC(fast_syscall), IDTVEC(fast_syscall32); -#ifdef STOP_NMI -static volatile cpumask_t ipi_nmi_pending; - -static void ipi_nmi_selected(cpumask_t cpus); -#endif - /* * Local data and functions. */ -#ifdef STOP_NMI -/* - * Provide an alternate method of stopping other CPUs. If another CPU has - * disabled interrupts the conventional STOP IPI will be blocked. This - * NMI-based stop should get through in that case. - */ -static int stop_cpus_with_nmi = 1; -SYSCTL_INT(_debug, OID_AUTO, stop_cpus_with_nmi, CTLTYPE_INT | CTLFLAG_RW, - &stop_cpus_with_nmi, 0, ""); -TUNABLE_INT("debug.stop_cpus_with_nmi", &stop_cpus_with_nmi); -#else -#define stop_cpus_with_nmi 0 -#endif - static u_int logical_cpus; +static volatile cpumask_t ipi_nmi_pending; /* used to hold the AP's until we are ready to release them */ static struct mtx ap_boot_mtx; @@ -1158,12 +1139,14 @@ ipi_selected(cpumask_t cpus, u_int ipi) ipi = IPI_BITMAP_VECTOR; } -#ifdef STOP_NMI - if (ipi == IPI_STOP && stop_cpus_with_nmi) { - ipi_nmi_selected(cpus); - return; - } -#endif + /* + * IPI_STOP_HARD maps to a NMI and the trap handler needs a bit + * of help in order to understand what is the source. + * Set the mask of receiving CPUs for this purpose. + */ + if (ipi == IPI_STOP_HARD) + atomic_set_int(&ipi_nmi_pending, cpus); + CTR3(KTR_SMP, "%s: cpus: %x ipi: %x", __func__, cpus, ipi); while ((cpu = ffs(cpus)) != 0) { cpu--; @@ -1194,64 +1177,43 @@ void ipi_all_but_self(u_int ipi) { - if (IPI_IS_BITMAPED(ipi) || (ipi == IPI_STOP && stop_cpus_with_nmi)) { + if (IPI_IS_BITMAPED(ipi)) { ipi_selected(PCPU_GET(other_cpus), ipi); return; } - CTR2(KTR_SMP, "%s: ipi: %x", __func__, ipi); - lapic_ipi_vectored(ipi, APIC_IPI_DEST_OTHERS); -} -#ifdef STOP_NMI -/* - * send NMI IPI to selected CPUs - */ - -#define BEFORE_SPIN 1000000 - -static void -ipi_nmi_selected(cpumask_t cpus) -{ - int cpu; - register_t icrlo; - - icrlo = APIC_DELMODE_NMI | APIC_DESTMODE_PHY | APIC_LEVEL_ASSERT - | APIC_TRIGMOD_EDGE; - - CTR2(KTR_SMP, "%s: cpus: %x nmi", __func__, cpus); - - atomic_set_int(&ipi_nmi_pending, cpus); - - while ((cpu = ffs(cpus)) != 0) { - cpu--; - cpus &= ~(1 << cpu); - - KASSERT(cpu_apic_ids[cpu] != -1, - ("IPI NMI to non-existent CPU %d", cpu)); - - /* Wait for an earlier IPI to finish. */ - if (!lapic_ipi_wait(BEFORE_SPIN)) - panic("ipi_nmi_selected: previous IPI has not cleared"); + /* + * IPI_STOP_HARD maps to a NMI and the trap handler needs a bit + * of help in order to understand what is the source. + * Set the mask of receiving CPUs for this purpose. + */ + if (ipi == IPI_STOP_HARD) + atomic_set_int(&ipi_nmi_pending, PCPU_GET(other_cpus)); - lapic_ipi_raw(icrlo, cpu_apic_ids[cpu]); - } + CTR2(KTR_SMP, "%s: ipi: %x", __func__, ipi); + lapic_ipi_vectored(ipi, APIC_IPI_DEST_OTHERS); } int -ipi_nmi_handler(void) +ipi_nmi_handler() { - int cpumask = PCPU_GET(cpumask); + cpumask_t cpumask; - if (!(ipi_nmi_pending & cpumask)) - return 1; + /* + * As long as there is not a simple way to know about a NMI's + * source, if the bitmask for the current CPU is present in + * the global pending bitword an IPI_STOP_HARD has been issued + * and should be handled. + */ + cpumask = PCPU_GET(cpumask); + if ((ipi_nmi_pending & cpumask) == 0) + return (1); atomic_clear_int(&ipi_nmi_pending, cpumask); cpustop_handler(); - return 0; + return (0); } -#endif /* STOP_NMI */ - /* * Handle an IPI_STOP by saving our current context and spinning until we * are resumed. Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/amd64/amd64/trap.c Thu Aug 13 17:09:45 2009 (r196196) @@ -239,13 +239,11 @@ trap(struct trapframe *frame) type = frame->tf_trapno; #ifdef SMP -#ifdef STOP_NMI /* Handler for NMI IPIs used for stopping CPUs. */ if (type == T_NMI) { if (ipi_nmi_handler() == 0) goto out; } -#endif /* STOP_NMI */ #endif /* SMP */ #ifdef KDB Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/amd64/conf/GENERIC Thu Aug 13 17:09:45 2009 (r196196) @@ -69,7 +69,6 @@ options P1003_1B_SEMAPHORES # POSIX-sty options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. options KBD_INSTALL_CDEV # install a CDEV entry in /dev -options STOP_NMI # Stop CPUS using NMI instead of IPI options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing options MAC # TrustedBSD MAC Framework Modified: head/sys/amd64/conf/NOTES ============================================================================== --- head/sys/amd64/conf/NOTES Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/amd64/conf/NOTES Thu Aug 13 17:09:45 2009 (r196196) @@ -30,11 +30,6 @@ device mptable # Optional MPSPEC mpta # options MP_WATCHDOG -# -# Debugging options. -# -options STOP_NMI # Stop CPUS using NMI instead of IPI - ##################################################################### Modified: head/sys/amd64/conf/XENHVM ============================================================================== --- head/sys/amd64/conf/XENHVM Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/amd64/conf/XENHVM Thu Aug 13 17:09:45 2009 (r196196) @@ -68,7 +68,6 @@ options SYSVMSG # SYSV-style message options SYSVSEM # SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options KBD_INSTALL_CDEV # install a CDEV entry in /dev -options STOP_NMI # Stop CPUS using NMI instead of IPI options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing #options KDTRACE_FRAME # Ensure frames are compiled in Modified: head/sys/amd64/include/apicvar.h ============================================================================== --- head/sys/amd64/include/apicvar.h Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/amd64/include/apicvar.h Thu Aug 13 17:09:45 2009 (r196196) @@ -102,11 +102,6 @@ * smp_ipi_mtx and waits for the completion of the IPI (Only one IPI user * at a time) The second group uses a single interrupt and a bitmap to avoid * redundant IPI interrupts. - * - * Right now IPI_STOP used by kdb shares the interrupt priority class with - * the two IPI groups mentioned above. As such IPI_STOP may cause a deadlock. - * Eventually IPI_STOP should use NMI IPIs - this would eliminate this and - * other deadlocks caused by IPI_STOP. */ /* Interrupts for local APIC LVT entries other than the timer. */ @@ -134,6 +129,7 @@ #define IPI_STOP (APIC_IPI_INTS + 7) /* Stop CPU until restarted. */ #define IPI_SUSPEND (APIC_IPI_INTS + 8) /* Suspend CPU until restarted. */ +#define IPI_STOP_HARD (APIC_IPI_INTS + 9) /* Stop CPU with a NMI. */ /* * The spurious interrupt can share the priority class with the IPIs since Modified: head/sys/amd64/include/smp.h ============================================================================== --- head/sys/amd64/include/smp.h Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/amd64/include/smp.h Thu Aug 13 17:09:45 2009 (r196196) @@ -52,6 +52,7 @@ void cpu_add(u_int apic_id, char boot_cp void cpustop_handler(void); void cpususpend_handler(void); void init_secondary(void); +int ipi_nmi_handler(void); void ipi_selected(cpumask_t cpus, u_int ipi); void ipi_all_but_self(u_int ipi); void ipi_bitmap_handler(struct trapframe frame); @@ -66,10 +67,6 @@ void smp_masked_invlpg_range(cpumask_t m void smp_invltlb(void); void smp_masked_invltlb(cpumask_t mask); -#ifdef STOP_NMI -int ipi_nmi_handler(void); -#endif - #endif /* !LOCORE */ #endif /* SMP */ Modified: head/sys/conf/options.amd64 ============================================================================== --- head/sys/conf/options.amd64 Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/conf/options.amd64 Thu Aug 13 17:09:45 2009 (r196196) @@ -52,7 +52,6 @@ PSM_DEBUG opt_psm.h DEV_ATPIC opt_atpic.h # Debugging -STOP_NMI opt_cpu.h KDTRACE_FRAME opt_kdtrace.h # BPF just-in-time compiler Modified: head/sys/conf/options.i386 ============================================================================== --- head/sys/conf/options.i386 Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/conf/options.i386 Thu Aug 13 17:09:45 2009 (r196196) @@ -110,7 +110,6 @@ ASR_COMPAT opt_asr.h # Debugging NPX_DEBUG opt_npx.h -STOP_NMI opt_cpu.h # BPF just-in-time compiler BPF_JITTER opt_bpf.h Modified: head/sys/conf/options.pc98 ============================================================================== --- head/sys/conf/options.pc98 Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/conf/options.pc98 Thu Aug 13 17:09:45 2009 (r196196) @@ -95,7 +95,6 @@ DEV_NPX opt_npx.h # Debugging NPX_DEBUG opt_npx.h -STOP_NMI opt_cpu.h AGP_DEBUG opt_agp.h # BPF just-in-time compiler Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/i386/conf/GENERIC Thu Aug 13 17:09:45 2009 (r196196) @@ -70,7 +70,6 @@ options P1003_1B_SEMAPHORES # POSIX-sty options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. options KBD_INSTALL_CDEV # install a CDEV entry in /dev -options STOP_NMI # Stop CPUS using NMI instead of IPI options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing options MAC # TrustedBSD MAC Framework Modified: head/sys/i386/conf/NOTES ============================================================================== --- head/sys/i386/conf/NOTES Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/i386/conf/NOTES Thu Aug 13 17:09:45 2009 (r196196) @@ -49,7 +49,6 @@ options MP_WATCHDOG # Debugging options. # -options STOP_NMI # Stop CPUS using NMI instead of IPI options COUNT_XINVLTLB_HITS # Counters for TLB events options COUNT_IPIS # Per-CPU IPI interrupt counters Modified: head/sys/i386/i386/local_apic.c ============================================================================== --- head/sys/i386/i386/local_apic.c Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/i386/i386/local_apic.c Thu Aug 13 17:09:45 2009 (r196196) @@ -1248,8 +1248,17 @@ lapic_ipi_vectored(u_int vector, int des KASSERT((vector & ~APIC_VECTOR_MASK) == 0, ("%s: invalid vector %d", __func__, vector)); - icrlo = vector | APIC_DELMODE_FIXED | APIC_DESTMODE_PHY | - APIC_LEVEL_DEASSERT | APIC_TRIGMOD_EDGE; + icrlo = APIC_DESTMODE_PHY | APIC_TRIGMOD_EDGE; + + /* + * IPI_STOP_HARD is just a "fake" vector used to send a NMI. + * Use special rules regard NMI if passed, otherwise specify + * the vector. + */ + if (vector == IPI_STOP_HARD) + icrlo |= APIC_DELMODE_NMI | APIC_LEVEL_ASSERT; + else + icrlo |= vector | APIC_DELMODE_FIXED | APIC_LEVEL_DEASSERT; destfield = 0; switch (dest) { case APIC_IPI_DEST_SELF: Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/i386/i386/mp_machdep.c Thu Aug 13 17:09:45 2009 (r196196) @@ -155,12 +155,6 @@ vm_offset_t smp_tlb_addr1; vm_offset_t smp_tlb_addr2; volatile int smp_tlb_wait; -#ifdef STOP_NMI -static volatile cpumask_t ipi_nmi_pending; - -static void ipi_nmi_selected(cpumask_t cpus); -#endif - #ifdef COUNT_IPIS /* Interrupt counts. */ static u_long *ipi_preempt_counts[MAXCPU]; @@ -177,21 +171,8 @@ u_long *ipi_lazypmap_counts[MAXCPU]; * Local data and functions. */ -#ifdef STOP_NMI -/* - * Provide an alternate method of stopping other CPUs. If another CPU has - * disabled interrupts the conventional STOP IPI will be blocked. This - * NMI-based stop should get through in that case. - */ -static int stop_cpus_with_nmi = 1; -SYSCTL_INT(_debug, OID_AUTO, stop_cpus_with_nmi, CTLTYPE_INT | CTLFLAG_RW, - &stop_cpus_with_nmi, 0, ""); -TUNABLE_INT("debug.stop_cpus_with_nmi", &stop_cpus_with_nmi); -#else -#define stop_cpus_with_nmi 0 -#endif - static u_int logical_cpus; +static volatile cpumask_t ipi_nmi_pending; /* used to hold the AP's until we are ready to release them */ static struct mtx ap_boot_mtx; @@ -1318,12 +1299,14 @@ ipi_selected(cpumask_t cpus, u_int ipi) ipi = IPI_BITMAP_VECTOR; } -#ifdef STOP_NMI - if (ipi == IPI_STOP && stop_cpus_with_nmi) { - ipi_nmi_selected(cpus); - return; - } -#endif + /* + * IPI_STOP_HARD maps to a NMI and the trap handler needs a bit + * of help in order to understand what is the source. + * Set the mask of receiving CPUs for this purpose. + */ + if (ipi == IPI_STOP_HARD) + atomic_set_int(&ipi_nmi_pending, cpus); + CTR3(KTR_SMP, "%s: cpus: %x ipi: %x", __func__, cpus, ipi); while ((cpu = ffs(cpus)) != 0) { cpu--; @@ -1354,64 +1337,42 @@ void ipi_all_but_self(u_int ipi) { - if (IPI_IS_BITMAPED(ipi) || (ipi == IPI_STOP && stop_cpus_with_nmi)) { + if (IPI_IS_BITMAPED(ipi)) { ipi_selected(PCPU_GET(other_cpus), ipi); return; } + + /* + * IPI_STOP_HARD maps to a NMI and the trap handler needs a bit + * of help in order to understand what is the source. + * Set the mask of receiving CPUs for this purpose. + */ + if (ipi == IPI_STOP_HARD) + atomic_set_int(&ipi_nmi_pending, PCPU_GET(other_cpus)); CTR2(KTR_SMP, "%s: ipi: %x", __func__, ipi); lapic_ipi_vectored(ipi, APIC_IPI_DEST_OTHERS); } -#ifdef STOP_NMI -/* - * send NMI IPI to selected CPUs - */ - -#define BEFORE_SPIN 1000000 - -void -ipi_nmi_selected(cpumask_t cpus) -{ - int cpu; - register_t icrlo; - - icrlo = APIC_DELMODE_NMI | APIC_DESTMODE_PHY | APIC_LEVEL_ASSERT - | APIC_TRIGMOD_EDGE; - - CTR2(KTR_SMP, "%s: cpus: %x nmi", __func__, cpus); - - atomic_set_int(&ipi_nmi_pending, cpus); - - while ((cpu = ffs(cpus)) != 0) { - cpu--; - cpus &= ~(1 << cpu); - - KASSERT(cpu_apic_ids[cpu] != -1, - ("IPI NMI to non-existent CPU %d", cpu)); - - /* Wait for an earlier IPI to finish. */ - if (!lapic_ipi_wait(BEFORE_SPIN)) - panic("ipi_nmi_selected: previous IPI has not cleared"); - - lapic_ipi_raw(icrlo, cpu_apic_ids[cpu]); - } -} - int -ipi_nmi_handler(void) +ipi_nmi_handler() { - int cpumask = PCPU_GET(cpumask); + cpumask_t cpumask; - if (!(ipi_nmi_pending & cpumask)) - return 1; + /* + * As long as there is not a simple way to know about a NMI's + * source, if the bitmask for the current CPU is present in + * the global pending bitword an IPI_STOP_HARD has been issued + * and should be handled. + */ + cpumask = PCPU_GET(cpumask); + if ((ipi_nmi_pending & cpumask) == 0) + return (1); atomic_clear_int(&ipi_nmi_pending, cpumask); cpustop_handler(); - return 0; + return (0); } -#endif /* STOP_NMI */ - /* * Handle an IPI_STOP by saving our current context and spinning until we * are resumed. Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/i386/i386/trap.c Thu Aug 13 17:09:45 2009 (r196196) @@ -211,13 +211,11 @@ trap(struct trapframe *frame) type = frame->tf_trapno; #ifdef SMP -#ifdef STOP_NMI /* Handler for NMI IPIs used for stopping CPUs. */ if (type == T_NMI) { if (ipi_nmi_handler() == 0) goto out; } -#endif /* STOP_NMI */ #endif /* SMP */ #ifdef KDB Modified: head/sys/i386/include/apicvar.h ============================================================================== --- head/sys/i386/include/apicvar.h Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/i386/include/apicvar.h Thu Aug 13 17:09:45 2009 (r196196) @@ -100,11 +100,6 @@ * smp_ipi_mtx and waits for the completion of the IPI (Only one IPI user * at a time) The second group uses a single interrupt and a bitmap to avoid * redundant IPI interrupts. - * - * Right now IPI_STOP used by kdb shares the interrupt priority class with - * the two IPI groups mentioned above. As such IPI_STOP may cause a deadlock. - * Eventually IPI_STOP should use NMI IPIs - this would eliminate this and - * other deadlocks caused by IPI_STOP. */ /* Interrupts for local APIC LVT entries other than the timer. */ @@ -134,6 +129,7 @@ #define IPI_IS_BITMAPED(x) ((x) <= IPI_BITMAP_LAST) #define IPI_STOP (APIC_IPI_INTS + 7) /* Stop CPU until restarted. */ +#define IPI_STOP_HARD (APIC_IPI_INTS + 8) /* Stop CPU with a NMI. */ #else /* XEN */ /* These are the normal i386 APIC definitions */ @@ -161,6 +157,7 @@ #define IPI_IS_BITMAPED(x) ((x) <= IPI_BITMAP_LAST) #define IPI_STOP (APIC_IPI_INTS + 7) /* Stop CPU until restarted. */ +#define IPI_STOP_HARD (APIC_IPI_INTS + 8) /* Stop CPU with a NMI. */ #endif /* XEN */ /* Modified: head/sys/i386/include/smp.h ============================================================================== --- head/sys/i386/include/smp.h Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/i386/include/smp.h Thu Aug 13 17:09:45 2009 (r196196) @@ -60,7 +60,8 @@ inthand_t void cpu_add(u_int apic_id, char boot_cpu); void cpustop_handler(void); void init_secondary(void); -void ipi_selected(u_int cpus, u_int ipi); +int ipi_nmi_handler(void); +void ipi_selected(cpumask_t cpus, u_int ipi); void ipi_all_but_self(u_int ipi); #ifndef XEN void ipi_bitmap_handler(struct trapframe frame); @@ -76,9 +77,6 @@ void smp_masked_invlpg_range(cpumask_t m void smp_invltlb(void); void smp_masked_invltlb(cpumask_t mask); -#ifdef STOP_NMI -int ipi_nmi_handler(void); -#endif #ifdef XEN void ipi_to_irq_init(void); Modified: head/sys/i386/xen/mp_machdep.c ============================================================================== --- head/sys/i386/xen/mp_machdep.c Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/i386/xen/mp_machdep.c Thu Aug 13 17:09:45 2009 (r196196) @@ -90,8 +90,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define stop_cpus_with_nmi 0 - int mp_naps; /* # of Applications processors */ int boot_cpu_id = -1; /* designated BSP */ Modified: head/sys/ia64/ia64/interrupt.c ============================================================================== --- head/sys/ia64/ia64/interrupt.c Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/ia64/ia64/interrupt.c Thu Aug 13 17:09:45 2009 (r196196) @@ -145,6 +145,8 @@ interrupt(struct trapframe *tf) /* * Handle ExtINT interrupts by generating an INTA cycle to * read the vector. + * IPI_STOP_HARD is mapped to IPI_STOP so it is not necessary + * to add it to this switch-like construct. */ if (vector == 0) { inta = ib->ib_inta; Modified: head/sys/ia64/include/smp.h ============================================================================== --- head/sys/ia64/include/smp.h Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/ia64/include/smp.h Thu Aug 13 17:09:45 2009 (r196196) @@ -21,6 +21,7 @@ #define IPI_AST 4 #define IPI_RENDEZVOUS 5 #define IPI_STOP 6 +#define IPI_STOP_HARD 6 #define IPI_PREEMPT 7 #define IPI_COUNT 8 Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/kern/kern_shutdown.c Thu Aug 13 17:09:45 2009 (r196196) @@ -412,9 +412,6 @@ boot(int howto) */ EVENTHANDLER_INVOKE(shutdown_post_sync, howto); - /* XXX This doesn't disable interrupts any more. Reconsider? */ - splhigh(); - if ((howto & (RB_HALT|RB_DUMP)) == RB_DUMP && !cold && !dumping) doadump(); @@ -488,6 +485,13 @@ static void shutdown_reset(void *junk, int howto) { + /* + * Disable interrupts on CPU0 in order to avoid fast handlers + * to preempt the stopping process and to deadlock against other + * CPUs. + */ + spinlock_enter(); + printf("Rebooting...\n"); DELAY(1000000); /* wait 1 sec for printf's to complete and be read */ /* cpu_boot(howto); */ /* doesn't do anything at the moment */ Modified: head/sys/kern/subr_kdb.c ============================================================================== --- head/sys/kern/subr_kdb.c Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/kern/subr_kdb.c Thu Aug 13 17:09:45 2009 (r196196) @@ -88,7 +88,8 @@ SYSCTL_PROC(_debug_kdb, OID_AUTO, trap_c * Flag indicating whether or not to IPI the other CPUs to stop them on * entering the debugger. Sometimes, this will result in a deadlock as * stop_cpus() waits for the other cpus to stop, so we allow it to be - * disabled. + * disabled. In order to maximize the chances of success, use a hard + * stop for that. */ #ifdef SMP static int kdb_stop_cpus = 1; @@ -226,7 +227,7 @@ kdb_panic(const char *msg) { #ifdef SMP - stop_cpus(PCPU_GET(other_cpus)); + stop_cpus_hard(PCPU_GET(other_cpus)); #endif printf("KDB: panic\n"); panic(msg); @@ -518,7 +519,7 @@ kdb_trap(int type, int code, struct trap #ifdef SMP if ((did_stop_cpus = kdb_stop_cpus) != 0) - stop_cpus(PCPU_GET(other_cpus)); + stop_cpus_hard(PCPU_GET(other_cpus)); #endif kdb_active++; Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/kern/subr_smp.c Thu Aug 13 17:09:45 2009 (r196196) @@ -233,18 +233,21 @@ forward_roundrobin(void) * XXX FIXME: this is not MP-safe, needs a lock to prevent multiple CPUs * from executing at same time. */ -int -stop_cpus(cpumask_t map) +static int +generic_stop_cpus(cpumask_t map, u_int type) { int i; + KASSERT(type == IPI_STOP || type == IPI_STOP_HARD, + ("%s: invalid stop type", __func__)); + if (!smp_started) return 0; - CTR1(KTR_SMP, "stop_cpus(%x)", map); + CTR2(KTR_SMP, "stop_cpus(%x) with %u type", map, type); /* send the stop IPI to all CPUs in map */ - ipi_selected(map, IPI_STOP); + ipi_selected(map, type); i = 0; while ((stopped_cpus & map) != map) { @@ -262,6 +265,20 @@ stop_cpus(cpumask_t map) return 1; } +int +stop_cpus(cpumask_t map) +{ + + return (generic_stop_cpus(map, IPI_STOP)); +} + +int +stop_cpus_hard(cpumask_t map) +{ + + return (generic_stop_cpus(map, IPI_STOP_HARD)); +} + #if defined(__amd64__) /* * When called the executing CPU will send an IPI to all other CPUs Modified: head/sys/mips/include/smp.h ============================================================================== --- head/sys/mips/include/smp.h Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/mips/include/smp.h Thu Aug 13 17:09:45 2009 (r196196) @@ -24,6 +24,7 @@ #define IPI_RENDEZVOUS 0x0002 #define IPI_AST 0x0004 #define IPI_STOP 0x0008 +#define IPI_STOP_HARD 0x0008 #ifndef LOCORE Modified: head/sys/mips/mips/mp_machdep.c ============================================================================== --- head/sys/mips/mips/mp_machdep.c Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/mips/mips/mp_machdep.c Thu Aug 13 17:09:45 2009 (r196196) @@ -129,7 +129,12 @@ smp_handle_ipi(struct trapframe *frame) break; case IPI_STOP: - CTR0(KTR_SMP, "IPI_STOP"); + + /* + * IPI_STOP_HARD is mapped to IPI_STOP so it is not + * necessary to add it in the switch. + */ + CTR0(KTR_SMP, "IPI_STOP or IPI_STOP_HARD"); atomic_set_int(&stopped_cpus, cpumask); while ((started_cpus & cpumask) == 0) Modified: head/sys/pc98/conf/NOTES ============================================================================== --- head/sys/pc98/conf/NOTES Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/pc98/conf/NOTES Thu Aug 13 17:09:45 2009 (r196196) @@ -29,10 +29,6 @@ device apic # I/O apic # options MP_WATCHDOG -# Debugging options. -# -options STOP_NMI # Stop CPUS using NMI instead of IPI - ##################################################################### Modified: head/sys/powerpc/include/smp.h ============================================================================== --- head/sys/powerpc/include/smp.h Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/powerpc/include/smp.h Thu Aug 13 17:09:45 2009 (r196196) @@ -35,6 +35,7 @@ #define IPI_PREEMPT 1 #define IPI_RENDEZVOUS 2 #define IPI_STOP 3 +#define IPI_STOP_HARD 3 #ifndef LOCORE Modified: head/sys/powerpc/powerpc/mp_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/mp_machdep.c Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/powerpc/powerpc/mp_machdep.c Thu Aug 13 17:09:45 2009 (r196196) @@ -281,7 +281,13 @@ powerpc_ipi_handler(void *arg) smp_rendezvous_action(); break; case IPI_STOP: - CTR1(KTR_SMP, "%s: IPI_STOP (stop)", __func__); + + /* + * IPI_STOP_HARD is mapped to IPI_STOP so it is not + * necessary to add such case in the switch. + */ + CTR1(KTR_SMP, "%s: IPI_STOP or IPI_STOP_HARD (stop)", + __func__); self = PCPU_GET(cpumask); savectx(PCPU_GET(curpcb)); atomic_set_int(&stopped_cpus, self); Modified: head/sys/sparc64/include/smp.h ============================================================================== --- head/sys/sparc64/include/smp.h Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/sparc64/include/smp.h Thu Aug 13 17:09:45 2009 (r196196) @@ -56,6 +56,7 @@ #define IPI_RENDEZVOUS PIL_RENDEZVOUS #define IPI_PREEMPT PIL_PREEMPT #define IPI_STOP PIL_STOP +#define IPI_STOP_HARD PIL_STOP #define IPI_RETRIES 5000 Modified: head/sys/sun4v/include/smp.h ============================================================================== --- head/sys/sun4v/include/smp.h Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/sun4v/include/smp.h Thu Aug 13 17:09:45 2009 (r196196) @@ -44,6 +44,7 @@ #define IPI_AST PIL_AST #define IPI_RENDEZVOUS PIL_RENDEZVOUS #define IPI_STOP PIL_STOP +#define IPI_STOP_HARD PIL_STOP #define IPI_PREEMPT PIL_PREEMPT Modified: head/sys/sys/smp.h ============================================================================== --- head/sys/sys/smp.h Thu Aug 13 16:08:35 2009 (r196195) +++ head/sys/sys/smp.h Thu Aug 13 17:09:45 2009 (r196196) @@ -123,6 +123,7 @@ void forward_signal(struct thread *); void forward_roundrobin(void); int restart_cpus(cpumask_t); int stop_cpus(cpumask_t); +int stop_cpus_hard(cpumask_t); #if defined(__amd64__) int suspend_cpus(cpumask_t); #endif From scottl at FreeBSD.org Thu Aug 13 23:18:46 2009 From: scottl at FreeBSD.org (Scott Long) Date: Thu Aug 13 23:18:54 2009 Subject: svn commit: r196200 - in head: etc/mtree include sys/dev/mfi usr.sbin usr.sbin/mfiutil Message-ID: <200908132318.n7DNIjvO015601@svn.freebsd.org> Author: scottl Date: Thu Aug 13 23:18:45 2009 New Revision: 196200 URL: http://svn.freebsd.org/changeset/base/196200 Log: ntroduce mfiutil, a basic utility for managing LSI SAS-RAID & Dell PERC5/6 controllers. Controller, array, and drive status can be checked, basic attributes can be changed, and arrays and spares can be created and deleted. Controller firmware can also be flashed. This does not replace MegaCLI, found in ports, as that is officially sanctioned and supported by LSI and includes vastly more functionality. However, mfiutil is open source and guaranteed to provide basic functionality, which can be especially useful if you have a problem and can't get MegaCLI to work. Approved by: re Obtained from: Yahoo! Inc. Added: head/usr.sbin/mfiutil/ head/usr.sbin/mfiutil/Makefile (contents, props changed) head/usr.sbin/mfiutil/README (contents, props changed) head/usr.sbin/mfiutil/mfi_cmd.c (contents, props changed) head/usr.sbin/mfiutil/mfi_config.c (contents, props changed) head/usr.sbin/mfiutil/mfi_drive.c (contents, props changed) head/usr.sbin/mfiutil/mfi_evt.c (contents, props changed) head/usr.sbin/mfiutil/mfi_flash.c (contents, props changed) head/usr.sbin/mfiutil/mfi_patrol.c (contents, props changed) head/usr.sbin/mfiutil/mfi_show.c (contents, props changed) head/usr.sbin/mfiutil/mfi_volume.c (contents, props changed) head/usr.sbin/mfiutil/mfiutil.1 (contents, props changed) head/usr.sbin/mfiutil/mfiutil.c (contents, props changed) head/usr.sbin/mfiutil/mfiutil.h (contents, props changed) Modified: head/etc/mtree/BSD.include.dist head/include/Makefile head/sys/dev/mfi/mfi_ioctl.h head/sys/dev/mfi/mfireg.h head/usr.sbin/Makefile Modified: head/etc/mtree/BSD.include.dist ============================================================================== --- head/etc/mtree/BSD.include.dist Thu Aug 13 19:47:13 2009 (r196199) +++ head/etc/mtree/BSD.include.dist Thu Aug 13 23:18:45 2009 (r196200) @@ -104,6 +104,8 @@ .. lmc .. + mfi + .. mpt mpilib .. Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Thu Aug 13 19:47:13 2009 (r196199) +++ head/include/Makefile Thu Aug 13 23:18:45 2009 (r196200) @@ -40,7 +40,7 @@ LDIRS= bsm cam geom net net80211 netatal LSUBDIRS= cam/ata cam/scsi \ dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \ - dev/ic dev/iicbus ${_dev_ieee488} dev/lmc dev/ofw \ + dev/ic dev/iicbus ${_dev_ieee488} dev/lmc dev/mfi dev/ofw \ dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \ dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \ fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/nfs fs/ntfs fs/nullfs \ Modified: head/sys/dev/mfi/mfi_ioctl.h ============================================================================== --- head/sys/dev/mfi/mfi_ioctl.h Thu Aug 13 19:47:13 2009 (r196199) +++ head/sys/dev/mfi/mfi_ioctl.h Thu Aug 13 23:18:45 2009 (r196200) @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #if defined(__amd64__) /* Assume amd64 wants 32 bit Linux */ struct iovec32 { u_int32_t iov_base; Modified: head/sys/dev/mfi/mfireg.h ============================================================================== --- head/sys/dev/mfi/mfireg.h Thu Aug 13 19:47:13 2009 (r196199) +++ head/sys/dev/mfi/mfireg.h Thu Aug 13 23:18:45 2009 (r196200) @@ -89,7 +89,7 @@ __FBSDID("$FreeBSD$"); #define MFI_ODCR0 0xa0 /* outbound doorbell clear register0 */ #define MFI_OSP0 0xb0 /* outbound scratch pad0 */ #define MFI_1078_EIM 0x80000004 /* 1078 enable intrrupt mask */ -#define MFI_RMI 0x2 /* reply message interrupt */ +#define MFI_RMI 0x2 /* reply message interrupt */ #define MFI_1078_RM 0x80000000 /* reply 1078 message interrupt */ #define MFI_ODC 0x4 /* outbound doorbell change interrupt */ @@ -151,15 +151,41 @@ typedef enum { MFI_DCMD_CTRL_EVENT_GETINFO = 0x01040100, MFI_DCMD_CTRL_EVENT_GET = 0x01040300, MFI_DCMD_CTRL_EVENT_WAIT = 0x01040500, + MFI_DCMD_PR_GET_STATUS = 0x01070100, + MFI_DCMD_PR_GET_PROPERTIES = 0x01070200, + MFI_DCMD_PR_SET_PROPERTIES = 0x01070300, + MFI_DCMD_PR_START = 0x01070400, + MFI_DCMD_PR_STOP = 0x01070500, + MFI_DCMD_TIME_SECS_GET = 0x01080201, + MFI_DCMD_FLASH_FW_OPEN = 0x010f0100, + MFI_DCMD_FLASH_FW_DOWNLOAD = 0x010f0200, + MFI_DCMD_FLASH_FW_FLASH = 0x010f0300, + MFI_DCMD_FLASH_FW_CLOSE = 0x010f0400, + MFI_DCMD_PD_GET_LIST = 0x02010000, + MFI_DCMD_PD_GET_INFO = 0x02020000, + MFI_DCMD_PD_STATE_SET = 0x02030100, + MFI_DCMD_PD_REBUILD_START = 0x02040100, + MFI_DCMD_PD_REBUILD_ABORT = 0x02040200, + MFI_DCMD_PD_CLEAR_START = 0x02050100, + MFI_DCMD_PD_CLEAR_ABORT = 0x02050200, + MFI_DCMD_PD_GET_PROGRESS = 0x02060000, + MFI_DCMD_PD_LOCATE_START = 0x02070100, + MFI_DCMD_PD_LOCATE_STOP = 0x02070200, MFI_DCMD_LD_GET_LIST = 0x03010000, MFI_DCMD_LD_GET_INFO = 0x03020000, MFI_DCMD_LD_GET_PROP = 0x03030000, MFI_DCMD_LD_SET_PROP = 0x03040000, + MFI_DCMD_LD_INIT_START = 0x03060100, MFI_DCMD_LD_DELETE = 0x03090000, MFI_DCMD_CFG_READ = 0x04010000, MFI_DCMD_CFG_ADD = 0x04020000, MFI_DCMD_CFG_CLEAR = 0x04030000, + MFI_DCMD_CFG_MAKE_SPARE = 0x04040000, + MFI_DCMD_CFG_REMOVE_SPARE = 0x04050000, MFI_DCMD_CFG_FOREIGN_IMPORT = 0x04060400, + MFI_DCMD_BBU_GET_STATUS = 0x05010000, + MFI_DCMD_BBU_GET_CAPACITY_INFO =0x05020000, + MFI_DCMD_BBU_GET_DESIGN_INFO = 0x05030000, MFI_DCMD_CLUSTER = 0x08000000, MFI_DCMD_CLUSTER_RESET_ALL = 0x08010100, MFI_DCMD_CLUSTER_RESET_LD = 0x08010200 @@ -245,6 +271,9 @@ typedef enum { MFI_STAT_RESERVATION_IN_PROGRESS, MFI_STAT_I2C_ERRORS_DETECTED, MFI_STAT_PCI_ERRORS_DETECTED, + MFI_STAT_DIAG_FAILED, + MFI_STAT_BOOT_MSG_PENDING, + MFI_STAT_FOREIGN_CONFIG_INCOMPLETE, MFI_STAT_INVALID_STATUS = 0xFF } mfi_status_t; @@ -303,6 +332,17 @@ typedef enum { MR_LD_CACHE_ALLOW_WRITE_CACHE = 0x20, MR_LD_CACHE_ALLOW_READ_CACHE = 0x40 } mfi_ld_cache; +#define MR_LD_CACHE_MASK 0x7f + +#define MR_LD_CACHE_POLICY_READ_AHEAD_NONE 0 +#define MR_LD_CACHE_POLICY_READ_AHEAD_ALWAYS MR_LD_CACHE_READ_AHEAD +#define MR_LD_CACHE_POLICY_READ_AHEAD_ADAPTIVE \ + (MR_LD_CACHE_READ_AHEAD | MR_LD_CACHE_READ_ADAPTIVE) +#define MR_LD_CACHE_POLICY_WRITE_THROUGH 0 +#define MR_LD_CACHE_POLICY_WRITE_BACK MR_LD_CACHE_WRITE_BACK +#define MR_LD_CACHE_POLICY_IO_CACHED \ + (MR_LD_CACHE_ALLOW_WRITE_CACHE | MR_LD_CACHE_ALLOW_READ_CACHE) +#define MR_LD_CACHE_POLICY_IO_DIRECT 0 typedef enum { MR_PD_CACHE_UNCHANGED = 0, @@ -320,6 +360,7 @@ typedef enum { #define MFI_DEFAULT_ID -1 #define MFI_MAX_LUN 8 #define MFI_MAX_LD 64 +#define MFI_MAX_PD 256 #define MFI_FRAME_SIZE 64 #define MFI_MBOX_SIZE 12 @@ -866,12 +907,10 @@ union mfi_pd_ddf_type { } __packed; struct mfi_pd_progress { - struct { - uint32_t rbld : 1; - uint32_t patrol : 1; - uint32_t clear : 1; - uint32_t reserved: 29; - } active; + uint32_t active; +#define MFI_PD_PROGRESS_REBUILD (1<<0) +#define MFI_PD_PROGRESS_PATROL (1<<1) +#define MFI_PD_PROGRESS_CLEAR (1<<2) struct mfi_progress rbld; struct mfi_progress patrol; struct mfi_progress clear; @@ -890,8 +929,8 @@ struct mfi_pd_info { uint32_t other_err_count; uint32_t pred_fail_count; uint32_t last_pred_fail_event_seq_num; - uint16_t fw_state; - uint8_t disable_for_removal; + uint16_t fw_state; /* MFI_PD_STATE_* */ + uint8_t disabled_for_removal; uint8_t link_speed; union mfi_pd_ddf_type state; struct { @@ -918,7 +957,7 @@ struct mfi_pd_address { uint16_t encl_device_id; uint8_t encl_index; uint8_t slot_number; - uint8_t scsi_dev_type; + uint8_t scsi_dev_type; /* 0 = disk */ uint8_t connect_port_bitmap; uint64_t sas_addr[2]; } __packed; @@ -926,12 +965,19 @@ struct mfi_pd_address { struct mfi_pd_list { uint32_t size; uint32_t count; - uint8_t data; - /* - struct mfi_pd_address addr[]; - */ + struct mfi_pd_address addr[0]; } __packed; +enum mfi_pd_state { + MFI_PD_STATE_UNCONFIGURED_GOOD = 0x00, + MFI_PD_STATE_UNCONFIGURED_BAD = 0x01, + MFI_PD_STATE_HOT_SPARE = 0x02, + MFI_PD_STATE_OFFLINE = 0x10, + MFI_PD_STATE_FAILED = 0x11, + MFI_PD_STATE_REBUILD = 0x14, + MFI_PD_STATE_ONLINE = 0x18 +}; + union mfi_ld_ref { struct { uint8_t target_id; @@ -986,6 +1032,9 @@ struct mfi_ld_params { uint8_t span_depth; uint8_t state; uint8_t init_state; +#define MFI_LD_PARAMS_INIT_NO 0 +#define MFI_LD_PARAMS_INIT_QUICK 1 +#define MFI_LD_PARAMS_INIT_FULL 2 uint8_t is_consistent; uint8_t reserved[23]; } __packed; @@ -995,7 +1044,7 @@ struct mfi_ld_progress { #define MFI_LD_PROGRESS_CC (1<<0) #define MFI_LD_PROGRESS_BGI (1<<1) #define MFI_LD_PROGRESS_FGI (1<<2) -#define MFI_LD_PORGRESS_RECON (1<<3) +#define MFI_LD_PROGRESS_RECON (1<<3) struct mfi_progress cc; struct mfi_progress bgi; struct mfi_progress fgi; @@ -1028,26 +1077,18 @@ struct mfi_ld_info { uint8_t reserved2[16]; } __packed; -union mfi_spare_type { - struct { - uint8_t is_dedicate :1; - uint8_t is_revertable :1; - uint8_t is_encl_affinity :1; - uint8_t reserved :5; - } v; - uint8_t type; -} __packed; - #define MAX_ARRAYS 16 struct mfi_spare { union mfi_pd_ref ref; - union mfi_spare_type spare_type; + uint8_t spare_type; +#define MFI_SPARE_DEDICATED (1 << 0) +#define MFI_SPARE_REVERTIBLE (1 << 1) +#define MFI_SPARE_ENCL_AFFINITY (1 << 2) uint8_t reserved[2]; uint8_t array_count; - uint16_t array_refd[MAX_ARRAYS]; + uint16_t array_ref[MAX_ARRAYS]; } __packed; -#define MAX_ROW_SIZE 32 struct mfi_array { uint64_t size; uint8_t num_drives; @@ -1055,13 +1096,13 @@ struct mfi_array { uint16_t array_ref; uint8_t pad[20]; struct { - union mfi_pd_ref ref; - uint16_t fw_state; + union mfi_pd_ref ref; /* 0xffff == missing drive */ + uint16_t fw_state; /* MFI_PD_STATE_* */ struct { uint8_t pd; uint8_t slot; } encl; - } pd[MAX_ROW_SIZE]; + } pd[0]; } __packed; struct mfi_config_data { @@ -1073,13 +1114,117 @@ struct mfi_config_data { uint16_t spares_count; uint16_t spares_size; uint8_t reserved[16]; - uint8_t data; - /* - struct mfi_array array[]; - struct mfi_ld_config ld[]; - struct mfi_spare spare[]; - */ -} __packed; + struct mfi_array array[0]; + struct mfi_ld_config ld[0]; + struct mfi_spare spare[0]; +} __packed; + +struct mfi_bbu_capacity_info { + uint16_t relative_charge; + uint16_t absolute_charge; + uint16_t remaining_capacity; + uint16_t full_charge_capacity; + uint16_t run_time_to_empty; + uint16_t average_time_to_empty; + uint16_t average_time_to_full; + uint16_t cycle_count; + uint16_t max_error; + uint16_t remaining_capacity_alarm; + uint16_t remaining_time_alarm; + uint8_t reserved[26]; +} __packed; + +struct mfi_bbu_design_info { + uint32_t mfg_date; + uint16_t design_capacity; + uint16_t design_voltage; + uint16_t spec_info; + uint16_t serial_number; + uint16_t pack_stat_config; + uint8_t mfg_name[12]; + uint8_t device_name[8]; + uint8_t device_chemistry[8]; + uint8_t mfg_data[8]; + uint8_t reserved[17]; +} __packed; + +struct mfi_ibbu_state { + uint16_t gas_guage_status; + uint16_t relative_charge; + uint16_t charger_system_state; + uint16_t charger_system_ctrl; + uint16_t charging_current; + uint16_t absolute_charge; + uint16_t max_error; + uint8_t reserved[18]; +} __packed; + +struct mfi_bbu_state { + uint16_t gas_guage_status; + uint16_t relative_charge; + uint16_t charger_status; + uint16_t remaining_capacity; + uint16_t full_charge_capacity; + uint8_t is_SOH_good; + uint8_t reserved[21]; +} __packed; + +union mfi_bbu_status_detail { + struct mfi_ibbu_state ibbu; + struct mfi_bbu_state bbu; +}; + +struct mfi_bbu_status { + uint8_t battery_type; +#define MFI_BBU_TYPE_NONE 0 +#define MFI_BBU_TYPE_IBBU 1 +#define MFI_BBU_TYPE_BBU 2 + uint8_t reserved; + uint16_t voltage; + int16_t current; + uint16_t temperature; + uint32_t fw_status; +#define MFI_BBU_STATE_PACK_MISSING (1 << 0) +#define MFI_BBU_STATE_VOLTAGE_LOW (1 << 1) +#define MFI_BBU_STATE_TEMPERATURE_HIGH (1 << 2) +#define MFI_BBU_STATE_CHARGE_ACTIVE (1 << 0) +#define MFI_BBU_STATE_DISCHARGE_ACTIVE (1 << 0) + uint8_t pad[20]; + union mfi_bbu_status_detail detail; +} __packed; + +enum mfi_pr_state { + MFI_PR_STATE_STOPPED = 0, + MFI_PR_STATE_READY = 1, + MFI_PR_STATE_ACTIVE = 2, + MFI_PR_STATE_ABORTED = 0xff +}; + +struct mfi_pr_status { + uint32_t num_iteration; + uint8_t state; + uint8_t num_pd_done; + uint8_t reserved[10]; +}; + +enum mfi_pr_opmode { + MFI_PR_OPMODE_AUTO = 0, + MFI_PR_OPMODE_MANUAL = 1, + MFI_PR_OPMODE_DISABLED = 2 +}; + +struct mfi_pr_properties { + uint8_t op_mode; + uint8_t max_pd; + uint8_t reserved; + uint8_t exclude_ld_count; + uint16_t excluded_ld[MFI_MAX_LD]; + uint8_t cur_pd_map[MFI_MAX_PD / 8]; + uint8_t last_pd_map[MFI_MAX_PD / 8]; + uint32_t next_exec; + uint32_t exec_freq; + uint32_t clear_freq; +}; #define MFI_SCSI_MAX_TARGETS 128 #define MFI_SCSI_MAX_LUNS 8 Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Thu Aug 13 19:47:13 2009 (r196199) +++ head/usr.sbin/Makefile Thu Aug 13 23:18:45 2009 (r196200) @@ -94,6 +94,7 @@ SUBDIR= ${_ac} \ manctl \ memcontrol \ mergemaster \ + mfiutil \ mixer \ ${_mld6query} \ mlxcontrol \ Added: head/usr.sbin/mfiutil/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/mfiutil/Makefile Thu Aug 13 23:18:45 2009 (r196200) @@ -0,0 +1,17 @@ +# $FreeBSD$ +PROG= mfiutil + +SRCS= mfiutil.c mfi_cmd.c mfi_config.c mfi_drive.c mfi_evt.c mfi_flash.c \ + mfi_patrol.c mfi_show.c mfi_volume.c + +CFLAGS+= -fno-builtin-strftime +WARNS?=3 + +LDADD= -lutil + +# Here be dragons +.ifdef DEBUG +CFLAGS+= -DDEBUG +.endif + +.include Added: head/usr.sbin/mfiutil/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/mfiutil/README Thu Aug 13 23:18:45 2009 (r196200) @@ -0,0 +1,104 @@ +# $FreeBSD$ + +This package includes a mfiutil command for administering mfi(4) controllers +on FreeBSD. + +Version 1.0.13 + * Cleaned up warnings in preparation for integration with FreeBSD + +Version 1.0.12 + * Add 'drive clear' command to wipe drives with all 0x00 characters + +Version 1.0.11 + * Display serial number for drives + * Display location info for drives with 'show config' + +Version 1.0.10 + * Display min and max stripe size supported by adapters. + * Added support for examining the controller event log. + +Version 1.0.9 + * Display stripe size for volumes. + * Added support for setting the stripe size for new volumes. + * Fix a regression in 1.0.8 that broke creation of RAID-5 and RAID-50 + arrays. + +Version 1.0.8 + * Added support for RAID-60 arrays. + * Added 'flash' command to support firmware flashing. + +Version 1.0.7 + * Renamed 'clear config' to 'clear, 'create volume' to 'create', + 'delete volume' to 'delete', 'create spare' to 'add', and + 'delete spare' to 'remove'. The old names still work. + * Added support for RAID-6 arrays. + +Version 1.0.6 + * Added 'show patrol', 'patrol', 'start patrol', and 'stop patrol' + commands to manage patrol reads. + +Version 1.0.5 + * Added 'create volume' and 'delete volume' commands to manage volumes. + * Added 'clear config' command to clear entire configuration. + * Added more detailed error reporting based on firmware status codes. + * Renamed 'progress' command to 'drive progress'. + * Added 'volume progress' command to display progress of volume-level + activites such as background inits. + * Fixed 'create spare' to properly add global spares. + +Version 1.0.4 + * Added 'create spare' and 'delete spare' commands to manage hot spares. + * Added 'good' command to mark unconfigured bad drives as good. + * Display more information about hot spares in 'show config' + * Allow physical drives to be specified via Exx:Syy similar to megacli + * Display onboard memory size in 'show adapter' + +Version 1.0.3 + * Added 'cache' command to manage cache settings for volumes. + * Added 'name' command to name volumes. + * Added manpage. + +Version 1.0.2 + * Added 'show adapter' and 'show battery' commands. + * Added RAID level of volumes to 'show config' and 'show volumes'. + * Added drive model info to 'show config' and 'show drives'. + * Added package firmware version to 'show firmware'. + * Added read and write cache status to 'show volumes'. + * Map volume IDs to mfidX device names on newer kernels. + +Version 1.0.1 + * Added 'show firmware' command + +Version 1.0.0 + * Initial release + +usage: mfiutil [-u unit] ... + +Commands include: + version + show adapter - display controller information + show battery - display battery information + show config - display RAID configuration + show drives - list physical drives + show firmware - list firmware images + show volumes - list logical volumes + show patrol - display patrol read status + fail - fail a physical drive + good - mark a bad physical drive as good + rebuild - mark failed drive ready for rebuild + drive progress - display status of active operations + start rebuild + abort rebuild + locate - toggle drive LED + cache [command [setting]] + name + volume progress - display status of active operations + clear - clear volume configuration + create [-v] [,[,...]] [[,[,...]] + delete + add [volume] - add a hot spare + remove - remove a hot spare + patrol [interval [start]] + start patrol - start a patrol read + stop patrol - stop a patrol read + flash Added: head/usr.sbin/mfiutil/mfi_cmd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/mfiutil/mfi_cmd.c Thu Aug 13 23:18:45 2009 (r196200) @@ -0,0 +1,351 @@ +/*- + * Copyright (c) 2008, 2009 Yahoo!, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The names of the authors may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "mfiutil.h" +#include + +static const char *mfi_status_codes[] = { + "Command completed succesfully", + "Invalid command", + "Invalid DMCD opcode", + "Invalid parameter", + "Invalid Sequence Number", + "Abort isn't possible for the requested command", + "Application 'host' code not found", + "Application in use", + "Application not initialized", + "Array index invalid", + "Array row not empty", + "Configuration resource conflict", + "Device not found", + "Drive too small", + "Flash memory allocation failed", + "Flash download already in progress", + "Flash operation failed", + "Bad flash image", + "Incomplete flash image", + "Flash not open", + "Flash not started", + "Flush failed", + "Specified application doesn't have host-resident code", + "Volume consistency check in progress", + "Volume initialization in progress", + "Volume LBA out of range", + "Maximum number of volumes are already configured", + "Volume is not OPTIMAL", + "Volume rebuild in progress", + "Volume reconstruction in progress", + "Volume RAID level is wrong for requested operation", + "Too many spares assigned", + "Scratch memory not available", + "Error writing MFC data to SEEPROM", + "Required hardware is missing", + "Item not found", + "Volume drives are not within an enclosure", + "Drive clear in progress", + "Drive type mismatch (SATA vs SAS)", + "Patrol read disabled", + "Invalid row index", + "SAS Config - Invalid action", + "SAS Config - Invalid data", + "SAS Config - Invalid page", + "SAS Config - Invalid type", + "SCSI command completed with error", + "SCSI I/O request failed", + "SCSI RESERVATION_CONFLICT", + "One or more flush operations during shutdown failed", + "Firmware time is not set", + "Wrong firmware or drive state", + "Volume is offline", + "Peer controller rejected request", + "Unable to inform peer of communication changes", + "Volume reservation already in progress", + "I2C errors were detected", + "PCI errors occurred during XOR/DMA operation", + "Diagnostics failed", + "Unable to process command as boot messages are pending", + "Foreign configuration is incomplete" +}; + +const char * +mfi_status(u_int status_code) +{ + static char buffer[16]; + + if (status_code == MFI_STAT_INVALID_STATUS) + return ("Invalid status"); + if (status_code < sizeof(mfi_status_codes) / sizeof(char *)) + return (mfi_status_codes[status_code]); + snprintf(buffer, sizeof(buffer), "Status: 0x%02x", status_code); + return (buffer); +} + +const char * +mfi_raid_level(uint8_t primary_level, uint8_t secondary_level) +{ + static char buf[16]; + + switch (primary_level) { + case DDF_RAID0: + return ("RAID-0"); + case DDF_RAID1: + if (secondary_level != 0) + return ("RAID-10"); + else + return ("RAID-1"); + case DDF_RAID1E: + return ("RAID-1E"); + case DDF_RAID3: + return ("RAID-3"); + case DDF_RAID5: + if (secondary_level != 0) + return ("RAID-50"); + else + return ("RAID-5"); + case DDF_RAID5E: + return ("RAID-5E"); + case DDF_RAID5EE: + return ("RAID-5EE"); + case DDF_RAID6: + if (secondary_level != 0) + return ("RAID-60"); + else + return ("RAID-6"); + case DDF_JBOD: + return ("JBOD"); + case DDF_CONCAT: + return ("CONCAT"); + default: + sprintf(buf, "LVL 0x%02x", primary_level); + return (buf); + } +} + +static int +mfi_query_disk(int fd, uint8_t target_id, struct mfi_query_disk *info) +{ + + bzero(info, sizeof(*info)); + info->array_id = target_id; + if (ioctl(fd, MFIIO_QUERY_DISK, info) < 0) + return (-1); + if (!info->present) { + errno = ENXIO; + return (-1); + } + return (0); +} + +const char * +mfi_volume_name(int fd, uint8_t target_id) +{ + static struct mfi_query_disk info; + static char buf[4]; + + if (mfi_query_disk(fd, target_id, &info) < 0) { + snprintf(buf, sizeof(buf), "%d", target_id); + return (buf); + } + return (info.devname); +} + +int +mfi_volume_busy(int fd, uint8_t target_id) +{ + struct mfi_query_disk info; + + /* Assume it isn't mounted if we can't get information. */ + if (mfi_query_disk(fd, target_id, &info) < 0) + return (0); + return (info.open != 0); +} + +/* + * Check if the running kernel supports changing the RAID + * configuration of the mfi controller. + */ +int +mfi_reconfig_supported(void) +{ + char mibname[64]; + size_t len; + int dummy; + + len = sizeof(dummy); + snprintf(mibname, sizeof(mibname), "dev.mfi.%d.delete_busy_volumes", + mfi_unit); + return (sysctlbyname(mibname, &dummy, &len, NULL, 0) == 0); +} + +int +mfi_lookup_volume(int fd, const char *name, uint8_t *target_id) +{ + struct mfi_query_disk info; + struct mfi_ld_list list; + char *cp; + long val; + u_int i; + + /* If it's a valid number, treat it as a raw target ID. */ + val = strtol(name, &cp, 0); + if (*cp == '\0') { + *target_id = val; + return (0); + } + + if (mfi_dcmd_command(fd, MFI_DCMD_LD_GET_LIST, &list, sizeof(list), + NULL, 0, NULL) < 0) + return (-1); + + for (i = 0; i < list.ld_count; i++) { + if (mfi_query_disk(fd, list.ld_list[i].ld.v.target_id, + &info) < 0) + continue; + if (strcmp(name, info.devname) == 0) { + *target_id = list.ld_list[i].ld.v.target_id; + return (0); + } + } + errno = EINVAL; + return (-1); +} + +int +mfi_dcmd_command(int fd, uint32_t opcode, void *buf, size_t bufsize, + uint8_t *mbox, size_t mboxlen, uint8_t *statusp) +{ + struct mfi_ioc_passthru ioc; + struct mfi_dcmd_frame *dcmd; + int r; + + if ((mbox != NULL && (mboxlen == 0 || mboxlen > MFI_MBOX_SIZE)) || + (mbox == NULL && mboxlen != 0)) { + errno = EINVAL; + return (-1); + } + + bzero(&ioc, sizeof(ioc)); + dcmd = &ioc.ioc_frame; + if (mbox) + bcopy(mbox, dcmd->mbox, mboxlen); + dcmd->header.cmd = MFI_CMD_DCMD; + dcmd->header.timeout = 0; + dcmd->header.flags = 0; + dcmd->header.data_len = bufsize; + dcmd->opcode = opcode; + + ioc.buf = buf; + ioc.buf_size = bufsize; + r = ioctl(fd, MFIIO_PASSTHRU, &ioc); + if (r < 0) + return (r); + + if (statusp != NULL) + *statusp = dcmd->header.cmd_status; + else if (dcmd->header.cmd_status != MFI_STAT_OK) { + warnx("Command failed: %s", + mfi_status(dcmd->header.cmd_status)); + errno = EIO; + return (-1); + } + return (0); +} + +int +mfi_ctrl_get_info(int fd, struct mfi_ctrl_info *info, uint8_t *statusp) +{ + + return (mfi_dcmd_command(fd, MFI_DCMD_CTRL_GETINFO, info, + sizeof(struct mfi_ctrl_info), NULL, 0, statusp)); +} + +int +mfi_open(int unit) +{ + char path[MAXPATHLEN]; + + snprintf(path, sizeof(path), "/dev/mfi%d", unit); + return (open(path, O_RDWR)); +} + +void +mfi_display_progress(const char *label, struct mfi_progress *prog) +{ + uint seconds; + + printf("%s: %.2f%% complete, after %ds", label, + (float)prog->progress * 100 / 0xffff, prog->elapsed_seconds); + if (prog->elapsed_seconds > 10) { + printf(" finished in "); + seconds = (0x10000 * (uint32_t)prog->elapsed_seconds) / + prog->progress - prog->elapsed_seconds; + if (seconds > 3600) + printf("%u:", seconds / 3600); + if (seconds > 60) { + seconds %= 3600; + printf("%02u:%02u", seconds / 60, seconds % 60); + } else + printf("%us", seconds); + } + printf("\n"); +} + +int +mfi_table_handler(struct mfiutil_command **start, struct mfiutil_command **end, + int ac, char **av) +{ + struct mfiutil_command **cmd; + + if (ac < 2) { + warnx("The %s command requires a sub-command.", av[0]); + return (EINVAL); + } + for (cmd = start; cmd < end; cmd++) { + if (strcmp((*cmd)->name, av[1]) == 0) + return ((*cmd)->handler(ac - 1, av + 1)); + } + + warnx("%s is not a valid sub-command of %s.", av[1], av[0]); + return (ENOENT); +} Added: head/usr.sbin/mfiutil/mfi_config.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/mfiutil/mfi_config.c Thu Aug 13 23:18:45 2009 (r196200) @@ -0,0 +1,1164 @@ +/*- + * Copyright (c) 2008, 2009 Yahoo!, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The names of the authors may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#ifdef DEBUG +#include +#endif +#include +#include +#include +#ifdef DEBUG +#include +#endif +#include +#include +#include +#include +#include "mfiutil.h" + +#ifdef DEBUG +static void dump_config(int fd, struct mfi_config_data *config); +#endif + +static int add_spare(int ac, char **av); +static int remove_spare(int ac, char **av); + +#define powerof2(x) ((((x)-1)&(x))==0) + +static long +dehumanize(const char *value) +{ + char *vtp; + long iv; + + if (value == NULL) + return (0); + iv = strtoq(value, &vtp, 0); + if (vtp == value || (vtp[0] != '\0' && vtp[1] != '\0')) { + return (0); + } + switch (vtp[0]) { + case 't': case 'T': + iv *= 1024; + case 'g': case 'G': + iv *= 1024; + case 'm': case 'M': + iv *= 1024; + case 'k': case 'K': + iv *= 1024; + case '\0': + break; + default: + return (0); + } + return (iv); +} +int +mfi_config_read(int fd, struct mfi_config_data **configp) +{ + struct mfi_config_data *config; + uint32_t config_size; + + /* + * Keep fetching the config in a loop until we have a large enough + * buffer to hold the entire configuration. + */ + config = NULL; + config_size = 1024; +fetch: + config = reallocf(config, config_size); + if (config == NULL) + return (-1); + if (mfi_dcmd_command(fd, MFI_DCMD_CFG_READ, config, + config_size, NULL, 0, NULL) < 0) + return (-1); + + if (config->size > config_size) { + config_size = config->size; + goto fetch; + } + + *configp = config; + return (0); +} + +static struct mfi_array * +mfi_config_lookup_array(struct mfi_config_data *config, uint16_t array_ref) +{ + struct mfi_array *ar; + char *p; + int i; + + p = (char *)config->array; + for (i = 0; i < config->array_count; i++) { + ar = (struct mfi_array *)p; + if (ar->array_ref == array_ref) + return (ar); + p += config->array_size; + } + + return (NULL); +} *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From remko at elvandar.org Fri Aug 14 06:00:05 2009 From: remko at elvandar.org (Remko Lodder) Date: Fri Aug 14 06:00:11 2009 Subject: svn commit: r196200 - in head: etc/mtree include sys/dev/mfi usr.sbin usr.sbin/mfiutil In-Reply-To: <200908132318.n7DNIjvO015601@svn.freebsd.org> References: <200908132318.n7DNIjvO015601@svn.freebsd.org> Message-ID: On Fri, August 14, 2009 1:18 am, Scott Long wrote: > Author: scottl > Date: Thu Aug 13 23:18:45 2009 > New Revision: 196200 > URL: http://svn.freebsd.org/changeset/base/196200 > > Log: > ntroduce mfiutil, a basic utility for managing LSI SAS-RAID & Dell > PERC5/6 > controllers. Controller, array, and drive status can be checked, basic > attributes can be changed, and arrays and spares can be created and > deleted. > Controller firmware can also be flashed. > > This does not replace MegaCLI, found in ports, as that is officially > sanctioned > and supported by LSI and includes vastly more functionality. However, > mfiutil > is open source and guaranteed to provide basic functionality, which can > be > especially useful if you have a problem and can't get MegaCLI to work. > > Approved by: re > Obtained from: Yahoo! Inc. > Great work! Thanks! Also thanks to Yahoo! Inc.! Cheers, Remko -- /"\ Best regards, | remko@FreeBSD.org \ / Remko Lodder | remko@EFnet X http://www.evilcoder.org/ | / \ ASCII Ribbon Campaign | Against HTML Mail and News From danger at rulez.sk Fri Aug 14 09:53:21 2009 From: danger at rulez.sk (=?UTF-8?B?RGFuaWVsIEdlcsW+bw==?=) Date: Fri Aug 14 09:53:33 2009 Subject: svn commit: r196200 - in head: etc/mtree include sys/dev/mfi usr.sbin usr.sbin/mfiutil In-Reply-To: <200908132318.n7DNIjvO015601@svn.freebsd.org> References: <200908132318.n7DNIjvO015601@svn.freebsd.org> Message-ID: <4A852FDF.5060709@rulez.sk> Scott Long wrote: > Author: scottl > Date: Thu Aug 13 23:18:45 2009 > New Revision: 196200 > URL: http://svn.freebsd.org/changeset/base/196200 > > Log: > ntroduce mfiutil, a basic utility for managing LSI SAS-RAID & Dell PERC5/6 > controllers. Controller, array, and drive status can be checked, basic > attributes can be changed, and arrays and spares can be created and deleted. > Controller firmware can also be flashed. > > This does not replace MegaCLI, found in ports, as that is officially sanctioned > and supported by LSI and includes vastly more functionality. However, mfiutil > is open source and guaranteed to provide basic functionality, which can be > especially useful if you have a problem and can't get MegaCLI to work. Is this MFC-able to stable/7 and stable/8? From julian at FreeBSD.org Fri Aug 14 10:09:46 2009 From: julian at FreeBSD.org (Julian Elischer) Date: Fri Aug 14 10:09:53 2009 Subject: svn commit: r196201 - head/sys/netinet/ipfw Message-ID: <200908141009.n7EA9k1m028514@svn.freebsd.org> Author: julian Date: Fri Aug 14 10:09:45 2009 New Revision: 196201 URL: http://svn.freebsd.org/changeset/base/196201 Log: Fix ipfw crash on uid or gid check. Receiving any ip packet for which there is no existing socket will crash if ipfw has a uid or gid test rule, as the uid/gid of the non existent owner of said non existent socket is tested. Brooks introduced this error as part of his >16 gids patch. It appears to be a cut-n-paste error from similar code a few lines before. The old code used the 'pcb' variable here, but in the new code that switched the 'inp' variable, which is often NULL and what is tested in the code further up. The rest of the multi-gid patch for ipfw seems solid (and cleaner than previous code). Reviewed by: brooks Approved by: re (rwatson) Modified: head/sys/netinet/ipfw/ip_fw2.c Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Thu Aug 13 23:18:45 2009 (r196200) +++ head/sys/netinet/ipfw/ip_fw2.c Fri Aug 14 10:09:45 2009 (r196201) @@ -2057,7 +2057,7 @@ check_uidgid(ipfw_insn_u32 *insn, int pr dst_ip, htons(dst_port), wildcard, NULL); if (pcb != NULL) { - *uc = crhold(inp->inp_cred); + *uc = crhold(pcb->inp_cred); *ugid_lookupp = 1; } INP_INFO_RUNLOCK(pi); From bzeeb-lists at lists.zabbadoz.net Fri Aug 14 10:20:34 2009 From: bzeeb-lists at lists.zabbadoz.net (Bjoern A. Zeeb) Date: Fri Aug 14 10:20:40 2009 Subject: svn commit: r196200 - in head: etc/mtree include sys/dev/mfi usr.sbin usr.sbin/mfiutil In-Reply-To: <200908132318.n7DNIjvO015601@svn.freebsd.org> References: <200908132318.n7DNIjvO015601@svn.freebsd.org> Message-ID: <20090814095726.A93661@maildrop.int.zabbadoz.net> On Thu, 13 Aug 2009, Scott Long wrote: > Author: scottl > Date: Thu Aug 13 23:18:45 2009 > New Revision: 196200 > URL: http://svn.freebsd.org/changeset/base/196200 > > Log: > ntroduce mfiutil, a basic utility for managing LSI SAS-RAID & Dell PERC5/6 > controllers. Controller, array, and drive status can be checked, basic > attributes can be changed, and arrays and spares can be created and deleted. > Controller firmware can also be flashed. > > This does not replace MegaCLI, found in ports, as that is officially sanctioned > and supported by LSI and includes vastly more functionality. However, mfiutil > is open source and guaranteed to provide basic functionality, which can be > especially useful if you have a problem and can't get MegaCLI to work. > > Approved by: re > Obtained from: Yahoo! Inc. as you noticed already it breaks here on 32bit platforms: /src/usr.sbin/mfiutil/mfi_drive.c: In function 'mfi_lookup_drive': /src/usr.sbin/mfiutil/mfi_drive.c:120: warning: comparison between signed and unsigned struct mfi_pd_list { uint32_t size; uint32_t count; struct mfi_pd_address addr[0]; } __packed; long val; struct mfi_pd_list *list 120 for (val = 0; val < list->count; val++) { long vs uint32_t. -- Bjoern A. Zeeb What was I talking about and who are you again? From kib at FreeBSD.org Fri Aug 14 10:57:29 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Fri Aug 14 10:57:40 2009 Subject: svn commit: r196203 - head/sys/kern Message-ID: <200908141057.n7EAvS1P029582@svn.freebsd.org> Author: kib Date: Fri Aug 14 10:57:28 2009 New Revision: 196203 URL: http://svn.freebsd.org/changeset/base/196203 Log: Correctly handle unlock for !MAKEENTRY case, after successfull attempt of lock upgrade cache shall be unlocked from write. Reported by: Lucius Windschuh Reviewed by: kan Approved by: re (rwatson) Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Fri Aug 14 10:25:14 2009 (r196202) +++ head/sys/kern/vfs_cache.c Fri Aug 14 10:57:28 2009 (r196203) @@ -416,7 +416,8 @@ retry_wlocked: if (dvp->v_cache_dd->nc_flag & NCF_ISDOTDOT) cache_zap(dvp->v_cache_dd); dvp->v_cache_dd = NULL; - goto unlock; + CACHE_WUNLOCK(); + return (0); } if (dvp->v_cache_dd->nc_flag & NCF_ISDOTDOT) *vpp = dvp->v_cache_dd->nc_vp; From kib at FreeBSD.org Fri Aug 14 10:57:57 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Fri Aug 14 10:58:03 2009 Subject: svn commit: r196204 - head/sys/sys Message-ID: <200908141057.n7EAvveO029626@svn.freebsd.org> Author: kib Date: Fri Aug 14 10:57:57 2009 New Revision: 196204 URL: http://svn.freebsd.org/changeset/base/196204 Log: Add the address of the lock to the KTR_LOCK trace. Tested by: pho Approved by: re (rwatson) Modified: head/sys/sys/lock.h Modified: head/sys/sys/lock.h ============================================================================== --- head/sys/sys/lock.h Fri Aug 14 10:57:28 2009 (r196203) +++ head/sys/sys/lock.h Fri Aug 14 10:57:57 2009 (r196204) @@ -155,16 +155,16 @@ struct lock_class { #define LOCK_LOG_LOCK(opname, lo, flags, recurse, file, line) do { \ if (LOCK_LOG_TEST((lo), (flags))) \ - CTR5(KTR_LOCK, opname " (%s) %s r = %d at %s:%d", \ + CTR6(KTR_LOCK, opname " (%s) %s %p r = %d at %s:%d", \ LOCK_CLASS(lo)->lc_name, (lo)->lo_name, \ - (u_int)(recurse), (file), (line)); \ + (lo), (u_int)(recurse), (file), (line)); \ } while (0) #define LOCK_LOG_TRY(opname, lo, flags, result, file, line) do { \ if (LOCK_LOG_TEST((lo), (flags))) \ - CTR5(KTR_LOCK, "TRY_" opname " (%s) %s result=%d at %s:%d",\ + CTR6(KTR_LOCK, "TRY_" opname " (%s) %s %p result=%d at %s:%d",\ LOCK_CLASS(lo)->lc_name, (lo)->lo_name, \ - (u_int)(result), (file), (line)); \ + (lo), (u_int)(result), (file), (line)); \ } while (0) #define LOCK_LOG_INIT(lo, flags) do { \ From kib at FreeBSD.org Fri Aug 14 10:59:18 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Fri Aug 14 10:59:29 2009 Subject: svn commit: r196205 - head/sys/nfsclient Message-ID: <200908141059.n7EAxHUF032021@svn.freebsd.org> Author: kib Date: Fri Aug 14 10:59:17 2009 New Revision: 196205 URL: http://svn.freebsd.org/changeset/base/196205 Log: In nfs_upgrade_vnlock(), assert that the vnode is locked. It is for all pathes, as far as I see and testing seems to confirm it. Comparision of old_lock with LK_SHARED make sense only if vnode is locked by current thread. When downgrading, pass LK_RETRY to the vn_lock(), since otherwise vn_lock() unlocks the doomed vnode, causing extra unlock. Reported and tested by: pho Approved by: re (rwatson) MFC after: 3 weeks Modified: head/sys/nfsclient/nfs_subs.c Modified: head/sys/nfsclient/nfs_subs.c ============================================================================== --- head/sys/nfsclient/nfs_subs.c Fri Aug 14 10:57:57 2009 (r196204) +++ head/sys/nfsclient/nfs_subs.c Fri Aug 14 10:59:17 2009 (r196205) @@ -409,28 +409,25 @@ int nfs_upgrade_vnlock(struct vnode *vp) { int old_lock; - - if ((old_lock = VOP_ISLOCKED(vp)) != LK_EXCLUSIVE) { - if (old_lock == LK_SHARED) { - /* Upgrade to exclusive lock, this might block */ - vn_lock(vp, LK_UPGRADE | LK_RETRY); - } else { - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - } + + ASSERT_VOP_LOCKED(vp, "nfs_upgrade_vnlock"); + old_lock = VOP_ISLOCKED(vp); + if (old_lock != LK_EXCLUSIVE) { + KASSERT(old_lock == LK_SHARED, + ("nfs_upgrade_vnlock: wrong old_lock %d", old_lock)); + /* Upgrade to exclusive lock, this might block */ + vn_lock(vp, LK_UPGRADE | LK_RETRY); } - return old_lock; + return (old_lock); } void nfs_downgrade_vnlock(struct vnode *vp, int old_lock) { if (old_lock != LK_EXCLUSIVE) { - if (old_lock == LK_SHARED) { - /* Downgrade from exclusive lock, this might block */ - vn_lock(vp, LK_DOWNGRADE); - } else { - VOP_UNLOCK(vp, 0); - } + KASSERT(old_lock == LK_SHARED, ("wrong old_lock %d", old_lock)); + /* Downgrade from exclusive lock. */ + vn_lock(vp, LK_DOWNGRADE | LK_RETRY); } } From kib at FreeBSD.org Fri Aug 14 11:00:38 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Fri Aug 14 11:00:44 2009 Subject: svn commit: r196206 - head/sys/ufs/ffs Message-ID: <200908141100.n7EB0cnM032109@svn.freebsd.org> Author: kib Date: Fri Aug 14 11:00:38 2009 New Revision: 196206 URL: http://svn.freebsd.org/changeset/base/196206 Log: When a UFS node is truncated to the zero length, e.g. by explicit truncate(2) call, or by being removed or truncated on open, either new softupdate freeblks structure is allocated to track the freed blocks of the node, or truncation is done syncronously when too many SU dependencies are accumulated. The decision does not take into account the allocated freeblks dependencies, allowing workloads that do huge amount of truncations to exhaust the kernel memory. Take the number of allocated freeblks into consideration for softdep_slowdown(). Reported by: pluknet gmail com Diagnosed and tested by: pho Approved by: re (rwatson) MFC after: 1 month Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Fri Aug 14 10:59:17 2009 (r196205) +++ head/sys/ufs/ffs/ffs_softdep.c Fri Aug 14 11:00:38 2009 (r196206) @@ -663,6 +663,8 @@ static int req_clear_inodedeps; /* synce static int req_clear_remove; /* syncer process flush some freeblks */ #define FLUSH_REMOVE 2 #define FLUSH_REMOVE_WAIT 3 +static long num_freeblkdep; /* number of freeblks workitems allocated */ + /* * runtime statistics */ @@ -2223,6 +2225,9 @@ softdep_setup_freeblocks(ip, length, fla freeblks->fb_uid = ip->i_uid; freeblks->fb_previousinum = ip->i_number; freeblks->fb_devvp = ip->i_devvp; + ACQUIRE_LOCK(&lk); + num_freeblkdep++; + FREE_LOCK(&lk); extblocks = 0; if (fs->fs_magic == FS_UFS2_MAGIC) extblocks = btodb(fragroundup(fs, ip->i_din2->di_extsize)); @@ -2815,6 +2820,7 @@ handle_workitem_freeblocks(freeblks, fla ACQUIRE_LOCK(&lk); WORKITEM_FREE(freeblks, D_FREEBLKS); + num_freeblkdep--; FREE_LOCK(&lk); } @@ -5768,7 +5774,8 @@ softdep_slowdown(vp) max_softdeps_hard = max_softdeps * 11 / 10; if (num_dirrem < max_softdeps_hard / 2 && num_inodedep < max_softdeps_hard && - VFSTOUFS(vp->v_mount)->um_numindirdeps < maxindirdeps) { + VFSTOUFS(vp->v_mount)->um_numindirdeps < maxindirdeps && + num_freeblkdep < max_softdeps_hard) { FREE_LOCK(&lk); return (0); } From scottl at FreeBSD.org Fri Aug 14 12:30:10 2009 From: scottl at FreeBSD.org (Scott Long) Date: Fri Aug 14 12:30:21 2009 Subject: svn commit: r196211 - head/usr.sbin/mfiutil Message-ID: <200908141230.n7ECUA9I034046@svn.freebsd.org> Author: scottl Date: Fri Aug 14 12:30:10 2009 New Revision: 196211 URL: http://svn.freebsd.org/changeset/base/196211 Log: Fix is 32bit bug missed in testing. Approved by: re Modified: head/usr.sbin/mfiutil/mfi_drive.c Modified: head/usr.sbin/mfiutil/mfi_drive.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_drive.c Fri Aug 14 11:22:09 2009 (r196210) +++ head/usr.sbin/mfiutil/mfi_drive.c Fri Aug 14 12:30:10 2009 (r196211) @@ -75,8 +75,9 @@ int mfi_lookup_drive(int fd, char *drive, uint16_t *device_id) { struct mfi_pd_list *list; - long val; uint8_t encl, slot; + long val; + u_int i; char *cp; /* Look for a raw device id first. */ @@ -117,15 +118,15 @@ mfi_lookup_drive(int fd, char *drive, ui return (errno); } - for (val = 0; val < list->count; val++) { - if (list->addr[val].scsi_dev_type != 0) + for (i = 0; i < list->count; i++) { + if (list->addr[i].scsi_dev_type != 0) continue; if (((encl == 0xff && - list->addr[val].encl_device_id == 0xffff) || - list->addr[val].encl_index == encl) && - list->addr[val].slot_number == slot) { - *device_id = list->addr[val].device_id; + list->addr[i].encl_device_id == 0xffff) || + list->addr[i].encl_index == encl) && + list->addr[i].slot_number == slot) { + *device_id = list->addr[i].device_id; free(list); return (0); } From scottl at FreeBSD.org Fri Aug 14 13:13:13 2009 From: scottl at FreeBSD.org (Scott Long) Date: Fri Aug 14 13:13:26 2009 Subject: svn commit: r196212 - in head/usr.sbin: . mptutil Message-ID: <200908141313.n7EDDDC5034943@svn.freebsd.org> Author: scottl Date: Fri Aug 14 13:13:12 2009 New Revision: 196212 URL: http://svn.freebsd.org/changeset/base/196212 Log: Add mptutil, a basic utility for managing MPT SCSI/SATA/SAS controllers. Drive and controller status can be reported, basic attributes changed, and arrays and spares can be created and deleted. Approved by: re Obtained from: Yahoo! Inc. Added: head/usr.sbin/mptutil/ head/usr.sbin/mptutil/Makefile (contents, props changed) head/usr.sbin/mptutil/mpt_cam.c (contents, props changed) head/usr.sbin/mptutil/mpt_cmd.c (contents, props changed) head/usr.sbin/mptutil/mpt_config.c (contents, props changed) head/usr.sbin/mptutil/mpt_drive.c (contents, props changed) head/usr.sbin/mptutil/mpt_evt.c (contents, props changed) head/usr.sbin/mptutil/mpt_show.c (contents, props changed) head/usr.sbin/mptutil/mpt_volume.c (contents, props changed) head/usr.sbin/mptutil/mptutil.8 (contents, props changed) head/usr.sbin/mptutil/mptutil.c (contents, props changed) head/usr.sbin/mptutil/mptutil.h (contents, props changed) Modified: head/usr.sbin/Makefile Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Fri Aug 14 12:30:10 2009 (r196211) +++ head/usr.sbin/Makefile Fri Aug 14 13:13:12 2009 (r196212) @@ -104,6 +104,7 @@ SUBDIR= ${_ac} \ ${_mount_smbfs} \ ${_moused} \ ${_mptable} \ + mptutil \ mtest \ mtree \ ${_named} \ Added: head/usr.sbin/mptutil/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/mptutil/Makefile Fri Aug 14 13:13:12 2009 (r196212) @@ -0,0 +1,19 @@ +# $FreeBSD$ + +PROG= mptutil +SRCS= mptutil.c mpt_cam.c mpt_cmd.c mpt_config.c mpt_drive.c mpt_evt.c \ + mpt_show.c mpt_volume.c +# mpt_flash.c +MAN= mptutil.8 + +WARNS?= 3 + +DPADD+= ${LIBCAM} ${LIBUTIL} +LDADD+= -lcam -lutil + +# Here be dragons +.ifdef DEBUG +CFLAGS+= -DDEBUG +.endif + +.include Added: head/usr.sbin/mptutil/mpt_cam.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/mptutil/mpt_cam.c Fri Aug 14 13:13:12 2009 (r196212) @@ -0,0 +1,569 @@ +/*- + * Copyright (c) 2008 Yahoo!, Inc. + * All rights reserved. + * Written by: John Baldwin + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__RCSID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "mptutil.h" + +static int xptfd; + +static int +xpt_open(void) +{ + + if (xptfd == 0) + xptfd = open(XPT_DEVICE, O_RDWR); + return (xptfd); +} + +int +mpt_query_disk(U8 VolumeBus, U8 VolumeID, struct mpt_query_disk *qd) +{ + struct bus_match_pattern *b; + struct periph_match_pattern *p; + struct periph_match_result *r; + union ccb ccb; + size_t bufsize; + int i; + + /* mpt(4) only handles devices on bus 0. */ + if (VolumeBus != 0) + return (ENXIO); + + if (xpt_open() < 0) + return (ENXIO); + + bzero(&ccb, sizeof(ccb)); + + ccb.ccb_h.func_code = XPT_DEV_MATCH; + ccb.ccb_h.path_id = CAM_XPT_PATH_ID; + ccb.ccb_h.target_id = CAM_TARGET_WILDCARD; + ccb.ccb_h.target_lun = CAM_LUN_WILDCARD; + + bufsize = sizeof(struct dev_match_result) * 5; + ccb.cdm.num_matches = 0; + ccb.cdm.match_buf_len = bufsize; + ccb.cdm.matches = calloc(1, bufsize); + + bufsize = sizeof(struct dev_match_pattern) * 2; + ccb.cdm.num_patterns = 2; + ccb.cdm.pattern_buf_len = bufsize; + ccb.cdm.patterns = calloc(1, bufsize); + + /* Match mptX bus 0. */ + ccb.cdm.patterns[0].type = DEV_MATCH_BUS; + b = &ccb.cdm.patterns[0].pattern.bus_pattern; + snprintf(b->dev_name, sizeof(b->dev_name), "mpt"); + b->unit_number = mpt_unit; + b->bus_id = 0; + b->flags = BUS_MATCH_NAME | BUS_MATCH_UNIT | BUS_MATCH_BUS_ID; + + /* Look for a "da" device at the specified target and lun. */ + ccb.cdm.patterns[1].type = DEV_MATCH_PERIPH; + p = &ccb.cdm.patterns[1].pattern.periph_pattern; + snprintf(p->periph_name, sizeof(p->periph_name), "da"); + p->target_id = VolumeID; + p->flags = PERIPH_MATCH_NAME | PERIPH_MATCH_TARGET; + + if (ioctl(xptfd, CAMIOCOMMAND, &ccb) < 0) { + i = errno; + free(ccb.cdm.matches); + free(ccb.cdm.patterns); + return (i); + } + free(ccb.cdm.patterns); + + if (((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) || + (ccb.cdm.status != CAM_DEV_MATCH_LAST)) { + warnx("mpt_query_disk got CAM error %#x, CDM error %d\n", + ccb.ccb_h.status, ccb.cdm.status); + free(ccb.cdm.matches); + return (EIO); + } + + /* + * We should have exactly 2 matches, 1 for the bus and 1 for + * the peripheral. However, if we only have 1 match and it is + * for the bus, don't print an error message and return + * ENOENT. + */ + if (ccb.cdm.num_matches == 1 && + ccb.cdm.matches[0].type == DEV_MATCH_BUS) { + free(ccb.cdm.matches); + return (ENOENT); + } + if (ccb.cdm.num_matches != 2) { + warnx("mpt_query_disk got %d matches, expected 2", + ccb.cdm.num_matches); + free(ccb.cdm.matches); + return (EIO); + } + if (ccb.cdm.matches[0].type != DEV_MATCH_BUS || + ccb.cdm.matches[1].type != DEV_MATCH_PERIPH) { + warnx("mpt_query_disk got wrong CAM matches"); + free(ccb.cdm.matches); + return (EIO); + } + + /* Copy out the data. */ + r = &ccb.cdm.matches[1].result.periph_result; + snprintf(qd->devname, sizeof(qd->devname), "%s%d", r->periph_name, + r->unit_number); + free(ccb.cdm.matches); + + return (0); +} + +static int +periph_is_volume(CONFIG_PAGE_IOC_2 *ioc2, struct periph_match_result *r) +{ + CONFIG_PAGE_IOC_2_RAID_VOL *vol; + int i; + + if (ioc2 == NULL) + return (0); + vol = ioc2->RaidVolume; + for (i = 0; i < ioc2->NumActiveVolumes; vol++, i++) { + if (vol->VolumeBus == 0 && vol->VolumeID == r->target_id) + return (1); + } + return (0); +} + +/* Much borrowed from scsireadcapacity() in src/sbin/camcontrol/camcontrol.c. */ +static int +fetch_scsi_capacity(struct cam_device *dev, struct mpt_standalone_disk *disk) +{ + struct scsi_read_capacity_data rcap; + struct scsi_read_capacity_data_long rcaplong; + union ccb *ccb; + int error; + + ccb = cam_getccb(dev); + if (ccb == NULL) + return (ENOMEM); + + /* Zero the rest of the ccb. */ + bzero(&(&ccb->ccb_h)[1], sizeof(struct ccb_scsiio) - + sizeof(struct ccb_hdr)); + + scsi_read_capacity(&ccb->csio, 1, NULL, MSG_SIMPLE_Q_TAG, &rcap, + SSD_FULL_SIZE, 5000); + + /* Disable freezing the device queue */ + ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; + + if (cam_send_ccb(dev, ccb) < 0) { + error = errno; + cam_freeccb(ccb); + return (error); + } + + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + cam_freeccb(ccb); + return (EIO); + } + cam_freeccb(ccb); + + /* + * A last block of 2^32-1 means that the true capacity is over 2TB, + * and we need to issue the long READ CAPACITY to get the real + * capacity. Otherwise, we're all set. + */ + if (scsi_4btoul(rcap.addr) != 0xffffffff) { + disk->maxlba = scsi_4btoul(rcap.addr); + return (0); + } + + /* Zero the rest of the ccb. */ + bzero(&(&ccb->ccb_h)[1], sizeof(struct ccb_scsiio) - + sizeof(struct ccb_hdr)); + + scsi_read_capacity_16(&ccb->csio, 1, NULL, MSG_SIMPLE_Q_TAG, 0, 0, 0, + &rcaplong, SSD_FULL_SIZE, 5000); + + /* Disable freezing the device queue */ + ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; + + if (cam_send_ccb(dev, ccb) < 0) { + error = errno; + cam_freeccb(ccb); + return (error); + } + + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + cam_freeccb(ccb); + return (EIO); + } + cam_freeccb(ccb); + + disk->maxlba = scsi_8btou64(rcaplong.addr); + return (0); +} + +/* Borrowed heavily from scsi_all.c:scsi_print_inquiry(). */ +static void +format_scsi_inquiry(struct mpt_standalone_disk *disk, + struct scsi_inquiry_data *inq_data) +{ + char vendor[16], product[48], revision[16], rstr[12]; + + if (SID_QUAL_IS_VENDOR_UNIQUE(inq_data)) + return; + if (SID_TYPE(inq_data) != T_DIRECT) + return; + if (SID_QUAL(inq_data) != SID_QUAL_LU_CONNECTED) + return; + + cam_strvis(vendor, inq_data->vendor, sizeof(inq_data->vendor), + sizeof(vendor)); + cam_strvis(product, inq_data->product, sizeof(inq_data->product), + sizeof(product)); + cam_strvis(revision, inq_data->revision, sizeof(inq_data->revision), + sizeof(revision)); + + /* Hack for SATA disks, no idea how to tell speed. */ + if (strcmp(vendor, "ATA") == 0) { + snprintf(disk->inqstring, sizeof(disk->inqstring), + "<%s %s> SATA", product, revision); + return; + } + + switch (SID_ANSI_REV(inq_data)) { + case SCSI_REV_CCS: + strcpy(rstr, "SCSI-CCS"); + break; + case 5: + strcpy(rstr, "SAS"); + break; + default: + snprintf(rstr, sizeof (rstr), "SCSI-%d", + SID_ANSI_REV(inq_data)); + break; + } + snprintf(disk->inqstring, sizeof(disk->inqstring), "<%s %s %s> %s", + vendor, product, revision, rstr); +} + +/* Much borrowed from scsiinquiry() in src/sbin/camcontrol/camcontrol.c. */ +static int +fetch_scsi_inquiry(struct cam_device *dev, struct mpt_standalone_disk *disk) +{ + struct scsi_inquiry_data *inq_buf; + union ccb *ccb; + int error; + + ccb = cam_getccb(dev); + if (ccb == NULL) + return (ENOMEM); + + /* Zero the rest of the ccb. */ + bzero(&(&ccb->ccb_h)[1], sizeof(struct ccb_scsiio) - + sizeof(struct ccb_hdr)); + + inq_buf = calloc(1, sizeof(*inq_buf)); + if (inq_buf == NULL) { + cam_freeccb(ccb); + return (ENOMEM); + } + scsi_inquiry(&ccb->csio, 1, NULL, MSG_SIMPLE_Q_TAG, (void *)inq_buf, + SHORT_INQUIRY_LENGTH, 0, 0, SSD_FULL_SIZE, 5000); + + /* Disable freezing the device queue */ + ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; + + if (cam_send_ccb(dev, ccb) < 0) { + error = errno; + free(inq_buf); + cam_freeccb(ccb); + return (error); + } + + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + free(inq_buf); + cam_freeccb(ccb); + return (EIO); + } + + cam_freeccb(ccb); + format_scsi_inquiry(disk, inq_buf); + free(inq_buf); + return (0); +} + +int +mpt_fetch_disks(int fd, int *ndisks, struct mpt_standalone_disk **disksp) +{ + CONFIG_PAGE_IOC_2 *ioc2; + struct mpt_standalone_disk *disks; + struct bus_match_pattern *b; + struct periph_match_pattern *p; + struct periph_match_result *r; + struct cam_device *dev; + union ccb ccb; + size_t bufsize; + u_int i; + int count; + + if (xpt_open() < 0) + return (ENXIO); + + for (count = 100;; count+= 100) { + /* Try to fetch 'count' disks in one go. */ + bzero(&ccb, sizeof(ccb)); + + ccb.ccb_h.func_code = XPT_DEV_MATCH; + + bufsize = sizeof(struct dev_match_result) * (count + 2); + ccb.cdm.num_matches = 0; + ccb.cdm.match_buf_len = bufsize; + ccb.cdm.matches = calloc(1, bufsize); + + bufsize = sizeof(struct dev_match_pattern) * 2; + ccb.cdm.num_patterns = 2; + ccb.cdm.pattern_buf_len = bufsize; + ccb.cdm.patterns = calloc(1, bufsize); + + /* Match mptX bus 0. */ + ccb.cdm.patterns[0].type = DEV_MATCH_BUS; + b = &ccb.cdm.patterns[0].pattern.bus_pattern; + snprintf(b->dev_name, sizeof(b->dev_name), "mpt"); + b->unit_number = mpt_unit; + b->bus_id = 0; + b->flags = BUS_MATCH_NAME | BUS_MATCH_UNIT | BUS_MATCH_BUS_ID; + + /* Match any "da" peripherals. */ + ccb.cdm.patterns[1].type = DEV_MATCH_PERIPH; + p = &ccb.cdm.patterns[1].pattern.periph_pattern; + snprintf(p->periph_name, sizeof(p->periph_name), "da"); + p->flags = PERIPH_MATCH_NAME; + + if (ioctl(xptfd, CAMIOCOMMAND, &ccb) < 0) { + i = errno; + free(ccb.cdm.matches); + free(ccb.cdm.patterns); + return (i); + } + free(ccb.cdm.patterns); + + /* Check for CCB errors. */ + if ((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + free(ccb.cdm.matches); + return (EIO); + } + + /* If we need a longer list, try again. */ + if (ccb.cdm.status == CAM_DEV_MATCH_MORE) { + free(ccb.cdm.matches); + continue; + } + + /* If we got an error, abort. */ + if (ccb.cdm.status != CAM_DEV_MATCH_LAST) { + free(ccb.cdm.matches); + return (EIO); + } + break; + } + + /* + * We should have N + 1 matches, 1 for the bus and 1 for each + * "da" device. + */ + if (ccb.cdm.num_matches < 1) { + warnx("mpt_fetch_disks didn't get any matches"); + free(ccb.cdm.matches); + return (EIO); + } + if (ccb.cdm.matches[0].type != DEV_MATCH_BUS) { + warnx("mpt_fetch_disks got wrong CAM matches"); + free(ccb.cdm.matches); + return (EIO); + } + for (i = 1; i < ccb.cdm.num_matches; i++) { + if (ccb.cdm.matches[i].type != DEV_MATCH_PERIPH) { + warnx("mpt_fetch_disks got wrong CAM matches"); + free(ccb.cdm.matches); + return (EIO); + } + } + + /* Shortcut if we don't have any "da" devices. */ + if (ccb.cdm.num_matches == 1) { + free(ccb.cdm.matches); + *ndisks = 0; + *disksp = NULL; + return (0); + } + + /* + * Some of the "da" peripherals may be for RAID volumes, so + * fetch the IOC 2 page (list of RAID volumes) so we can + * exclude them from the list. + */ + ioc2 = mpt_read_ioc_page(fd, 2, NULL); + disks = calloc(ccb.cdm.num_matches, sizeof(*disks)); + count = 0; + for (i = 1; i < ccb.cdm.num_matches; i++) { + r = &ccb.cdm.matches[i].result.periph_result; + if (periph_is_volume(ioc2, r)) + continue; + disks[count].bus = 0; + disks[count].target = r->target_id; + snprintf(disks[count].devname, sizeof(disks[count].devname), + "%s%d", r->periph_name, r->unit_number); + + dev = cam_open_device(disks[count].devname, O_RDWR); + if (dev != NULL) { + fetch_scsi_capacity(dev, &disks[count]); + fetch_scsi_inquiry(dev, &disks[count]); + cam_close_device(dev); + } + count++; + } + free(ccb.cdm.matches); + free(ioc2); + + *ndisks = count; + *disksp = disks; + return (0); +} + +/* + * Instruct the mpt(4) device to rescan its busses to find new devices + * such as disks whose RAID physdisk page was removed or volumes that + * were created. If id is -1, the entire bus is rescanned. + * Otherwise, only devices at the specified ID are rescanned. If bus + * is -1, then all busses are scanned instead of the specified bus. + * Note that currently, only bus 0 is supported. + */ +int +mpt_rescan_bus(int bus, int id) +{ + struct bus_match_pattern *b; + union ccb ccb; + path_id_t path_id; + size_t bufsize; + + /* mpt(4) only handles devices on bus 0. */ + if (bus != -1 && bus != 0) + return (EINVAL); + + if (xpt_open() < 0) + return (ENXIO); + + /* First, find the path id of bus 0 for this mpt controller. */ + bzero(&ccb, sizeof(ccb)); + + ccb.ccb_h.func_code = XPT_DEV_MATCH; + + bufsize = sizeof(struct dev_match_result) * 1; + ccb.cdm.num_matches = 0; + ccb.cdm.match_buf_len = bufsize; + ccb.cdm.matches = calloc(1, bufsize); + + bufsize = sizeof(struct dev_match_pattern) * 1; + ccb.cdm.num_patterns = 1; + ccb.cdm.pattern_buf_len = bufsize; + ccb.cdm.patterns = calloc(1, bufsize); + + /* Match mptX bus 0. */ + ccb.cdm.patterns[0].type = DEV_MATCH_BUS; + b = &ccb.cdm.patterns[0].pattern.bus_pattern; + snprintf(b->dev_name, sizeof(b->dev_name), "mpt"); + b->unit_number = mpt_unit; + b->bus_id = 0; + b->flags = BUS_MATCH_NAME | BUS_MATCH_UNIT | BUS_MATCH_BUS_ID; + + if (ioctl(xptfd, CAMIOCOMMAND, &ccb) < 0) { + free(ccb.cdm.matches); + free(ccb.cdm.patterns); + return (errno); + } + free(ccb.cdm.patterns); + + if (((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) || + (ccb.cdm.status != CAM_DEV_MATCH_LAST)) { + warnx("mpt_rescan_bus got CAM error %#x, CDM error %d\n", + ccb.ccb_h.status, ccb.cdm.status); + free(ccb.cdm.matches); + return (EIO); + } + + /* We should have exactly 1 match for the bus. */ + if (ccb.cdm.num_matches != 1 || + ccb.cdm.matches[0].type != DEV_MATCH_BUS) { + free(ccb.cdm.matches); + return (ENOENT); + } + path_id = ccb.cdm.matches[0].result.bus_result.path_id; + free(ccb.cdm.matches); + + /* Now perform the actual rescan. */ + ccb.ccb_h.path_id = path_id; + if (id == -1) { + ccb.ccb_h.func_code = XPT_SCAN_BUS; + ccb.ccb_h.target_id = CAM_TARGET_WILDCARD; + ccb.ccb_h.target_lun = CAM_LUN_WILDCARD; + ccb.ccb_h.timeout = 5000; + } else { + ccb.ccb_h.func_code = XPT_SCAN_LUN; + ccb.ccb_h.target_id = id; + ccb.ccb_h.target_lun = 0; + } + ccb.crcn.flags = CAM_FLAG_NONE; + + /* Run this at a low priority. */ + ccb.ccb_h.pinfo.priority = 5; + + if (ioctl(xptfd, CAMIOCOMMAND, &ccb) == -1) + return (errno); + + if ((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + warnx("mpt_rescan_bus rescan got CAM error %#x\n", + ccb.ccb_h.status & CAM_STATUS_MASK); + return (EIO); + } + + return (0); +} Added: head/usr.sbin/mptutil/mpt_cmd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/mptutil/mpt_cmd.c Fri Aug 14 13:13:12 2009 (r196212) @@ -0,0 +1,639 @@ +/*- + * Copyright (c) 2008 Yahoo!, Inc. + * All rights reserved. + * Written by: John Baldwin + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__RCSID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "mptutil.h" + +static const char *mpt_ioc_status_codes[] = { + "Success", /* 0x0000 */ + "Invalid function", + "Busy", + "Invalid scatter-gather list", + "Internal error", + "Reserved", + "Insufficient resources", + "Invalid field", + "Invalid state", /* 0x0008 */ + "Operation state not supported", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, /* 0x0010 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, /* 0x0018 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "Invalid configuration action", /* 0x0020 */ + "Invalid configuration type", + "Invalid configuration page", + "Invalid configuration data", + "No configuration defaults", + "Unable to commit configuration change", + NULL, + NULL, + NULL, /* 0x0028 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, /* 0x0030 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, /* 0x0038 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "Recovered SCSI error", /* 0x0040 */ + "Invalid SCSI bus", + "Invalid SCSI target ID", + "SCSI device not there", + "SCSI data overrun", + "SCSI data underrun", + "SCSI I/O error", + "SCSI protocol error", + "SCSI task terminated", /* 0x0048 */ + "SCSI residual mismatch", + "SCSI task management failed", + "SCSI I/O controller terminated", + "SCSI external controller terminated", + "EEDP guard error", + "EEDP reference tag error", + "EEDP application tag error", + NULL, /* 0x0050 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, /* 0x0058 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "SCSI target priority I/O", /* 0x0060 */ + "Invalid SCSI target port", + "Invalid SCSI target I/O index", + "SCSI target aborted", + "No connection retryable", + "No connection", + "FC aborted", + "Invalid FC receive ID", + "FC did invalid", /* 0x0068 */ + "FC node logged out", + "Transfer count mismatch", + "STS data not set", + "FC exchange canceled", + "Data offset error", + "Too much write data", + "IU too short", + "ACK NAK timeout", /* 0x0070 */ + "NAK received", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, /* 0x0078 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "LAN device not found", /* 0x0080 */ + "LAN device failure", + "LAN transmit error", + "LAN transmit aborted", + "LAN receive error", + "LAN receive aborted", + "LAN partial packet", + "LAN canceled", + NULL, /* 0x0088 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "SAS SMP request failed", /* 0x0090 */ + "SAS SMP data overrun", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "Inband aborted", /* 0x0098 */ + "No inband connection", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "Diagnostic released", /* 0x00A0 */ +}; + +static const char *mpt_raid_action_status_codes[] = { + "Success", + "Invalid action", + "Failure", + "Operation in progress", +}; + +const char * +mpt_ioc_status(U16 IOCStatus) +{ + static char buffer[16]; + + IOCStatus &= MPI_IOCSTATUS_MASK; + if (IOCStatus < sizeof(mpt_ioc_status_codes) / sizeof(char *) && + mpt_ioc_status_codes[IOCStatus] != NULL) + return (mpt_ioc_status_codes[IOCStatus]); + snprintf(buffer, sizeof(buffer), "Status: 0x%04x", IOCStatus); + return (buffer); +} + +const char * +mpt_raid_status(U16 ActionStatus) +{ + static char buffer[16]; + + if (ActionStatus < sizeof(mpt_raid_action_status_codes) / + sizeof(char *)) + return (mpt_raid_action_status_codes[ActionStatus]); + snprintf(buffer, sizeof(buffer), "Status: 0x%04x", ActionStatus); + return (buffer); +} + +const char * +mpt_raid_level(U8 VolumeType) +{ + static char buf[16]; + + switch (VolumeType) { + case MPI_RAID_VOL_TYPE_IS: + return ("RAID-0"); + case MPI_RAID_VOL_TYPE_IM: + return ("RAID-1"); + case MPI_RAID_VOL_TYPE_IME: + return ("RAID-1E"); + case MPI_RAID_VOL_TYPE_RAID_5: + return ("RAID-5"); + case MPI_RAID_VOL_TYPE_RAID_6: + return ("RAID-6"); + case MPI_RAID_VOL_TYPE_RAID_10: + return ("RAID-10"); + case MPI_RAID_VOL_TYPE_RAID_50: + return ("RAID-50"); + default: + sprintf(buf, "LVL 0x%02x", VolumeType); + return (buf); + } +} + +const char * +mpt_volume_name(U8 VolumeBus, U8 VolumeID) +{ + static struct mpt_query_disk info; + static char buf[16]; + + if (mpt_query_disk(VolumeBus, VolumeID, &info) != 0) { + /* + * We only print out the bus number if it is non-zero + * since mpt(4) only supports devices on bus zero + * anyway. + */ + if (VolumeBus == 0) + snprintf(buf, sizeof(buf), "%d", VolumeID); + else + snprintf(buf, sizeof(buf), "%d:%d", VolumeBus, + VolumeID); + return (buf); + } + return (info.devname); +} + +int +mpt_lookup_volume(int fd, const char *name, U8 *VolumeBus, U8 *VolumeID) +{ + CONFIG_PAGE_IOC_2 *ioc2; + CONFIG_PAGE_IOC_2_RAID_VOL *vol; + struct mpt_query_disk info; + char *cp; + long bus, id; + int i; + + /* + * Check for a raw [:] string. If the bus is not + * specified, assume bus 0. + */ + bus = strtol(name, &cp, 0); + if (*cp == ':') { + id = strtol(cp + 1, &cp, 0); + if (*cp == '\0') { + if (bus < 0 || bus > 0xff || id < 0 || id > 0xff) { + errno = EINVAL; + return (-1); + } + *VolumeBus = bus; + *VolumeID = id; + return (0); + } + } else if (*cp == '\0') { + if (bus < 0 || bus > 0xff) { + errno = EINVAL; + return (-1); + } + *VolumeBus = 0; + *VolumeID = bus; + return (0); + } + + ioc2 = mpt_read_ioc_page(fd, 2, NULL); + if (ioc2 == NULL) + return (-1); + + vol = ioc2->RaidVolume; + for (i = 0; i < ioc2->NumActiveVolumes; vol++, i++) { + if (mpt_query_disk(vol->VolumeBus, vol->VolumeID, &info) != 0) + continue; + if (strcmp(name, info.devname) == 0) { + *VolumeBus = vol->VolumeBus; + *VolumeID = vol->VolumeID; + free(ioc2); + return (0); + } + } + free(ioc2); + errno = EINVAL; + return (-1); +} + +int +mpt_read_config_page_header(int fd, U8 PageType, U8 PageNumber, U32 PageAddress, + CONFIG_PAGE_HEADER *header, U16 *IOCStatus) +{ + struct mpt_cfg_page_req req; + + if (IOCStatus != NULL) + *IOCStatus = MPI_IOCSTATUS_SUCCESS; + bzero(&req, sizeof(req)); + req.header.PageType = PageType; + req.header.PageNumber = PageNumber; + req.page_address = PageAddress; + if (ioctl(fd, MPTIO_READ_CFG_HEADER, &req) < 0) + return (-1); + if (!IOC_STATUS_SUCCESS(req.ioc_status)) { + if (IOCStatus != NULL) + *IOCStatus = req.ioc_status; + else + warnx("Reading config page header failed: %s", + mpt_ioc_status(req.ioc_status)); + errno = EIO; + return (-1); + } + *header = req.header; + return (0); +} + +void * +mpt_read_config_page(int fd, U8 PageType, U8 PageNumber, U32 PageAddress, + U16 *IOCStatus) +{ + struct mpt_cfg_page_req req; + void *buf; + int save_errno; + + if (IOCStatus != NULL) + *IOCStatus = MPI_IOCSTATUS_SUCCESS; + bzero(&req, sizeof(req)); + req.header.PageType = PageType; + req.header.PageNumber = PageNumber; + req.page_address = PageAddress; + if (ioctl(fd, MPTIO_READ_CFG_HEADER, &req) < 0) + return (NULL); + if (!IOC_STATUS_SUCCESS(req.ioc_status)) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From scottl at samsco.org Fri Aug 14 13:13:44 2009 From: scottl at samsco.org (Scott Long) Date: Fri Aug 14 13:13:55 2009 Subject: svn commit: r196200 - in head: etc/mtree include sys/dev/mfi usr.sbin usr.sbin/mfiutil In-Reply-To: <4A852FDF.5060709@rulez.sk> References: <200908132318.n7DNIjvO015601@svn.freebsd.org> <4A852FDF.5060709@rulez.sk> Message-ID: <4A856303.6050000@samsco.org> Daniel Ger?o wrote: > Scott Long wrote: >> Author: scottl >> Date: Thu Aug 13 23:18:45 2009 >> New Revision: 196200 >> URL: http://svn.freebsd.org/changeset/base/196200 >> >> Log: >> ntroduce mfiutil, a basic utility for managing LSI SAS-RAID & Dell >> PERC5/6 >> controllers. Controller, array, and drive status can be checked, basic >> attributes can be changed, and arrays and spares can be created and >> deleted. >> Controller firmware can also be flashed. >> This does not replace MegaCLI, found in ports, as that is >> officially sanctioned >> and supported by LSI and includes vastly more functionality. >> However, mfiutil >> is open source and guaranteed to provide basic functionality, which >> can be >> especially useful if you have a problem and can't get MegaCLI to work. > > Is this MFC-able to stable/7 and stable/8? Yes. Scott From cperciva at FreeBSD.org Fri Aug 14 13:24:44 2009 From: cperciva at FreeBSD.org (Colin Percival) Date: Fri Aug 14 13:24:56 2009 Subject: svn commit: r196213 - head/usr.sbin/sysinstall Message-ID: <200908141324.n7EDOi2r035234@svn.freebsd.org> Author: cperciva Date: Fri Aug 14 13:24:44 2009 New Revision: 196213 URL: http://svn.freebsd.org/changeset/base/196213 Log: Make sysinstall recognize /dev/ada* disk devices. The description string "SATA disk device" reflects the current state of /dev/ada*; this may be changed in the future if other drive types start appearing as /dev/ada*. Submitted by: randi Details about what disks can appear as /dev/ada* supplied by: scottl Approved by: re (rwatson) Modified: head/usr.sbin/sysinstall/devices.c Modified: head/usr.sbin/sysinstall/devices.c ============================================================================== --- head/usr.sbin/sysinstall/devices.c Fri Aug 14 13:13:12 2009 (r196212) +++ head/usr.sbin/sysinstall/devices.c Fri Aug 14 13:24:44 2009 (r196213) @@ -80,6 +80,7 @@ static struct _devname { CDROM("acd%d", "ATAPI/IDE CDROM", 4), DISK("da%d", "SCSI disk device", 16), DISK("ad%d", "ATA/IDE disk device", 16), + DISK("ada%d", "SATA disk device", 16), DISK("ar%d", "ATA/IDE RAID device", 16), DISK("afd%d", "ATAPI/IDE floppy device", 4), DISK("mlxd%d", "Mylex RAID disk", 4), From scottl at samsco.org Fri Aug 14 13:27:40 2009 From: scottl at samsco.org (Scott Long) Date: Fri Aug 14 13:27:51 2009 Subject: svn commit: r196213 - head/usr.sbin/sysinstall In-Reply-To: <200908141324.n7EDOi2r035234@svn.freebsd.org> References: <200908141324.n7EDOi2r035234@svn.freebsd.org> Message-ID: <4A856647.7030100@samsco.org> Colin Percival wrote: > Author: cperciva > Date: Fri Aug 14 13:24:44 2009 > New Revision: 196213 > URL: http://svn.freebsd.org/changeset/base/196213 > > Log: > Make sysinstall recognize /dev/ada* disk devices. The description string > "SATA disk device" reflects the current state of /dev/ada*; this may be > changed in the future if other drive types start appearing as /dev/ada*. > > Submitted by: randi > Details about what disks can appear as /dev/ada* supplied by: scottl > Approved by: re (rwatson) > > Modified: > head/usr.sbin/sysinstall/devices.c > > Modified: head/usr.sbin/sysinstall/devices.c > ============================================================================== > --- head/usr.sbin/sysinstall/devices.c Fri Aug 14 13:13:12 2009 (r196212) > +++ head/usr.sbin/sysinstall/devices.c Fri Aug 14 13:24:44 2009 (r196213) > @@ -80,6 +80,7 @@ static struct _devname { > CDROM("acd%d", "ATAPI/IDE CDROM", 4), > DISK("da%d", "SCSI disk device", 16), > DISK("ad%d", "ATA/IDE disk device", 16), > + DISK("ada%d", "SATA disk device", 16), > DISK("ar%d", "ATA/IDE RAID device", 16), > DISK("afd%d", "ATAPI/IDE floppy device", 4), > DISK("mlxd%d", "Mylex RAID disk", 4), Note that there's still a possibility that 'ada' will go away in the future. Scott From cperciva at freebsd.org Fri Aug 14 13:34:07 2009 From: cperciva at freebsd.org (Colin Percival) Date: Fri Aug 14 13:34:21 2009 Subject: svn commit: r196213 - head/usr.sbin/sysinstall In-Reply-To: <4A856647.7030100@samsco.org> References: <200908141324.n7EDOi2r035234@svn.freebsd.org> <4A856647.7030100@samsco.org> Message-ID: <4A8567CE.4010400@freebsd.org> Scott Long wrote: > Colin Percival wrote: >> Log: >> Make sysinstall recognize /dev/ada* disk devices. The description >> string >> "SATA disk device" reflects the current state of /dev/ada*; this may be >> changed in the future if other drive types start appearing as >> /dev/ada*. >> Submitted by: randi >> Details about what disks can appear as /dev/ada* supplied by: scottl >> Approved by: re (rwatson) > > Note that there's still a possibility that 'ada' will go away in the > future. Oops. Quite right, I intended to mention both the possibility of more devices appearing as /dev/ada* and also the possibility of fewer devices appearing as /dev/ada*, but I forgot about the second half of that when I sat down to write the commit log. -- Colin Percival Security Officer, FreeBSD | freebsd.org | The power to serve Founder / author, Tarsnap | tarsnap.com | Online backups for the truly paranoid From remko at FreeBSD.org Fri Aug 14 18:18:52 2009 From: remko at FreeBSD.org (Remko Lodder) Date: Fri Aug 14 18:18:58 2009 Subject: svn commit: r196216 - head/usr.sbin/arp Message-ID: <200908141818.n7EIIpxZ043806@svn.freebsd.org> Author: remko Date: Fri Aug 14 18:18:51 2009 New Revision: 196216 URL: http://svn.freebsd.org/changeset/base/196216 Log: Remove bogus char cast. PR: 118014 Submitted by: Gardner Bell Approved by: re (rwatson), imp (mentor, implicit) MFC after: immediate Modified: head/usr.sbin/arp/arp.c Modified: head/usr.sbin/arp/arp.c ============================================================================== --- head/usr.sbin/arp/arp.c Fri Aug 14 16:15:18 2009 (r196215) +++ head/usr.sbin/arp/arp.c Fri Aug 14 18:18:51 2009 (r196216) @@ -120,7 +120,7 @@ main(int argc, char *argv[]) int aflag = 0; /* do it for all entries */ while ((ch = getopt(argc, argv, "andfsSi:")) != -1) - switch((char)ch) { + switch(ch) { case 'a': aflag = 1; break; From jhb at FreeBSD.org Fri Aug 14 20:03:53 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Fri Aug 14 20:03:59 2009 Subject: svn commit: r196219 - in head/sys: dev/ata dev/sound/usb dev/usb dev/usb/controller dev/usb/input dev/usb/misc dev/usb/net dev/usb/quirk dev/usb/serial dev/usb/storage dev/usb/template dev/usb/wlan... Message-ID: <200908142003.n7EK3r82046080@svn.freebsd.org> Author: jhb Date: Fri Aug 14 20:03:53 2009 New Revision: 196219 URL: http://svn.freebsd.org/changeset/base/196219 Log: Purge mergeinfo from files that were temporarily renamed while USB2 was imported into the tree alongside USB. Approved by: re (mergeinfo blanket) Modified: head/sys/dev/ata/ata-usb.c (props changed) head/sys/dev/sound/usb/uaudio.c (props changed) head/sys/dev/sound/usb/uaudio.h (props changed) head/sys/dev/sound/usb/uaudio_pcm.c (props changed) head/sys/dev/sound/usb/uaudioreg.h (props changed) head/sys/dev/usb/controller/at91dci.c (props changed) head/sys/dev/usb/controller/at91dci.h (props changed) head/sys/dev/usb/controller/at91dci_atmelarm.c (props changed) head/sys/dev/usb/controller/atmegadci.c (props changed) head/sys/dev/usb/controller/atmegadci.h (props changed) head/sys/dev/usb/controller/atmegadci_atmelarm.c (props changed) head/sys/dev/usb/controller/ehci.c (props changed) head/sys/dev/usb/controller/ehci.h (props changed) head/sys/dev/usb/controller/ehci_ixp4xx.c (props changed) head/sys/dev/usb/controller/ehci_mbus.c (props changed) head/sys/dev/usb/controller/ehci_pci.c (props changed) head/sys/dev/usb/controller/musb_otg.c (props changed) head/sys/dev/usb/controller/musb_otg.h (props changed) head/sys/dev/usb/controller/musb_otg_atmelarm.c (props changed) head/sys/dev/usb/controller/ohci.c (props changed) head/sys/dev/usb/controller/ohci.h (props changed) head/sys/dev/usb/controller/ohci_atmelarm.c (props changed) head/sys/dev/usb/controller/ohci_pci.c (props changed) head/sys/dev/usb/controller/uhci.c (props changed) head/sys/dev/usb/controller/uhci.h (props changed) head/sys/dev/usb/controller/uhci_pci.c (props changed) head/sys/dev/usb/controller/usb_controller.c (props changed) head/sys/dev/usb/controller/uss820dci.c (props changed) head/sys/dev/usb/controller/uss820dci.h (props changed) head/sys/dev/usb/controller/uss820dci_atmelarm.c (props changed) head/sys/dev/usb/input/uhid.c (props changed) head/sys/dev/usb/input/ukbd.c (props changed) head/sys/dev/usb/input/ums.c (props changed) head/sys/dev/usb/input/usb_rdesc.h (props changed) head/sys/dev/usb/misc/udbp.c (props changed) head/sys/dev/usb/misc/udbp.h (props changed) head/sys/dev/usb/misc/ufm.c (props changed) head/sys/dev/usb/net/if_aue.c (props changed) head/sys/dev/usb/net/if_auereg.h (props changed) head/sys/dev/usb/net/if_axe.c (props changed) head/sys/dev/usb/net/if_axereg.h (props changed) head/sys/dev/usb/net/if_cdce.c (props changed) head/sys/dev/usb/net/if_cdcereg.h (props changed) head/sys/dev/usb/net/if_cue.c (props changed) head/sys/dev/usb/net/if_cuereg.h (props changed) head/sys/dev/usb/net/if_kue.c (props changed) head/sys/dev/usb/net/if_kuefw.h (props changed) head/sys/dev/usb/net/if_kuereg.h (props changed) head/sys/dev/usb/net/if_rue.c (props changed) head/sys/dev/usb/net/if_ruereg.h (props changed) head/sys/dev/usb/net/if_udav.c (props changed) head/sys/dev/usb/net/if_udavreg.h (props changed) head/sys/dev/usb/net/usb_ethernet.c (props changed) head/sys/dev/usb/net/usb_ethernet.h (props changed) head/sys/dev/usb/quirk/usb_quirk.c (props changed) head/sys/dev/usb/quirk/usb_quirk.h (props changed) head/sys/dev/usb/serial/u3g.c (props changed) head/sys/dev/usb/serial/uark.c (props changed) head/sys/dev/usb/serial/ubsa.c (props changed) head/sys/dev/usb/serial/ubser.c (props changed) head/sys/dev/usb/serial/uchcom.c (props changed) head/sys/dev/usb/serial/ucycom.c (props changed) head/sys/dev/usb/serial/ufoma.c (props changed) head/sys/dev/usb/serial/uftdi.c (props changed) head/sys/dev/usb/serial/uftdi_reg.h (props changed) head/sys/dev/usb/serial/ugensa.c (props changed) head/sys/dev/usb/serial/uipaq.c (props changed) head/sys/dev/usb/serial/ulpt.c (props changed) head/sys/dev/usb/serial/umct.c (props changed) head/sys/dev/usb/serial/umodem.c (props changed) head/sys/dev/usb/serial/umoscom.c (props changed) head/sys/dev/usb/serial/uplcom.c (props changed) head/sys/dev/usb/serial/usb_serial.c (props changed) head/sys/dev/usb/serial/usb_serial.h (props changed) head/sys/dev/usb/serial/uslcom.c (props changed) head/sys/dev/usb/serial/uvisor.c (props changed) head/sys/dev/usb/serial/uvscom.c (props changed) head/sys/dev/usb/storage/rio500_usb.h (props changed) head/sys/dev/usb/storage/umass.c (props changed) head/sys/dev/usb/storage/urio.c (props changed) head/sys/dev/usb/storage/ustorage_fs.c (props changed) head/sys/dev/usb/template/usb_template.c (props changed) head/sys/dev/usb/template/usb_template.h (props changed) head/sys/dev/usb/template/usb_template_cdce.c (props changed) head/sys/dev/usb/template/usb_template_msc.c (props changed) head/sys/dev/usb/template/usb_template_mtp.c (props changed) head/sys/dev/usb/ufm_ioctl.h (props changed) head/sys/dev/usb/usb.h (props changed) head/sys/dev/usb/usb_bus.h (props changed) head/sys/dev/usb/usb_busdma.c (props changed) head/sys/dev/usb/usb_busdma.h (props changed) head/sys/dev/usb/usb_cdc.h (props changed) head/sys/dev/usb/usb_compat_linux.c (props changed) head/sys/dev/usb/usb_compat_linux.h (props changed) head/sys/dev/usb/usb_controller.h (props changed) head/sys/dev/usb/usb_core.c (props changed) head/sys/dev/usb/usb_core.h (props changed) head/sys/dev/usb/usb_debug.c (props changed) head/sys/dev/usb/usb_debug.h (props changed) head/sys/dev/usb/usb_dev.c (props changed) head/sys/dev/usb/usb_dev.h (props changed) head/sys/dev/usb/usb_device.c (props changed) head/sys/dev/usb/usb_device.h (props changed) head/sys/dev/usb/usb_dynamic.c (props changed) head/sys/dev/usb/usb_dynamic.h (props changed) head/sys/dev/usb/usb_endian.h (props changed) head/sys/dev/usb/usb_error.c (props changed) head/sys/dev/usb/usb_generic.c (props changed) head/sys/dev/usb/usb_generic.h (props changed) head/sys/dev/usb/usb_handle_request.c (props changed) head/sys/dev/usb/usb_hid.c (props changed) head/sys/dev/usb/usb_hub.c (props changed) head/sys/dev/usb/usb_hub.h (props changed) head/sys/dev/usb/usb_if.m (props changed) head/sys/dev/usb/usb_ioctl.h (props changed) head/sys/dev/usb/usb_lookup.c (props changed) head/sys/dev/usb/usb_mbuf.c (props changed) head/sys/dev/usb/usb_mbuf.h (props changed) head/sys/dev/usb/usb_msctest.c (props changed) head/sys/dev/usb/usb_msctest.h (props changed) head/sys/dev/usb/usb_parse.c (props changed) head/sys/dev/usb/usb_pci.h (props changed) head/sys/dev/usb/usb_process.c (props changed) head/sys/dev/usb/usb_process.h (props changed) head/sys/dev/usb/usb_request.c (props changed) head/sys/dev/usb/usb_request.h (props changed) head/sys/dev/usb/usb_transfer.c (props changed) head/sys/dev/usb/usb_transfer.h (props changed) head/sys/dev/usb/usb_util.c (props changed) head/sys/dev/usb/usb_util.h (props changed) head/sys/dev/usb/usbdevs (props changed) head/sys/dev/usb/usbhid.h (props changed) head/sys/dev/usb/wlan/if_rum.c (props changed) head/sys/dev/usb/wlan/if_rumfw.h (props changed) head/sys/dev/usb/wlan/if_rumreg.h (props changed) head/sys/dev/usb/wlan/if_rumvar.h (props changed) head/sys/dev/usb/wlan/if_ural.c (props changed) head/sys/dev/usb/wlan/if_uralreg.h (props changed) head/sys/dev/usb/wlan/if_uralvar.h (props changed) head/sys/dev/usb/wlan/if_zyd.c (props changed) head/sys/dev/usb/wlan/if_zydfw.h (props changed) head/sys/dev/usb/wlan/if_zydreg.h (props changed) head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c (props changed) head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h (props changed) head/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c (props changed) From jhb at FreeBSD.org Fri Aug 14 20:35:43 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Fri Aug 14 20:35:48 2009 Subject: svn commit: r196221 - head/release Message-ID: <200908142035.n7EKZgfS046896@svn.freebsd.org> Author: jhb Date: Fri Aug 14 20:35:42 2009 New Revision: 196221 URL: http://svn.freebsd.org/changeset/base/196221 Log: Add the ability to build a release from an SVN checkout instead of a CVS checkout. If SVNROOT is specified, then the source tree will be checked out from that SVN repository instead of using CVS. ports and docs still use CVS. If SVNROOT is not specified, then the source tree will be checked out using CVS. An explicit SVN branch can be specified using SVNBRANCH (e.g. SVNBRANCH=stable/8). If SVNBRANCH is not set but RELEASETAG is set to a CVS branch (such as RELENG_8) the appropriate SVN branch will be inferred from the CVS branch using svnbranch.awk. Note that there are still several open questions about using SVN instead of CVS in the release process. However, this does enable one to build a release from an SVN repository if needed. Approved by: re (kensmith) Added: head/release/svnbranch.awk (contents, props changed) Modified: head/release/Makefile Modified: head/release/Makefile ============================================================================== --- head/release/Makefile Fri Aug 14 20:09:31 2009 (r196220) +++ head/release/Makefile Fri Aug 14 20:35:42 2009 (r196221) @@ -1,7 +1,8 @@ # $FreeBSD$ # # make release [BUILDNAME=somename] CHROOTDIR=/some/dir CVSROOT=/cvs/dir \ -# [RELEASETAG=tag] +# [RELEASETAG=tag] [SVNROOT=svn://svn.freebsd.org/base] \ +# [SVNBRANCH=some/branch] # # Where "/some/dir" is the pathname of a directory on a some filesystem with # at least 1000MB of free space, "somename" is what you want the release to @@ -9,6 +10,11 @@ # which CVS "tag" name should be used when checking out the sources to build # the release (default is HEAD). # +# Please note the support for building from SVN is preliminary and there +# are still questions about things like how to handle updates of +# /usr/src on production systems (csup(1) replacement). It is a work +# in progress and may change as the other issues get worked out. +# # Please note: the md(4) driver must be present in the kernel # (either by being compiled in or available as a kld(4) module), # otherwise the target 'release.8' and possibly others will fail. @@ -49,12 +55,25 @@ BUILDNAME?=${BASE}-${DATE}-SNAP # To add other options to the CVS command, set #CVSARGS="-lfq" # -# To prefix the cvs command +# To prefix the CVS command #CVSPREFIX="/usr/bin/time" # # Where the CVS repository is #CVSROOT="/home/ncvs" # +# To add other options to the Subversion subcommands (co,up), set +#SVNCMDARGS="-r '{ 01/01/2002 00:00:00 UTC }'" +# +# To prefix the Subversion command +#SVNPREFIX="/usr/bin/time" +# +# Where the Subversion repository is +#SVNROOT=svn://svn.freebsd.org/base +# +# Subversion branch to build for src. If this is not set then it is +# automatically computed from RELEASETAG. +#SVNBRANCH=stable/7 +# # Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we # are building an official release. Otherwise, we are building for # a branch. @@ -68,6 +87,16 @@ PORTSRELEASETAG?= ${AUXRELEASETAG} .endif .endif +# Determine the Subversion source branch that corresponds to the requested +# RELEASETAG. +.if !defined(SVNBRANCH) +.if defined(RELEASETAG) +SVNBRANCH!= echo "${RELEASETAG}" | awk -f ${.CURDIR}/svnbranch.awk +.else +SVNBRANCH= head +.endif +.endif + # If you want to pass flags to the world build such as -j X, use # WORLD_FLAGS. Similarly, you can specify make flags for kernel # builds via KERNEL_FLAGS. @@ -341,8 +370,17 @@ CVS_PORTSARGS+= -r ${PORTSRELEASETAG} WORLDDIR?= ${.CURDIR}/.. release rerelease: -.if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT) - @echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false +.if !defined(CHROOTDIR) || !defined(BUILDNAME) + @echo "To make a release you must set CHROOTDIR and BUILDNAME" && false +.endif +.if !defined(NOPORTSATALL) && !defined(EXTPORTSDIR) && !defined(CVSROOT) + @echo "Building ports requires CVSROOT or EXTPORTSDIR" && false +.endif +.if !defined(NODOC) && !defined(EXTDOCDIR) && !defined(CVSROOT) + @echo "Building docs requires CVSROOT or EXTDOCDIR" && false +.endif +.if !defined(EXTSRCDIR) && !defined(CVSROOT) && !defined(SVNROOT) + @echo "The source tree requires SVNROOT, CVSROOT, or EXTSRCDIR" && false .endif .if defined(NOPORTSATALL) && !defined(NODOC) @echo "Ports are required for building the release docs. Either set NODOC or" @@ -387,6 +425,10 @@ release rerelease: .if defined(EXTSRCDIR) cd ${CHROOTDIR}/usr && \ cp -R -H ${EXTSRCDIR} src +.elif defined(SVNROOT) + cd ${CHROOTDIR}/usr && \ + ${SVNPREFIX} svn co ${SVNCMDARGS} ${SVNROOT}/${SVNBRANCH} \ + ${RELEASESRCMODULE} .else cd ${CHROOTDIR}/usr && \ ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \ @@ -432,7 +474,10 @@ release rerelease: .endif .if make(rerelease) .if !defined(RELEASENOUPDATE) && !defined(EXTSRCDIR) -.if !defined(RELEASETAG) +.if defined(SVNROOT) + cd ${CHROOTDIR}/usr/src && ${SVNPREFIX} svn switch ${SVNCMDARGS} \ + ${SVNROOT}/${SVNBRANCH} +.elif !defined(RELEASETAG) cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \ update ${CVSCMDARGS} -P -d -A .else Added: head/release/svnbranch.awk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/release/svnbranch.awk Fri Aug 14 20:35:42 2009 (r196221) @@ -0,0 +1,28 @@ +# $FreeBSD$ + +BEGIN { + FS = "_" +} + +/RELENG_.*_RELEASE/ { + if (NF == 5) { + printf "release/%s.%s.%s", $2, $3, $4 + exit + } +} + +/RELENG_.*/ { + if (NF == 3) { + printf "releng/%s.%s", $2, $3 + exit + } + + if (NF == 2) { + printf "stable/%s", $2 + exit + } +} + +// { + printf "unknown_branch" +} From jhb at FreeBSD.org Fri Aug 14 21:05:09 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Fri Aug 14 21:05:15 2009 Subject: svn commit: r196224 - in head/sys: amd64/amd64 amd64/include dev/hwpmc i386/i386 i386/include Message-ID: <200908142105.n7EL58HV047671@svn.freebsd.org> Author: jhb Date: Fri Aug 14 21:05:08 2009 New Revision: 196224 URL: http://svn.freebsd.org/changeset/base/196224 Log: Adjust the handling of the local APIC PMC interrupt vector: - Provide lapic_disable_pmc(), lapic_enable_pmc(), and lapic_reenable_pmc() routines in the local APIC code that the hwpmc(4) driver can use to manage the local APIC PMC interrupt vector. - Do not enable the local APIC PMC interrupt vector by default when HWPMC_HOOKS is enabled. Instead, the hwpmc(4) driver explicitly enables the interrupt when it is succesfully initialized and disables the interrupt when it is unloaded. This avoids enabling the interrupt on unsupported CPUs which may result in spurious NMIs. Reported by: rnoland Reviewed by: jkoshy Approved by: re (kib) MFC after: 2 weeks Modified: head/sys/amd64/amd64/local_apic.c head/sys/amd64/include/apicvar.h head/sys/amd64/include/pmc_mdep.h head/sys/dev/hwpmc/hwpmc_core.c head/sys/dev/hwpmc/hwpmc_piv.c head/sys/dev/hwpmc/hwpmc_ppro.c head/sys/dev/hwpmc/hwpmc_x86.c head/sys/i386/i386/local_apic.c head/sys/i386/include/apicvar.h head/sys/i386/include/pmc_mdep.h Modified: head/sys/amd64/amd64/local_apic.c ============================================================================== --- head/sys/amd64/amd64/local_apic.c Fri Aug 14 20:57:21 2009 (r196223) +++ head/sys/amd64/amd64/local_apic.c Fri Aug 14 21:05:08 2009 (r196224) @@ -123,7 +123,7 @@ static struct lvt lvts[LVT_MAX + 1] = { { 1, 1, 0, 1, APIC_LVT_DM_NMI, 0 }, /* LINT1: NMI */ { 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_TIMER_INT }, /* Timer */ { 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_ERROR_INT }, /* Error */ - { 1, 1, 0, 1, APIC_LVT_DM_NMI, 0 }, /* PMC */ + { 1, 1, 1, 1, APIC_LVT_DM_NMI, 0 }, /* PMC */ { 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_THERMAL_INT }, /* Thermal */ }; @@ -305,11 +305,9 @@ lapic_setup(int boot) lapic->lvt_lint0 = lvt_mode(la, LVT_LINT0, lapic->lvt_lint0); lapic->lvt_lint1 = lvt_mode(la, LVT_LINT1, lapic->lvt_lint1); -#ifdef HWPMC_HOOKS /* Program the PMC LVT entry if present. */ if (maxlvt >= LVT_PMC) lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint); -#endif /* Program timer LVT and setup handler. */ lapic->lvt_timer = lvt_mode(la, LVT_TIMER, lapic->lvt_timer); @@ -332,6 +330,88 @@ lapic_setup(int boot) intr_restore(eflags); } +void +lapic_reenable_pmc(void) +{ +#ifdef HWPMC_HOOKS + uint32_t value; + + value = lapic->lvt_pcint; + value &= ~APIC_LVT_M; + lapic->lvt_pcint = value; +#endif +} + +#ifdef HWPMC_HOOKS +static void +lapic_update_pmc(void *dummy) +{ + struct lapic *la; + + la = &lapics[lapic_id()]; + lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint); +} +#endif + +int +lapic_enable_pmc(void) +{ +#ifdef HWPMC_HOOKS + u_int32_t maxlvt; + + /* Fail if the local APIC is not present. */ + if (lapic == NULL) + return (0); + + /* Fail if the PMC LVT is not present. */ + maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT; + if (maxlvt < LVT_PMC) + return (0); + + lvts[LVT_PMC].lvt_masked = 0; + +#ifdef SMP + /* + * If hwpmc was loaded at boot time then the APs may not be + * started yet. In that case, don't forward the request to + * them as they will program the lvt when they start. + */ + if (smp_started) + smp_rendezvous(NULL, lapic_update_pmc, NULL, NULL); + else +#endif + lapic_update_pmc(NULL); + return (1); +#else + return (0); +#endif +} + +void +lapic_disable_pmc(void) +{ +#ifdef HWPMC_HOOKS + u_int32_t maxlvt; + + /* Fail if the local APIC is not present. */ + if (lapic == NULL) + return; + + /* Fail if the PMC LVT is not present. */ + maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT; + if (maxlvt < LVT_PMC) + return; + + lvts[LVT_PMC].lvt_masked = 1; + +#ifdef SMP + /* The APs should always be started when hwpmc is unloaded. */ + KASSERT(mp_ncpus == 1 || smp_started, ("hwpmc unloaded too early")); +#endif + smp_rendezvous(NULL, lapic_update_pmc, NULL, NULL); +#endif +} + /* * Called by cpu_initclocks() on the BSP to setup the local APIC timer so * that it can drive hardclock, statclock, and profclock. This function Modified: head/sys/amd64/include/apicvar.h ============================================================================== --- head/sys/amd64/include/apicvar.h Fri Aug 14 20:57:21 2009 (r196223) +++ head/sys/amd64/include/apicvar.h Fri Aug 14 21:05:08 2009 (r196224) @@ -201,7 +201,9 @@ int ioapic_set_triggermode(void *cookie, int ioapic_set_smi(void *cookie, u_int pin); void lapic_create(u_int apic_id, int boot_cpu); void lapic_disable(void); +void lapic_disable_pmc(void); void lapic_dump(const char *str); +int lapic_enable_pmc(void); void lapic_eoi(void); u_int lapic_error(void); int lapic_id(void); @@ -212,6 +214,7 @@ void lapic_ipi_vectored(u_int vector, in int lapic_ipi_wait(int delay); void lapic_handle_intr(int vector, struct trapframe *frame); void lapic_handle_timer(struct trapframe *frame); +void lapic_reenable_pmc(void); void lapic_set_logical_id(u_int apic_id, u_int cluster, u_int cluster_id); int lapic_set_lvt_mask(u_int apic_id, u_int lvt, u_char masked); int lapic_set_lvt_mode(u_int apic_id, u_int lvt, u_int32_t mode); Modified: head/sys/amd64/include/pmc_mdep.h ============================================================================== --- head/sys/amd64/include/pmc_mdep.h Fri Aug 14 20:57:21 2009 (r196223) +++ head/sys/amd64/include/pmc_mdep.h Fri Aug 14 21:05:08 2009 (r196224) @@ -115,7 +115,6 @@ union pmc_md_pmc { */ void start_exceptions(void), end_exceptions(void); -void pmc_x86_lapic_enable_pmc_interrupt(void); struct pmc_mdep *pmc_amd_initialize(void); void pmc_amd_finalize(struct pmc_mdep *_md); Modified: head/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_core.c Fri Aug 14 20:57:21 2009 (r196223) +++ head/sys/dev/hwpmc/hwpmc_core.c Fri Aug 14 21:05:08 2009 (r196224) @@ -32,10 +32,13 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include +#include +#include #include #include #include @@ -1771,7 +1774,7 @@ core_intr(int cpu, struct trapframe *tf) } if (found_interrupt) - pmc_x86_lapic_enable_pmc_interrupt(); + lapic_reenable_pmc(); atomic_add_int(found_interrupt ? &pmc_stats.pm_intr_processed : &pmc_stats.pm_intr_ignored, 1); @@ -1895,7 +1898,7 @@ core2_intr(int cpu, struct trapframe *tf (uintmax_t) rdmsr(IA_GLOBAL_OVF_CTRL)); if (found_interrupt) - pmc_x86_lapic_enable_pmc_interrupt(); + lapic_reenable_pmc(); atomic_add_int(found_interrupt ? &pmc_stats.pm_intr_processed : &pmc_stats.pm_intr_ignored, 1); Modified: head/sys/dev/hwpmc/hwpmc_piv.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_piv.c Fri Aug 14 20:57:21 2009 (r196223) +++ head/sys/dev/hwpmc/hwpmc_piv.c Fri Aug 14 21:05:08 2009 (r196224) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -39,6 +40,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -1537,7 +1540,7 @@ p4_intr(int cpu, struct trapframe *tf) */ if (did_interrupt) - pmc_x86_lapic_enable_pmc_interrupt(); + lapic_reenable_pmc(); atomic_add_int(did_interrupt ? &pmc_stats.pm_intr_processed : &pmc_stats.pm_intr_ignored, 1); Modified: head/sys/dev/hwpmc/hwpmc_ppro.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_ppro.c Fri Aug 14 20:57:21 2009 (r196223) +++ head/sys/dev/hwpmc/hwpmc_ppro.c Fri Aug 14 21:05:08 2009 (r196224) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -39,6 +40,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -718,7 +721,7 @@ p6_intr(int cpu, struct trapframe *tf) * unmasked after a PMC interrupt. */ if (retval) - pmc_x86_lapic_enable_pmc_interrupt(); + lapic_reenable_pmc(); atomic_add_int(retval ? &pmc_stats.pm_intr_processed : &pmc_stats.pm_intr_ignored, 1); Modified: head/sys/dev/hwpmc/hwpmc_x86.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_x86.c Fri Aug 14 20:57:21 2009 (r196223) +++ head/sys/dev/hwpmc/hwpmc_x86.c Fri Aug 14 21:05:08 2009 (r196224) @@ -39,7 +39,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include +#include #include #include @@ -47,18 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -extern volatile lapic_t *lapic; - -void -pmc_x86_lapic_enable_pmc_interrupt(void) -{ - uint32_t value; - - value = lapic->lvt_pcint; - value &= ~APIC_LVT_M; - lapic->lvt_pcint = value; -} - /* * Attempt to walk a user call stack using a too-simple algorithm. * In the general case we need unwind information associated with @@ -252,16 +241,15 @@ pmc_md_initialize() struct pmc_mdep *md; /* determine the CPU kind */ - md = NULL; if (cpu_vendor_id == CPU_VENDOR_AMD) md = pmc_amd_initialize(); else if (cpu_vendor_id == CPU_VENDOR_INTEL) md = pmc_intel_initialize(); else - KASSERT(0, ("[x86,%d] Unknown vendor", __LINE__)); + return (NULL); /* disallow sampling if we do not have an LAPIC */ - if (md != NULL && lapic == NULL) + if (!lapic_enable_pmc()) for (i = 1; i < md->pmd_nclass; i++) md->pmd_classdep[i].pcd_caps &= ~PMC_CAP_INTERRUPT; @@ -271,6 +259,8 @@ pmc_md_initialize() void pmc_md_finalize(struct pmc_mdep *md) { + + lapic_disable_pmc(); if (cpu_vendor_id == CPU_VENDOR_AMD) pmc_amd_finalize(md); else if (cpu_vendor_id == CPU_VENDOR_INTEL) Modified: head/sys/i386/i386/local_apic.c ============================================================================== --- head/sys/i386/i386/local_apic.c Fri Aug 14 20:57:21 2009 (r196223) +++ head/sys/i386/i386/local_apic.c Fri Aug 14 21:05:08 2009 (r196224) @@ -123,7 +123,7 @@ static struct lvt lvts[LVT_MAX + 1] = { { 1, 1, 0, 1, APIC_LVT_DM_NMI, 0 }, /* LINT1: NMI */ { 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_TIMER_INT }, /* Timer */ { 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_ERROR_INT }, /* Error */ - { 1, 1, 0, 1, APIC_LVT_DM_NMI, 0 }, /* PMC */ + { 1, 1, 1, 1, APIC_LVT_DM_NMI, 0 }, /* PMC */ { 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_THERMAL_INT }, /* Thermal */ }; @@ -307,11 +307,9 @@ lapic_setup(int boot) lapic->lvt_lint0 = lvt_mode(la, LVT_LINT0, lapic->lvt_lint0); lapic->lvt_lint1 = lvt_mode(la, LVT_LINT1, lapic->lvt_lint1); -#ifdef HWPMC_HOOKS /* Program the PMC LVT entry if present. */ if (maxlvt >= LVT_PMC) lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint); -#endif /* Program timer LVT and setup handler. */ lapic->lvt_timer = lvt_mode(la, LVT_TIMER, lapic->lvt_timer); @@ -334,6 +332,88 @@ lapic_setup(int boot) intr_restore(eflags); } +void +lapic_reenable_pmc(void) +{ +#ifdef HWPMC_HOOKS + uint32_t value; + + value = lapic->lvt_pcint; + value &= ~APIC_LVT_M; + lapic->lvt_pcint = value; +#endif +} + +#ifdef HWPMC_HOOKS +static void +lapic_update_pmc(void *dummy) +{ + struct lapic *la; + + la = &lapics[lapic_id()]; + lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint); +} +#endif + +int +lapic_enable_pmc(void) +{ +#ifdef HWPMC_HOOKS + u_int32_t maxlvt; + + /* Fail if the local APIC is not present. */ + if (lapic == NULL) + return (0); + + /* Fail if the PMC LVT is not present. */ + maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT; + if (maxlvt < LVT_PMC) + return (0); + + lvts[LVT_PMC].lvt_masked = 0; + +#ifdef SMP + /* + * If hwpmc was loaded at boot time then the APs may not be + * started yet. In that case, don't forward the request to + * them as they will program the lvt when they start. + */ + if (smp_started) + smp_rendezvous(NULL, lapic_update_pmc, NULL, NULL); + else +#endif + lapic_update_pmc(NULL); + return (1); +#else + return (0); +#endif +} + +void +lapic_disable_pmc(void) +{ +#ifdef HWPMC_HOOKS + u_int32_t maxlvt; + + /* Fail if the local APIC is not present. */ + if (lapic == NULL) + return; + + /* Fail if the PMC LVT is not present. */ + maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT; + if (maxlvt < LVT_PMC) + return; + + lvts[LVT_PMC].lvt_masked = 1; + +#ifdef SMP + /* The APs should always be started when hwpmc is unloaded. */ + KASSERT(mp_ncpus == 1 || smp_started, ("hwpmc unloaded too early")); +#endif + smp_rendezvous(NULL, lapic_update_pmc, NULL, NULL); +#endif +} + /* * Called by cpu_initclocks() on the BSP to setup the local APIC timer so * that it can drive hardclock, statclock, and profclock. This function Modified: head/sys/i386/include/apicvar.h ============================================================================== --- head/sys/i386/include/apicvar.h Fri Aug 14 20:57:21 2009 (r196223) +++ head/sys/i386/include/apicvar.h Fri Aug 14 21:05:08 2009 (r196224) @@ -230,7 +230,9 @@ int ioapic_set_triggermode(void *cookie, int ioapic_set_smi(void *cookie, u_int pin); void lapic_create(u_int apic_id, int boot_cpu); void lapic_disable(void); +void lapic_disable_pmc(void); void lapic_dump(const char *str); +int lapic_enable_pmc(void); void lapic_eoi(void); u_int lapic_error(void); int lapic_id(void); @@ -241,6 +243,7 @@ void lapic_ipi_vectored(u_int vector, in int lapic_ipi_wait(int delay); void lapic_handle_intr(int vector, struct trapframe *frame); void lapic_handle_timer(struct trapframe *frame); +void lapic_reenable_pmc(void); void lapic_set_logical_id(u_int apic_id, u_int cluster, u_int cluster_id); int lapic_set_lvt_mask(u_int apic_id, u_int lvt, u_char masked); int lapic_set_lvt_mode(u_int apic_id, u_int lvt, u_int32_t mode); Modified: head/sys/i386/include/pmc_mdep.h ============================================================================== --- head/sys/i386/include/pmc_mdep.h Fri Aug 14 20:57:21 2009 (r196223) +++ head/sys/i386/include/pmc_mdep.h Fri Aug 14 21:05:08 2009 (r196224) @@ -150,7 +150,6 @@ struct pmc_mdep; */ void start_exceptions(void), end_exceptions(void); -void pmc_x86_lapic_enable_pmc_interrupt(void); struct pmc_mdep *pmc_amd_initialize(void); void pmc_amd_finalize(struct pmc_mdep *_md); From bz at FreeBSD.org Fri Aug 14 21:46:54 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Fri Aug 14 21:47:06 2009 Subject: svn commit: r196226 - in head/sys: kern sys Message-ID: <200908142146.n7ELksKZ048760@svn.freebsd.org> Author: bz Date: Fri Aug 14 21:46:54 2009 New Revision: 196226 URL: http://svn.freebsd.org/changeset/base/196226 Log: Add a new macro to test that a variable could be loaded atomically. Check that the given variable is at most uintptr_t in size and that it is aligned. Note: ASSERT_ATOMIC_LOAD() uses ALIGN() to check for adequate alignment -- however, the function of ALIGN() is to guarantee alignment, and therefore may lead to stronger alignment enforcement than necessary for types that are smaller than sizeof(uintptr_t). Add checks to mtx, rw and sx locks init functions to detect possible breakage. This was used during debugging of the problem fixed with r196118 where a pointer was on an un-aligned address in the dpcpu area. In collaboration with: rwatson Reviewed by: rwatson Approved by: re (kib) Modified: head/sys/kern/kern_mutex.c head/sys/kern/kern_rwlock.c head/sys/kern/kern_sx.c head/sys/sys/systm.h Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Fri Aug 14 21:07:41 2009 (r196225) +++ head/sys/kern/kern_mutex.c Fri Aug 14 21:46:54 2009 (r196226) @@ -783,6 +783,8 @@ mtx_init(struct mtx *m, const char *name MPASS((opts & ~(MTX_SPIN | MTX_QUIET | MTX_RECURSE | MTX_NOWITNESS | MTX_DUPOK | MTX_NOPROFILE)) == 0); + ASSERT_ATOMIC_LOAD(m->mtx_lock, ("%s: mtx_lock not aligned for %s: %p", + __func__, name, &m->mtx_lock)); #ifdef MUTEX_DEBUG /* Diagnostic and error correction */ Modified: head/sys/kern/kern_rwlock.c ============================================================================== --- head/sys/kern/kern_rwlock.c Fri Aug 14 21:07:41 2009 (r196225) +++ head/sys/kern/kern_rwlock.c Fri Aug 14 21:46:54 2009 (r196226) @@ -174,6 +174,8 @@ rw_init_flags(struct rwlock *rw, const c MPASS((opts & ~(RW_DUPOK | RW_NOPROFILE | RW_NOWITNESS | RW_QUIET | RW_RECURSE)) == 0); + ASSERT_ATOMIC_LOAD(rw->rw_lock, ("%s: rw_lock not aligned for %s: %p", + __func__, name, &rw->rw_lock)); flags = LO_UPGRADABLE; if (opts & RW_DUPOK) Modified: head/sys/kern/kern_sx.c ============================================================================== --- head/sys/kern/kern_sx.c Fri Aug 14 21:07:41 2009 (r196225) +++ head/sys/kern/kern_sx.c Fri Aug 14 21:46:54 2009 (r196226) @@ -205,6 +205,8 @@ sx_init_flags(struct sx *sx, const char MPASS((opts & ~(SX_QUIET | SX_RECURSE | SX_NOWITNESS | SX_DUPOK | SX_NOPROFILE | SX_NOADAPTIVE)) == 0); + ASSERT_ATOMIC_LOAD(sx->sx_lock, ("%s: sx_lock not aligned for %s: %p", + __func__, description, &sx->sx_lock)); flags = LO_SLEEPABLE | LO_UPGRADABLE; if (opts & SX_DUPOK) Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Fri Aug 14 21:07:41 2009 (r196225) +++ head/sys/sys/systm.h Fri Aug 14 21:46:54 2009 (r196226) @@ -89,6 +89,10 @@ extern int maxusers; /* system tune hin #define __CTASSERT(x, y) typedef char __assert ## y[(x) ? 1 : -1] #endif +#define ASSERT_ATOMIC_LOAD(var,msg) \ + KASSERT(sizeof(var) <= sizeof(uintptr_t) && \ + ALIGN(&(var)) == (uintptr_t)&(var), msg) + /* * XXX the hints declarations are even more misplaced than most declarations * in this file, since they are needed in one file (per arch) and only used From zec at FreeBSD.org Fri Aug 14 22:41:39 2009 From: zec at FreeBSD.org (Marko Zec) Date: Fri Aug 14 22:41:45 2009 Subject: svn commit: r196228 - in head/sys: conf net Message-ID: <200908142241.n7EMfdw1050063@svn.freebsd.org> Author: zec Date: Fri Aug 14 22:41:39 2009 New Revision: 196228 URL: http://svn.freebsd.org/changeset/base/196228 Log: Make VNET_DEBUG a standalone compile-time option, i.e. decouple it from INVARIANTS. Reviewed by: bz Approved by: re (rwatson), julian (mentor) Modified: head/sys/conf/options head/sys/net/vnet.h Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Fri Aug 14 21:50:47 2009 (r196227) +++ head/sys/conf/options Fri Aug 14 22:41:39 2009 (r196228) @@ -821,8 +821,9 @@ TDMA_TXRATE_QUARTER_DEFAULT opt_tdma.h TDMA_TXRATE_11NA_DEFAULT opt_tdma.h TDMA_TXRATE_11NG_DEFAULT opt_tdma.h -# Virtualize the network stack +# Network stack virtualization options VIMAGE opt_global.h +VNET_DEBUG opt_global.h # Common Flash Interface (CFI) options CFI_SUPPORT_STRATAFLASH opt_cfi.h Modified: head/sys/net/vnet.h ============================================================================== --- head/sys/net/vnet.h Fri Aug 14 21:50:47 2009 (r196227) +++ head/sys/net/vnet.h Fri Aug 14 22:41:39 2009 (r196228) @@ -107,9 +107,6 @@ void vnet_destroy(struct vnet *vnet); * Various macros -- get and set the current network stack, but also * assertions. */ -#ifdef INVARIANTS -#define VNET_DEBUG -#endif #ifdef VNET_DEBUG #define VNET_ASSERT(condition) \ if (!(condition)) { \ From zec at FreeBSD.org Fri Aug 14 22:43:25 2009 From: zec at FreeBSD.org (Marko Zec) Date: Fri Aug 14 22:43:32 2009 Subject: svn commit: r196229 - head/sys/netinet Message-ID: <200908142243.n7EMhPUQ050130@svn.freebsd.org> Author: zec Date: Fri Aug 14 22:43:25 2009 New Revision: 196229 URL: http://svn.freebsd.org/changeset/base/196229 Log: SCTP is not yet compatible with options VIMAGE kernels although it compiles with VIMAGE defined, so explicitly disallow building such kernels. Reviewed by: rrs Approved by: re (rwatson), julian (mentor) Modified: head/sys/netinet/sctp_os_bsd.h Modified: head/sys/netinet/sctp_os_bsd.h ============================================================================== --- head/sys/netinet/sctp_os_bsd.h Fri Aug 14 22:41:39 2009 (r196228) +++ head/sys/netinet/sctp_os_bsd.h Fri Aug 14 22:43:25 2009 (r196229) @@ -78,6 +78,10 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef VIMAGE +#error "SCTP is not yet compatible with VIMAGE." +#endif + #ifdef IPSEC #include #include From zec at FreeBSD.org Fri Aug 14 22:46:45 2009 From: zec at FreeBSD.org (Marko Zec) Date: Fri Aug 14 22:46:52 2009 Subject: svn commit: r196230 - head/sys/net Message-ID: <200908142246.n7EMkjgw050245@svn.freebsd.org> Author: zec Date: Fri Aug 14 22:46:45 2009 New Revision: 196230 URL: http://svn.freebsd.org/changeset/base/196230 Log: Appease VNET_DEBUG - in if_vmove we temporarily switch i.e. recurse from one vnet to another which is OK, so no need to flood the console with warnings here. Approved by: re (rwatson), julian (mentor) Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Fri Aug 14 22:43:25 2009 (r196229) +++ head/sys/net/if.c Fri Aug 14 22:46:45 2009 (r196230) @@ -920,7 +920,7 @@ if_vmove_loan(struct thread *td, struct /* Make sure the named iface does not exists in the dst. prison/vnet. */ /* XXX Lock interfaces to avoid races. */ - CURVNET_SET(pr->pr_vnet); + CURVNET_SET_QUIET(pr->pr_vnet); difp = ifunit(ifname); CURVNET_RESTORE(); if (difp != NULL) { From qingli at FreeBSD.org Fri Aug 14 23:44:59 2009 From: qingli at FreeBSD.org (Qing Li) Date: Fri Aug 14 23:45:10 2009 Subject: svn commit: r196234 - head/sys/netinet Message-ID: <200908142344.n7ENixMN051744@svn.freebsd.org> Author: qingli Date: Fri Aug 14 23:44:59 2009 New Revision: 196234 URL: http://svn.freebsd.org/changeset/base/196234 Log: In function ip_output(), the cached route is flushed when there is a mismatch between the cached entry and the intended destination. The cached rtentry{} is flushed but the associated llentry{} is not. This causes the wrong destination MAC address being used in the output packets. The fix is to flush the llentry{} when rtentry{} is cleared. Reviewed by: kmacy, rwatson Approved by: re Modified: head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Fri Aug 14 23:05:10 2009 (r196233) +++ head/sys/netinet/ip_output.c Fri Aug 14 23:44:59 2009 (r196234) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -201,9 +202,12 @@ again: if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 || dst->sin_family != AF_INET || dst->sin_addr.s_addr != ip->ip_dst.s_addr)) { - if (!nortfree) + if (!nortfree) { RTFREE(ro->ro_rt); + LLE_FREE(ro->ro_lle); + } ro->ro_rt = (struct rtentry *)NULL; + ro->ro_lle = (struct llentry *)NULL; } #ifdef IPFIREWALL_FORWARD if (ro->ro_rt == NULL && fwd_tag == NULL) { From attilio at freebsd.org Sat Aug 15 03:01:04 2009 From: attilio at freebsd.org (Attilio Rao) Date: Sat Aug 15 03:01:10 2009 Subject: svn commit: r196226 - in head/sys: kern sys In-Reply-To: <200908142146.n7ELksKZ048760@svn.freebsd.org> References: <200908142146.n7ELksKZ048760@svn.freebsd.org> Message-ID: <3bbf2fe10908141933u91d0305jdc7301526adb69e2@mail.gmail.com> 2009/8/14 Bjoern A. Zeeb : > Author: bz > Date: Fri Aug 14 21:46:54 2009 > New Revision: 196226 > URL: http://svn.freebsd.org/changeset/base/196226 > > Log: > Add a new macro to test that a variable could be loaded atomically. > Check that the given variable is at most uintptr_t in size and that > it is aligned. > > Note: ASSERT_ATOMIC_LOAD() uses ALIGN() to check for adequate > alignment -- however, the function of ALIGN() is to guarantee > alignment, and therefore may lead to stronger alignment > enforcement than necessary for types that are smaller than > sizeof(uintptr_t). > > Add checks to mtx, rw and sx locks init functions to detect possible > breakage. This was used during debugging of the problem fixed with > r196118 where a pointer was on an un-aligned address in the dpcpu area. > > In collaboration with: rwatson > Reviewed by: rwatson > Approved by: re (kib) > > Modified: > head/sys/kern/kern_mutex.c > head/sys/kern/kern_rwlock.c > head/sys/kern/kern_sx.c > head/sys/sys/systm.h I think you should cover the lockmgr case too. Attilio -- Peace can only be achieved by understanding - A. Einstein From trasz at FreeBSD.org Sat Aug 15 11:47:05 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Sat Aug 15 11:47:12 2009 Subject: svn commit: r196242 - head/share/man/man4 Message-ID: <200908151147.n7FBl5HS069284@svn.freebsd.org> Author: trasz Date: Sat Aug 15 11:47:05 2009 New Revision: 196242 URL: http://svn.freebsd.org/changeset/base/196242 Log: Add mptutil(8) and mfiutil(1) to 'SEE ALSO' sections in mpt(4) and mfi(4). Approved by: re (rwatson) Modified: head/share/man/man4/mfi.4 head/share/man/man4/mpt.4 Modified: head/share/man/man4/mfi.4 ============================================================================== --- head/share/man/man4/mfi.4 Sat Aug 15 08:39:54 2009 (r196241) +++ head/share/man/man4/mfi.4 Sat Aug 15 11:47:05 2009 (r196242) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 17, 2008 +.Dd August 15, 2009 .Dt MFI 4 .Os .Sh NAME @@ -102,6 +102,7 @@ management interface An attempt was made to remove a mounted volume. .El .Sh SEE ALSO +.Xr mfiutil 1 , .Xr amr 4 , .Xr pci 4 .Sh HISTORY Modified: head/share/man/man4/mpt.4 ============================================================================== --- head/share/man/man4/mpt.4 Sat Aug 15 08:39:54 2009 (r196241) +++ head/share/man/man4/mpt.4 Sat Aug 15 11:47:05 2009 (r196242) @@ -35,7 +35,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 6, 2007 +.Dd August 15, 2009 .Dt MPT 4 .Os .Sh NAME @@ -155,6 +155,7 @@ can take on - no separate compilation is .Xr sa 4 , .Xr scsi 4 , .Xr targ 4 , +.Xr mptutil 8 , .Xr gmultipath 8 .Rs .%T "LSI Logic Website" From stas at FreeBSD.org Sat Aug 15 14:39:33 2009 From: stas at FreeBSD.org (Stanislav Sedov) Date: Sat Aug 15 14:39:39 2009 Subject: svn commit: r196244 - head/usr.sbin/pstat Message-ID: <200908151439.n7FEdXom073317@svn.freebsd.org> Author: stas Date: Sat Aug 15 14:39:33 2009 New Revision: 196244 URL: http://svn.freebsd.org/changeset/base/196244 Log: - Avoid overflowing the swap size counters in human-readable mode by introducing the new CONVERT_BLOCKS macro which operates on sizes already converted to number of blocks. With this macro it is not longer needed to perform needless multiplication by blocksize just to divide on it later in CONVERT macro. Approved by: re (kib) MFC after: 1 week Modified: head/usr.sbin/pstat/pstat.c Modified: head/usr.sbin/pstat/pstat.c ============================================================================== --- head/usr.sbin/pstat/pstat.c Sat Aug 15 11:52:40 2009 (r196243) +++ head/usr.sbin/pstat/pstat.c Sat Aug 15 14:39:33 2009 (r196244) @@ -460,6 +460,7 @@ getfiles(struct xfile **abuf, size_t *al */ #define CONVERT(v) ((int64_t)(v) * pagesize / blocksize) +#define CONVERT_BLOCKS(v) ((int64_t)(v) * pagesize) static struct kvm_swap swtot; static int nswdev; @@ -492,10 +493,10 @@ print_swap_line(const char *swdevname, i printf("%-15s %*jd ", swdevname, hlen, CONVERT(nblks)); if (humanflag) { humanize_number(usedbuf, sizeof(usedbuf), - CONVERT(blocksize * bused), "", + CONVERT_BLOCKS(bused), "", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); humanize_number(availbuf, sizeof(availbuf), - CONVERT(blocksize * bavail), "", + CONVERT_BLOCKS(bavail), "", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); printf("%8s %8s %5.0f%%\n", usedbuf, availbuf, bpercent); } else { From stas at FreeBSD.org Sat Aug 15 15:15:21 2009 From: stas at FreeBSD.org (Stanislav Sedov) Date: Sat Aug 15 15:15:27 2009 Subject: svn commit: r196246 - head/sys/arm/at91 Message-ID: <200908151515.n7FFFKEG074655@svn.freebsd.org> Author: stas Date: Sat Aug 15 15:15:20 2009 New Revision: 196246 URL: http://svn.freebsd.org/changeset/base/196246 Log: - Proprely intialize UART parameters at probe stage, so uart(4) will initialize the FIFO memory correctly on attach. Before that this values was intialized in only in at91_usart_bus_attach which is called after the uart(4) memory allocation happens. Approved by: re (kib) MFC after: 1 week Modified: head/sys/arm/at91/uart_dev_at91usart.c Modified: head/sys/arm/at91/uart_dev_at91usart.c ============================================================================== --- head/sys/arm/at91/uart_dev_at91usart.c Sat Aug 15 15:12:46 2009 (r196245) +++ head/sys/arm/at91/uart_dev_at91usart.c Sat Aug 15 15:15:20 2009 (r196246) @@ -307,6 +307,10 @@ static kobj_method_t at91_usart_methods[ int at91_usart_bus_probe(struct uart_softc *sc) { + + sc->sc_txfifosz = USART_BUFFER_SIZE; + sc->sc_rxfifosz = USART_BUFFER_SIZE; + sc->sc_hwiflow = 0; return (0); } @@ -344,10 +348,6 @@ at91_usart_bus_attach(struct uart_softc atsc->flags |= HAS_TIMEOUT; WR4(&sc->sc_bas, USART_IDR, 0xffffffff); - sc->sc_txfifosz = USART_BUFFER_SIZE; - sc->sc_rxfifosz = USART_BUFFER_SIZE; - sc->sc_hwiflow = 0; - #ifndef SKYEYE_WORKAROUNDS /* * Allocate DMA tags and maps From fluffy at FreeBSD.org Sat Aug 15 15:40:31 2009 From: fluffy at FreeBSD.org (Dima Panov) Date: Sat Aug 15 15:40:55 2009 Subject: svn commit: r196248 - head/usr.bin/calendar/calendars Message-ID: <200908151540.n7FFeVCl075795@svn.freebsd.org> Author: fluffy (ports committer) Date: Sat Aug 15 15:40:30 2009 New Revision: 196248 URL: http://svn.freebsd.org/changeset/base/196248 Log: Add my birthday Approved by: re (rwatson) miwi (mentor) Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Sat Aug 15 15:18:29 2009 (r196247) +++ head/usr.bin/calendar/calendars/calendar.freebsd Sat Aug 15 15:40:30 2009 (r196248) @@ -244,6 +244,7 @@ 09/10 Wesley R. Peters born in Hartford, Alabama, United States, 1961 09/12 Weongyo Jeong born in Haman, Korea, 1980 09/12 William C. Fumerola II born in Detroit, Michigan, United States, 1981 +09/15 Dima Panov born in Khabarovsk, Russian Federation, 1978 09/17 Maxim Bolotin born in Rostov-on-Don, Russian Federation, 1976 09/20 Kevin Lo born in Taipei, Taiwan, Republic of China, 1972 09/27 Neil Blakey-Milner born in Port Elizabeth, South Africa, 1978 From keramida at FreeBSD.org Sat Aug 15 17:57:22 2009 From: keramida at FreeBSD.org (Giorgos Keramidas) Date: Sat Aug 15 17:57:34 2009 Subject: svn commit: r196254 - head/usr.sbin/iostat Message-ID: <200908151757.n7FHvLCa080913@svn.freebsd.org> Author: keramida (doc committer) Date: Sat Aug 15 17:57:21 2009 New Revision: 196254 URL: http://svn.freebsd.org/changeset/base/196254 Log: iostat: add a bit of space between tty in/out columns The columns for tty input and output may bump against each other if the tty output needs more than 5 columns. Add a bit of space that pushes everything 1 column to the right, but also avoids the problem. Approved by: re (rwatson) Modified: head/usr.sbin/iostat/iostat.c Modified: head/usr.sbin/iostat/iostat.c ============================================================================== --- head/usr.sbin/iostat/iostat.c Sat Aug 15 16:15:50 2009 (r196253) +++ head/usr.sbin/iostat/iostat.c Sat Aug 15 17:57:21 2009 (r196254) @@ -586,7 +586,7 @@ main(int argc, char **argv) } if (xflag == 0 && Tflag > 0) - printf("%4.0Lf%5.0Lf", cur.tk_nin / etime, + printf("%4.0Lf %5.0Lf", cur.tk_nin / etime, cur.tk_nout / etime); devstats(hflag, etime, havelast); @@ -674,7 +674,7 @@ phdr(void) return; if (Tflag > 0) - (void)printf(" tty"); + (void)printf(" tty"); for (i = 0, printed=0;(i < num_devices) && (printed < maxshowdevs);i++){ int di; if ((dev_select[i].selected != 0) @@ -696,7 +696,7 @@ phdr(void) (void)printf("\n"); if (Tflag > 0) - (void)printf(" tin tout"); + (void)printf(" tin tout"); for (i=0, printed = 0;(i < num_devices) && (printed < maxshowdevs);i++){ if ((dev_select[i].selected != 0) @@ -741,7 +741,7 @@ devstats(int perf_select, long double et if (xflag > 0) { printf(" extended device statistics "); if (Tflag > 0) - printf(" tty "); + printf(" tty "); if (Cflag > 0) printf(" cpu "); printf("\n"); @@ -754,7 +754,7 @@ devstats(int perf_select, long double et "device r/i w/i kr/i kw/i wait svc_t %%b " ); if (Tflag > 0) - printf("tin tout "); + printf("tin tout "); if (Cflag > 0) printf("us ni sy in id "); printf("\n"); @@ -895,7 +895,7 @@ devstats(int perf_select, long double et */ printf("%52s",""); if (Tflag > 0) - printf("%4.0Lf%5.0Lf", cur.tk_nin / etime, + printf("%4.0Lf %5.0Lf", cur.tk_nin / etime, cur.tk_nout / etime); if (Cflag > 0) cpustats(); From attilio at FreeBSD.org Sat Aug 15 18:37:07 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Sat Aug 15 18:37:12 2009 Subject: svn commit: r196256 - head/sys/i386/xen Message-ID: <200908151837.n7FIb69r081959@svn.freebsd.org> Author: attilio Date: Sat Aug 15 18:37:06 2009 New Revision: 196256 URL: http://svn.freebsd.org/changeset/base/196256 Log: Port recent IPI enhachements to en: * Introduce the ipi_nmi_handler() function for the Xen infrastructure * Fixup adeguately the ipi sender functions Approved by: re (kib) Modified: head/sys/i386/xen/mp_machdep.c Modified: head/sys/i386/xen/mp_machdep.c ============================================================================== --- head/sys/i386/xen/mp_machdep.c Sat Aug 15 18:03:34 2009 (r196255) +++ head/sys/i386/xen/mp_machdep.c Sat Aug 15 18:37:06 2009 (r196256) @@ -118,6 +118,7 @@ volatile int smp_tlb_wait; typedef void call_data_func_t(uintptr_t , uintptr_t); static u_int logical_cpus; +static volatile cpumask_t ipi_nmi_pending; /* used to hold the AP's until we are ready to release them */ static struct mtx ap_boot_mtx; @@ -1109,6 +1110,14 @@ ipi_selected(cpumask_t cpus, u_int ipi) ipi = IPI_BITMAP_VECTOR; } + /* + * IPI_STOP_HARD maps to a NMI and the trap handler needs a bit + * of help in order to understand what is the source. + * Set the mask of receiving CPUs for this purpose. + */ + if (ipi == IPI_STOP_HARD) + atomic_set_int(&ipi_nmi_pending, cpus); + CTR3(KTR_SMP, "%s: cpus: %x ipi: %x", __func__, cpus, ipi); while ((cpu = ffs(cpus)) != 0) { cpu--; @@ -1140,10 +1149,39 @@ ipi_selected(cpumask_t cpus, u_int ipi) void ipi_all_but_self(u_int ipi) { + + /* + * IPI_STOP_HARD maps to a NMI and the trap handler needs a bit + * of help in order to understand what is the source. + * Set the mask of receiving CPUs for this purpose. + */ + if (ipi == IPI_STOP_HARD) + atomic_set_int(&ipi_nmi_pending, PCPU_GET(other_cpus)); + CTR2(KTR_SMP, "%s: ipi: %x", __func__, ipi); ipi_selected(PCPU_GET(other_cpus), ipi); } +int +ipi_nmi_handler() +{ + cpumask_t cpumask; + + /* + * As long as there is not a simple way to know about a NMI's + * source, if the bitmask for the current CPU is present in + * the global pending bitword an IPI_STOP_HARD has been issued + * and should be handled. + */ + cpumask = PCPU_GET(cpumask); + if ((ipi_nmi_pending & cpumask) == 0) + return (1); + + atomic_clear_int(&ipi_nmi_pending, cpumask); + cpustop_handler(); + return (0); +} + /* * Handle an IPI_STOP by saving our current context and spinning until we * are resumed. From ivoras at freebsd.org Sat Aug 15 18:37:50 2009 From: ivoras at freebsd.org (Ivan Voras) Date: Sat Aug 15 18:38:02 2009 Subject: svn commit: r196254 - head/usr.sbin/iostat In-Reply-To: <200908151757.n7FHvLCa080913@svn.freebsd.org> References: <200908151757.n7FHvLCa080913@svn.freebsd.org> Message-ID: <9bbcef730908151137h3c752f91j3ec9d93a8f860d66@mail.gmail.com> 2009/8/15 Giorgos Keramidas : > Author: keramida (doc committer) > Date: Sat Aug 15 17:57:21 2009 > New Revision: 196254 > URL: http://svn.freebsd.org/changeset/base/196254 > > Log: > ?iostat: add a bit of space between tty in/out columns > > ?The columns for tty input and output may bump against each other > ?if the tty output needs more than 5 columns. ?Add a bit of space > ?that pushes everything 1 column to the right, but also avoids the > ?problem. I don't know if it would interfere with some use cases (OTOH I don't know why would someone need tty in/out counts at all) but why not aggressively humanize the numbers instead? From keramida at freebsd.org Sat Aug 15 19:46:39 2009 From: keramida at freebsd.org (Giorgos Keramidas) Date: Sat Aug 15 19:46:51 2009 Subject: svn commit: r196254 - head/usr.sbin/iostat In-Reply-To: <9bbcef730908151137h3c752f91j3ec9d93a8f860d66@mail.gmail.com> (Ivan Voras's message of "Sat, 15 Aug 2009 20:37:28 +0200") References: <200908151757.n7FHvLCa080913@svn.freebsd.org> <9bbcef730908151137h3c752f91j3ec9d93a8f860d66@mail.gmail.com> Message-ID: <87r5vcc28z.fsf@kobe.laptop> On Sat, 15 Aug 2009 20:37:28 +0200, Ivan Voras wrote: >2009/8/15 Giorgos Keramidas : >> Author: keramida (doc committer) >> Date: Sat Aug 15 17:57:21 2009 >> New Revision: 196254 >> URL: http://svn.freebsd.org/changeset/base/196254 >> >> Log: >> ?iostat: add a bit of space between tty in/out columns >> >> ?The columns for tty input and output may bump against each other >> ?if the tty output needs more than 5 columns. ?Add a bit of space >> ?that pushes everything 1 column to the right, but also avoids the >> ?problem. > > I don't know if it would interfere with some use cases (OTOH I don't > know why would someone need tty in/out counts at all) but why not > aggressively humanize the numbers instead? It would probably interfere with scripts that people are using to parse iostat output. Even *this* change that slides everything to the right by one column may cause a bit of surprise, but I see that -H is not taken as an option. I'll try to grab it and add support for human readable numbers, but keep it non-default. Thanks! :) From tuexen at FreeBSD.org Sat Aug 15 21:10:53 2009 From: tuexen at FreeBSD.org (Michael Tuexen) Date: Sat Aug 15 21:11:05 2009 Subject: svn commit: r196260 - head/sys/netinet Message-ID: <200908152110.n7FLArWj088332@svn.freebsd.org> Author: tuexen Date: Sat Aug 15 21:10:52 2009 New Revision: 196260 URL: http://svn.freebsd.org/changeset/base/196260 Log: * Fix a bug where PR-SCTP settings are ignore when using implicit association setup. * Fix a bug where message with illegal stream ids are not deleted. * Fix a crash when reporting back unsent messages from the send_queue. * Fix a bug related to INIT retransmission when the socket is already closed. * Fix a bug where associations were stalled when partial delivery API was enabled. * Fix a bug where the receive buffer size was smaller than the partial_delivery_point. Approved by: re, rrs (mentor) MFC after: One day. Modified: head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_timer.c head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Sat Aug 15 19:48:14 2009 (r196259) +++ head/sys/netinet/sctp_indata.c Sat Aug 15 21:10:52 2009 (r196260) @@ -900,7 +900,7 @@ sctp_deliver_reasm_check(struct sctp_tcb { struct sctp_tmit_chunk *chk; uint16_t nxt_todel; - uint32_t tsize; + uint32_t tsize, pd_point; doit_again: chk = TAILQ_FIRST(&asoc->reasmqueue); @@ -920,8 +920,13 @@ doit_again: * Yep the first one is here and its ok to deliver * but should we? */ - if ((sctp_is_all_msg_on_reasm(asoc, &tsize) || - (tsize >= stcb->sctp_ep->partial_delivery_point))) { + if (stcb->sctp_socket) { + pd_point = min(SCTP_SB_LIMIT_RCV(stcb->sctp_socket) >> SCTP_PARTIAL_DELIVERY_SHIFT, + stcb->sctp_ep->partial_delivery_point); + } else { + pd_point = stcb->sctp_ep->partial_delivery_point; + } + if (sctp_is_all_msg_on_reasm(asoc, &tsize) || (tsize >= pd_point)) { /* * Yes, we setup to start reception, by @@ -2824,7 +2829,7 @@ void sctp_service_queues(struct sctp_tcb *stcb, struct sctp_association *asoc) { struct sctp_tmit_chunk *chk; - uint32_t tsize; + uint32_t tsize, pd_point; uint16_t nxt_todel; if (asoc->fragmented_delivery_inprogress) { @@ -2860,8 +2865,13 @@ doit_again: * be here or 1/4 the socket buffer max or nothing on the * delivery queue and something can be delivered. */ - if ((sctp_is_all_msg_on_reasm(asoc, &tsize) || - (tsize >= stcb->sctp_ep->partial_delivery_point))) { + if (stcb->sctp_socket) { + pd_point = min(SCTP_SB_LIMIT_RCV(stcb->sctp_socket) >> SCTP_PARTIAL_DELIVERY_SHIFT, + stcb->sctp_ep->partial_delivery_point); + } else { + pd_point = stcb->sctp_ep->partial_delivery_point; + } + if (sctp_is_all_msg_on_reasm(asoc, &tsize) || (tsize >= pd_point)) { asoc->fragmented_delivery_inprogress = 1; asoc->tsn_last_delivered = chk->rec.data.TSN_seq - 1; asoc->str_of_pdapi = chk->rec.data.stream_number; @@ -5192,7 +5202,7 @@ skip_segments: /* sa_ignore NO_NULL_CHK */ sctp_free_bufspace(stcb, asoc, tp1, 1); sctp_m_freem(tp1->data); - if (PR_SCTP_BUF_ENABLED(tp1->flags)) { + if (asoc->peer_supports_prsctp && PR_SCTP_BUF_ENABLED(tp1->flags)) { asoc->sent_queue_cnt_removeable--; } } @@ -6289,10 +6299,11 @@ sctp_handle_forward_tsn(struct sctp_tcb ctl->pdapi_aborted = 1; sv = stcb->asoc.control_pdapi; stcb->asoc.control_pdapi = ctl; - sctp_notify_partial_delivery_indication(stcb, + sctp_ulp_notify(SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION, + stcb, SCTP_PARTIAL_DELIVERY_ABORTED, - SCTP_HOLDS_LOCK, - str_seq); + (void *)&str_seq, + SCTP_SO_NOT_LOCKED); stcb->asoc.control_pdapi = sv; break; } else if ((ctl->sinfo_stream == stseq->stream) && @@ -7786,7 +7797,7 @@ skip_segments: /* sa_ignore NO_NULL_CHK */ sctp_free_bufspace(stcb, asoc, tp1, 1); sctp_m_freem(tp1->data); - if (PR_SCTP_BUF_ENABLED(tp1->flags)) { + if (asoc->peer_supports_prsctp && PR_SCTP_BUF_ENABLED(tp1->flags)) { asoc->sent_queue_cnt_removeable--; } } Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sat Aug 15 19:48:14 2009 (r196259) +++ head/sys/netinet/sctp_input.c Sat Aug 15 21:10:52 2009 (r196260) @@ -278,18 +278,38 @@ sctp_process_init(struct sctp_init_chunk unsigned int newcnt; struct sctp_stream_out *outs; struct sctp_stream_queue_pending *sp; + struct sctp_tmit_chunk *chk, *chk_next; - /* cut back on number of streams */ + /* abandon the upper streams */ newcnt = ntohs(init->num_inbound_streams); - /* This if is probably not needed but I am cautious */ + if (!TAILQ_EMPTY(&asoc->send_queue)) { + chk = TAILQ_FIRST(&asoc->send_queue); + while (chk) { + chk_next = TAILQ_NEXT(chk, sctp_next); + if (chk->rec.data.stream_number >= newcnt) { + TAILQ_REMOVE(&asoc->send_queue, chk, sctp_next); + asoc->send_queue_cnt--; + if (chk->data != NULL) { + sctp_free_bufspace(stcb, asoc, chk, 1); + sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, + SCTP_NOTIFY_DATAGRAM_UNSENT, chk, SCTP_SO_NOT_LOCKED); + if (chk->data) { + sctp_m_freem(chk->data); + chk->data = NULL; + } + } + sctp_free_a_chunk(stcb, chk); + /* sa_ignore FREED_MEMORY */ + } + chk = chk_next; + } + } if (asoc->strmout) { - /* First make sure no data chunks are trapped */ for (i = newcnt; i < asoc->pre_open_streams; i++) { outs = &asoc->strmout[i]; sp = TAILQ_FIRST(&outs->outqueue); while (sp) { - TAILQ_REMOVE(&outs->outqueue, sp, - next); + TAILQ_REMOVE(&outs->outqueue, sp, next); asoc->stream_queue_cnt--; sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, stcb, SCTP_NOTIFY_DATAGRAM_UNSENT, @@ -301,16 +321,13 @@ sctp_process_init(struct sctp_init_chunk sctp_free_remote_addr(sp->net); sp->net = NULL; /* Free the chunk */ - SCTP_PRINTF("sp:%p tcb:%p weird free case\n", - sp, stcb); - sctp_free_a_strmoq(stcb, sp); /* sa_ignore FREED_MEMORY */ sp = TAILQ_FIRST(&outs->outqueue); } } } - /* cut back the count and abandon the upper streams */ + /* cut back the count */ asoc->pre_open_streams = newcnt; } SCTP_TCB_SEND_UNLOCK(stcb); Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sat Aug 15 19:48:14 2009 (r196259) +++ head/sys/netinet/sctp_output.c Sat Aug 15 21:10:52 2009 (r196260) @@ -4200,7 +4200,7 @@ sctp_send_initiate(struct sctp_inpcb *in /* place in my tag */ init->init.initiate_tag = htonl(stcb->asoc.my_vtag); /* set up some of the credits. */ - init->init.a_rwnd = htonl(max(SCTP_SB_LIMIT_RCV(inp->sctp_socket), + init->init.a_rwnd = htonl(max(inp->sctp_socket ? SCTP_SB_LIMIT_RCV(inp->sctp_socket) : 0, SCTP_MINIMAL_RWND)); init->init.num_outbound_streams = htons(stcb->asoc.pre_open_streams); @@ -4411,7 +4411,6 @@ sctp_send_initiate(struct sctp_inpcb *in net->port, so_locked, NULL); SCTPDBG(SCTP_DEBUG_OUTPUT4, "lowlevel_output - %d\n", ret); SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); - sctp_timer_start(SCTP_TIMER_TYPE_INIT, inp, stcb, net); (void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time); } @@ -5786,61 +5785,58 @@ sctp_get_frag_point(struct sctp_tcb *stc } static void -sctp_set_prsctp_policy(struct sctp_tcb *stcb, - struct sctp_stream_queue_pending *sp) +sctp_set_prsctp_policy(struct sctp_stream_queue_pending *sp) { sp->pr_sctp_on = 0; - if (stcb->asoc.peer_supports_prsctp) { + /* + * We assume that the user wants PR_SCTP_TTL if the user provides a + * positive lifetime but does not specify any PR_SCTP policy. This + * is a BAD assumption and causes problems at least with the + * U-Vancovers MPI folks. I will change this to be no policy means + * NO PR-SCTP. + */ + if (PR_SCTP_ENABLED(sp->sinfo_flags)) { + sp->act_flags |= PR_SCTP_POLICY(sp->sinfo_flags); + sp->pr_sctp_on = 1; + } else { + return; + } + switch (PR_SCTP_POLICY(sp->sinfo_flags)) { + case CHUNK_FLAGS_PR_SCTP_BUF: /* - * We assume that the user wants PR_SCTP_TTL if the user - * provides a positive lifetime but does not specify any - * PR_SCTP policy. This is a BAD assumption and causes - * problems at least with the U-Vancovers MPI folks. I will - * change this to be no policy means NO PR-SCTP. - */ - if (PR_SCTP_ENABLED(sp->sinfo_flags)) { - sp->act_flags |= PR_SCTP_POLICY(sp->sinfo_flags); - sp->pr_sctp_on = 1; - } else { - return; - } - switch (PR_SCTP_POLICY(sp->sinfo_flags)) { - case CHUNK_FLAGS_PR_SCTP_BUF: - /* - * Time to live is a priority stored in tv_sec when - * doing the buffer drop thing. - */ - sp->ts.tv_sec = sp->timetolive; - sp->ts.tv_usec = 0; - break; - case CHUNK_FLAGS_PR_SCTP_TTL: - { - struct timeval tv; - - (void)SCTP_GETTIME_TIMEVAL(&sp->ts); - tv.tv_sec = sp->timetolive / 1000; - tv.tv_usec = (sp->timetolive * 1000) % 1000000; - /* - * TODO sctp_constants.h needs alternative - * time macros when _KERNEL is undefined. - */ - timevaladd(&sp->ts, &tv); - } - break; - case CHUNK_FLAGS_PR_SCTP_RTX: + * Time to live is a priority stored in tv_sec when doing + * the buffer drop thing. + */ + sp->ts.tv_sec = sp->timetolive; + sp->ts.tv_usec = 0; + break; + case CHUNK_FLAGS_PR_SCTP_TTL: + { + struct timeval tv; + + (void)SCTP_GETTIME_TIMEVAL(&sp->ts); + tv.tv_sec = sp->timetolive / 1000; + tv.tv_usec = (sp->timetolive * 1000) % 1000000; /* - * Time to live is a the number or retransmissions - * stored in tv_sec. + * TODO sctp_constants.h needs alternative time + * macros when _KERNEL is undefined. */ - sp->ts.tv_sec = sp->timetolive; - sp->ts.tv_usec = 0; - break; - default: - SCTPDBG(SCTP_DEBUG_USRREQ1, - "Unknown PR_SCTP policy %u.\n", - PR_SCTP_POLICY(sp->sinfo_flags)); - break; + timevaladd(&sp->ts, &tv); } + break; + case CHUNK_FLAGS_PR_SCTP_RTX: + /* + * Time to live is a the number or retransmissions stored in + * tv_sec. + */ + sp->ts.tv_sec = sp->timetolive; + sp->ts.tv_usec = 0; + break; + default: + SCTPDBG(SCTP_DEBUG_USRREQ1, + "Unknown PR_SCTP policy %u.\n", + PR_SCTP_POLICY(sp->sinfo_flags)); + break; } } @@ -5911,7 +5907,7 @@ sctp_msg_append(struct sctp_tcb *stcb, sp->tail_mbuf = NULL; sp->length = 0; at = m; - sctp_set_prsctp_policy(stcb, sp); + sctp_set_prsctp_policy(sp); /* * We could in theory (for sendall) sifa the length in, but we would * still have to hunt through the chain since we need to setup the @@ -7138,7 +7134,7 @@ dont_do_it: } /* We only re-set the policy if it is on */ if (sp->pr_sctp_on) { - sctp_set_prsctp_policy(stcb, sp); + sctp_set_prsctp_policy(sp); asoc->pr_sctp_cnt++; chk->pr_sctp_on = 1; } else { @@ -12285,7 +12281,7 @@ skip_copy: sp->addr_over = 0; } atomic_add_int(&sp->net->ref_count, 1); - sctp_set_prsctp_policy(stcb, sp); + sctp_set_prsctp_policy(sp); } out_now: return (sp); Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sat Aug 15 19:48:14 2009 (r196259) +++ head/sys/netinet/sctp_pcb.c Sat Aug 15 21:10:52 2009 (r196260) @@ -4547,8 +4547,11 @@ sctp_free_assoc(struct sctp_inpcb *inp, stcb->asoc.control_pdapi = sq; strseq = (sq->sinfo_stream << 16) | sq->sinfo_ssn; - sctp_notify_partial_delivery_indication(stcb, - SCTP_PARTIAL_DELIVERY_ABORTED, 1, strseq); + sctp_ulp_notify(SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION, + stcb, + SCTP_PARTIAL_DELIVERY_ABORTED, + (void *)&strseq, + SCTP_SO_LOCKED); stcb->asoc.control_pdapi = NULL; } } Modified: head/sys/netinet/sctp_timer.c ============================================================================== --- head/sys/netinet/sctp_timer.c Sat Aug 15 19:48:14 2009 (r196259) +++ head/sys/netinet/sctp_timer.c Sat Aug 15 21:10:52 2009 (r196260) @@ -588,7 +588,7 @@ sctp_recover_sent_list(struct sctp_tcb * /* sa_ignore NO_NULL_CHK */ sctp_free_bufspace(stcb, asoc, chk, 1); sctp_m_freem(chk->data); - if (PR_SCTP_BUF_ENABLED(chk->flags)) { + if (asoc->peer_supports_prsctp && PR_SCTP_BUF_ENABLED(chk->flags)) { asoc->sent_queue_cnt_removeable--; } } @@ -757,7 +757,7 @@ start_again: continue; } } - if (PR_SCTP_TTL_ENABLED(chk->flags)) { + if (stcb->asoc.peer_supports_prsctp && PR_SCTP_TTL_ENABLED(chk->flags)) { /* Is it expired? */ if ((now.tv_sec > chk->rec.data.timetodrop.tv_sec) || ((chk->rec.data.timetodrop.tv_sec == now.tv_sec) && @@ -772,7 +772,7 @@ start_again: continue; } } - if (PR_SCTP_RTX_ENABLED(chk->flags)) { + if (stcb->asoc.peer_supports_prsctp && PR_SCTP_RTX_ENABLED(chk->flags)) { /* Has it been retransmitted tv_sec times? */ if (chk->snd_count > chk->rec.data.timetodrop.tv_sec) { if (chk->data) { Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Sat Aug 15 19:48:14 2009 (r196259) +++ head/sys/netinet/sctputil.c Sat Aug 15 21:10:52 2009 (r196260) @@ -1484,6 +1484,7 @@ sctp_timeout_handler(void *t) SCTP_INP_INCR_REF(inp); if ((inp->sctp_socket == 0) && ((tmr->type != SCTP_TIMER_TYPE_INPKILL) && + (tmr->type != SCTP_TIMER_TYPE_INIT) && (tmr->type != SCTP_TIMER_TYPE_SEND) && (tmr->type != SCTP_TIMER_TYPE_RECV) && (tmr->type != SCTP_TIMER_TYPE_HEARTBEAT) && @@ -2984,8 +2985,6 @@ sctp_notify_send_failed(struct sctp_tcb ssf->ssf_info.sinfo_assoc_id = sctp_get_associd(stcb); ssf->ssf_assoc_id = sctp_get_associd(stcb); - SCTP_BUF_NEXT(m_notify) = chk->data; - SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed); if (chk->data) { /* * trim off the sctp chunk header(it should be there) @@ -2996,6 +2995,8 @@ sctp_notify_send_failed(struct sctp_tcb chk->send_size -= sizeof(struct sctp_data_chunk); } } + SCTP_BUF_NEXT(m_notify) = chk->data; + SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed); /* Steal off the mbuf */ chk->data = NULL; /* @@ -3146,9 +3147,13 @@ sctp_notify_adaptation_layer(struct sctp } /* This always must be called with the read-queue LOCKED in the INP */ -void +static void sctp_notify_partial_delivery_indication(struct sctp_tcb *stcb, uint32_t error, - int nolock, uint32_t val) + uint32_t val, int so_locked +#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) + SCTP_UNUSED +#endif +) { struct mbuf *m_notify; struct sctp_pdapi_event *pdapi; @@ -3189,9 +3194,6 @@ sctp_notify_partial_delivery_indication( control->tail_mbuf = m_notify; control->held_length = 0; control->length = 0; - if (nolock == 0) { - SCTP_INP_READ_LOCK(stcb->sctp_ep); - } sb = &stcb->sctp_socket->so_rcv; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SB_LOGGING_ENABLE) { sctp_sblog(sb, control->do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBALLOC, SCTP_BUF_LEN(m_notify)); @@ -3208,12 +3210,30 @@ sctp_notify_partial_delivery_indication( /* we really should not see this case */ TAILQ_INSERT_TAIL(&stcb->sctp_ep->read_queue, control, next); } - if (nolock == 0) { - SCTP_INP_READ_UNLOCK(stcb->sctp_ep); - } if (stcb->sctp_ep && stcb->sctp_socket) { /* This should always be the case */ +#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) + struct socket *so; + + so = SCTP_INP_SO(stcb->sctp_ep); + if (!so_locked) { + atomic_add_int(&stcb->asoc.refcnt, 1); + SCTP_TCB_UNLOCK(stcb); + SCTP_SOCKET_LOCK(so, 1); + SCTP_TCB_LOCK(stcb); + atomic_subtract_int(&stcb->asoc.refcnt, 1); + if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { + SCTP_SOCKET_UNLOCK(so, 1); + return; + } + } +#endif sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket); +#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) + if (!so_locked) { + SCTP_SOCKET_UNLOCK(so, 1); + } +#endif } } @@ -3540,9 +3560,9 @@ sctp_ulp_notify(uint32_t notification, s val = *((uint32_t *) data); - sctp_notify_partial_delivery_indication(stcb, error, 0, val); + sctp_notify_partial_delivery_indication(stcb, error, val, so_locked); + break; } - break; case SCTP_NOTIFY_STRDATA_ERR: break; case SCTP_NOTIFY_ASSOC_ABORTED: @@ -3585,11 +3605,9 @@ sctp_ulp_notify(uint32_t notification, s case SCTP_NOTIFY_STR_RESET_FAILED_OUT: sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), (SCTP_STRRESET_OUTBOUND_STR | SCTP_STRRESET_FAILED)); break; - case SCTP_NOTIFY_STR_RESET_FAILED_IN: sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), (SCTP_STRRESET_INBOUND_STR | SCTP_STRRESET_FAILED)); break; - case SCTP_NOTIFY_ASCONF_ADD_IP: sctp_notify_peer_addr_change(stcb, SCTP_ADDR_ADDED, data, error); @@ -3671,8 +3689,10 @@ sctp_report_all_outbound(struct sctp_tcb sctp_free_bufspace(stcb, asoc, chk, 1); sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, SCTP_NOTIFY_DATAGRAM_SENT, chk, so_locked); - sctp_m_freem(chk->data); - chk->data = NULL; + if (chk->data) { + sctp_m_freem(chk->data); + chk->data = NULL; + } } sctp_free_a_chunk(stcb, chk); /* sa_ignore FREED_MEMORY */ @@ -3689,8 +3709,10 @@ sctp_report_all_outbound(struct sctp_tcb sctp_free_bufspace(stcb, asoc, chk, 1); sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, SCTP_NOTIFY_DATAGRAM_UNSENT, chk, so_locked); - sctp_m_freem(chk->data); - chk->data = NULL; + if (chk->data) { + sctp_m_freem(chk->data); + chk->data = NULL; + } } sctp_free_a_chunk(stcb, chk); /* sa_ignore FREED_MEMORY */ @@ -5346,6 +5368,38 @@ restart_nosblocks: } goto restart; } + if ((control->length == 0) && + (control->end_added == 1)) { + /* + * Do we also need to check for (control->pdapi_aborted == + * 1)? + */ + if (hold_rlock == 0) { + hold_rlock = 1; + SCTP_INP_READ_LOCK(inp); + } + TAILQ_REMOVE(&inp->read_queue, control, next); + if (control->data) { +#ifdef INVARIANTS + panic("control->data not null but control->length == 0"); +#else + SCTP_PRINTF("Strange, data left in the control buffer. Cleaning up.\n"); + sctp_m_freem(control->data); + control->data = NULL; +#endif + } + if (control->aux_data) { + sctp_m_free(control->aux_data); + control->aux_data = NULL; + } + sctp_free_remote_addr(control->whoFrom); + sctp_free_a_readq(stcb, control); + if (hold_rlock) { + hold_rlock = 0; + SCTP_INP_READ_UNLOCK(inp); + } + goto restart; + } if (control->length == 0) { if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE)) && (filling_sinfo)) { Modified: head/sys/netinet/sctputil.h ============================================================================== --- head/sys/netinet/sctputil.h Sat Aug 15 19:48:14 2009 (r196259) +++ head/sys/netinet/sctputil.h Sat Aug 15 21:10:52 2009 (r196260) @@ -234,10 +234,6 @@ int sctp_cmpaddr(struct sockaddr *, stru void sctp_print_address(struct sockaddr *); void sctp_print_address_pkt(struct ip *, struct sctphdr *); -void -sctp_notify_partial_delivery_indication(struct sctp_tcb *stcb, - uint32_t error, int no_lock, uint32_t strseq); - int sctp_release_pr_sctp_chunk(struct sctp_tcb *, struct sctp_tmit_chunk *, int, int From rwatson at FreeBSD.org Sat Aug 15 22:26:27 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sat Aug 15 22:26:38 2009 Subject: svn commit: r196263 - head/sys/net Message-ID: <200908152226.n7FMQRvQ091853@svn.freebsd.org> Author: rwatson Date: Sat Aug 15 22:26:26 2009 New Revision: 196263 URL: http://svn.freebsd.org/changeset/base/196263 Log: Remove unused if_rawoutput() macro; it has been unused since at least FreeBSD 2. Approved by: re (kib) Modified: head/sys/net/if_var.h Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Sat Aug 15 21:42:04 2009 (r196262) +++ head/sys/net/if_var.h Sat Aug 15 22:26:26 2009 (r196263) @@ -235,7 +235,6 @@ typedef void if_init_f_t(void *); #define if_iqdrops if_data.ifi_iqdrops #define if_noproto if_data.ifi_noproto #define if_lastchange if_data.ifi_lastchange -#define if_rawoutput(if, m, sa) if_output(if, m, sa, (struct rtentry *)NULL) /* for compatibility with other BSDs */ #define if_addrlist if_addrhead From rwatson at FreeBSD.org Sat Aug 15 23:07:44 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sat Aug 15 23:07:55 2009 Subject: svn commit: r196267 - in head: share/man/man4 sys/kern Message-ID: <200908152307.n7FN7ihE092912@svn.freebsd.org> Author: rwatson Date: Sat Aug 15 23:07:43 2009 New Revision: 196267 URL: http://svn.freebsd.org/changeset/base/196267 Log: Rather than fix questionable ifnet list locking in the implementation of the kern.polling.enable sysctl, remove the sysctl. It has been deprecated since FreeBSD 6 in favour of per-ifnet polling flags. Reviewed by: luigi Approved by: re (kib) Modified: head/share/man/man4/polling.4 head/sys/kern/kern_poll.c Modified: head/share/man/man4/polling.4 ============================================================================== --- head/share/man/man4/polling.4 Sat Aug 15 22:51:11 2009 (r196266) +++ head/share/man/man4/polling.4 Sat Aug 15 23:07:43 2009 (r196267) @@ -87,6 +87,16 @@ feature. It is turned on and off with help of .Xr ifconfig 8 command. +.Pp +The historic +.Va kern.polling.enable , +which enabled polling for all interfaces, can be replaced with the following +code: +.Bd -literal +for i in `ifconfig -l` ; + do ifconfig $i polling; # use -polling to disable +done +.Ed .Ss MIB Variables The operation of .Nm @@ -156,15 +166,6 @@ Default is 20. How many active devices have registered for .Nm . .Pp -.It Va kern.polling.enable -Legacy MIB, that was used to enable or disable polling globally. -Currently if set to 1, -.Nm -is enabled on all capable interfaces. -If set to 0, -.Nm -is disabled on all interfaces. -.Pp .It Va kern.polling.short_ticks .It Va kern.polling.lost_polls .It Va kern.polling.pending_polls Modified: head/sys/kern/kern_poll.c ============================================================================== --- head/sys/kern/kern_poll.c Sat Aug 15 22:51:11 2009 (r196266) +++ head/sys/kern/kern_poll.c Sat Aug 15 23:07:43 2009 (r196267) @@ -46,8 +46,6 @@ __FBSDID("$FreeBSD$"); #include /* for NETISR_POLL */ #include -static int poll_switch(SYSCTL_HANDLER_ARGS); - void hardclock_device_poll(void); /* hook from hardclock */ static struct mtx poll_mtx; @@ -230,10 +228,6 @@ static uint32_t poll_handlers; /* next f SYSCTL_UINT(_kern_polling, OID_AUTO, handlers, CTLFLAG_RD, &poll_handlers, 0, "Number of registered poll handlers"); -static int polling = 0; -SYSCTL_PROC(_kern_polling, OID_AUTO, enable, CTLTYPE_UINT | CTLFLAG_RW, - 0, sizeof(int), poll_switch, "I", "Switch polling for all interfaces"); - static uint32_t phase; SYSCTL_UINT(_kern_polling, OID_AUTO, phase, CTLFLAG_RD, &phase, 0, "Polling phase"); @@ -538,49 +532,6 @@ ether_poll_deregister(struct ifnet *ifp) return (0); } -/* - * Legacy interface for turning polling on all interfaces at one time. - */ -static int -poll_switch(SYSCTL_HANDLER_ARGS) -{ - struct ifnet *ifp; - int error; - int val = polling; - - error = sysctl_handle_int(oidp, &val, 0, req); - if (error || !req->newptr ) - return (error); - - if (val == polling) - return (0); - - if (val < 0 || val > 1) - return (EINVAL); - - polling = val; - - IFNET_RLOCK(); - TAILQ_FOREACH(ifp, &V_ifnet, if_link) { - if (ifp->if_capabilities & IFCAP_POLLING) { - struct ifreq ifr; - - if (val == 1) - ifr.ifr_reqcap = - ifp->if_capenable | IFCAP_POLLING; - else - ifr.ifr_reqcap = - ifp->if_capenable & ~IFCAP_POLLING; - (void) (*ifp->if_ioctl)(ifp, SIOCSIFCAP, (caddr_t)&ifr); - } - } - IFNET_RUNLOCK(); - - log(LOG_ERR, "kern.polling.enable is deprecated. Use ifconfig(8)"); - - return (0); -} - static void poll_idle(void) { From marcel at FreeBSD.org Sun Aug 16 01:43:08 2009 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Sun Aug 16 01:43:15 2009 Subject: svn commit: r196268 - head/sys/ia64/ia64 Message-ID: <200908160143.n7G1h8JK096540@svn.freebsd.org> Author: marcel Date: Sun Aug 16 01:43:08 2009 New Revision: 196268 URL: http://svn.freebsd.org/changeset/base/196268 Log: Decouple ACPI CPU Ids from FreeBSD's cpuid. The ACPI Ids can be sparse, which causes a kernel assert. Approved by: re (kensmith) Modified: head/sys/ia64/ia64/genassym.c head/sys/ia64/ia64/machdep.c head/sys/ia64/ia64/mp_machdep.c Modified: head/sys/ia64/ia64/genassym.c ============================================================================== --- head/sys/ia64/ia64/genassym.c Sat Aug 15 23:07:43 2009 (r196267) +++ head/sys/ia64/ia64/genassym.c Sun Aug 16 01:43:08 2009 (r196268) @@ -91,7 +91,6 @@ ASSYM(MC_SPECIAL_RNAT, offsetof(mcontext ASSYM(PAGE_SHIFT, PAGE_SHIFT); ASSYM(PAGE_SIZE, PAGE_SIZE); -ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid)); ASSYM(PC_CURRENT_PMAP, offsetof(struct pcpu, pc_current_pmap)); ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); ASSYM(PC_IDLETHREAD, offsetof(struct pcpu, pc_idlethread)); Modified: head/sys/ia64/ia64/machdep.c ============================================================================== --- head/sys/ia64/ia64/machdep.c Sat Aug 15 23:07:43 2009 (r196267) +++ head/sys/ia64/ia64/machdep.c Sun Aug 16 01:43:08 2009 (r196268) @@ -424,7 +424,11 @@ void cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size) { - pcpu->pc_acpi_id = cpuid; + /* + * Set pc_acpi_id to "uninitialized". + * See sys/dev/acpica/acpi_cpu.c + */ + pcpu->pc_acpi_id = 0xffffffff; } void Modified: head/sys/ia64/ia64/mp_machdep.c ============================================================================== --- head/sys/ia64/ia64/mp_machdep.c Sat Aug 15 23:07:43 2009 (r196267) +++ head/sys/ia64/ia64/mp_machdep.c Sun Aug 16 01:43:08 2009 (r196268) @@ -208,31 +208,25 @@ cpu_mp_add(u_int acpiid, u_int apicid, u struct pcpu *pc; u_int64_t lid; void *dpcpu; - - /* Ignore any processor numbers outside our range */ - if (acpiid > mp_maxid) - return; - - KASSERT((all_cpus & (1UL << acpiid)) == 0, - ("%s: cpu%d already in CPU map", __func__, acpiid)); + u_int cpuid; lid = LID_SAPIC_SET(apicid, apiceid); + cpuid = ((ia64_get_lid() & LID_SAPIC_MASK) == lid) ? 0 : smp_cpus++; - if ((ia64_get_lid() & LID_SAPIC_MASK) == lid) { - KASSERT(acpiid == 0, - ("%s: the BSP must be cpu0", __func__)); - } + KASSERT((all_cpus & (1UL << cpuid)) == 0, + ("%s: cpu%d already in CPU map", __func__, acpiid)); - if (acpiid != 0) { + if (cpuid != 0) { pc = (struct pcpu *)malloc(sizeof(*pc), M_SMP, M_WAITOK); + pcpu_init(pc, cpuid, sizeof(*pc)); dpcpu = (void *)kmem_alloc(kernel_map, DPCPU_SIZE); - pcpu_init(pc, acpiid, sizeof(*pc)); - dpcpu_init(dpcpu, acpiid); + dpcpu_init(dpcpu, cpuid); } else pc = pcpup; + pc->pc_acpi_id = acpiid; pc->pc_lid = lid; - all_cpus |= (1UL << acpiid); + all_cpus |= (1UL << cpuid); } void @@ -244,8 +238,8 @@ cpu_mp_announce() for (i = 0; i <= mp_maxid; i++) { pc = pcpu_find(i); if (pc != NULL) { - printf("cpu%d: SAPIC Id=%x, SAPIC Eid=%x", i, - LID_SAPIC_ID(pc->pc_lid), + printf("cpu%d: ACPI Id=%x, SAPIC Id=%x, SAPIC Eid=%x", + i, pc->pc_acpi_id, LID_SAPIC_ID(pc->pc_lid), LID_SAPIC_EID(pc->pc_lid)); if (i == 0) printf(" (BSP)\n"); @@ -305,7 +299,9 @@ cpu_mp_unleash(void *dummy) SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { cpus++; if (pc->pc_awake) { - kproc_create(ia64_store_mca_state, (void*)((uintptr_t)pc->pc_cpuid), NULL, 0, 0, "mca %u", pc->pc_cpuid); + kproc_create(ia64_store_mca_state, + (void*)((uintptr_t)pc->pc_cpuid), NULL, 0, 0, + "mca %u", pc->pc_cpuid); smp_cpus++; } } From marcel at FreeBSD.org Sun Aug 16 01:48:46 2009 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Sun Aug 16 01:48:58 2009 Subject: svn commit: r196269 - head/sys/cddl/contrib/opensolaris/common/nvpair Message-ID: <200908160148.n7G1mkmE096710@svn.freebsd.org> Author: marcel Date: Sun Aug 16 01:48:46 2009 New Revision: 196269 URL: http://svn.freebsd.org/changeset/base/196269 Log: Fix misalignment in nvpair_native_embedded() caused by the compiler replacing the bzero(). See also revision 195627, which fixed the misalignment in nvpair_native_embedded_array(). Approved by: re (kensmith) Modified: head/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c Modified: head/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c Sun Aug 16 01:43:08 2009 (r196268) +++ head/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c Sun Aug 16 01:48:46 2009 (r196269) @@ -2523,14 +2523,15 @@ nvpair_native_embedded(nvstream_t *nvs, { if (nvs->nvs_op == NVS_OP_ENCODE) { nvs_native_t *native = (nvs_native_t *)nvs->nvs_private; - nvlist_t *packed = (void *) + char *packed = (void *) (native->n_curr - nvp->nvp_size + NVP_VALOFF(nvp)); /* * Null out the pointer that is meaningless in the packed * structure. The address may not be aligned, so we have * to use bzero. */ - bzero(&packed->nvl_priv, sizeof (packed->nvl_priv)); + bzero(packed + offsetof(nvlist_t, nvl_priv), + sizeof(((nvlist_t *)NULL)->nvl_priv)); } return (nvs_embedded(nvs, EMBEDDED_NVL(nvp))); From rink at FreeBSD.org Sun Aug 16 10:11:34 2009 From: rink at FreeBSD.org (Rink Springer) Date: Sun Aug 16 10:11:41 2009 Subject: svn commit: r196272 - head/usr.sbin/sysinstall Message-ID: <200908161011.n7GABY5F010920@svn.freebsd.org> Author: rink Date: Sun Aug 16 10:11:33 2009 New Revision: 196272 URL: http://svn.freebsd.org/changeset/base/196272 Log: Prevent sysinstall from needlessly waiting for confirmation when using an USB device in non-interactive mode. If there are no USB devices, sysinstall gives an error messages, and if there is >1, it'll ask which one is to be used. This change allows a non-interactive install from USB media to succeed without any user interaction if there is exactly one USB disk device in the system it can use. Submitted by: Daniel O'Connor < doconnorat gsoft dot com dot au > Reviewed by: randi Approved by: re (rwatson) Modified: head/usr.sbin/sysinstall/media.c Modified: head/usr.sbin/sysinstall/media.c ============================================================================== --- head/usr.sbin/sysinstall/media.c Sun Aug 16 02:21:24 2009 (r196271) +++ head/usr.sbin/sysinstall/media.c Sun Aug 16 10:11:33 2009 (r196272) @@ -262,7 +262,8 @@ mediaSetUSB(dialogMenuItem *self) mediaDevice = devs[0]; if (mediaDevice) mediaDevice->private = NULL; - msgConfirm("Using USB device: %s", mediaDevice->name); + if (!variable_get(VAR_NONINTERACTIVE)) + msgConfirm("Using USB device: %s", mediaDevice->name); return (mediaDevice ? DITEM_LEAVE_MENU : DITEM_FAILURE); } From thompsa at FreeBSD.org Sun Aug 16 14:13:56 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Aug 16 14:14:15 2009 Subject: svn commit: r196274 - head/sys/dev/usb Message-ID: <200908161413.n7GEDuYN018862@svn.freebsd.org> Author: thompsa Date: Sun Aug 16 14:13:55 2009 New Revision: 196274 URL: http://svn.freebsd.org/changeset/base/196274 Log: Change the usb workers from kernel processes to threads, this is mostly a cosmetic change to reduce cruft in the proc table. Also change the idle wait message to `-` like how taskqueues are. Reviewed by: julian Approved by: re (kib) Modified: head/sys/dev/usb/usb_process.c head/sys/dev/usb/usb_process.h Modified: head/sys/dev/usb/usb_process.c ============================================================================== --- head/sys/dev/usb/usb_process.c Sun Aug 16 10:25:58 2009 (r196273) +++ head/sys/dev/usb/usb_process.c Sun Aug 16 14:13:55 2009 (r196274) @@ -63,10 +63,12 @@ #endif #if (__FreeBSD_version >= 800000) +static struct proc *usbproc; #define USB_THREAD_CREATE(f, s, p, ...) \ - kproc_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__) -#define USB_THREAD_SUSPEND(p) kproc_suspend(p,0) -#define USB_THREAD_EXIT(err) kproc_exit(err) + kproc_kthread_add((f), (s), &usbproc, (p), RFHIGHPID, \ + 0, "usb", __VA_ARGS__) +#define USB_THREAD_SUSPEND(p) kthread_suspend(p,0) +#define USB_THREAD_EXIT(err) kthread_exit() #else #define USB_THREAD_CREATE(f, s, p, ...) \ kthread_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__) @@ -207,8 +209,8 @@ usb_proc_create(struct usb_process *up, TAILQ_INIT(&up->up_qhead); - cv_init(&up->up_cv, "wmsg"); - cv_init(&up->up_drain, "dmsg"); + cv_init(&up->up_cv, "-"); + cv_init(&up->up_drain, "usbdrain"); if (USB_THREAD_CREATE(&usb_process, up, &up->up_ptr, pmesg)) { Modified: head/sys/dev/usb/usb_process.h ============================================================================== --- head/sys/dev/usb/usb_process.h Sun Aug 16 10:25:58 2009 (r196273) +++ head/sys/dev/usb/usb_process.h Sun Aug 16 14:13:55 2009 (r196274) @@ -49,7 +49,11 @@ struct usb_process { struct cv up_cv; struct cv up_drain; +#if (__FreeBSD_version >= 800000) + struct thread *up_ptr; +#else struct proc *up_ptr; +#endif struct thread *up_curtd; struct mtx *up_mtx; From ed at FreeBSD.org Sun Aug 16 19:55:54 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Sun Aug 16 19:56:06 2009 Subject: svn commit: r196276 - head/sys/kern Message-ID: <200908161955.n7GJtrTR030129@svn.freebsd.org> Author: ed Date: Sun Aug 16 19:55:53 2009 New Revision: 196276 URL: http://svn.freebsd.org/changeset/base/196276 Log: Fix small style regression introduced by the MPSAFE newbus code. Approved by: re (rwatson) Modified: head/sys/kern/subr_bus.c Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Sun Aug 16 14:17:47 2009 (r196275) +++ head/sys/kern/subr_bus.c Sun Aug 16 19:55:53 2009 (r196276) @@ -4131,7 +4131,7 @@ driver_module_handler(module_t mod, int return (ENOMEM); } - switch (what) { + switch (what) { case MOD_LOAD: if (dmd->dmd_chainevh) error = dmd->dmd_chainevh(mod,what,dmd->dmd_chainarg); From marcel at FreeBSD.org Sun Aug 16 21:27:35 2009 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Sun Aug 16 21:27:46 2009 Subject: svn commit: r196278 - head/sbin/geom/class/part Message-ID: <200908162127.n7GLRZl5032522@svn.freebsd.org> Author: marcel Date: Sun Aug 16 21:27:35 2009 New Revision: 196278 URL: http://svn.freebsd.org/changeset/base/196278 Log: Emit a proper error message instead of dumping core when 1) GEOM_PART does not exist in the kernel, and 2) the GEOM in question does not exist. Additionally abort in case of programming errors that result in neither the class nor geom not being present in the gctl request. Submitted by: "Andrey V. Elsukov" Approved by: re (kib) Modified: head/sbin/geom/class/part/geom_part.c Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Sun Aug 16 20:33:16 2009 (r196277) +++ head/sbin/geom/class/part/geom_part.c Sun Aug 16 21:27:35 2009 (r196278) @@ -274,8 +274,18 @@ gpart_autofill(struct gctl_req *req) error = geom_gettree(&mesh); if (error) return (error); - cp = find_class(&mesh, gctl_get_ascii(req, "class")); - gp = find_geom(cp, gctl_get_ascii(req, "geom")); + s = gctl_get_ascii(req, "class"); + if (s == NULL) + abort(); + cp = find_class(&mesh, s); + if (cp == NULL) + errx(EXIT_FAILURE, "Class %s not found.", s); + s = gctl_get_ascii(req, "geom"); + if (s == NULL) + abort(); + gp = find_geom(cp, s); + if (gp == NULL) + errx(EXIT_FAILURE, "No such geom: %s.", s); first = atoll(find_geomcfg(gp, "first")); last = atoll(find_geomcfg(gp, "last")); grade = ~0ULL; @@ -536,6 +546,8 @@ gpart_write_partcode(struct gctl_req *re errx(EXIT_FAILURE, "Class %s not found.", s); } s = gctl_get_ascii(req, "geom"); + if (s == NULL) + abort(); gp = find_geom(classp, s); if (gp == NULL) errx(EXIT_FAILURE, "No such geom: %s.", s); From scottl at FreeBSD.org Mon Aug 17 06:05:56 2009 From: scottl at FreeBSD.org (Scott Long) Date: Mon Aug 17 06:06:12 2009 Subject: svn commit: r196280 - head/usr.sbin/mfiutil Message-ID: <200908170605.n7H65thw049134@svn.freebsd.org> Author: scottl Date: Mon Aug 17 06:05:55 2009 New Revision: 196280 URL: http://svn.freebsd.org/changeset/base/196280 Log: Move mfiutil.1 to mfiutil.8 for consistency. Remove superfulous README. Approved by: re Added: head/usr.sbin/mfiutil/mfiutil.8 (props changed) - copied unchanged from r196279, head/usr.sbin/mfiutil/mfiutil.1 Deleted: head/usr.sbin/mfiutil/README head/usr.sbin/mfiutil/mfiutil.1 Modified: head/usr.sbin/mfiutil/Makefile Modified: head/usr.sbin/mfiutil/Makefile ============================================================================== --- head/usr.sbin/mfiutil/Makefile Sun Aug 16 21:32:12 2009 (r196279) +++ head/usr.sbin/mfiutil/Makefile Mon Aug 17 06:05:55 2009 (r196280) @@ -3,6 +3,7 @@ PROG= mfiutil SRCS= mfiutil.c mfi_cmd.c mfi_config.c mfi_drive.c mfi_evt.c mfi_flash.c \ mfi_patrol.c mfi_show.c mfi_volume.c +MAN8= mfiutil.8 CFLAGS+= -fno-builtin-strftime WARNS?=3 Copied: head/usr.sbin/mfiutil/mfiutil.8 (from r196279, head/usr.sbin/mfiutil/mfiutil.1) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/mfiutil/mfiutil.8 Mon Aug 17 06:05:55 2009 (r196280, copy of r196279, head/usr.sbin/mfiutil/mfiutil.1) @@ -0,0 +1,574 @@ +.\" Copyright (c) 2008, 2009 Yahoo!, Inc. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd June 17, 2008 +.Dt MFIUTIL 1 +.Os +.Sh NAME +.Nm mfiutil +.Nd Utility for managing LSI MegaRAID SAS controllers +.Sh SYNOPSIS +.Nm +.Cm version +.Nm +.Op Fl u Ar unit +.Cm show adapter +.Nm +.Op Fl u Ar unit +.Cm show battery +.Nm +.Op Fl u Ar unit +.Cm show config +.Nm +.Op Fl u Ar unit +.Cm show drives +.Nm +.Op Fl u Ar unit +.Cm show events +.Op Fl c Ar class +.Op Fl l Ar locale +.Op Fl n Ar count +.Op Fl v +.Op Ar start Op Ar stop +.Nm +.Op Fl u Ar unit +.Cm show firmware +.Nm +.Op Fl u Ar unit +.Cm show logstate +.Nm +.Op Fl u Ar unit +.Cm show patrol +.Nm +.Op Fl u Ar unit +.Cm show volumes +.Nm +.Op Fl u Ar unit +.Cm fail Ar drive +.Nm +.Op Fl u Ar unit +.Cm good Ar drive +.Nm +.Op Fl u Ar unit +.Cm rebuild Ar drive +.Nm +.Op Fl u Ar unit +.Cm drive progress Ar drive +.Nm +.Op Fl u Ar unit +.Cm drive clear Ar drive Brq "start | stop" +.Nm +.Op Fl u Ar unit +.Cm start rebuild Ar drive +.Nm +.Op Fl u Ar unit +.Cm abort rebuild Ar drive +.Nm +.Op Fl u Ar unit +.Cm locate Ar drive Brq "on | off" +.Nm +.Op Fl u Ar unit +.Cm cache Ar volume Op Ar setting Op Ar value +.Nm +.Op Fl u Ar unit +.Cm name Ar volume Ar name +.Nm +.Op Fl u Ar unit +.Cm volume progress Ar volume +.Nm +.Op Fl u Ar unit +.Cm clear +.Nm +.Op Fl u Ar unit +.Cm create Ar type +.Op Fl v +.Op Fl s Ar stripe_size +.Ar drive Ns Op \&, Ns Ar drive Ns Op ",..." +.Op Ar drive Ns Op \&, Ns Ar drive Ns Op ",..." +.Nm +.Op Fl u Ar unit +.Cm delete Ar volume +.Nm +.Op Fl u Ar unit +.Cm add Ar drive Op Ar volume +.Nm +.Op Fl u Ar unit +.Cm remove Ar drive +.Nm +.Op Fl u Ar unit +.Cm start patrol +.Nm +.Op Fl u Ar unit +.Cm stop patrol +.Nm +.Op Fl u Ar unit +.Cm patrol Ar command Op Ar interval Op Ar start +.Nm +.Op Fl u Ar unit +.Cm flash Ar file +.Sh DESCRIPTION +The +.Nm +utility can be used to display or modify various parameters on LSI +MegaRAID SAS RAID controllers. +Each invocation of +.Nm +consists of zero or more global options followed by a command. +Commands may support additional optional or required arguments after the +command. +.Pp +Currently one global option is supported: +.Bl -tag -width indent +.It Fl u Ar unit +.Ar unit +specifies the unit of the controller to work with. +If no unit is specified, +then unit 0 is used. +.El +.Pp +Volumes may be specified in two forms. +First, +a volume may be identified by its target ID. +Second, +on the volume may be specified by the corresponding +.Em mfidX +device, +such as +.Em mfid0 . +Note that this second method only works on OS versions +.Dv 6.2-YAHOO-20070510 +and later. +.Pp +Drives may be specified in two forms. +First, +a drive may be identified by its device ID. +The device ID for configured drives can be found in +.Cm show config . +Second, +a drive may be identified by its location as +.Sm off +.Op E Ar xx Ns \&: +.Li S Ns Ar yy +.Sm on +where +.Ar xx +is the enclosure +and +.Ar yy +is the slot for each drive as displayed in +.Cm show drives . +.Pp +The +.Nm +utility supports several different groups of commands. +The first group of commands provide information about the controller, +the volumes it manages, and the drives it controls. +The second group of commands are used to manage the physical drives +attached to the controller. +The third group of commands are used to manage the logical volumes +managed by the controller. +The fourth group of commands are used to manage the drive configuration for +the controller. +The fifth group of commands are used to manage controller-wide operations. +.Pp +The informational commands include: +.Bl -tag -width indent +.It Cm version +Displays the version of +.Nm . +.It Cm show adapter +Displays information about the RAID controller such as the model number. +.It Cm show battery +Displays information about the battery from the battery backup unit. +.It Cm show config +Displays the volume and drive configuration for the controller. +Each array is listed along with the physical drives the array is built from. +Each volume is listed along with the arrays that the volume spans. +If any hot spare drives are configured, then they are listed as well. +.It Cm show drives +Lists all of the physical drives attached to the controller. +.It Xo Cm show events +.Op Fl c Ar class +.Op Fl l Ar locale +.Op Fl n Ar count +.Op Fl v +.Op Ar start Op Ar stop +.Xc +Display entries from the controller's event log. +The controller maintains a circular buffer of events. +Each event is tagged with a class and locale. +.Pp +The +.Ar class +parameter limits the output to entries at the specified class or higher. +The default class is +.Dq warn . +The available classes from lowest priority to highest are: +.Bl -tag -width -indent +.It Cm debug +Debug messages. +.It Cm progress +Periodic progress updates for long-running operations such as background +initializations, array rebuilds, or patrol reads. +.It Cm info +Informational messages such as drive insertions and volume creations. +.It Cm warn +Indicates that some component may be close to failing. +.It Cm crit +A component has failed, but no data is lost. +For example, a volume becoming degraded due to a drive failure. +.It Cm fatal +A component has failed resulting in data loss. +.It Cm dead +The controller itself has died. +.El +.Pp +The +.Ar locale +parameter limits the output to entries for the specified part of the controller. +The default locale is +.Dq all . +The available locales are +.Dq volume , +.Dq drive , +.Dq enclousure , +.Dq battery , +.Dq sas , +.Dq controller , +.Dq config , +.Dq cluster , +and +.Dq all . +.Pp +The +.Ar count +parameter is a debugging aid that specifies the number of events to fetch from +the controller for each low-level request. +The default is 15 events. +.Pp +By default, matching event log entries from the previous shutdown up to the +present are displayed. This range can be adjusted via the +.Ar start +and +.Ar stop +parameters. +Each of these parameters can either be specified as a log entry number or as +one of the following aliases: +.Bl -tag -width -indent +.It Cm newest +The newest entry in the event log. +.It Cm oldest +The oldest entry in the event log. +.It Cm clear +The first entry since the event log was cleared. +.It Cm shutdown +The entry in the event log corresponding to the last time the controller was +cleanly shut down. +.It Cm boot +The entry in the event log corresponding to the most recent boot. +.El +.It Cm show firmware +Lists all of the firmware images present on the controller. +.It Cm show logstate +Display the various sequence numbers associated with the event log. +.It Cm show patrol +Display the status of the controller's patrol read operation. +.It Cm show volumes +Lists all of the logical volumes managed by the controller. +.El +.Pp +The physical drive management commands include: +.Bl -tag -width indent +.It Cm fail Ar drive +Mark +.Ar drive +as failed. +.Ar Drive +must be an online drive that is part of an array. +.It Cm good Ar drive +Mark +.Ar drive +as an unconfigured good drive. +.Ar Drive +must not be part of an existing array. +.It Cm rebuild Ar drive +Mark a failed +.Ar drive +that is still part of an array as a good drive suitable for a rebuild. +The firmware should kick off an array rebuild on its own if a failed drive +is marked as a rebuild drive. +.It Cm drive progress Ar drive +Report the current progress and estimated completion time of drive operations +such as rebuilds or patrol reads. +.It Cm drive clear Ar drive Brq "start | stop" +Start or stop the writing of all 0x00 characters to a drive. +.It Cm start rebuild Ar drive +Manually start a rebuild on +.Ar drive . +.It Cm abort rebuild Ar drive +Abort an in-progress rebuild operation on +.Ar drive . +It can be resumed with the +.Cm start rebuild +command. +.It Cm locate Ar drive Brq "on | off" +Change the state of the external LED associated with +.Ar drive . +.El +.Pp +The logical volume management commands include: +.Bl -tag -width indent +.It Cm cache Ar volume Op Ar setting Op Ar value +If no +.Ar setting +argument is supplied, then the current cache policy for +.Ar volume +is displayed; +otherwise, +the cache policy for +.Ar volume +is modified. +The optional +.Ar setting +argument can be one of the following values: +.Bl -tag -width indent +.It Cm enable +Enable caching for both read and write I/O operations. +.It Cm disable +Disable caching for both read and write I/O operations. +.It Cm reads +Enable caching only for read I/O operations. +.It Cm writes +Enable caching only for write I/O operations. +.It Cm write-back +Use write-back policy for cached writes. +.It Cm write-through +Use write-through policy for cached writes. +.It Cm read-ahead Op Ar value +Set the read ahead policy for cached reads. +The +.Ar value +argument can be set to either +.Dq none , +.Dq adaptive , +or +.Dq always . +.It Cm write-cache Op Ar value +Control the write caches on the physical drives backing +.Ar volume . +The +.Ar value +argument can be set to either +.Dq disable , +.Dq enable , +or +.Dq default . +.Pp +In general this setting should be left disabled to avoid data loss when the +physical drives lose power. +The battery backup of the RAID controller does not save data in the write +caches of the physical drives. +.El +.It Cm name Ar volume Ar name +Sets the name of +.Ar volume +to +.Ar name . +.It Cm volume progress Ar volume +Report the current progress and estimated completion time of volume operations +such as consistency checks and initializations. +.El +.Pp +The configuration commands include: +.Bl -tag -width indent +.It Cm clear +Delete the entire configuration including all volumes, arrays, and spares. +.It Xo Cm create Ar type +.Op Fl v +.Op Fl s Ar stripe_size +.Ar drive Ns Op \&, Ns Ar drive Ns Op ",..." +.Op Ar drive Ns Op \&, Ns Ar drive Ns Op ",..." +.Xc +Create a new volume. +The +.Ar type +specifies the type of volume to create. +Currently supported types include: +.Bl -tag -width indent +.It Cm jbod +Creates a RAID0 volume for each drive specified. +Each drive must be specified as a separate argument. +.It Cm raid0 +Creates one RAID0 volume spanning the drives listed in the single drive list. +.It Cm raid1 +Creates one RAID1 volume spanning the drives listed in the single drive list. +.It Cm raid5 +Creates one RAID5 volume spanning the drives listed in the single drive list. +.It Cm raid6 +Creates one RAID6 volume spanning the drives listed in the single drive list. +.It Cm raid10 +Creates one RAID10 volume spanning multiple RAID1 arrays. +The drives for each RAID1 array are specified as a single drive list. +.It Cm raid50 +Creates one RAID50 volume spanning multiple RAID5 arrays. +The drives for each RAID5 array are specified as a single drive list. +.It Cm raid60 +Creates one RAID60 volume spanning multiple RAID6 arrays. +The drives for each RAID6 array are specified as a single drive list. +.It Cm concat +Creates a single volume by concatenating all of the drives in the single drive +list. +.El +.Pp +.Sy Note: +Not all volume types are supported by all controllers. +.Pp +If the +.Fl v +flag is specified after +.Ar type , +then more verbose output will be enabled. +Currently this just provides notification as drives are added to arrays and +arrays to volumes when building the configuration. +.Pp +The +.Fl s +.Ar stripe_size +parameter allows the stripe size of the array to be set. +By default a stripe size of 64K is used. +Valid values are 512 through 1M, though the MFI firmware may reject some +values. +.It Cm delete Ar volume +Delete the volume +.Ar volume . +.It Cm add Ar drive Op Ar volume +Mark +.Ar drive +as a hot spare. +.Ar Drive +must be in the unconfigured good state. +If +.Ar volume +is specified, +then the hot spare will be dedicated to arrays backing that volume. +Otherwise, +.Ar drive +will be used as a global hot spare backing all arrays for this controller. +Note that +.Ar drive +must be as large as the smallest drive in all of the arrays it is going to +back. +.It Cm remove Ar drive +Remove the hot spare +.Ar drive +from service. +It will be placed in the unconfigured good state. +.El +.Pp +The controller management commands include: +.Bl -tag -width indent +.It Cm patrol Ar command Op Ar interval Op Ar start +Set the patrol read operation mode. +The +.Ar command +argument can be one of the following values: +.Bl -tag -width indent +.It Cm disable +Disable patrol reads. +.It Cm auto +Enable periodic patrol reads initiated by the firmware. +The optional +.Ar interval +argument specifies the interval in seconds between patrol reads. +If patrol reads should be run continously, +then +.Ar interval +should consist of the word +.Dq continuously . +The optional +.Ar start +argument specifies a non-negative, relative start time for the next patrol read. +If an interval or start time is not specified, +then the existing setting will be used. +.It Cm manual +Enable manual patrol reads that are only initiated by the user. +.El +.It Cm start patrol +Start a patrol read operation. +.It Cm stop patrol +Stop a currently running patrol read operation. +.It Cm flash Ar file +Updates the flash on the controller with the firmware stored in +.Ar file . +A reboot is required for the new firmware to take effect. +.El +.Sh EXAMPLES +Configure the cache for volume mfid0 to cache only writes: +.Pp +.Dl Nm Cm cache mfid0 writes +.Dl Nm Cm cache mfid0 write-back +.Pp +Create a RAID5 array spanning the first four disks in the second enclosure: +.Pp +.Dl Nm Cm create raid5 e1:s0,e1:s1,e1:s2,e1:s4 +.Pp +Configure the first three disks on a controller as JBOD: +.Pp +.Dl Nm Cm create jbod 0 1 2 +.Pp +Create a RAID10 volume that spans two arrays each of which contains two disks +from two different enclosures: +.Pp +.Dl Nm Cm create raid10 e1:s0,e1:s1 e2:s0,e2:s1 +.Pp +Add drive with the device ID of 4 as a global hot spare: +.Pp +.Dl Nm Cm add 4 +.Pp +Add the drive in slot 2 in the main chassis as a hot spare for volume mfid0: +.Pp +.Dl Nm Cm add s2 mfid0 +.Pp +Configure the adapter to run periodic patrol reads once a week with the first +patrol read starting in 5 minutes: +.Pp +.Dl Nm Cm patrol auto 604800 300 +.Pp +.Sh SEE ALSO +.Xr mfi 4 +.Sh BUGS +On 64-bit OS versions +.Dv 6.2-YAHOO-20070514 +and earlier, +the +.Xr mfi 4 +driver does not properly report firmware errors to 32-bit versions of +.Nm . +As a result, +some commands may fail even though they do not report any errors. From scottl at FreeBSD.org Mon Aug 17 06:11:30 2009 From: scottl at FreeBSD.org (Scott Long) Date: Mon Aug 17 06:11:42 2009 Subject: svn commit: r196281 - head/usr.sbin/mfiutil Message-ID: <200908170611.n7H6BUif049298@svn.freebsd.org> Author: scottl Date: Mon Aug 17 06:11:30 2009 New Revision: 196281 URL: http://svn.freebsd.org/changeset/base/196281 Log: Update the man page for FreeBSD 8.0 Approved by: re Modified: head/usr.sbin/mfiutil/mfiutil.8 Modified: head/usr.sbin/mfiutil/mfiutil.8 ============================================================================== --- head/usr.sbin/mfiutil/mfiutil.8 Mon Aug 17 06:05:55 2009 (r196280) +++ head/usr.sbin/mfiutil/mfiutil.8 Mon Aug 17 06:11:30 2009 (r196281) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 17, 2008 +.Dd August 16, 2009 .Dt MFIUTIL 1 .Os .Sh NAME @@ -161,9 +161,6 @@ on the volume may be specified by the co device, such as .Em mfid0 . -Note that this second method only works on OS versions -.Dv 6.2-YAHOO-20070510 -and later. .Pp Drives may be specified in two forms. First, @@ -562,13 +559,8 @@ patrol read starting in 5 minutes: .Pp .Sh SEE ALSO .Xr mfi 4 -.Sh BUGS -On 64-bit OS versions -.Dv 6.2-YAHOO-20070514 -and earlier, -the -.Xr mfi 4 -driver does not properly report firmware errors to 32-bit versions of -.Nm . -As a result, -some commands may fail even though they do not report any errors. +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 8.0 . From scottl at FreeBSD.org Mon Aug 17 06:15:10 2009 From: scottl at FreeBSD.org (Scott Long) Date: Mon Aug 17 06:15:21 2009 Subject: svn commit: r196282 - head/usr.sbin/mfiutil Message-ID: <200908170615.n7H6F8n8049408@svn.freebsd.org> Author: scottl Date: Mon Aug 17 06:15:08 2009 New Revision: 196282 URL: http://svn.freebsd.org/changeset/base/196282 Log: Update the man page for manual section 8 Approved by: re Modified: head/usr.sbin/mfiutil/mfiutil.8 Modified: head/usr.sbin/mfiutil/mfiutil.8 ============================================================================== --- head/usr.sbin/mfiutil/mfiutil.8 Mon Aug 17 06:11:30 2009 (r196281) +++ head/usr.sbin/mfiutil/mfiutil.8 Mon Aug 17 06:15:08 2009 (r196282) @@ -28,7 +28,7 @@ .\" $FreeBSD$ .\" .Dd August 16, 2009 -.Dt MFIUTIL 1 +.Dt MFIUTIL 8 .Os .Sh NAME .Nm mfiutil From scottl at FreeBSD.org Mon Aug 17 06:15:44 2009 From: scottl at FreeBSD.org (Scott Long) Date: Mon Aug 17 06:15:51 2009 Subject: svn commit: r196283 - head/usr.sbin/mptutil Message-ID: <200908170615.n7H6FitA049463@svn.freebsd.org> Author: scottl Date: Mon Aug 17 06:15:44 2009 New Revision: 196283 URL: http://svn.freebsd.org/changeset/base/196283 Log: Update the mptutil man page for FreeBSD 8.0 Approved by: re Modified: head/usr.sbin/mptutil/mptutil.8 Modified: head/usr.sbin/mptutil/mptutil.8 ============================================================================== --- head/usr.sbin/mptutil/mptutil.8 Mon Aug 17 06:15:08 2009 (r196282) +++ head/usr.sbin/mptutil/mptutil.8 Mon Aug 17 06:15:44 2009 (r196283) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 22, 2008 +.Dd August 16, 2009 .Dt MPTUTIL 8 .Os .Sh NAME @@ -349,8 +349,6 @@ as a global hot spare: .Sh SEE ALSO .Xr mpt 4 .Sh BUGS -Deleting volumes usually provokes a kernel crash in OS versions older than -.Dv 6.3-YAHOO-20080722 . .Pp The handling of spare drives appears to be unreliable. The @@ -381,3 +379,8 @@ configurations may not work reliably. .Pp Drive configuration commands result in an excessive flood of messages on the console. +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 8.0 . From pjd at FreeBSD.org Mon Aug 17 07:38:48 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Aug 17 07:38:59 2009 Subject: svn commit: r196287 - head/sbin/umount Message-ID: <200908170738.n7H7clLd052645@svn.freebsd.org> Author: pjd Date: Mon Aug 17 07:38:47 2009 New Revision: 196287 URL: http://svn.freebsd.org/changeset/base/196287 Log: Be more precise how to get fsids - 'mount -v' doesn't show fsids unless is run by root. Approved by: re (kib) Modified: head/sbin/umount/umount.8 Modified: head/sbin/umount/umount.8 ============================================================================== --- head/sbin/umount/umount.8 Mon Aug 17 07:30:08 2009 (r196286) +++ head/sbin/umount/umount.8 Mon Aug 17 07:38:47 2009 (r196287) @@ -57,7 +57,8 @@ device or remote node (rhost:path), the or by the file system ID .Ar fsid as reported by -.Dq mount -v . +.Dq mount -v +when run by root. .Pp The options are as follows: .Bl -tag -width indent From pjd at FreeBSD.org Mon Aug 17 08:03:02 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Aug 17 08:03:08 2009 Subject: svn commit: r196289 - in head: cddl/lib/libnvpair sys/cddl/compat/opensolaris/rpc sys/cddl/contrib/opensolaris/uts/common/rpc Message-ID: <200908170803.n7H832IY053649@svn.freebsd.org> Author: pjd Date: Mon Aug 17 08:03:02 2009 New Revision: 196289 URL: http://svn.freebsd.org/changeset/base/196289 Log: Remove files that are no longer used. Discussed with: kmacy Approved by: re (kib) Deleted: head/sys/cddl/compat/opensolaris/rpc/xdr.h head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_array.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_mem.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.h Modified: head/cddl/lib/libnvpair/Makefile Modified: head/cddl/lib/libnvpair/Makefile ============================================================================== --- head/cddl/lib/libnvpair/Makefile Mon Aug 17 07:46:55 2009 (r196288) +++ head/cddl/lib/libnvpair/Makefile Mon Aug 17 08:03:02 2009 (r196289) @@ -13,5 +13,6 @@ SRCS= libnvpair.c \ CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common +CFLAGS+= -I${.CURDIR}/../../../sys .include From pjd at FreeBSD.org Mon Aug 17 08:36:41 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Aug 17 08:36:53 2009 Subject: svn commit: r196291 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200908170836.n7H8afxO054579@svn.freebsd.org> Author: pjd Date: Mon Aug 17 08:36:41 2009 New Revision: 196291 URL: http://svn.freebsd.org/changeset/base/196291 Log: - Fix a race where /dev/zfs control device is created before ZFS is fully initialized. Also destroy /dev/zfs before doing other deinitializations. - Initialization through taskq is no longer needed and there is a race where one of the zpool/zfs command loads zfs.ko and tries to do some work immediately, but /dev/zfs is not there yet. Reported by: pav Approved by: re (kib) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Mon Aug 17 08:09:46 2009 (r196290) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Mon Aug 17 08:36:41 2009 (r196291) @@ -3056,44 +3056,35 @@ zfsdev_fini(void) destroy_dev(zfsdev); } -static struct task zfs_start_task; static struct root_hold_token *zfs_root_token; - uint_t zfs_fsyncer_key; extern uint_t rrw_tsd_key; -static void -zfs_start(void *context __unused, int pending __unused) -{ - - zfsdev_init(); - spa_init(FREAD | FWRITE); - zfs_init(); - zvol_init(); - - tsd_create(&zfs_fsyncer_key, NULL); - tsd_create(&rrw_tsd_key, NULL); - - printf("ZFS storage pool version " SPA_VERSION_STRING "\n"); - root_mount_rel(zfs_root_token); -} - static int zfs_modevent(module_t mod, int type, void *unused __unused) { - int error; + int error = 0; - error = EOPNOTSUPP; switch (type) { case MOD_LOAD: zfs_root_token = root_mount_hold("ZFS"); printf("WARNING: ZFS is considered to be an experimental " "feature in FreeBSD.\n"); - TASK_INIT(&zfs_start_task, 0, zfs_start, NULL); - taskqueue_enqueue(taskqueue_thread, &zfs_start_task); + mutex_init(&zfs_share_lock, NULL, MUTEX_DEFAULT, NULL); - error = 0; + + spa_init(FREAD | FWRITE); + zfs_init(); + zvol_init(); + + tsd_create(&zfs_fsyncer_key, NULL); + tsd_create(&rrw_tsd_key, NULL); + + printf("ZFS storage pool version " SPA_VERSION_STRING "\n"); + root_mount_rel(zfs_root_token); + + zfsdev_init(); break; case MOD_UNLOAD: if (spa_busy() || zfs_busy() || zvol_busy() || @@ -3101,14 +3092,19 @@ zfs_modevent(module_t mod, int type, voi error = EBUSY; break; } + + zfsdev_fini(); zvol_fini(); zfs_fini(); spa_fini(); - zfsdev_fini(); + tsd_destroy(&zfs_fsyncer_key); tsd_destroy(&rrw_tsd_key); + mutex_destroy(&zfs_share_lock); - error = 0; + break; + default: + error = EOPNOTSUPP; break; } return (error); From pjd at FreeBSD.org Mon Aug 17 08:42:34 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Aug 17 08:42:45 2009 Subject: svn commit: r196293 - head/sys/kern Message-ID: <200908170842.n7H8gYo5054777@svn.freebsd.org> Author: pjd Date: Mon Aug 17 08:42:34 2009 New Revision: 196293 URL: http://svn.freebsd.org/changeset/base/196293 Log: Because taskqueue_run() can drop tq_mutex, we need to check if the TQ_FLAGS_ACTIVE flag wasn't removed in the meantime, which means we missed a wakeup. Approved by: re (kib) Modified: head/sys/kern/subr_taskqueue.c Modified: head/sys/kern/subr_taskqueue.c ============================================================================== --- head/sys/kern/subr_taskqueue.c Mon Aug 17 08:38:41 2009 (r196292) +++ head/sys/kern/subr_taskqueue.c Mon Aug 17 08:42:34 2009 (r196293) @@ -401,6 +401,13 @@ taskqueue_thread_loop(void *arg) TQ_LOCK(tq); while ((tq->tq_flags & TQ_FLAGS_ACTIVE) != 0) { taskqueue_run(tq); + /* + * Because taskqueue_run() can drop tq_mutex, we need to + * check if the TQ_FLAGS_ACTIVE flag wasn't removed in the + * meantime, which means we missed a wakeup. + */ + if ((tq->tq_flags & TQ_FLAGS_ACTIVE) == 0) + break; TQ_SLEEP(tq, tq, &tq->tq_mutex, 0, "-", 0); } From pjd at FreeBSD.org Mon Aug 17 09:01:20 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Aug 17 09:01:29 2009 Subject: svn commit: r196295 - in head: share/man/man9 sys/cddl/compat/opensolaris/kern sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys sys/cddl/contrib/opensolaris/uts/co... Message-ID: <200908170901.n7H91KeH055689@svn.freebsd.org> Author: pjd Date: Mon Aug 17 09:01:20 2009 New Revision: 196295 URL: http://svn.freebsd.org/changeset/base/196295 Log: Remove OpenSolaris taskq port (it performs very poorly in our kernel) and replace it with wrappers around our taskqueue(9). To make it possible implement taskqueue_member() function which returns 1 if the given thread was created by the given taskqueue. Approved by: re (kib) Added: head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h (contents, props changed) Deleted: head/sys/cddl/compat/opensolaris/sys/taskq.h head/sys/cddl/compat/opensolaris/sys/taskq_impl.h head/sys/cddl/contrib/opensolaris/uts/common/os/taskq.c Modified: head/share/man/man9/taskqueue.9 head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h head/sys/kern/subr_taskqueue.c head/sys/modules/zfs/Makefile head/sys/sys/taskqueue.h Modified: head/share/man/man9/taskqueue.9 ============================================================================== --- head/share/man/man9/taskqueue.9 Mon Aug 17 08:46:47 2009 (r196294) +++ head/share/man/man9/taskqueue.9 Mon Aug 17 09:01:20 2009 (r196295) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 13, 2008 +.Dd August 17, 2009 .Dt TASKQUEUE 9 .Os .Sh NAME @@ -71,6 +71,8 @@ struct task { .Fn taskqueue_run_fast "struct taskqueue *queue" .Ft void .Fn taskqueue_drain "struct taskqueue *queue" "struct task *task" +.Ft int +.Fn taskqueue_member "struct taskqueue *queue" "struct thread *td" .Fn TASK_INIT "struct task *task" "int priority" "task_fn_t *func" "void *context" .Fn TASKQUEUE_DECLARE "name" .Fn TASKQUEUE_DEFINE "name" "taskqueue_enqueue_fn enqueue" "void *context" "init" @@ -182,6 +184,18 @@ There is no guarantee that the task will enqueued after call to .Fn taskqueue_drain . .Pp +The +.Fn taskqueue_member +function returns +.No 1 +is the given thread +.Fa td +is part of the given taskqeueue +.Fa queue +and +.No 0 +otherwise. +.Pp A convenience macro, .Fn TASK_INIT "task" "priority" "func" "context" is provided to initialise a Added: head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c Mon Aug 17 09:01:20 2009 (r196295) @@ -0,0 +1,135 @@ +/*- + * Copyright (c) 2009 Pawel Jakub Dawidek + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +static uma_zone_t taskq_zone; + +struct ostask { + struct task ost_task; + task_func_t *ost_func; + void *ost_arg; +}; + +taskq_t *system_taskq = NULL; + +static void +system_taskq_init(void *arg) +{ + + system_taskq = (taskq_t *)taskqueue_thread; + taskq_zone = uma_zcreate("taskq_zone", sizeof(struct ostask), + NULL, NULL, NULL, NULL, 0, 0); +} +SYSINIT(system_taskq_init, SI_SUB_CONFIGURE, SI_ORDER_ANY, system_taskq_init, NULL); + +static void +system_taskq_fini(void *arg) +{ + + uma_zdestroy(taskq_zone); +} +SYSUNINIT(system_taskq_fini, SI_SUB_CONFIGURE, SI_ORDER_ANY, system_taskq_fini, NULL); + +taskq_t * +taskq_create(const char *name, int nthreads, pri_t pri, int minalloc __unused, + int maxalloc __unused, uint_t flags) +{ + taskq_t *tq; + + if ((flags & TASKQ_THREADS_CPU_PCT) != 0) { + /* TODO: Calculate number od threads. */ + printf("%s: TASKQ_THREADS_CPU_PCT\n", __func__); + } + + tq = kmem_alloc(sizeof(*tq), KM_SLEEP); + tq->tq_queue = taskqueue_create(name, M_WAITOK, taskqueue_thread_enqueue, + &tq->tq_queue); + (void) taskqueue_start_threads(&tq->tq_queue, nthreads, pri, name); + + return ((taskq_t *)tq); +} + +void +taskq_destroy(taskq_t *tq) +{ + + taskqueue_free(tq->tq_queue); + kmem_free(tq, sizeof(*tq)); +} + +int +taskq_member(taskq_t *tq, kthread_t *thread) +{ + + return (taskqueue_member(tq->tq_queue, thread)); +} + +static void +taskq_run(void *arg, int pending __unused) +{ + struct ostask *task = arg; + + task->ost_func(task->ost_arg); + + uma_zfree(taskq_zone, task); +} + +taskqid_t +taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) +{ + struct ostask *task; + int mflag; + + if ((flags & (TQ_SLEEP | TQ_NOQUEUE)) == TQ_SLEEP) + mflag = M_WAITOK; + else + mflag = M_NOWAIT; + + task = uma_zalloc(taskq_zone, mflag); + if (task == NULL) + return (0); + + task->ost_func = func; + task->ost_arg = arg; + + TASK_INIT(&task->ost_task, 0, taskq_run, task); + taskqueue_enqueue(tq->tq_queue, &task->ost_task); + + return ((taskqid_t)(void *)task); +} Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h Mon Aug 17 08:46:47 2009 (r196294) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h Mon Aug 17 09:01:20 2009 (r196295) @@ -49,6 +49,7 @@ extern "C" { #include #include #include +#include #include #include #include Added: head/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h Mon Aug 17 09:01:20 2009 (r196295) @@ -0,0 +1,90 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_TASKQ_H +#define _SYS_TASKQ_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define TASKQ_NAMELEN 31 + +struct taskqueue; +struct taskq { + struct taskqueue *tq_queue; +}; + +typedef struct taskq taskq_t; +typedef uintptr_t taskqid_t; +typedef void (task_func_t)(void *); + +/* + * Public flags for taskq_create(): bit range 0-15 + */ +#define TASKQ_PREPOPULATE 0x0001 /* Prepopulate with threads and data */ +#define TASKQ_CPR_SAFE 0x0002 /* Use CPR safe protocol */ +#define TASKQ_DYNAMIC 0x0004 /* Use dynamic thread scheduling */ +#define TASKQ_THREADS_CPU_PCT 0x0008 /* number of threads as % of ncpu */ + +/* + * Flags for taskq_dispatch. TQ_SLEEP/TQ_NOSLEEP should be same as + * KM_SLEEP/KM_NOSLEEP. + */ +#define TQ_SLEEP 0x00 /* Can block for memory */ +#define TQ_NOSLEEP 0x01 /* cannot block for memory; may fail */ +#define TQ_NOQUEUE 0x02 /* Do not enqueue if can't dispatch */ +#define TQ_NOALLOC 0x04 /* cannot allocate memory; may fail */ + +#ifdef _KERNEL + +extern taskq_t *system_taskq; + +extern void taskq_init(void); +extern void taskq_mp_init(void); + +extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t); +extern taskq_t *taskq_create_instance(const char *, int, int, pri_t, int, + int, uint_t); +extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t); +extern void nulltask(void *); +extern void taskq_destroy(taskq_t *); +extern void taskq_wait(taskq_t *); +extern void taskq_suspend(taskq_t *); +extern int taskq_suspended(taskq_t *); +extern void taskq_resume(taskq_t *); +extern int taskq_member(taskq_t *, kthread_t *); + +#endif /* _KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_TASKQ_H */ Modified: head/sys/kern/subr_taskqueue.c ============================================================================== --- head/sys/kern/subr_taskqueue.c Mon Aug 17 08:46:47 2009 (r196294) +++ head/sys/kern/subr_taskqueue.c Mon Aug 17 09:01:20 2009 (r196295) @@ -472,3 +472,23 @@ taskqueue_fast_run(void *dummy) TASKQUEUE_FAST_DEFINE(fast, taskqueue_fast_enqueue, NULL, swi_add(NULL, "Fast task queue", taskqueue_fast_run, NULL, SWI_TQ_FAST, INTR_MPSAFE, &taskqueue_fast_ih)); + +int +taskqueue_member(struct taskqueue *queue, struct thread *td) +{ + int i, j, ret = 0; + + TQ_LOCK(queue); + for (i = 0, j = 0; ; i++) { + if (queue->tq_threads[i] == NULL) + continue; + if (queue->tq_threads[i] == td) { + ret = 1; + break; + } + if (++j >= queue->tq_tcount) + break; + } + TQ_UNLOCK(queue); + return (ret); +} Modified: head/sys/modules/zfs/Makefile ============================================================================== --- head/sys/modules/zfs/Makefile Mon Aug 17 08:46:47 2009 (r196294) +++ head/sys/modules/zfs/Makefile Mon Aug 17 09:01:20 2009 (r196295) @@ -23,6 +23,7 @@ SRCS+= opensolaris_kstat.c SRCS+= opensolaris_lookup.c SRCS+= opensolaris_policy.c SRCS+= opensolaris_string.c +SRCS+= opensolaris_taskq.c SRCS+= opensolaris_vfs.c SRCS+= opensolaris_zone.c @@ -42,7 +43,6 @@ SRCS+= vnode.c SRCS+= callb.c SRCS+= list.c SRCS+= nvpair_alloc_system.c -SRCS+= taskq.c .PATH: ${SUNW}/uts/common/zmod SRCS+= adler32.c Modified: head/sys/sys/taskqueue.h ============================================================================== --- head/sys/sys/taskqueue.h Mon Aug 17 08:46:47 2009 (r196294) +++ head/sys/sys/taskqueue.h Mon Aug 17 09:01:20 2009 (r196295) @@ -37,6 +37,7 @@ #include struct taskqueue; +struct thread; /* * A notification callback function which is called from @@ -60,6 +61,7 @@ void taskqueue_free(struct taskqueue *qu void taskqueue_run(struct taskqueue *queue); void taskqueue_block(struct taskqueue *queue); void taskqueue_unblock(struct taskqueue *queue); +int taskqueue_member(struct taskqueue *queue, struct thread *td); /* * Functions for dedicated thread taskqueues From pjd at FreeBSD.org Mon Aug 17 09:13:22 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Aug 17 09:13:33 2009 Subject: svn commit: r196297 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200908170913.n7H9DMAl056381@svn.freebsd.org> Author: pjd Date: Mon Aug 17 09:13:22 2009 New Revision: 196297 URL: http://svn.freebsd.org/changeset/base/196297 Log: Fix panic in zfs recv code. The last vnode (mountpoint's vnode) can have 0 usecount. Reported by: Thomas Backman Approved by: re (kib) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon Aug 17 09:03:47 2009 (r196296) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon Aug 17 09:13:22 2009 (r196297) @@ -917,7 +917,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolea for (zp = list_head(&zfsvfs->z_all_znodes); zp != NULL; zp = list_next(&zfsvfs->z_all_znodes, zp)) if (zp->z_dbuf) { - ASSERT(ZTOV(zp)->v_count > 0); + ASSERT(ZTOV(zp)->v_count >= 0); zfs_znode_dmu_fini(zp); } mutex_exit(&zfsvfs->z_znodes_lock); From pjd at FreeBSD.org Mon Aug 17 09:21:40 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Aug 17 09:21:46 2009 Subject: svn commit: r196299 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200908170921.n7H9Ld8c056791@svn.freebsd.org> Author: pjd Date: Mon Aug 17 09:21:39 2009 New Revision: 196299 URL: http://svn.freebsd.org/changeset/base/196299 Log: - We need to recycle vnode instead of freeing znode. Submitted by: avg - Add missing vnode interlock unlock. - Remove redundant znode locking. Approved by: re (kib) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:14:58 2009 (r196298) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:21:39 2009 (r196299) @@ -3709,12 +3709,11 @@ zfs_inactive(vnode_t *vp, cred_t *cr, ca * The fs has been unmounted, or we did a * suspend/resume and this file no longer exists. */ - mutex_enter(&zp->z_lock); VI_LOCK(vp); vp->v_count = 0; /* count arrives as 1 */ - mutex_exit(&zp->z_lock); + VI_UNLOCK(vp); + vrecycle(vp, curthread); rw_exit(&zfsvfs->z_teardown_inactive_lock); - zfs_znode_free(zp); return; } From pjd at FreeBSD.org Mon Aug 17 09:25:38 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Aug 17 09:25:50 2009 Subject: svn commit: r196301 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200908170925.n7H9PcS2056984@svn.freebsd.org> Author: pjd Date: Mon Aug 17 09:25:37 2009 New Revision: 196301 URL: http://svn.freebsd.org/changeset/base/196301 Log: If z_buf is NULL, we should free znode immediately. Noticed by: avg Approved by: re (kib) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:23:27 2009 (r196300) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:25:37 2009 (r196301) @@ -4350,7 +4350,6 @@ zfs_freebsd_reclaim(ap) { vnode_t *vp = ap->a_vp; znode_t *zp = VTOZ(vp); - zfsvfs_t *zfsvfs; ASSERT(zp != NULL); @@ -4360,13 +4359,18 @@ zfs_freebsd_reclaim(ap) vnode_destroy_vobject(vp); mutex_enter(&zp->z_lock); - ASSERT(zp->z_phys); + ASSERT(zp->z_phys != NULL); ZTOV(zp) = NULL; - if (!zp->z_unlinked) { + mutex_exit(&zp->z_lock); + + if (zp->z_unlinked) + ; /* Do nothing. */ + else if (zp->z_dbuf == NULL) + zfs_znode_free(zp); + else /* if (!zp->z_unlinked && zp->z_dbuf != NULL) */ { + zfsvfs_t *zfsvfs = zp->z_zfsvfs; int locked; - zfsvfs = zp->z_zfsvfs; - mutex_exit(&zp->z_lock); locked = MUTEX_HELD(ZFS_OBJ_MUTEX(zfsvfs, zp->z_id)) ? 2 : ZFS_OBJ_HOLD_TRYENTER(zfsvfs, zp->z_id); if (locked == 0) { @@ -4382,8 +4386,6 @@ zfs_freebsd_reclaim(ap) ZFS_OBJ_HOLD_EXIT(zfsvfs, zp->z_id); zfs_znode_free(zp); } - } else { - mutex_exit(&zp->z_lock); } VI_LOCK(vp); vp->v_data = NULL; From pjd at FreeBSD.org Mon Aug 17 09:28:15 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Aug 17 09:28:26 2009 Subject: svn commit: r196303 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200908170928.n7H9SFWm057119@svn.freebsd.org> Author: pjd Date: Mon Aug 17 09:28:15 2009 New Revision: 196303 URL: http://svn.freebsd.org/changeset/base/196303 Log: - Reduce z_teardown_lock lock scope a bit. - The error variable is int, not bool. - Convert spaces to tabs where needed. Approved by: re (kib) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:27:10 2009 (r196302) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:28:15 2009 (r196303) @@ -4529,9 +4529,9 @@ vop_getextattr { vp = nd.ni_vp; NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) { + ZFS_EXIT(zfsvfs); if (error == ENOENT) error = ENOATTR; - ZFS_EXIT(zfsvfs); return (error); } @@ -4597,9 +4597,9 @@ vop_deleteextattr { vp = nd.ni_vp; NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) { + ZFS_EXIT(zfsvfs); if (error == ENOENT) error = ENOATTR; - ZFS_EXIT(zfsvfs); return (error); } error = VOP_REMOVE(nd.ni_dvp, vp, &nd.ni_cnd); @@ -4712,7 +4712,7 @@ vop_listextattr { error = extattr_check_cred(ap->a_vp, ap->a_attrnamespace, ap->a_cred, ap->a_td, VREAD); - if (error) + if (error != 0) return (error); error = zfs_create_attrname(ap->a_attrnamespace, "", attrprefix, @@ -4729,13 +4729,13 @@ vop_listextattr { error = zfs_lookup(ap->a_vp, NULL, &xvp, NULL, 0, ap->a_cred, td, LOOKUP_XATTR); if (error != 0) { + ZFS_EXIT(zfsvfs); /* * ENOATTR means that the EA directory does not yet exist, * i.e. there are no extended attributes there. */ if (error == ENOATTR) error = 0; - ZFS_EXIT(zfsvfs); return (error); } @@ -4825,10 +4825,10 @@ zfs_freebsd_getacl(ap) return (error); error = acl_from_aces(ap->a_aclp, vsecattr.vsa_aclentp, vsecattr.vsa_aclcnt); - if (vsecattr.vsa_aclentp != NULL) - kmem_free(vsecattr.vsa_aclentp, vsecattr.vsa_aclentsz); + if (vsecattr.vsa_aclentp != NULL) + kmem_free(vsecattr.vsa_aclentp, vsecattr.vsa_aclentsz); - return (error); + return (error); } int From pjd at FreeBSD.org Mon Aug 17 09:34:00 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Aug 17 09:34:07 2009 Subject: svn commit: r196305 - head/cddl/contrib/opensolaris/lib/libzfs/common Message-ID: <200908170934.n7H9Y0SV057325@svn.freebsd.org> Author: pjd Date: Mon Aug 17 09:34:00 2009 New Revision: 196305 URL: http://svn.freebsd.org/changeset/base/196305 Log: Fix receive when dataset has no / in its name. Submitted by: James R. Van Artsdalen Approved by: re (kib) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Mon Aug 17 09:30:31 2009 (r196304) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Mon Aug 17 09:34:00 2009 (r196305) @@ -1126,7 +1126,7 @@ again: uint64_t originguid = 0; uint64_t stream_originguid = 0; uint64_t parent_fromsnap_guid, stream_parent_fromsnap_guid; - char *fsname, *stream_fsname; + char *fsname, *stream_fsname, *p1, *p2; nextfselem = nvlist_next_nvpair(local_nv, fselem); @@ -1295,10 +1295,11 @@ again: "parentfromsnap", &stream_parent_fromsnap_guid)); /* check for rename */ + p1 = strrchr(fsname, '/'); + p2 = strrchr(stream_fsname, '/'); if ((stream_parent_fromsnap_guid != 0 && stream_parent_fromsnap_guid != parent_fromsnap_guid) || - strcmp(strrchr(fsname, '/'), - strrchr(stream_fsname, '/')) != 0) { + (p1 != NULL && p2 != NULL && strcmp (p1, p2) != 0)) { nvlist_t *parent; char tryname[ZFS_MAXNAMELEN]; @@ -1317,7 +1318,7 @@ again: VERIFY(0 == nvlist_lookup_string(parent, "name", &pname)); (void) snprintf(tryname, sizeof (tryname), - "%s%s", pname, strrchr(stream_fsname, '/')); + "%s%s", pname, p2 != NULL ? p2 : ""); } else { tryname[0] = '\0'; if (flags.verbose) { From pjd at FreeBSD.org Mon Aug 17 09:48:34 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Aug 17 09:48:46 2009 Subject: svn commit: r196307 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys contrib/opensolaris/... Message-ID: <200908170948.n7H9mY9H057685@svn.freebsd.org> Author: pjd Date: Mon Aug 17 09:48:34 2009 New Revision: 196307 URL: http://svn.freebsd.org/changeset/base/196307 Log: Manage asynchronous vnode release just like Solaris. Discussed with: kmacy Approved by: re (kib) Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/vnode.h Mon Aug 17 09:42:34 2009 (r196306) +++ head/sys/cddl/compat/opensolaris/sys/vnode.h Mon Aug 17 09:48:34 2009 (r196307) @@ -75,7 +75,6 @@ vn_is_readonly(vnode_t *vp) #define VN_HOLD(v) vref(v) #define VN_RELE(v) vrele(v) #define VN_URELE(v) vput(v) -#define VN_RELE_ASYNC(v, tq) vn_rele_async(v, tq); #define VOP_REALVP(vp, vpp, ct) (*(vpp) = (vp), 0) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c Mon Aug 17 09:42:34 2009 (r196306) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c Mon Aug 17 09:48:34 2009 (r196307) @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -36,12 +36,10 @@ * contributors. */ - -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include +#include #include /* Extensible attribute (xva) routines. */ @@ -74,15 +72,12 @@ xva_getxoptattr(xvattr_t *xvap) return (xoap); } -static STAILQ_HEAD(, vnode) vn_rele_async_list; -static struct mtx vn_rele_async_lock; -static struct cv vn_rele_async_cv; -static int vn_rele_list_length; -static int vn_rele_async_thread_exit; - -typedef struct { - struct vnode *stqe_next; -} vnode_link_t; +static void +vn_rele_inactive(vnode_t *vp) +{ + + vrele(vp); +} /* * Like vn_rele() except if we are going to call VOP_INACTIVE() then do it @@ -95,117 +90,16 @@ typedef struct { * This is because taskqs throttle back allocation if too many are created. */ void -vn_rele_async(vnode_t *vp, taskq_t *taskq /* unused */) +vn_rele_async(vnode_t *vp, taskq_t *taskq) { - - KASSERT(vp != NULL, ("vrele: null vp")); - VFS_ASSERT_GIANT(vp->v_mount); + VERIFY(vp->v_count > 0); VI_LOCK(vp); - - if (vp->v_usecount > 1 || ((vp->v_iflag & VI_DOINGINACT) && - vp->v_usecount == 1)) { - vp->v_usecount--; - vdropl(vp); - return; - } - if (vp->v_usecount != 1) { -#ifdef DIAGNOSTIC - vprint("vrele: negative ref count", vp); -#endif + if (vp->v_count == 1 && !(vp->v_iflag & VI_DOINGINACT)) { VI_UNLOCK(vp); - panic("vrele: negative ref cnt"); - } - /* - * We are exiting - */ - if (vn_rele_async_thread_exit != 0) { - vrele(vp); + VERIFY(taskq_dispatch((taskq_t *)taskq, + (task_func_t *)vn_rele_inactive, vp, TQ_SLEEP) != 0); return; } - - mtx_lock(&vn_rele_async_lock); - - /* STAILQ_INSERT_TAIL */ - (*(vnode_link_t *)&vp->v_cstart).stqe_next = NULL; - *vn_rele_async_list.stqh_last = vp; - vn_rele_async_list.stqh_last = - &((vnode_link_t *)&vp->v_cstart)->stqe_next; - - /****************************************/ - vn_rele_list_length++; - if ((vn_rele_list_length % 100) == 0) - cv_signal(&vn_rele_async_cv); - mtx_unlock(&vn_rele_async_lock); - VI_UNLOCK(vp); -} - -static void -vn_rele_async_init(void *arg) -{ - - mtx_init(&vn_rele_async_lock, "valock", NULL, MTX_DEF); - STAILQ_INIT(&vn_rele_async_list); - - /* cv_init(&vn_rele_async_cv, "vacv"); */ - vn_rele_async_cv.cv_description = "vacv"; - vn_rele_async_cv.cv_waiters = 0; -} - -void -vn_rele_async_fini(void) -{ - - mtx_lock(&vn_rele_async_lock); - vn_rele_async_thread_exit = 1; - cv_signal(&vn_rele_async_cv); - while (vn_rele_async_thread_exit != 0) - cv_wait(&vn_rele_async_cv, &vn_rele_async_lock); - mtx_unlock(&vn_rele_async_lock); - mtx_destroy(&vn_rele_async_lock); -} - - -static void -vn_rele_async_cleaner(void) -{ - STAILQ_HEAD(, vnode) vn_tmp_list; - struct vnode *curvnode; - - STAILQ_INIT(&vn_tmp_list); - mtx_lock(&vn_rele_async_lock); - while (vn_rele_async_thread_exit == 0) { - STAILQ_CONCAT(&vn_tmp_list, &vn_rele_async_list); - vn_rele_list_length = 0; - mtx_unlock(&vn_rele_async_lock); - - while (!STAILQ_EMPTY(&vn_tmp_list)) { - curvnode = STAILQ_FIRST(&vn_tmp_list); - - /* STAILQ_REMOVE_HEAD */ - STAILQ_FIRST(&vn_tmp_list) = - ((vnode_link_t *)&curvnode->v_cstart)->stqe_next; - if (STAILQ_FIRST(&vn_tmp_list) == NULL) - vn_tmp_list.stqh_last = &STAILQ_FIRST(&vn_tmp_list); - /***********************/ - vrele(curvnode); - } - mtx_lock(&vn_rele_async_lock); - if (vn_rele_list_length == 0) - cv_timedwait(&vn_rele_async_cv, &vn_rele_async_lock, - hz/10); - } - - vn_rele_async_thread_exit = 0; - cv_broadcast(&vn_rele_async_cv); - mtx_unlock(&vn_rele_async_lock); - thread_exit(); + vp->v_usecount--; + vdropl(vp); } - -static struct proc *vn_rele_async_proc; -static struct kproc_desc up_kp = { - "vaclean", - vn_rele_async_cleaner, - &vn_rele_async_proc -}; -SYSINIT(vaclean, SI_SUB_KTHREAD_UPDATE, SI_ORDER_FIRST, kproc_start, &up_kp); -SYSINIT(vn_rele_async_setup, SI_SUB_VFS, SI_ORDER_FIRST, vn_rele_async_init, NULL); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Aug 17 09:42:34 2009 (r196306) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Aug 17 09:48:34 2009 (r196307) @@ -1199,9 +1199,6 @@ dmu_init(void) void dmu_fini(void) { -#ifdef _KERNEL - vn_rele_async_fini(); -#endif arc_fini(); dnode_fini(); dbuf_fini(); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Mon Aug 17 09:42:34 2009 (r196306) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Mon Aug 17 09:48:34 2009 (r196307) @@ -91,6 +91,9 @@ dsl_pool_open_impl(spa_t *spa, uint64_t mutex_init(&dp->dp_lock, NULL, MUTEX_DEFAULT, NULL); mutex_init(&dp->dp_scrub_cancel_lock, NULL, MUTEX_DEFAULT, NULL); + dp->dp_vnrele_taskq = taskq_create("zfs_vn_rele_taskq", 1, minclsyspri, + 1, 4, 0); + return (dp); } @@ -228,6 +231,7 @@ dsl_pool_close(dsl_pool_t *dp) rw_destroy(&dp->dp_config_rwlock); mutex_destroy(&dp->dp_lock); mutex_destroy(&dp->dp_scrub_cancel_lock); + taskq_destroy(dp->dp_vnrele_taskq); kmem_free(dp, sizeof (dsl_pool_t)); } @@ -611,3 +615,9 @@ dsl_pool_create_origin(dsl_pool_t *dp, d dsl_dataset_rele(ds, FTAG); rw_exit(&dp->dp_config_rwlock); } + +taskq_t * +dsl_pool_vnrele_taskq(dsl_pool_t *dp) +{ + return (dp->dp_vnrele_taskq); +} Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Mon Aug 17 09:42:34 2009 (r196306) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Mon Aug 17 09:48:34 2009 (r196307) @@ -57,6 +57,7 @@ typedef struct dsl_pool { struct dsl_dir *dp_mos_dir; struct dsl_dataset *dp_origin_snap; uint64_t dp_root_dir_obj; + struct taskq *dp_vnrele_taskq; /* No lock needed - sync context only */ blkptr_t dp_meta_rootbp; @@ -119,6 +120,8 @@ int dsl_pool_scrub_clean(dsl_pool_t *dp) void dsl_pool_scrub_sync(dsl_pool_t *dp, dmu_tx_t *tx); void dsl_pool_scrub_restart(dsl_pool_t *dp); +taskq_t *dsl_pool_vnrele_taskq(dsl_pool_t *dp); + #ifdef __cplusplus } #endif Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:42:34 2009 (r196306) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:48:34 2009 (r196307) @@ -924,6 +924,7 @@ zfs_get_done(dmu_buf_t *db, void *vzgd) zgd_t *zgd = (zgd_t *)vzgd; rl_t *rl = zgd->zgd_rl; vnode_t *vp = ZTOV(rl->r_zp); + objset_t *os = rl->r_zp->z_zfsvfs->z_os; int vfslocked; vfslocked = VFS_LOCK_GIANT(vp->v_vfsp); @@ -933,7 +934,7 @@ zfs_get_done(dmu_buf_t *db, void *vzgd) * Release the vnode asynchronously as we currently have the * txg stopped from syncing. */ - VN_RELE_ASYNC(vp, NULL); + VN_RELE_ASYNC(vp, dsl_pool_vnrele_taskq(dmu_objset_pool(os))); zil_add_block(zgd->zgd_zilog, zgd->zgd_bp); kmem_free(zgd, sizeof (zgd_t)); VFS_UNLOCK_GIANT(vfslocked); @@ -968,8 +969,8 @@ zfs_get_data(void *arg, lr_write_t *lr, * Release the vnode asynchronously as we currently have the * txg stopped from syncing. */ - VN_RELE_ASYNC(ZTOV(zp), NULL); - + VN_RELE_ASYNC(ZTOV(zp), + dsl_pool_vnrele_taskq(dmu_objset_pool(os))); return (ENOENT); } @@ -1045,7 +1046,7 @@ out: * Release the vnode asynchronously as we currently have the * txg stopped from syncing. */ - VN_RELE_ASYNC(ZTOV(zp), NULL); + VN_RELE_ASYNC(ZTOV(zp), dsl_pool_vnrele_taskq(dmu_objset_pool(os))); return (error); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h Mon Aug 17 09:42:34 2009 (r196306) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h Mon Aug 17 09:48:34 2009 (r196307) @@ -354,6 +354,11 @@ typedef struct caller_context { } caller_context_t; /* + * Structure tags for function prototypes, defined elsewhere. + */ +struct taskq; + +/* * Flags for VOP_LOOKUP * * Defined in file.h, but also possible, FIGNORECASE @@ -370,6 +375,13 @@ typedef struct caller_context { #define V_RDDIR_ENTFLAGS 0x01 /* request dirent flags */ /* + * Public vnode manipulation functions. + */ +#ifdef _KERNEL + +void vn_rele_async(struct vnode *vp, struct taskq *taskq); + +/* * Extensible vnode attribute (xva) routines: * xva_init() initializes an xvattr_t (zero struct, init mapsize, set AT_XATTR) * xva_getxoptattr() returns a ponter to the xoptattr_t section of xvattr_t @@ -377,10 +389,12 @@ typedef struct caller_context { void xva_init(xvattr_t *); xoptattr_t *xva_getxoptattr(xvattr_t *); /* Get ptr to xoptattr_t */ -struct taskq; -void vn_rele_async(struct vnode *vp, struct taskq *taskq); -void vn_rele_async_fini(void); - +#define VN_RELE_ASYNC(vp, taskq) { \ + vn_rele_async(vp, taskq); \ +} + +#endif /* _KERNEL */ + /* * Flags to VOP_SETATTR/VOP_GETATTR. */ From pjd at FreeBSD.org Mon Aug 17 10:00:19 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Aug 17 10:00:26 2009 Subject: svn commit: r196309 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200908171000.n7HA0Iau058149@svn.freebsd.org> Author: pjd Date: Mon Aug 17 10:00:18 2009 New Revision: 196309 URL: http://svn.freebsd.org/changeset/base/196309 Log: getcwd() (when __getcwd() fails) works by stating current directory, going up (..), calling readdir and looking for previous directory inode. In case of .zfs/ directory this doesn't work, because .zfs/ is hidden by default, so it won't be visible in readdir output. Fix this by implementing VPTOCNP for snapshot directories, so __getcwd() doesn't fail and getcwd() doesn't have to use readdir method. This fixes /bin/pwd from within .zfs/snapshot//. Suggested by: kib Approved by: re (rwatson) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon Aug 17 09:55:58 2009 (r196308) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon Aug 17 10:00:18 2009 (r196309) @@ -1195,6 +1195,48 @@ zfsctl_snapshot_lookup(ap) return (error); } +static int +zfsctl_snapshot_vptocnp(struct vop_vptocnp_args *ap) +{ + zfsvfs_t *zfsvfs = ap->a_vp->v_vfsp->vfs_data; + vnode_t *dvp, *vp; + zfsctl_snapdir_t *sdp; + zfs_snapentry_t *sep; + int error; + + ASSERT(zfsvfs->z_ctldir != NULL); + error = zfsctl_root_lookup(zfsvfs->z_ctldir, "snapshot", &dvp, + NULL, 0, NULL, kcred, NULL, NULL, NULL); + if (error != 0) + return (error); + sdp = dvp->v_data; + + mutex_enter(&sdp->sd_lock); + sep = avl_first(&sdp->sd_snaps); + while (sep != NULL) { + vp = sep->se_root; + if (vp == ap->a_vp) + break; + sep = AVL_NEXT(&sdp->sd_snaps, sep); + } + if (sep == NULL) { + mutex_exit(&sdp->sd_lock); + error = ENOENT; + } else { + size_t len; + + len = strlen(sep->se_name); + *ap->a_buflen -= len; + bcopy(sep->se_name, ap->a_buf + *ap->a_buflen, len); + mutex_exit(&sdp->sd_lock); + vhold(dvp); + *ap->a_vpp = dvp; + } + VN_RELE(dvp); + + return (error); +} + /* * These VP's should never see the light of day. They should always * be covered. @@ -1206,6 +1248,7 @@ static struct vop_vector zfsctl_ops_snap .vop_reclaim = zfsctl_common_reclaim, .vop_getattr = zfsctl_snapshot_getattr, .vop_fid = zfsctl_snapshot_fid, + .vop_vptocnp = zfsctl_snapshot_vptocnp, }; int From pjd at FreeBSD.org Mon Aug 17 10:20:22 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Aug 17 10:20:34 2009 Subject: svn commit: r196311 - head/share/man/man9 Message-ID: <200908171020.n7HAKMDU058615@svn.freebsd.org> Author: pjd Date: Mon Aug 17 10:20:22 2009 New Revision: 196311 URL: http://svn.freebsd.org/changeset/base/196311 Log: Correct typo in the previous commit. Noticed by: pluknet Approved by: re (kib, implicit) Modified: head/share/man/man9/taskqueue.9 Modified: head/share/man/man9/taskqueue.9 ============================================================================== --- head/share/man/man9/taskqueue.9 Mon Aug 17 10:02:31 2009 (r196310) +++ head/share/man/man9/taskqueue.9 Mon Aug 17 10:20:22 2009 (r196311) @@ -188,7 +188,7 @@ The .Fn taskqueue_member function returns .No 1 -is the given thread +if the given thread .Fa td is part of the given taskqeueue .Fa queue From rpaulo at FreeBSD.org Mon Aug 17 12:57:57 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Mon Aug 17 12:58:04 2009 Subject: svn commit: r196316 - head/sys/net80211 Message-ID: <200908171257.n7HCvveb078164@svn.freebsd.org> Author: rpaulo Date: Mon Aug 17 12:57:57 2009 New Revision: 196316 URL: http://svn.freebsd.org/changeset/base/196316 Log: Fix a typo in ifdef mesh support. This would make mesh unworkable if TDMA support was compiled out. Approved by: re (kib) Modified: head/sys/net80211/ieee80211_input.c Modified: head/sys/net80211/ieee80211_input.c ============================================================================== --- head/sys/net80211/ieee80211_input.c Mon Aug 17 12:37:06 2009 (r196315) +++ head/sys/net80211/ieee80211_input.c Mon Aug 17 12:57:57 2009 (r196316) @@ -524,7 +524,7 @@ ieee80211_parse_beacon(struct ieee80211_ case IEEE80211_ELEMID_HTINFO: scan->htinfo = frm; break; -#ifdef IEEE80211_SUPPORT_TDMA +#ifdef IEEE80211_SUPPORT_MESH case IEEE80211_ELEMID_MESHID: scan->meshid = frm; break; From kib at FreeBSD.org Mon Aug 17 13:27:56 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Mon Aug 17 13:28:03 2009 Subject: svn commit: r196318 - head/sys/amd64/amd64 Message-ID: <200908171327.n7HDRuxs078877@svn.freebsd.org> Author: kib Date: Mon Aug 17 13:27:55 2009 New Revision: 196318 URL: http://svn.freebsd.org/changeset/base/196318 Log: Correct a critical accounting error in pmap_demote_pde(). Specifically, when pmap_demote_pde() allocates a page table page to implement a user-space demotion, it must increment the pmap's resident page count. Not doing so, can lead to an underflow during address space termination that causes pmap_remove() to exit prematurely, before it has destroyed all of the mappings within the specified range. The ultimate effect or symptom of this error is an assertion failure in vm_page_free_toq() because the page being freed is still mapped. This error is only possible when superpage promotion is enabled. Thus, it only affects FreeBSD versions greater than 7.2. Tested by: pho, alc Reviewed by: alc Approved by: re (rwatson) MFC after: 1 week Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Aug 17 13:00:32 2009 (r196317) +++ head/sys/amd64/amd64/pmap.c Mon Aug 17 13:27:55 2009 (r196318) @@ -2261,6 +2261,8 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t " in pmap %p", va, pmap); return (FALSE); } + if (va < VM_MAXUSER_ADDRESS) + pmap->pm_stats.resident_count++; } mptepa = VM_PAGE_TO_PHYS(mpte); firstpte = (pt_entry_t *)PHYS_TO_DMAP(mptepa); From jhb at FreeBSD.org Mon Aug 17 14:38:59 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Mon Aug 17 14:39:11 2009 Subject: svn commit: r196322 - in head/sys: dev/cxgb modules/dtrace/dtnfsclient modules/ip6_mroute_mod modules/ipmi/ipmi_linux netinet/ipfw xen Message-ID: <200908171438.n7HEcxLr080551@svn.freebsd.org> Author: jhb Date: Mon Aug 17 14:38:59 2009 New Revision: 196322 URL: http://svn.freebsd.org/changeset/base/196322 Log: Purge mergeinfo in sys/ that is either empty or a subset of the parent mergeinfo on sys/ itself. Approved by: re (mergeinfo blanket) Modified: head/sys/dev/cxgb/ (props changed) head/sys/modules/dtrace/dtnfsclient/ (props changed) head/sys/modules/ip6_mroute_mod/ (props changed) head/sys/modules/ipmi/ipmi_linux/ (props changed) head/sys/netinet/ipfw/ip_dummynet.c (props changed) head/sys/netinet/ipfw/ip_fw2.c (props changed) head/sys/netinet/ipfw/ip_fw_nat.c (props changed) head/sys/netinet/ipfw/ip_fw_pfil.c (props changed) head/sys/xen/evtchn.h (props changed) head/sys/xen/hypervisor.h (props changed) head/sys/xen/xen_intr.h (props changed) From jhb at FreeBSD.org Mon Aug 17 14:53:21 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Mon Aug 17 14:53:28 2009 Subject: svn commit: r196324 - head/sys/dev/ata Message-ID: <200908171453.n7HErK7V081047@svn.freebsd.org> Author: jhb Date: Mon Aug 17 14:53:20 2009 New Revision: 196324 URL: http://svn.freebsd.org/changeset/base/196324 Log: Remove bogus mergeinfo claiming that change 185357 from head/sys was merged into head/sys/dev/ata. The mergeinfo was added as a side effect of another change and not as part of a merge. The rest of the mergeinfo on dev/ata was a valid subset of the parent mergeinfo on sys/. Approved by: re (mergeinfo blanket) Modified: head/sys/dev/ata/ (props changed) From jhay at FreeBSD.org Mon Aug 17 15:19:03 2009 From: jhay at FreeBSD.org (John Hay) Date: Mon Aug 17 15:19:09 2009 Subject: svn commit: r196326 - head/sys/boot/i386/gptboot Message-ID: <200908171519.n7HFJ351081727@svn.freebsd.org> Author: jhay Date: Mon Aug 17 15:19:03 2009 New Revision: 196326 URL: http://svn.freebsd.org/changeset/base/196326 Log: Fix parse() so that the partition to boot (load /boot/loader) from can be set. The syntax as printed in main() is used: 0:ad(0p3)/boot/loader Reviewed by: jhb Approved by: re (kib) Modified: head/sys/boot/i386/gptboot/gptboot.c Modified: head/sys/boot/i386/gptboot/gptboot.c ============================================================================== --- head/sys/boot/i386/gptboot/gptboot.c Mon Aug 17 14:53:59 2009 (r196325) +++ head/sys/boot/i386/gptboot/gptboot.c Mon Aug 17 15:19:03 2009 (r196326) @@ -466,16 +466,13 @@ parse(void) dsk.type = i; arg += 3; dsk.unit = *arg - '0'; - if (arg[1] != ',' || dsk.unit > 9) + if (arg[1] != 'p' || dsk.unit > 9) return -1; arg += 2; - dsk.part = -1; - if (arg[1] == ',') { - dsk.part = *arg - '0'; - if (dsk.part < 1 || dsk.part > 9) - return -1; - arg += 2; - } + dsk.part = *arg - '0'; + if (dsk.part < 1 || dsk.part > 9) + return -1; + arg++; if (arg[0] != ')') return -1; arg++; From sam at errno.com Mon Aug 17 15:36:13 2009 From: sam at errno.com (Sam Leffler) Date: Mon Aug 17 15:36:24 2009 Subject: svn commit: r196293 - head/sys/kern In-Reply-To: <200908170842.n7H8gYo5054777@svn.freebsd.org> References: <200908170842.n7H8gYo5054777@svn.freebsd.org> Message-ID: <4A8978EC.101@errno.com> Pawel Jakub Dawidek wrote: > Author: pjd > Date: Mon Aug 17 08:42:34 2009 > New Revision: 196293 > URL: http://svn.freebsd.org/changeset/base/196293 > > Log: > Because taskqueue_run() can drop tq_mutex, we need to check if the > TQ_FLAGS_ACTIVE flag wasn't removed in the meantime, which means we missed a > wakeup. So this would leave a task q thread running? Can you describe the scenario that demonstrated this problem? Sam From jhb at FreeBSD.org Mon Aug 17 15:39:45 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Mon Aug 17 15:39:57 2009 Subject: svn commit: r196327 - in head/sys/dev/xen: netfront xenpci Message-ID: <200908171539.n7HFdjXD082196@svn.freebsd.org> Author: jhb Date: Mon Aug 17 15:39:45 2009 New Revision: 196327 URL: http://svn.freebsd.org/changeset/base/196327 Log: - Remove self-referential mergeinfo from xen/netfront and xen/xenpci that claims those directories were merged into themselves. - Remove mergeinfo on xen/xenpci that claims the stable/7 xenpci was merged into head. Approved by: re (mergeinfo blanket) Modified: head/sys/dev/xen/netfront/ (props changed) head/sys/dev/xen/xenpci/ (props changed) From jhb at FreeBSD.org Mon Aug 17 15:50:11 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Mon Aug 17 15:50:21 2009 Subject: svn commit: r196330 - head/sys/netipx Message-ID: <200908171550.n7HFoAK1082555@svn.freebsd.org> Author: jhb Date: Mon Aug 17 15:50:10 2009 New Revision: 196330 URL: http://svn.freebsd.org/changeset/base/196330 Log: Remove the spx_usrreq.c mergeinfo from spx_reass.c. Future changes to spx_usrreq.c won't be merged to spx_reass.c which is what this would help with. Approved by: re (blanket mergeinfo), rwatson Modified: head/sys/netipx/spx_reass.c (props changed) From rmacklem at FreeBSD.org Mon Aug 17 16:12:29 2009 From: rmacklem at FreeBSD.org (Rick Macklem) Date: Mon Aug 17 16:12:41 2009 Subject: svn commit: r196332 - head/sys/fs/nfsclient Message-ID: <200908171612.n7HGCTIL083163@svn.freebsd.org> Author: rmacklem Date: Mon Aug 17 16:12:28 2009 New Revision: 196332 URL: http://svn.freebsd.org/changeset/base/196332 Log: Apply the same patch as r196205 for nfs_upgrade_lock() and nfs_downgrade_lock() to the experimental nfs client. Approved by: re (kensmith), kib (mentor) Modified: head/sys/fs/nfsclient/nfs_clsubs.c Modified: head/sys/fs/nfsclient/nfs_clsubs.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clsubs.c Mon Aug 17 15:51:31 2009 (r196331) +++ head/sys/fs/nfsclient/nfs_clsubs.c Mon Aug 17 16:12:28 2009 (r196332) @@ -129,28 +129,25 @@ int ncl_upgrade_vnlock(struct vnode *vp) { int old_lock; - - if ((old_lock = VOP_ISLOCKED(vp)) != LK_EXCLUSIVE) { - if (old_lock == LK_SHARED) { - /* Upgrade to exclusive lock, this might block */ - vn_lock(vp, LK_UPGRADE | LK_RETRY); - } else { - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - } + + ASSERT_VOP_LOCKED(vp, "ncl_upgrade_vnlock"); + old_lock = VOP_ISLOCKED(vp); + if (old_lock != LK_EXCLUSIVE) { + KASSERT(old_lock == LK_SHARED, + ("ncl_upgrade_vnlock: wrong old_lock %d", old_lock)); + /* Upgrade to exclusive lock, this might block */ + vn_lock(vp, LK_UPGRADE | LK_RETRY); } - return old_lock; + return (old_lock); } void ncl_downgrade_vnlock(struct vnode *vp, int old_lock) { if (old_lock != LK_EXCLUSIVE) { - if (old_lock == LK_SHARED) { - /* Downgrade from exclusive lock, this might block */ - vn_lock(vp, LK_DOWNGRADE); - } else { - VOP_UNLOCK(vp, 0); - } + KASSERT(old_lock == LK_SHARED, ("wrong old_lock %d", old_lock)); + /* Downgrade from exclusive lock. */ + vn_lock(vp, LK_DOWNGRADE | LK_RETRY); } } From marcel at FreeBSD.org Mon Aug 17 16:16:46 2009 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Mon Aug 17 16:16:52 2009 Subject: svn commit: r196333 - head/sys/geom/part Message-ID: <200908171616.n7HGGkwc083377@svn.freebsd.org> Author: marcel Date: Mon Aug 17 16:16:46 2009 New Revision: 196333 URL: http://svn.freebsd.org/changeset/base/196333 Log: The start of the EFI GPT partition in the PMBR can always be represented by CHS addressing. Don't define these fields as 0xff, but rather define them correctly. This prevents boot problems on PCs where GPT is being used. PR: 115406 Submitted by: Kent Hauser Approved by: re (kib) Modified: head/sys/geom/part/g_part_gpt.c Modified: head/sys/geom/part/g_part_gpt.c ============================================================================== --- head/sys/geom/part/g_part_gpt.c Mon Aug 17 16:12:28 2009 (r196332) +++ head/sys/geom/part/g_part_gpt.c Mon Aug 17 16:16:46 2009 (r196333) @@ -409,9 +409,9 @@ g_part_gpt_create(struct g_part_table *b last = (pp->mediasize / pp->sectorsize) - 1; le16enc(table->mbr + DOSMAGICOFFSET, DOSMAGIC); - table->mbr[DOSPARTOFF + 1] = 0xff; /* shd */ - table->mbr[DOSPARTOFF + 2] = 0xff; /* ssect */ - table->mbr[DOSPARTOFF + 3] = 0xff; /* scyl */ + table->mbr[DOSPARTOFF + 1] = 0x01; /* shd */ + table->mbr[DOSPARTOFF + 2] = 0x01; /* ssect */ + table->mbr[DOSPARTOFF + 3] = 0x00; /* scyl */ table->mbr[DOSPARTOFF + 4] = 0xee; /* typ */ table->mbr[DOSPARTOFF + 5] = 0xff; /* ehd */ table->mbr[DOSPARTOFF + 6] = 0xff; /* esect */ From attilio at FreeBSD.org Mon Aug 17 16:17:21 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Mon Aug 17 16:17:34 2009 Subject: svn commit: r196334 - in head/sys: kern sys Message-ID: <200908171617.n7HGHLJs083432@svn.freebsd.org> Author: attilio Date: Mon Aug 17 16:17:21 2009 New Revision: 196334 URL: http://svn.freebsd.org/changeset/base/196334 Log: * Change the scope of the ASSERT_ATOMIC_LOAD() from a generic check to a pointer-fetching specific operation check. Consequently, rename the operation ASSERT_ATOMIC_LOAD_PTR(). * Fix the implementation of ASSERT_ATOMIC_LOAD_PTR() by checking directly alignment on the word boundry, for all the given specific architectures. That's a bit too strict for some common case, but it assures safety. * Add a comment explaining the scope of the macro * Add a new stub in the lockmgr specific implementation Tested by: marcel (initial version), marius Reviewed by: rwatson, jhb (comment specific review) Approved by: re (kib) Modified: head/sys/kern/kern_lock.c head/sys/kern/kern_mutex.c head/sys/kern/kern_rwlock.c head/sys/kern/kern_sx.c head/sys/sys/systm.h Modified: head/sys/kern/kern_lock.c ============================================================================== --- head/sys/kern/kern_lock.c Mon Aug 17 16:16:46 2009 (r196333) +++ head/sys/kern/kern_lock.c Mon Aug 17 16:17:21 2009 (r196334) @@ -334,6 +334,9 @@ lockinit(struct lock *lk, int pri, const int iflags; MPASS((flags & ~LK_INIT_MASK) == 0); + ASSERT_ATOMIC_LOAD_PTR(lk->lk_lock, + ("%s: lockmgr not aligned for %s: %p", __func__, wmesg, + &lk->lk_lock)); iflags = LO_SLEEPABLE | LO_UPGRADABLE; if (flags & LK_CANRECURSE) Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Mon Aug 17 16:16:46 2009 (r196333) +++ head/sys/kern/kern_mutex.c Mon Aug 17 16:17:21 2009 (r196334) @@ -783,8 +783,9 @@ mtx_init(struct mtx *m, const char *name MPASS((opts & ~(MTX_SPIN | MTX_QUIET | MTX_RECURSE | MTX_NOWITNESS | MTX_DUPOK | MTX_NOPROFILE)) == 0); - ASSERT_ATOMIC_LOAD(m->mtx_lock, ("%s: mtx_lock not aligned for %s: %p", - __func__, name, &m->mtx_lock)); + ASSERT_ATOMIC_LOAD_PTR(m->mtx_lock, + ("%s: mtx_lock not aligned for %s: %p", __func__, name, + &m->mtx_lock)); #ifdef MUTEX_DEBUG /* Diagnostic and error correction */ Modified: head/sys/kern/kern_rwlock.c ============================================================================== --- head/sys/kern/kern_rwlock.c Mon Aug 17 16:16:46 2009 (r196333) +++ head/sys/kern/kern_rwlock.c Mon Aug 17 16:17:21 2009 (r196334) @@ -174,8 +174,9 @@ rw_init_flags(struct rwlock *rw, const c MPASS((opts & ~(RW_DUPOK | RW_NOPROFILE | RW_NOWITNESS | RW_QUIET | RW_RECURSE)) == 0); - ASSERT_ATOMIC_LOAD(rw->rw_lock, ("%s: rw_lock not aligned for %s: %p", - __func__, name, &rw->rw_lock)); + ASSERT_ATOMIC_LOAD_PTR(rw->rw_lock, + ("%s: rw_lock not aligned for %s: %p", __func__, name, + &rw->rw_lock)); flags = LO_UPGRADABLE; if (opts & RW_DUPOK) Modified: head/sys/kern/kern_sx.c ============================================================================== --- head/sys/kern/kern_sx.c Mon Aug 17 16:16:46 2009 (r196333) +++ head/sys/kern/kern_sx.c Mon Aug 17 16:17:21 2009 (r196334) @@ -205,8 +205,9 @@ sx_init_flags(struct sx *sx, const char MPASS((opts & ~(SX_QUIET | SX_RECURSE | SX_NOWITNESS | SX_DUPOK | SX_NOPROFILE | SX_NOADAPTIVE)) == 0); - ASSERT_ATOMIC_LOAD(sx->sx_lock, ("%s: sx_lock not aligned for %s: %p", - __func__, description, &sx->sx_lock)); + ASSERT_ATOMIC_LOAD_PTR(sx->sx_lock, + ("%s: sx_lock not aligned for %s: %p", __func__, description, + &sx->sx_lock)); flags = LO_SLEEPABLE | LO_UPGRADABLE; if (opts & SX_DUPOK) Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Mon Aug 17 16:16:46 2009 (r196333) +++ head/sys/sys/systm.h Mon Aug 17 16:17:21 2009 (r196334) @@ -89,9 +89,16 @@ extern int maxusers; /* system tune hin #define __CTASSERT(x, y) typedef char __assert ## y[(x) ? 1 : -1] #endif -#define ASSERT_ATOMIC_LOAD(var,msg) \ - KASSERT(sizeof(var) <= sizeof(uintptr_t) && \ - ALIGN(&(var)) == (uintptr_t)&(var), msg) +/* + * Assert that a pointer can be loaded from memory atomically. + * + * This assertion enforces stronger alignment than necessary. For example, + * on some architectures, atomicity for unaligned loads will depend on + * whether or not the load spans multiple cache lines. + */ +#define ASSERT_ATOMIC_LOAD_PTR(var, msg) \ + KASSERT(sizeof(var) == sizeof(void *) && \ + ((uintptr_t)&(var) & (sizeof(void *) - 1)) == 0, msg) /* * XXX the hints declarations are even more misplaced than most declarations From xcllnt at mac.com Mon Aug 17 16:47:00 2009 From: xcllnt at mac.com (Marcel Moolenaar) Date: Mon Aug 17 16:48:00 2009 Subject: svn commit: r196334 - in head/sys: kern sys In-Reply-To: <200908171617.n7HGHLJs083432@svn.freebsd.org> References: <200908171617.n7HGHLJs083432@svn.freebsd.org> Message-ID: On Aug 17, 2009, at 9:17 AM, Attilio Rao wrote: > Log: > * Change the scope of the ASSERT_ATOMIC_LOAD() from a generic check > to > a pointer-fetching specific operation check. Consequently, rename > the > operation ASSERT_ATOMIC_LOAD_PTR(). Thanks for sticking with it and driving it to conclusion. -- Marcel Moolenaar xcllnt@mac.com From andy at fud.org.nz Mon Aug 17 16:48:07 2009 From: andy at fud.org.nz (Andrew Thompson) Date: Mon Aug 17 16:48:18 2009 Subject: svn commit: r196274 - head/sys/dev/usb In-Reply-To: <200908161413.n7GEDuYN018862@svn.freebsd.org> References: <200908161413.n7GEDuYN018862@svn.freebsd.org> Message-ID: On 16/08/2009, at 16:13, Andrew Thompson wrote: > Author: thompsa > Date: Sun Aug 16 14:13:55 2009 > New Revision: 196274 > URL: http://svn.freebsd.org/changeset/base/196274 > > Log: > Change the usb workers from kernel processes to threads, this is > mostly a > cosmetic change to reduce cruft in the proc table. > > Modified: head/sys/dev/usb/usb_process.c > === > === > === > ===================================================================== > --- head/sys/dev/usb/usb_process.c Sun Aug 16 10:25:58 2009 > (r196273) > +++ head/sys/dev/usb/usb_process.c Sun Aug 16 14:13:55 2009 > (r196274) > @@ -63,10 +63,12 @@ > #endif > > #if (__FreeBSD_version >= 800000) > +static struct proc *usbproc; > #define USB_THREAD_CREATE(f, s, p, ...) \ > - kproc_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__) > + kproc_kthread_add((f), (s), &usbproc, (p), RFHIGHPID, \ > + 0, "usb", __VA_ARGS__) This could also be a nice tidyup for zfs which creates quite a few procs. cheers, Andrew From jhb at FreeBSD.org Mon Aug 17 17:09:15 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Mon Aug 17 17:09:27 2009 Subject: svn commit: r196337 - head/share/man/man7 Message-ID: <200908171709.n7HH9Fa7084709@svn.freebsd.org> Author: jhb Date: Mon Aug 17 17:09:14 2009 New Revision: 196337 URL: http://svn.freebsd.org/changeset/base/196337 Log: Document the newly added SVNCMDARGS, SVNROOT, and SVNBRANCH variables. Approved by: re (kib) Modified: head/share/man/man7/release.7 Modified: head/share/man/man7/release.7 ============================================================================== --- head/share/man/man7/release.7 Mon Aug 17 16:33:53 2009 (r196336) +++ head/share/man/man7/release.7 Mon Aug 17 17:09:14 2009 (r196337) @@ -390,6 +390,35 @@ of the CVS tree .It Va SEPARATE_LIVEFS Store the live file system on its own CD-ROM image rather than placing it on the first disc. +.It Va SVNCMDARGS +Additional arguments for svn +.Ic checkout +and +.Ic switch +commands. +.It Va SVNROOT +The location of the FreeBSD SVN source repository. +If this variable is set, +then the source tree will be extracted using Subversion rather than +CVS. +.It Va SVNBRANCH +The branch to check out from a SVN source repository. +It is specified as a path such as +.Pa head +or +.Pa stable/7 . +If this variable is not set, +then the branch that corresponds to the current value of +.Va RELEASETAG +will be used. +If neither +.Va SVNBRANCH +nor +.Va RELEASETAG +are set, +then the +.Pa head +branch will be used. .It Va TARGET_ARCH The target machine processor architecture. This is analogous to the From kmacy at FreeBSD.org Mon Aug 17 19:09:28 2009 From: kmacy at FreeBSD.org (Kip Macy) Date: Mon Aug 17 19:09:34 2009 Subject: svn commit: r196342 - head/sys/net Message-ID: <200908171909.n7HJ9SqX087647@svn.freebsd.org> Author: kmacy Date: Mon Aug 17 19:09:28 2009 New Revision: 196342 URL: http://svn.freebsd.org/changeset/base/196342 Log: fix netboot issue by disabling flowtable lookups until initialization has been run Reviewed by: rwatson@ Approved by: re@ Modified: head/sys/net/flowtable.c Modified: head/sys/net/flowtable.c ============================================================================== --- head/sys/net/flowtable.c Mon Aug 17 18:11:50 2009 (r196341) +++ head/sys/net/flowtable.c Mon Aug 17 19:09:28 2009 (r196342) @@ -203,6 +203,7 @@ static VNET_DEFINE(int, flowtable_udp_ex static VNET_DEFINE(int, flowtable_fin_wait_expire) = FIN_WAIT_IDLE; static VNET_DEFINE(int, flowtable_tcp_expire) = TCP_IDLE; static VNET_DEFINE(int, flowtable_nmbflows) = 4096; +static VNET_DEFINE(int, flowtable_ready) = 0; #define V_flowtable_enable VNET(flowtable_enable) #define V_flowtable_hits VNET(flowtable_hits) @@ -217,6 +218,7 @@ static VNET_DEFINE(int, flowtable_nmbflo #define V_flowtable_fin_wait_expire VNET(flowtable_fin_wait_expire) #define V_flowtable_tcp_expire VNET(flowtable_tcp_expire) #define V_flowtable_nmbflows VNET(flowtable_nmbflows) +#define V_flowtable_ready VNET(flowtable_ready) SYSCTL_NODE(_net_inet, OID_AUTO, flowtable, CTLFLAG_RD, NULL, "flowtable"); SYSCTL_VNET_INT(_net_inet_flowtable, OID_AUTO, enable, CTLFLAG_RW, @@ -345,7 +347,7 @@ ipv4_flow_lookup_hash_internal(struct mb struct udphdr *uh; struct sctphdr *sh; - if (V_flowtable_enable == 0) + if ((V_flowtable_enable == 0) || (V_flowtable_ready == 0)) return (0); key[1] = key[0] = 0; @@ -799,6 +801,7 @@ flowtable_init(const void *unused __unus NULL, NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET); uma_zone_set_max(V_flow_ipv4_zone, V_flowtable_nmbflows); uma_zone_set_max(V_flow_ipv6_zone, V_flowtable_nmbflows); + V_flowtable_ready = 1; } VNET_SYSINIT(flowtable_init, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY, From pjd at FreeBSD.org Mon Aug 17 21:19:51 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Aug 17 21:20:03 2009 Subject: svn commit: r196293 - head/sys/kern In-Reply-To: <4A8978EC.101@errno.com> References: <200908170842.n7H8gYo5054777@svn.freebsd.org> <4A8978EC.101@errno.com> Message-ID: <20090817211945.GC2298@garage.freebsd.pl> On Mon, Aug 17, 2009 at 08:36:12AM -0700, Sam Leffler wrote: > Pawel Jakub Dawidek wrote: > >Author: pjd > >Date: Mon Aug 17 08:42:34 2009 > >New Revision: 196293 > >URL: http://svn.freebsd.org/changeset/base/196293 > > > >Log: > > Because taskqueue_run() can drop tq_mutex, we need to check if the > > TQ_FLAGS_ACTIVE flag wasn't removed in the meantime, which means we > > missed a > > wakeup. > > So this would leave a task q thread running? [...] Sleeping infinitely to be precise. > [...] Can you describe the > scenario that demonstrated this problem? Once I moved ZFS from taskq ported from OpenSolaris to wrapper around our taskqueue(9), the deadlock was easy to trigger (I experienced it by testing with fsstress). -- Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20090817/6c7d18ca/attachment.pgp From mav at FreeBSD.org Tue Aug 18 08:46:55 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Tue Aug 18 08:47:07 2009 Subject: svn commit: r196352 - in head/sys: cam dev/iscsi/initiator dev/ppbus Message-ID: <200908180846.n7I8kt18009137@svn.freebsd.org> Author: mav Date: Tue Aug 18 08:46:54 2009 New Revision: 196352 URL: http://svn.freebsd.org/changeset/base/196352 Log: Fix iSCSI initiator and vpo driver operation, broken by CAM changes. Reviewed by: scottl, Danny Braniss Approved by: re (rwatson) Modified: head/sys/cam/cam_ccb.h head/sys/cam/cam_xpt.c head/sys/dev/iscsi/initiator/isc_cam.c head/sys/dev/ppbus/vpo.c Modified: head/sys/cam/cam_ccb.h ============================================================================== --- head/sys/cam/cam_ccb.h Mon Aug 17 23:50:57 2009 (r196351) +++ head/sys/cam/cam_ccb.h Tue Aug 18 08:46:54 2009 (r196352) @@ -243,6 +243,7 @@ typedef enum { XPORT_ATA, /* AT Attachment */ XPORT_SAS, /* Serial Attached SCSI */ XPORT_SATA, /* Serial AT Attachment */ + XPORT_ISCSI, /* iSCSI */ } cam_xport; #define PROTO_VERSION_UNKNOWN (UINT_MAX - 1) Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Mon Aug 17 23:50:57 2009 (r196351) +++ head/sys/cam/cam_xpt.c Tue Aug 18 08:46:54 2009 (r196352) @@ -3803,6 +3803,8 @@ xpt_bus_register(struct cam_sim *sim, de case XPORT_SAS: case XPORT_FC: case XPORT_USB: + case XPORT_ISCSI: + case XPORT_PPB: new_bus->xport = scsi_get_xport(); break; case XPORT_ATA: Modified: head/sys/dev/iscsi/initiator/isc_cam.c ============================================================================== --- head/sys/dev/iscsi/initiator/isc_cam.c Mon Aug 17 23:50:57 2009 (r196351) +++ head/sys/dev/iscsi/initiator/isc_cam.c Tue Aug 18 08:46:54 2009 (r196352) @@ -190,6 +190,8 @@ _inq(struct cam_sim *sim, union ccb *ccb strncpy(cpi->hba_vid, "iSCSI", HBA_IDLEN); strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); cpi->unit_number = cam_sim_unit(sim); + cpi->transport = XPORT_ISCSI; + cpi->transport_version = 0; cpi->ccb_h.status = CAM_REQ_CMP; } Modified: head/sys/dev/ppbus/vpo.c ============================================================================== --- head/sys/dev/ppbus/vpo.c Mon Aug 17 23:50:57 2009 (r196351) +++ head/sys/dev/ppbus/vpo.c Tue Aug 18 08:46:54 2009 (r196352) @@ -427,6 +427,8 @@ vpo_action(struct cam_sim *sim, union cc strncpy(cpi->hba_vid, "Iomega", HBA_IDLEN); strncpy(cpi->dev_name, sim->sim_name, DEV_IDLEN); cpi->unit_number = sim->unit_number; + cpi->transport = XPORT_PPB; + cpi->transport_version = 0; cpi->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); From mav at FreeBSD.org Tue Aug 18 09:27:17 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Tue Aug 18 09:27:23 2009 Subject: svn commit: r196353 - head/sys/cam/ata Message-ID: <200908180927.n7I9RHOn010243@svn.freebsd.org> Author: mav Date: Tue Aug 18 09:27:17 2009 New Revision: 196353 URL: http://svn.freebsd.org/changeset/base/196353 Log: Fix copy/paste bug, that requests data read during ATA device probe sequence for ATA_SETFEATURES/ATA_SF_SETXFER command which by definition transfers no data. Most of controllers are irrelevant to this bug, but some nVidia's doesn't. Tested on: current@ Approved by: re (kib) Modified: head/sys/cam/ata/ata_xpt.c Modified: head/sys/cam/ata/ata_xpt.c ============================================================================== --- head/sys/cam/ata/ata_xpt.c Tue Aug 18 08:46:54 2009 (r196352) +++ head/sys/cam/ata/ata_xpt.c Tue Aug 18 09:27:17 2009 (r196353) @@ -370,10 +370,10 @@ probestart(struct cam_periph *periph, un cam_fill_ataio(ataio, 1, probedone, - /*flags*/CAM_DIR_IN, - MSG_SIMPLE_Q_TAG, - /*data_ptr*/(u_int8_t *)ident_buf, - /*dxfer_len*/sizeof(struct ata_params), + /*flags*/CAM_DIR_NONE, + 0, + /*data_ptr*/NULL, + /*dxfer_len*/0, 30 * 1000); ata_36bit_cmd(ataio, ATA_SETFEATURES, ATA_SF_SETXFER, 0, ata_max_mode(ident_buf, ATA_UDMA6, ATA_UDMA6)); From trhodes at FreeBSD.org Tue Aug 18 12:24:27 2009 From: trhodes at FreeBSD.org (Tom Rhodes) Date: Tue Aug 18 12:24:34 2009 Subject: svn commit: r196356 - head/share/man/man7 Message-ID: <200908181224.n7ICORhF017316@svn.freebsd.org> Author: trhodes Date: Tue Aug 18 12:24:27 2009 New Revision: 196356 URL: http://svn.freebsd.org/changeset/base/196356 Log: Document MAKE_DVD and xref svn in ports. Approved by: re@ (kib) Modified: head/share/man/man7/release.7 Modified: head/share/man/man7/release.7 ============================================================================== --- head/share/man/man7/release.7 Tue Aug 18 09:36:25 2009 (r196355) +++ head/share/man/man7/release.7 Tue Aug 18 12:24:27 2009 (r196356) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 12, 2006 +.Dd August 17, 2009 .Dt RELEASE 7 .Os .Sh NAME @@ -332,6 +332,10 @@ patch file. A script that will be run in the .Xr chroot 8 environment immediately after any local patches are applied. +.It Va MAKE_DVD +If defined, build a bootable ISO DVD image in the CD-ROM +stage directory. +This option may not be available for all architectures. .It Va MAKE_ISOS If defined, bootable ISO CD-ROM images will be created from the contents of the CD-ROM stage directory. @@ -503,6 +507,7 @@ make release CHROOTDIR=/local3/release B .Xr install 1 , .Xr make 1 , .Xr patch 1 , +.Xr svn 1 Pq Pa ports/devel/subversion-freebsd , .Xr uname 1 , .Xr md 4 , .Xr make.conf 5 , @@ -540,7 +545,7 @@ effort was spent getting into a shape where it could at least automate most of the tediousness of building a release in a sterile environment. .Pp -With its almost 1000 revisions spread over multiple branches, the +At near 1000 revisions spread over multiple branches, the .Xr cvs 1 log of .Pa src/release/Makefile From pjd at FreeBSD.org Tue Aug 18 13:55:48 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Tue Aug 18 13:56:00 2009 Subject: svn commit: r196358 - in head: share/man/man9 sys/kern sys/sys Message-ID: <200908181355.n7IDtmqT019165@svn.freebsd.org> Author: pjd Date: Tue Aug 18 13:55:48 2009 New Revision: 196358 URL: http://svn.freebsd.org/changeset/base/196358 Log: Remove unused taskqueue_find() function. Reviewed by: dfr Approved by: re (kib) Modified: head/share/man/man9/taskqueue.9 head/sys/kern/subr_taskqueue.c head/sys/sys/taskqueue.h Modified: head/share/man/man9/taskqueue.9 ============================================================================== --- head/share/man/man9/taskqueue.9 Tue Aug 18 13:51:51 2009 (r196357) +++ head/share/man/man9/taskqueue.9 Tue Aug 18 13:55:48 2009 (r196358) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 17, 2009 +.Dd August 18, 2009 .Dt TASKQUEUE 9 .Os .Sh NAME @@ -59,8 +59,6 @@ struct task { .Fn taskqueue_create_fast "const char *name" "int mflags" "taskqueue_enqueue_fn enqueue" "void *context" .Ft void .Fn taskqueue_free "struct taskqueue *queue" -.Ft struct taskqueue * -.Fn taskqueue_find "const char *name" .Ft int .Fn taskqueue_enqueue "struct taskqueue *queue" "struct task *task" .Ft int @@ -115,16 +113,10 @@ should be used in place of .Pp The function .Fn taskqueue_free -should be used to remove the queue from the global list of queues -and free the memory used by the queue. +should be used to free the memory used by the queue. Any tasks that are on the queue will be executed at this time after which the thread servicing the queue will be signaled that it should exit. .Pp -The system maintains a list of all queues which can be searched using -.Fn taskqueue_find . -The first queue whose name matches is returned, otherwise -.Dv NULL . -.Pp To add a task to the list of tasks queued on a taskqueue, call .Fn taskqueue_enqueue with pointers to the queue and task. Modified: head/sys/kern/subr_taskqueue.c ============================================================================== --- head/sys/kern/subr_taskqueue.c Tue Aug 18 13:51:51 2009 (r196357) +++ head/sys/kern/subr_taskqueue.c Tue Aug 18 13:55:48 2009 (r196358) @@ -45,11 +45,8 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_TASKQUEUE, "taskqueue", "Task Queues"); static void *taskqueue_giant_ih; static void *taskqueue_ih; -static STAILQ_HEAD(taskqueue_list, taskqueue) taskqueue_queues; -static struct mtx taskqueue_queues_mutex; struct taskqueue { - STAILQ_ENTRY(taskqueue) tq_link; STAILQ_HEAD(, task) tq_queue; const char *tq_name; taskqueue_enqueue_fn tq_enqueue; @@ -84,8 +81,6 @@ TQ_UNLOCK(struct taskqueue *tq) mtx_unlock(&tq->tq_mutex); } -static void init_taskqueue_list(void *data); - static __inline int TQ_SLEEP(struct taskqueue *tq, void *p, struct mtx *m, int pri, const char *wm, int t) @@ -95,16 +90,6 @@ TQ_SLEEP(struct taskqueue *tq, void *p, return (msleep(p, m, pri, wm, t)); } -static void -init_taskqueue_list(void *data __unused) -{ - - mtx_init(&taskqueue_queues_mutex, "taskqueue list", NULL, MTX_DEF); - STAILQ_INIT(&taskqueue_queues); -} -SYSINIT(taskqueue_list, SI_SUB_INTRINSIC, SI_ORDER_ANY, init_taskqueue_list, - NULL); - static struct taskqueue * _taskqueue_create(const char *name, int mflags, taskqueue_enqueue_fn enqueue, void *context, @@ -124,10 +109,6 @@ _taskqueue_create(const char *name, int queue->tq_flags |= TQ_FLAGS_ACTIVE; mtx_init(&queue->tq_mutex, mtxname, NULL, mtxflags); - mtx_lock(&taskqueue_queues_mutex); - STAILQ_INSERT_TAIL(&taskqueue_queues, queue, tq_link); - mtx_unlock(&taskqueue_queues_mutex); - return queue; } @@ -156,10 +137,6 @@ void taskqueue_free(struct taskqueue *queue) { - mtx_lock(&taskqueue_queues_mutex); - STAILQ_REMOVE(&taskqueue_queues, queue, taskqueue, tq_link); - mtx_unlock(&taskqueue_queues_mutex); - TQ_LOCK(queue); queue->tq_flags &= ~TQ_FLAGS_ACTIVE; taskqueue_run(queue); @@ -169,26 +146,6 @@ taskqueue_free(struct taskqueue *queue) free(queue, M_TASKQUEUE); } -/* - * Returns with the taskqueue locked. - */ -struct taskqueue * -taskqueue_find(const char *name) -{ - struct taskqueue *queue; - - mtx_lock(&taskqueue_queues_mutex); - STAILQ_FOREACH(queue, &taskqueue_queues, tq_link) { - if (strcmp(queue->tq_name, name) == 0) { - TQ_LOCK(queue); - mtx_unlock(&taskqueue_queues_mutex); - return queue; - } - } - mtx_unlock(&taskqueue_queues_mutex); - return NULL; -} - int taskqueue_enqueue(struct taskqueue *queue, struct task *task) { Modified: head/sys/sys/taskqueue.h ============================================================================== --- head/sys/sys/taskqueue.h Tue Aug 18 13:51:51 2009 (r196357) +++ head/sys/sys/taskqueue.h Tue Aug 18 13:55:48 2009 (r196358) @@ -48,7 +48,6 @@ struct thread; */ typedef void (*taskqueue_enqueue_fn)(void *context); -struct proc; struct taskqueue *taskqueue_create(const char *name, int mflags, taskqueue_enqueue_fn enqueue, void *context); @@ -56,7 +55,6 @@ int taskqueue_start_threads(struct taskq const char *name, ...) __printflike(4, 5); int taskqueue_enqueue(struct taskqueue *queue, struct task *task); void taskqueue_drain(struct taskqueue *queue, struct task *task); -struct taskqueue *taskqueue_find(const char *name); void taskqueue_free(struct taskqueue *queue); void taskqueue_run(struct taskqueue *queue); void taskqueue_block(struct taskqueue *queue); From pjd at FreeBSD.org Tue Aug 18 15:21:12 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Tue Aug 18 15:21:18 2009 Subject: svn commit: r196200 - in head: etc/mtree include sys/dev/mfi usr.sbin usr.sbin/mfiutil In-Reply-To: <200908132318.n7DNIjvO015601@svn.freebsd.org> References: <200908132318.n7DNIjvO015601@svn.freebsd.org> Message-ID: <20090818152107.GE1738@garage.freebsd.pl> On Thu, Aug 13, 2009 at 11:18:45PM +0000, Scott Long wrote: > Author: scottl > Date: Thu Aug 13 23:18:45 2009 > New Revision: 196200 > URL: http://svn.freebsd.org/changeset/base/196200 [...] > --- head/etc/mtree/BSD.include.dist Thu Aug 13 19:47:13 2009 (r196199) > +++ head/etc/mtree/BSD.include.dist Thu Aug 13 23:18:45 2009 (r196200) > @@ -104,6 +104,8 @@ > .. > lmc > .. > + mfi > + .. You should use spaces, not tab here. -- Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20090818/0ea1e036/attachment.pgp From sam at errno.com Tue Aug 18 15:26:12 2009 From: sam at errno.com (Sam Leffler) Date: Tue Aug 18 15:26:22 2009 Subject: svn commit: r196358 - in head: share/man/man9 sys/kern sys/sys In-Reply-To: <200908181355.n7IDtmqT019165@svn.freebsd.org> References: <200908181355.n7IDtmqT019165@svn.freebsd.org> Message-ID: <4A8AC814.2070804@errno.com> Pawel Jakub Dawidek wrote: > Author: pjd > Date: Tue Aug 18 13:55:48 2009 > New Revision: 196358 > URL: http://svn.freebsd.org/changeset/base/196358 > > Log: > Remove unused taskqueue_find() function. > > Reviewed by: dfr > Approved by: re (kib) I don't understand why this should be removed (let alone during a code freeze). I can think of several uses for this function including a ddb cmd that takes a taskq name and dumps it's contents. The overhead of maintaining the global list appears minimal. Sam From attilio at freebsd.org Tue Aug 18 18:06:19 2009 From: attilio at freebsd.org (Attilio Rao) Date: Tue Aug 18 18:06:25 2009 Subject: svn commit: r196358 - in head: share/man/man9 sys/kern sys/sys In-Reply-To: <4A8AC814.2070804@errno.com> References: <200908181355.n7IDtmqT019165@svn.freebsd.org> <4A8AC814.2070804@errno.com> Message-ID: <3bbf2fe10908181106u159934b9ofc4c2a5e4793b692@mail.gmail.com> 2009/8/18 Sam Leffler : > Pawel Jakub Dawidek wrote: >> >> Author: pjd >> Date: Tue Aug 18 13:55:48 2009 >> New Revision: 196358 >> URL: http://svn.freebsd.org/changeset/base/196358 >> >> Log: >> Remove unused taskqueue_find() function. >> Reviewed by: dfr >> Approved by: re (kib) > > I don't understand why this should be removed (let alone during a code > freeze). I can think of several uses for this function including a ddb cmd > that takes a taskq name and dumps it's contents. The overhead of > maintaining the global list appears minimal. FWIW, I agree with Sam. Attilio -- Peace can only be achieved by understanding - A. Einstein From pjd at FreeBSD.org Tue Aug 18 18:39:04 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Tue Aug 18 18:39:10 2009 Subject: svn commit: r196358 - in head: share/man/man9 sys/kern sys/sys In-Reply-To: <3bbf2fe10908181106u159934b9ofc4c2a5e4793b692@mail.gmail.com> References: <200908181355.n7IDtmqT019165@svn.freebsd.org> <4A8AC814.2070804@errno.com> <3bbf2fe10908181106u159934b9ofc4c2a5e4793b692@mail.gmail.com> Message-ID: <20090818183858.GB1794@garage.freebsd.pl> On Tue, Aug 18, 2009 at 08:06:17PM +0200, Attilio Rao wrote: > 2009/8/18 Sam Leffler : > > Pawel Jakub Dawidek wrote: > >> > >> Author: pjd > >> Date: Tue Aug 18 13:55:48 2009 > >> New Revision: 196358 > >> URL: http://svn.freebsd.org/changeset/base/196358 > >> > >> Log: > >> Remove unused taskqueue_find() function. > >> Reviewed by: dfr > >> Approved by: re (kib) > > > > I don't understand why this should be removed (let alone during a code > > freeze). I can think of several uses for this function including a ddb cmd > > that takes a taskq name and dumps it's contents. The overhead of > > maintaining the global list appears minimal. > > FWIW, I agree with Sam. The only use I could think of was exactly what Sam suggested - a DDB command and that was the only possible use I found. I decided to propose removal of this KPI, because nobody decided to use it for more than 9 years now and this is a good thing to remove unused code, no? I won't fight for keeping it removed, really. If after 9 years someone will find it useful I'm all for bringing it back. -- Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20090818/a2d7ffbc/attachment.pgp From dougb at FreeBSD.org Tue Aug 18 19:12:19 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Tue Aug 18 19:12:25 2009 Subject: svn commit: r196358 - in head: share/man/man9 sys/kern sys/sys In-Reply-To: <20090818183858.GB1794@garage.freebsd.pl> References: <200908181355.n7IDtmqT019165@svn.freebsd.org> <4A8AC814.2070804@errno.com> <3bbf2fe10908181106u159934b9ofc4c2a5e4793b692@mail.gmail.com> <20090818183858.GB1794@garage.freebsd.pl> Message-ID: <4A8AF6C7.5010707@FreeBSD.org> Pawel Jakub Dawidek wrote: > The only use I could think of was exactly what Sam suggested - a DDB > command and that was the only possible use I found. > > I decided to propose removal of this KPI, because nobody decided to use > it for more than 9 years now and this is a good thing to remove unused > code, no? Not during a freeze/right before a release, no. Doug -- This .signature sanitized for your protection From tuexen at FreeBSD.org Tue Aug 18 19:58:50 2009 From: tuexen at FreeBSD.org (Michael Tuexen) Date: Tue Aug 18 19:58:56 2009 Subject: svn commit: r196364 - head/sys/netinet Message-ID: <200908181958.n7IJwnXP026751@svn.freebsd.org> Author: tuexen Date: Tue Aug 18 19:58:49 2009 New Revision: 196364 URL: http://svn.freebsd.org/changeset/base/196364 Log: Fix a crash when using one-to-one stlye socket in non-blocking mode and there is no listening server. PR: 137795 Approved by: re, rrs (mentor) MFC after:immediately. Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Tue Aug 18 16:23:09 2009 (r196363) +++ head/sys/netinet/sctp_output.c Tue Aug 18 19:58:49 2009 (r196364) @@ -12464,7 +12464,8 @@ sctp_lower_sosend(struct socket *so, error = ENOTCONN; goto out_unlocked; } - hold_tcblock = 0; + SCTP_TCB_LOCK(stcb); + hold_tcblock = 1; SCTP_INP_RUNLOCK(inp); if (addr) { /* Must locate the net structure if addr given */ From pjd at FreeBSD.org Tue Aug 18 20:00:15 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Tue Aug 18 20:00:31 2009 Subject: svn commit: r196358 - in head: share/man/man9 sys/kern sys/sys In-Reply-To: <4A8AF6C7.5010707@FreeBSD.org> References: <200908181355.n7IDtmqT019165@svn.freebsd.org> <4A8AC814.2070804@errno.com> <3bbf2fe10908181106u159934b9ofc4c2a5e4793b692@mail.gmail.com> <20090818183858.GB1794@garage.freebsd.pl> <4A8AF6C7.5010707@FreeBSD.org> Message-ID: <20090818200008.GC1794@garage.freebsd.pl> On Tue, Aug 18, 2009 at 11:45:27AM -0700, Doug Barton wrote: > Pawel Jakub Dawidek wrote: > > > The only use I could think of was exactly what Sam suggested - a DDB > > command and that was the only possible use I found. > > > > I decided to propose removal of this KPI, because nobody decided to use > > it for more than 9 years now and this is a good thing to remove unused > > code, no? > > Not during a freeze/right before a release, no. Then when? Between 8.3 and 8.4 when some 3rd party modules start to use it? -- Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20090818/3a6afd4a/attachment.pgp From scottl at samsco.org Tue Aug 18 20:14:22 2009 From: scottl at samsco.org (Scott Long) Date: Tue Aug 18 20:15:00 2009 Subject: svn commit: r196358 - in head: share/man/man9 sys/kern sys/sys In-Reply-To: <20090818200008.GC1794@garage.freebsd.pl> References: <200908181355.n7IDtmqT019165@svn.freebsd.org> <4A8AC814.2070804@errno.com> <3bbf2fe10908181106u159934b9ofc4c2a5e4793b692@mail.gmail.com> <20090818183858.GB1794@garage.freebsd.pl> <4A8AF6C7.5010707@FreeBSD.org> <20090818200008.GC1794@garage.freebsd.pl> Message-ID: <4A8B0B3C.5060402@samsco.org> Pawel Jakub Dawidek wrote: > On Tue, Aug 18, 2009 at 11:45:27AM -0700, Doug Barton wrote: >> Pawel Jakub Dawidek wrote: >> >>> The only use I could think of was exactly what Sam suggested - a DDB >>> command and that was the only possible use I found. >>> >>> I decided to propose removal of this KPI, because nobody decided to use >>> it for more than 9 years now and this is a good thing to remove unused >>> code, no? >> Not during a freeze/right before a release, no. > > Then when? Between 8.3 and 8.4 when some 3rd party modules start to use it? > Was this code getting in the way of anything? Why are you so insistent to ignore advice like this? Please back this out. You don't unilateraly own all APIs that ZFS uses, and I saw no call for discussion on the taskqueue API. Scott From yongari at FreeBSD.org Tue Aug 18 20:20:16 2009 From: yongari at FreeBSD.org (Pyun YongHyeon) Date: Tue Aug 18 20:20:24 2009 Subject: svn commit: r196366 - head/sys/dev/mii Message-ID: <200908182020.n7IKKFtt027352@svn.freebsd.org> Author: yongari Date: Tue Aug 18 20:20:15 2009 New Revision: 196366 URL: http://svn.freebsd.org/changeset/base/196366 Log: Backout r193289. r193289 restored page select bits to previous value instead of blindly resetting it to 0. However, it seems page select bits of some 88E1116 PHY is initialized to invalid one such that restoring page select bits after programming broke MII register access. The correct solution would be reset page select bits to 0 in PHY attach stage but it would require more testing. Since we're in BETA stage such a change would be dangerous so just back it out. This change should fix nfe(4) breakage on NVIDIA MCP55. Reported by: Ryan Rogers < webmaster <> doghouserepair dot com > Sam Fourman Jr. < sfourman <> gmail dot com > Tested by: Ryan Rogers < webmaster <> doghouserepair dot com > Sam Fourman Jr. < sfourman <> gmail dot com > Approved by: re (kib) Modified: head/sys/dev/mii/e1000phy.c Modified: head/sys/dev/mii/e1000phy.c ============================================================================== --- head/sys/dev/mii/e1000phy.c Tue Aug 18 20:06:00 2009 (r196365) +++ head/sys/dev/mii/e1000phy.c Tue Aug 18 20:20:15 2009 (r196366) @@ -240,13 +240,11 @@ e1000phy_reset(struct mii_softc *sc) if (esc->mii_model == MII_MODEL_MARVELL_E1116 || esc->mii_model == MII_MODEL_MARVELL_E1149) { - page = PHY_READ(sc, E1000_EADR); - /* Select page 2, MAC specific control register. */ PHY_WRITE(sc, E1000_EADR, 2); reg = PHY_READ(sc, E1000_SCR); reg |= E1000_SCR_RGMII_POWER_UP; PHY_WRITE(sc, E1000_SCR, reg); - PHY_WRITE(sc, E1000_EADR, page); + PHY_WRITE(sc, E1000_EADR, 0); } } From kmacy at FreeBSD.org Tue Aug 18 20:28:59 2009 From: kmacy at FreeBSD.org (Kip Macy) Date: Tue Aug 18 20:29:11 2009 Subject: svn commit: r196368 - in head/sys: net netinet Message-ID: <200908182028.n7IKSwJ9027599@svn.freebsd.org> Author: kmacy Date: Tue Aug 18 20:28:58 2009 New Revision: 196368 URL: http://svn.freebsd.org/changeset/base/196368 Log: - change the interface to flowtable_lookup so that we don't rely on the mbuf for obtaining the fib index - check that a cached flow corresponds to the same fib index as the packet for which we are doing the lookup - at interface detach time flush any flows referencing stale rtentrys associated with the interface that is going away (fixes reported panics) - reduce the time between cleans in case the cleaner is running at the time the eventhandler is called and the wakeup is missed less time will elapse before the eventhandler returns - separate per-vnet initialization from global initialization (pointed out by jeli@) Reviewed by: sam@ Approved by: re@ Modified: head/sys/net/flowtable.c head/sys/net/flowtable.h head/sys/netinet/ip_output.c Modified: head/sys/net/flowtable.c ============================================================================== --- head/sys/net/flowtable.c Tue Aug 18 20:25:02 2009 (r196367) +++ head/sys/net/flowtable.c Tue Aug 18 20:28:58 2009 (r196368) @@ -29,6 +29,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "opt_route.h" #include "opt_mpath.h" +#include "opt_ddb.h" #include __FBSDID("$FreeBSD$"); @@ -36,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -66,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include struct ipv4_tuple { uint16_t ip_sport; /* source port */ @@ -94,8 +97,9 @@ union ipv6_flow { struct flentry { volatile uint32_t f_fhash; /* hash flowing forward */ uint16_t f_flags; /* flow flags */ - uint8_t f_pad; /* alignment */ + uint8_t f_pad; uint8_t f_proto; /* protocol */ + uint32_t f_fibnum; /* fib index */ uint32_t f_uptime; /* uptime at last access */ struct flentry *f_next; /* pointer to collision entry */ volatile struct rtentry *f_rt; /* rtentry for flow */ @@ -173,6 +177,10 @@ static VNET_DEFINE(uma_zone_t, flow_ipv6 #define V_flow_ipv4_zone VNET(flow_ipv4_zone) #define V_flow_ipv6_zone VNET(flow_ipv6_zone) +static struct cv flowclean_cv; +static struct mtx flowclean_lock; +static uint32_t flowclean_cycles; + /* * TODO: * - Make flowtable stats per-cpu, aggregated at sysctl call time, @@ -288,10 +296,10 @@ SYSCTL_VNET_PROC(_net_inet_flowtable, OI #ifndef RADIX_MPATH static void -in_rtalloc_ign_wrapper(struct route *ro, uint32_t hash, u_int fib) +in_rtalloc_ign_wrapper(struct route *ro, uint32_t hash, u_int fibnum) { - rtalloc_ign_fib(ro, 0, fib); + rtalloc_ign_fib(ro, 0, fibnum); } #endif @@ -425,7 +433,7 @@ static bitstr_t * flowtable_mask(struct flowtable *ft) { bitstr_t *mask; - + if (ft->ft_flags & FL_PCPU) mask = ft->ft_masks[curcpu]; else @@ -501,7 +509,7 @@ flowtable_set_hashkey(struct flentry *fl static int flowtable_insert(struct flowtable *ft, uint32_t hash, uint32_t *key, - uint8_t proto, struct route *ro, uint16_t flags) + uint8_t proto, uint32_t fibnum, struct route *ro, uint16_t flags) { struct flentry *fle, *fletail, *newfle, **flep; int depth; @@ -564,6 +572,7 @@ skip: fle->f_rt = ro->ro_rt; fle->f_lle = ro->ro_lle; fle->f_fhash = hash; + fle->f_fibnum = fibnum; fle->f_uptime = time_uptime; FL_ENTRY_UNLOCK(ft, hash); return (0); @@ -591,13 +600,13 @@ flowtable_key_equal(struct flentry *fle, } int -flowtable_lookup(struct flowtable *ft, struct mbuf *m, struct route *ro) +flowtable_lookup(struct flowtable *ft, struct mbuf *m, struct route *ro, uint32_t fibnum) { uint32_t key[9], hash; struct flentry *fle; uint16_t flags; uint8_t proto = 0; - int error = 0, fib = 0; + int error = 0; struct rtentry *rt; struct llentry *lle; @@ -640,6 +649,7 @@ keycheck: && fle->f_fhash == hash && flowtable_key_equal(fle, key) && (proto == fle->f_proto) + && (fibnum == fle->f_fibnum) && (rt->rt_flags & RTF_UP) && (rt->rt_ifp != NULL)) { V_flowtable_hits++; @@ -668,10 +678,8 @@ uncached: * of arpresolve with an rt_check variant that expected to * receive the route locked */ - if (m != NULL) - fib = M_GETFIB(m); - ft->ft_rtalloc(ro, hash, fib); + ft->ft_rtalloc(ro, hash, fibnum); if (ro->ro_rt == NULL) error = ENETUNREACH; else { @@ -692,7 +700,7 @@ uncached: ro->ro_rt = NULL; return (ENOENT); } - error = flowtable_insert(ft, hash, key, proto, + error = flowtable_insert(ft, hash, key, proto, fibnum, ro, flags); if (error) { @@ -791,35 +799,6 @@ flowtable_alloc(int nentry, int flags) return (ft); } -static void -flowtable_init(const void *unused __unused) -{ - - V_flow_ipv4_zone = uma_zcreate("ip4flow", sizeof(struct flentry_v4), - NULL, NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET); - V_flow_ipv6_zone = uma_zcreate("ip6flow", sizeof(struct flentry_v6), - NULL, NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET); - uma_zone_set_max(V_flow_ipv4_zone, V_flowtable_nmbflows); - uma_zone_set_max(V_flow_ipv6_zone, V_flowtable_nmbflows); - V_flowtable_ready = 1; -} - -VNET_SYSINIT(flowtable_init, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY, - flowtable_init, NULL); - -#ifdef VIMAGE -static void -flowtable_uninit(const void *unused __unused) -{ - - uma_zdestroy(V_flow_ipv4_zone); - uma_zdestroy(V_flow_ipv6_zone); -} - -VNET_SYSUNINIT(flowtable_uninit, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY, - flowtable_uninit, NULL); -#endif - /* * The rest of the code is devoted to garbage collection of expired entries. * It is a new additon made necessary by the switch to dynamically allocating @@ -973,12 +952,30 @@ flowtable_cleaner(void) } VNET_LIST_RUNLOCK(); + flowclean_cycles++; /* * The 20 second interval between cleaning checks * is arbitrary */ - pause("flowcleanwait", 20*hz); + mtx_lock(&flowclean_lock); + cv_broadcast(&flowclean_cv); + cv_timedwait(&flowclean_cv, &flowclean_lock, 10*hz); + mtx_unlock(&flowclean_lock); + } +} + +static void +flowtable_flush(void *unused __unused) +{ + uint64_t start; + + mtx_lock(&flowclean_lock); + start = flowclean_cycles; + while (start == flowclean_cycles) { + cv_broadcast(&flowclean_cv); + cv_wait(&flowclean_cv, &flowclean_lock); } + mtx_unlock(&flowclean_lock); } static struct kproc_desc flow_kp = { @@ -988,3 +985,159 @@ static struct kproc_desc flow_kp = { }; SYSINIT(flowcleaner, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY, kproc_start, &flow_kp); +static void +flowtable_init_vnet(const void *unused __unused) +{ + + V_flow_ipv4_zone = uma_zcreate("ip4flow", sizeof(struct flentry_v4), + NULL, NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET); + V_flow_ipv6_zone = uma_zcreate("ip6flow", sizeof(struct flentry_v6), + NULL, NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET); + uma_zone_set_max(V_flow_ipv4_zone, V_flowtable_nmbflows); + uma_zone_set_max(V_flow_ipv6_zone, V_flowtable_nmbflows); +} +VNET_SYSINIT(flowtable_init_vnet, SI_SUB_KTHREAD_INIT, SI_ORDER_MIDDLE, + flowtable_init_vnet, NULL); + +static void +flowtable_init(const void *unused __unused) +{ + + cv_init(&flowclean_cv, "flowcleanwait"); + mtx_init(&flowclean_lock, "flowclean lock", NULL, MTX_DEF); + EVENTHANDLER_REGISTER(ifnet_departure_event, flowtable_flush, NULL, + EVENTHANDLER_PRI_ANY); + V_flowtable_ready = 1; +} +SYSINIT(flowtable_init, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY, + flowtable_init, NULL); + + +#ifdef VIMAGE +static void +flowtable_uninit(const void *unused __unused) +{ + + uma_zdestroy(V_flow_ipv4_zone); + uma_zdestroy(V_flow_ipv6_zone); +} + +VNET_SYSUNINIT(flowtable_uninit, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY, + flowtable_uninit, NULL); +#endif + +#ifdef DDB +static bitstr_t * +flowtable_mask_pcpu(struct flowtable *ft, int cpuid) +{ + bitstr_t *mask; + + if (ft->ft_flags & FL_PCPU) + mask = ft->ft_masks[cpuid]; + else + mask = ft->ft_masks[0]; + + return (mask); +} + +static struct flentry ** +flowtable_entry_pcpu(struct flowtable *ft, uint32_t hash, int cpuid) +{ + struct flentry **fle; + int index = (hash % ft->ft_size); + + if (ft->ft_flags & FL_PCPU) { + fle = &ft->ft_table.pcpu[cpuid][index]; + } else { + fle = &ft->ft_table.global[index]; + } + + return (fle); +} + +static void +flow_show(struct flowtable *ft, struct flentry *fle) +{ + int idle_time; + int rt_valid; + + idle_time = (int)(time_uptime - fle->f_uptime); + rt_valid = fle->f_rt != NULL; + db_printf("hash=0x%08x idle_time=%03d rt=%p ifp=%p", + fle->f_fhash, idle_time, + fle->f_rt, rt_valid ? fle->f_rt->rt_ifp : NULL); + if (rt_valid && (fle->f_rt->rt_flags & RTF_UP)) + db_printf(" RTF_UP "); + if (fle->f_flags & FL_STALE) + db_printf(" FL_STALE "); + db_printf("\n"); +} + +static void +flowtable_show(struct flowtable *ft, int cpuid) +{ + int curbit = 0; + struct flentry *fle, **flehead; + bitstr_t *mask, *tmpmask; + + db_printf("cpu: %d\n", cpuid); + mask = flowtable_mask_pcpu(ft, cpuid); + tmpmask = ft->ft_tmpmask; + memcpy(tmpmask, mask, ft->ft_size/8); + /* + * XXX Note to self, bit_ffs operates at the byte level + * and thus adds gratuitous overhead + */ + bit_ffs(tmpmask, ft->ft_size, &curbit); + while (curbit != -1) { + if (curbit >= ft->ft_size || curbit < -1) { + db_printf("warning: bad curbit value %d \n", + curbit); + break; + } + + flehead = flowtable_entry_pcpu(ft, curbit, cpuid); + fle = *flehead; + + while (fle != NULL) { + flow_show(ft, fle); + fle = fle->f_next; + continue; + } + bit_clear(tmpmask, curbit); + bit_ffs(tmpmask, ft->ft_size, &curbit); + } +} + +static void +flowtable_show_vnet(void) +{ + struct flowtable *ft; + int i; + + ft = V_flow_list_head; + while (ft != NULL) { + if (ft->ft_flags & FL_PCPU) { + for (i = 0; i <= mp_maxid; i++) { + if (CPU_ABSENT(i)) + continue; + flowtable_show(ft, i); + } + } else { + flowtable_show(ft, 0); + } + ft = ft->ft_next; + } +} + +DB_SHOW_COMMAND(flowtables, db_show_flowtables) +{ + VNET_ITERATOR_DECL(vnet_iter); + + VNET_FOREACH(vnet_iter) { + CURVNET_SET(vnet_iter); + flowtable_show_vnet(); + CURVNET_RESTORE(); + } +} +#endif Modified: head/sys/net/flowtable.h ============================================================================== --- head/sys/net/flowtable.h Tue Aug 18 20:25:02 2009 (r196367) +++ head/sys/net/flowtable.h Tue Aug 18 20:28:58 2009 (r196368) @@ -49,7 +49,7 @@ struct flowtable *flowtable_alloc(int ne * */ int flowtable_lookup(struct flowtable *ft, struct mbuf *m, - struct route *ro); + struct route *ro, uint32_t fibnum); #endif /* _KERNEL */ #endif Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Tue Aug 18 20:25:02 2009 (r196367) +++ head/sys/netinet/ip_output.c Tue Aug 18 20:28:58 2009 (r196368) @@ -157,7 +157,7 @@ ip_output(struct mbuf *m, struct mbuf *o * longer than that long for the stability of ro_rt. The * flow ID assignment must have happened before this point. */ - if (flowtable_lookup(V_ip_ft, m, ro) == 0) + if (flowtable_lookup(V_ip_ft, m, ro, M_GETFIB(m)) == 0) nortfree = 1; #endif } From pjd at FreeBSD.org Tue Aug 18 20:30:10 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Tue Aug 18 20:30:22 2009 Subject: svn commit: r196358 - in head: share/man/man9 sys/kern sys/sys In-Reply-To: <4A8B0B3C.5060402@samsco.org> References: <200908181355.n7IDtmqT019165@svn.freebsd.org> <4A8AC814.2070804@errno.com> <3bbf2fe10908181106u159934b9ofc4c2a5e4793b692@mail.gmail.com> <20090818183858.GB1794@garage.freebsd.pl> <4A8AF6C7.5010707@FreeBSD.org> <20090818200008.GC1794@garage.freebsd.pl> <4A8B0B3C.5060402@samsco.org> Message-ID: <20090818203004.GF1794@garage.freebsd.pl> On Tue, Aug 18, 2009 at 02:12:44PM -0600, Scott Long wrote: > Was this code getting in the way of anything? Why are you so insistent > to ignore advice like this? Please back this out. You don't > unilateraly own all APIs that ZFS uses, and I saw no call for discussion > on the taskqueue API. 1. I don't insist on keeping it removed, as I already stated. 2. I'm not going to back it out (unless requested by re@), I still see no use for it. The patch was reviewed by re@ and by the author. 3. This has _NOTHING_ to do with ZFS. Now, if someone is willing to use this function, eg. by implementing DDB command that Sam suggested or do _anything_ else useful with it, he is free to bring it back. If someone wants to bring it back and do nothing useful with it, then hey, fine by me as well, really. I see no point to discuss this further. -- Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20090818/402a5ff1/attachment.pgp From sam at errno.com Tue Aug 18 20:55:47 2009 From: sam at errno.com (Sam Leffler) Date: Tue Aug 18 20:55:54 2009 Subject: svn commit: r196368 - in head/sys: net netinet In-Reply-To: <200908182028.n7IKSwJ9027599@svn.freebsd.org> References: <200908182028.n7IKSwJ9027599@svn.freebsd.org> Message-ID: <4A8B1552.6010703@errno.com> Kip Macy wrote: > Author: kmacy > Date: Tue Aug 18 20:28:58 2009 > New Revision: 196368 > URL: http://svn.freebsd.org/changeset/base/196368 > > Log: > - change the interface to flowtable_lookup so that we don't rely on > the mbuf for obtaining the fib index > - check that a cached flow corresponds to the same fib index as the > packet for which we are doing the lookup > - at interface detach time flush any flows referencing stale rtentrys > associated with the interface that is going away (fixes reported > panics) > - reduce the time between cleans in case the cleaner is running at > the time the eventhandler is called and the wakeup is missed less > time will elapse before the eventhandler returns > - separate per-vnet initialization from global initialization > (pointed out by jeli@) - add ddb "show flowtables" cmd From stas at FreeBSD.org Tue Aug 18 21:07:39 2009 From: stas at FreeBSD.org (Stanislav Sedov) Date: Tue Aug 18 21:07:45 2009 Subject: svn commit: r196370 - head/sys/dev/bge Message-ID: <200908182107.n7IL7d3V028466@svn.freebsd.org> Author: stas Date: Tue Aug 18 21:07:39 2009 New Revision: 196370 URL: http://svn.freebsd.org/changeset/base/196370 Log: - Do not try to reevaluate current RX production index on each loop iteration as it can be updated by the card while we process the RX ring forcing us to process RX descriptors for which DMA synchronisation operation has not been performed. This fixes the bug when bge(4) drops packets under high load. Discussed with: yongari, marius Approved by: re (kib) MFC after: 1 week Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Tue Aug 18 20:39:35 2009 (r196369) +++ head/sys/dev/bge/if_bge.c Tue Aug 18 21:07:39 2009 (r196370) @@ -3055,12 +3055,14 @@ bge_rxeof(struct bge_softc *sc) { struct ifnet *ifp; int rx_npkts = 0, stdcnt = 0, jumbocnt = 0; + uint16_t rx_prod, rx_cons; BGE_LOCK_ASSERT(sc); + rx_cons = sc->bge_rx_saved_considx; + rx_prod = sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx; /* Nothing to do. */ - if (sc->bge_rx_saved_considx == - sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx) + if (rx_cons == rx_prod) return (rx_npkts); ifp = sc->bge_ifp; @@ -3073,8 +3075,7 @@ bge_rxeof(struct bge_softc *sc) bus_dmamap_sync(sc->bge_cdata.bge_rx_jumbo_ring_tag, sc->bge_cdata.bge_rx_jumbo_ring_map, BUS_DMASYNC_POSTREAD); - while (sc->bge_rx_saved_considx != - sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx) { + while (rx_cons != rx_prod) { struct bge_rx_bd *cur_rx; uint32_t rxidx; struct mbuf *m = NULL; @@ -3089,11 +3090,10 @@ bge_rxeof(struct bge_softc *sc) } #endif - cur_rx = - &sc->bge_ldata.bge_rx_return_ring[sc->bge_rx_saved_considx]; + cur_rx = &sc->bge_ldata.bge_rx_return_ring[rx_cons]; rxidx = cur_rx->bge_idx; - BGE_INC(sc->bge_rx_saved_considx, sc->bge_return_ring_cnt); + BGE_INC(rx_cons, sc->bge_return_ring_cnt); if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING && cur_rx->bge_flags & BGE_RXBDFLAG_VLAN_TAG) { @@ -3207,6 +3207,7 @@ bge_rxeof(struct bge_softc *sc) bus_dmamap_sync(sc->bge_cdata.bge_rx_jumbo_ring_tag, sc->bge_cdata.bge_rx_jumbo_ring_map, BUS_DMASYNC_PREWRITE); + sc->bge_rx_saved_considx = rx_cons; bge_writembx(sc, BGE_MBX_RX_CONS0_LO, sc->bge_rx_saved_considx); if (stdcnt) bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, sc->bge_std); From mlaier at FreeBSD.org Wed Aug 19 00:10:11 2009 From: mlaier at FreeBSD.org (Max Laier) Date: Wed Aug 19 00:10:23 2009 Subject: svn commit: r196372 - head/sys/contrib/pf/net Message-ID: <200908190010.n7J0ABEk032189@svn.freebsd.org> Author: mlaier Date: Wed Aug 19 00:10:10 2009 New Revision: 196372 URL: http://svn.freebsd.org/changeset/base/196372 Log: If we cannot immediately get the pf_consistency_lock in the purge thread, restart the scan after acquiring the lock the hard way. Otherwise we might end up with a dead reference. Reported by: pfsense Reviewed by: eri Initial patch by: eri Tested by: pfsense Approved by: re (kib) Modified: head/sys/contrib/pf/net/pf.c head/sys/contrib/pf/net/pfvar.h Modified: head/sys/contrib/pf/net/pf.c ============================================================================== --- head/sys/contrib/pf/net/pf.c Tue Aug 18 21:13:00 2009 (r196371) +++ head/sys/contrib/pf/net/pf.c Wed Aug 19 00:10:10 2009 (r196372) @@ -971,6 +971,9 @@ void pf_purge_thread(void *v) { int nloops = 0, s; +#ifdef __FreeBSD__ + int locked; +#endif for (;;) { tsleep(pf_purge_thread, PWAIT, "pftm", 1 * hz); @@ -978,14 +981,19 @@ pf_purge_thread(void *v) #ifdef __FreeBSD__ sx_slock(&pf_consistency_lock); PF_LOCK(); + locked = 0; if (pf_end_threads) { - pf_purge_expired_states(pf_status.states); + PF_UNLOCK(); + sx_sunlock(&pf_consistency_lock); + sx_xlock(&pf_consistency_lock); + PF_LOCK(); + pf_purge_expired_states(pf_status.states, 1); pf_purge_expired_fragments(); - pf_purge_expired_src_nodes(0); + pf_purge_expired_src_nodes(1); pf_end_threads++; - sx_sunlock(&pf_consistency_lock); + sx_xunlock(&pf_consistency_lock); PF_UNLOCK(); wakeup(pf_purge_thread); kproc_exit(0); @@ -994,20 +1002,44 @@ pf_purge_thread(void *v) s = splsoftnet(); /* process a fraction of the state table every second */ +#ifdef __FreeBSD__ + if(!pf_purge_expired_states(1 + (pf_status.states + / pf_default_rule.timeout[PFTM_INTERVAL]), 0)) { + PF_UNLOCK(); + sx_sunlock(&pf_consistency_lock); + sx_xlock(&pf_consistency_lock); + PF_LOCK(); + locked = 1; + + pf_purge_expired_states(1 + (pf_status.states + / pf_default_rule.timeout[PFTM_INTERVAL]), 1); + } +#else pf_purge_expired_states(1 + (pf_status.states / pf_default_rule.timeout[PFTM_INTERVAL])); +#endif /* purge other expired types every PFTM_INTERVAL seconds */ if (++nloops >= pf_default_rule.timeout[PFTM_INTERVAL]) { pf_purge_expired_fragments(); - pf_purge_expired_src_nodes(0); + if (!pf_purge_expired_src_nodes(locked)) { + PF_UNLOCK(); + sx_sunlock(&pf_consistency_lock); + sx_xlock(&pf_consistency_lock); + PF_LOCK(); + locked = 1; + pf_purge_expired_src_nodes(1); + } nloops = 0; } splx(s); #ifdef __FreeBSD__ PF_UNLOCK(); - sx_sunlock(&pf_consistency_lock); + if (locked) + sx_xunlock(&pf_consistency_lock); + else + sx_sunlock(&pf_consistency_lock); #endif } } @@ -1056,8 +1088,13 @@ pf_state_expires(const struct pf_state * return (state->expire + timeout); } +#ifdef __FreeBSD__ +int +pf_purge_expired_src_nodes(int waslocked) +#else void pf_purge_expired_src_nodes(int waslocked) +#endif { struct pf_src_node *cur, *next; int locked = waslocked; @@ -1068,12 +1105,8 @@ pf_purge_expired_src_nodes(int waslocked if (cur->states <= 0 && cur->expire <= time_second) { if (! locked) { #ifdef __FreeBSD__ - if (!sx_try_upgrade(&pf_consistency_lock)) { - PF_UNLOCK(); - sx_sunlock(&pf_consistency_lock); - sx_xlock(&pf_consistency_lock); - PF_LOCK(); - } + if (!sx_try_upgrade(&pf_consistency_lock)) + return (0); #else rw_enter_write(&pf_consistency_lock); #endif @@ -1100,6 +1133,10 @@ pf_purge_expired_src_nodes(int waslocked #else rw_exit_write(&pf_consistency_lock); #endif + +#ifdef __FreeBSD__ + return (1); +#endif } void @@ -1202,12 +1239,21 @@ pf_free_state(struct pf_state *cur) pf_status.states--; } +#ifdef __FreeBSD__ +int +pf_purge_expired_states(u_int32_t maxcheck, int waslocked) +#else void pf_purge_expired_states(u_int32_t maxcheck) +#endif { static struct pf_state *cur = NULL; struct pf_state *next; +#ifdef __FreeBSD__ + int locked = waslocked; +#else int locked = 0; +#endif while (maxcheck--) { /* wrap to start of list when we hit the end */ @@ -1224,12 +1270,8 @@ pf_purge_expired_states(u_int32_t maxche /* free unlinked state */ if (! locked) { #ifdef __FreeBSD__ - if (!sx_try_upgrade(&pf_consistency_lock)) { - PF_UNLOCK(); - sx_sunlock(&pf_consistency_lock); - sx_xlock(&pf_consistency_lock); - PF_LOCK(); - } + if (!sx_try_upgrade(&pf_consistency_lock)) + return (0); #else rw_enter_write(&pf_consistency_lock); #endif @@ -1241,12 +1283,8 @@ pf_purge_expired_states(u_int32_t maxche pf_unlink_state(cur); if (! locked) { #ifdef __FreeBSD__ - if (!sx_try_upgrade(&pf_consistency_lock)) { - PF_UNLOCK(); - sx_sunlock(&pf_consistency_lock); - sx_xlock(&pf_consistency_lock); - PF_LOCK(); - } + if (!sx_try_upgrade(&pf_consistency_lock)) + return (0); #else rw_enter_write(&pf_consistency_lock); #endif @@ -1257,10 +1295,13 @@ pf_purge_expired_states(u_int32_t maxche cur = next; } - if (locked) #ifdef __FreeBSD__ + if (!waslocked && locked) sx_downgrade(&pf_consistency_lock); + + return (1); #else + if (locked) rw_exit_write(&pf_consistency_lock); #endif } Modified: head/sys/contrib/pf/net/pfvar.h ============================================================================== --- head/sys/contrib/pf/net/pfvar.h Tue Aug 18 21:13:00 2009 (r196371) +++ head/sys/contrib/pf/net/pfvar.h Wed Aug 19 00:10:10 2009 (r196372) @@ -1593,8 +1593,13 @@ extern struct pool pf_state_pl, pf_alt extern struct pool pf_state_scrub_pl; #endif extern void pf_purge_thread(void *); +#ifdef __FreeBSD__ +extern int pf_purge_expired_src_nodes(int); +extern int pf_purge_expired_states(u_int32_t, int); +#else extern void pf_purge_expired_src_nodes(int); extern void pf_purge_expired_states(u_int32_t); +#endif extern void pf_unlink_state(struct pf_state *); extern void pf_free_state(struct pf_state *); extern int pf_insert_state(struct pfi_kif *, From edwin at FreeBSD.org Wed Aug 19 03:52:16 2009 From: edwin at FreeBSD.org (Edwin Groothuis) Date: Wed Aug 19 03:52:27 2009 Subject: svn commit: r196374 - head/release/doc/en_US.ISO8859-1/relnotes Message-ID: <200908190352.n7J3qFKp041012@svn.freebsd.org> Author: edwin Date: Wed Aug 19 03:52:15 2009 New Revision: 196374 URL: http://svn.freebsd.org/changeset/base/196374 Log: - Make note of the update of tzdata from 2008h to 2009j - Make note of the update of tzcode from 2004a to 2009h Add an extra alert that people who update via source or via freebsd-update will have to run the tzsetup(8) utility. Approved by: re (Kostik) Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Wed Aug 19 00:17:00 2009 (r196373) +++ head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Wed Aug 19 03:52:15 2009 (r196374) @@ -411,6 +411,9 @@ &man.top.1; now supports a flag to provide per-CPU usage statistics. + &man.zdump.8; is now working properly on 64 bit architectures. + + &man.traceroute.8; now has the ability to print the AS number for each hop with the new switch; a new option allows selecting a particular @@ -468,8 +471,15 @@ 8.14.1 to 8.14.3. The timezone database has been updated from - the tzdata2008b release to - the tzdata2008h release. + the tzdata2008h release to + the tzdata2009j release. + + The stdtime part of libc, &man.zdump.8 and &man.zic.8 + have been updated from the tzcode2004a + release to the tzcode2009h release. + If you have upgraded from source or via the &man.freebsd-update.8, + then please run &man.tzsetup.8 to install a new /etc/localtime. + WPA Supplicant has been updated from 0.5.8 to 0.5.10. From brde at optusnet.com.au Wed Aug 19 09:56:00 2009 From: brde at optusnet.com.au (Bruce Evans) Date: Wed Aug 19 09:56:11 2009 Subject: svn commit: r196358 - in head: share/man/man9 sys/kern sys/sys In-Reply-To: <20090818183858.GB1794@garage.freebsd.pl> References: <200908181355.n7IDtmqT019165@svn.freebsd.org> <4A8AC814.2070804@errno.com> <3bbf2fe10908181106u159934b9ofc4c2a5e4793b692@mail.gmail.com> <20090818183858.GB1794@garage.freebsd.pl> Message-ID: <20090819194425.S35105@delplex.bde.org> On Tue, 18 Aug 2009, Pawel Jakub Dawidek wrote: > On Tue, Aug 18, 2009 at 08:06:17PM +0200, Attilio Rao wrote: >> 2009/8/18 Sam Leffler : >>> Pawel Jakub Dawidek wrote: >>>> Log: >>>> Remove unused taskqueue_find() function. >>>> Reviewed by: dfr >>>> Approved by: re (kib) >>> >>> I don't understand why this should be removed (let alone during a code >>> freeze). I can think of several uses for this function including a ddb cmd >>> that takes a taskq name and dumps it's contents. The overhead of >>> maintaining the global list appears minimal. >> >> FWIW, I agree with Sam. > > The only use I could think of was exactly what Sam suggested - a DDB > command and that was the only possible use I found. And ddb cannot call it, since it uses locks unconditionally. Bruce From tuexen at FreeBSD.org Wed Aug 19 12:02:28 2009 From: tuexen at FreeBSD.org (Michael Tuexen) Date: Wed Aug 19 12:02:39 2009 Subject: svn commit: r196376 - head/sys/netinet Message-ID: <200908191202.n7JC2STC053639@svn.freebsd.org> Author: tuexen Date: Wed Aug 19 12:02:28 2009 New Revision: 196376 URL: http://svn.freebsd.org/changeset/base/196376 Log: Fix a bug in the handling of unreliable messages which results in stalled associations. Approved by: re, rrs (mentor) MFC after: immediately Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Wed Aug 19 03:58:12 2009 (r196375) +++ head/sys/netinet/sctputil.c Wed Aug 19 12:02:28 2009 (r196376) @@ -4667,8 +4667,10 @@ sctp_release_pr_sctp_chunk(struct sctp_t stcb->asoc.peers_rwnd += tp1->send_size; stcb->asoc.peers_rwnd += SCTP_BASE_SYSCTL(sctp_peer_chunk_oh); sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, reason, tp1, so_locked); - sctp_m_freem(tp1->data); - tp1->data = NULL; + if (tp1->data) { + sctp_m_freem(tp1->data); + tp1->data = NULL; + } do_wakeup_routine = 1; if (PR_SCTP_BUF_ENABLED(tp1->flags)) { stcb->asoc.sent_queue_cnt_removeable--; @@ -4715,12 +4717,14 @@ next_on_sent: */ chk = tp1; ret_sz += tp1->book_size; - sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, reason, tp1, so_locked); sctp_free_bufspace(stcb, &stcb->asoc, tp1, 1); - sctp_m_freem(tp1->data); + sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, reason, tp1, so_locked); + if (tp1->data) { + sctp_m_freem(tp1->data); + tp1->data = NULL; + } /* No flight involved here book the size to 0 */ tp1->book_size = 0; - tp1->data = NULL; if (tp1->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) { foundeom = 1; } From ed at FreeBSD.org Wed Aug 19 14:30:46 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Wed Aug 19 14:30:58 2009 Subject: svn commit: r196378 - head/sys/kern Message-ID: <200908191430.n7JEUkGt056763@svn.freebsd.org> Author: ed Date: Wed Aug 19 14:30:46 2009 New Revision: 196378 URL: http://svn.freebsd.org/changeset/base/196378 Log: Small changes to the warning message generated by pty(4): - Only print the warning once, instead of filling up the screen. - Use the word "legacy" for the pty_warningcnt description, to prevent confusion. - Use log() instead of printf(). Discussed with: rwatson, jhb Approved by: re (kib) Modified: head/sys/kern/tty_pty.c Modified: head/sys/kern/tty_pty.c ============================================================================== --- head/sys/kern/tty_pty.c Wed Aug 19 12:12:51 2009 (r196377) +++ head/sys/kern/tty_pty.c Wed Aug 19 14:30:46 2009 (r196378) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -47,10 +48,10 @@ __FBSDID("$FreeBSD$"); * si_drv1 inside the cdev to mark whether the PTY is in use. */ -static unsigned int pty_warningcnt = 10; +static unsigned int pty_warningcnt = 1; SYSCTL_UINT(_kern, OID_AUTO, tty_pty_warningcnt, CTLFLAG_RW, &pty_warningcnt, 0, - "Warnings that will be triggered upon PTY allocation"); + "Warnings that will be triggered upon legacy PTY allocation"); static int ptydev_fdopen(struct cdev *dev, int fflags, struct thread *td, struct file *fp) @@ -74,7 +75,7 @@ ptydev_fdopen(struct cdev *dev, int ffla /* Raise a warning when a legacy PTY has been allocated. */ if (pty_warningcnt > 0) { pty_warningcnt--; - printf("pid %d (%s) is using legacy pty devices%s\n", + log(LOG_INFO, "pid %d (%s) is using legacy pty devices%s\n", td->td_proc->p_pid, td->td_name, pty_warningcnt ? "" : " - not logging anymore"); } From raj at FreeBSD.org Wed Aug 19 14:39:08 2009 From: raj at FreeBSD.org (Rafal Jaworowski) Date: Wed Aug 19 14:39:21 2009 Subject: svn commit: r196380 - head/sys/dev/usb Message-ID: <200908191439.n7JEd892057035@svn.freebsd.org> Author: raj Date: Wed Aug 19 14:39:08 2009 New Revision: 196380 URL: http://svn.freebsd.org/changeset/base/196380 Log: Fix USB cache sync operations for platforms with non-coherent DMA. - usb_pc_cpu_invalidate() is called between [consecutive] reads from a device, so a sequence of BUS_DMASYNC_POSTREAD and _PREREAD should be used. Note we cannot use or'ed shorthand ( _POSTREAD | _PREREAD) for BUS_DMASYNC flags, as the low level bus dma sync operation is implementation dependent and we cannot assume the required order of operations to be guaranteed. - usb_pc_cpu_flush() is called before writing to a device, so BUS_DMASYNC_PREWRITE should be used. Submitted by: Grzegorz Bernacki Reviewed by: HPS, arm@, usb@ ML Tested by: HPS, Mike Tancsa Approved by: re (kib) Obtained from: Semihalf Modified: head/sys/dev/usb/usb_busdma.c Modified: head/sys/dev/usb/usb_busdma.c ============================================================================== --- head/sys/dev/usb/usb_busdma.c Wed Aug 19 14:38:43 2009 (r196379) +++ head/sys/dev/usb/usb_busdma.c Wed Aug 19 14:39:08 2009 (r196380) @@ -679,8 +679,8 @@ usb_pc_cpu_invalidate(struct usb_page_ca /* nothing has been loaded into this page cache! */ return; } - bus_dmamap_sync(pc->tag, pc->map, - BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(pc->tag, pc->map, BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(pc->tag, pc->map, BUS_DMASYNC_PREREAD); } /*------------------------------------------------------------------------* @@ -693,8 +693,7 @@ usb_pc_cpu_flush(struct usb_page_cache * /* nothing has been loaded into this page cache! */ return; } - bus_dmamap_sync(pc->tag, pc->map, - BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); + bus_dmamap_sync(pc->tag, pc->map, BUS_DMASYNC_PREWRITE); } /*------------------------------------------------------------------------* From jhb at FreeBSD.org Wed Aug 19 15:17:13 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Wed Aug 19 15:17:19 2009 Subject: svn commit: r196382 - head/contrib/top Message-ID: <200908191517.n7JFHDFr057881@svn.freebsd.org> Author: jhb Date: Wed Aug 19 15:17:13 2009 New Revision: 196382 URL: http://svn.freebsd.org/changeset/base/196382 Log: Explicitly line up the CPU state labels with the calculated starting column that takes into account the width of the largest CPU ID. On systems with > 10 CPUs the labels for the first 10 CPUs were not lined up properly otherwise. Approved by: re (kib) MFC after: 1 week Modified: head/contrib/top/display.c Modified: head/contrib/top/display.c ============================================================================== --- head/contrib/top/display.c Wed Aug 19 14:48:59 2009 (r196381) +++ head/contrib/top/display.c Wed Aug 19 15:17:13 2009 (r196382) @@ -452,6 +452,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) { lastline++; /* now walk thru the names and print the line */ + Move_to(cpustates_column, y_cpustates + cpu); while ((thisname = *names++) != NULL) { if (*thisname != '\0') @@ -543,6 +544,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) { printf("\nCPU %d: ", cpu); lastline++; + Move_to(cpustates_column, y_cpustates + cpu); while ((thisname = *names++) != NULL) { if (*thisname != '\0') From sam at errno.com Wed Aug 19 15:30:39 2009 From: sam at errno.com (Sam Leffler) Date: Wed Aug 19 15:30:45 2009 Subject: svn commit: r196380 - head/sys/dev/usb In-Reply-To: <200908191439.n7JEd892057035@svn.freebsd.org> References: <200908191439.n7JEd892057035@svn.freebsd.org> Message-ID: <4A8C1AA0.20303@errno.com> Rafal Jaworowski wrote: > Author: raj > Date: Wed Aug 19 14:39:08 2009 > New Revision: 196380 > URL: http://svn.freebsd.org/changeset/base/196380 > > Log: > Fix USB cache sync operations for platforms with non-coherent DMA. > > - usb_pc_cpu_invalidate() is called between [consecutive] reads from a device, > so a sequence of BUS_DMASYNC_POSTREAD and _PREREAD should be used. Note we > cannot use or'ed shorthand ( _POSTREAD | _PREREAD) for BUS_DMASYNC flags, as > the low level bus dma sync operation is implementation dependent and we > cannot assume the required order of operations to be guaranteed. > > - usb_pc_cpu_flush() is called before writing to a device, so > BUS_DMASYNC_PREWRITE should be used. > > Submitted by: Grzegorz Bernacki > Reviewed by: HPS, arm@, usb@ ML > Tested by: HPS, Mike Tancsa > Approved by: re (kib) > Obtained from: Semihalf Is this different from the patch I tested on Gateworks 2358 boards which didn't completely resolve problems? Sam From sam at errno.com Wed Aug 19 15:48:54 2009 From: sam at errno.com (Sam Leffler) Date: Wed Aug 19 15:49:00 2009 Subject: svn commit: r196380 - head/sys/dev/usb In-Reply-To: <81BE0575-26B5-4EBE-90D5-4B3DDB42F79F@semihalf.com> References: <200908191439.n7JEd892057035@svn.freebsd.org> <4A8C1AA0.20303@errno.com> <81BE0575-26B5-4EBE-90D5-4B3DDB42F79F@semihalf.com> Message-ID: <4A8C1EE5.3030103@errno.com> Rafal Jaworowski wrote: > > On 2009-08-19, at 17:30, Sam Leffler wrote: > >> Rafal Jaworowski wrote: >>> Author: raj >>> Date: Wed Aug 19 14:39:08 2009 >>> New Revision: 196380 >>> URL: http://svn.freebsd.org/changeset/base/196380 >>> Log: >>> Fix USB cache sync operations for platforms with non-coherent DMA. >>> - usb_pc_cpu_invalidate() is called between [consecutive] reads >>> from a device, >>> so a sequence of BUS_DMASYNC_POSTREAD and _PREREAD should be used. >>> Note we >>> cannot use or'ed shorthand ( _POSTREAD | _PREREAD) for BUS_DMASYNC >>> flags, as >>> the low level bus dma sync operation is implementation dependent >>> and we >>> cannot assume the required order of operations to be guaranteed. >>> - usb_pc_cpu_flush() is called before writing to a device, so >>> BUS_DMASYNC_PREWRITE should be used. >>> Submitted by: Grzegorz Bernacki >>> Reviewed by: HPS, arm@, usb@ ML >>> Tested by: HPS, Mike Tancsa >>> Approved by: re (kib) >>> Obtained from: Semihalf >> >> Is this different from the patch I tested on Gateworks 2358 boards >> which didn't completely resolve problems? > > Hm, not sure what patch you have tested with GW. There was an initial > workaround for this problem from late June time frame, and this commit > is a refined fix identical to the patch posted 05 Aug to arm@. There > were other ARM patches in the meantime involving cache sync, but they > were pmap-related. I'm pretty sure it's the same one and was combined with other changes you describe. Unfortunately reproducing the problem requires an out-of-tree driver so we can't be sure whether all issues are resolved on the platform. Sam From raj at semihalf.com Wed Aug 19 15:55:51 2009 From: raj at semihalf.com (Rafal Jaworowski) Date: Wed Aug 19 15:56:03 2009 Subject: svn commit: r196380 - head/sys/dev/usb In-Reply-To: <4A8C1AA0.20303@errno.com> References: <200908191439.n7JEd892057035@svn.freebsd.org> <4A8C1AA0.20303@errno.com> Message-ID: <81BE0575-26B5-4EBE-90D5-4B3DDB42F79F@semihalf.com> On 2009-08-19, at 17:30, Sam Leffler wrote: > Rafal Jaworowski wrote: >> Author: raj >> Date: Wed Aug 19 14:39:08 2009 >> New Revision: 196380 >> URL: http://svn.freebsd.org/changeset/base/196380 >> Log: >> Fix USB cache sync operations for platforms with non-coherent DMA. >> - usb_pc_cpu_invalidate() is called between [consecutive] reads >> from a device, >> so a sequence of BUS_DMASYNC_POSTREAD and _PREREAD should be >> used. Note we >> cannot use or'ed shorthand ( _POSTREAD | _PREREAD) for >> BUS_DMASYNC flags, as >> the low level bus dma sync operation is implementation dependent >> and we >> cannot assume the required order of operations to be guaranteed. >> - usb_pc_cpu_flush() is called before writing to a device, so >> BUS_DMASYNC_PREWRITE should be used. >> Submitted by: Grzegorz Bernacki >> Reviewed by: HPS, arm@, usb@ ML >> Tested by: HPS, Mike Tancsa >> Approved by: re (kib) >> Obtained from: Semihalf > > Is this different from the patch I tested on Gateworks 2358 boards > which didn't completely resolve problems? Hm, not sure what patch you have tested with GW. There was an initial workaround for this problem from late June time frame, and this commit is a refined fix identical to the patch posted 05 Aug to arm@. There were other ARM patches in the meantime involving cache sync, but they were pmap-related. Rafal From raj at semihalf.com Wed Aug 19 16:04:24 2009 From: raj at semihalf.com (Rafal Jaworowski) Date: Wed Aug 19 16:04:36 2009 Subject: svn commit: r196380 - head/sys/dev/usb In-Reply-To: <4A8C1EE5.3030103@errno.com> References: <200908191439.n7JEd892057035@svn.freebsd.org> <4A8C1AA0.20303@errno.com> <81BE0575-26B5-4EBE-90D5-4B3DDB42F79F@semihalf.com> <4A8C1EE5.3030103@errno.com> Message-ID: On 2009-08-19, at 17:48, Sam Leffler wrote: >>> Is this different from the patch I tested on Gateworks 2358 boards >>> which didn't completely resolve problems? >> Hm, not sure what patch you have tested with GW. There was an >> initial workaround for this problem from late June time frame, and >> this commit is a refined fix identical to the patch posted 05 Aug >> to arm@. There were other ARM patches in the meantime involving >> cache sync, but they were pmap-related. > > I'm pretty sure it's the same one and was combined with other > changes you describe. Unfortunately reproducing the problem > requires an out-of-tree driver so we can't be sure whether all > issues are resolved on the platform. There could still be other issues with the USB stack: we are observing instabilities on some PowerPC machine and EHCI controller, but I don't have a detailed scenario yet. The cache sync routines from this commit were clearly wrong and the fix helps for failing scenarios we were observing on ARM, although in your case it's difficult to say without reproducing. Rafal From marcel at FreeBSD.org Wed Aug 19 16:29:21 2009 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Wed Aug 19 16:29:32 2009 Subject: svn commit: r196383 - head/sbin/bsdlabel Message-ID: <200908191629.n7JGTLo0059421@svn.freebsd.org> Author: marcel Date: Wed Aug 19 16:29:20 2009 New Revision: 196383 URL: http://svn.freebsd.org/changeset/base/196383 Log: Remove the dependency on the kernel -- in particular the gctl request to the GEOM_BSD class -- to translate the absolute offsets in the label to relative ones. This makes bslabel(8) work correctly with GEOM_PART and also when the BSD label is nested under arbitrary partitioning schemes. Inspired by: Eygene Ryabinkin Approved by: re (kib) Modified: head/sbin/bsdlabel/bsdlabel.c Modified: head/sbin/bsdlabel/bsdlabel.c ============================================================================== --- head/sbin/bsdlabel/bsdlabel.c Wed Aug 19 15:17:13 2009 (r196382) +++ head/sbin/bsdlabel/bsdlabel.c Wed Aug 19 16:29:20 2009 (r196383) @@ -118,7 +118,7 @@ static int installboot; /* non-zero if w static int allfields; /* present all fields in edit */ static char const *xxboot; /* primary boot */ -static off_t mbroffset; +static uint32_t lba_offset; #ifndef LABELSECTOR #define LABELSECTOR -1 #endif @@ -403,7 +403,7 @@ writelabel(void) readboot(); for (i = 0; i < lab.d_npartitions; i++) if (lab.d_partitions[i].p_size) - lab.d_partitions[i].p_offset += mbroffset; + lab.d_partitions[i].p_offset += lba_offset; bsd_disklabel_le_enc(bootarea + labeloffset + labelsoffset * secsize, lp); if (alphacksum) { @@ -479,10 +479,9 @@ get_file_parms(int f) static int readlabel(int flag) { + uint32_t lba; int f, i; int error; - struct gctl_req *grq; - char const *errstr; f = open(specname, O_RDONLY); if (f < 0) @@ -510,22 +509,28 @@ readlabel(int flag) if (is_file) return(0); - grq = gctl_get_handle(); - gctl_ro_param(grq, "verb", -1, "read mbroffset"); - gctl_ro_param(grq, "class", -1, "BSD"); - gctl_ro_param(grq, "geom", -1, pname); - gctl_rw_param(grq, "mbroffset", sizeof(mbroffset), &mbroffset); - errstr = gctl_issue(grq); - if (errstr != NULL) { - mbroffset = 0; - gctl_free(grq); - return (error); + + /* + * Compensate for absolute block addressing by finding the + * smallest partition offset and if the offset of the 'c' + * partition is equal to that, subtract it from all offsets. + */ + lba = ~0; + for (i = 0; i < lab.d_npartitions; i++) { + if (lab.d_partitions[i].p_size) + lba = MIN(lba, lab.d_partitions[i].p_offset); } - mbroffset /= lab.d_secsize; - if (lab.d_partitions[RAW_PART].p_offset == mbroffset) - for (i = 0; i < lab.d_npartitions; i++) + if (lba != 0 && lab.d_partitions[RAW_PART].p_offset == lba) { + for (i = 0; i < lab.d_npartitions; i++) { if (lab.d_partitions[i].p_size) - lab.d_partitions[i].p_offset -= mbroffset; + lab.d_partitions[i].p_offset -= lba; + } + /* + * Save the offset so that we can write the label + * back with absolute block addresses. + */ + lba_offset = lba; + } return (error); } From delphij at FreeBSD.org Wed Aug 19 17:59:42 2009 From: delphij at FreeBSD.org (Xin LI) Date: Wed Aug 19 17:59:48 2009 Subject: svn commit: r196386 - head/sys/dev/e1000 Message-ID: <200908191759.n7JHxfJg061294@svn.freebsd.org> Author: delphij Date: Wed Aug 19 17:59:41 2009 New Revision: 196386 URL: http://svn.freebsd.org/changeset/base/196386 Log: Temporarily enhance em(4) and igb(4) hack to take account for IFF_NOARP. Without this changeset there will be no way to prevent these NICs from sending ARP, which is harmful in server farms that is configured as "Direct Server Return" behind a load balancer. A better fix would remove the whole hack completely but it would be later than 8.0-RELEASE. Reviewed by: jfv, yongari Approved by: re (kib) Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Wed Aug 19 17:45:58 2009 (r196385) +++ head/sys/dev/e1000/if_em.c Wed Aug 19 17:59:41 2009 (r196386) @@ -1204,7 +1204,8 @@ em_ioctl(struct ifnet *ifp, u_long comma em_init_locked(adapter); EM_CORE_UNLOCK(adapter); } - arp_ifinit(ifp, ifa); + if (!(ifp->if_flags & IFF_NOARP)) + arp_ifinit(ifp, ifa); } else #endif error = ether_ioctl(ifp, command, data); Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Wed Aug 19 17:45:58 2009 (r196385) +++ head/sys/dev/e1000/if_igb.c Wed Aug 19 17:59:41 2009 (r196386) @@ -952,7 +952,8 @@ igb_ioctl(struct ifnet *ifp, u_long comm igb_init_locked(adapter); IGB_CORE_UNLOCK(adapter); } - arp_ifinit(ifp, ifa); + if (!(ifp->if_flags & IFF_NOARP)) + arp_ifinit(ifp, ifa); } else #endif error = ether_ioctl(ifp, command, data); From kmacy at FreeBSD.org Wed Aug 19 20:13:09 2009 From: kmacy at FreeBSD.org (Kip Macy) Date: Wed Aug 19 20:13:15 2009 Subject: svn commit: r196388 - head/sys/net Message-ID: <200908192013.n7JKD9RD064194@svn.freebsd.org> Author: kmacy Date: Wed Aug 19 20:13:09 2009 New Revision: 196388 URL: http://svn.freebsd.org/changeset/base/196388 Log: This change fixes a comment and addresses a complaint by kib@ by moving a frequently executed flowtable syslog statement from being conditional on bootverbose to conditional on a per-vnet flowtable sysctl. Approved by: re@ Modified: head/sys/net/flowtable.c Modified: head/sys/net/flowtable.c ============================================================================== --- head/sys/net/flowtable.c Wed Aug 19 18:08:50 2009 (r196387) +++ head/sys/net/flowtable.c Wed Aug 19 20:13:09 2009 (r196388) @@ -199,6 +199,7 @@ static uint32_t flowclean_cycles; * - idetach() cleanup for options VIMAGE builds. */ VNET_DEFINE(int, flowtable_enable) = 1; +static VNET_DEFINE(int, flowtable_debug); static VNET_DEFINE(int, flowtable_hits); static VNET_DEFINE(int, flowtable_lookups); static VNET_DEFINE(int, flowtable_misses); @@ -214,6 +215,7 @@ static VNET_DEFINE(int, flowtable_nmbflo static VNET_DEFINE(int, flowtable_ready) = 0; #define V_flowtable_enable VNET(flowtable_enable) +#define V_flowtable_debug VNET(flowtable_debug) #define V_flowtable_hits VNET(flowtable_hits) #define V_flowtable_lookups VNET(flowtable_lookups) #define V_flowtable_misses VNET(flowtable_misses) @@ -229,6 +231,8 @@ static VNET_DEFINE(int, flowtable_ready) #define V_flowtable_ready VNET(flowtable_ready) SYSCTL_NODE(_net_inet, OID_AUTO, flowtable, CTLFLAG_RD, NULL, "flowtable"); +SYSCTL_VNET_INT(_net_inet_flowtable, OID_AUTO, debug, CTLFLAG_RW, + &VNET_NAME(flowtable_debug), 0, "print debug info."); SYSCTL_VNET_INT(_net_inet_flowtable, OID_AUTO, enable, CTLFLAG_RW, &VNET_NAME(flowtable_enable), 0, "enable flowtable caching."); SYSCTL_VNET_INT(_net_inet_flowtable, OID_AUTO, hits, CTLFLAG_RD, @@ -902,7 +906,7 @@ flowtable_free_stale(struct flowtable *f V_flowtable_frees++; fle_free(fle); } - if (bootverbose && count) + if (V_flowtable_debug && count) log(LOG_DEBUG, "freed %d flow entries\n", count); } @@ -954,7 +958,7 @@ flowtable_cleaner(void) flowclean_cycles++; /* - * The 20 second interval between cleaning checks + * The 10 second interval between cleaning checks * is arbitrary */ mtx_lock(&flowclean_lock); From ed at FreeBSD.org Wed Aug 19 20:39:34 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Wed Aug 19 20:39:45 2009 Subject: svn commit: r196390 - in head/sys: amd64/amd64 i386/i386 Message-ID: <200908192039.n7JKdXTt064768@svn.freebsd.org> Author: ed Date: Wed Aug 19 20:39:33 2009 New Revision: 196390 URL: http://svn.freebsd.org/changeset/base/196390 Log: Make the MacBookPro3,1 hardware boot again. Tested by: Patrick Lamaiziere Approved by: re (kib) Modified: head/sys/amd64/amd64/machdep.c head/sys/i386/i386/machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Wed Aug 19 20:17:36 2009 (r196389) +++ head/sys/amd64/amd64/machdep.c Wed Aug 19 20:39:33 2009 (r196390) @@ -217,6 +217,7 @@ cpu_startup(dummy) strncmp(sysenv, "MacBook3,1", 10) == 0 || strncmp(sysenv, "MacBookPro1,1", 13) == 0 || strncmp(sysenv, "MacBookPro1,2", 13) == 0 || + strncmp(sysenv, "MacBookPro3,1", 13) == 0 || strncmp(sysenv, "Macmini1,1", 10) == 0) { if (bootverbose) printf("Disabling LEGACY_USB_EN bit on " Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Wed Aug 19 20:17:36 2009 (r196389) +++ head/sys/i386/i386/machdep.c Wed Aug 19 20:39:33 2009 (r196390) @@ -261,6 +261,7 @@ cpu_startup(dummy) strncmp(sysenv, "MacBook3,1", 10) == 0 || strncmp(sysenv, "MacBookPro1,1", 13) == 0 || strncmp(sysenv, "MacBookPro1,2", 13) == 0 || + strncmp(sysenv, "MacBookPro3,1", 13) == 0 || strncmp(sysenv, "Macmini1,1", 10) == 0) { if (bootverbose) printf("Disabling LEGACY_USB_EN bit on " From simon at FreeBSD.org Wed Aug 19 20:47:32 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Wed Aug 19 20:47:38 2009 Subject: svn commit: r196392 - in head: etc share/man/man5 usr.sbin/freebsd-update Message-ID: <200908192047.n7JKlVCE065020@svn.freebsd.org> Author: simon Date: Wed Aug 19 20:47:31 2009 New Revision: 196392 URL: http://svn.freebsd.org/changeset/base/196392 Log: Add support for backing up the old kernel when installing a new kernel using freebsd-update. This applies to using freebsd-update in "upgrade mode" and normal freebsd-update on a security branch. The backup kernel will be written to /boot/kernel.old, if the directory does not exist, or the directory was created by freebsd-update in a previous backup. Otherwise freebsd-update will generate a new directory name for use by the backup. By default symbol files are not backed up to save diskspace and avoid filling up the root partition. This feature is fully configurable in the freebsd-update config file, but defaults to enabled. MFC after: 1 week (stable/7) Reviewed by: cperciva Approved by: re (kib) Modified: head/etc/freebsd-update.conf head/share/man/man5/freebsd-update.conf.5 head/usr.sbin/freebsd-update/freebsd-update.sh Modified: head/etc/freebsd-update.conf ============================================================================== --- head/etc/freebsd-update.conf Wed Aug 19 20:44:22 2009 (r196391) +++ head/etc/freebsd-update.conf Wed Aug 19 20:47:31 2009 (r196392) @@ -63,3 +63,14 @@ MergeChanges /etc/ /var/named/etc/ /boot # which *might* be installed of which FreeBSD Update should figure out # which actually are installed and upgrade those (StrictComponents no)? # StrictComponents no + +# When installing a new kernel perform a backup of the old one first +# so it is possible to boot the old kernel in case of problems. +# BackupKernel yes + +# If BackupKernel is enabled, the backup kernel is saved to this +# directory. +# BackupKernelDir /boot/kernel.old + +# When backing up a kernel also back up debug symbol files? +# BackupKernelSymbolFiles no Modified: head/share/man/man5/freebsd-update.conf.5 ============================================================================== --- head/share/man/man5/freebsd-update.conf.5 Wed Aug 19 20:44:22 2009 (r196391) +++ head/share/man/man5/freebsd-update.conf.5 Wed Aug 19 20:47:31 2009 (r196392) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 30, 2006 +.Dd August 19, 2009 .Dt FREEBSD-UPDATE.CONF 5 .Os FreeBSD .Sh NAME @@ -48,7 +48,7 @@ error. .Pp The possible options and their meanings are as follows: .Pp -.Bl -tag -width "KeepModifiedMetadata" +.Bl -tag -width ".Cm BackupKernelSymbolFiles" .It Cm KeyPrint The single parameter following this keyword is the SHA256 hash of the RSA key which will be trusted to sign updates. @@ -171,6 +171,54 @@ command is used ("yes"), or merely as a which might be installed, of which .Cm freebsd-update should identify which in fact are present ("no"). +.It Cm BackupKernel +The single parameter following this keyword must be +.Dq yes +or +.Dq no +and specifies whether +.Cm freebsd-update +will create a backup of the old kernel before installing a new kernel. +This backup kernel can be used to recover a system where the newly +installed kernel somehow did not work. +Note that the backup kernel is not reverted to its original state by +the +.Cm freebsd-update +rollback command. +.It Cm BackupKernelDir +This keyword sets the directory which is used to store a backup +kernel, if the BackupKernel feature is enabled. +If the directory already exist, and it was not created by +.Cm freebsd-update , +the directory is skipped. +In the case of the primary directory name not being usable, a number +starting with +.Sq 1 +is appended to the directory name. +Like with the primary directory name, the constructed directory name is +only used if the path name does not exist, or if the directory was +previously created by +.Cm freebsd-update . +If the constructed directory still exist the appended number is +incremented with 1 and the directory search process restarted. +Should the number increment go above 9, +.Cm freebsd-update +will abort. +.It Cm BackupKernelSymbolFiles +The single parameter following this keyword must be +.Dq yes +or +.Dq no +and specifies whether +.Cm freebsd-update +will also backup kernel symbol files, if they exist. +The kernel symbol files takes up a lot of disk space and are not +needed for recovery purposes. +If the symbol files are needed, after recovering a system using the +backup kernel, the +.Cm freebsd-update +rollback command will recreate the symbol files along with the old +kernel. .El .Sh FILES .Bl -tag -width "/etc/freebsd-update.conf" Modified: head/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- head/usr.sbin/freebsd-update/freebsd-update.sh Wed Aug 19 20:44:22 2009 (r196391) +++ head/usr.sbin/freebsd-update/freebsd-update.sh Wed Aug 19 20:47:31 2009 (r196392) @@ -88,7 +88,7 @@ EOF CONFIGOPTIONS="KEYPRINT WORKDIR SERVERNAME MAILTO ALLOWADD ALLOWDELETE KEEPMODIFIEDMETADATA COMPONENTS IGNOREPATHS UPDATEIFUNMODIFIED BASEDIR VERBOSELEVEL TARGETRELEASE STRICTCOMPONENTS MERGECHANGES - IDSIGNOREPATHS" + IDSIGNOREPATHS BACKUPKERNEL BACKUPKERNELDIR BACKUPKERNELSYMBOLFILES" # Set all the configuration options to "". nullconfig () { @@ -308,6 +308,70 @@ config_VerboseLevel () { fi } +config_BackupKernel () { + if [ -z ${BACKUPKERNEL} ]; then + case $1 in + [Yy][Ee][Ss]) + BACKUPKERNEL=yes + ;; + [Nn][Oo]) + BACKUPKERNEL=no + ;; + *) + return 1 + ;; + esac + else + return 1 + fi +} + +config_BackupKernelDir () { + if [ -z ${BACKUPKERNELDIR} ]; then + if [ -z "$1" ]; then + echo "BackupKernelDir set to empty dir" + return 1 + fi + + # We check for some paths which would be extremely odd + # to use, but which could cause a lot of problems if + # used. + case $1 in + /|/bin|/boot|/etc|/lib|/libexec|/sbin|/usr|/var) + echo "BackupKernelDir set to invalid path $1" + return 1 + ;; + /*) + BACKUPKERNELDIR=$1 + ;; + *) + echo "BackupKernelDir ($1) is not an absolute path" + return 1 + ;; + esac + else + return 1 + fi +} + +config_BackupKernelSymbolFiles () { + if [ -z ${BACKUPKERNELSYMBOLFILES} ]; then + case $1 in + [Yy][Ee][Ss]) + BACKUPKERNELSYMBOLFILES=yes + ;; + [Nn][Oo]) + BACKUPKERNELSYMBOLFILES=no + ;; + *) + return 1 + ;; + esac + else + return 1 + fi +} + # Handle one line of configuration configline () { if [ $# -eq 0 ]; then @@ -461,6 +525,9 @@ default_params () { config_BaseDir / config_VerboseLevel stats config_StrictComponents no + config_BackupKernel yes + config_BackupKernelDir /boot/kernel.old + config_BackupKernelSymbolFiles no # Merge these defaults into the earlier-configured settings mergeconfig @@ -665,6 +732,14 @@ install_check_params () { echo "Re-run '$0 fetch'." exit 1 fi + + # Figure out what directory contains the running kernel + BOOTFILE=`sysctl -n kern.bootfile` + KERNELDIR=${BOOTFILE%/kernel} + if ! [ -d ${KERNELDIR} ]; then + echo "Cannot identify running kernel" + exit 1 + fi } # Perform sanity checks and set some final parameters in @@ -2494,6 +2569,88 @@ install_unschg () { rm filelist } +# Decide which directory name to use for kernel backups. +backup_kernel_finddir () { + CNT=0 + while true ; do + # Pathname does not exist, so it is OK use that name + # for backup directory. + if [ ! -e $BACKUPKERNELDIR ]; then + return 0 + fi + + # If directory do exist, we only use if it has our + # marker file. + if [ -d $BACKUPKERNELDIR -a \ + -e $BACKUPKERNELDIR/.freebsd-update ]; then + return 0 + fi + + # We could not use current directory name, so add counter to + # the end and try again. + CNT=$((CNT + 1)) + if [ $CNT -gt 9 ]; then + echo "Could not find valid backup dir ($BACKUPKERNELDIR)" + exit 1 + fi + BACKUPKERNELDIR="`echo $BACKUPKERNELDIR | sed -Ee 's/[0-9]\$//'`" + BACKUPKERNELDIR="${BACKUPKERNELDIR}${CNT}" + done +} + +# Backup the current kernel using hardlinks, if not disabled by user. +# Since we delete all files in the directory used for previous backups +# we create a marker file called ".freebsd-update" in the directory so +# we can determine on the next run that the directory was created by +# freebsd-update and we then do not accidentally remove user files in +# the unlikely case that the user has created a directory with a +# conflicting name. +backup_kernel () { + # Only make kernel backup is so configured. + if [ $BACKUPKERNEL != yes ]; then + return 0 + fi + + # Decide which directory name to use for kernel backups. + backup_kernel_finddir + + # Remove old kernel backup files. If $BACKUPKERNELDIR was + # "not ours", backup_kernel_finddir would have exited, so + # deleting the directory content is as safe as we can make it. + if [ -d $BACKUPKERNELDIR ]; then + rm -f $BACKUPKERNELDIR/* + fi + + # Create directory for backup if it doesn't exist. + mkdir -p $BACKUPKERNELDIR + + # Mark the directory as having been created by freebsd-update. + touch $BACKUPKERNELDIR/.freebsd-update + if [ $? -ne 0 ]; then + echo "Could not create kernel backup directory" + exit 1 + fi + + # Disable pathname expansion to be sure *.symbols is not + # expanded. + set -f + + # Use find to ignore symbol files, unless disabled by user. + if [ $BACKUPKERNELSYMBOLFILES = yes ]; then + FINDFILTER="" + else + FINDFILTER=-"a ! -name *.symbols" + fi + + # Backup all the kernel files using hardlinks. + find $KERNELDIR -type f $FINDFILTER | \ + sed -Ee "s,($KERNELDIR)/?(.*),\1/\2 ${BACKUPKERNELDIR}/\2," | \ + xargs -n 2 cp -pl + + # Re-enable patchname expansion. + set +f +} + # Install new files install_from_index () { # First pass: Do everything apart from setting file flags. We @@ -2575,6 +2732,9 @@ install_files () { grep -E '^/boot/' $1/INDEX-OLD > INDEX-OLD grep -E '^/boot/' $1/INDEX-NEW > INDEX-NEW + # Backup current kernel before installing a new one + backup_kernel || return 1 + # Install new files install_from_index INDEX-NEW || return 1 From pjd at FreeBSD.org Thu Aug 20 00:05:30 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Thu Aug 20 00:05:36 2009 Subject: svn commit: r196395 - head/sys/cddl/compat/opensolaris/rpc Message-ID: <200908200005.n7K05TfY068953@svn.freebsd.org> Author: pjd Date: Thu Aug 20 00:05:29 2009 New Revision: 196395 URL: http://svn.freebsd.org/changeset/base/196395 Log: Our libc doesn't implement control method for XDR (only kernel does) and it will always return failure. Fix this by bringing userland implementation of xdrmem_control() back. This allow 'zpool import' to work again. Reported by: Thomas Backman Reviewed by: kmacy Approved by: re (kib) Added: head/sys/cddl/compat/opensolaris/rpc/xdr.h (contents, props changed) Added: head/sys/cddl/compat/opensolaris/rpc/xdr.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/compat/opensolaris/rpc/xdr.h Thu Aug 20 00:05:29 2009 (r196395) @@ -0,0 +1,70 @@ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +#ifndef _OPENSOLARIS_RPC_XDR_H_ +#define _OPENSOLARIS_RPC_XDR_H_ + +#include_next + +#ifndef _KERNEL + +#include + +/* + * Taken from sys/xdr/xdr_mem.c. + * + * FreeBSD's userland XDR doesn't implement control method (only the kernel), + * but OpenSolaris nvpair still depend on it, so we have to implement it here. + */ +static __inline bool_t +xdrmem_control(XDR *xdrs, int request, void *info) +{ + xdr_bytesrec *xptr; + + switch (request) { + case XDR_GET_BYTES_AVAIL: + xptr = (xdr_bytesrec *)info; + xptr->xc_is_last_record = TRUE; + xptr->xc_num_avail = xdrs->x_handy; + return (TRUE); + default: + assert(!"unexpected request"); + } + return (FALSE); +} + +#undef XDR_CONTROL +#define XDR_CONTROL(xdrs, req, op) \ + (((xdrs)->x_ops->x_control == NULL) ? \ + xdrmem_control((xdrs), (req), (op)) : \ + (*(xdrs)->x_ops->x_control)(xdrs, req, op)) + +#endif /* !_KERNEL */ + +#endif /* !_OPENSOLARIS_RPC_XDR_H_ */ From will at FreeBSD.org Thu Aug 20 02:33:13 2009 From: will at FreeBSD.org (Will Andrews) Date: Thu Aug 20 02:33:25 2009 Subject: svn commit: r196397 - head/sys/netinet Message-ID: <200908200233.n7K2XCfF071803@svn.freebsd.org> Author: will Date: Thu Aug 20 02:33:12 2009 New Revision: 196397 URL: http://svn.freebsd.org/changeset/base/196397 Log: Fix CARP memory leaks on carp_if's malloc'd using M_CARP. This occurs when CARP tries to free them using M_IFADDR after the last address for a virtual host is removed and when detaching from the parent interface. Reviewed by: mlaier Approved by: re (kib), ken (mentor) Modified: head/sys/netinet/ip_carp.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Thu Aug 20 00:08:58 2009 (r196396) +++ head/sys/netinet/ip_carp.c Thu Aug 20 02:33:12 2009 (r196397) @@ -501,7 +501,7 @@ carpdetach(struct carp_softc *sc, int un ifpromisc(sc->sc_carpdev, 0); sc->sc_carpdev->if_carp = NULL; CARP_LOCK_DESTROY(cif); - free(cif, M_IFADDR); + free(cif, M_CARP); } else if (unlock) CARP_UNLOCK(cif); sc->sc_carpdev = NULL; @@ -1639,7 +1639,7 @@ carp_del_addr(struct carp_softc *sc, str if (!--cif->vhif_nvrs) { sc->sc_carpdev->if_carp = NULL; CARP_LOCK_DESTROY(cif); - free(cif, M_IFADDR); + free(cif, M_CARP); } else { CARP_UNLOCK(cif); } @@ -1843,7 +1843,7 @@ carp_del_addr6(struct carp_softc *sc, st if (!--cif->vhif_nvrs) { CARP_LOCK_DESTROY(cif); sc->sc_carpdev->if_carp = NULL; - free(cif, M_IFADDR); + free(cif, M_CARP); } else CARP_UNLOCK(cif); } From avg at FreeBSD.org Thu Aug 20 10:57:15 2009 From: avg at FreeBSD.org (Andriy Gapon) Date: Thu Aug 20 10:57:27 2009 Subject: svn commit: r196399 - head/usr.bin/fstat Message-ID: <200908201057.n7KAvE4d084139@svn.freebsd.org> Author: avg Date: Thu Aug 20 10:57:14 2009 New Revision: 196399 URL: http://svn.freebsd.org/changeset/base/196399 Log: fstat: fix fsid comparison when executed on systems with 64-bit long This affects only fstat on zfs and devfs, only on 64-bit systems and only when fsid is greater than 2^31 - 1. When fstat examines a file via stat(2) it takes uint32_t st_dev and assigns to (signed) (64-bit) long fsid, this results in a positive value. When fstat examines opened files it takes int32_t f_fsid.val[0] and assigns to (signed) (64-bit) long fsid, this results in a negative value. So, while initially st_dev and f_fsid.val[0] have the same bit values they get promoted to different 64-bit values because of the signed-vs-unsigned difference. A fix is to use "more natural" positive numbers by introducing intermediate unsigned cast for f_fsid.val[0]. Reviewed by: jhb, lulf Approved by: re (kib) MFC after: 1 week (to stable/7) Modified: head/usr.bin/fstat/fstat.c head/usr.bin/fstat/zfs.c Modified: head/usr.bin/fstat/fstat.c ============================================================================== --- head/usr.bin/fstat/fstat.c Thu Aug 20 02:49:43 2009 (r196398) +++ head/usr.bin/fstat/fstat.c Thu Aug 20 10:57:14 2009 (r196399) @@ -658,7 +658,7 @@ devfs_filestat(struct vnode *vp, struct (void *)devfs_dirent.de_vnode, Pid); return 0; } - fsp->fsid = (long)mount.mnt_stat.f_fsid.val[0]; + fsp->fsid = (long)(uint32_t)mount.mnt_stat.f_fsid.val[0]; fsp->fileid = devfs_dirent.de_inode; fsp->mode = (devfs_dirent.de_mode & ~S_IFMT) | S_IFCHR; fsp->size = 0; Modified: head/usr.bin/fstat/zfs.c ============================================================================== --- head/usr.bin/fstat/zfs.c Thu Aug 20 02:49:43 2009 (r196398) +++ head/usr.bin/fstat/zfs.c Thu Aug 20 10:57:14 2009 (r196399) @@ -117,7 +117,7 @@ zfs_filestat(struct vnode *vp, struct fi goto bad; } - fsp->fsid = (long)mount.mnt_stat.f_fsid.val[0]; + fsp->fsid = (long)(uint32_t)mount.mnt_stat.f_fsid.val[0]; fsp->fileid = *zid; /* * XXX: Shows up wrong in output, but UFS has this error too. Could From brian at Awfulhak.org Thu Aug 20 17:16:14 2009 From: brian at Awfulhak.org (Brian Somers) Date: Thu Aug 20 17:16:19 2009 Subject: svn commit: r196392 - in head: etc share/man/man5 usr.sbin/freebsd-update In-Reply-To: <200908192047.n7JKlVCE065020@svn.freebsd.org> References: <200908192047.n7JKlVCE065020@svn.freebsd.org> Message-ID: <20090820094737.1f9a6121@dev.lan.Awfulhak.org> On Wed, 19 Aug 2009 20:47:31 +0000 (UTC) "Simon L. Nielsen" wrote: > Author: simon > Date: Wed Aug 19 20:47:31 2009 > New Revision: 196392 > URL: http://svn.freebsd.org/changeset/base/196392 > > Log: > Add support for backing up the old kernel when installing a new kernel > using freebsd-update. This applies to using freebsd-update in "upgrade > mode" and normal freebsd-update on a security branch. > > The backup kernel will be written to /boot/kernel.old, if the directory > does not exist, or the directory was created by freebsd-update in a > previous backup. Otherwise freebsd-update will generate a new directory > name for use by the backup. By default symbol files are not backed up > to save diskspace and avoid filling up the root partition. > > This feature is fully configurable in the freebsd-update config file, > but defaults to enabled. > > MFC after: 1 week (stable/7) > Reviewed by: cperciva > Approved by: re (kib) This should really have the same behaviour as ``make installkernel''. After moving the kernel to kernel.old it should update kern.bootfile and it should not backup kernel => kernel.old if kern.bootfile already points at kernel.old. It's bad if two kernel upgrades without an intervening reboot blow away your running kernel :( -- Brian Somers Don't _EVER_ lose your sense of humour ! From jhb at FreeBSD.org Thu Aug 20 19:17:54 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Thu Aug 20 19:18:07 2009 Subject: svn commit: r196403 - in head/sys: dev/aac dev/acpica dev/adb dev/amdtemp dev/amr dev/ata dev/atkbdc dev/bktr dev/drm dev/ips dev/mfi dev/mlx dev/mmc dev/pccbb dev/pst dev/rp dev/sound/pci/hda dev/... Message-ID: <200908201917.n7KJHrYW096093@svn.freebsd.org> Author: jhb Date: Thu Aug 20 19:17:53 2009 New Revision: 196403 URL: http://svn.freebsd.org/changeset/base/196403 Log: Temporarily revert the new-bus locking for 8.0 release. It will be reintroduced after HEAD is reopened for commits by re@. Approved by: re (kib), attilio Modified: head/sys/dev/aac/aac.c head/sys/dev/acpica/acpi.c head/sys/dev/acpica/acpi_battery.c head/sys/dev/acpica/acpi_cpu.c head/sys/dev/acpica/acpi_dock.c head/sys/dev/acpica/acpi_thermal.c head/sys/dev/adb/adb_bus.c head/sys/dev/amdtemp/amdtemp.c head/sys/dev/amr/amr.c head/sys/dev/ata/ata-all.c head/sys/dev/atkbdc/psm.c head/sys/dev/bktr/bktr_os.c head/sys/dev/drm/drm_drv.c head/sys/dev/ips/ips_pci.c head/sys/dev/mfi/mfi.c head/sys/dev/mlx/mlx.c head/sys/dev/mmc/mmc.c head/sys/dev/pccbb/pccbb.c head/sys/dev/pst/pst-iop.c head/sys/dev/rp/rp.c head/sys/dev/sound/pci/hda/hdac.c head/sys/dev/twe/twe.c head/sys/dev/usb/controller/usb_controller.c head/sys/dev/usb/input/ukbd.c head/sys/dev/usb/net/usb_ethernet.c head/sys/dev/usb/usb_compat_linux.c head/sys/dev/usb/usb_dev.c head/sys/dev/usb/usb_handle_request.c head/sys/dev/usb/usb_hub.c head/sys/dev/usb/wlan/if_upgt.c head/sys/dev/xen/blkback/blkback.c head/sys/dev/xen/netback/netback.c head/sys/i386/acpica/acpi_machdep.c head/sys/i386/bios/smapi.c head/sys/i386/bios/smbios.c head/sys/i386/bios/vpd.c head/sys/kern/subr_bus.c head/sys/pc98/cbus/fdc.c head/sys/sys/bus.h head/sys/xen/xenbus/xenbus_probe.c Modified: head/sys/dev/aac/aac.c ============================================================================== --- head/sys/dev/aac/aac.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/aac/aac.c Thu Aug 20 19:17:53 2009 (r196403) @@ -3270,10 +3270,10 @@ aac_handle_aif(struct aac_softc *sc, str while (co != NULL) { if (co->co_found == 0) { mtx_unlock(&sc->aac_io_lock); - newbus_xlock(); + mtx_lock(&Giant); device_delete_child(sc->aac_dev, co->co_disk); - newbus_xunlock(); + mtx_unlock(&Giant); mtx_lock(&sc->aac_io_lock); co_next = TAILQ_NEXT(co, co_link); mtx_lock(&sc->aac_container_lock); @@ -3291,9 +3291,9 @@ aac_handle_aif(struct aac_softc *sc, str /* Attach the newly created containers */ if (added) { mtx_unlock(&sc->aac_io_lock); - newbus_xlock(); + mtx_lock(&Giant); bus_generic_attach(sc->aac_dev); - newbus_xunlock(); + mtx_unlock(&Giant); mtx_lock(&sc->aac_io_lock); } Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/acpica/acpi.c Thu Aug 20 19:17:53 2009 (r196403) @@ -675,6 +675,8 @@ acpi_suspend(device_t dev) device_t child, *devlist; int error, i, numdevs, pstate; + GIANT_REQUIRED; + /* First give child devices a chance to suspend. */ error = bus_generic_suspend(dev); if (error) @@ -717,6 +719,8 @@ acpi_resume(device_t dev) int i, numdevs, error; device_t child, *devlist; + GIANT_REQUIRED; + /* * Put all devices in D0 before resuming them. Call _S0D on each one * since some systems expect this. @@ -741,6 +745,8 @@ static int acpi_shutdown(device_t dev) { + GIANT_REQUIRED; + /* Allow children to shutdown first. */ bus_generic_shutdown(dev); @@ -2528,7 +2534,11 @@ acpi_EnterSleepState(struct acpi_softc * thread_unlock(curthread); #endif - newbus_xlock(); + /* + * Be sure to hold Giant across DEVICE_SUSPEND/RESUME since non-MPSAFE + * drivers need this. + */ + mtx_lock(&Giant); slp_state = ACPI_SS_NONE; @@ -2601,7 +2611,7 @@ backout: if (slp_state >= ACPI_SS_SLEPT) acpi_enable_fixed_events(sc); - newbus_xunlock(); + mtx_unlock(&Giant); #ifdef SMP thread_lock(curthread); Modified: head/sys/dev/acpica/acpi_battery.c ============================================================================== --- head/sys/dev/acpica/acpi_battery.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/acpica/acpi_battery.c Thu Aug 20 19:17:53 2009 (r196403) @@ -329,7 +329,6 @@ acpi_battery_find_dev(u_int logical_unit dev = NULL; found_unit = 0; - newbus_slock(); batt_dc = devclass_find("battery"); maxunit = devclass_get_maxunit(batt_dc); for (i = 0; i < maxunit; i++) { @@ -341,7 +340,6 @@ acpi_battery_find_dev(u_int logical_unit found_unit++; dev = NULL; } - newbus_sunlock(); return (dev); } @@ -371,17 +369,13 @@ acpi_battery_ioctl(u_long cmd, caddr_t a */ switch (cmd) { case ACPIIO_BATT_GET_UNITS: - newbus_slock(); *(int *)addr = acpi_battery_get_units(); - newbus_sunlock(); error = 0; break; case ACPIIO_BATT_GET_BATTINFO: if (dev != NULL || unit == ACPI_BATTERY_ALL_UNITS) { bzero(&ioctl_arg->battinfo, sizeof(ioctl_arg->battinfo)); - newbus_slock(); error = acpi_battery_get_battinfo(dev, &ioctl_arg->battinfo); - newbus_sunlock(); } break; case ACPIIO_BATT_GET_BIF: @@ -422,11 +416,6 @@ acpi_battery_sysctl(SYSCTL_HANDLER_ARGS) { int val, error; - /* - * Tolerate a race here because newbus lock can't be acquired before - * acpi_battery_get_battinfo() as it can create a LOR with the sysctl - * lock. - */ acpi_battery_get_battinfo(NULL, &acpi_battery_battinfo); val = *(u_int *)oidp->oid_arg1; error = sysctl_handle_int(oidp, &val, 0, req); @@ -438,10 +427,6 @@ acpi_battery_units_sysctl(SYSCTL_HANDLER { int count, error; - /* - * Tolerate a race here in order to avoid a LOR between sysctl lock - * and newbus lock. - */ count = acpi_battery_get_units(); error = sysctl_handle_int(oidp, &count, 0, req); return (error); Modified: head/sys/dev/acpica/acpi_cpu.c ============================================================================== --- head/sys/dev/acpica/acpi_cpu.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/acpica/acpi_cpu.c Thu Aug 20 19:17:53 2009 (r196403) @@ -732,9 +732,7 @@ acpi_cpu_startup(void *arg) int i; /* Get set of CPU devices */ - newbus_slock(); devclass_get_devices(acpi_cpu_devclass, &cpu_devices, &cpu_ndevices); - newbus_sunlock(); /* * Setup any quirks that might necessary now that we have probed Modified: head/sys/dev/acpica/acpi_dock.c ============================================================================== --- head/sys/dev/acpica/acpi_dock.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/acpica/acpi_dock.c Thu Aug 20 19:17:53 2009 (r196403) @@ -188,12 +188,12 @@ acpi_dock_attach_later(void *context) dev = (device_t)context; - newbus_xlock(); if (!device_is_enabled(dev)) device_enable(dev); + mtx_lock(&Giant); device_probe_and_attach(dev); - newbus_xunlock(); + mtx_unlock(&Giant); } static ACPI_STATUS @@ -299,11 +299,11 @@ acpi_dock_eject_child(ACPI_HANDLE handle "ejecting device for %s\n", acpi_name(handle)); dev = acpi_get_device(handle); - newbus_xlock(); if (dev != NULL && device_is_attached(dev)) { + mtx_lock(&Giant); device_detach(dev); + mtx_unlock(&Giant); } - newbus_xunlock(); acpi_SetInteger(handle, "_EJ0", 0); out: Modified: head/sys/dev/acpica/acpi_thermal.c ============================================================================== --- head/sys/dev/acpica/acpi_thermal.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/acpica/acpi_thermal.c Thu Aug 20 19:17:53 2009 (r196403) @@ -936,8 +936,6 @@ acpi_tz_thread(void *arg) sc = NULL; for (;;) { - newbus_slock(); - /* If the number of devices has changed, re-evaluate. */ if (devclass_get_count(acpi_tz_devclass) != devcount) { if (devs != NULL) { @@ -950,7 +948,6 @@ acpi_tz_thread(void *arg) for (i = 0; i < devcount; i++) sc[i] = device_get_softc(devs[i]); } - newbus_sunlock(); /* Check for temperature events and act on them. */ for (i = 0; i < devcount; i++) { Modified: head/sys/dev/adb/adb_bus.c ============================================================================== --- head/sys/dev/adb/adb_bus.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/adb/adb_bus.c Thu Aug 20 19:17:53 2009 (r196403) @@ -113,7 +113,6 @@ adb_bus_enumerate(void *xdev) uint8_t i, next_free; uint16_t r3; - newbus_xlock(); sc->sc_dev = dev; sc->parent = device_get_parent(dev); @@ -188,7 +187,6 @@ adb_bus_enumerate(void *xdev) } bus_generic_attach(dev); - newbus_xunlock(); config_intrhook_disestablish(&sc->enum_hook); } Modified: head/sys/dev/amdtemp/amdtemp.c ============================================================================== --- head/sys/dev/amdtemp/amdtemp.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/amdtemp/amdtemp.c Thu Aug 20 19:17:53 2009 (r196403) @@ -269,7 +269,6 @@ amdtemp_intrhook(void *arg) /* * dev.cpu.N.temperature. */ - newbus_xlock(); nexus = device_find_child(root_bus, "nexus", 0); acpi = device_find_child(nexus, "acpi", 0); @@ -286,7 +285,6 @@ amdtemp_intrhook(void *arg) "Max of sensor 0 / 1"); } } - newbus_xunlock(); config_intrhook_disestablish(&sc->sc_ich); } Modified: head/sys/dev/amr/amr.c ============================================================================== --- head/sys/dev/amr/amr.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/amr/amr.c Thu Aug 20 19:17:53 2009 (r196403) @@ -90,10 +90,6 @@ __FBSDID("$FreeBSD$"); SYSCTL_NODE(_hw, OID_AUTO, amr, CTLFLAG_RD, 0, "AMR driver parameters"); -/* - * In order to get rid of Giant, amr_state should be protected by - * a proper softc lock for the cdev operations. - */ static d_open_t amr_open; static d_close_t amr_close; static d_ioctl_t amr_ioctl; @@ -316,11 +312,9 @@ amr_startup(void *arg) config_intrhook_disestablish(&sc->amr_ich); sc->amr_ich.ich_func = NULL; - newbus_xlock(); /* get up-to-date drive information */ if (amr_query_controller(sc)) { device_printf(sc->amr_dev, "can't scan controller for drives\n"); - newbus_xunlock(); return; } @@ -353,7 +347,6 @@ amr_startup(void *arg) /* interrupts will be enabled before we do anything more */ sc->amr_state |= AMR_STATE_INTEN; - newbus_xunlock(); /* * Start the timeout routine. @@ -441,11 +434,7 @@ static int amr_open(struct cdev *dev, int flags, int fmt, struct thread *td) { int unit = dev2unit(dev); - struct amr_softc *sc; - - newbus_slock(); - sc = devclass_get_softc(devclass_find("amr"), unit); - newbus_sunlock(); + struct amr_softc *sc = devclass_get_softc(devclass_find("amr"), unit); debug_called(1); @@ -501,11 +490,7 @@ static int amr_close(struct cdev *dev, int flags, int fmt, struct thread *td) { int unit = dev2unit(dev); - struct amr_softc *sc; - - newbus_slock(); - sc = devclass_get_softc(devclass_find("amr"), unit); - newbus_sunlock(); + struct amr_softc *sc = devclass_get_softc(devclass_find("amr"), unit); debug_called(1); @@ -522,7 +507,6 @@ amr_rescan_drives(struct cdev *dev) struct amr_softc *sc = (struct amr_softc *)dev->si_drv1; int i, error = 0; - newbus_xlock(); sc->amr_state |= AMR_STATE_REMAP_LD; while (sc->amr_busyslots) { device_printf(sc->amr_dev, "idle controller\n"); @@ -546,7 +530,6 @@ amr_rescan_drives(struct cdev *dev) sc->amr_drive[i].al_disk = 0; } } - newbus_xunlock(); shutdown_out: amr_startup(sc); @@ -822,9 +805,7 @@ amr_ioctl(struct cdev *dev, u_long cmd, struct amr_linux_ioctl ali; int adapter, error; - newbus_slock(); devclass = devclass_find("amr"); - newbus_sunlock(); if (devclass == NULL) return (ENOENT); Modified: head/sys/dev/ata/ata-all.c ============================================================================== --- head/sys/dev/ata/ata-all.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/ata/ata-all.c Thu Aug 20 19:17:53 2009 (r196403) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); static d_ioctl_t ata_ioctl; static struct cdevsw ata_cdevsw = { .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, /* we need this as newbus isn't mpsafe */ .d_ioctl = ata_ioctl, .d_name = "ata", }; @@ -203,9 +204,7 @@ ata_conn_event(void *context, int dummy) { device_t dev = (device_t)context; - newbus_xlock(); ata_reinit(dev); - newbus_xunlock(); } int @@ -247,6 +246,7 @@ ata_reinit(device_t dev) /* reinit the children and delete any that fails */ if (!device_get_children(dev, &children, &nchildren)) { + mtx_lock(&Giant); /* newbus suckage it needs Giant */ for (i = 0; i < nchildren; i++) { /* did any children go missing ? */ if (children[i] && device_is_attached(children[i]) && @@ -269,6 +269,7 @@ ata_reinit(device_t dev) } } free(children, M_TEMP); + mtx_unlock(&Giant); /* newbus suckage dealt with, release Giant */ } /* if we still have a good request put it on the queue again */ @@ -394,7 +395,6 @@ ata_ioctl(struct cdev *dev, u_long cmd, int *value = (int *)data; int i, nchildren, error = ENOTTY; - newbus_xlock(); switch (cmd) { case IOCATAGMAXCHANNEL: /* In case we have channel 0..n this will return n+1. */ @@ -405,40 +405,32 @@ ata_ioctl(struct cdev *dev, u_long cmd, case IOCATAREINIT: if (*value >= devclass_get_maxunit(ata_devclass) || !(device = devclass_get_device(ata_devclass, *value)) || - !device_is_attached(device)) { - newbus_xunlock(); + !device_is_attached(device)) return ENXIO; - } error = ata_reinit(device); break; case IOCATAATTACH: if (*value >= devclass_get_maxunit(ata_devclass) || !(device = devclass_get_device(ata_devclass, *value)) || - !device_is_attached(device)) { - newbus_xunlock(); + !device_is_attached(device)) return ENXIO; - } error = DEVICE_ATTACH(device); break; case IOCATADETACH: if (*value >= devclass_get_maxunit(ata_devclass) || !(device = devclass_get_device(ata_devclass, *value)) || - !device_is_attached(device)) { - newbus_xunlock(); + !device_is_attached(device)) return ENXIO; - } error = DEVICE_DETACH(device); break; case IOCATADEVICES: if (devices->channel >= devclass_get_maxunit(ata_devclass) || !(device = devclass_get_device(ata_devclass, devices->channel)) || - !device_is_attached(device)) { - newbus_xunlock(); + !device_is_attached(device)) return ENXIO; - } bzero(devices->name[0], 32); bzero(&devices->params[0], sizeof(struct ata_params)); bzero(devices->name[1], 32); @@ -473,7 +465,6 @@ ata_ioctl(struct cdev *dev, u_long cmd, if (ata_raid_ioctl_func) error = ata_raid_ioctl_func(cmd, data); } - newbus_xunlock(); return error; } @@ -581,7 +572,7 @@ ata_boot_attach(void) struct ata_channel *ch; int ctlr; - newbus_xlock(); + mtx_lock(&Giant); /* newbus suckage it needs Giant */ /* kick of probe and attach on all channels */ for (ctlr = 0; ctlr < devclass_get_maxunit(ata_devclass); ctlr++) { @@ -596,7 +587,8 @@ ata_boot_attach(void) free(ata_delayed_attach, M_TEMP); ata_delayed_attach = NULL; } - newbus_xunlock(); + + mtx_unlock(&Giant); /* newbus suckage dealt with, release Giant */ } @@ -725,6 +717,7 @@ ata_identify(device_t dev) if (bootverbose) device_printf(dev, "Identifying devices: %08x\n", ch->devices); + mtx_lock(&Giant); /* Skip existing devices. */ if (!device_get_children(dev, &children, &nchildren)) { for (i = 0; i < nchildren; i++) { @@ -736,8 +729,10 @@ ata_identify(device_t dev) /* Create new devices. */ if (bootverbose) device_printf(dev, "New devices: %08x\n", n); - if (n == 0) + if (n == 0) { + mtx_unlock(&Giant); return (0); + } for (i = 0; i < ATA_PM; ++i) { if (n & (((ATA_ATA_MASTER | ATA_ATAPI_MASTER) << i))) { int unit = -1; @@ -780,6 +775,7 @@ ata_identify(device_t dev) } bus_generic_probe(dev); bus_generic_attach(dev); + mtx_unlock(&Giant); return 0; } Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/atkbdc/psm.c Thu Aug 20 19:17:53 2009 (r196403) @@ -1488,9 +1488,7 @@ psmopen(struct cdev *dev, int flag, int if (sc->state & PSM_OPEN) return (EBUSY); - newbus_xlock(); device_busy(devclass_get_device(psm_devclass, unit)); - newbus_xunlock(); /* Initialize state */ sc->mode.level = sc->dflt_mode.level; @@ -1645,9 +1643,7 @@ psmclose(struct cdev *dev, int flag, int /* close is almost always successful */ sc->state &= ~PSM_OPEN; kbdc_lock(sc->kbdc, FALSE); - newbus_xlock(); device_unbusy(devclass_get_device(psm_devclass, unit)); - newbus_xunlock(); return (0); } Modified: head/sys/dev/bktr/bktr_os.c ============================================================================== --- head/sys/dev/bktr/bktr_os.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/bktr/bktr_os.c Thu Aug 20 19:17:53 2009 (r196403) @@ -597,9 +597,7 @@ bktr_open( struct cdev *dev, int flags, return( ENXIO ); /* Record that the device is now busy */ - newbus_xlock(); device_busy(devclass_get_device(bktr_devclass, unit)); - newbus_xunlock(); if (bt848_card != -1) { @@ -670,11 +668,8 @@ bktr_open( struct cdev *dev, int flags, } /* If there was an error opening the device, undo the busy status */ - if (result != 0) { - newbus_xlock(); + if (result != 0) device_unbusy(devclass_get_device(bktr_devclass, unit)); - newbus_xunlock(); - } return( result ); } @@ -694,7 +689,6 @@ bktr_close( struct cdev *dev, int flags, /* Get the device data */ bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit); if (bktr == NULL) { - /* the device is no longer valid/functioning */ return (ENXIO); } @@ -711,11 +705,10 @@ bktr_close( struct cdev *dev, int flags, break; default: return (ENXIO); + break; } - newbus_xlock(); device_unbusy(devclass_get_device(bktr_devclass, unit)); - newbus_xunlock(); return( result ); } Modified: head/sys/dev/drm/drm_drv.c ============================================================================== --- head/sys/dev/drm/drm_drv.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/drm/drm_drv.c Thu Aug 20 19:17:53 2009 (r196403) @@ -614,13 +614,11 @@ int drm_open(struct cdev *kdev, int flag if (!retcode) { atomic_inc(&dev->counts[_DRM_STAT_OPENS]); - newbus_xlock(); DRM_LOCK(); device_busy(dev->device); if (!dev->open_count++) retcode = drm_firstopen(dev); DRM_UNLOCK(); - newbus_xunlock(); } return retcode; @@ -634,11 +632,6 @@ void drm_close(void *data) DRM_DEBUG("open_count = %d\n", dev->open_count); - /* - * We require to lock newbus here for handling device_unbusy() and - * avoid a LOR with DRM_LOCK. - */ - newbus_xlock(); DRM_LOCK(); if (dev->driver->preclose != NULL) @@ -715,7 +708,6 @@ void drm_close(void *data) } DRM_UNLOCK(); - newbus_xunlock(); } /* drm_ioctl is called whenever a process performs an ioctl on /dev/drm. Modified: head/sys/dev/ips/ips_pci.c ============================================================================== --- head/sys/dev/ips/ips_pci.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/ips/ips_pci.c Thu Aug 20 19:17:53 2009 (r196403) @@ -173,12 +173,10 @@ ips_intrhook(void *arg) struct ips_softc *sc = (struct ips_softc *)arg; config_intrhook_disestablish(&sc->ips_ich); - newbus_xlock(); if (ips_adapter_init(sc)) ips_pci_free(sc); else sc->configured = 1; - newbus_xunlock(); } static int ips_pci_free(ips_softc_t *sc) Modified: head/sys/dev/mfi/mfi.c ============================================================================== --- head/sys/dev/mfi/mfi.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/mfi/mfi.c Thu Aug 20 19:17:53 2009 (r196403) @@ -1327,11 +1327,11 @@ mfi_add_ld_complete(struct mfi_command * mfi_release_command(cm); mtx_unlock(&sc->mfi_io_lock); - newbus_xlock(); + mtx_lock(&Giant); if ((child = device_add_child(sc->mfi_dev, "mfid", -1)) == NULL) { device_printf(sc->mfi_dev, "Failed to add logical disk\n"); free(ld_info, M_MFIBUF); - newbus_xunlock(); + mtx_unlock(&Giant); mtx_lock(&sc->mfi_io_lock); return; } @@ -1339,7 +1339,7 @@ mfi_add_ld_complete(struct mfi_command * device_set_ivars(child, ld_info); device_set_desc(child, "MFI Logical Disk"); bus_generic_attach(sc->mfi_dev); - newbus_xunlock(); + mtx_unlock(&Giant); mtx_lock(&sc->mfi_io_lock); } @@ -1805,9 +1805,9 @@ mfi_check_command_post(struct mfi_softc KASSERT(ld != NULL, ("volume dissappeared")); if (cm->cm_frame->header.cmd_status == MFI_STAT_OK) { mtx_unlock(&sc->mfi_io_lock); - newbus_xlock(); + mtx_lock(&Giant); device_delete_child(sc->mfi_dev, ld->ld_dev); - newbus_xunlock(); + mtx_unlock(&Giant); mtx_lock(&sc->mfi_io_lock); } else mfi_disk_enable(ld); @@ -1815,11 +1815,11 @@ mfi_check_command_post(struct mfi_softc case MFI_DCMD_CFG_CLEAR: if (cm->cm_frame->header.cmd_status == MFI_STAT_OK) { mtx_unlock(&sc->mfi_io_lock); - newbus_xlock(); + mtx_lock(&Giant); TAILQ_FOREACH_SAFE(ld, &sc->mfi_ld_tqh, ld_link, ldn) { device_delete_child(sc->mfi_dev, ld->ld_dev); } - newbus_xunlock(); + mtx_unlock(&Giant); mtx_lock(&sc->mfi_io_lock); } else { TAILQ_FOREACH(ld, &sc->mfi_ld_tqh, ld_link) @@ -1985,9 +1985,7 @@ mfi_ioctl(struct cdev *dev, u_long cmd, adapter = ioc->mfi_adapter_no; if (device_get_unit(sc->mfi_dev) == 0 && adapter != 0) { - newbus_slock(); devclass = devclass_find("mfi"); - newbus_sunlock(); sc = devclass_get_softc(devclass, adapter); } mtx_lock(&sc->mfi_io_lock); @@ -2175,9 +2173,7 @@ out: struct mfi_linux_ioc_packet l_ioc; int adapter; - newbus_slock(); devclass = devclass_find("mfi"); - newbus_sunlock(); if (devclass == NULL) return (ENOENT); @@ -2198,9 +2194,7 @@ out: struct mfi_linux_ioc_aen l_aen; int adapter; - newbus_slock(); devclass = devclass_find("mfi"); - newbus_sunlock(); if (devclass == NULL) return (ENOENT); Modified: head/sys/dev/mlx/mlx.c ============================================================================== --- head/sys/dev/mlx/mlx.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/mlx/mlx.c Thu Aug 20 19:17:53 2009 (r196403) @@ -772,9 +772,7 @@ mlx_ioctl(struct cdev *dev, u_long cmd, * Scan the controller to see whether new drives have appeared. */ case MLX_RESCAN_DRIVES: - newbus_xlock(); mlx_startup(sc); - newbus_xunlock(); return(0); /* Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/mmc/mmc.c Thu Aug 20 19:17:53 2009 (r196403) @@ -1496,9 +1496,7 @@ mmc_delayed_attach(void *xsc) { struct mmc_softc *sc = xsc; - newbus_xlock(); mmc_scan(sc); - newbus_xunlock(); config_intrhook_disestablish(&sc->config_intrhook); } Modified: head/sys/dev/pccbb/pccbb.c ============================================================================== --- head/sys/dev/pccbb/pccbb.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/pccbb/pccbb.c Thu Aug 20 19:17:53 2009 (r196403) @@ -464,7 +464,14 @@ cbb_event_thread(void *arg) sc->flags |= CBB_KTHREAD_RUNNING; while ((sc->flags & CBB_KTHREAD_DONE) == 0) { mtx_unlock(&sc->mtx); - newbus_xlock(); + /* + * We take out Giant here because we need it deep, + * down in the bowels of the vm system for mapping the + * memory we need to read the CIS. In addition, since + * we are adding/deleting devices from the dev tree, + * and that code isn't MP safe, we have to hold Giant. + */ + mtx_lock(&Giant); status = cbb_get(sc, CBB_SOCKET_STATE); DPRINTF(("Status is 0x%x\n", status)); if (!CBB_CARD_PRESENT(status)) { @@ -490,7 +497,7 @@ cbb_event_thread(void *arg) not_a_card = 0; /* We know card type */ cbb_insert(sc); } - newbus_xunlock(); + mtx_unlock(&Giant); /* * First time through we need to tell mountroot that we're Modified: head/sys/dev/pst/pst-iop.c ============================================================================== --- head/sys/dev/pst/pst-iop.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/pst/pst-iop.c Thu Aug 20 19:17:53 2009 (r196403) @@ -152,9 +152,7 @@ iop_attach(void *arg) break; case I2O_CLASS_RANDOM_BLOCK_STORAGE: - newbus_xlock(); pst_add_raid(sc, &sc->lct[i]); - newbus_xunlock(); break; } } Modified: head/sys/dev/rp/rp.c ============================================================================== --- head/sys/dev/rp/rp.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/rp/rp.c Thu Aug 20 19:17:53 2009 (r196403) @@ -903,9 +903,7 @@ rpopen(struct tty *tp) rp_callout_handle = timeout(rp_do_poll, (void *)NULL, POLL_INTERVAL); - newbus_xlock(); device_busy(rp->rp_ctlp->dev); - newbus_xunlock(); return(0); } @@ -916,9 +914,7 @@ rpclose(struct tty *tp) rp = tty_softc(tp); rphardclose(tp); - newbus_xlock(); device_unbusy(rp->rp_ctlp->dev); - newbus_xunlock(); } static void Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/sound/pci/hda/hdac.c Thu Aug 20 19:17:53 2009 (r196403) @@ -7435,7 +7435,6 @@ hdac_attach2(void *arg) quirks_on, quirks_off); ); - newbus_xlock(); hdac_lock(sc); /* Remove ourselves from the config hooks */ @@ -7675,7 +7674,6 @@ hdac_attach2(void *arg) SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)), OID_AUTO, "pindump", CTLTYPE_INT | CTLFLAG_RW, sc->dev, sizeof(sc->dev), sysctl_hdac_pindump, "I", "Dump pin states/data"); - newbus_xunlock(); } /**************************************************************************** Modified: head/sys/dev/twe/twe.c ============================================================================== --- head/sys/dev/twe/twe.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/twe/twe.c Thu Aug 20 19:17:53 2009 (r196403) @@ -294,10 +294,8 @@ twe_init(struct twe_softc *sc) /* * Scan for drives */ - newbus_xlock(); for (i = 0; i < TWE_MAX_UNITS; i++) twe_add_unit(sc, i); - newbus_xunlock(); /* * Initialise connection with controller. @@ -623,15 +621,11 @@ twe_ioctl(struct twe_softc *sc, int ioct break; case TWEIO_ADD_UNIT: - newbus_xlock(); error = twe_add_unit(sc, td->td_unit); - newbus_xunlock(); break; case TWEIO_DEL_UNIT: - newbus_xlock(); error = twe_del_unit(sc, td->td_unit); - newbus_xunlock(); break; /* XXX implement ATA PASSTHROUGH */ Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/usb/controller/usb_controller.c Thu Aug 20 19:17:53 2009 (r196403) @@ -143,7 +143,9 @@ usb_attach(device_t dev) } if (usb_post_init_called) { + mtx_lock(&Giant); usb_attach_sub(dev, bus); + mtx_unlock(&Giant); usb_needs_explore(bus, 1); } return (0); /* return success */ @@ -226,13 +228,20 @@ usb_bus_explore(struct usb_proc_msg *pm) } USB_BUS_UNLOCK(bus); + mtx_lock(&Giant); + /* * First update the USB power state! */ usb_bus_powerd(bus); - - /* Explore the Root USB HUB. */ + /* + * Explore the Root USB HUB. This call can sleep, + * exiting Giant, which is actually Giant. + */ (udev->hub->explore) (udev); + + mtx_unlock(&Giant); + USB_BUS_LOCK(bus); } if (bus->bus_roothold != NULL) { @@ -260,7 +269,7 @@ usb_bus_detach(struct usb_proc_msg *pm) device_set_softc(dev, NULL); USB_BUS_UNLOCK(bus); - newbus_xlock(); + mtx_lock(&Giant); /* detach children first */ bus_generic_detach(dev); @@ -272,7 +281,7 @@ usb_bus_detach(struct usb_proc_msg *pm) usb_free_device(udev, USB_UNCFG_FLAG_FREE_EP0); - newbus_xunlock(); + mtx_unlock(&Giant); USB_BUS_LOCK(bus); /* clear bdev variable last */ bus->bdev = NULL; @@ -341,7 +350,7 @@ usb_bus_attach(struct usb_proc_msg *pm) } USB_BUS_UNLOCK(bus); - newbus_xlock(); + mtx_lock(&Giant); /* XXX not required by USB */ /* default power_mask value */ bus->hw_power_state = @@ -374,7 +383,7 @@ usb_bus_attach(struct usb_proc_msg *pm) err = USB_ERR_NOMEM; } - newbus_xunlock(); + mtx_unlock(&Giant); USB_BUS_LOCK(bus); if (err) { @@ -463,7 +472,7 @@ usb_post_init(void *arg) int max; int n; - newbus_xlock(); + mtx_lock(&Giant); usb_devclass_ptr = devclass_find("usbus"); @@ -474,8 +483,11 @@ usb_post_init(void *arg) dev = devclass_get_device(dc, n); if (dev && device_is_attached(dev)) { bus = device_get_ivars(dev); - if (bus) + if (bus) { + mtx_lock(&Giant); usb_attach_sub(dev, bus); + mtx_unlock(&Giant); + } } } } else { @@ -487,7 +499,7 @@ usb_post_init(void *arg) usb_needs_explore_all(); - newbus_xunlock(); + mtx_unlock(&Giant); } SYSINIT(usb_post_init, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, usb_post_init, NULL); Modified: head/sys/dev/usb/input/ukbd.c ============================================================================== --- head/sys/dev/usb/input/ukbd.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/usb/input/ukbd.c Thu Aug 20 19:17:53 2009 (r196403) @@ -745,7 +745,7 @@ ukbd_attach(device_t dev) uint16_t n; uint16_t hid_len; - mtx_lock(&Giant); + mtx_assert(&Giant, MA_OWNED); kbd_init_struct(kbd, UKBD_DRIVER_NAME, KB_OTHER, unit, 0, 0, 0); @@ -854,6 +854,9 @@ ukbd_attach(device_t dev) if (bootverbose) { genkbd_diag(kbd, bootverbose); } + /* lock keyboard mutex */ + + mtx_lock(&Giant); /* start the keyboard */ @@ -876,7 +879,7 @@ ukbd_detach(device_t dev) struct ukbd_softc *sc = device_get_softc(dev); int error; - mtx_lock(&Giant); + mtx_assert(&Giant, MA_OWNED); DPRINTF("\n"); @@ -913,8 +916,6 @@ ukbd_detach(device_t dev) usb_callout_drain(&sc->sc_callout); - mtx_unlock(&Giant); - DPRINTF("%s: disconnected\n", device_get_nameunit(dev)); @@ -926,9 +927,9 @@ ukbd_resume(device_t dev) { struct ukbd_softc *sc = device_get_softc(dev); - mtx_lock(&Giant); + mtx_assert(&Giant, MA_OWNED); + ukbd_clear_state(&sc->sc_kbd); - mtx_unlock(&Giant); return (0); } Modified: head/sys/dev/usb/net/usb_ethernet.c ============================================================================== --- head/sys/dev/usb/net/usb_ethernet.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/usb/net/usb_ethernet.c Thu Aug 20 19:17:53 2009 (r196403) @@ -221,10 +221,10 @@ ue_attach_post_task(struct usb_proc_msg if (ue->ue_methods->ue_mii_upd != NULL && ue->ue_methods->ue_mii_sts != NULL) { - newbus_xlock(); + mtx_lock(&Giant); /* device_xxx() depends on this */ error = mii_phy_probe(ue->ue_dev, &ue->ue_miibus, ue_ifmedia_upd, ue->ue_methods->ue_mii_sts); - newbus_xunlock(); + mtx_unlock(&Giant); if (error) { device_printf(ue->ue_dev, "MII without any PHY\n"); goto error; @@ -279,12 +279,9 @@ uether_ifdetach(struct usb_ether *ue) /* detach miibus */ if (ue->ue_miibus != NULL) { - - /* - * It is up to the callers to provide the correct - * newbus locking. - */ + mtx_lock(&Giant); /* device_xxx() depends on this */ device_delete_child(ue->ue_dev, ue->ue_miibus); + mtx_unlock(&Giant); } /* detach ethernet */ Modified: head/sys/dev/usb/usb_compat_linux.c ============================================================================== --- head/sys/dev/usb/usb_compat_linux.c Thu Aug 20 14:20:56 2009 (r196402) +++ head/sys/dev/usb/usb_compat_linux.c Thu Aug 20 19:17:53 2009 (r196403) @@ -215,12 +215,14 @@ usb_linux_probe(device_t dev) if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); } + mtx_lock(&Giant); LIST_FOREACH(udrv, &usb_linux_driver_list, linux_driver_list) { if (usb_linux_lookup_id(udrv->id_table, uaa)) { err = 0; break; } } + mtx_unlock(&Giant); return (err); } @@ -237,7 +239,9 @@ usb_linux_get_usb_driver(struct usb_linu { struct usb_driver *udrv; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From jhb at FreeBSD.org Thu Aug 20 19:23:58 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Thu Aug 20 19:24:07 2009 Subject: svn commit: r196404 - in head: share/man/man9 sys/kern sys/sys Message-ID: <200908201923.n7KJNwwc096363@svn.freebsd.org> Author: jhb Date: Thu Aug 20 19:23:58 2009 New Revision: 196404 URL: http://svn.freebsd.org/changeset/base/196404 Log: Change the 'resid' parameter to sglist_consume_uio() from an int to a size_t to match the recent type change of the uio_resid member of struct uio. Approved by: re (kib) Modified: head/share/man/man9/sglist.9 head/sys/kern/subr_sglist.c head/sys/sys/sglist.h Modified: head/share/man/man9/sglist.9 ============================================================================== --- head/share/man/man9/sglist.9 Thu Aug 20 19:17:53 2009 (r196403) +++ head/share/man/man9/sglist.9 Thu Aug 20 19:23:58 2009 (r196404) @@ -70,7 +70,7 @@ .Ft struct sglist * .Fn sglist_clone "struct sglist *sg" "int mflags" .Ft int -.Fn sglist_consume_uio "struct sglist *sg" "struct uio *uio" "int resid" +.Fn sglist_consume_uio "struct sglist *sg" "struct uio *uio" "size_t resid" .Ft int .Fn sglist_count "void *buf" "size_t len" .Ft void Modified: head/sys/kern/subr_sglist.c ============================================================================== --- head/sys/kern/subr_sglist.c Thu Aug 20 19:17:53 2009 (r196403) +++ head/sys/kern/subr_sglist.c Thu Aug 20 19:23:58 2009 (r196404) @@ -315,7 +315,7 @@ sglist_append_uio(struct sglist *sg, str * segments, then only the amount that fits is appended. */ int -sglist_consume_uio(struct sglist *sg, struct uio *uio, int resid) +sglist_consume_uio(struct sglist *sg, struct uio *uio, size_t resid) { struct iovec *iov; size_t done; Modified: head/sys/sys/sglist.h ============================================================================== --- head/sys/sys/sglist.h Thu Aug 20 19:17:53 2009 (r196403) +++ head/sys/sys/sglist.h Thu Aug 20 19:23:58 2009 (r196404) @@ -91,7 +91,7 @@ int sglist_append_user(struct sglist *sg struct thread *td); struct sglist *sglist_build(void *buf, size_t len, int mflags); struct sglist *sglist_clone(struct sglist *sg, int mflags); -int sglist_consume_uio(struct sglist *sg, struct uio *uio, int resid); +int sglist_consume_uio(struct sglist *sg, struct uio *uio, size_t resid); int sglist_count(void *buf, size_t len); void sglist_free(struct sglist *sg); int sglist_join(struct sglist *first, struct sglist *second); From zec at FreeBSD.org Thu Aug 20 22:39:20 2009 From: zec at FreeBSD.org (Marko Zec) Date: Thu Aug 20 22:39:33 2009 Subject: svn commit: r196409 - head/tools/tools/vimage Message-ID: <200908202239.n7KMdKhP001640@svn.freebsd.org> Author: zec Date: Thu Aug 20 22:39:20 2009 New Revision: 196409 URL: http://svn.freebsd.org/changeset/base/196409 Log: vimage(8) is a legacy CLI interface for managing jails associated with network stack instances, which is provided for compatibility with older applications. This change brings it back to life in a followup to the initial conversion of vimage to use the new jail(4) userland-kernel API: - when creating vimages via "vimage -c", by default turn on a few options expected by legacy applications, such as allow operations on raw sockets, FS mounts etc, and allow jail-related parameters to be optionally configured. - introduce the "-m" modifier which allows for configuring jail parameters of existing vimages / vnet-jails. - make "vimage name command ..." actually work. - when reassigning ifnets to vnets using "vimage -i", attempt to rename the ifnet as "ethXXX" on arrival in the target vnet. Several legacy applications are known to depend heavily on such behavior. - vimage -l lists only jails associated with vnets. The output is sorted using vimage / jail names as keys. - vimage -l by default searches only the current level in the jail hierarchy. Recursive listing can be requested via -r switch. - vimage -l by default prints only jail names on each line, making such output suitable for pipelining to other commands. More verbose output can be obtained via -v switch, and even more jail specific information will be displayed if -j switch is turned on. - there's no need to build vimage as statically linked, so update the Makefile accordingly. - update the vimage.8 man page. Approved by: re (rwatson), julian (mentor) MFC after: immediately Modified: head/tools/tools/vimage/Makefile head/tools/tools/vimage/vimage.8 head/tools/tools/vimage/vimage.c Modified: head/tools/tools/vimage/Makefile ============================================================================== --- head/tools/tools/vimage/Makefile Thu Aug 20 21:29:49 2009 (r196408) +++ head/tools/tools/vimage/Makefile Thu Aug 20 22:39:20 2009 (r196409) @@ -10,6 +10,5 @@ CFLAGS+= -I../../../sys MAN= vimage.8 BINDIR?= /usr/sbin -NO_SHARED?= YES .include Modified: head/tools/tools/vimage/vimage.8 ============================================================================== --- head/tools/tools/vimage/vimage.8 Thu Aug 20 21:29:49 2009 (r196408) +++ head/tools/tools/vimage/vimage.8 Thu Aug 20 22:39:20 2009 (r196409) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2002, 2003 Marko Zec +.\" Copyright (c) 2002, 2003 Marko Zec .\" Copyright (c) 2009 University of Zagreb .\" Copyright (c) 2009 FreeBSD Foundation .\" @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 6, 2009 +.Dd August 25, 2009 .Dt VIMAGE 8 .Os .Sh NAME @@ -35,35 +35,46 @@ .Nd manage virtual network stacks .Sh SYNOPSIS .Nm -.Ar vi_name -.Op command -.Nm -.Fl c -.Ar vi_name +.Op Fl c | m +.Ar vname +.Op Ar param=value ... .Nm .Fl d -.Ar vi_name +.Ar vname .Nm .Fl l -.Op Ar vi_name +.Op Fl rvj +.Op Ar vname .Nm .Fl i -.Ar vi_name interface +.Ar vname ifname +.Op Ar newifname +.Nm +.Ar vi_name +.Op command ... .Sh DESCRIPTION +The .Nm -command is an interm user interface for controlling the virtual network -stacks in FreeBSD. +utility is an alternative user interface for controlling virtual network +stacks in FreeBSD, aimed primarily at supporting legacy applications +which are not yet converted to using +.Xr jail 8 , +.Xr jexec 8 , +and +.Xr jls 8 . +. .Ss Overview -A virtual image reprepresents an isolated operating environment with its -own independent network stack instance. Every process, socket and network -interface present in the system is always attached to one, and only one, -virtual image i.e. virtual network stack instance. -During the system bootup sequence default virtual image is created to -which all the configured interfaces and user processes are initially -assigned. -Assuming that enough system resources and per virtual image privileges -are provided, the super-user can create and manage a hierarchy of -subordinated virtual images. The +A virtual image or vimage is a jail with its own independent network +stack instance. Every process, socket and network interface present +in the system is always attached to one, and only one, virtual network +stack instance (vnet). +During system bootup sequence a default vnet +is created to which all the configured interfaces and user processes +are initially attached. +Assuming that enough system resources are +are available, a user with sufficient privileges can create and manage +a hierarchy of subordinated virtual images. +The .Nm command allows for creation, deletion and monitoring of virtual images, as well as for execution of arbitrary processes in a targeted virtual @@ -71,59 +82,72 @@ image. .Ss Invocation If invoked with no modifiers, the .Nm -command spawns a new shell process in virtual image -.Ar vi_name . -If provided, the optional arguments following the virtual image name -.Ar vi_name -are interpreted as a standard command line issued at a shell, -otherwise an interactive shell is started in the target virtual image. +command spawns a new interactive shell in virtual image +.Ar vname . +If optional additional arguments following +.Ar vname +are provided, the first of those will be executed in place of the +interactive shell, and the rest of the arguments will be passed as +arguments to the executed command. .Pp -The following parameters are available: +The following modifiers are available: .Bl -tag -width indent .It Fl c Create a new virtual image named -.So -.Ar vi_name -.Sc . +.Ar vname . +Additional arguments, if provided, may be used to specify operating +parameters different from defaults, in format +.Ar param=value . +See +.Xr jail 8 +for an extensive list of available parameters. +.It Fl m +Modify the parameters of a virtual image named +.Ar vname , +using the same syntax as with the -c form of the command. .It Fl d Delete the virtual image -.Ar vi_name . +.Ar vname . No processes and/or sockets should exist in the target virtual image -in order for the delete request to succeed. Non-loopback interfaces +in order for the delete request to succeed. Non-loopback interfaces residing in the target virtual image will be reassigned to the virtual image's parent. .It Fl l List the properties and statistics for virtual images one level below the current one in the hierarchy. If an optional argument -.Ar vi_name +.Ar vname is provided, only the information regarding the target virtual image -.Ar vi_name +.Ar vname is displayed. -.It Fl lr -List the properties and statistics for all virtual images in -the hierarchy of subordinated vimages. If an optional argument -.Ar vi_name -is provided, the hierarchy will be traversed at and below the -.Ar vi_name -level. +With the optional +.Op Ar -r +switch enabled the list will include all virtual images below the +current level in the vimage hierarchy. +Enabling the optional +.Op Ar -v +or +.Op Ar -j +switches results in a more detailed output. .It Fl i -Move the interface -.Ar interface +Move interface +.Ar ifname to the target virtual image -.Ar vi_name . -If the value of -.Ar vi_name -argument is -.So .. +.Ar vname . +Interfaces will be automatically renamed to +.So +ethXX .Sc , -the interface is returned to the parent of the current virtual image. +unless an optional argument specifying the desired interface name +.Op Ar newifname +is provided. .El .Sh EXAMPLES Create a new virtual image named .So v1 -.Sc : +.Sc , +which is allowed to create and manage an own subhierarchy of vimages: .Pp -.Dl vimage -c v1 +.Dl vimage -c v1 children.max=100 .Pp Execute the .So ifconfig @@ -137,28 +161,35 @@ Move the interface .So vlan0 .Sc to the virtual image .So v1 +.Sc while renaming the interface as +.So +ve0 .Sc : .Pp -.Dl vimage -i v1 vlan0 +.Dl vimage -i v1 vlan0 ve0 .Pp Show the status information for virtual image .So v1 .Sc : .Pp -.Dl vimage -l v1 +.Dl vimage -lv v1 .Sh DIAGNOSTICS The .Nm command exits 0 on success, and >0 if an error occurs. .Sh SEE ALSO .Xr jail 8 +.Xr jexec 8 +.Xr jls 8 .Sh BUGS -If memory allocation failure occurs during the vimage creation, it will remain -undetected/ignored in the current implementation, thus latently scheduling -an almost imminent system crash in the future. +Deletion of vimages / vnets is known to leak kernel memory and fail at +stopping various timers, hence may lead to system crashes. .Sh AUTHOR .An "Marko Zec" Aq zec@fer.hr .Sh HISTORY -The -.Nm -facility first appeared as a patch against FreeBSD 4.7-RELEASE in 2002. +Network stack virtualization framework first appeared as a patchset +against the FreeBSD 4.7 kernel in 2002, and was maintained outside +of the main FreeBSD tree. +As a result of a project sponsored by the FreeBSD Foundation and +Stiching NLNet, integrated virtualized network stack first appeared +in FreeBSD 8.0. Modified: head/tools/tools/vimage/vimage.c ============================================================================== --- head/tools/tools/vimage/vimage.c Thu Aug 20 21:29:49 2009 (r196408) +++ head/tools/tools/vimage/vimage.c Thu Aug 20 22:39:20 2009 (r196409) @@ -28,142 +28,294 @@ */ #include -#include #include #include #include #include -#include +#include #include #include #include #include #include -#define VI_CREATE 0x00000001 -#define VI_DESTROY 0x00000002 -#define VI_SWITCHTO 0x00000008 -#define VI_IFACE 0x00000010 -#define VI_GET 0x00000100 -#define VI_GETNEXT 0x00000200 +typedef enum { + VI_SWITCHTO, + VI_CREATE, + VI_MODIFY, + VI_DESTROY, + VI_IFMOVE, + VI_GET +} vi_cmd_t; + +typedef struct vimage_status { + char name[MAXPATHLEN]; /* Must be first field for strcmp(). */ + char path[MAXPATHLEN]; + char hostname[MAXPATHLEN]; + char domainname[MAXPATHLEN]; + int jid; + int parentjid; + int vnet; + int childcnt; + int childmax; + int cpuset; + int rawsock; + int socket_af; + int mount; +} vstat_t; + +#define VST_SIZE_STEP 1024 +#define MAXPARAMS 32 + +static int getjail(vstat_t *, int, int); + +static char *invocname; + +static void +usage(void) +{ -static int getjail(char *name, int lastjid, int *vnet); + fprintf(stderr, + "usage: %s [-c | -m] vname [param=value ...]\n" + " %s -d vname\n" + " %s -l[rvj] [vname]\n" + " %s -i vname ifname [newifname]\n" + " %s vname [command ...]\n", + invocname, invocname, invocname, invocname, invocname); + exit(1); +} int main(int argc, char **argv) { - int s; - char *shell; - int cmd; - int jid, vnet; + struct jailparam params[MAXPARAMS]; + char ifname[IFNAMSIZ]; struct ifreq ifreq; - char name[MAXHOSTNAMELEN]; - - switch (argc) { - - case 1: - cmd = 0; - break; - - case 2: - if (strcmp(argv[1], "-l") == 0) - cmd = VI_GETNEXT; - else if (strcmp(argv[1], "-lr") == 0) - cmd = VI_GETNEXT; - else { - strcpy(name, argv[1]); - cmd = VI_SWITCHTO; + vi_cmd_t newcmd, cmd; + int recurse = 0; + int verbose = 0; + int jid, i, s, namelen; + int vst_size, vst_last; + vstat_t *vst; + char *str; + char ch; + + invocname = argv[0]; + + newcmd = cmd = VI_SWITCHTO; /* Default if no modifiers specified. */ + while ((ch = getopt(argc, argv, "cdijlmrv")) != -1) { + switch (ch) { + case 'c': + newcmd = VI_CREATE; + break; + case 'm': + newcmd = VI_MODIFY; + break; + case 'd': + newcmd = VI_DESTROY; + break; + case 'l': + newcmd = VI_GET; + break; + case 'i': + newcmd = VI_IFMOVE; + break; + case 'r': + recurse = 1; + break; + case 'v': + verbose++; + break; + case 'j': + verbose = 2; + break; + default: + usage(); } - break; - - case 3: - strcpy(name, argv[2]); - if (strcmp(argv[1], "-l") == 0) - cmd = VI_GET; - if (strcmp(argv[1], "-c") == 0) - cmd = VI_CREATE; - if (strcmp(argv[1], "-d") == 0) - cmd = VI_DESTROY; - break; - - default: - strcpy(name, argv[2]); - if (strcmp(argv[1], "-c") == 0) - cmd = VI_CREATE; - if (strcmp(argv[1], "-i") == 0) - cmd = VI_IFACE; + if (cmd == VI_SWITCHTO || cmd == newcmd) + cmd = newcmd; + else + usage(); } + argc -= optind; + argv += optind; - switch (cmd) { + if ((cmd != VI_GET && (argc == 0 || recurse != 0 || verbose != 0)) || + (cmd == VI_IFMOVE && (argc < 2 || argc > 3)) || + (cmd == VI_MODIFY && argc < 2) || argc >= MAXPARAMS) + usage(); + switch (cmd) { case VI_GET: - jid = getjail(name, -1, &vnet); - if (jid < 0) - goto abort; - printf("%d: %s%s\n", jid, name, vnet ? "" : " (no vnet)"); - exit(0); - - case VI_GETNEXT: + vst_last = 0; + vst_size = VST_SIZE_STEP; + if ((vst = malloc(vst_size * sizeof(*vst))) == NULL) + break; + if (argc == 1) + namelen = strlen(argv[0]); + else + namelen = 0; jid = 0; - while ((jid = getjail(name, jid, &vnet)) > 0) - printf("%d: %s%s\n", jid, name, - vnet ? "" : " (no vnet)"); + while ((jid = getjail(&vst[vst_last], jid, verbose)) > 0) { + /* Skip jails which do not own vnets. */ + if (vst[vst_last].vnet != 1) + continue; + /* Skip non-matching vnames / hierarchies. */ + if (namelen && + ((strlen(vst[vst_last].name) < namelen || + strncmp(vst[vst_last].name, argv[0], namelen) != 0) + || (strlen(vst[vst_last].name) > namelen && + vst[vst_last].name[namelen] != '.'))) + continue; + /* Skip any sub-trees if -r not requested. */ + if (!recurse && + (strlen(vst[vst_last].name) < namelen || + strchr(&vst[vst_last].name[namelen], '.') != NULL)) + continue; + /* Grow vst table if necessary. */ + if (++vst_last == vst_size) { + vst_size += VST_SIZE_STEP; + vst = realloc(vst, vst_size * sizeof(*vst)); + if (vst == NULL) + break; + } + } + if (vst == NULL) + break; + /* Sort: the key is the 1st field in *vst, i.e. vimage name. */ + qsort(vst, vst_last, sizeof(*vst), (void *) strcmp); + for (i = 0; i < vst_last; i++) { + if (!verbose) { + printf("%s\n", vst[i].name); + continue; + } + + printf("%s:\n", vst[i].name); + printf(" Path: %s\n", vst[i].path); + printf(" Hostname: %s\n", vst[i].hostname); + printf(" Domainname: %s\n", vst[i].domainname); + printf(" Children: %d\n", vst[i].childcnt); + + if (verbose < 2) + continue; + + printf(" Children limit: %d\n", vst[i].childmax); + printf(" CPUsetID: %d\n", vst[i].cpuset); + printf(" JID: %d\n", vst[i].jid); + printf(" PJID: %d\n", vst[i].parentjid); + printf(" Raw sockets allowed: %d\n", vst[i].rawsock); + printf(" All AF allowed: %d\n", vst[i].socket_af); + printf(" Mount allowed: %d\n", vst[i].mount); + } + free(vst); exit(0); - case VI_IFACE: - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s == -1) - goto abort; - jid = jail_getid(name); - if (jid < 0) - goto abort; + case VI_IFMOVE: + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) + break; + if ((jid = jail_getid(argv[0])) < 0) + break; ifreq.ifr_jid = jid; - strncpy(ifreq.ifr_name, argv[3], sizeof(ifreq.ifr_name)); + strncpy(ifreq.ifr_name, argv[1], sizeof(ifreq.ifr_name)); if (ioctl(s, SIOCSIFVNET, (caddr_t)&ifreq) < 0) - goto abort; - printf("%s@%s\n", ifreq.ifr_name, name); + break; + close(s); + if (argc == 3) + snprintf(ifname, sizeof(ifname), "%s", argv[2]); + else + snprintf(ifname, sizeof(ifname), "eth0"); + ifreq.ifr_data = ifname; + /* Do we need to rename the ifnet? */ + if (strcmp(ifreq.ifr_name, ifname) != 0) { + /* Switch to the context of the target vimage. */ + if (jail_attach(jid) < 0) + break; + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) + break; + for (namelen = 0; isalpha(ifname[namelen]); namelen++); + i = 0; + /* Search for a free ifunit in target vnet. Unsafe. */ + while (ioctl(s, SIOCSIFNAME, (caddr_t)&ifreq) < 0) { + snprintf(&ifname[namelen], + sizeof(ifname) - namelen, "%d", i); + /* Emergency brake. */ + if (i++ == IF_MAXUNIT) + break; + } + } + if (i < IF_MAXUNIT) + printf("%s@%s\n", ifname, argv[0]); + else + printf("%s@%s\n", ifreq.ifr_name, argv[0]); exit(0); case VI_CREATE: - if (jail_setv(JAIL_CREATE, "name", name, "vnet", NULL, - "host", NULL, "persist", NULL, NULL) < 0) - goto abort; + if ((jid = jail_setv(JAIL_CREATE, + "name", argv[0], + "vnet", NULL, + "host", NULL, + "persist", NULL, + "allow.raw_sockets", "true", + "allow.socket_af", "true", + "allow.mount", "true", + NULL)) >= 0) + break; + if (jid < 0) + break; + if (argc == 1) + exit(0); + /* Not done yet, proceed to apply non-default parameters. */ + + case VI_MODIFY: + jailparam_init(¶ms[0], "name"); + jailparam_import(¶ms[0], argv[0]); + for (i = 1; i < argc; i++) { + for (str = argv[i]; *str != '=' && *str != 0; str++) { + /* Do nothing - search for '=' delimeter. */ + } + if (*str == 0) + break; + *str++ = 0; + if (*str == 0) + break; + jailparam_init(¶ms[i], argv[i]); + jailparam_import(¶ms[i], str); + } + if (i != argc) + break; + if (jailparam_set(params, i, JAIL_UPDATE) < 0) + break; + exit(0); + + case VI_DESTROY: + if ((jid = jail_getid(argv[0])) < 0) + break; + if (jail_remove(jid) < 0) + break; exit(0); case VI_SWITCHTO: - jid = jail_getid(name); - if (jid < 0) - goto abort; + if ((jid = jail_getid(argv[0])) < 0) + break; if (jail_attach(jid) < 0) - goto abort; - - if (argc == 2) { - printf("Switched to jail %s\n", argv[1]); - if ((shell = getenv("SHELL")) == NULL) - execlp("/bin/sh", argv[0], NULL); + break; + if (argc == 1) { + printf("Switched to vimage %s\n", argv[0]); + if ((str = getenv("SHELL")) == NULL) + execlp("/bin/sh", invocname, NULL); else - execlp(shell, argv[0], NULL); + execlp(str, invocname, NULL); } else - execvp(argv[2], &argv[2]); + execvp(argv[1], &argv[1]); break; - case VI_DESTROY: - jid = jail_getid(name); - if (jid < 0) - goto abort; - if (jail_remove(jid) < 0) - goto abort; - exit(0); - default: - fprintf(stderr, "usage: %s [-cdilr] vi_name [args]\n", - argv[0]); - exit(1); + /* Should be unreachable. */ + break; } -abort: if (jail_errmsg[0]) fprintf(stderr, "Error: %s\n", jail_errmsg); else @@ -172,27 +324,69 @@ abort: } static int -getjail(char *name, int lastjid, int *vnet) +getjail(vstat_t *vs, int lastjid, int verbose) { - struct jailparam params[3]; - int jid; + struct jailparam params[32]; /* Must be > max(psize). */ + int psize = 0; - if (lastjid < 0) { - jid = jail_getid(name); - if (jid < 0) - return (jid); - jailparam_init(¶ms[0], "jid"); - jailparam_import_raw(¶ms[0], &jid, sizeof jid); - } else { - jailparam_init(¶ms[0], "lastjid"); - jailparam_import_raw(¶ms[0], &lastjid, sizeof lastjid); - } - jailparam_init(¶ms[1], "name"); - jailparam_import_raw(¶ms[1], name, MAXHOSTNAMELEN); - name[0] = 0; - jailparam_init(¶ms[2], "vnet"); - jailparam_import_raw(¶ms[2], vnet, sizeof(*vnet)); - jid = jailparam_get(params, 3, 0); - jailparam_free(params, 3); - return (jid); + bzero(params, sizeof(params)); + bzero(vs, sizeof(*vs)); + + jailparam_init(¶ms[psize], "lastjid"); + jailparam_import_raw(¶ms[psize++], &lastjid, sizeof lastjid); + + jailparam_init(¶ms[psize], "vnet"); + jailparam_import_raw(¶ms[psize++], &vs->vnet, sizeof(vs->vnet)); + + jailparam_init(¶ms[psize], "name"); + jailparam_import_raw(¶ms[psize++], &vs->name, sizeof(vs->name)); + + if (verbose == 0) + goto done; + + jailparam_init(¶ms[psize], "path"); + jailparam_import_raw(¶ms[psize++], &vs->path, sizeof(vs->path)); + + jailparam_init(¶ms[psize], "host.hostname"); + jailparam_import_raw(¶ms[psize++], &vs->hostname, + sizeof(vs->hostname)); + + jailparam_init(¶ms[psize], "host.domainname"); + jailparam_import_raw(¶ms[psize++], &vs->domainname, + sizeof(vs->domainname)); + + jailparam_init(¶ms[psize], "children.cur"); + jailparam_import_raw(¶ms[psize++], &vs->childcnt, + sizeof(vs->childcnt)); + + if (verbose == 1) + goto done; + + jailparam_init(¶ms[psize], "children.max"); + jailparam_import_raw(¶ms[psize++], &vs->childmax, + sizeof(vs->childmax)); + + jailparam_init(¶ms[psize], "cpuset.id"); + jailparam_import_raw(¶ms[psize++], &vs->cpuset, + sizeof(vs->cpuset)); + + jailparam_init(¶ms[psize], "parent"); + jailparam_import_raw(¶ms[psize++], &vs->parentjid, + sizeof(vs->parentjid)); + + jailparam_init(¶ms[psize], "allow.raw_sockets"); + jailparam_import_raw(¶ms[psize++], &vs->rawsock, + sizeof(vs->rawsock)); + + jailparam_init(¶ms[psize], "allow.socket_af"); + jailparam_import_raw(¶ms[psize++], &vs->socket_af, + sizeof(vs->socket_af)); + + jailparam_init(¶ms[psize], "allow.mount"); + jailparam_import_raw(¶ms[psize++], &vs->mount, sizeof(vs->mount)); + +done: + vs->jid = jailparam_get(params, psize, 0); + jailparam_free(params, psize); + return (vs->jid); } From peter at FreeBSD.org Thu Aug 20 22:53:29 2009 From: peter at FreeBSD.org (Peter Wemm) Date: Thu Aug 20 22:53:41 2009 Subject: svn commit: r196410 - head/sys/netinet Message-ID: <200908202253.n7KMrSUs002026@svn.freebsd.org> Author: peter Date: Thu Aug 20 22:53:28 2009 New Revision: 196410 URL: http://svn.freebsd.org/changeset/base/196410 Log: Fix signed comparison bug when ticks goes negative after 24 days of uptime. This causes the tcp time_wait state code to fail to expire sockets in timewait state. Approved by: re (kensmith) Modified: head/sys/netinet/tcp_timewait.c Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Thu Aug 20 22:39:20 2009 (r196409) +++ head/sys/netinet/tcp_timewait.c Thu Aug 20 22:53:28 2009 (r196410) @@ -603,7 +603,7 @@ tcp_tw_2msl_scan(int reuse) INP_INFO_WLOCK_ASSERT(&V_tcbinfo); for (;;) { tw = TAILQ_FIRST(&V_twq_2msl); - if (tw == NULL || (!reuse && tw->tw_time > ticks)) + if (tw == NULL || (!reuse && (tw->tw_time - ticks) > 0)) break; INP_WLOCK(tw->tw_inpcb); tcp_twclose(tw, reuse); From jkim at FreeBSD.org Thu Aug 20 22:58:06 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Thu Aug 20 22:58:12 2009 Subject: svn commit: r196412 - in head/sys: amd64/amd64 i386/i386 Message-ID: <200908202258.n7KMw5sU002300@svn.freebsd.org> Author: jkim Date: Thu Aug 20 22:58:05 2009 New Revision: 196412 URL: http://svn.freebsd.org/changeset/base/196412 Log: Check whether the SMBIOS reports reasonable amount of memory. If it is less than "avail memory", fall back to Maxmem to avoid user confusion. We use SMBIOS information to display "real memory" since r190599 but some broken SMBIOS implementation reported only half of actual memory. Tested by: bz Approved by: re (kib) Modified: head/sys/amd64/amd64/machdep.c head/sys/i386/i386/machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Thu Aug 20 22:56:29 2009 (r196411) +++ head/sys/amd64/amd64/machdep.c Thu Aug 20 22:58:05 2009 (r196412) @@ -236,19 +236,21 @@ cpu_startup(dummy) #ifdef PERFMON perfmon_init(); #endif + realmem = Maxmem; + + /* + * Display physical memory if SMBIOS reports reasonable amount. + */ + memsize = 0; sysenv = getenv("smbios.memory.enabled"); if (sysenv != NULL) { - memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10); + memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10) << 10; freeenv(sysenv); - } else - memsize = 0; - if (memsize > 0) - printf("real memory = %ju (%ju MB)\n", memsize << 10, - memsize >> 10); - else - printf("real memory = %ju (%ju MB)\n", ptoa((uintmax_t)Maxmem), - ptoa((uintmax_t)Maxmem) / 1048576); - realmem = Maxmem; + } + if (memsize < ptoa((uintmax_t)cnt.v_free_count)) + memsize = ptoa((uintmax_t)Maxmem); + printf("real memory = %ju (%ju MB)\n", memsize, memsize >> 20); + /* * Display any holes after the first chunk of extended memory. */ Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Thu Aug 20 22:56:29 2009 (r196411) +++ head/sys/i386/i386/machdep.c Thu Aug 20 22:58:05 2009 (r196412) @@ -280,19 +280,21 @@ cpu_startup(dummy) #ifdef PERFMON perfmon_init(); #endif + realmem = Maxmem; + + /* + * Display physical memory if SMBIOS reports reasonable amount. + */ + memsize = 0; sysenv = getenv("smbios.memory.enabled"); if (sysenv != NULL) { - memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10); + memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10) << 10; freeenv(sysenv); - } else - memsize = 0; - if (memsize > 0) - printf("real memory = %ju (%ju MB)\n", memsize << 10, - memsize >> 10); - else - printf("real memory = %ju (%ju MB)\n", ptoa((uintmax_t)Maxmem), - ptoa((uintmax_t)Maxmem) / 1048576); - realmem = Maxmem; + } + if (memsize < ptoa((uintmax_t)cnt.v_free_count)) + memsize = ptoa((uintmax_t)Maxmem); + printf("real memory = %ju (%ju MB)\n", memsize, memsize >> 20); + /* * Display any holes after the first chunk of extended memory. */ From kensmith at FreeBSD.org Fri Aug 21 01:00:16 2009 From: kensmith at FreeBSD.org (Ken Smith) Date: Fri Aug 21 01:00:27 2009 Subject: svn commit: r196415 - head/sys/dev/hptrr Message-ID: <200908210100.n7L10GsI006599@svn.freebsd.org> Author: kensmith Date: Fri Aug 21 01:00:15 2009 New Revision: 196415 URL: http://svn.freebsd.org/changeset/base/196415 Log: Fix a boot hang for hptrr(4) caused by changes introduced in r195534. It is necessary to make sure cpi->transport is set for xpt_scan_bus() to work properly. Submitted by: Bernhard Schmidt (scb+freebsd-current techwires net) Reviewed by: scottl Approved by: re (kib) Modified: head/sys/dev/hptrr/hptrr_osm_bsd.c Modified: head/sys/dev/hptrr/hptrr_osm_bsd.c ============================================================================== --- head/sys/dev/hptrr/hptrr_osm_bsd.c Thu Aug 20 23:07:53 2009 (r196414) +++ head/sys/dev/hptrr/hptrr_osm_bsd.c Fri Aug 21 01:00:15 2009 (r196415) @@ -814,6 +814,10 @@ static void hpt_action(struct cam_sim *s strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); strncpy(cpi->hba_vid, "HPT ", HBA_IDLEN); strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); + cpi->transport = XPORT_SPI; + cpi->transport_version = 2; + cpi->protocol = PROTO_SCSI; + cpi->protocol_version = SCSI_REV_2; cpi->ccb_h.status = CAM_REQ_CMP; break; } From jhb at FreeBSD.org Fri Aug 21 02:59:08 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Fri Aug 21 02:59:14 2009 Subject: svn commit: r196417 - in head: share/man/man9 sys/kern Message-ID: <200908210259.n7L2x7oc008957@svn.freebsd.org> Author: jhb Date: Fri Aug 21 02:59:07 2009 New Revision: 196417 URL: http://svn.freebsd.org/changeset/base/196417 Log: This patch fixes two bugs in sglist(9) and improves robustness of the API via better semantics if a request to append an address range to an existing list fails. - When cloning an sglist, properly set the length in the new sglist instead of leaving the new list empty. - Properly compute the amount of data added to an sglist via _sglist_append_buf(). This allows sglist_consume_uio() to properly update uio_resid. - When a request to append an address range to a scatter/gather list fails, restore the sglist to the state it had at the start of the function call instead of resetting it to an empty list. Requested by: np (3) Approved by: re (kib) Modified: head/share/man/man9/sglist.9 head/sys/kern/subr_sglist.c Modified: head/share/man/man9/sglist.9 ============================================================================== --- head/share/man/man9/sglist.9 Fri Aug 21 01:12:06 2009 (r196416) +++ head/share/man/man9/sglist.9 Fri Aug 21 02:59:07 2009 (r196417) @@ -191,6 +191,8 @@ Specifically, the family of routines can be used to append the physical address ranges described by an object to the end of a scatter/gather list. All of these routines return 0 on success or an error on failure. +If a request to append an address range to a scatter/gather list fails, +the scatter/gather list will remain unchanged. .Pp The .Nm sglist_append @@ -445,6 +447,7 @@ There are not enough available segments to append the physical address ranges from .Fa second . .El +.Pp The .Nm sglist_slice function returns the following errors on failure: @@ -470,6 +473,7 @@ list in .Fa *slice to describe the requested physical address ranges. .El +.Pp The .Nm sglist_split function returns the following errors on failure: Modified: head/sys/kern/subr_sglist.c ============================================================================== --- head/sys/kern/subr_sglist.c Fri Aug 21 01:12:06 2009 (r196416) +++ head/sys/kern/subr_sglist.c Fri Aug 21 02:59:07 2009 (r196417) @@ -48,6 +48,32 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_SGLIST, "sglist", "scatter/gather lists"); /* + * Convenience macros to save the state of an sglist so it can be restored + * if an append attempt fails. Since sglist's only grow we only need to + * save the current count of segments and the length of the ending segment. + * Earlier segments will not be changed by an append, and the only change + * that can occur to the ending segment is that it can be extended. + */ +struct sgsave { + u_short sg_nseg; + size_t ss_len; +}; + +#define SGLIST_SAVE(sg, sgsave) do { \ + (sgsave).sg_nseg = (sg)->sg_nseg; \ + if ((sgsave).sg_nseg > 0) \ + (sgsave).ss_len = (sg)->sg_segs[(sgsave).sg_nseg - 1].ss_len; \ + else \ + (sgsave).ss_len = 0; \ +} while (0) + +#define SGLIST_RESTORE(sg, sgsave) do { \ + (sg)->sg_nseg = (sgsave).sg_nseg; \ + if ((sgsave).sg_nseg > 0) \ + (sg)->sg_segs[(sgsave).sg_nseg - 1].ss_len = (sgsave).ss_len; \ +} while (0) + +/* * Append a single (paddr, len) to a sglist. sg is the list and ss is * the current segment in the list. If we run out of segments then * EFBIG will be returned. @@ -62,10 +88,8 @@ _sglist_append_range(struct sglist *sg, if (ss->ss_paddr + ss->ss_len == paddr) ss->ss_len += len; else { - if (sg->sg_nseg == sg->sg_maxseg) { - sg->sg_nseg = 0; + if (sg->sg_nseg == sg->sg_maxseg) return (EFBIG); - } ss++; ss->ss_paddr = paddr; ss->ss_len = len; @@ -107,26 +131,33 @@ _sglist_append_buf(struct sglist *sg, vo ss->ss_paddr = paddr; ss->ss_len = seglen; sg->sg_nseg = 1; - error = 0; } else { ss = &sg->sg_segs[sg->sg_nseg - 1]; error = _sglist_append_range(sg, &ss, paddr, seglen); + if (error) + return (error); } + vaddr += seglen; + len -= seglen; + if (donep) + *donep += seglen; - while (error == 0 && len > seglen) { - vaddr += seglen; - len -= seglen; - if (donep) - *donep += seglen; + while (len > 0) { seglen = MIN(len, PAGE_SIZE); if (pmap != NULL) paddr = pmap_extract(pmap, vaddr); else paddr = pmap_kextract(vaddr); error = _sglist_append_range(sg, &ss, paddr, seglen); + if (error) + return (error); + vaddr += seglen; + len -= seglen; + if (donep) + *donep += seglen; } - return (error); + return (0); } /* @@ -195,10 +226,16 @@ sglist_free(struct sglist *sg) int sglist_append(struct sglist *sg, void *buf, size_t len) { + struct sgsave save; + int error; if (sg->sg_maxseg == 0) return (EINVAL); - return (_sglist_append_buf(sg, buf, len, NULL, NULL)); + SGLIST_SAVE(sg, save); + error = _sglist_append_buf(sg, buf, len, NULL, NULL); + if (error) + SGLIST_RESTORE(sg, save); + return (error); } /* @@ -209,6 +246,8 @@ int sglist_append_phys(struct sglist *sg, vm_paddr_t paddr, size_t len) { struct sglist_seg *ss; + struct sgsave save; + int error; if (sg->sg_maxseg == 0) return (EINVAL); @@ -222,7 +261,11 @@ sglist_append_phys(struct sglist *sg, vm return (0); } ss = &sg->sg_segs[sg->sg_nseg - 1]; - return (_sglist_append_range(sg, &ss, paddr, len)); + SGLIST_SAVE(sg, save); + error = _sglist_append_range(sg, &ss, paddr, len); + if (error) + SGLIST_RESTORE(sg, save); + return (error); } /* @@ -233,6 +276,7 @@ sglist_append_phys(struct sglist *sg, vm int sglist_append_mbuf(struct sglist *sg, struct mbuf *m0) { + struct sgsave save; struct mbuf *m; int error; @@ -240,11 +284,14 @@ sglist_append_mbuf(struct sglist *sg, st return (EINVAL); error = 0; + SGLIST_SAVE(sg, save); for (m = m0; m != NULL; m = m->m_next) { if (m->m_len > 0) { error = sglist_append(sg, m->m_data, m->m_len); - if (error) + if (error) { + SGLIST_RESTORE(sg, save); return (error); + } } } return (0); @@ -258,11 +305,17 @@ sglist_append_mbuf(struct sglist *sg, st int sglist_append_user(struct sglist *sg, void *buf, size_t len, struct thread *td) { + struct sgsave save; + int error; if (sg->sg_maxseg == 0) return (EINVAL); - return (_sglist_append_buf(sg, buf, len, - vmspace_pmap(td->td_proc->p_vmspace), NULL)); + SGLIST_SAVE(sg, save); + error = _sglist_append_buf(sg, buf, len, + vmspace_pmap(td->td_proc->p_vmspace), NULL); + if (error) + SGLIST_RESTORE(sg, save); + return (error); } /* @@ -274,6 +327,7 @@ int sglist_append_uio(struct sglist *sg, struct uio *uio) { struct iovec *iov; + struct sgsave save; size_t resid, minlen; pmap_t pmap; int error, i; @@ -292,6 +346,7 @@ sglist_append_uio(struct sglist *sg, str pmap = NULL; error = 0; + SGLIST_SAVE(sg, save); for (i = 0; i < uio->uio_iovcnt && resid != 0; i++) { /* * Now at the first iovec to load. Load each iovec @@ -301,8 +356,10 @@ sglist_append_uio(struct sglist *sg, str if (minlen > 0) { error = _sglist_append_buf(sg, iov[i].iov_base, minlen, pmap, NULL); - if (error) + if (error) { + SGLIST_RESTORE(sg, save); return (error); + } resid -= minlen; } } @@ -397,6 +454,7 @@ sglist_clone(struct sglist *sg, int mfla new = sglist_alloc(sg->sg_maxseg, mflags); if (new == NULL) return (NULL); + new->sg_nseg = sg->sg_nseg; bcopy(sg->sg_segs, new->sg_segs, sizeof(struct sglist_seg) * sg->sg_nseg); return (new); From julian at FreeBSD.org Fri Aug 21 09:22:32 2009 From: julian at FreeBSD.org (Julian Elischer) Date: Fri Aug 21 09:22:44 2009 Subject: svn commit: r196419 - head/sys/net Message-ID: <200908210922.n7L9MWje017082@svn.freebsd.org> Author: julian Date: Fri Aug 21 09:22:32 2009 New Revision: 196419 URL: http://svn.freebsd.org/changeset/base/196419 Log: Don't allow access to the internals until it has all been set up. Specifically, not until the per-vnet parts have been set up. Submitted by: kmacy@ Reviewed by: julian@, zec@ Approved by: re(rwatson) MFC after: immediately Modified: head/sys/net/flowtable.c Modified: head/sys/net/flowtable.c ============================================================================== --- head/sys/net/flowtable.c Fri Aug 21 03:14:39 2009 (r196418) +++ head/sys/net/flowtable.c Fri Aug 21 09:22:32 2009 (r196419) @@ -999,6 +999,7 @@ flowtable_init_vnet(const void *unused _ NULL, NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET); uma_zone_set_max(V_flow_ipv4_zone, V_flowtable_nmbflows); uma_zone_set_max(V_flow_ipv6_zone, V_flowtable_nmbflows); + V_flowtable_ready = 1; } VNET_SYSINIT(flowtable_init_vnet, SI_SUB_KTHREAD_INIT, SI_ORDER_MIDDLE, flowtable_init_vnet, NULL); @@ -1011,7 +1012,6 @@ flowtable_init(const void *unused __unus mtx_init(&flowclean_lock, "flowclean lock", NULL, MTX_DEF); EVENTHANDLER_REGISTER(ifnet_departure_event, flowtable_flush, NULL, EVENTHANDLER_PRI_ANY); - V_flowtable_ready = 1; } SYSINIT(flowtable_init, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY, flowtable_init, NULL); @@ -1022,6 +1022,7 @@ static void flowtable_uninit(const void *unused __unused) { + V_flowtable_ready = 0; uma_zdestroy(V_flow_ipv4_zone); uma_zdestroy(V_flow_ipv6_zone); } From zec at FreeBSD.org Fri Aug 21 11:13:57 2009 From: zec at FreeBSD.org (Marko Zec) Date: Fri Aug 21 11:14:03 2009 Subject: svn commit: r196421 - head/tools/tools/vimage Message-ID: <200908211113.n7LBDuco020898@svn.freebsd.org> Author: zec Date: Fri Aug 21 11:13:56 2009 New Revision: 196421 URL: http://svn.freebsd.org/changeset/base/196421 Log: Bugfix: all requests for creating vnets via vimage -c were always reported as failures, even if the actual library / system call would succeed, because error message would be reported if the return value from jail_setv() call was >= 0, and if not, then if that same value was < 0, i.e. always. The correct behavior is to abort (only) if jail_setv() returns < 0. Approved by: re (rwatson), julian (mentor) Modified: head/tools/tools/vimage/vimage.c Modified: head/tools/tools/vimage/vimage.c ============================================================================== --- head/tools/tools/vimage/vimage.c Fri Aug 21 10:05:26 2009 (r196420) +++ head/tools/tools/vimage/vimage.c Fri Aug 21 11:13:56 2009 (r196421) @@ -252,7 +252,7 @@ main(int argc, char **argv) exit(0); case VI_CREATE: - if ((jid = jail_setv(JAIL_CREATE, + if (jail_setv(JAIL_CREATE, "name", argv[0], "vnet", NULL, "host", NULL, @@ -260,9 +260,7 @@ main(int argc, char **argv) "allow.raw_sockets", "true", "allow.socket_af", "true", "allow.mount", "true", - NULL)) >= 0) - break; - if (jid < 0) + NULL) < 0) break; if (argc == 1) exit(0); From julian at FreeBSD.org Fri Aug 21 11:20:10 2009 From: julian at FreeBSD.org (Julian Elischer) Date: Fri Aug 21 11:20:18 2009 Subject: svn commit: r196423 - in head/sys/netinet: . ipfw Message-ID: <200908211120.n7LBKAjw021131@svn.freebsd.org> Author: julian Date: Fri Aug 21 11:20:10 2009 New Revision: 196423 URL: http://svn.freebsd.org/changeset/base/196423 Log: Fix ipfw's initialization functions to get the correct order of evaluation to allow vnet and non vnet operation. Move some functions from ip_fw_pfil.c to ip_fw2.c and mode to mostly using the SYSINIT and VNET_SYSINIT handlers instead of the modevent handler. Correct some spelling errors in comments in the affected code. Note this bug fixes a crash in NON VIMAGE kernels when ipfw is unloaded. This patch is a minimal patch for 8.0 I have a much larger patch that actually fixes the underlying problems that will be applied after 8.0 Reviewed by: zec@, rwatson@, bz@(earlier version) Approved by: re (rwatson) MFC after: Immediatly Modified: head/sys/netinet/ip_fw.h head/sys/netinet/ipfw/ip_fw2.c head/sys/netinet/ipfw/ip_fw_pfil.c Modified: head/sys/netinet/ip_fw.h ============================================================================== --- head/sys/netinet/ip_fw.h Fri Aug 21 11:17:25 2009 (r196422) +++ head/sys/netinet/ip_fw.h Fri Aug 21 11:20:10 2009 (r196423) @@ -645,8 +645,10 @@ int ipfw_check_out(void *, struct mbuf * int ipfw_chk(struct ip_fw_args *); -int ipfw_init(void); -void ipfw_destroy(void); +int ipfw_hook(void); +int ipfw6_hook(void); +int ipfw_unhook(void); +int ipfw6_unhook(void); #ifdef NOTYET void ipfw_nat_destroy(void); #endif Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Fri Aug 21 11:17:25 2009 (r196422) +++ head/sys/netinet/ipfw/ip_fw2.c Fri Aug 21 11:20:10 2009 (r196423) @@ -102,6 +102,8 @@ __FBSDID("$FreeBSD$"); #include #endif +static VNET_DEFINE(int, ipfw_vnet_ready) = 0; +#define V_ipfw_vnet_ready VNET(ipfw_vnet_ready) /* * set_disable contains one bit per set value (0..31). * If the bit is set, all rules with the corresponding set @@ -2237,7 +2239,7 @@ ipfw_chk(struct ip_fw_args *args) /* end of ipv6 variables */ int is_ipv4 = 0; - if (m->m_flags & M_SKIP_FIREWALL) + if (m->m_flags & M_SKIP_FIREWALL || (! V_ipfw_vnet_ready)) return (IP_FW_PASS); /* accept */ dst_ip.s_addr = 0; /* make sure it is initialized */ @@ -4579,12 +4581,10 @@ done: CURVNET_RESTORE(); } - - /**************** * Stuff that must be initialised only on boot or module load */ -int +static int ipfw_init(void) { int error = 0; @@ -4623,9 +4623,11 @@ ipfw_init(void) default_to_accept ? "accept" : "deny"); /* - * Note: V_xxx variables can be accessed here but the iattach() - * may not have been called yet for the VIMGE case. - * Tuneables will have been processed. + * Note: V_xxx variables can be accessed here but the vnet specific + * initializer may not have been called yet for the VIMAGE case. + * Tuneables will have been processed. We will print out values for + * the default vnet. + * XXX This should all be rationalized AFTER 8.0 */ if (V_fw_verbose == 0) printf("disabled\n"); @@ -4636,6 +4638,20 @@ ipfw_init(void) V_verbose_limit); /* + * Hook us up to pfil. + * Eventually pfil will be per vnet. + */ + if ((error = ipfw_hook()) != 0) { + printf("ipfw_hook() error\n"); + return (error); + } +#ifdef INET6 + if ((error = ipfw6_hook()) != 0) { + printf("ipfw6_hook() error\n"); + return (error); + } +#endif + /* * Other things that are only done the first time. * (now that we a re cuaranteed of success). */ @@ -4645,8 +4661,8 @@ ipfw_init(void) } /**************** - * Stuff that must be initialised for every instance - * (including the forst of course). + * Stuff that must be initialized for every instance + * (including the first of course). */ static int vnet_ipfw_init(const void *unused) @@ -4726,17 +4742,17 @@ vnet_ipfw_init(const void *unused) #endif /* First set up some values that are compile time options */ + V_ipfw_vnet_ready = 1; /* Open for business */ return (0); } /********************** * Called for the removal of the last instance only on module unload. */ -void +static void ipfw_destroy(void) { - ip_fw_chk_ptr = NULL; - ip_fw_ctl_ptr = NULL; + uma_zdestroy(ipfw_dyn_rule_zone); IPFW_DYN_LOCK_DESTROY(); printf("IP firewall unloaded\n"); @@ -4750,7 +4766,9 @@ vnet_ipfw_uninit(const void *unused) { struct ip_fw *reap; + V_ipfw_vnet_ready = 0; /* tell new callers to go away */ callout_drain(&V_ipfw_timeout); + /* We wait on the wlock here until the last user leaves */ IPFW_WLOCK(&V_layer3_chain); flush_tables(&V_layer3_chain); V_layer3_chain.reap = NULL; @@ -4766,10 +4784,86 @@ vnet_ipfw_uninit(const void *unused) return 0; } -VNET_SYSINIT(vnet_ipfw_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY - 255, - vnet_ipfw_init, NULL); +/* + * Module event handler. + * In general we have the choice of handling most of these events by the + * event handler or by the (VNET_)SYS(UN)INIT handlers. I have chosen to + * use the SYSINIT handlers as they are more capable of expressing the + * flow of control during module and vnet operations, so this is just + * a skeleton. Note there is no SYSINIT equivalent of the module + * SHUTDOWN handler, but we don't have anything to do in that case anyhow. + */ +static int +ipfw_modevent(module_t mod, int type, void *unused) +{ + int err = 0; + + switch (type) { + case MOD_LOAD: + /* Called once at module load or + * system boot if compiled in. */ + break; + case MOD_UNLOAD: + break; + case MOD_QUIESCE: + /* Yes, the unhooks can return errors, we can safely ignore + * them. Eventually these will be done per jail as they + * shut down. We will wait on each vnet's l3 lock as existing + * callers go away. + */ + ipfw_unhook(); +#ifdef INET6 + ipfw6_unhook(); +#endif + /* layer2 and other entrypoints still come in this way. */ + ip_fw_chk_ptr = NULL; + ip_fw_ctl_ptr = NULL; + /* Called during unload. */ + break; + case MOD_SHUTDOWN: + /* Called during system shutdown. */ + break; + default: + err = EOPNOTSUPP; + break; + } + return err; +} + +static moduledata_t ipfwmod = { + "ipfw", + ipfw_modevent, + 0 +}; -VNET_SYSUNINIT(vnet_ipfw_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY - 255, - vnet_ipfw_uninit, NULL); +/* Define startup order. */ +#define IPFW_SI_SUB_FIREWALL SI_SUB_PROTO_IFATTACHDOMAIN +#define IPFW_MODEVENT_ORDER (SI_ORDER_ANY - 255) /* On boot slot in here. */ +#define IPFW_MODULE_ORDER (IPFW_MODEVENT_ORDER + 1) /* A little later. */ +#define IPFW_VNET_ORDER (IPFW_MODEVENT_ORDER + 2) /* Later still. */ + +DECLARE_MODULE(ipfw, ipfwmod, IPFW_SI_SUB_FIREWALL, IPFW_MODEVENT_ORDER); +MODULE_VERSION(ipfw, 2); +/* should declare some dependencies here */ + +/* + * Starting up. Done in order after ipfwmod() has been called. + * VNET_SYSINIT is also called for each existing vnet and each new vnet. + */ +SYSINIT(ipfw_init, IPFW_SI_SUB_FIREWALL, IPFW_MODULE_ORDER, + ipfw_init, NULL); +VNET_SYSINIT(vnet_ipfw_init, IPFW_SI_SUB_FIREWALL, IPFW_VNET_ORDER, + vnet_ipfw_init, NULL); + +/* + * Closing up shop. These are done in REVERSE ORDER, but still + * after ipfwmod() has been called. Not called on reboot. + * VNET_SYSUNINIT is also called for each exiting vnet as it exits. + * or when the module is unloaded. + */ +SYSUNINIT(ipfw_destroy, IPFW_SI_SUB_FIREWALL, IPFW_MODULE_ORDER, + ipfw_destroy, NULL); +VNET_SYSUNINIT(vnet_ipfw_uninit, IPFW_SI_SUB_FIREWALL, IPFW_VNET_ORDER, + vnet_ipfw_uninit, NULL); Modified: head/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_pfil.c Fri Aug 21 11:17:25 2009 (r196422) +++ head/sys/netinet/ipfw/ip_fw_pfil.c Fri Aug 21 11:20:10 2009 (r196423) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -441,7 +442,7 @@ nodivert: return 1; } -static int +int ipfw_hook(void) { struct pfil_head *pfh_inet; @@ -458,7 +459,7 @@ ipfw_hook(void) return 0; } -static int +int ipfw_unhook(void) { struct pfil_head *pfh_inet; @@ -476,7 +477,7 @@ ipfw_unhook(void) } #ifdef INET6 -static int +int ipfw6_hook(void) { struct pfil_head *pfh_inet6; @@ -493,7 +494,7 @@ ipfw6_hook(void) return 0; } -static int +int ipfw6_unhook(void) { struct pfil_head *pfh_inet6; @@ -517,6 +518,10 @@ ipfw_chg_hook(SYSCTL_HANDLER_ARGS) int enable = *(int *)arg1; int error; +#ifdef VIMAGE /* Since enabling is global, only let base do it. */ + if (! IS_DEFAULT_VNET(curvnet)) + return (EPERM); +#endif error = sysctl_handle_int(oidp, &enable, 0, req); if (error) return (error); @@ -549,50 +554,3 @@ ipfw_chg_hook(SYSCTL_HANDLER_ARGS) return (0); } -static int -ipfw_modevent(module_t mod, int type, void *unused) -{ - int err = 0; - - switch (type) { - case MOD_LOAD: - if ((err = ipfw_init()) != 0) { - printf("ipfw_init() error\n"); - break; - } - if ((err = ipfw_hook()) != 0) { - printf("ipfw_hook() error\n"); - break; - } -#ifdef INET6 - if ((err = ipfw6_hook()) != 0) { - printf("ipfw_hook() error\n"); - break; - } -#endif - break; - - case MOD_UNLOAD: - if ((err = ipfw_unhook()) > 0) - break; -#ifdef INET6 - if ((err = ipfw6_unhook()) > 0) - break; -#endif - ipfw_destroy(); - break; - - default: - return EOPNOTSUPP; - break; - } - return err; -} - -static moduledata_t ipfwmod = { - "ipfw", - ipfw_modevent, - 0 -}; -DECLARE_MODULE(ipfw, ipfwmod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY - 256); -MODULE_VERSION(ipfw, 2); From kensmith at FreeBSD.org Sat Aug 22 23:44:38 2009 From: kensmith at FreeBSD.org (Ken Smith) Date: Sat Aug 22 23:44:44 2009 Subject: svn commit: r196432 - in head: . gnu/usr.bin/groff/tmac release sys/conf sys/sys usr.sbin/pkg_install/add Message-ID: <200908222344.n7MNibQZ040298@svn.freebsd.org> Author: kensmith Date: Sat Aug 22 23:44:37 2009 New Revision: 196432 URL: http://svn.freebsd.org/changeset/base/196432 Log: Make head 9.0-CURRENT in preparation for lifting code freeze. Approved by: re (implicit) Modified: head/UPDATING head/gnu/usr.bin/groff/tmac/mdoc.local head/release/Makefile head/sys/conf/newvers.sh head/sys/sys/param.h head/usr.sbin/pkg_install/add/main.c Modified: head/UPDATING ============================================================================== --- head/UPDATING Sat Aug 22 09:17:49 2009 (r196431) +++ head/UPDATING Sat Aug 22 23:44:37 2009 (r196432) @@ -8,8 +8,8 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. -NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.x IS SLOW: - FreeBSD 8.x has many debugging features turned on, in +NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.x IS SLOW: + FreeBSD 9.x has many debugging features turned on, in both the kernel and userland. These features attempt to detect incorrect use of system primitives, and encourage loud failure through extra sanity checking and fail stop semantics. They Modified: head/gnu/usr.bin/groff/tmac/mdoc.local ============================================================================== --- head/gnu/usr.bin/groff/tmac/mdoc.local Sat Aug 22 09:17:49 2009 (r196431) +++ head/gnu/usr.bin/groff/tmac/mdoc.local Sat Aug 22 23:44:37 2009 (r196432) @@ -66,13 +66,14 @@ .ds doc-volume-as-arm arm . .\" Default .Os value -.ds doc-default-operating-system FreeBSD\~8.0 +.ds doc-default-operating-system FreeBSD\~9.0 . .\" FreeBSD releases not found in doc-common .ds doc-operating-system-FreeBSD-6.3 6.3 .ds doc-operating-system-FreeBSD-6.4 6.4 .ds doc-operating-system-FreeBSD-7.1 7.1 .ds doc-operating-system-FreeBSD-8.0 8.0 +.ds doc-operating-system-FreeBSD-9.0 9.0 . .\" Definitions not (yet) in doc-syms .ds doc-str-St--p1003.1-2008 \*[doc-Tn-font-size]\%IEEE\*[doc-str-St] Std 1003.1-2008 Modified: head/release/Makefile ============================================================================== --- head/release/Makefile Sat Aug 22 09:17:49 2009 (r196431) +++ head/release/Makefile Sat Aug 22 23:44:37 2009 (r196432) @@ -24,16 +24,16 @@ # Set these, release builder! # # Fixed version: -#BUILDNAME=8.0-CURRENT +#BUILDNAME=9.0-CURRENT # # Automatic SNAP versioning: DATE != date +%Y%m%d -BASE = 8.0 +BASE = 9.0 BUILDNAME?=${BASE}-${DATE}-SNAP # #CHROOTDIR=/junk/release # If this is a -stable snapshot, then set -#RELEASETAG=RELENG_7 +#RELEASETAG=RELENG_8 # # To test a release with a source tree containing patches and # other work. This tree will get copied instead of getting the @@ -72,7 +72,7 @@ BUILDNAME?=${BASE}-${DATE}-SNAP # # Subversion branch to build for src. If this is not set then it is # automatically computed from RELEASETAG. -#SVNBRANCH=stable/7 +#SVNBRANCH=stable/8 # # Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we # are building an official release. Otherwise, we are building for Modified: head/sys/conf/newvers.sh ============================================================================== --- head/sys/conf/newvers.sh Sat Aug 22 09:17:49 2009 (r196431) +++ head/sys/conf/newvers.sh Sat Aug 22 23:44:37 2009 (r196432) @@ -31,8 +31,8 @@ # $FreeBSD$ TYPE="FreeBSD" -REVISION="8.0" -BRANCH="BETA2" +REVISION="9.0" +BRANCH="CURRENT" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Sat Aug 22 09:17:49 2009 (r196431) +++ head/sys/sys/param.h Sat Aug 22 23:44:37 2009 (r196432) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 800107 /* Master, propagated to newvers */ +#define __FreeBSD_version 900000 /* Master, propagated to newvers */ #ifndef LOCORE #include Modified: head/usr.sbin/pkg_install/add/main.c ============================================================================== --- head/usr.sbin/pkg_install/add/main.c Sat Aug 22 09:17:49 2009 (r196431) +++ head/usr.sbin/pkg_install/add/main.c Sat Aug 22 23:44:37 2009 (r196432) @@ -82,13 +82,15 @@ struct { { 700000, 700099, "/packages-7.0-release" }, { 701000, 701099, "/packages-7.1-release" }, { 702000, 702099, "/packages-7.2-release" }, + { 800000, 800499, "/packages-8.0-release" }, { 300000, 399000, "/packages-3-stable" }, { 400000, 499000, "/packages-4-stable" }, { 502100, 502128, "/packages-5-current" }, { 503100, 599000, "/packages-5-stable" }, { 600100, 699000, "/packages-6-stable" }, { 700100, 799000, "/packages-7-stable" }, - { 800000, 899000, "/packages-8-current" }, + { 800000, 899000, "/packages-8-stable" }, + { 900000, 999000, "/packages-9-current" }, { 0, 9999999, "/packages-current" }, { 0, 0, NULL } }; From dougb at FreeBSD.org Sun Aug 23 05:42:51 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Sun Aug 23 05:42:59 2009 Subject: svn commit: r196434 - head/release/scripts Message-ID: <200908230542.n7N5goM5047840@svn.freebsd.org> Author: dougb Date: Sun Aug 23 05:42:50 2009 New Revision: 196434 URL: http://svn.freebsd.org/changeset/base/196434 Log: Add a script to create the /var/db/mergemaster.mtree file for new releases so that when users subsequently update their source trees they can make use of mergemaster's -U option. Added: head/release/scripts/mm-mtree.sh (contents, props changed) Added: head/release/scripts/mm-mtree.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/release/scripts/mm-mtree.sh Sun Aug 23 05:42:50 2009 (r196434) @@ -0,0 +1,155 @@ +#!/bin/sh + +# mergemaster mtree database generator + +# This script is intended to be used as part of the release building +# process to generate the /var/db/mergemaster.mtree file relevant to +# the source tree used to create the release so that users can make +# use of mergemaster's -U option to update their files after csup'ing +# to -stable. + +# Copyright 2009 Douglas Barton +# dougb@FreeBSD.org + +# $FreeBSD$ + +PATH=/bin:/usr/bin:/usr/sbin + +display_usage () { + VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4` + echo "${0##*/} version ${VERSION_NUMBER}" + echo "Usage: ${0##*/} [-m /path] [-t /path] [-A arch] [-F ] [-D /path]" + echo "Options:" + echo " -m /path/directory Specify location of source to do the make in" + echo " -t /path/directory Specify temp root directory" + echo " -A architecture Alternative architecture name to pass to make" + echo " -F Specify what to put on the make command line" + echo ' -D /path/directory Specify the destination directory to install files to' + echo '' +} + +# Set the default path for the temporary root environment +# +TEMPROOT='/var/tmp/temproot' + +# Assign the location of the mtree database +# +MTREEDB=${MTREEDB:-/var/db} +MTREEFILE="${MTREEDB}/mergemaster.mtree" + +# Check the command line options +# +while getopts "m:t:A:F:D:h" COMMAND_LINE_ARGUMENT ; do + case "${COMMAND_LINE_ARGUMENT}" in + m) + SOURCEDIR=${OPTARG} + ;; + t) + TEMPROOT=${OPTARG} + ;; + A) + ARCHSTRING='TARGET_ARCH='${OPTARG} + ;; + F) + MM_MAKE_ARGS="${OPTARG}" + ;; + D) + DESTDIR=${OPTARG} + ;; + h) + display_usage + exit 0 + ;; + *) + echo '' + display_usage + exit 1 + ;; + esac +done + +# Assign the source directory +# +SOURCEDIR=${SOURCEDIR:-/usr/src} +if [ ! -f ${SOURCEDIR}/Makefile.inc1 -a \ + -f ${SOURCEDIR}/../Makefile.inc1 ]; then + echo " *** The source directory you specified (${SOURCEDIR})" + echo " will be reset to ${SOURCEDIR}/.." + echo '' + sleep 3 + SOURCEDIR=${SOURCEDIR}/.. +fi + +# Setup make to use system files from SOURCEDIR +MM_MAKE="make ${ARCHSTRING} ${MM_MAKE_ARGS} -m ${SOURCEDIR}/share/mk" + +delete_temproot () { + rm -rf "${TEMPROOT}" 2>/dev/null + chflags -R 0 "${TEMPROOT}" 2>/dev/null + rm -rf "${TEMPROOT}" || exit 1 +} + +[ -d "${TEMPROOT}" ] && delete_temproot + +echo "*** Creating the temporary root environment in ${TEMPROOT}" + +if mkdir -p "${TEMPROOT}"; then + echo " *** ${TEMPROOT} ready for use" +fi + +if [ ! -d "${TEMPROOT}" ]; then + echo '' + echo " *** FATAL ERROR: Cannot create ${TEMPROOT}" + echo '' + exit 1 +fi + +echo " *** Creating and populating directory structure in ${TEMPROOT}" +echo '' + +{ cd ${SOURCEDIR} || { echo "*** Cannot cd to ${SOURCEDIR}" ; exit 1;} + case "${DESTDIR}" in + '') ;; + *) + ${MM_MAKE} DESTDIR=${DESTDIR} distrib-dirs + ;; + esac + od=${TEMPROOT}/usr/obj + ${MM_MAKE} DESTDIR=${TEMPROOT} distrib-dirs && + MAKEOBJDIRPREFIX=$od ${MM_MAKE} _obj SUBDIR_OVERRIDE=etc && + MAKEOBJDIRPREFIX=$od ${MM_MAKE} everything SUBDIR_OVERRIDE=etc && + MAKEOBJDIRPREFIX=$od ${MM_MAKE} DESTDIR=${TEMPROOT} distribution;} || + { echo ''; + echo " *** FATAL ERROR: Cannot 'cd' to ${SOURCEDIR} and install files to"; + echo " the temproot environment"; + echo ''; + exit 1;} + +# We really don't want to have to deal with files like login.conf.db, pwd.db, +# or spwd.db. Instead, we want to compare the text versions, and run *_mkdb. +# Prompt the user to do so below, as needed. +# +rm -f ${TEMPROOT}/etc/*.db ${TEMPROOT}/etc/passwd + +# We only need to compare things like freebsd.cf once +find ${TEMPROOT}/usr/obj -type f -delete 2>/dev/null + +# Delete stuff we do not need to keep the mtree database small, +# and to make the actual comparison faster. +find ${TEMPROOT}/usr -type l -delete 2>/dev/null +find ${TEMPROOT} -type f -size 0 -delete 2>/dev/null +find -d ${TEMPROOT} -type d -empty -delete 2>/dev/null + +# Build the mtree database in a temporary location. +MTREENEW=`mktemp -t mergemaster.mtree` +mtree -ci -p ${TEMPROOT} -k size,md5digest > ${MTREENEW} 2>/dev/null + +if [ -s "${MTREENEW}" ]; then + echo "*** Saving mtree database for future upgrades" + test -e "${DESTDIR}${MTREEFILE}" && unlink ${DESTDIR}${MTREEFILE} + mv ${MTREENEW} ${DESTDIR}${MTREEFILE} +fi + +delete_temproot + +exit 0 From dougb at FreeBSD.org Sun Aug 23 05:45:38 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Sun Aug 23 05:45:50 2009 Subject: svn commit: r196435 - head/sys/conf Message-ID: <200908230545.n7N5jcpZ047952@svn.freebsd.org> Author: dougb Date: Sun Aug 23 05:45:38 2009 New Revision: 196435 URL: http://svn.freebsd.org/changeset/base/196435 Log: The svnversion string is only relevant when newvers.sh is called during the kernel build process, the other places that call the script do not make use of that information. So restrict execution of the svnversion-related code to the kernel build context. Modified: head/sys/conf/newvers.sh Modified: head/sys/conf/newvers.sh ============================================================================== --- head/sys/conf/newvers.sh Sun Aug 23 05:42:50 2009 (r196434) +++ head/sys/conf/newvers.sh Sun Aug 23 05:45:38 2009 (r196435) @@ -87,29 +87,25 @@ touch version v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date` i=`${MAKE:-make} -V KERN_IDENT` -for dir in /bin /usr/bin /usr/local/bin; do - if [ -x "${dir}/svnversion" ]; then - svnversion=${dir}/svnversion - SRCDIR=${d##*obj} - if [ -n "$MACHINE" ]; then - SRCDIR=${SRCDIR##/$MACHINE} +case "$d" in +*/sys/*) + for dir in /bin /usr/bin /usr/local/bin; do + if [ -x "${dir}/svnversion" ]; then + svnversion=${dir}/svnversion + SRCDIR=${d##*obj} + if [ -n "$MACHINE" ]; then + SRCDIR=${SRCDIR##/$MACHINE} + fi + SRCDIR=${SRCDIR%%/sys/*} + break fi - SRCDIR=${SRCDIR%%/sys/*} - break - fi -done + done -if [ -n "$svnversion" -a -d "${SRCDIR}/.svn" ] ; then - # If we are called from the kernel build, limit - # the scope of svnversion to sys/ . - if [ -e "${SRCDIR}/sys/conf/newvers.sh" ] ; then - svn=" r`cd $SRCDIR/sys && $svnversion`" - else - svn=" r`cd $SRCDIR && $svnversion`" + if [ -n "$svnversion" -a -d "${SRCDIR}/sys/.svn" ] ; then + svn=" r`cd ${SRCDIR}/sys && $svnversion`" fi -else - svn="" -fi + ;; +esac cat << EOF > vers.c $COPYRIGHT From dougb at FreeBSD.org Sun Aug 23 05:47:20 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Sun Aug 23 05:47:31 2009 Subject: svn commit: r196436 - in head/etc: . rc.d Message-ID: <200908230547.n7N5lJN5048021@svn.freebsd.org> Author: dougb Date: Sun Aug 23 05:47:19 2009 New Revision: 196436 URL: http://svn.freebsd.org/changeset/base/196436 Log: Move is_wired_interface() from rc.d/wpa_supplicant into network.subr, simplify it a bit, and make use of that method to determine if an interface is a candidate for IPv6 rtsol rather than listing all of the possible wireless interfaces that should _not_ get rtsol'ed. This change is only relevant for 8.0+ unless the "wlan mandatory" code gets ported back to RELENG_7. Modified: head/etc/network.subr head/etc/rc.d/wpa_supplicant Modified: head/etc/network.subr ============================================================================== --- head/etc/network.subr Sun Aug 23 05:45:38 2009 (r196435) +++ head/etc/network.subr Sun Aug 23 05:47:19 2009 (r196436) @@ -816,6 +816,17 @@ hexprint() echo ${str} } +is_wired_interface() +{ + local media + + case `ifconfig $1 2>/dev/null` in + *media:?Ethernet*) media=Ethernet ;; + esac + + test "$media" = "Ethernet" +} + # Setup the interfaces for IPv6 network6_interface_setup() { @@ -858,14 +869,19 @@ network6_interface_setup() ifconfig $i inet6 ${ipv6_ifconfig} alias fi + # Wireless NIC cards are virtualized through the wlan interface + if ! is_wired_interface ${i}; then + case "${i}" in + wlan*) rtsol_available=yes ;; + *) rtsol_available=no ;; + esac + fi + if [ ${rtsol_available} = yes -a ${rtsol_interface} = yes ] then case ${i} in lo0|gif[0-9]*|stf[0-9]*|faith[0-9]*|lp[0-9]*|sl[0-9]*|tun[0-9]*|pflog[0-9]*|pfsync[0-9]*) ;; - # Wireless NIC cards are virtualized through the wlan interface - an[0-9]*|ath[0-9]*|ipw[0-9]*|iwi[0-9]*|iwn[0-9]*|ral[0-9]*|wi[0-9]*|wl[0-9]*|wpi[0-9]*) - ;; *) rtsol_interfaces="${rtsol_interfaces} ${i}" ;; Modified: head/etc/rc.d/wpa_supplicant ============================================================================== --- head/etc/rc.d/wpa_supplicant Sun Aug 23 05:45:38 2009 (r196435) +++ head/etc/rc.d/wpa_supplicant Sun Aug 23 05:47:19 2009 (r196436) @@ -18,18 +18,6 @@ if [ -z "$ifn" ]; then return 1 fi -is_wired_interface() -{ - media=`ifconfig $1 2>/dev/null | while read line; do - case "$line" in - *media:?Ethernet*) - echo Ethernet - ;; - esac - done` - test "$media" = "Ethernet" -} - is_ndis_interface() { case `sysctl -n net.wlan.${1#wlan}.%parent 2>/dev/null` in From jkoshy at FreeBSD.org Sun Aug 23 05:47:34 2009 From: jkoshy at FreeBSD.org (Joseph Koshy) Date: Sun Aug 23 05:47:49 2009 Subject: svn commit: r196437 - head/lib/libpmc Message-ID: <200908230547.n7N5lYro048060@svn.freebsd.org> Author: jkoshy Date: Sun Aug 23 05:47:33 2009 New Revision: 196437 URL: http://svn.freebsd.org/changeset/base/196437 Log: Fix typos. Reported by: Harald Servat Modified: head/lib/libpmc/pmc.3 head/lib/libpmc/pmc.atom.3 head/lib/libpmc/pmc.core2.3 Modified: head/lib/libpmc/pmc.3 ============================================================================== --- head/lib/libpmc/pmc.3 Sun Aug 23 05:47:19 2009 (r196436) +++ head/lib/libpmc/pmc.3 Sun Aug 23 05:47:33 2009 (r196437) @@ -187,7 +187,7 @@ enumeration. Supported PMC kinds include: .Bl -tag -width "Li PMC_CLASS_IAF" -compact .It Li PMC_CLASS_IAF -Fixed function hardwre counters presents in CPUs conforming to the +Fixed function hardware counters presents in CPUs conforming to the .Tn Intel performance measurement architecture version 2 and later. .It Li PMC_CLASS_IAP Modified: head/lib/libpmc/pmc.atom.3 ============================================================================== --- head/lib/libpmc/pmc.atom.3 Sun Aug 23 05:47:19 2009 (r196436) +++ head/lib/libpmc/pmc.atom.3 Sun Aug 23 05:47:33 2009 (r196437) @@ -222,7 +222,7 @@ Measure CMP2S snoops. .Pp The default is to measure both snoops. .Ss Event Specifiers (Programmable PMCs) -Core2 programmable PMCs support the following events: +Atom programmable PMCs support the following events: .Bl -tag -width indent .It Li BACLEARS .Pq Event E6H , Umask 01H @@ -576,7 +576,7 @@ The number of transitions from floating instructions. .It Li HW_INT_RCV .Pq Event C8H , Umask 00H -The number of hardware interrupts recieved. +The number of hardware interrupts received. .It Li ICACHE.ACCESSES .Pq Event 80H , Umask 03H The number of instruction fetches. Modified: head/lib/libpmc/pmc.core2.3 ============================================================================== --- head/lib/libpmc/pmc.core2.3 Sun Aug 23 05:47:19 2009 (r196436) +++ head/lib/libpmc/pmc.core2.3 Sun Aug 23 05:47:33 2009 (r196437) @@ -544,7 +544,7 @@ The number of transitions from floating instructions. .It Li HW_INT_RCV .Pq Event C8H , Umask 00H -The number of hardware interrupts recieved. +The number of hardware interrupts received. .It Li IDLE_DURING_DIV .Pq Event 18H , Umask 00H The number of cycles the divider is busy and no other execution unit From jkoshy at FreeBSD.org Sun Aug 23 05:49:12 2009 From: jkoshy at FreeBSD.org (Joseph Koshy) Date: Sun Aug 23 05:49:18 2009 Subject: svn commit: r196438 - head/lib/libpmc Message-ID: <200908230549.n7N5nCCS048130@svn.freebsd.org> Author: jkoshy Date: Sun Aug 23 05:49:12 2009 New Revision: 196438 URL: http://svn.freebsd.org/changeset/base/196438 Log: Fix a typo. Reported by: John McCullough Modified: head/lib/libpmc/pmc.3 Modified: head/lib/libpmc/pmc.3 ============================================================================== --- head/lib/libpmc/pmc.3 Sun Aug 23 05:47:33 2009 (r196437) +++ head/lib/libpmc/pmc.3 Sun Aug 23 05:49:12 2009 (r196438) @@ -423,7 +423,7 @@ The PMCs would then be started using fun .Fn pmc_start . .It Once started, the values of counting PMCs may be read using function -.Fn pmc_start . +.Fn pmc_read . For PMCs that write events to the log file, this logged data would be read and parsed using the .Xr pmclog 3 From jmallett at FreeBSD.org Sun Aug 23 05:53:21 2009 From: jmallett at FreeBSD.org (Juli Mallett) Date: Sun Aug 23 05:53:32 2009 Subject: svn commit: r196435 - head/sys/conf In-Reply-To: <200908230545.n7N5jcpZ047952@svn.freebsd.org> References: <200908230545.n7N5jcpZ047952@svn.freebsd.org> Message-ID: On Sat, Aug 22, 2009 at 22:45, Doug Barton wrote: > Author: dougb > Date: Sun Aug 23 05:45:38 2009 > New Revision: 196435 > URL: http://svn.freebsd.org/changeset/base/196435 > > Log: > ?The svnversion string is only relevant when newvers.sh is called > ?during the kernel build process, the other places that call the script > ?do not make use of that information. So restrict execution of the > ?svnversion-related code to the kernel build context. This seems to assume that the kernel is always checked out in a directory called 'sys', is that right? That isn't always true in my experience, and I have a bad habit of keeping multiple kernel trees checked out named things like 'sys-head', etc. I could be misreading the code, which gave only constructs I'm not very familiar with for determining whether it's being used for a kernel build. Is it harmful to include the svnversion stuff for other newvers.sh users? Could they just set an environment variable to indicate they want it excluded? Or could you check the environment for kernel build-related variables? Or even set a variable when running newvers.sh for the kernel to explicitly request svnversion inclusion? Juli. From dougb at FreeBSD.org Sun Aug 23 05:56:54 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Sun Aug 23 05:57:01 2009 Subject: svn commit: r196439 - head/etc/rc.d Message-ID: <200908230556.n7N5us81048312@svn.freebsd.org> Author: dougb Date: Sun Aug 23 05:56:54 2009 New Revision: 196439 URL: http://svn.freebsd.org/changeset/base/196439 Log: Fix the typo mentioned in the PR, and one additional. Fix caps while I'm here. PR: conf/138087 Submitted by: Chris Petrik Modified: head/etc/rc.d/ipsec Modified: head/etc/rc.d/ipsec ============================================================================== --- head/etc/rc.d/ipsec Sun Aug 23 05:49:12 2009 (r196438) +++ head/etc/rc.d/ipsec Sun Aug 23 05:56:54 2009 (r196439) @@ -41,9 +41,9 @@ ipsec_stop() { echo "Clearing ipsec manual keys/policies." - # still not 100% sure if we would like to do this. - # it is very questionable to do this during shutdown session, since - # it can hang any of remaining IPv4/v6 session. + # Still not 100% sure if we would like to do this. + # It is very questionable to do this during shutdown session + # since it can hang any of the remaining IPv4/v6 sessions. # ${ipsec_program} -F ${ipsec_program} -FP From dougb at FreeBSD.org Sun Aug 23 06:09:40 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Sun Aug 23 06:09:52 2009 Subject: svn commit: r196435 - head/sys/conf In-Reply-To: References: <200908230545.n7N5jcpZ047952@svn.freebsd.org> Message-ID: <4A90DD18.2030107@FreeBSD.org> Juli Mallett wrote: > On Sat, Aug 22, 2009 at 22:45, Doug Barton wrote: >> Author: dougb >> Date: Sun Aug 23 05:45:38 2009 >> New Revision: 196435 >> URL: http://svn.freebsd.org/changeset/base/196435 >> >> Log: >> The svnversion string is only relevant when newvers.sh is called >> during the kernel build process, the other places that call the script >> do not make use of that information. So restrict execution of the >> svnversion-related code to the kernel build context. > > This seems to assume that the kernel is always checked out in a > directory called 'sys', Yes, I think that's a reasonable assumption. > Is it harmful to include the svnversion stuff for other newvers.sh > users? There was whinging that it took a "long time" to run svnversion on the whole src tree, so a very badly formed patch was applied to try and conditionalize it for only running when the kernel is being built. This change will actually restrict it to when the kernel is being built in a directory called */sys/* which will actually work for the vast majority of FreeBSD users. > Could they just set an environment variable to indicate they > want it excluded? Or could you check the environment for kernel > build-related variables? Or even set a variable when running > newvers.sh for the kernel to explicitly request svnversion inclusion? Knock yourself out, I look forward to reviewing your patches. This very simple little item has already received WAY more hackery than it really merits. The only reason I made the change I did (after swearing off touching it again on the principle of trying to avoid getting bike shed paint all over my clothes) was that the patch that was applied previously was just plain silly. FWIW, your comments would have been a lot more timely if they had been in response to my posting this patch following the discussion on the topic in -current on 8/15. Given that I have received no comments on that post at all in the 7 days since posting the patch I felt it was more than reasonable to commit it tonight. Doug -- This .signature sanitized for your protection From jkoshy at FreeBSD.org Sun Aug 23 06:19:02 2009 From: jkoshy at FreeBSD.org (Joseph Koshy) Date: Sun Aug 23 06:19:08 2009 Subject: svn commit: r196440 - head/lib/libpmc Message-ID: <200908230619.n7N6J2Wx048749@svn.freebsd.org> Author: jkoshy Date: Sun Aug 23 06:19:02 2009 New Revision: 196440 URL: http://svn.freebsd.org/changeset/base/196440 Log: Correct grammar. Modified: head/lib/libpmc/pmc.3 Modified: head/lib/libpmc/pmc.3 ============================================================================== --- head/lib/libpmc/pmc.3 Sun Aug 23 05:56:54 2009 (r196439) +++ head/lib/libpmc/pmc.3 Sun Aug 23 06:19:02 2009 (r196440) @@ -120,7 +120,7 @@ Process scope sampling PMCs. Process scope counting PMCs that have been configured to report PMC readings on process context switches or process exits. .El -Upto one log file may be configured per owner process. +Up to one log file may be configured per owner process. Events logged to a log file may be subsequently analyzed using the .Xr pmclog 3 family of functions. @@ -262,7 +262,7 @@ CPU is running unprivileged code. The ability to write to performance counters. .El .Ss CPU Naming Conventions -CPUs are named using small integers from zero uptil, but +CPUs are named using small integers from zero until, but excluding, the value returned by function .Fn pmc_ncpu . On platforms supporting sparsely numbered CPUs not all the numbers in From jkoshy at FreeBSD.org Sun Aug 23 06:22:32 2009 From: jkoshy at FreeBSD.org (Joseph Koshy) Date: Sun Aug 23 06:22:42 2009 Subject: svn commit: r196441 - head/lib/libpmc Message-ID: <200908230622.n7N6MV7L048936@svn.freebsd.org> Author: jkoshy Date: Sun Aug 23 06:22:31 2009 New Revision: 196441 URL: http://svn.freebsd.org/changeset/base/196441 Log: Correct typos. Modified: head/lib/libpmc/pmc_read.3 Modified: head/lib/libpmc/pmc_read.3 ============================================================================== --- head/lib/libpmc/pmc_read.3 Sun Aug 23 06:19:02 2009 (r196440) +++ head/lib/libpmc/pmc_read.3 Sun Aug 23 06:22:31 2009 (r196441) @@ -30,7 +30,7 @@ .Nm pmc_read , .Nm pmc_rw , .Nm pmc_write , -.Nd read and write hardware performace counters +.Nd read and write hardware performance counters .Sh LIBRARY .Lb libpmc .Sh SYNOPSIS @@ -62,7 +62,7 @@ Function .Fn pmc_rw combines a read and a write into a single atomic operation. .Pp -For write operations the PMC should be a quiesced state. +For write operations the PMC should be a quiescent state. .Sh RETURN VALUES .Rv -std .Sh ERRORS From kensmith at FreeBSD.org Sun Aug 23 06:30:15 2009 From: kensmith at FreeBSD.org (Ken Smith) Date: Sun Aug 23 06:30:21 2009 Subject: svn commit: r196442 - head/etc/defaults Message-ID: <200908230630.n7N6UEaD049117@svn.freebsd.org> Author: kensmith Date: Sun Aug 23 06:30:14 2009 New Revision: 196442 URL: http://svn.freebsd.org/changeset/base/196442 Log: Update name of INDEX file as part of 8.0 -> 9.0 transition. Modified: head/etc/defaults/periodic.conf Modified: head/etc/defaults/periodic.conf ============================================================================== --- head/etc/defaults/periodic.conf Sun Aug 23 06:22:31 2009 (r196441) +++ head/etc/defaults/periodic.conf Sun Aug 23 06:30:14 2009 (r196442) @@ -224,7 +224,7 @@ weekly_noid_dirs="/" # Look here # 400.status-pkg weekly_status_pkg_enable="NO" # Find out-of-date pkgs pkg_version=pkg_version # Use this program -pkg_version_index=/usr/ports/INDEX-8 # Use this index file +pkg_version_index=/usr/ports/INDEX-9 # Use this index file # 999.local weekly_local="/etc/weekly.local" # Local scripts From jkoshy at FreeBSD.org Sun Aug 23 07:24:39 2009 From: jkoshy at FreeBSD.org (Joseph Koshy) Date: Sun Aug 23 07:24:46 2009 Subject: svn commit: r196445 - head/lib/libpmc Message-ID: <200908230724.n7N7OdcJ050255@svn.freebsd.org> Author: jkoshy Date: Sun Aug 23 07:24:39 2009 New Revision: 196445 URL: http://svn.freebsd.org/changeset/base/196445 Log: Fix typos. Modified: head/lib/libpmc/pmc.core2.3 Modified: head/lib/libpmc/pmc.core2.3 ============================================================================== --- head/lib/libpmc/pmc.core2.3 Sun Aug 23 06:53:58 2009 (r196444) +++ head/lib/libpmc/pmc.core2.3 Sun Aug 23 07:24:39 2009 (r196445) @@ -42,7 +42,7 @@ family CPUs CPUs contain PMCs conforming to version 2 of the .Tn Intel performance measurement architecture. -These CPUs may contain upto two classes of PMCs: +These CPUs may contain up to two classes of PMCs: .Bl -tag -width "Li PMC_CLASS_IAP" .It Li PMC_CLASS_IAF Fixed-function counters that count only one hardware event per counter. @@ -92,13 +92,13 @@ Configure the PMC to increment only if t events measured in a cycle is greater than or equal to .Ar value . .It Li edge -Configure the PMC to count the number of deasserted to asserted +Configure the PMC to count the number of de-asserted to asserted transitions of the conditions expressed by the other qualifiers. If specified, the counter will increment only once whenever a condition becomes true, irrespective of the number of clocks during which the condition remains true. .It Li inv -Invert the sense of comparision when the +Invert the sense of comparison when the .Dq Li cmask qualifier is present, making the counter increment when the number of events per cycle is less than the value specified by the @@ -169,7 +169,7 @@ The default is .Dq Li both . .Pp Events that require a cache coherence qualifier to be specified use an -additional qualifer +additional qualifier .Dq Li cachestate= Ns Ar state , where argument .Ar state @@ -361,7 +361,7 @@ signal was asserted on the bus. .Xc .Pq Event 60H The number of pending full cache line read transactions on the bus -occuring in each cycle. +occurring in each cycle. .It Li BUS_TRANS_P Xo .Op ,agent= Ns Ar agent .Op ,core= Ns Ar core @@ -421,7 +421,7 @@ The number of burst read transactions. .Op ,core= Ns Ar core .Xc .Pq Event 6CH -The number of completed I/O bus transaactions due to +The number of completed I/O bus transactions due to .Li IN and .Li OUT @@ -437,7 +437,7 @@ The number of Read For Ownership bus tra .Op ,core= Ns Ar core .Xc .Pq Event 67H -The number explicit writeback bus transactions due to dirty line +The number explicit write-back bus transactions due to dirty line evictions. .It Li CMP_SNOOP Xo .Op ,core= Ns Ar core @@ -661,7 +661,7 @@ fetch unit. .It Li L2_LD Xo .Op ,cachestate= Ns Ar state .Op ,core= Ns Ar core -.Op ,prefech= Ns Ar prefetch +.Op ,prefetch= Ns Ar prefetch .Xc .Pq Event 29H The number of L2 cache read requests from L1 cache and L2 @@ -747,7 +747,7 @@ The number of loads blocked by preceding whose data value is not known. .It Li LOAD_BLOCK.UNTIL_RETIRE .Pq Event 03H , Umask 10H -The numer of load operations that were blocked until retirement. +The number of load operations that were blocked until retirement. .It Li LOAD_HIT_PRE .Pq Event 4CH , Umask 00H The number of load operations that conflicted with an prefetch to the From jkoshy at FreeBSD.org Sun Aug 23 07:29:35 2009 From: jkoshy at FreeBSD.org (Joseph Koshy) Date: Sun Aug 23 07:29:47 2009 Subject: svn commit: r196446 - head/lib/libpmc Message-ID: <200908230729.n7N7TYtt050385@svn.freebsd.org> Author: jkoshy Date: Sun Aug 23 07:29:34 2009 New Revision: 196446 URL: http://svn.freebsd.org/changeset/base/196446 Log: Fix typos, use American English spellings. Modified: head/lib/libpmc/pmc.k7.3 head/lib/libpmc/pmc.k8.3 head/lib/libpmc/pmc.p4.3 head/lib/libpmc/pmc.p6.3 Modified: head/lib/libpmc/pmc.k7.3 ============================================================================== --- head/lib/libpmc/pmc.k7.3 Sun Aug 23 07:24:39 2009 (r196445) +++ head/lib/libpmc/pmc.k7.3 Sun Aug 23 07:29:34 2009 (r196446) @@ -79,7 +79,7 @@ In other words, the counter will increme condition becomes true, irrespective of the number of clocks during which the condition remains true. .It Li inv -Invert the sense of comparision when the +Invert the sense of comparison when the .Dq Li count qualifier is present, making the counter to increment when the number of events per cycle is less than the value specified by @@ -205,7 +205,7 @@ Count all retired branches (conditional, and interrupts). .It Li k7-retired-branches-mispredicted .Pq Event C3H -Count all misprediced retired branches. +Count all mispredicted retired branches. .It Li k7-retired-far-control-transfers .Pq Event C6H Count retired far control transfers. Modified: head/lib/libpmc/pmc.k8.3 ============================================================================== --- head/lib/libpmc/pmc.k8.3 Sun Aug 23 07:24:39 2009 (r196445) +++ head/lib/libpmc/pmc.k8.3 Sun Aug 23 07:29:34 2009 (r196446) @@ -82,7 +82,7 @@ In other words, the counter will increme condition becomes true, irrespective of the number of clocks during which the condition remains true. .It Li inv -Invert the sense of comparision when the +Invert the sense of comparison when the .Dq Li count qualifier is present, making the counter to increment when the number of events per cycle is less than the value specified by @@ -173,7 +173,7 @@ Count TLB reloads. The default is to count all types of requests. .It Li k8-dc-access .Pq Event 40H -Count data cache accesses including microcode scratchpad accesses. +Count data cache accesses including microcode scratch pad accesses. .It Li k8-dc-copyback Op Li ,mask= Ns Ar qualifier .Pq Event 44H Count data cache copyback operations. Modified: head/lib/libpmc/pmc.p4.3 ============================================================================== --- head/lib/libpmc/pmc.p4.3 Sun Aug 23 07:24:39 2009 (r196445) +++ head/lib/libpmc/pmc.p4.3 Sun Aug 23 07:29:34 2009 (r196446) @@ -121,7 +121,7 @@ See below for more information. .It Li edge Configure the counter to count false to true transitions of the threshold -comparision output. +comparison output. This qualifier only takes effect if a threshold qualifier has also been specified. .It Li complement @@ -547,7 +547,7 @@ Count cycles when the processor is activ .It Li p4-instr-retired Op Li ,mask= Ns Ar flags .Pq "TS event" Count instructions retired during a clock cycle. -Qualifer +Qualifier .Ar flags comprises of the following strings separated by .Ql + @@ -589,7 +589,7 @@ Count read entries. .It Li all-write Count write entries. .It Li mem-uc -Count entries accessing uncacheable memory. +Count entries accessing un-cacheable memory. .It Li mem-wc Count entries accessing write-combining memory. .It Li mem-wt @@ -620,7 +620,7 @@ The default is 0. The .Dq Li edge qualifier should not be used when counting cycles with this event. -The exact behaviour of this event depends on the processor revision. +The exact behavior of this event depends on the processor revision. .It Li p4-ioq-allocation Xo .Op Li ,mask= Ns Ar qualifier .Op Li ,busreqtype= Ns Ar req-type @@ -644,7 +644,7 @@ Count read entries. .It Li all-write Count write entries. .It Li mem-uc -Count entries accessing uncacheable memory. +Count entries accessing un-cacheable memory. .It Li mem-wc Count entries accessing write-combining memory. .It Li mem-wt @@ -676,10 +676,10 @@ The .Dq Li edge qualifier is normally used with this event to prevent multiple counting. -The exact behaviour of this event depends on the processor revision. +The exact behavior of this event depends on the processor revision. .It Li p4-itlb-reference Op mask= Ns Ar qualifier .Pq "TS event" -Count translations using the intruction translation look-aside +Count translations using the instruction translation look-aside buffer. The .Ar qualifier @@ -693,7 +693,7 @@ Count ITLB hits. .It Li miss Count ITLB misses. .It Li hit-uc -Count uncacheable ITLB hits. +Count un-cacheable ITLB hits. .El .Pp If no @@ -730,7 +730,7 @@ Count non-bogus retired branch instructi .It Li p4-machine-clear Op Li ,mask= Ns Ar flags .Pq "TS event" Count the number of pipeline clears seen by the processor. -Qualifer +Qualifier .Ar flags is a list of the following strings separated by .Ql + @@ -753,7 +753,7 @@ The default qualifier is .Dq Li clear . .It Li p4-memory-cancel Op Li ,mask= Ns Ar event-list .Pq "TS event" -Count the cancelling of various kinds of requests in the data cache +Count the canceling of various kinds of requests in the data cache address control unit of the CPU. The qualifier .Ar event-list @@ -773,8 +773,8 @@ If is not specified, then the default is to count both kinds of events. .It Li p4-memory-complete Op Li ,mask= Ns Ar event-list .Pq "TS event" -Count the completion of load split, store split, uncacheable split and -uncacheable load operations selected by qualifier +Count the completion of load split, store split, un-cacheable split and +un-cacheable load operations selected by qualifier .Ar event-list . The qualifier .Ar event-list @@ -784,7 +784,7 @@ separated list of the following flags: .Pp .Bl -tag -width indent -compact .It Li lsc -Count load splits completed, excluding loads from uncacheable or +Count load splits completed, excluding loads from un-cacheable or write-combining areas. .It Li ssc Count any split stores completed. @@ -1065,7 +1065,7 @@ The default qualifier counts all the abo .Pq "TS event" This event is used in conjunction with the front-end at-retirement mechanism to tag load and store uops. -Qualifer +Qualifier .Ar flags comprises the following strings separated by .Ql + @@ -1112,7 +1112,7 @@ WC buffer evictions due to any cause. WC buffer evictions due to no WC buffer being available. .El .Pp -The default qualifer counts both kinds of evictions. +The default qualifier counts both kinds of evictions. .It Li p4-x87-assist Op Li ,mask= Ns Ar flags .Pq "TS event" Count the retirement of x87 instructions that required special Modified: head/lib/libpmc/pmc.p6.3 ============================================================================== --- head/lib/libpmc/pmc.p6.3 Sun Aug 23 07:24:39 2009 (r196445) +++ head/lib/libpmc/pmc.p6.3 Sun Aug 23 07:29:34 2009 (r196446) @@ -89,13 +89,13 @@ Configure the PMC to increment only if t events measured in a cycle is greater than or equal to .Ar value . .It Li edge -Configure the PMC to count the number of deasserted to asserted +Configure the PMC to count the number of de-asserted to asserted transitions of the conditions expressed by the other qualifiers. If specified, the counter will increment only once whenever a condition becomes true, irrespective of the number of clocks during which the condition remains true. .It Li inv -Invert the sense of comparision when the +Invert the sense of comparison when the .Dq Li cmask qualifier is present, making the counter increment when the number of events per cycle is less than the value specified by the @@ -584,7 +584,7 @@ Count SSE2 scalar-double instructions. .El .Pp The default is to count SSE packed-single instructions. -.It Li p6-emon-sse-sse2-inst-retired Op Li ,umask= Ns Ar qualifer +.It Li p6-emon-sse-sse2-inst-retired Op Li ,umask= Ns Ar qualifier .Pq Event D8H , Tn "Pentium M" Count the number of SSE instructions retired. An additional qualifier can be specified, and can be one of the From jkoshy at FreeBSD.org Sun Aug 23 07:30:12 2009 From: jkoshy at FreeBSD.org (Joseph Koshy) Date: Sun Aug 23 07:30:24 2009 Subject: svn commit: r196447 - head/lib/libpmc Message-ID: <200908230730.n7N7UCF6050446@svn.freebsd.org> Author: jkoshy Date: Sun Aug 23 07:30:12 2009 New Revision: 196447 URL: http://svn.freebsd.org/changeset/base/196447 Log: Fix a typo. Modified: head/lib/libpmc/pmc_capabilities.3 Modified: head/lib/libpmc/pmc_capabilities.3 ============================================================================== --- head/lib/libpmc/pmc_capabilities.3 Sun Aug 23 07:29:34 2009 (r196446) +++ head/lib/libpmc/pmc_capabilities.3 Sun Aug 23 07:30:12 2009 (r196447) @@ -63,7 +63,7 @@ is a PMC handle obtained by a prior call .Fn pmc_allocate . The function sets argument .Fa caps -to a bitmask of capabilities supported by the PMC denoted by +to a bit mask of capabilities supported by the PMC denoted by argument .Fa pmc . PMC capabilities are described in From jkoshy at FreeBSD.org Sun Aug 23 07:31:11 2009 From: jkoshy at FreeBSD.org (Joseph Koshy) Date: Sun Aug 23 07:31:23 2009 Subject: svn commit: r196448 - head/lib/libpmc Message-ID: <200908230731.n7N7VARm050505@svn.freebsd.org> Author: jkoshy Date: Sun Aug 23 07:31:10 2009 New Revision: 196448 URL: http://svn.freebsd.org/changeset/base/196448 Log: Fix typos. Modified: head/lib/libpmc/pmc.p5.3 Modified: head/lib/libpmc/pmc.p5.3 ============================================================================== --- head/lib/libpmc/pmc.p5.3 Sun Aug 23 07:30:12 2009 (r196447) +++ head/lib/libpmc/pmc.p5.3 Sun Aug 23 07:31:10 2009 (r196448) @@ -156,14 +156,14 @@ This event is only allocated on counter .It Li p5-code-cache-miss .Pq Event 0EH The number of instruction reads that miss the internal code cache. -Both cacheable and uncacheable misses are counted. +Both cacheable and un-cacheable misses are counted. .It Li p5-code-read .Pq Event 0CH -The number of instruction reads to both cacheable and uncacheable regions. +The number of instruction reads to both cacheable and un-cacheable regions. .It Li p5-code-tlb-miss .Pq Event 0DH The number of instruction reads that miss the instruction TLB. -Both cacheable and uncacheable unreads are counted. +Both cacheable and un-cacheable unreads are counted. .It Li p5-d1-starvation-and-fifo-is-empty .Pq Event 33H , Tn Pentium MMX The number of times the D1 stage cannot issue any instructions because @@ -193,13 +193,13 @@ Split cycle reads are counted individual .It Li p5-data-read-miss .Pq Event 03H The number of memory read accesses that miss the data cache, counting -both cacheable and uncacheable accesses. +both cacheable and un-cacheable accesses. Data accesses that are part of TLB miss processing are not included. I/O accesses are not included. .It Li p5-data-read-miss-or-write-miss .Pq Event 29H The number of data reads and writes that miss the internal data cache, -counting uncacheable accesses. +counting un-cacheable accesses. Data accesses due to TLB miss processing are not counted. .It Li p5-data-read-or-write .Pq Event 28H @@ -208,7 +208,7 @@ and misses. Data reads due to TLB miss processing are not counted. .It Li p5-data-tlb-miss .Pq Event 02H -The number of misses to the data cache translation lookaside buffer. +The number of misses to the data cache translation look aside buffer. .It Li p5-data-write .Pq Event 01H The number of memory data writes, counting internal data cache hits @@ -217,7 +217,7 @@ I/O is not included and split cycle writ .It Li p5-data-write-miss .Pq Event 04H The number of memory write accesses that miss the data cache, counting -both cacheable and uncacheable accesses. +both cacheable and un-cacheable accesses. I/O accesses are not counted. .It Li p5-emms-instructions-executed .Pq Event 2DH , Tn Pentium MMX From jkoshy at FreeBSD.org Sun Aug 23 07:32:31 2009 From: jkoshy at FreeBSD.org (Joseph Koshy) Date: Sun Aug 23 07:32:42 2009 Subject: svn commit: r196449 - head/lib/libpmc Message-ID: <200908230732.n7N7WUfV050562@svn.freebsd.org> Author: jkoshy Date: Sun Aug 23 07:32:30 2009 New Revision: 196449 URL: http://svn.freebsd.org/changeset/base/196449 Log: Use US spellings, fix typos. Modified: head/lib/libpmc/pmc.atom.3 head/lib/libpmc/pmc.core.3 head/lib/libpmc/pmc.iaf.3 Modified: head/lib/libpmc/pmc.atom.3 ============================================================================== --- head/lib/libpmc/pmc.atom.3 Sun Aug 23 07:31:10 2009 (r196448) +++ head/lib/libpmc/pmc.atom.3 Sun Aug 23 07:32:30 2009 (r196449) @@ -93,13 +93,13 @@ Configure the PMC to increment only if t events measured in a cycle is greater than or equal to .Ar value . .It Li edge -Configure the PMC to count the number of deasserted to asserted +Configure the PMC to count the number of de-asserted to asserted transitions of the conditions expressed by the other qualifiers. If specified, the counter will increment only once whenever a condition becomes true, irrespective of the number of clocks during which the condition remains true. .It Li inv -Invert the sense of comparision when the +Invert the sense of comparison when the .Dq Li cmask qualifier is present, making the counter increment when the number of events per cycle is less than the value specified by the @@ -170,7 +170,7 @@ The default is .Dq Li both . .Pp Events that require a cache coherence qualifier to be specified use an -additional qualifer +additional qualifier .Dq Li cachestate= Ns Ar state , where argument .Ar state @@ -371,7 +371,7 @@ This event is thread independent. .Xc .Pq Event 60H The number of pending full cache line read transactions on the bus -occuring in each cycle. +occurring in each cycle. This event is thread independent. .It Li BUS_TRANS_P Xo .Op ,agent= Ns Ar agent @@ -432,7 +432,7 @@ The number of burst read transactions. .Op ,core= Ns Ar core .Xc .Pq Event 6CH -The number of completed I/O bus transaactions due to +The number of completed I/O bus transactions due to .Li IN and .Li OUT @@ -448,7 +448,7 @@ The number of Read For Ownership bus tra .Op ,core= Ns Ar core .Xc .Pq Event 67H -The number explicit writeback bus transactions due to dirty line +The number explicit write-back bus transactions due to dirty line evictions. .It Li CMP_SNOOP Xo .Op ,core= Ns Ar core @@ -693,7 +693,7 @@ fetch unit. .It Li L2_LD Xo .Op ,cachestate= Ns Ar state .Op ,core= Ns Ar core -.Op ,prefech= Ns Ar prefetch +.Op ,prefetch= Ns Ar prefetch .Xc .Pq Event 29H The number of L2 cache read requests from L1 cache and L2 @@ -778,7 +778,7 @@ The number of loads blocked by preceding whose data value is not known. .It Li LOAD_BLOCK.UNTIL_RETIRE .Pq Event 03H , Umask 10H -The numer of load operations that were blocked until retirement. +The number of load operations that were blocked until retirement. .It Li LOAD_HIT_PRE .Pq Event 4CH , Umask 00H The number of load operations that conflicted with an prefetch to the Modified: head/lib/libpmc/pmc.core.3 ============================================================================== --- head/lib/libpmc/pmc.core.3 Sun Aug 23 07:31:10 2009 (r196448) +++ head/lib/libpmc/pmc.core.3 Sun Aug 23 07:32:30 2009 (r196449) @@ -85,13 +85,13 @@ Configure the PMC to increment only if t events measured in a cycle is greater than or equal to .Ar value . .It Li edge -Configure the PMC to count the number of deasserted to asserted +Configure the PMC to count the number of de-asserted to asserted transitions of the conditions expressed by the other qualifiers. If specified, the counter will increment only once whenever a condition becomes true, irrespective of the number of clocks during which the condition remains true. .It Li inv -Invert the sense of comparision when the +Invert the sense of comparison when the .Dq Li cmask qualifier is present, making the counter increment when the number of events per cycle is less than the value specified by the @@ -159,7 +159,7 @@ The default is .Dq Li both . .Pp Events that require a cache coherence qualifier to be specified use an -additional qualifer +additional qualifier .Dq Li cachestate= Ns Ar value , where argument .Ar value @@ -348,8 +348,8 @@ The number of completed partial write tr The number of completed read-for-ownership transactions. .It Li Bus_Trans_WB Op ,agent= Ns Ar agent .Pq Event 67H -The number of completed writeback transactions from the data cache -unit, excluding L2 writebacks. +The number of completed write-back transactions from the data cache +unit, excluding L2 write-backs. .It Li Cycles_Div_Busy .Pq Event 14H , Umask 00H The number of cycles the divider is busy. @@ -393,13 +393,13 @@ The number of cacheable read and write o .It Li Data_Mem_Ref .Pq Event 43H , Umask 01H The number of L1 data reads and writes, both cacheable and -uncacheable. +un-cacheable. .It Li Dbus_Busy Op ,core= Ns Ar core .Pq Event 22H The number of core cycles during which the data bus was busy. .It Li Dbus_Busy_Rd Op ,core= Ns Ar core .Pq Event 23H -The nunber of cycles during which the data bus was busy transferring +The number of cycles during which the data bus was busy transferring data to a core. .It Li Div .Pq Event 13H , Umask 00H @@ -460,7 +460,7 @@ streaming buffers. .It Li ICache_Reads .Pq Event 80H , Umask 00H The number of instruction fetches from the the instruction cache and -streaming buffers counting both cacheable and uncacheable fetches. +streaming buffers counting both cacheable and un-cacheable fetches. .It Li IFU_Mem_Stall .Pq Event 86H , Umask 00H The number of cycles the instruction fetch unit was stalled while @@ -754,7 +754,7 @@ Performance monitoring events for retire .It AE29 DR3 address match on MOVD/MOVQ/MOVNTQ memory store instruction may incorrectly increment performance monitoring count -for saturating simd instructions retired (Event CFH). +for saturating SIMD instructions retired (Event CFH). .It AE33 Hardware prefetch performance monitoring events may be counted inaccurately. Modified: head/lib/libpmc/pmc.iaf.3 ============================================================================== --- head/lib/libpmc/pmc.iaf.3 Sun Aug 23 07:31:10 2009 (r196448) +++ head/lib/libpmc/pmc.iaf.3 Sun Aug 23 07:32:30 2009 (r196449) @@ -73,7 +73,7 @@ Fixed-function PMCs support the followin .It PMC_CAP_WRITE Ta Yes .El .Ss Class Name Prefix -These pmcs are named using a class name prefix of +These PMCs are named using a class name prefix of .Dq Li iaf- . .Ss Event Qualifiers (Fixed Function PMCs) These PMCs support the following modifiers: From julian at FreeBSD.org Sun Aug 23 07:48:12 2009 From: julian at FreeBSD.org (Julian Elischer) Date: Sun Aug 23 07:48:24 2009 Subject: svn commit: r196450 - head/share/man/man9 Message-ID: <200908230748.n7N7mBB8050912@svn.freebsd.org> Author: julian Date: Sun Aug 23 07:48:11 2009 New Revision: 196450 URL: http://svn.freebsd.org/changeset/base/196450 Log: Add claraifications to the kproc and kthread manpages and link the kthread_create(9) man page to the kproc(9) page as it had migrated and people looking for it may need a hand to find its new name. MFC after: 1 week Modified: head/share/man/man9/Makefile head/share/man/man9/kproc.9 head/share/man/man9/kthread.9 Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sun Aug 23 07:32:30 2009 (r196449) +++ head/share/man/man9/Makefile Sun Aug 23 07:48:11 2009 (r196450) @@ -713,6 +713,7 @@ MLINKS+=kobj.9 DEFINE_CLASS.9 \ kobj.9 kobj_delete.9 \ kobj.9 kobj_init.9 MLINKS+=kproc.9 kproc_create.9 \ + kproc.9 kthread_create.9 \ kproc.9 kproc_exit.9 \ kproc.9 kproc_resume.9 \ kproc.9 kproc_shutdown.9 \ Modified: head/share/man/man9/kproc.9 ============================================================================== --- head/share/man/man9/kproc.9 Sun Aug 23 07:32:30 2009 (r196449) +++ head/share/man/man9/kproc.9 Sun Aug 23 07:48:11 2009 (r196450) @@ -64,6 +64,28 @@ .Fa "int flags" "int pages" "char * procname" "const char *fmt" "..." .Fc .Sh DESCRIPTION +In +.Fx 8.0 , +the +.Fn kthread* 9 +family of functions was renamed to be the +.Fn kproc* 9 +family of functions, as they were misnamed +and actually produced kernel processes. +A new family of +.Em different +.Fn kthread_* 9 +functions was added to produce +.Em real +kernel +.Em threads . +See the +.Xr kthread 9 +man page for more information on those calls. +Also note that the +.Fn kproc_kthread_add 9 +function appears in both pages as its functionality is split. +.Pp The function .Fn kproc_start is used to start Modified: head/share/man/man9/kthread.9 ============================================================================== --- head/share/man/man9/kthread.9 Sun Aug 23 07:32:30 2009 (r196449) +++ head/share/man/man9/kthread.9 Sun Aug 23 07:48:11 2009 (r196450) @@ -65,6 +65,27 @@ .Fa "int flags" "int pages" "char * procname" "const char *fmt" "..." .Fc .Sh DESCRIPTION +In +.Fx 8.0 , +the older family of +.Fn kthread_* 9 +functions was renamed to be the +.Fn kproc_* 9 +family of functions, +as they were previously misnamed +and actually produced kernel processes. +This new family of +.Fn kthread_* 9 +functions was added to produce +.Em real +kernel threads. +See the +.Xr kproc 9 +man page for more information on the renamed calls. +Also note that the +.Fn kproc_kthread_add 9 +function appears in both pages as its functionality is split. +.Pp The function .Fn kthread_start is used to start From julian at FreeBSD.org Sun Aug 23 07:59:29 2009 From: julian at FreeBSD.org (Julian Elischer) Date: Sun Aug 23 07:59:35 2009 Subject: svn commit: r196451 - head/sys/netinet/ipfw Message-ID: <200908230759.n7N7xS6g051165@svn.freebsd.org> Author: julian Date: Sun Aug 23 07:59:28 2009 New Revision: 196451 URL: http://svn.freebsd.org/changeset/base/196451 Log: Fix typo in comment that has been bugging me for days. MFC after: 1 week Modified: head/sys/netinet/ipfw/ip_fw2.c Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Sun Aug 23 07:48:11 2009 (r196450) +++ head/sys/netinet/ipfw/ip_fw2.c Sun Aug 23 07:59:28 2009 (r196451) @@ -4653,7 +4653,7 @@ ipfw_init(void) #endif /* * Other things that are only done the first time. - * (now that we a re cuaranteed of success). + * (now that we a re guaranteed of success). */ ip_fw_ctl_ptr = ipfw_ctl; ip_fw_chk_ptr = ipfw_chk; From ed at FreeBSD.org Sun Aug 23 08:04:40 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Sun Aug 23 08:04:47 2009 Subject: svn commit: r196452 - in head/sys: dev/snp kern sys Message-ID: <200908230804.n7N84efJ051317@svn.freebsd.org> Author: ed Date: Sun Aug 23 08:04:40 2009 New Revision: 196452 URL: http://svn.freebsd.org/changeset/base/196452 Log: Add ttydisc_rint_simple(). I noticed several drivers in our tree don't actually care about parity and framing, such as pts(4), snp(4) (and my partially finished console driver). Instead of duplicating a lot of code, I think we'd better add a utility function for those drivers to quickly process a buffer of input. Also change pts(4) and snp(4) to use this function. Modified: head/sys/dev/snp/snp.c head/sys/kern/tty_pts.c head/sys/kern/tty_ttydisc.c head/sys/sys/ttydisc.h Modified: head/sys/dev/snp/snp.c ============================================================================== --- head/sys/dev/snp/snp.c Sun Aug 23 07:59:28 2009 (r196451) +++ head/sys/dev/snp/snp.c Sun Aug 23 08:04:40 2009 (r196452) @@ -192,7 +192,7 @@ snp_write(struct cdev *dev, struct uio * { struct snp_softc *ss; struct tty *tp; - int error, len, i; + int error, len; char in[SNP_INPUT_BUFSIZE]; error = devfs_get_cdevpriv((void **)&ss); @@ -223,14 +223,9 @@ snp_write(struct cdev *dev, struct uio * * because we shouldn't bail out when we're running * close to the watermarks. */ - if (ttydisc_can_bypass(tp)) { - ttydisc_rint_bypass(tp, in, len); - } else { - for (i = 0; i < len; i++) - ttydisc_rint(tp, in[i], 0); - } - + ttydisc_rint_simple(tp, in, len); ttydisc_rint_done(tp); + tty_unlock(tp); } Modified: head/sys/kern/tty_pts.c ============================================================================== --- head/sys/kern/tty_pts.c Sun Aug 23 07:59:28 2009 (r196451) +++ head/sys/kern/tty_pts.c Sun Aug 23 08:04:40 2009 (r196452) @@ -215,25 +215,12 @@ ptsdev_write(struct file *fp, struct uio */ MPASS(iblen > 0); do { - if (ttydisc_can_bypass(tp)) { - /* Store data at once. */ - rintlen = ttydisc_rint_bypass(tp, - ibstart, iblen); - ibstart += rintlen; - iblen -= rintlen; - - if (iblen == 0) { - /* All data written. */ - break; - } - } else { - error = ttydisc_rint(tp, *ibstart, 0); - if (error == 0) { - /* Character stored successfully. */ - ibstart++; - iblen--; - continue; - } + rintlen = ttydisc_rint_simple(tp, ibstart, iblen); + ibstart += rintlen; + iblen -= rintlen; + if (iblen == 0) { + /* All data written. */ + break; } /* Maybe the device isn't used anyway. */ Modified: head/sys/kern/tty_ttydisc.c ============================================================================== --- head/sys/kern/tty_ttydisc.c Sun Aug 23 07:59:28 2009 (r196451) +++ head/sys/kern/tty_ttydisc.c Sun Aug 23 08:04:40 2009 (r196452) @@ -1045,6 +1045,22 @@ print: } size_t +ttydisc_rint_simple(struct tty *tp, const void *buf, size_t len) +{ + const char *cbuf; + + if (ttydisc_can_bypass(tp)) + return (ttydisc_rint_bypass(tp, buf, len)); + + for (cbuf = buf; len-- > 0; cbuf++) { + if (ttydisc_rint(tp, *cbuf, 0) != 0) + break; + } + + return (cbuf - (const char *)buf); +} + +size_t ttydisc_rint_bypass(struct tty *tp, const void *buf, size_t len) { size_t ret; Modified: head/sys/sys/ttydisc.h ============================================================================== --- head/sys/sys/ttydisc.h Sun Aug 23 07:59:28 2009 (r196451) +++ head/sys/sys/ttydisc.h Sun Aug 23 08:04:40 2009 (r196452) @@ -52,6 +52,7 @@ void ttydisc_optimize(struct tty *tp); void ttydisc_modem(struct tty *tp, int open); #define ttydisc_can_bypass(tp) ((tp)->t_flags & TF_BYPASS) int ttydisc_rint(struct tty *tp, char c, int flags); +size_t ttydisc_rint_simple(struct tty *tp, const void *buf, size_t len); size_t ttydisc_rint_bypass(struct tty *tp, const void *buf, size_t len); void ttydisc_rint_done(struct tty *tp); size_t ttydisc_rint_poll(struct tty *tp); From ed at 80386.nl Sun Aug 23 08:09:44 2009 From: ed at 80386.nl (Ed Schouten) Date: Sun Aug 23 08:09:55 2009 Subject: svn commit: r196451 - head/sys/netinet/ipfw In-Reply-To: <200908230759.n7N7xS6g051165@svn.freebsd.org> References: <200908230759.n7N7xS6g051165@svn.freebsd.org> Message-ID: <20090823080940.GT1292@hoeg.nl> * Julian Elischer wrote: > + * (now that we a re guaranteed of success). ^^^^ ;-) -- Ed Schouten WWW: http://80386.nl/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20090823/c59f3c18/attachment.pgp From danfe at FreeBSD.org Sun Aug 23 08:35:53 2009 From: danfe at FreeBSD.org (Alexey Dokuchaev) Date: Sun Aug 23 08:36:04 2009 Subject: svn commit: r196440 - head/lib/libpmc In-Reply-To: <200908230619.n7N6J2Wx048749@svn.freebsd.org> References: <200908230619.n7N6J2Wx048749@svn.freebsd.org> Message-ID: <20090823083553.GB14817@FreeBSD.org> On Sun, Aug 23, 2009 at 06:19:02AM +0000, Joseph Koshy wrote: > Author: jkoshy > Date: Sun Aug 23 06:19:02 2009 > New Revision: 196440 > URL: http://svn.freebsd.org/changeset/base/196440 > > Log: > Correct grammar. > > -CPUs are named using small integers from zero uptil, but > +CPUs are named using small integers from zero until, but I guess "up to" is also more appropriate here instead of "until". ./danfe From julian at FreeBSD.org Sun Aug 23 08:49:32 2009 From: julian at FreeBSD.org (Julian Elischer) Date: Sun Aug 23 08:49:38 2009 Subject: svn commit: r196453 - head/sys/netinet/ipfw Message-ID: <200908230849.n7N8nWjB052240@svn.freebsd.org> Author: julian Date: Sun Aug 23 08:49:32 2009 New Revision: 196453 URL: http://svn.freebsd.org/changeset/base/196453 Log: Fix another typo right next to the previous one, that amazingly, I did not see before. MFC after: 1 week Modified: head/sys/netinet/ipfw/ip_fw2.c Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Sun Aug 23 08:04:40 2009 (r196452) +++ head/sys/netinet/ipfw/ip_fw2.c Sun Aug 23 08:49:32 2009 (r196453) @@ -4653,7 +4653,7 @@ ipfw_init(void) #endif /* * Other things that are only done the first time. - * (now that we a re guaranteed of success). + * (now that we are guaranteed of success). */ ip_fw_ctl_ptr = ipfw_ctl; ip_fw_chk_ptr = ipfw_chk; From rpaulo at FreeBSD.org Sun Aug 23 09:55:07 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Sun Aug 23 09:55:18 2009 Subject: svn commit: r196454 - head/sys/kern Message-ID: <200908230955.n7N9t6Go053499@svn.freebsd.org> Author: rpaulo Date: Sun Aug 23 09:55:06 2009 New Revision: 196454 URL: http://svn.freebsd.org/changeset/base/196454 Log: Constify prime numbers. Modified: head/sys/kern/kern_subr.c Modified: head/sys/kern/kern_subr.c ============================================================================== --- head/sys/kern/kern_subr.c Sun Aug 23 08:49:32 2009 (r196453) +++ head/sys/kern/kern_subr.c Sun Aug 23 09:55:06 2009 (r196454) @@ -419,9 +419,9 @@ hashdestroy(void *vhashtbl, struct mallo free(hashtbl, type); } -static int primes[] = { 1, 13, 31, 61, 127, 251, 509, 761, 1021, 1531, 2039, - 2557, 3067, 3583, 4093, 4603, 5119, 5623, 6143, 6653, - 7159, 7673, 8191, 12281, 16381, 24571, 32749 }; +static const int primes[] = { 1, 13, 31, 61, 127, 251, 509, 761, 1021, 1531, + 2039, 2557, 3067, 3583, 4093, 4603, 5119, 5623, 6143, + 6653, 7159, 7673, 8191, 12281, 16381, 24571, 32749 }; #define NPRIMES (sizeof(primes) / sizeof(primes[0])) /* From rpaulo at FreeBSD.org Sun Aug 23 09:58:07 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Sun Aug 23 09:58:13 2009 Subject: svn commit: r196455 - head/sys/dev/asmc Message-ID: <200908230958.n7N9w6AJ053577@svn.freebsd.org> Author: rpaulo Date: Sun Aug 23 09:58:06 2009 New Revision: 196455 URL: http://svn.freebsd.org/changeset/base/196455 Log: Make dev.asmc.N.light.control writable by everyone. Submitted by: Patrick Lamaiziere MFC after: 1 week Modified: head/sys/dev/asmc/asmc.c Modified: head/sys/dev/asmc/asmc.c ============================================================================== --- head/sys/dev/asmc/asmc.c Sun Aug 23 09:55:06 2009 (r196454) +++ head/sys/dev/asmc/asmc.c Sun Aug 23 09:58:06 2009 (r196455) @@ -419,7 +419,8 @@ asmc_attach(device_t dev) SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sc->sc_light_tree), - OID_AUTO, "control", CTLTYPE_INT | CTLFLAG_RW, + OID_AUTO, "control", + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_ANYBODY, dev, 0, model->smc_light_control, "I", "Keyboard backlight brightness control"); } From pjd at FreeBSD.org Sun Aug 23 11:22:47 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Sun Aug 23 11:22:58 2009 Subject: svn commit: r196456 - head/sys/cddl/compat/opensolaris/sys Message-ID: <200908231122.n7NBMkJq059355@svn.freebsd.org> Author: pjd Date: Sun Aug 23 11:22:46 2009 New Revision: 196456 URL: http://svn.freebsd.org/changeset/base/196456 Log: - Give minclsyspri and maxclsyspri real values (consulted with kmacy). - Honour 'pri' argument for thread_create(). Modified: head/sys/cddl/compat/opensolaris/sys/mutex.h head/sys/cddl/compat/opensolaris/sys/proc.h Modified: head/sys/cddl/compat/opensolaris/sys/mutex.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/mutex.h Sun Aug 23 09:58:06 2009 (r196455) +++ head/sys/cddl/compat/opensolaris/sys/mutex.h Sun Aug 23 11:22:46 2009 (r196456) @@ -32,9 +32,9 @@ #ifdef _KERNEL #include -#include #include #include_next +#include #include typedef enum { Modified: head/sys/cddl/compat/opensolaris/sys/proc.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/proc.h Sun Aug 23 09:58:06 2009 (r196455) +++ head/sys/cddl/compat/opensolaris/sys/proc.h Sun Aug 23 11:22:46 2009 (r196456) @@ -34,13 +34,16 @@ #include_next #include #include +#include +#include +#include #include #ifdef _KERNEL #define CPU curcpu -#define minclsyspri 0 -#define maxclsyspri 0 +#define minclsyspri PRIBIO +#define maxclsyspri PVM #define max_ncpus mp_ncpus #define boot_max_ncpus mp_ncpus @@ -58,6 +61,7 @@ static __inline kthread_t * thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg, size_t len, proc_t *pp, int state, pri_t pri) { + kthread_t *td; proc_t *p; int error; @@ -70,7 +74,15 @@ thread_create(caddr_t stk, size_t stksiz error = kproc_create(proc, arg, &p, 0, stksize / PAGE_SIZE, "solthread %p", proc); - return (error == 0 ? FIRST_THREAD_IN_PROC(p) : NULL); + if (error != 0) + td = NULL; + else { + td = FIRST_THREAD_IN_PROC(p); + thread_lock(td); + sched_prio(td, pri); + thread_unlock(td); + } + return (td); } #define thread_exit() kproc_exit(0) From pjd at FreeBSD.org Sun Aug 23 11:27:08 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Sun Aug 23 11:27:20 2009 Subject: svn commit: r196457 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200908231127.n7NBR8Dp059467@svn.freebsd.org> Author: pjd Date: Sun Aug 23 11:27:08 2009 New Revision: 196457 URL: http://svn.freebsd.org/changeset/base/196457 Log: Set priority of vdev_geom threads and zvol threads to PRIBIO. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Aug 23 11:22:46 2009 (r196456) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Aug 23 11:27:08 2009 (r196457) @@ -194,6 +194,10 @@ vdev_geom_worker(void *arg) zio_t *zio; struct bio *bp; + thread_lock(curthread); + sched_prio(curthread, PRIBIO); + thread_unlock(curthread); + ctx = arg; for (;;) { mtx_lock(&ctx->gc_queue_mtx); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sun Aug 23 11:22:46 2009 (r196456) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sun Aug 23 11:27:08 2009 (r196457) @@ -402,6 +402,10 @@ zvol_worker(void *arg) zvol_state_t *zv; struct bio *bp; + thread_lock(curthread); + sched_prio(curthread, PRIBIO); + thread_unlock(curthread); + zv = arg; for (;;) { mtx_lock(&zv->zv_queue_mtx); From pjd at FreeBSD.org Sun Aug 23 11:33:48 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Sun Aug 23 11:34:01 2009 Subject: svn commit: r196458 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/sys Message-ID: <200908231133.n7NBXl5D059625@svn.freebsd.org> Author: pjd Date: Sun Aug 23 11:33:46 2009 New Revision: 196458 URL: http://svn.freebsd.org/changeset/base/196458 Log: - Hide ZFS kernel threads under zfskern process. - Use better (shorter) threads names: 'zvol:worker zvol/tank/vol00' -> 'zvol tank/vol00' 'vdev:worker da0' -> 'vdev da0' Modified: head/sys/cddl/compat/opensolaris/sys/proc.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c head/sys/cddl/contrib/opensolaris/uts/common/sys/callb.h Modified: head/sys/cddl/compat/opensolaris/sys/proc.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/proc.h Sun Aug 23 11:27:08 2009 (r196457) +++ head/sys/cddl/compat/opensolaris/sys/proc.h Sun Aug 23 11:33:46 2009 (r196458) @@ -57,12 +57,13 @@ typedef struct thread kthread_t; typedef struct thread *kthread_id_t; typedef struct proc proc_t; +extern struct proc *zfsproc; + static __inline kthread_t * thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg, size_t len, proc_t *pp, int state, pri_t pri) { - kthread_t *td; - proc_t *p; + kthread_t *td = NULL; int error; /* @@ -71,13 +72,11 @@ thread_create(caddr_t stk, size_t stksiz ASSERT(stk == NULL); ASSERT(len == 0); ASSERT(state == TS_RUN); + ASSERT(pp == &p0); - error = kproc_create(proc, arg, &p, 0, stksize / PAGE_SIZE, - "solthread %p", proc); - if (error != 0) - td = NULL; - else { - td = FIRST_THREAD_IN_PROC(p); + error = kproc_kthread_add(proc, arg, &zfsproc, &td, 0, + stksize / PAGE_SIZE, "zfskern", "solthread %p", proc); + if (error == 0) { thread_lock(td); sched_prio(td, pri); thread_unlock(td); @@ -85,7 +84,7 @@ thread_create(caddr_t stk, size_t stksiz return (td); } -#define thread_exit() kproc_exit(0) +#define thread_exit() kthread_exit() #endif /* _KERNEL */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Aug 23 11:27:08 2009 (r196457) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Aug 23 11:33:46 2009 (r196458) @@ -207,7 +207,7 @@ vdev_geom_worker(void *arg) ctx->gc_state = 2; wakeup_one(&ctx->gc_state); mtx_unlock(&ctx->gc_queue_mtx); - kproc_exit(0); + kthread_exit(); } msleep(&ctx->gc_queue, &ctx->gc_queue_mtx, PRIBIO | PDROP, "vgeom:io", 0); @@ -534,8 +534,8 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi vd->vdev_tsd = ctx; pp = cp->provider; - kproc_create(vdev_geom_worker, ctx, NULL, 0, 0, "vdev:worker %s", - pp->name); + kproc_kthread_add(vdev_geom_worker, ctx, &zfsproc, NULL, 0, 0, + "zfskern", "vdev %s", pp->name); /* * Determine the actual size of the device. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Aug 23 11:27:08 2009 (r196457) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Aug 23 11:33:46 2009 (r196458) @@ -3057,6 +3057,7 @@ zfsdev_fini(void) } static struct root_hold_token *zfs_root_token; +struct proc *zfsproc; uint_t zfs_fsyncer_key; extern uint_t rrw_tsd_key; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sun Aug 23 11:27:08 2009 (r196457) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sun Aug 23 11:33:46 2009 (r196458) @@ -415,7 +415,7 @@ zvol_worker(void *arg) zv->zv_state = 2; wakeup(&zv->zv_state); mtx_unlock(&zv->zv_queue_mtx); - kproc_exit(0); + kthread_exit(); } msleep(&zv->zv_queue, &zv->zv_queue_mtx, PRIBIO | PDROP, "zvol:io", 0); @@ -828,7 +828,8 @@ zvol_create_minor(const char *name, majo bioq_init(&zv->zv_queue); mtx_init(&zv->zv_queue_mtx, "zvol", NULL, MTX_DEF); zv->zv_state = 0; - kproc_create(zvol_worker, zv, NULL, 0, 0, "zvol:worker %s", pp->name); + kproc_kthread_add(zvol_worker, zv, &zfsproc, NULL, 0, 0, "zfskern", + "zvol %s", pp->name + strlen(ZVOL_DEV_DIR) + 1); zvol_minors++; end: Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/callb.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/callb.h Sun Aug 23 11:27:08 2009 (r196457) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/callb.h Sun Aug 23 11:33:46 2009 (r196458) @@ -135,8 +135,6 @@ typedef struct callb_cpr { #define CALLB_CPR_INIT(cp, lockp, func, name) { \ strlcpy(curthread->td_name, (name), \ sizeof(curthread->td_name)); \ - strlcpy(curthread->td_proc->p_comm, (name), \ - sizeof(curthread->td_proc->p_comm)); \ bzero((caddr_t)(cp), sizeof (callb_cpr_t)); \ (cp)->cc_lockp = lockp; \ (cp)->cc_id = callb_add(func, (void *)(cp), \ From ed at FreeBSD.org Sun Aug 23 12:23:25 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Sun Aug 23 12:23:37 2009 Subject: svn commit: r196459 - head/gnu/usr.bin/patch Message-ID: <200908231223.n7NCNPqd060679@svn.freebsd.org> Author: ed Date: Sun Aug 23 12:23:24 2009 New Revision: 196459 URL: http://svn.freebsd.org/changeset/base/196459 Log: Add support for diffs generated by Perforce. It basically picks the filenames from the "====" line and strips off the # revision number. Modified: head/gnu/usr.bin/patch/pch.c Modified: head/gnu/usr.bin/patch/pch.c ============================================================================== --- head/gnu/usr.bin/patch/pch.c Sun Aug 23 11:33:46 2009 (r196458) +++ head/gnu/usr.bin/patch/pch.c Sun Aug 23 12:23:24 2009 (r196459) @@ -211,6 +211,25 @@ there_is_another_patch(void) return TRUE; } +static char * +p4_savestr(char *str) +{ + char *t, *h; + + /* Leading whitespace. */ + while (isspace((unsigned char)*str)) + str++; + + /* Remove the file revision number. */ + for (t = str, h = NULL; *t != '\0' && !isspace((unsigned char)*t); t++) + if (*t == '#') + h = t; + if (h != NULL) + *h = '\0'; + + return savestr(str); +} + /* * Determine what kind of diff is in the remaining part of the patch file. */ @@ -298,6 +317,11 @@ intuit_diff_type(void) free(revision); revision = Nullch; } + } else if (strnEQ(s, "==== ", 5)) { + /* Perforce-style diffs. */ + if ((t = strstr(s + 5, " - ")) != NULL) + newtmp = p4_savestr(t + 3); + oldtmp = p4_savestr(s + 5); } if ((!diff_type || diff_type == ED_DIFF) && first_command_line >= 0L && From kib at FreeBSD.org Sun Aug 23 12:44:16 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sun Aug 23 12:44:22 2009 Subject: svn commit: r196460 - head/sys/kern Message-ID: <200908231244.n7NCiFgc061095@svn.freebsd.org> Author: kib Date: Sun Aug 23 12:44:15 2009 New Revision: 196460 URL: http://svn.freebsd.org/changeset/base/196460 Log: Fix the conformance of poll(2) for sockets after r195423 by returning POLLHUP instead of POLLIN for several cases. Now, the tools/regression/poll results for FreeBSD are closer to that of the Solaris and Linux. Also, improve the POSIX conformance by explicitely clearing POLLOUT when POLLHUP is reported in pollscan(), making the fix global. Submitted by: bde Reviewed by: rwatson MFC after: 1 week Modified: head/sys/kern/sys_generic.c head/sys/kern/uipc_socket.c Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Sun Aug 23 12:23:24 2009 (r196459) +++ head/sys/kern/sys_generic.c Sun Aug 23 12:44:15 2009 (r196460) @@ -1228,6 +1228,13 @@ pollscan(td, fds, nfd) selfdalloc(td, fds); fds->revents = fo_poll(fp, fds->events, td->td_ucred, td); + /* + * POSIX requires POLLOUT to be never + * set simultaneously with POLLHUP. + */ + if ((fds->revents & POLLHUP) != 0) + fds->revents &= ~POLLOUT; + if (fds->revents != 0) n++; } Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Sun Aug 23 12:23:24 2009 (r196459) +++ head/sys/kern/uipc_socket.c Sun Aug 23 12:44:15 2009 (r196460) @@ -2898,13 +2898,11 @@ sopoll_generic(struct socket *so, int ev if (so->so_oobmark || (so->so_rcv.sb_state & SBS_RCVATMARK)) revents |= events & (POLLPRI | POLLRDBAND); - if ((events & POLLINIGNEOF) == 0) { - if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { - revents |= events & (POLLIN | POLLRDNORM); - if (so->so_snd.sb_state & SBS_CANTSENDMORE) - revents |= POLLHUP; - } - } + if ((events & POLLINIGNEOF) == 0) + if (so->so_rcv.sb_state & SBS_CANTRCVMORE) + revents |= POLLHUP; + if (so->so_snd.sb_state & SBS_CANTSENDMORE) + revents |= POLLHUP; if (revents == 0) { if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) { From brde at optusnet.com.au Sun Aug 23 14:14:56 2009 From: brde at optusnet.com.au (Bruce Evans) Date: Sun Aug 23 14:15:02 2009 Subject: svn commit: r196451 - head/sys/netinet/ipfw In-Reply-To: <20090823080940.GT1292@hoeg.nl> References: <200908230759.n7N7xS6g051165@svn.freebsd.org> <20090823080940.GT1292@hoeg.nl> Message-ID: <20090823230300.Q38728@delplex.bde.org> On Sun, 23 Aug 2009, Ed Schouten wrote: > * Julian Elischer wrote: >> + * (now that we a re guaranteed of success). > ^^^^ > > ;-) At least 5 more commits are needed at this rate to fix the comment. % /* % * Other things that are only done the first time. ^ (1) ^ (2) % * (now that we a re guaranteed of success). ^^^^ (3) ^^ (4) % */ (1) remove syntax error ("." in the middle of a pseudo-sentence (2) fix line break (don't format for 60-column terminals) (3) as above (4) remove syntax error (5) either remove the comment, or change it so that it says something that is useful or at least correct. This is an especially initial init function, so of course it does things that are done the first time, and other comments in it describe the onlyness of this better. This function always succeeds, so its success is guaranteed throughout the function, not just in the lines following this comment. 100 or so commits at this rate would be needed to fix other style bugs in this function: % % % 3 extra blank lines before the function. % /**************** Non-KNF block comment. % * Stuff that must be initialised only on boot or module load Strange (English?) spelling of "initialized". Sentence not terminated with a ".". % */ % int % ipfw_init(void) % { % int error = 0; This variable is not really used. Initialization in declaration. This mainly obfuscates the non-use of the variable. % % ipfw_dyn_rule_zone = uma_zcreate("IPFW dynamic rule", % sizeof(ipfw_dyn_rule), NULL, NULL, NULL, NULL, % UMA_ALIGN_PTR, 0); Bogus line splitting for the second split (the split is long before needed, and in fact is not needed). % Extra blank line % IPFW_DYN_LOCK_INIT(); Minor obfuscation. This macro is only used once. % /* % * Only print out this stuff the first time around, % * when called from the sysinit code. % */ Missing blank line before the comment. KNF doesn't really allow this either, but if there are to be blank lines in functions then they belong before blocks of code (and all blocks of code should begin with a comment). Comment adds less than nothing. This is an especially initial init function, so of course it does stuff that is only done the first time, not just this printf, and this is better described earlier. % printf("ipfw2 " % #ifdef INET6 % "(+ipv6) " % #endif % "initialized, divert %s, nat %s, " % "rule-based forwarding " % #ifdef IPFIREWALL_FORWARD % "enabled, " % #else % "disabled, " % #endif % "default to %s, logging ", % #ifdef IPDIVERT % "enabled", % #else % "loadable", % #endif % #ifdef IPFIREWALL_NAT % "enabled", % #else % "loadable", % #endif % default_to_accept ? "accept" : "deny"); I hate using C90 string concatenation to obfuscate messages, but don't see anything better here. % Extra blank line. This would normally be correct before a block comment, but here the block comment breaks the block -- to the extent that the previous comment is useful, its scope doesn't end here -- the "block" consistes of all the printfs. % /* % * Note: V_xxx variables can be accessed here but the iattach() % * may not have been called yet for the VIMGE case. % * Tuneables will have been processed. % */ Grammar error "the iattach()". Should be plain iattach in KNF. I prefer iattach(). Could be "the iattach() function to be as verbose as man pages. Semantic error "may" (should be "might"). Spelling error "VIMGE". Possible spelling error "Tuneables". ispell gives only tunable, "tune able" and "tune-able". % if (V_fw_verbose == 0) % printf("disabled\n"); % else if (V_verbose_limit == 0) % printf("unlimited\n"); % else % printf("limited to %d packets/entry by default\n", % V_verbose_limit); This is an extension of the previous printed, with a completely different style. It uses separate printfs instead of combining everything using complicated logic involving ifdefs and the ?: operator. This is probably better. With the second style, the newline should be in a separate printf too. The printfs are too verbose (especially the last one), so they might give too-long lines in output, but a single line is best for a log message. % % /* % * Other things that are only done the first time. % * (now that we a re guaranteed of success). % */ See above. % ip_fw_ctl_ptr = ipfw_ctl; % ip_fw_chk_ptr = ipfw_chk; Missing blank line. The above comment and its block end before the return statement. % return (error); This is an obfuscation of "return (0);". Old versions of this function sometimes failed, so the "(now we a re cuaranteed success)" (sic) comment would have applied to them, but they didn't have the comment. They needed the `error' variable, but they were missing the obfuscatory initialization of it to 0 and the obfuscatory return of it (they just returned 0 here). % } Bruce From rnoland at FreeBSD.org Sun Aug 23 14:27:47 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Sun Aug 23 14:27:53 2009 Subject: svn commit: r196464 - head/sys/dev/drm Message-ID: <200908231427.n7NERkJX063295@svn.freebsd.org> Author: rnoland Date: Sun Aug 23 14:27:46 2009 New Revision: 196464 URL: http://svn.freebsd.org/changeset/base/196464 Log: Clean up the locking in drm_alloc_resource() MFC after: 2 weeks Modified: head/sys/dev/drm/drm_bufs.c Modified: head/sys/dev/drm/drm_bufs.c ============================================================================== --- head/sys/dev/drm/drm_bufs.c Sun Aug 23 14:15:28 2009 (r196463) +++ head/sys/dev/drm/drm_bufs.c Sun Aug 23 14:27:46 2009 (r196464) @@ -45,27 +45,35 @@ __FBSDID("$FreeBSD$"); */ static int drm_alloc_resource(struct drm_device *dev, int resource) { + struct resource *res; + int rid; + + DRM_SPINLOCK_ASSERT(&dev->dev_lock); + if (resource >= DRM_MAX_PCI_RESOURCE) { DRM_ERROR("Resource %d too large\n", resource); return 1; } - DRM_UNLOCK(); if (dev->pcir[resource] != NULL) { - DRM_LOCK(); return 0; } - dev->pcirid[resource] = PCIR_BAR(resource); - dev->pcir[resource] = bus_alloc_resource_any(dev->device, - SYS_RES_MEMORY, &dev->pcirid[resource], RF_SHAREABLE); + DRM_UNLOCK(); + rid = PCIR_BAR(resource); + res = bus_alloc_resource_any(dev->device, SYS_RES_MEMORY, &rid, + RF_SHAREABLE); DRM_LOCK(); - - if (dev->pcir[resource] == NULL) { + if (res == NULL) { DRM_ERROR("Couldn't find resource 0x%x\n", resource); return 1; } + if (dev->pcir[resource] == NULL) { + dev->pcirid[resource] = rid; + dev->pcir[resource] = res; + } + return 0; } From rnoland at FreeBSD.org Sun Aug 23 14:31:20 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Sun Aug 23 14:31:32 2009 Subject: svn commit: r196465 - head/sys/dev/drm Message-ID: <200908231431.n7NEVKv0063405@svn.freebsd.org> Author: rnoland Date: Sun Aug 23 14:31:20 2009 New Revision: 196465 URL: http://svn.freebsd.org/changeset/base/196465 Log: Clean up the handling of device minors Submitted by: Ed MFC after: 2 weeks Modified: head/sys/dev/drm/drmP.h head/sys/dev/drm/drm_drv.c head/sys/dev/drm/drm_fops.c head/sys/dev/drm/drm_sysctl.c Modified: head/sys/dev/drm/drmP.h ============================================================================== --- head/sys/dev/drm/drmP.h Sun Aug 23 14:27:46 2009 (r196464) +++ head/sys/dev/drm/drmP.h Sun Aug 23 14:31:20 2009 (r196465) @@ -416,7 +416,6 @@ struct drm_file { struct drm_device *dev; int authenticated; int master; - int minor; pid_t pid; uid_t uid; drm_magic_t magic; Modified: head/sys/dev/drm/drm_drv.c ============================================================================== --- head/sys/dev/drm/drm_drv.c Sun Aug 23 14:27:46 2009 (r196464) +++ head/sys/dev/drm/drm_drv.c Sun Aug 23 14:31:20 2009 (r196465) @@ -53,9 +53,6 @@ static void drm_unload(struct drm_device static drm_pci_id_list_t *drm_find_description(int vendor, int device, drm_pci_id_list_t *idlist); -#define DRIVER_SOFTC(unit) \ - ((struct drm_device *)devclass_get_softc(drm_devclass, unit)) - MODULE_VERSION(drm, 1); MODULE_DEPEND(drm, agp, 1, 1, 1); MODULE_DEPEND(drm, pci, 1, 1, 1); @@ -210,11 +207,12 @@ int drm_attach(device_t kdev, drm_pci_id dev->device = kdev; #endif dev->devnode = make_dev(&drm_cdevsw, - unit, + 0, DRM_DEV_UID, DRM_DEV_GID, DRM_DEV_MODE, "dri/card%d", unit); + dev->devnode->si_drv1 = dev; #if __FreeBSD_version >= 700053 dev->pci_domain = pci_get_domain(dev->device); @@ -606,7 +604,7 @@ int drm_open(struct cdev *kdev, int flag struct drm_device *dev = NULL; int retcode = 0; - dev = DRIVER_SOFTC(dev2unit(kdev)); + dev = kdev->si_drv1; DRM_DEBUG("open_count = %d\n", dev->open_count); Modified: head/sys/dev/drm/drm_fops.c ============================================================================== --- head/sys/dev/drm/drm_fops.c Sun Aug 23 14:27:46 2009 (r196464) +++ head/sys/dev/drm/drm_fops.c Sun Aug 23 14:31:20 2009 (r196465) @@ -44,14 +44,13 @@ int drm_open_helper(struct cdev *kdev, i struct drm_device *dev) { struct drm_file *priv; - int m = dev2unit(kdev); int retcode; if (flags & O_EXCL) return EBUSY; /* No exclusive opens */ dev->flags = flags; - DRM_DEBUG("pid = %d, minor = %d\n", DRM_CURRENTPID, m); + DRM_DEBUG("pid = %d, device = %s\n", DRM_CURRENTPID, devtoname(kdev)); priv = malloc(sizeof(*priv), DRM_MEM_FILES, M_NOWAIT | M_ZERO); if (priv == NULL) { @@ -68,7 +67,6 @@ int drm_open_helper(struct cdev *kdev, i priv->dev = dev; priv->uid = p->td_ucred->cr_svuid; priv->pid = p->td_proc->p_pid; - priv->minor = m; priv->ioctl_count = 0; /* for compatibility root is always authenticated */ Modified: head/sys/dev/drm/drm_sysctl.c ============================================================================== --- head/sys/dev/drm/drm_sysctl.c Sun Aug 23 14:27:46 2009 (r196464) +++ head/sys/dev/drm/drm_sysctl.c Sun Aug 23 14:31:20 2009 (r196465) @@ -298,12 +298,13 @@ static int drm_clients_info DRM_SYSCTL_H DRM_UNLOCK(); - DRM_SYSCTL_PRINT("\na dev pid uid magic ioctls\n"); + DRM_SYSCTL_PRINT( + "\na dev pid uid magic ioctls\n"); for (i = 0; i < privcount; i++) { priv = &tempprivs[i]; - DRM_SYSCTL_PRINT("%c %3d %5d %5d %10u %10lu\n", + DRM_SYSCTL_PRINT("%c %-12s %5d %5d %10u %10lu\n", priv->authenticated ? 'y' : 'n', - priv->minor, + devtoname(priv->dev->devnode), priv->pid, priv->uid, priv->magic, From rnoland at FreeBSD.org Sun Aug 23 14:33:14 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Sun Aug 23 14:33:25 2009 Subject: svn commit: r196466 - head/sys/dev/drm Message-ID: <200908231433.n7NEXDE5063486@svn.freebsd.org> Author: rnoland Date: Sun Aug 23 14:33:12 2009 New Revision: 196466 URL: http://svn.freebsd.org/changeset/base/196466 Log: Add a read only sysctl tracking the hw.drm.msi tunable. MFC after: 2 weeks Modified: head/sys/dev/drm/drmP.h head/sys/dev/drm/drm_drv.c Modified: head/sys/dev/drm/drmP.h ============================================================================== --- head/sys/dev/drm/drmP.h Sun Aug 23 14:31:20 2009 (r196465) +++ head/sys/dev/drm/drmP.h Sun Aug 23 14:33:12 2009 (r196466) @@ -148,6 +148,8 @@ MALLOC_DECLARE(DRM_MEM_CTXBITMAP); MALLOC_DECLARE(DRM_MEM_SGLISTS); MALLOC_DECLARE(DRM_MEM_DRAWABLE); +SYSCTL_DECL(_hw_drm); + #define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8) /* Internal types and structures */ Modified: head/sys/dev/drm/drm_drv.c ============================================================================== --- head/sys/dev/drm/drm_drv.c Sun Aug 23 14:31:20 2009 (r196465) +++ head/sys/dev/drm/drm_drv.c Sun Aug 23 14:33:12 2009 (r196466) @@ -133,6 +133,9 @@ static struct cdevsw drm_cdevsw = { static int drm_msi = 1; /* Enable by default. */ TUNABLE_INT("hw.drm.msi", &drm_msi); +SYSCTL_NODE(_hw, OID_AUTO, drm, CTLFLAG_RW, NULL, "DRM device"); +SYSCTL_INT(_hw_drm, OID_AUTO, msi, CTLFLAG_RDTUN, &drm_msi, 1, + "Enable MSI interrupts for drm devices"); static struct drm_msi_blacklist_entry drm_msi_blacklist[] = { {0x8086, 0x2772}, /* Intel i945G */ \ From jeremie at le-hen.org Sun Aug 23 14:39:27 2009 From: jeremie at le-hen.org (Jeremie Le Hen) Date: Sun Aug 23 14:39:38 2009 Subject: svn commit: r196200 - in head: etc/mtree include sys/dev/mfi usr.sbin usr.sbin/mfiutil In-Reply-To: <200908132318.n7DNIjvO015601@svn.freebsd.org> References: <200908132318.n7DNIjvO015601@svn.freebsd.org> Message-ID: <20090823143840.GD61707@felucia.tataz.chchile.org> Hi, On Thu, Aug 13, 2009 at 11:18:45PM +0000, Scott Long wrote: > Author: scottl > Date: Thu Aug 13 23:18:45 2009 > New Revision: 196200 > URL: http://svn.freebsd.org/changeset/base/196200 > > Log: > ntroduce mfiutil, a basic utility for managing LSI SAS-RAID & Dell > PERC5/6 controllers. Controller, array, and drive status can be > checked, basic attributes can be changed, and arrays and spares can > be created and deleted. Controller firmware can also be flashed. > > This does not replace MegaCLI, found in ports, as that is officially > sanctioned and supported by LSI and includes vastly more > functionality. However, mfiutil is open source and guaranteed to > provide basic functionality, which can be especially useful if you > have a problem and can't get MegaCLI to work. > > Approved by: re > Obtained from: Yahoo! Inc. Thanks for this work. Wouldn't it be more reasonable to use a standard suffix for all dedicated admin utility such as vidcontrol, memcontrol, kbdcontrol: % 59# find /bin /sbin /usr/bin /usr/sbin -name \*control | wc -l % 25 % 60# find /bin /sbin /usr/bin /usr/sbin -name \*config | wc -l % 13 Once 8.0-RELEASE is out, the name will be more difficult to change. Regards, -- Jeremie Le Hen < jeremie at le-hen dot org >< ttz at chchile dot org > From jkoshy at FreeBSD.org Sun Aug 23 14:48:25 2009 From: jkoshy at FreeBSD.org (Joseph Koshy) Date: Sun Aug 23 14:48:31 2009 Subject: svn commit: r196469 - head/lib/libpmc Message-ID: <200908231448.n7NEmPix063937@svn.freebsd.org> Author: jkoshy Date: Sun Aug 23 14:48:25 2009 New Revision: 196469 URL: http://svn.freebsd.org/changeset/base/196469 Log: Use a more appropriate choice of words. Submitted by: danfe Modified: head/lib/libpmc/pmc.3 Modified: head/lib/libpmc/pmc.3 ============================================================================== --- head/lib/libpmc/pmc.3 Sun Aug 23 14:44:51 2009 (r196468) +++ head/lib/libpmc/pmc.3 Sun Aug 23 14:48:25 2009 (r196469) @@ -262,7 +262,7 @@ CPU is running unprivileged code. The ability to write to performance counters. .El .Ss CPU Naming Conventions -CPUs are named using small integers from zero until, but +CPUs are named using small integers from zero up to, but excluding, the value returned by function .Fn pmc_ncpu . On platforms supporting sparsely numbered CPUs not all the numbers in From rnoland at FreeBSD.org Sun Aug 23 14:55:58 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Sun Aug 23 14:56:05 2009 Subject: svn commit: r196470 - in head/sys: conf dev/drm modules/drm/radeon Message-ID: <200908231455.n7NEtvav064138@svn.freebsd.org> Author: rnoland Date: Sun Aug 23 14:55:57 2009 New Revision: 196470 URL: http://svn.freebsd.org/changeset/base/196470 Log: Add kernel support for Radeon R6/7xx 3D. You will still need Mesa from git and possibly an updated DDX driver, but this is working fairly well now. MFC after: 2 weeks Added: head/sys/dev/drm/r600_blit.c (contents, props changed) head/sys/dev/drm/radeon_cs.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/drm/r600_cp.c head/sys/dev/drm/radeon_cp.c head/sys/dev/drm/radeon_drm.h head/sys/dev/drm/radeon_drv.h head/sys/dev/drm/radeon_state.c head/sys/modules/drm/radeon/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Aug 23 14:48:25 2009 (r196469) +++ head/sys/conf/files Sun Aug 23 14:55:57 2009 (r196470) @@ -845,8 +845,10 @@ dev/drm/r128_irq.c optional r128drm dev/drm/r128_state.c optional r128drm \ compile-with "${NORMAL_C} -finline-limit=13500" dev/drm/r300_cmdbuf.c optional radeondrm +dev/drm/r600_blit.c optional radeondrm dev/drm/r600_cp.c optional radeondrm dev/drm/radeon_cp.c optional radeondrm +dev/drm/radeon_cs.c optional radeondrm dev/drm/radeon_drv.c optional radeondrm dev/drm/radeon_irq.c optional radeondrm dev/drm/radeon_mem.c optional radeondrm Added: head/sys/dev/drm/r600_blit.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/drm/r600_blit.c Sun Aug 23 14:55:57 2009 (r196470) @@ -0,0 +1,1986 @@ +/*- + * Copyright 2009 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Alex Deucher + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "dev/drm/drmP.h" +#include "dev/drm/drm.h" +#include "dev/drm/radeon_drm.h" +#include "dev/drm/radeon_drv.h" + +static u32 r6xx_default_state[] = +{ + 0xc0002400, + 0x00000000, + 0xc0012800, + 0x80000000, + 0x80000000, + 0xc0004600, + 0x00000016, + 0xc0016800, + 0x00000010, + 0x00028000, + 0xc0016800, + 0x00000010, + 0x00008000, + 0xc0016800, + 0x00000542, + 0x07000003, + 0xc0016800, + 0x000005c5, + 0x00000000, + 0xc0016800, + 0x00000363, + 0x00000000, + 0xc0016800, + 0x0000060c, + 0x82000000, + 0xc0016800, + 0x0000060e, + 0x01020204, + 0xc0016f00, + 0x00000000, + 0x00000000, + 0xc0016f00, + 0x00000001, + 0x00000000, + 0xc0096900, + 0x0000022a, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xc0016900, + 0x00000004, + 0x00000000, + 0xc0016900, + 0x0000000a, + 0x00000000, + 0xc0016900, + 0x0000000b, + 0x00000000, + 0xc0016900, + 0x0000010c, + 0x00000000, + 0xc0016900, + 0x0000010d, + 0x00000000, + 0xc0016900, + 0x00000200, + 0x00000000, + 0xc0016900, + 0x00000343, + 0x00000060, + 0xc0016900, + 0x00000344, + 0x00000040, + 0xc0016900, + 0x00000351, + 0x0000aa00, + 0xc0016900, + 0x00000104, + 0x00000000, + 0xc0016900, + 0x0000010e, + 0x00000000, + 0xc0046900, + 0x00000105, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xc0036900, + 0x00000109, + 0x00000000, + 0x00000000, + 0x00000000, + 0xc0046900, + 0x0000030c, + 0x01000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xc0046900, + 0x00000048, + 0x3f800000, + 0x00000000, + 0x3f800000, + 0x3f800000, + 0xc0016900, + 0x0000008e, + 0x0000000f, + 0xc0016900, + 0x00000080, + 0x00000000, + 0xc0016900, + 0x00000083, + 0x0000ffff, + 0xc0016900, + 0x00000084, + 0x00000000, + 0xc0016900, + 0x00000085, + 0x20002000, + 0xc0016900, + 0x00000086, + 0x00000000, + 0xc0016900, + 0x00000087, + 0x20002000, + 0xc0016900, + 0x00000088, + 0x00000000, + 0xc0016900, + 0x00000089, + 0x20002000, + 0xc0016900, + 0x0000008a, + 0x00000000, + 0xc0016900, + 0x0000008b, + 0x20002000, + 0xc0016900, + 0x0000008c, + 0x00000000, + 0xc0016900, + 0x00000094, + 0x80000000, + 0xc0016900, + 0x00000095, + 0x20002000, + 0xc0026900, + 0x000000b4, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x00000096, + 0x80000000, + 0xc0016900, + 0x00000097, + 0x20002000, + 0xc0026900, + 0x000000b6, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x00000098, + 0x80000000, + 0xc0016900, + 0x00000099, + 0x20002000, + 0xc0026900, + 0x000000b8, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x0000009a, + 0x80000000, + 0xc0016900, + 0x0000009b, + 0x20002000, + 0xc0026900, + 0x000000ba, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x0000009c, + 0x80000000, + 0xc0016900, + 0x0000009d, + 0x20002000, + 0xc0026900, + 0x000000bc, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x0000009e, + 0x80000000, + 0xc0016900, + 0x0000009f, + 0x20002000, + 0xc0026900, + 0x000000be, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000a0, + 0x80000000, + 0xc0016900, + 0x000000a1, + 0x20002000, + 0xc0026900, + 0x000000c0, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000a2, + 0x80000000, + 0xc0016900, + 0x000000a3, + 0x20002000, + 0xc0026900, + 0x000000c2, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000a4, + 0x80000000, + 0xc0016900, + 0x000000a5, + 0x20002000, + 0xc0026900, + 0x000000c4, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000a6, + 0x80000000, + 0xc0016900, + 0x000000a7, + 0x20002000, + 0xc0026900, + 0x000000c6, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000a8, + 0x80000000, + 0xc0016900, + 0x000000a9, + 0x20002000, + 0xc0026900, + 0x000000c8, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000aa, + 0x80000000, + 0xc0016900, + 0x000000ab, + 0x20002000, + 0xc0026900, + 0x000000ca, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000ac, + 0x80000000, + 0xc0016900, + 0x000000ad, + 0x20002000, + 0xc0026900, + 0x000000cc, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000ae, + 0x80000000, + 0xc0016900, + 0x000000af, + 0x20002000, + 0xc0026900, + 0x000000ce, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000b0, + 0x80000000, + 0xc0016900, + 0x000000b1, + 0x20002000, + 0xc0026900, + 0x000000d0, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000b2, + 0x80000000, + 0xc0016900, + 0x000000b3, + 0x20002000, + 0xc0026900, + 0x000000d2, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x00000293, + 0x00004010, + 0xc0016900, + 0x00000300, + 0x00000000, + 0xc0016900, + 0x00000301, + 0x00000000, + 0xc0016900, + 0x00000312, + 0xffffffff, + 0xc0016900, + 0x00000307, + 0x00000000, + 0xc0016900, + 0x00000308, + 0x00000000, + 0xc0016900, + 0x00000283, + 0x00000000, + 0xc0016900, + 0x00000292, + 0x00000000, + 0xc0066900, + 0x0000010f, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xc0016900, + 0x00000206, + 0x00000000, + 0xc0016900, + 0x00000207, + 0x00000000, + 0xc0016900, + 0x00000208, + 0x00000000, + 0xc0046900, + 0x00000303, + 0x3f800000, + 0x3f800000, + 0x3f800000, + 0x3f800000, + 0xc0016900, + 0x00000205, + 0x00000004, + 0xc0016900, + 0x00000280, + 0x00000000, + 0xc0016900, + 0x00000281, + 0x00000000, + 0xc0016900, + 0x0000037e, + 0x00000000, + 0xc0016900, + 0x00000382, + 0x00000000, + 0xc0016900, + 0x00000380, + 0x00000000, + 0xc0016900, + 0x00000383, + 0x00000000, + 0xc0016900, + 0x00000381, + 0x00000000, + 0xc0016900, + 0x00000282, + 0x00000008, + 0xc0016900, + 0x00000302, + 0x0000002d, + 0xc0016900, + 0x0000037f, + 0x00000000, + 0xc0016900, + 0x000001b2, + 0x00000000, + 0xc0016900, + 0x000001b6, + 0x00000000, + 0xc0016900, + 0x000001b7, + 0x00000000, + 0xc0016900, + 0x000001b8, + 0x00000000, + 0xc0016900, + 0x000001b9, + 0x00000000, + 0xc0016900, + 0x00000225, + 0x00000000, + 0xc0016900, + 0x00000229, + 0x00000000, + 0xc0016900, + 0x00000237, + 0x00000000, + 0xc0016900, + 0x00000100, + 0x00000800, + 0xc0016900, + 0x00000101, + 0x00000000, + 0xc0016900, + 0x00000102, + 0x00000000, + 0xc0016900, + 0x000002a8, + 0x00000000, + 0xc0016900, + 0x000002a9, + 0x00000000, + 0xc0016900, + 0x00000103, + 0x00000000, + 0xc0016900, + 0x00000284, + 0x00000000, + 0xc0016900, + 0x00000290, + 0x00000000, + 0xc0016900, + 0x00000285, + 0x00000000, + 0xc0016900, + 0x00000286, + 0x00000000, + 0xc0016900, + 0x00000287, + 0x00000000, + 0xc0016900, + 0x00000288, + 0x00000000, + 0xc0016900, + 0x00000289, + 0x00000000, + 0xc0016900, + 0x0000028a, + 0x00000000, + 0xc0016900, + 0x0000028b, + 0x00000000, + 0xc0016900, + 0x0000028c, + 0x00000000, + 0xc0016900, + 0x0000028d, + 0x00000000, + 0xc0016900, + 0x0000028e, + 0x00000000, + 0xc0016900, + 0x0000028f, + 0x00000000, + 0xc0016900, + 0x000002a1, + 0x00000000, + 0xc0016900, + 0x000002a5, + 0x00000000, + 0xc0016900, + 0x000002ac, + 0x00000000, + 0xc0016900, + 0x000002ad, + 0x00000000, + 0xc0016900, + 0x000002ae, + 0x00000000, + 0xc0016900, + 0x000002c8, + 0x00000000, + 0xc0016900, + 0x00000206, + 0x00000100, + 0xc0016900, + 0x00000204, + 0x00010000, + 0xc0036e00, + 0x00000000, + 0x00000012, + 0x00000000, + 0x00000000, + 0xc0016900, + 0x0000008f, + 0x0000000f, + 0xc0016900, + 0x000001e8, + 0x00000001, + 0xc0016900, + 0x00000202, + 0x00cc0000, + 0xc0016900, + 0x00000205, + 0x00000244, + 0xc0016900, + 0x00000203, + 0x00000210, + 0xc0016900, + 0x000001b1, + 0x00000000, + 0xc0016900, + 0x00000185, + 0x00000000, + 0xc0016900, + 0x000001b3, + 0x00000001, + 0xc0016900, + 0x000001b4, + 0x00000000, + 0xc0016900, + 0x00000191, + 0x00000b00, + 0xc0016900, + 0x000001b5, + 0x00000000, +}; + +static u32 r7xx_default_state[] = +{ + 0xc0012800, + 0x80000000, + 0x80000000, + 0xc0004600, + 0x00000016, + 0xc0016800, + 0x00000010, + 0x00028000, + 0xc0016800, + 0x00000010, + 0x00008000, + 0xc0016800, + 0x00000542, + 0x07000002, + 0xc0016800, + 0x000005c5, + 0x00000000, + 0xc0016800, + 0x00000363, + 0x00004000, + 0xc0016800, + 0x0000060c, + 0x00000000, + 0xc0016800, + 0x0000060e, + 0x00420204, + 0xc0016f00, + 0x00000000, + 0x00000000, + 0xc0016f00, + 0x00000001, + 0x00000000, + 0xc0096900, + 0x0000022a, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xc0016900, + 0x00000004, + 0x00000000, + 0xc0016900, + 0x0000000a, + 0x00000000, + 0xc0016900, + 0x0000000b, + 0x00000000, + 0xc0016900, + 0x0000010c, + 0x00000000, + 0xc0016900, + 0x0000010d, + 0x00000000, + 0xc0016900, + 0x00000200, + 0x00000000, + 0xc0016900, + 0x00000343, + 0x00000060, + 0xc0016900, + 0x00000344, + 0x00000000, + 0xc0016900, + 0x00000351, + 0x0000aa00, + 0xc0016900, + 0x00000104, + 0x00000000, + 0xc0016900, + 0x0000010e, + 0x00000000, + 0xc0046900, + 0x00000105, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xc0046900, + 0x0000030c, + 0x01000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xc0016900, + 0x0000008e, + 0x0000000f, + 0xc0016900, + 0x00000080, + 0x00000000, + 0xc0016900, + 0x00000083, + 0x0000ffff, + 0xc0016900, + 0x00000084, + 0x00000000, + 0xc0016900, + 0x00000085, + 0x20002000, + 0xc0016900, + 0x00000086, + 0x00000000, + 0xc0016900, + 0x00000087, + 0x20002000, + 0xc0016900, + 0x00000088, + 0x00000000, + 0xc0016900, + 0x00000089, + 0x20002000, + 0xc0016900, + 0x0000008a, + 0x00000000, + 0xc0016900, + 0x0000008b, + 0x20002000, + 0xc0016900, + 0x0000008c, + 0xaaaaaaaa, + 0xc0016900, + 0x00000094, + 0x80000000, + 0xc0016900, + 0x00000095, + 0x20002000, + 0xc0026900, + 0x000000b4, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x00000096, + 0x80000000, + 0xc0016900, + 0x00000097, + 0x20002000, + 0xc0026900, + 0x000000b6, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x00000098, + 0x80000000, + 0xc0016900, + 0x00000099, + 0x20002000, + 0xc0026900, + 0x000000b8, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x0000009a, + 0x80000000, + 0xc0016900, + 0x0000009b, + 0x20002000, + 0xc0026900, + 0x000000ba, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x0000009c, + 0x80000000, + 0xc0016900, + 0x0000009d, + 0x20002000, + 0xc0026900, + 0x000000bc, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x0000009e, + 0x80000000, + 0xc0016900, + 0x0000009f, + 0x20002000, + 0xc0026900, + 0x000000be, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000a0, + 0x80000000, + 0xc0016900, + 0x000000a1, + 0x20002000, + 0xc0026900, + 0x000000c0, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000a2, + 0x80000000, + 0xc0016900, + 0x000000a3, + 0x20002000, + 0xc0026900, + 0x000000c2, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000a4, + 0x80000000, + 0xc0016900, + 0x000000a5, + 0x20002000, + 0xc0026900, + 0x000000c4, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000a6, + 0x80000000, + 0xc0016900, + 0x000000a7, + 0x20002000, + 0xc0026900, + 0x000000c6, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000a8, + 0x80000000, + 0xc0016900, + 0x000000a9, + 0x20002000, + 0xc0026900, + 0x000000c8, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000aa, + 0x80000000, + 0xc0016900, + 0x000000ab, + 0x20002000, + 0xc0026900, + 0x000000ca, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000ac, + 0x80000000, + 0xc0016900, + 0x000000ad, + 0x20002000, + 0xc0026900, + 0x000000cc, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000ae, + 0x80000000, + 0xc0016900, + 0x000000af, + 0x20002000, + 0xc0026900, + 0x000000ce, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000b0, + 0x80000000, + 0xc0016900, + 0x000000b1, + 0x20002000, + 0xc0026900, + 0x000000d0, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000b2, + 0x80000000, + 0xc0016900, + 0x000000b3, + 0x20002000, + 0xc0026900, + 0x000000d2, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x00000293, + 0x00514000, + 0xc0016900, + 0x00000300, + 0x00000000, + 0xc0016900, + 0x00000301, + 0x00000000, + 0xc0016900, + 0x00000312, + 0xffffffff, + 0xc0016900, + 0x00000307, + 0x00000000, + 0xc0016900, + 0x00000308, + 0x00000000, + 0xc0016900, + 0x00000283, + 0x00000000, + 0xc0016900, + 0x00000292, + 0x00000000, + 0xc0066900, + 0x0000010f, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xc0016900, + 0x00000206, + 0x00000000, + 0xc0016900, + 0x00000207, + 0x00000000, + 0xc0016900, + 0x00000208, + 0x00000000, + 0xc0046900, + 0x00000303, + 0x3f800000, + 0x3f800000, + 0x3f800000, + 0x3f800000, + 0xc0016900, + 0x00000205, + 0x00000004, + 0xc0016900, + 0x00000280, + 0x00000000, + 0xc0016900, + 0x00000281, + 0x00000000, + 0xc0016900, + 0x0000037e, + 0x00000000, + 0xc0016900, + 0x00000382, + 0x00000000, + 0xc0016900, + 0x00000380, + 0x00000000, + 0xc0016900, + 0x00000383, + 0x00000000, + 0xc0016900, + 0x00000381, + 0x00000000, + 0xc0016900, + 0x00000282, + 0x00000008, + 0xc0016900, + 0x00000302, + 0x0000002d, + 0xc0016900, + 0x0000037f, + 0x00000000, + 0xc0016900, + 0x000001b2, + 0x00000001, + 0xc0016900, + 0x000001b6, + 0x00000000, + 0xc0016900, + 0x000001b7, + 0x00000000, + 0xc0016900, + 0x000001b8, + 0x00000000, + 0xc0016900, + 0x000001b9, + 0x00000000, + 0xc0016900, + 0x00000225, + 0x00000000, + 0xc0016900, + 0x00000229, + 0x00000000, + 0xc0016900, + 0x00000237, + 0x00000000, + 0xc0016900, + 0x00000100, + 0x00000800, + 0xc0016900, + 0x00000101, + 0x00000000, + 0xc0016900, + 0x00000102, + 0x00000000, + 0xc0016900, + 0x000002a8, + 0x00000000, + 0xc0016900, + 0x000002a9, + 0x00000000, + 0xc0016900, + 0x00000103, + 0x00000000, + 0xc0016900, + 0x00000284, + 0x00000000, + 0xc0016900, + 0x00000290, + 0x00000000, + 0xc0016900, + 0x00000285, + 0x00000000, + 0xc0016900, + 0x00000286, + 0x00000000, + 0xc0016900, + 0x00000287, + 0x00000000, + 0xc0016900, + 0x00000288, + 0x00000000, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From rnoland at FreeBSD.org Sun Aug 23 15:02:58 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Sun Aug 23 15:03:05 2009 Subject: svn commit: r196471 - head/sys/dev/drm Message-ID: <200908231502.n7NF2w1C064327@svn.freebsd.org> Author: rnoland Date: Sun Aug 23 15:02:58 2009 New Revision: 196471 URL: http://svn.freebsd.org/changeset/base/196471 Log: Add GET_PARAM support for Z pipes. This is needed for occulsion queries on rv530 chips. MFC after: 2 weeks Modified: head/sys/dev/drm/radeon_cp.c head/sys/dev/drm/radeon_drm.h head/sys/dev/drm/radeon_drv.h head/sys/dev/drm/radeon_state.c Modified: head/sys/dev/drm/radeon_cp.c ============================================================================== --- head/sys/dev/drm/radeon_cp.c Sun Aug 23 14:55:57 2009 (r196470) +++ head/sys/dev/drm/radeon_cp.c Sun Aug 23 15:02:58 2009 (r196471) @@ -408,6 +408,15 @@ static void radeon_init_pipes(drm_radeon { uint32_t gb_tile_config, gb_pipe_sel = 0; + if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV530) { + uint32_t z_pipe_sel = RADEON_READ(RV530_GB_PIPE_SELECT2); + if ((z_pipe_sel & 3) == 3) + dev_priv->num_z_pipes = 2; + else + dev_priv->num_z_pipes = 1; + } else + dev_priv->num_z_pipes = 1; + /* RS4xx/RS6xx/R4xx/R5xx */ if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R420) { gb_pipe_sel = RADEON_READ(R400_GB_PIPE_SELECT); Modified: head/sys/dev/drm/radeon_drm.h ============================================================================== --- head/sys/dev/drm/radeon_drm.h Sun Aug 23 14:55:57 2009 (r196470) +++ head/sys/dev/drm/radeon_drm.h Sun Aug 23 15:02:58 2009 (r196471) @@ -688,6 +688,8 @@ typedef struct drm_radeon_indirect { #define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */ #define RADEON_PARAM_FB_LOCATION 14 /* FB location */ #define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */ +#define RADEON_PARAM_DEVICE_ID 16 +#define RADEON_PARAM_NUM_Z_PIPES 17 /* num Z pipes */ typedef struct drm_radeon_getparam { int param; Modified: head/sys/dev/drm/radeon_drv.h ============================================================================== --- head/sys/dev/drm/radeon_drv.h Sun Aug 23 14:55:57 2009 (r196470) +++ head/sys/dev/drm/radeon_drv.h Sun Aug 23 15:02:58 2009 (r196471) @@ -102,9 +102,11 @@ __FBSDID("$FreeBSD$"); * 1.27- Add support for IGP GART * 1.28- Add support for VBL on CRTC2 * 1.29- R500 3D cmd buffer support + * 1.30- Add support for occlusion queries + * 1.31- Add support for num Z pipes from GET_PARAM */ #define DRIVER_MAJOR 1 -#define DRIVER_MINOR 29 +#define DRIVER_MINOR 31 #define DRIVER_PATCHLEVEL 0 /* @@ -368,6 +370,7 @@ typedef struct drm_radeon_private { unsigned long fb_aper_offset; int num_gb_pipes; + int num_z_pipes; int track_flush; drm_local_map_t *mmio; @@ -758,6 +761,7 @@ extern int r600_cs_init(struct drm_devic /* pipe config regs */ #define R400_GB_PIPE_SELECT 0x402c +#define RV530_GB_PIPE_SELECT2 0x4124 #define R500_DYN_SCLK_PWMEM_PIPE 0x000d /* PLL */ #define R300_GB_TILE_CONFIG 0x4018 # define R300_ENABLE_TILING (1 << 0) Modified: head/sys/dev/drm/radeon_state.c ============================================================================== --- head/sys/dev/drm/radeon_state.c Sun Aug 23 14:55:57 2009 (r196470) +++ head/sys/dev/drm/radeon_state.c Sun Aug 23 15:02:58 2009 (r196471) @@ -3078,6 +3078,9 @@ static int radeon_cp_getparam(struct drm case RADEON_PARAM_NUM_GB_PIPES: value = dev_priv->num_gb_pipes; break; + case RADEON_PARAM_NUM_Z_PIPES: + value = dev_priv->num_z_pipes; + break; default: DRM_DEBUG("Invalid parameter %d\n", param->param); return -EINVAL; From christoph.mallon at gmx.de Sun Aug 23 15:10:53 2009 From: christoph.mallon at gmx.de (Christoph Mallon) Date: Sun Aug 23 15:11:04 2009 Subject: svn commit: r196451 - head/sys/netinet/ipfw In-Reply-To: <20090823230300.Q38728@delplex.bde.org> References: <200908230759.n7N7xS6g051165@svn.freebsd.org> <20090823080940.GT1292@hoeg.nl> <20090823230300.Q38728@delplex.bde.org> Message-ID: <4A9155BA.9020808@gmx.de> Bruce Evans schrieb: > % */ > % int > % ipfw_init(void) > % { > % int error = 0; > > This variable is not really used. > > Initialization in declaration. This mainly obfuscates the non-use of the > variable. Rather the opposite is true: void f(void) { int error = 0; // GCC warns that error is unused } void g(void) { int error; error = 0; // GCC is silent } In this case it does not help, because error is used. But an assignment halfway down the function definitely would not improve the situation. Christoph From brde at optusnet.com.au Sun Aug 23 15:54:54 2009 From: brde at optusnet.com.au (Bruce Evans) Date: Sun Aug 23 15:55:00 2009 Subject: svn commit: r196451 - head/sys/netinet/ipfw In-Reply-To: <4A9155BA.9020808@gmx.de> References: <200908230759.n7N7xS6g051165@svn.freebsd.org> <20090823080940.GT1292@hoeg.nl> <20090823230300.Q38728@delplex.bde.org> <4A9155BA.9020808@gmx.de> Message-ID: <20090824013656.M38813@delplex.bde.org> On Sun, 23 Aug 2009, Christoph Mallon wrote: > Bruce Evans schrieb: >> % */ >> % int >> % ipfw_init(void) >> % { >> % int error = 0; >> >> This variable is not really used. >> >> Initialization in declaration. This mainly obfuscates the non-use of the >> variable. > > Rather the opposite is true: > > void f(void) > { > int error = 0; // GCC warns that error is unused > } > > void g(void) > { > int error; > error = 0; // GCC is silent > } Interesting. A bug in gcc. Even the primitive lint(1) in FreeBSD warns about both (it says "set but not used"; if the variable is not even set, then it says "unused"). > In this case it does not help, because error is used. But an assignment > halfway down the function definitely would not improve the situation. The assignment should be just before the first use of the variable (if the first use is conditional, this may be impossible, but then an initialization at the start of the function would increase the obfuscation). In this case, the first use is in the return statement and it would then be obvious to everyone except the compiler that both the variable and its initialization are bogus: error = 0; return (error); A non-KNF style would put the declaration next to the use. Then the bogusness would be even more obvious: #if __STDC_VERSION__ < 199901 { #endif int error; error = 0; return (error); #if __STDC_VERSION__ < 199901 } #endif Bruce From sam at FreeBSD.org Sun Aug 23 16:04:10 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Sun Aug 23 16:04:17 2009 Subject: svn commit: r196472 - head/usr.sbin/wpa/wpa_cli Message-ID: <200908231604.n7NG4ABo065583@svn.freebsd.org> Author: sam Date: Sun Aug 23 16:04:10 2009 New Revision: 196472 URL: http://svn.freebsd.org/changeset/base/196472 Log: Enable _DIRENT_HAVE_D_TYPE so wpa_cli scans directories properly for it's unix domain socket. Before this change wpa_cli would take the first file in the directory that was not "." or "..". Submitted by: Brandon Gooch MFC after: 3 days Modified: head/usr.sbin/wpa/wpa_cli/Makefile Modified: head/usr.sbin/wpa/wpa_cli/Makefile ============================================================================== --- head/usr.sbin/wpa/wpa_cli/Makefile Sun Aug 23 15:02:58 2009 (r196471) +++ head/usr.sbin/wpa/wpa_cli/Makefile Sun Aug 23 16:04:10 2009 (r196472) @@ -11,6 +11,8 @@ MAN= wpa_cli.8 CFLAGS+= -DCONFIG_CTRL_IFACE CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX +# enable use of d_type to identify unix domain sockets +CFLAGS+= -D_DIRENT_HAVE_D_TYPE #CFLAGS+= -DCONFIG_READLINE #LDADD+= -ledit -ltermcap From simon at FreeBSD.org Sun Aug 23 16:29:48 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Sun Aug 23 16:29:54 2009 Subject: svn commit: r196474 - in head/crypto/openssl: . crypto/pqueue ssl Message-ID: <200908231629.n7NGTmZX066168@svn.freebsd.org> Author: simon Date: Sun Aug 23 16:29:47 2009 New Revision: 196474 URL: http://svn.freebsd.org/changeset/base/196474 Log: Merge DTLS fixes from vendor-crypto/openssl/dist: - Fix memory consumption bug with "future epoch" DTLS records. - Fix fragment handling memory leak. - Do not access freed data structure. - Fix DTLS fragment bug - out-of-sequence message handling which could result in NULL pointer dereference in dtls1_process_out_of_seq_message(). Note that this will not get FreeBSD Security Advisory as DTLS is experimental in OpenSSL. MFC after: 1 week Security: CVE-2009-1377 CVE-2009-1378 CVE-2009-1379 CVE-2009-1387 Modified: head/crypto/openssl/ (props changed) head/crypto/openssl/crypto/pqueue/pqueue.c head/crypto/openssl/crypto/pqueue/pqueue.h head/crypto/openssl/ssl/d1_both.c head/crypto/openssl/ssl/d1_pkt.c Modified: head/crypto/openssl/crypto/pqueue/pqueue.c ============================================================================== --- head/crypto/openssl/crypto/pqueue/pqueue.c Sun Aug 23 16:21:49 2009 (r196473) +++ head/crypto/openssl/crypto/pqueue/pqueue.c Sun Aug 23 16:29:47 2009 (r196474) @@ -234,3 +234,17 @@ pqueue_next(pitem **item) return ret; } + +int +pqueue_size(pqueue_s *pq) +{ + pitem *item = pq->items; + int count = 0; + + while(item != NULL) + { + count++; + item = item->next; + } + return count; +} Modified: head/crypto/openssl/crypto/pqueue/pqueue.h ============================================================================== --- head/crypto/openssl/crypto/pqueue/pqueue.h Sun Aug 23 16:21:49 2009 (r196473) +++ head/crypto/openssl/crypto/pqueue/pqueue.h Sun Aug 23 16:29:47 2009 (r196474) @@ -91,5 +91,6 @@ pitem *pqueue_iterator(pqueue pq); pitem *pqueue_next(piterator *iter); void pqueue_print(pqueue pq); +int pqueue_size(pqueue pq); #endif /* ! HEADER_PQUEUE_H */ Modified: head/crypto/openssl/ssl/d1_both.c ============================================================================== --- head/crypto/openssl/ssl/d1_both.c Sun Aug 23 16:21:49 2009 (r196473) +++ head/crypto/openssl/ssl/d1_both.c Sun Aug 23 16:29:47 2009 (r196474) @@ -519,6 +519,7 @@ dtls1_retrieve_buffered_fragment(SSL *s, if ( s->d1->handshake_read_seq == frag->msg_header.seq) { + unsigned long frag_len = frag->msg_header.frag_len; pqueue_pop(s->d1->buffered_messages); al=dtls1_preprocess_fragment(s,&frag->msg_header,max); @@ -536,7 +537,7 @@ dtls1_retrieve_buffered_fragment(SSL *s, if (al==0) { *ok = 1; - return frag->msg_header.frag_len; + return frag_len; } ssl3_send_alert(s,SSL3_AL_FATAL,al); @@ -561,7 +562,16 @@ dtls1_process_out_of_seq_message(SSL *s, if ((msg_hdr->frag_off+frag_len) > msg_hdr->msg_len) goto err; - if (msg_hdr->seq <= s->d1->handshake_read_seq) + /* Try to find item in queue, to prevent duplicate entries */ + pq_64bit_init(&seq64); + pq_64bit_assign_word(&seq64, msg_hdr->seq); + item = pqueue_find(s->d1->buffered_messages, seq64); + pq_64bit_free(&seq64); + + /* Discard the message if sequence number was already there, is + * too far in the future or the fragment is already in the queue */ + if (msg_hdr->seq <= s->d1->handshake_read_seq || + msg_hdr->seq > s->d1->handshake_read_seq + 10 || item != NULL) { unsigned char devnull [256]; @@ -575,30 +585,31 @@ dtls1_process_out_of_seq_message(SSL *s, } } - frag = dtls1_hm_fragment_new(frag_len); - if ( frag == NULL) - goto err; + if (frag_len) + { + frag = dtls1_hm_fragment_new(frag_len); + if ( frag == NULL) + goto err; - memcpy(&(frag->msg_header), msg_hdr, sizeof(*msg_hdr)); + memcpy(&(frag->msg_header), msg_hdr, sizeof(*msg_hdr)); - if (frag_len) - { - /* read the body of the fragment (header has already been read */ + /* read the body of the fragment (header has already been read) */ i = s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE, frag->fragment,frag_len,0); if (i<=0 || (unsigned long)i!=frag_len) goto err; - } - pq_64bit_init(&seq64); - pq_64bit_assign_word(&seq64, msg_hdr->seq); + pq_64bit_init(&seq64); + pq_64bit_assign_word(&seq64, msg_hdr->seq); - item = pitem_new(seq64, frag); - pq_64bit_free(&seq64); - if ( item == NULL) - goto err; + item = pitem_new(seq64, frag); + pq_64bit_free(&seq64); + if ( item == NULL) + goto err; + + pqueue_insert(s->d1->buffered_messages, item); + } - pqueue_insert(s->d1->buffered_messages, item); return DTLS1_HM_FRAGMENT_RETRY; err: Modified: head/crypto/openssl/ssl/d1_pkt.c ============================================================================== --- head/crypto/openssl/ssl/d1_pkt.c Sun Aug 23 16:21:49 2009 (r196473) +++ head/crypto/openssl/ssl/d1_pkt.c Sun Aug 23 16:29:47 2009 (r196474) @@ -167,6 +167,10 @@ dtls1_buffer_record(SSL *s, record_pqueu DTLS1_RECORD_DATA *rdata; pitem *item; + /* Limit the size of the queue to prevent DOS attacks */ + if (pqueue_size(queue->q) >= 100) + return 0; + rdata = OPENSSL_malloc(sizeof(DTLS1_RECORD_DATA)); item = pitem_new(priority, rdata); if (rdata == NULL || item == NULL) From ume at FreeBSD.org Sun Aug 23 17:00:16 2009 From: ume at FreeBSD.org (Hajimu UMEMOTO) Date: Sun Aug 23 17:00:23 2009 Subject: svn commit: r196475 - in head: contrib/traceroute usr.sbin/traceroute6 Message-ID: <200908231700.n7NH0GmC066870@svn.freebsd.org> Author: ume Date: Sun Aug 23 17:00:16 2009 New Revision: 196475 URL: http://svn.freebsd.org/changeset/base/196475 Log: - Add AS lookup functionality to traceroute6(8) as well. - Support for IPv6 transport for AS lookup. - Introduce $RA_SERVER to set whois server. - Support for 4 byte ASN. - ANSIfy function declaration in as.c. Tested by: IHANet folks. Modified: head/contrib/traceroute/as.c head/contrib/traceroute/as.h head/contrib/traceroute/traceroute.c head/usr.sbin/traceroute6/Makefile head/usr.sbin/traceroute6/traceroute6.8 head/usr.sbin/traceroute6/traceroute6.c Modified: head/contrib/traceroute/as.c ============================================================================== --- head/contrib/traceroute/as.c Sun Aug 23 16:29:47 2009 (r196474) +++ head/contrib/traceroute/as.c Sun Aug 23 17:00:16 2009 (r196475) @@ -63,55 +63,42 @@ struct aslookup { }; void * -as_setup(server) - char *server; +as_setup(char *server) { struct aslookup *asn; - struct hostent *he = NULL; - struct servent *se; - struct sockaddr_in in; + struct addrinfo hints, *res0, *res; FILE *f; - int s; + int s, error; if (server == NULL) + server = getenv("RA_SERVER"); + if (server == NULL) server = DEFAULT_AS_SERVER; - (void)memset(&in, 0, sizeof(in)); - in.sin_family = AF_INET; - in.sin_len = sizeof(in); - if ((se = getservbyname("whois", "tcp")) == NULL) { + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + error = getaddrinfo(server, "whois", &hints, &res0); + if (error == EAI_SERVICE) { warnx("warning: whois/tcp service not found"); - in.sin_port = ntohs(43); - } else - in.sin_port = se->s_port; - - if (inet_aton(server, &in.sin_addr) == 0 && - ((he = gethostbyname(server)) == NULL || - he->h_addr == NULL)) { - warnx("%s: %s", server, hstrerror(h_errno)); - return (NULL); + error = getaddrinfo(server, "43", &hints, &res0); } - - if ((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) { - warn("socket"); + if (error != 0) { + warnx("%s: %s", server, gai_strerror(error)); return (NULL); } - do { - if (he != NULL) { - memcpy(&in.sin_addr, he->h_addr, he->h_length); - he->h_addr_list++; - } - if (connect(s, (struct sockaddr *)&in, sizeof(in)) == 0) + for (res = res0; res; res = res->ai_next) { + s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + if (s < 0) + continue; + if (connect(s, res->ai_addr, res->ai_addrlen) >= 0) break; - if (he == NULL || he->h_addr == NULL) { - close(s); - s = -1; - break; - } - } while (1); - - if (s == -1) { + close(s); + s = -1; + } + freeaddrinfo(res0); + if (s < 0) { warn("connect"); return (NULL); } @@ -137,23 +124,23 @@ as_setup(server) return (asn); } -int -as_lookup(_asn, addr) - void *_asn; - struct in_addr *addr; +unsigned int +as_lookup(void *_asn, char *addr, sa_family_t family) { struct aslookup *asn = _asn; char buf[1024]; - int as, rc, dlen; + unsigned int as; + int rc, dlen, plen; - as = rc = dlen = 0; - (void)fprintf(asn->as_f, "!r%s/32,l\n", inet_ntoa(*addr)); + as = 0; + rc = dlen = 0; + plen = (family == AF_INET6) ? 128 : 32; + (void)fprintf(asn->as_f, "!r%s/%d,l\n", addr, plen); (void)fflush(asn->as_f); #ifdef AS_DEBUG_FILE if (asn->as_debug) { - (void)fprintf(asn->as_debug, ">> !r%s/32,l\n", - inet_ntoa(*addr)); + (void)fprintf(asn->as_debug, ">> !r%s/%d,l\n", addr, plen); (void)fflush(asn->as_debug); } #endif /* AS_DEBUG_FILE */ @@ -182,7 +169,7 @@ as_lookup(_asn, addr) } #endif /* AS_DEBUG_FILE */ break; - case 'C': + case 'C': case 'D': case 'E': case 'F': @@ -209,7 +196,7 @@ as_lookup(_asn, addr) /* origin line is the interesting bit */ if (as == 0 && strncasecmp(buf, "origin:", 7) == 0) { - sscanf(buf + 7, " AS%d", &as); + sscanf(buf + 7, " AS%u", &as); #ifdef AS_DEBUG_FILE if (asn->as_debug) { (void)fprintf(asn->as_debug, "as: %d\n", as); @@ -223,8 +210,7 @@ as_lookup(_asn, addr) } void -as_shutdown(_asn) - void *_asn; +as_shutdown(void *_asn) { struct aslookup *asn = _asn; Modified: head/contrib/traceroute/as.h ============================================================================== --- head/contrib/traceroute/as.h Sun Aug 23 16:29:47 2009 (r196474) +++ head/contrib/traceroute/as.h Sun Aug 23 17:00:16 2009 (r196475) @@ -37,6 +37,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -void *as_setup __P((char *)); -int as_lookup __P((void *, struct in_addr *)); -void as_shutdown __P((void *)); +void *as_setup(char *); +unsigned int as_lookup(void *, char *, sa_family_t); +void as_shutdown(void *); Modified: head/contrib/traceroute/traceroute.c ============================================================================== --- head/contrib/traceroute/traceroute.c Sun Aug 23 16:29:47 2009 (r196474) +++ head/contrib/traceroute/traceroute.c Sun Aug 23 17:00:16 2009 (r196475) @@ -1477,19 +1477,21 @@ print(register u_char *buf, register int { register struct ip *ip; register int hlen; + char addr[INET_ADDRSTRLEN]; ip = (struct ip *) buf; hlen = ip->ip_hl << 2; cc -= hlen; + strlcpy(addr, inet_ntoa(from->sin_addr), sizeof(addr)); + if (as_path) - Printf(" [AS%d]", as_lookup(asn, &from->sin_addr)); + Printf(" [AS%u]", as_lookup(asn, addr, AF_INET)); if (nflag) - Printf(" %s", inet_ntoa(from->sin_addr)); + Printf(" %s", addr); else - Printf(" %s (%s)", inetname(from->sin_addr), - inet_ntoa(from->sin_addr)); + Printf(" %s (%s)", inetname(from->sin_addr), addr); if (verbose) Printf(" %d bytes to %s", cc, inet_ntoa (ip->ip_dst)); Modified: head/usr.sbin/traceroute6/Makefile ============================================================================== --- head/usr.sbin/traceroute6/Makefile Sun Aug 23 16:29:47 2009 (r196474) +++ head/usr.sbin/traceroute6/Makefile Sun Aug 23 17:00:16 2009 (r196475) @@ -13,12 +13,17 @@ # A PARTICULAR PURPOSE. # $FreeBSD$ +TRACEROUTE_DISTDIR?= ${.CURDIR}/../../contrib/traceroute +.PATH: ${TRACEROUTE_DISTDIR} + PROG= traceroute6 MAN= traceroute6.8 +SRCS= as.c traceroute6.c BINOWN= root BINMODE= 4555 CFLAGS+= -DIPSEC -DUSE_RFC2292BIS -DHAVE_POLL +CFLAGS+= -I${.CURDIR} -I${TRACEROUTE_DISTDIR} -I. DPADD= ${LIBIPSEC} LDADD= -lipsec Modified: head/usr.sbin/traceroute6/traceroute6.8 ============================================================================== --- head/usr.sbin/traceroute6/traceroute6.8 Sun Aug 23 16:29:47 2009 (r196474) +++ head/usr.sbin/traceroute6/traceroute6.8 Sun Aug 23 17:00:16 2009 (r196475) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 17, 1998 +.Dd August 24, 2009 .Dt TRACEROUTE6 8 .Os .\" @@ -40,7 +40,7 @@ .Sh SYNOPSIS .Nm .Bk -words -.Op Fl dIlnNrvU +.Op Fl adIlnNrvU .Ek .Bk -words .Op Fl f Ar firsthop @@ -64,6 +64,9 @@ .Op Fl w Ar waittime .Ek .Bk -words +.Op Fl A Ar as_server +.Ek +.Bk -words .Ar target .Op Ar datalen .Ek @@ -84,6 +87,10 @@ after the destination host name. .Pp Other options are: .Bl -tag -width Ds +.It Fl a +Turn on AS# lookups for each hop encountered. +.It Fl A Ar as_server +Turn on AS# lookups and use the given server instead of the default. .It Fl d Debug mode. .It Fl f Ar firsthop Modified: head/usr.sbin/traceroute6/traceroute6.c ============================================================================== --- head/usr.sbin/traceroute6/traceroute6.c Sun Aug 23 16:29:47 2009 (r196474) +++ head/usr.sbin/traceroute6/traceroute6.c Sun Aug 23 17:00:16 2009 (r196475) @@ -282,6 +282,8 @@ static const char rcsid[] = #include #endif +#include "as.h" + #define DUMMY_PORT 10010 #define MAXPACKET 65535 /* max ip packet size */ @@ -359,6 +361,9 @@ int waittime = 5; /* time to wait for r int nflag; /* print addresses numerically */ int useproto = IPPROTO_UDP; /* protocol to use to send packet */ int lflag; /* print both numerical address & hostname */ +int as_path; /* print as numbers for each hop */ +char *as_server = NULL; +void *asn; int main(argc, argv) @@ -411,8 +416,15 @@ main(argc, argv) seq = 0; - while ((ch = getopt(argc, argv, "df:g:Ilm:nNp:q:rs:Uvw:")) != -1) + while ((ch = getopt(argc, argv, "aA:df:g:Ilm:nNp:q:rs:Uvw:")) != -1) switch (ch) { + case 'a': + as_path = 1; + break; + case 'A': + as_path = 1; + as_server = optarg; + break; case 'd': options |= SO_DEBUG; break; @@ -867,6 +879,17 @@ main(argc, argv) srcport = ntohs(Src.sin6_port); } + if (as_path) { + asn = as_setup(as_server); + if (asn == NULL) { + fprintf(stderr, + "traceroute6: as_setup failed, AS# lookups" + " disabled\n"); + (void)fflush(stderr); + as_path = 0; + } + } + /* * Message to users */ @@ -948,6 +971,8 @@ main(argc, argv) exit(0); } } + if (as_path) + as_shutdown(asn); exit(0); } @@ -1361,6 +1386,8 @@ print(mhdr, cc) if (getnameinfo((struct sockaddr *)from, from->sin6_len, hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0) strlcpy(hbuf, "invalid", sizeof(hbuf)); + if (as_path) + printf(" [AS%u]", as_lookup(asn, hbuf, AF_INET6)); if (nflag) printf(" %s", hbuf); else if (lflag) From ivoras at FreeBSD.org Sun Aug 23 18:15:14 2009 From: ivoras at FreeBSD.org (Ivan Voras) Date: Sun Aug 23 18:15:21 2009 Subject: svn commit: r196476 - head/sbin/geom/class/label Message-ID: <200908231815.n7NIFEq5068734@svn.freebsd.org> Author: ivoras Date: Sun Aug 23 18:15:13 2009 New Revision: 196476 URL: http://svn.freebsd.org/changeset/base/196476 Log: Remove (c) line. Requested by: pjd Approved by: gnn (mentor) MFC after: 1 month Modified: head/sbin/geom/class/label/glabel.8 Modified: head/sbin/geom/class/label/glabel.8 ============================================================================== --- head/sbin/geom/class/label/glabel.8 Sun Aug 23 17:00:16 2009 (r196475) +++ head/sbin/geom/class/label/glabel.8 Sun Aug 23 18:15:13 2009 (r196476) @@ -1,5 +1,4 @@ .\" Copyright (c) 2004-2005 Pawel Jakub Dawidek -.\" Copyright (c) 2008-2009 Ivan Voras .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without From pluknet at gmail.com Sun Aug 23 18:18:10 2009 From: pluknet at gmail.com (pluknet) Date: Sun Aug 23 18:18:21 2009 Subject: svn commit: r196432 - in head: . gnu/usr.bin/groff/tmac release sys/conf sys/sys usr.sbin/pkg_install/add In-Reply-To: <200908222344.n7MNibQZ040298@svn.freebsd.org> References: <200908222344.n7MNibQZ040298@svn.freebsd.org> Message-ID: 2009/8/23 Ken Smith : > Author: kensmith > Date: Sat Aug 22 23:44:37 2009 > New Revision: 196432 > URL: http://svn.freebsd.org/changeset/base/196432 > > Log: > ?Make head 9.0-CURRENT in preparation for lifting code freeze. > > ?Approved by: ?re (implicit) > > Modified: > ?head/UPDATING > ?head/gnu/usr.bin/groff/tmac/mdoc.local > ?head/release/Makefile > ?head/sys/conf/newvers.sh > ?head/sys/sys/param.h > ?head/usr.sbin/pkg_install/add/main.c > [...] > Modified: head/usr.sbin/pkg_install/add/main.c > ============================================================================== > --- head/usr.sbin/pkg_install/add/main.c ? ? ? ?Sat Aug 22 09:17:49 2009 ? ? ? ?(r196431) > +++ head/usr.sbin/pkg_install/add/main.c ? ? ? ?Sat Aug 22 23:44:37 2009 ? ? ? ?(r196432) > @@ -82,13 +82,15 @@ struct { > ? ? ? ?{ 700000, 700099, "/packages-7.0-release" }, > ? ? ? ?{ 701000, 701099, "/packages-7.1-release" }, > ? ? ? ?{ 702000, 702099, "/packages-7.2-release" }, > + ? ? ? { 800000, 800499, "/packages-8.0-release" }, > ? ? ? ?{ 300000, 399000, "/packages-3-stable" }, > ? ? ? ?{ 400000, 499000, "/packages-4-stable" }, > ? ? ? ?{ 502100, 502128, "/packages-5-current" }, > ? ? ? ?{ 503100, 599000, "/packages-5-stable" }, > ? ? ? ?{ 600100, 699000, "/packages-6-stable" }, > ? ? ? ?{ 700100, 799000, "/packages-7-stable" }, > - ? ? ? { 800000, 899000, "/packages-8-current" }, > + ? ? ? { 800000, 899000, "/packages-8-stable" }, > + ? ? ? { 900000, 999000, "/packages-9-current" }, The last chunk should probably be: - { 800000, 899000, "/packages-8-current" }, + { 800500, 899000, "/packages-8-stable" }, + { 900000, 999000, "/packages-9-current" }, which also agrees to 196115 change (in stable/8). -- wbr, pluknet From antoine at FreeBSD.org Sun Aug 23 18:28:59 2009 From: antoine at FreeBSD.org (Antoine Brodin) Date: Sun Aug 23 18:29:05 2009 Subject: svn commit: r196477 - head Message-ID: <200908231828.n7NISwmi069035@svn.freebsd.org> Author: antoine Date: Sun Aug 23 18:28:58 2009 New Revision: 196477 URL: http://svn.freebsd.org/changeset/base/196477 Log: ObsoleteFiles.inc: kthread_create(9) was resurrected as a mlink to kproc(9) Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sun Aug 23 18:15:13 2009 (r196476) +++ head/ObsoleteFiles.inc Sun Aug 23 18:28:58 2009 (r196477) @@ -803,8 +803,6 @@ OLD_FILES+=rescue/bsdlabel OLD_FILES+=rescue/fdisk OLD_FILES+=rescue/gpt .endif -# 20071026: kthread(9)/kproc(9) API changes -OLD_FILES+=usr/share/man/man9/kthread_create.9.gz # 20071025: rc.d/nfslocking superceeded by rc.d/lockd and rc.d/statd OLD_FILES+=etc/rc.d/nfslocking # 20070930: rename of cached to nscd From stb at lassitu.de Sun Aug 23 19:37:27 2009 From: stb at lassitu.de (Stefan Bethke) Date: Sun Aug 23 19:37:39 2009 Subject: svn commit: r196200 - in head: etc/mtree include sys/dev/mfi usr.sbin usr.sbin/mfiutil In-Reply-To: <20090823143840.GD61707@felucia.tataz.chchile.org> References: <200908132318.n7DNIjvO015601@svn.freebsd.org> <20090823143840.GD61707@felucia.tataz.chchile.org> Message-ID: <76094077-6E36-45DF-B717-3C7884377A89@lassitu.de> Am 23.08.2009 um 16:38 schrieb Jeremie Le Hen: > Wouldn't it be more reasonable to use a standard > suffix for all dedicated admin utility such as vidcontrol, memcontrol, > kbdcontrol: > > % 59# find /bin /sbin /usr/bin /usr/sbin -name \*control | wc -l > % 25 > % 60# find /bin /sbin /usr/bin /usr/sbin -name \*config | wc -l > % 13 $ find /bin /sbin /usr/bin /usr/sbin -name \*ctl | wc -l 12 $ find /bin /sbin /usr/bin /usr/sbin -name \*cfg | wc -l 1 $ find /bin /sbin /usr/bin /usr/sbin -name \*util | wc -l 3 I'm afraid that train's left long ago. Stefan -- Stefan Bethke Fon +49 151 14070811 From serenity at exscape.org Sun Aug 23 19:43:29 2009 From: serenity at exscape.org (Thomas Backman) Date: Sun Aug 23 19:43:35 2009 Subject: svn commit: r196200 - in head: etc/mtree include sys/dev/mfi usr.sbin usr.sbin/mfiutil In-Reply-To: <76094077-6E36-45DF-B717-3C7884377A89@lassitu.de> References: <200908132318.n7DNIjvO015601@svn.freebsd.org> <20090823143840.GD61707@felucia.tataz.chchile.org> <76094077-6E36-45DF-B717-3C7884377A89@lassitu.de> Message-ID: On Aug 23, 2009, at 21:19, Stefan Bethke wrote: > > Am 23.08.2009 um 16:38 schrieb Jeremie Le Hen: > >> Wouldn't it be more reasonable to use a standard >> suffix for all dedicated admin utility such as vidcontrol, >> memcontrol, >> kbdcontrol: >> >> % 59# find /bin /sbin /usr/bin /usr/sbin -name \*control | wc -l >> % 25 >> % 60# find /bin /sbin /usr/bin /usr/sbin -name \*config | wc -l >> % 13 > > $ find /bin /sbin /usr/bin /usr/sbin -name \*util | wc -l > 3 > > I'm afraid that train's left long ago. Keep in mind that if you're on a recent build, 2/3 of those are mfiutil and mptutil, the two new programs in question here. Regards, Thomas From dougb at FreeBSD.org Sun Aug 23 19:52:47 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Sun Aug 23 19:52:53 2009 Subject: svn commit: r196478 - head/etc Message-ID: <200908231952.n7NJqlFg070672@svn.freebsd.org> Author: dougb Date: Sun Aug 23 19:52:47 2009 New Revision: 196478 URL: http://svn.freebsd.org/changeset/base/196478 Log: Prior to the dire warning about values of network_interfaces other than AUTO the biggest mistake users made was leaving lo0 off the list. Since lo0 is effectively mandatory, check for it and add it to the list if it's not there. Modified: head/etc/network.subr Modified: head/etc/network.subr ============================================================================== --- head/etc/network.subr Sun Aug 23 18:28:58 2009 (r196477) +++ head/etc/network.subr Sun Aug 23 19:52:47 2009 (r196478) @@ -727,6 +727,13 @@ list_net_interfaces() ;; *) _tmplist="${network_interfaces} ${cloned_interfaces}" + + # lo0 is effectively mandatory, so help prevent foot-shooting + # + case "$_tmplist" in + lo0*|*lo0|*' lo0 '*) ;; # This is fine, do nothing + *) _tmplist="lo0 ${_tmplist}" ;; + esac ;; esac From cognet at FreeBSD.org Sun Aug 23 19:54:37 2009 From: cognet at FreeBSD.org (Olivier Houchard) Date: Sun Aug 23 19:54:49 2009 Subject: svn commit: r196479 - head/sys/arm/xscale/ixp425 Message-ID: <200908231954.n7NJsbQU070739@svn.freebsd.org> Author: cognet Date: Sun Aug 23 19:54:36 2009 New Revision: 196479 URL: http://svn.freebsd.org/changeset/base/196479 Log: No need to remove the same flag multiple times. Modified: head/sys/arm/xscale/ixp425/ixdp425_pci.c Modified: head/sys/arm/xscale/ixp425/ixdp425_pci.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixdp425_pci.c Sun Aug 23 19:52:47 2009 (r196478) +++ head/sys/arm/xscale/ixp425/ixdp425_pci.c Sun Aug 23 19:54:36 2009 (r196479) @@ -62,12 +62,12 @@ ixp425_md_attach(device_t dev) /* PCI Reset Assert */ reg = GPIO_CONF_READ_4(sc, IXP425_GPIO_GPOUTR); reg &= ~(1U << GPIO_PCI_RESET); - GPIO_CONF_WRITE_4(sc, IXP425_GPIO_GPOUTR, reg & ~(1U << GPIO_PCI_RESET)); + GPIO_CONF_WRITE_4(sc, IXP425_GPIO_GPOUTR, reg); /* PCI Clock Disable */ reg = GPIO_CONF_READ_4(sc, IXP425_GPIO_GPCLKR); reg &= ~GPCLKR_MUX14; - GPIO_CONF_WRITE_4(sc, IXP425_GPIO_GPCLKR, reg & ~GPCLKR_MUX14); + GPIO_CONF_WRITE_4(sc, IXP425_GPIO_GPCLKR, reg); /* * set GPIO Direction From ed at FreeBSD.org Sun Aug 23 20:26:10 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Sun Aug 23 20:26:22 2009 Subject: svn commit: r196480 - in head/sys: conf dev/pty kern modules/pty Message-ID: <200908232026.n7NKQAxX071421@svn.freebsd.org> Author: ed Date: Sun Aug 23 20:26:09 2009 New Revision: 196480 URL: http://svn.freebsd.org/changeset/base/196480 Log: Allow pty(4) to be loaded as a kld. Unfortunately, the wrappers that are present in pts(4) don't have the mechanics to allow pty(4) to be unloaded safely, so I'm forcing this kld to return EBUSY. This also means we have to enable some extra code in pts(4) unconditionally. Proposed by: rwatson Added: head/sys/dev/pty/ head/sys/dev/pty/pty.c - copied, changed from r196449, head/sys/kern/tty_pty.c head/sys/modules/pty/ head/sys/modules/pty/Makefile (contents, props changed) Deleted: head/sys/kern/tty_pty.c Modified: head/sys/conf/files head/sys/conf/options head/sys/kern/tty_pts.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Aug 23 19:54:36 2009 (r196479) +++ head/sys/conf/files Sun Aug 23 20:26:09 2009 (r196480) @@ -1297,6 +1297,7 @@ dev/ppc/ppc_puc.c optional ppc puc dev/pst/pst-iop.c optional pst dev/pst/pst-pci.c optional pst pci dev/pst/pst-raid.c optional pst +dev/pty/pty.c optional pty dev/puc/puc.c optional puc dev/puc/puc_cfg.c optional puc dev/puc/puc_pccard.c optional puc pccard @@ -2059,7 +2060,6 @@ kern/tty_info.c standard kern/tty_inq.c standard kern/tty_outq.c standard kern/tty_pts.c standard -kern/tty_pty.c optional pty kern/tty_tty.c standard kern/tty_ttydisc.c standard kern/uipc_accf.c optional inet Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Sun Aug 23 19:54:36 2009 (r196479) +++ head/sys/conf/options Sun Aug 23 20:26:09 2009 (r196480) @@ -672,7 +672,6 @@ ISAPNP opt_isa.h DEV_BPF opt_bpf.h DEV_MCA opt_mca.h DEV_CARP opt_carp.h -DEV_PTY opt_tty.h DEV_SPLASH opt_splash.h # EISA support Copied and modified: head/sys/dev/pty/pty.c (from r196449, head/sys/kern/tty_pty.c) ============================================================================== --- head/sys/kern/tty_pty.c Sun Aug 23 07:32:30 2009 (r196449, copy source) +++ head/sys/dev/pty/pty.c Sun Aug 23 20:26:09 2009 (r196480) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -117,11 +118,24 @@ pty_clone(void *arg, struct ucred *cr, c NULL, UID_ROOT, GID_WHEEL, 0666, "%s", name); } -static void -pty_init(void *unused) +static int +pty_modevent(module_t mod, int type, void *data) { - EVENTHANDLER_REGISTER(dev_clone, pty_clone, 0, 1000); + switch(type) { + case MOD_LOAD: + EVENTHANDLER_REGISTER(dev_clone, pty_clone, 0, 1000); + break; + case MOD_SHUTDOWN: + break; + case MOD_UNLOAD: + /* XXX: No unloading support yet. */ + return (EBUSY); + default: + return (EOPNOTSUPP); + } + + return (0); } -SYSINIT(pty, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, pty_init, NULL); +DEV_MODULE(pty, pty_modevent, NULL); Modified: head/sys/kern/tty_pts.c ============================================================================== --- head/sys/kern/tty_pts.c Sun Aug 23 19:54:36 2009 (r196479) +++ head/sys/kern/tty_pts.c Sun Aug 23 20:26:09 2009 (r196480) @@ -30,14 +30,10 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_tty.h" - /* Add compatibility bits for FreeBSD. */ #define PTS_COMPAT -#ifdef DEV_PTY /* Add /dev/ptyXX compat bits. */ #define PTS_EXTERNAL -#endif /* DEV_PTY */ /* Add bits to make Linux binaries work. */ #define PTS_LINUX Added: head/sys/modules/pty/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/pty/Makefile Sun Aug 23 20:26:09 2009 (r196480) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../dev/pty + +KMOD= pty +SRCS= pty.c + +.include From rwatson at FreeBSD.org Sun Aug 23 20:40:20 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Aug 23 20:40:26 2009 Subject: svn commit: r196481 - in head/sys: compat/linux contrib/altq/altq kern net netgraph netinet netinet6 netipsec nfsclient Message-ID: <200908232040.n7NKeJB9071791@svn.freebsd.org> Author: rwatson Date: Sun Aug 23 20:40:19 2009 New Revision: 196481 URL: http://svn.freebsd.org/changeset/base/196481 Log: Rework global locks for interface list and index management, correcting several critical bugs, including race conditions and lock order issues: Replace the single rwlock, ifnet_lock, with two locks, an rwlock and an sxlock. Either can be held to stablize the lists and indexes, but both are required to write. This allows the list to be held stable in both network interrupt contexts and sleepable user threads across sleeping memory allocations or device driver interactions. As before, writes to the interface list must occur from sleepable contexts. Reviewed by: bz, julian MFC after: 3 days Modified: head/sys/compat/linux/linux_ioctl.c head/sys/contrib/altq/altq/altq_subr.c head/sys/kern/kern_uuid.c head/sys/net/bridgestp.c head/sys/net/if.c head/sys/net/if_llatbl.c head/sys/net/if_var.h head/sys/net/if_vlan.c head/sys/netgraph/ng_gif.c head/sys/netinet/in.c head/sys/netinet6/icmp6.c head/sys/netinet6/in6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/nd6.c head/sys/netipsec/xform_ipip.c head/sys/nfsclient/bootp_subr.c Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/compat/linux/linux_ioctl.c Sun Aug 23 20:40:19 2009 (r196481) @@ -2061,22 +2061,20 @@ linux_ifname(struct ifnet *ifp, char *bu struct ifnet *ifscan; int ethno; + IFNET_RLOCK_ASSERT(); + /* Short-circuit non ethernet interfaces */ if (!IFP_IS_ETH(ifp)) return (strlcpy(buffer, ifp->if_xname, buflen)); /* Determine the (relative) unit number for ethernet interfaces */ ethno = 0; - IFNET_RLOCK(); TAILQ_FOREACH(ifscan, &V_ifnet, if_link) { - if (ifscan == ifp) { - IFNET_RUNLOCK(); + if (ifscan == ifp) return (snprintf(buffer, buflen, "eth%d", ethno)); - } if (IFP_IS_ETH(ifscan)) ethno++; } - IFNET_RUNLOCK(); return (0); } @@ -2177,7 +2175,7 @@ again: valid_len = 0; /* Return all AF_INET addresses of all interfaces */ - IFNET_RLOCK(); /* could sleep XXX */ + IFNET_RLOCK(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { int addrs = 0; Modified: head/sys/contrib/altq/altq/altq_subr.c ============================================================================== --- head/sys/contrib/altq/altq/altq_subr.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/contrib/altq/altq/altq_subr.c Sun Aug 23 20:40:19 2009 (r196481) @@ -462,8 +462,8 @@ tbr_timeout(arg) s = splimp(); #endif #if defined(__FreeBSD__) && (__FreeBSD_version >= 500000) - IFNET_RLOCK(); - VNET_LIST_RLOCK(); + IFNET_RLOCK_NOSLEEP(); + VNET_LIST_RLOCK_NOSLEEP(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); #endif @@ -480,8 +480,8 @@ tbr_timeout(arg) #if defined(__FreeBSD__) && (__FreeBSD_version >= 500000) CURVNET_RESTORE(); } - VNET_LIST_RUNLOCK(); - IFNET_RUNLOCK(); + VNET_LIST_RUNLOCK_NOSLEEP(); + IFNET_RUNLOCK_NOSLEEP(); #endif splx(s); if (active > 0) Modified: head/sys/kern/kern_uuid.c ============================================================================== --- head/sys/kern/kern_uuid.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/kern/kern_uuid.c Sun Aug 23 20:40:19 2009 (r196481) @@ -95,7 +95,7 @@ uuid_node(uint16_t *node) int i; CURVNET_SET(TD_TO_VNET(curthread)); - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { /* Walk the address list */ IF_ADDR_LOCK(ifp); @@ -106,14 +106,14 @@ uuid_node(uint16_t *node) /* Got a MAC address. */ bcopy(LLADDR(sdl), node, UUID_NODE_LEN); IF_ADDR_UNLOCK(ifp); - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); CURVNET_RESTORE(); return; } } IF_ADDR_UNLOCK(ifp); } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); for (i = 0; i < (UUID_NODE_LEN>>1); i++) node[i] = (uint16_t)arc4random(); Modified: head/sys/net/bridgestp.c ============================================================================== --- head/sys/net/bridgestp.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/net/bridgestp.c Sun Aug 23 20:40:19 2009 (r196481) @@ -2019,7 +2019,7 @@ bstp_reinit(struct bstp_state *bs) * not need to be part of the bridge, it just needs to be a unique * value. */ - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (ifp->if_type != IFT_ETHER) continue; @@ -2036,7 +2036,7 @@ bstp_reinit(struct bstp_state *bs) continue; } } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); if (LIST_EMPTY(&bs->bs_bplist) || mif == NULL) { /* Set the bridge and root id (lower bits) to zero */ Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/net/if.c Sun Aug 23 20:40:19 2009 (r196481) @@ -154,14 +154,26 @@ VNET_DEFINE(struct ifgrouphead, ifg_head VNET_DEFINE(int, if_index); static VNET_DEFINE(int, if_indexlim) = 8; -/* Table of ifnet by index. Locked with ifnet_lock. */ +/* Table of ifnet by index. */ static VNET_DEFINE(struct ifindex_entry *, ifindex_table); #define V_if_indexlim VNET(if_indexlim) #define V_ifindex_table VNET(ifindex_table) int ifqmaxlen = IFQ_MAXLEN; -struct rwlock ifnet_lock; + +/* + * The global network interface list (V_ifnet) and related state (such as + * if_index, if_indexlim, and ifindex_table) are protected by an sxlock and + * an rwlock. Either may be acquired shared to stablize the list, but both + * must be acquired writable to modify the list. This model allows us to + * both stablize the interface list during interrupt thread processing, but + * also to stablize it over long-running ioctls, without introducing priority + * inversions and deadlocks. + */ +struct rwlock ifnet_rwlock; +struct sx ifnet_sxlock; + static if_com_alloc_t *if_com_alloc[256]; static if_com_free_t *if_com_free[256]; @@ -188,9 +200,9 @@ ifnet_byindex(u_short idx) { struct ifnet *ifp; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); ifp = ifnet_byindex_locked(idx); - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (ifp); } @@ -199,19 +211,19 @@ ifnet_byindex_ref(u_short idx) { struct ifnet *ifp; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); ifp = ifnet_byindex_locked(idx); if (ifp == NULL || (ifp->if_flags & IFF_DYING)) { - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (NULL); } if_ref(ifp); - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (ifp); } static void -ifnet_setbyindex(u_short idx, struct ifnet *ifp) +ifnet_setbyindex_locked(u_short idx, struct ifnet *ifp) { IFNET_WLOCK_ASSERT(); @@ -219,16 +231,25 @@ ifnet_setbyindex(u_short idx, struct ifn V_ifindex_table[idx].ife_ifnet = ifp; } +static void +ifnet_setbyindex(u_short idx, struct ifnet *ifp) +{ + + IFNET_WLOCK(); + ifnet_setbyindex_locked(idx, ifp); + IFNET_WUNLOCK(); +} + struct ifaddr * ifaddr_byindex(u_short idx) { struct ifaddr *ifa; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); ifa = ifnet_byindex_locked(idx)->if_addr; if (ifa != NULL) ifa_ref(ifa); - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (ifa); } @@ -361,9 +382,7 @@ if_alloc(u_char type) ifq_init(&ifp->if_snd, ifp); refcount_init(&ifp->if_refcount, 1); /* Index reference. */ - IFNET_WLOCK(); ifnet_setbyindex(ifp->if_index, ifp); - IFNET_WUNLOCK(); return (ifp); } @@ -383,7 +402,7 @@ if_free_internal(struct ifnet *ifp) KASSERT(ifp == ifnet_byindex_locked(ifp->if_index), ("%s: freeing unallocated ifnet", ifp->if_xname)); - ifnet_setbyindex(ifp->if_index, NULL); + ifnet_setbyindex_locked(ifp->if_index, NULL); while (V_if_index > 0 && ifnet_byindex_locked(V_if_index) == NULL) V_if_index--; IFNET_WUNLOCK(); @@ -855,11 +874,14 @@ if_vmove(struct ifnet *ifp, struct vnet if_detach_internal(ifp, 1); /* - * Unlink the ifnet from ifindex_table[] in current vnet, - * and shrink the if_index for that vnet if possible. + * Unlink the ifnet from ifindex_table[] in current vnet, and shrink + * the if_index for that vnet if possible. + * + * NOTE: IFNET_WLOCK/IFNET_WUNLOCK() are assumed to be unvirtualized, + * or we'd lock on one vnet and unlock on another. */ IFNET_WLOCK(); - ifnet_setbyindex(ifp->if_index, NULL); + ifnet_setbyindex_locked(ifp->if_index, NULL); while (V_if_index > 0 && ifnet_byindex_locked(V_if_index) == NULL) V_if_index--; IFNET_WUNLOCK(); @@ -886,7 +908,7 @@ if_vmove(struct ifnet *ifp, struct vnet V_if_index = ifp->if_index; if (V_if_index >= V_if_indexlim) if_grow(); - ifnet_setbyindex(ifp->if_index, ifp); + ifnet_setbyindex_locked(ifp->if_index, ifp); IFNET_WUNLOCK(); if_attach_internal(ifp, 1); @@ -1368,7 +1390,7 @@ ifa_ifwithaddr_internal(struct sockaddr struct ifnet *ifp; struct ifaddr *ifa; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { @@ -1395,7 +1417,7 @@ ifa_ifwithaddr_internal(struct sockaddr } ifa = NULL; done: - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (ifa); } @@ -1423,7 +1445,7 @@ ifa_ifwithbroadaddr(struct sockaddr *add struct ifnet *ifp; struct ifaddr *ifa; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { @@ -1442,7 +1464,7 @@ ifa_ifwithbroadaddr(struct sockaddr *add } ifa = NULL; done: - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (ifa); } @@ -1456,7 +1478,7 @@ ifa_ifwithdstaddr(struct sockaddr *addr) struct ifnet *ifp; struct ifaddr *ifa; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if ((ifp->if_flags & IFF_POINTOPOINT) == 0) continue; @@ -1475,7 +1497,7 @@ ifa_ifwithdstaddr(struct sockaddr *addr) } ifa = NULL; done: - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (ifa); } @@ -1508,7 +1530,7 @@ ifa_ifwithnet(struct sockaddr *addr) * we find one, as we release the IF_ADDR_LOCK() that kept it stable * when we move onto the next interface. */ - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { @@ -1584,7 +1606,7 @@ next: continue; ifa = ifa_maybe; ifa_maybe = NULL; done: - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); if (ifa_maybe != NULL) ifa_free(ifa_maybe); return (ifa); @@ -1863,7 +1885,7 @@ if_slowtimo(void *arg) int s = splimp(); VNET_LIST_RLOCK_NOSLEEP(); - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { @@ -1874,7 +1896,7 @@ if_slowtimo(void *arg) } CURVNET_RESTORE(); } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); VNET_LIST_RUNLOCK_NOSLEEP(); splx(s); timeout(if_slowtimo, (void *)0, hz / IFNET_SLOWHZ); @@ -1889,7 +1911,7 @@ ifunit_ref(const char *name) { struct ifnet *ifp; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (strncmp(name, ifp->if_xname, IFNAMSIZ) == 0 && !(ifp->if_flags & IFF_DYING)) @@ -1897,7 +1919,7 @@ ifunit_ref(const char *name) } if (ifp != NULL) if_ref(ifp); - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (ifp); } @@ -1906,12 +1928,12 @@ ifunit(const char *name) { struct ifnet *ifp; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (strncmp(name, ifp->if_xname, IFNAMSIZ) == 0) break; } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (ifp); } @@ -2521,7 +2543,7 @@ again: max_len = 0; valid_len = 0; - IFNET_RLOCK(); /* could sleep XXX */ + IFNET_RLOCK(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { int addrs; @@ -2846,13 +2868,13 @@ if_delmulti(struct ifnet *ifp, struct so #ifdef INVARIANTS struct ifnet *oifp; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(oifp, &V_ifnet, if_link) if (ifp == oifp) break; if (ifp != oifp) ifp = NULL; - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); KASSERT(ifp != NULL, ("%s: ifnet went away", __func__)); #endif @@ -2895,7 +2917,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifm } else { struct ifnet *oifp; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(oifp, &V_ifnet, if_link) if (ifp == oifp) break; @@ -2903,7 +2925,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifm printf("%s: ifnet %p disappeared\n", __func__, ifp); ifp = NULL; } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); } #endif /* Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/net/if_llatbl.c Sun Aug 23 20:40:19 2009 (r196481) @@ -200,14 +200,14 @@ lltable_prefix_free(int af, struct socka { struct lltable *llt; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); SLIST_FOREACH(llt, &lltables, llt_link) { if (llt->llt_af != af) continue; llt->llt_prefix_free(llt, prefix, mask); } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); } @@ -300,13 +300,13 @@ lla_rt_output(struct rt_msghdr *rtm, str } /* XXX linked list may be too expensive */ - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); SLIST_FOREACH(llt, &lltables, llt_link) { if (llt->llt_af == dst->sa_family && llt->llt_ifp == ifp) break; } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); KASSERT(llt != NULL, ("Yep, ugly hacks are bad\n")); if (flags && LLE_CREATE) Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/net/if_var.h Sun Aug 23 20:40:19 2009 (r196481) @@ -85,6 +85,7 @@ struct vnet; #include /* XXX */ #include /* XXX */ #include /* XXX */ +#include /* XXX */ #include /* XXX */ #include @@ -754,14 +755,39 @@ struct ifmultiaddr { #ifdef _KERNEL -extern struct rwlock ifnet_lock; -#define IFNET_LOCK_INIT() \ - rw_init_flags(&ifnet_lock, "ifnet", RW_RECURSE) -#define IFNET_WLOCK() rw_wlock(&ifnet_lock) -#define IFNET_WUNLOCK() rw_wunlock(&ifnet_lock) -#define IFNET_WLOCK_ASSERT() rw_assert(&ifnet_lock, RA_LOCKED) -#define IFNET_RLOCK() rw_rlock(&ifnet_lock) -#define IFNET_RUNLOCK() rw_runlock(&ifnet_lock) +extern struct rwlock ifnet_rwlock; +extern struct sx ifnet_sxlock; + +#define IFNET_LOCK_INIT() do { \ + rw_init_flags(&ifnet_rwlock, "ifnet_rw", RW_RECURSE); \ + sx_init_flags(&ifnet_sxlock, "ifnet_sx", SX_RECURSE); \ +} while(0) + +#define IFNET_WLOCK() do { \ + sx_xlock(&ifnet_sxlock); \ + rw_wlock(&ifnet_rwlock); \ +} while (0) + +#define IFNET_WUNLOCK() do { \ + rw_wunlock(&ifnet_rwlock); \ + sx_xunlock(&ifnet_sxlock); \ +} while (0) + +/* + * To assert the ifnet lock, you must know not only whether it's for read or + * write, but also whether it was acquired with sleep support or not. + */ +#define IFNET_RLOCK_ASSERT() sx_assert(&ifnet_sxlock, SA_SLOCKED) +#define IFNET_RLOCK_NOSLEEP_ASSERT() rw_assert(&ifnet_rwlock, RA_RLOCKED) +#define IFNET_WLOCK_ASSERT() do { \ + sx_assert(&ifnet_sxlock, SA_XLOCKED); \ + rw_assert(&ifnet_rwlock, RA_WLOCKED); \ +} while (0) + +#define IFNET_RLOCK() sx_slock(&ifnet_sxlock) +#define IFNET_RLOCK_NOSLEEP() rw_rlock(&ifnet_rwlock) +#define IFNET_RU