Re: svn commit: r362947 - head/usr.bin/truss

2020-07-05 Thread Paweł Biernacki
Before: 

__sysctl("sysctl.name2oid",2,0x7f763a80,0x7f763280,0x7f763680,8) = 
0 (0x0)
__sysctl("sysctl.oidfmt.6.2",4,0x7f763ae0,0x7f762e78,0x0,0) = 0 (0x0)
__sysctl("sysctl.name.6.2",4,0x7f762180,0x7f761d00,0x0,0) = 0 (0x0)
__sysctl("sysctl.oidfmt.6.2",4,0x7f762980,0x7f761d08,0x0,0) = 0 (0x0)
__sysctl("sysctl.oiddescr.6.2",4,0x7f762580,0x7f761d00,0x0,0) = 0 (0x0)

After:

__sysctl("sysctl.name2oid 
hw.model",2,0x7f161e60,0x7f161660,0x7f161a60,8) = 0 (0x0)
__sysctl("sysctl.oidfmt hw.model",4,0x7f161ec0,0x7f161258,0x0,0) = 0 
(0x0)
__sysctl("sysctl.name { 6.2 }",4,0x7f160560,0x7f1600e0,0x0,0) = 0 (0x0)
__sysctl("sysctl.oidfmt hw.model",4,0x7f160d60,0x7f1600e8,0x0,0) = 0 
(0x0)
__sysctl("sysctl.oiddescr hw.model",4,0x7f160960,0x7f1600e0,0x0,0) = 0 
(0x0)

Reminded by:mjg


> On 5 Jul 2020, at 21:53, Pawel Biernacki  wrote:
> 
> Author: kaktus
> Date: Sun Jul  5 19:53:54 2020
> New Revision: 362947
> URL: https://svnweb.freebsd.org/changeset/base/362947
> 
> Log:
>  truss: print more information about traced sysctls
> 
>  MFC after:   2 weeks
>  Sponsored by:Mysterious Code Ltd.
> 
> Modified:
>  head/usr.bin/truss/syscalls.c
> 
> Modified: head/usr.bin/truss/syscalls.c
> ==
> --- head/usr.bin/truss/syscalls.c Sun Jul  5 19:38:36 2020
> (r362946)
> +++ head/usr.bin/truss/syscalls.c Sun Jul  5 19:53:54 2020
> (r362947)
> @@ -1577,14 +1577,37 @@ print_cmsgs(FILE *fp, pid_t pid, bool receive, struct 
> }
> 
> static void
> -print_sysctl_oid(FILE *fp, int *oid, int len)
> +print_sysctl_oid(FILE *fp, int *oid, size_t len)
> {
> - int i;
> + size_t i;
> + bool first;
> 
> - for (i = 0; i < len; i++)
> - fprintf(fp, ".%d", oid[i]);
> + first = true;
> + fprintf(fp, "{ ");
> + for (i = 0; i < len; i++) {
> + fprintf(fp, "%s%d", first ? "" : ".", oid[i]);
> + first = false;
> + }
> + fprintf(fp, " }");
> }
> 
> +static void
> +print_sysctl(FILE *fp, int *oid, size_t len)
> +{
> + char name[BUFSIZ];
> + int qoid[CTL_MAXNAME + 2];
> + size_t i;
> +
> + qoid[0] = CTL_SYSCTL;
> + qoid[1] = CTL_SYSCTL_NAME;
> + memcpy(qoid + 2, oid, len * sizeof(int));
> + i = sizeof(name);
> + if (sysctl(qoid, len + 2, name, , 0, 0) == -1)
> + print_sysctl_oid(fp, oid, len);
> + else
> + fprintf(fp, "%s", name);
> +}
> +
> /*
>  * Converts a syscall argument into a string.  Said string is
>  * allocated via malloc(), so needs to be free()'d.  sc is
> @@ -2298,9 +2321,8 @@ print_arg(struct syscall_args *sc, unsigned long *args
>   break;
>   case Sysctl: {
>   char name[BUFSIZ];
> - int oid[CTL_MAXNAME + 2], qoid[CTL_MAXNAME + 2];
> - size_t i;
> - int len;
> + int oid[CTL_MAXNAME + 2];
> + size_t len;
> 
>   memset(name, 0, sizeof(name));
>   len = args[sc->offset + 1];
> @@ -2314,39 +2336,35 @@ print_arg(struct syscall_args *sc, unsigned long *args
>   fprintf(fp, "debug");
>   break;
>   case CTL_SYSCTL_NAME:
> - fprintf(fp, "name");
> + fprintf(fp, "name ");
>   print_sysctl_oid(fp, oid + 2, len - 2);
>   break;
>   case CTL_SYSCTL_NEXT:
>   fprintf(fp, "next");
>   break;
>   case CTL_SYSCTL_NAME2OID:
> - fprintf(fp, "name2oid");
> + fprintf(fp, "name2oid %s",
> + get_string(pid,
> + args[sc->offset + 4],
> + args[sc->offset + 5]));
>   break;
>   case CTL_SYSCTL_OIDFMT:
> - fprintf(fp, "oidfmt");
> - print_sysctl_oid(fp, oid + 2, len - 2);
> + fprintf(fp, "oidfmt ");
> + print_sysctl(fp, oid + 2, len - 2);
>   break;
>   case CTL_SYSCTL_OIDDESCR:
> - fprintf(fp, "oiddescr");
> - print_sysctl_oid(fp, oid + 2, len - 2);
> + fprintf(fp, "oiddescr ");
> + print_sysctl(fp, oid + 2, len - 2);
>   

Re: svn commit: r358334 - head/sys/sys

2020-02-26 Thread Paweł Biernacki
 Approved by:   kib (mentor, blanket)

> On 26 Feb 2020, at 16:12, Pawel Biernacki  wrote:
> 
> Author: kaktus
> Date: Wed Feb 26 15:12:38 2020
> New Revision: 358334
> URL: https://svnweb.freebsd.org/changeset/base/358334
> 
> Log:
>  Move the SYSCTL_ENFORCE_FLAGS to SYSCTL_NODE_WITH_LABEL where it should be
>  at the beginning.
> 
> Modified:
>  head/sys/sys/sysctl.h
> 
> Modified: head/sys/sys/sysctl.h
> ==
> --- head/sys/sys/sysctl.h Wed Feb 26 14:26:36 2020(r358333)
> +++ head/sys/sys/sysctl.h Wed Feb 26 15:12:38 2020(r358334)
> @@ -324,7 +324,6 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
>   SYSCTL_OID_RAW(sysctl___##name, __children,  \
>   nbr, #name, CTLTYPE_NODE|(access), NULL, 0, \
>   handler, "N", descr, NULL); \
> - SYSCTL_ENFORCE_FLAGS(access);   \
>   CTASSERT(((access) & CTLTYPE) == 0 ||   \
>   ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE)
> 
> @@ -335,6 +334,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
> #define   SYSCTL_NODE_WITH_LABEL(parent, nbr, name, access, handler, 
> descr, label) \
>   SYSCTL_OID_GLOBAL(parent, nbr, name, CTLTYPE_NODE|(access), \
>   NULL, 0, handler, "N", descr, label);   \
> + SYSCTL_ENFORCE_FLAGS(access);   \
>   CTASSERT(((access) & CTLTYPE) == 0 ||   \
>   ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE)
> 

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r358286 - in head/sys/dev: e1000 ixgbe ixl

2020-02-24 Thread Paweł Biernacki
 Approved by:   kib (mentor, blanket)
 Differential Revision: https://reviews.freebsd.org/D23630 


> On 24 Feb 2020, at 11:51, Pawel Biernacki  wrote:
> 
> Author: kaktus
> Date: Mon Feb 24 10:51:26 2020
> New Revision: 358286
> URL: https://svnweb.freebsd.org/changeset/base/358286
> 
> Log:
>  Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (15 of many)
> 
>  r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
>  still not MPSAFE (or already are but aren’t properly marked).
>  Use it in preparation for a general review of all nodes.
> 
>  This is non-functional change that adds annotations to SYSCTL_NODE and
>  SYSCTL_PROC nodes using one of the soon-to-be-required flags.
> 
> Modified:
>  head/sys/dev/e1000/if_em.c
>  head/sys/dev/ixgbe/if_bypass.c
>  head/sys/dev/ixgbe/if_ix.c
>  head/sys/dev/ixgbe/if_ixv.c
>  head/sys/dev/ixl/if_iavf.c
>  head/sys/dev/ixl/if_ixl.c
>  head/sys/dev/ixl/ixl_pf_main.c
>  head/sys/dev/ixl/ixl_txrx.c
> 
> Modified: head/sys/dev/e1000/if_em.c
> ==
> --- head/sys/dev/e1000/if_em.cMon Feb 24 10:47:18 2020
> (r358285)
> +++ head/sys/dev/e1000/if_em.cMon Feb 24 10:51:26 2020
> (r358286)
> @@ -459,7 +459,8 @@ static driver_t igb_if_driver = {
> #define CSUM_TSO  0
> #endif
> 
> -static SYSCTL_NODE(_hw, OID_AUTO, em, CTLFLAG_RD, 0, "EM driver parameters");
> +static SYSCTL_NODE(_hw, OID_AUTO, em, CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
> +"EM driver parameters");
> 
> static int em_disable_crc_stripping = 0;
> SYSCTL_INT(_hw_em, OID_AUTO, disable_crc_stripping, CTLFLAG_RDTUN,
> @@ -785,27 +786,29 @@ em_if_attach_pre(if_ctx_t ctx)
>   /* SYSCTL stuff */
>   SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
>   SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
> - OID_AUTO, "nvm", CTLTYPE_INT|CTLFLAG_RW, adapter, 0,
> - em_sysctl_nvm_info, "I", "NVM Information");
> + OID_AUTO, "nvm", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
> + adapter, 0, em_sysctl_nvm_info, "I", "NVM Information");
> 
>   SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
>   SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
> - OID_AUTO, "debug", CTLTYPE_INT|CTLFLAG_RW, adapter, 0,
> - em_sysctl_debug_info, "I", "Debug Information");
> + OID_AUTO, "debug", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
> + adapter, 0, em_sysctl_debug_info, "I", "Debug Information");
> 
>   SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
>   SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
> - OID_AUTO, "fc", CTLTYPE_INT|CTLFLAG_RW, adapter, 0,
> - em_set_flowcntl, "I", "Flow Control");
> + OID_AUTO, "fc", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
> + adapter, 0, em_set_flowcntl, "I", "Flow Control");
> 
>   SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
>   SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
> - OID_AUTO, "reg_dump", CTLTYPE_STRING | CTLFLAG_RD, adapter, 0,
> + OID_AUTO, "reg_dump",
> + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, adapter, 0,
>   em_get_regs, "A", "Dump Registers");
> 
>   SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
>   SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
> - OID_AUTO, "rs_dump", CTLTYPE_INT | CTLFLAG_RW, adapter, 0,
> + OID_AUTO, "rs_dump",
> + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, adapter, 0,
>   em_get_rs, "I", "Dump RS indexes");
> 
>   /* Determine hardware and mac info */
> @@ -1020,7 +1023,8 @@ em_if_attach_pre(if_ctx_t ctx)
>   hw->dev_spec.ich8lan.eee_disable = eee_setting;
>   SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
>   SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
> - OID_AUTO, "eee_control", CTLTYPE_INT|CTLFLAG_RW,
> + OID_AUTO, "eee_control",
> + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
>   adapter, 0, em_sysctl_eee, "I",
>   "Disable Energy Efficient Ethernet");
> 
> @@ -4081,13 +4085,13 @@ em_add_hw_stats(struct adapter *adapter)
>   CTLFLAG_RD, >watchdog_events,
>   "Watchdog timeouts");
>   SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "device_control",
> - CTLTYPE_UINT | CTLFLAG_RD, adapter, E1000_CTRL,
> - em_sysctl_reg_handler, "IU",
> - "Device Control Register");
> + CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_NEEDGIANT,
> + adapter, E1000_CTRL, em_sysctl_reg_handler, "IU",
> + "Device Control Register");
>   SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rx_control",
> - CTLTYPE_UINT | CTLFLAG_RD, adapter, E1000_RCTL,
> - em_sysctl_reg_handler, "IU",
> - "Receiver Control Register");
> + CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_NEEDGIANT,
> + 

Re: svn commit: r357614 - in head/sys: kern sys

2020-02-06 Thread Paweł Biernacki
Thanks, will be fixed before enabling it.


> On 6 Feb 2020, at 17:41, Hans Petter Selasky  wrote:
> 
> On 2020-02-06 13:45, Pawel Biernacki wrote:
>> +#ifdef notyet
>> +#define SYSCTL_ENFORCE_FLAGS(x) 
>> \
>> +_Static_assert(((CTLFLAG_MPSAFE ^ CTLFLAG_NEEDGIANT) & (x)),\
>> +"Has to be either CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT")
>> +#else
>> +#define SYSCTL_ENFORCE_FLAGS(x)
>> +#endif
> 
> Like cem@ pointed out, either you expand the XOR via OR or you can also do it 
> like this:
> 
> (((x) & CTLFLAG_MPSAFE) != 0) ^ (((x) & CTLFLAG_NEEDGIANT) != 0)
> 
> which avoids having to define another macro.
> 
> --HPS

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r352914 - head/sys/compat/linux

2019-09-30 Thread Paweł Biernacki



> On 30 Sep 2019, at 21:05, Pawel Biernacki  wrote:
> 
> Author: kaktus
> Date: Mon Sep 30 19:05:14 2019
> New Revision: 352914
> URL: https://svnweb.freebsd.org/changeset/base/352914
> 
> Log:
>  linux_renameat2: don't add extra \n on error.
> 
>  linux_msg() already adds \n at the end of all messages.
> 
>  Reported by: emaste, kib (mentor), mjg (mentor)
>  Reviewed by: kib (mentor), mjg (mentor)

Should be:
Reviewed by:emaste, kib (mentor), mjg (mentor)
Approved by:kib (mentor), mjg (mentor)


>  Differential Revision:   https://reviews.freebsd.org/D21852
> 
> Modified:
>  head/sys/compat/linux/linux_file.c
> 
> Modified: head/sys/compat/linux/linux_file.c
> ==
> --- head/sys/compat/linux/linux_file.cMon Sep 30 19:03:43 2019
> (r352913)
> +++ head/sys/compat/linux/linux_file.cMon Sep 30 19:05:14 2019
> (r352914)
> @@ -704,7 +704,7 @@ linux_renameat2(struct thread *td, struct linux_rename
>   int error, olddfd, newdfd;
> 
>   if (args->flags != 0) {
> - linux_msg(td, "renameat2 unsupported flags 0x%x\n",
> + linux_msg(td, "renameat2 unsupported flags 0x%x",
>   args->flags);
>   return (EINVAL);
>   }

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"