Re: svn commit: r313322 - in head/sys: conf dev/iwm modules/iwm
Hi Adrian, 2017-02-06 6:27 GMT+01:00 Adrian Chadd: > Modified: head/sys/conf/files > == > --- head/sys/conf/files Mon Feb 6 05:27:05 2017(r313321) > +++ head/sys/conf/files Mon Feb 6 05:27:07 2017(r313322) > @@ -1882,6 +1882,7 @@ dev/iwm/if_iwm.c optional iwm > dev/iwm/if_iwm_binding.c optional iwm > dev/iwm/if_iwm_led.c optional iwm > dev/iwm/if_iwm_mac_ctxt.c optional iwm > +dev/netif/iwm/if_iwm_notif_wait.c optional iwm > dev/iwm/if_iwm_pcie_trans.coptional iwm > dev/iwm/if_iwm_phy_ctxt.c optional iwm > dev/iwm/if_iwm_phy_db.coptional iwm What's with the 'netif' part in the source file's name? The actual source file doesn't use it. -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717 ___ 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"
svn commit: r313327 - head/usr.bin/gzip
Author: delphij Date: Mon Feb 6 07:02:17 2017 New Revision: 313327 URL: https://svnweb.freebsd.org/changeset/base/313327 Log: Reflect actual NetBSD revision we already have. MFC after:3 days Modified: head/usr.bin/gzip/unxz.c Modified: head/usr.bin/gzip/unxz.c == --- head/usr.bin/gzip/unxz.cMon Feb 6 06:15:38 2017(r313326) +++ head/usr.bin/gzip/unxz.cMon Feb 6 07:02:17 2017(r313327) @@ -1,4 +1,4 @@ -/* $NetBSD: unxz.c,v 1.5 2011/09/30 01:32:21 christos Exp $*/ +/* $NetBSD: unxz.c,v 1.6 2016/01/29 15:19:01 christos Exp $*/ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. ___ 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"
svn commit: r313326 - head/tools/tools/nanobsd/embedded
Author: imp Date: Mon Feb 6 06:15:38 2017 New Revision: 313326 URL: https://svnweb.freebsd.org/changeset/base/313326 Log: o Add mkimg to the cross tools, and use the TMPPATH as PATH to pick up mkimg for building on systems like FreeBSD 11.0 that don't have my -a changes. o Set NANO_ROOT and NANO_ALTROOT for std-* since their values don't change when we set NANO_SLICE*. PR: 216829 PR: 216830 Modified: head/tools/tools/nanobsd/embedded/common Modified: head/tools/tools/nanobsd/embedded/common == --- head/tools/tools/nanobsd/embedded/commonMon Feb 6 05:35:11 2017 (r313325) +++ head/tools/tools/nanobsd/embedded/commonMon Feb 6 06:15:38 2017 (r313326) @@ -132,6 +132,7 @@ customize_cmd cust_install_machine_files # NB: leave c++ enabled so devd can be built CONF_BUILD=" +LOCAL_XTOOL_DIRS=usr.bin/mkimg WITHOUT_ACPI=true WITHOUT_ATM=true WITHOUT_AUDIT=true @@ -612,17 +613,23 @@ std-embedded) NANO_SLICE_CFG=s2 NANO_SLICE_ROOT=s3 NANO_SLICE_ALTROOT=s4 + NANO_ROOT=${NANO_SLICE_ROOT}a + NANO_ALTROOT=${NANO_SLICE_ALTROOT}a ;; std-x86) NANO_SLICE_CFG=s1 NANO_SLICE_ROOT=s2 NANO_SLICE_ALTROOT=s3 + NANO_ROOT=${NANO_SLICE_ROOT}a + NANO_ALTROOT=${NANO_SLICE_ALTROOT}a ;; powerpc64-ibm) NANO_SLICE_PPCBOOT=s1 NANO_SLICE_CFG=s2 NANO_SLICE_ROOT=s3 NANO_SLICE_ALTROOT=s4 + NANO_ROOT=${NANO_SLICE_ROOT}a + NANO_ALTROOT=${NANO_SLICE_ALTROOT}a ;; powerpc64-apple) echo Not yet @@ -633,6 +640,8 @@ std-uefi) NANO_SLICE_CFG=s2 NANO_SLICE_ROOT=s3 NANO_SLICE_ALTROOT=s4 + NANO_ROOT=${NANO_SLICE_ROOT} + NANO_ALTROOT=${NANO_SLICE_ALTROOT} ;; std-uefi-bios) NANO_DISK_SCHEME=gpt @@ -641,7 +650,6 @@ std-uefi-bios) NANO_SLICE_CFG=p3 NANO_SLICE_ROOT=p4 NANO_SLICE_ALTROOT=p5 - # override root name NANO_ROOT=${NANO_SLICE_ROOT} NANO_ALTROOT=${NANO_SLICE_ALTROOT} ;; @@ -660,3 +668,8 @@ NANO_SLICE_DATA=# Not included create_diskimage ( ) ( eval create_diskimage_${NANO_DISK_SCHEME} ) + +# Set the path to the same path we use for buldworld to use latest mkimg +NANO_TARGET=$(cd ${NANO_SRC}; ${NANO_MAKE} TARGET_ARCH=${NANO_ARCH} -V _TARGET) +NANO_TMPPATH=$(cd ${NANO_SRC}; ${NANO_MAKE} TARGET=${NANO_TARGET} TARGET_ARCH=${NANO_ARCH} -f Makefile.inc1 buildenv -V TMPPATH) +export PATH="${NANO_TMPPATH}" ___ 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"
svn commit: r313324 - stable/10/usr.bin/mail
Author: delphij Date: Mon Feb 6 05:34:47 2017 New Revision: 313324 URL: https://svnweb.freebsd.org/changeset/base/313324 Log: MFC r312663: When creating record file, use umask 077 instead of the default. Modified: stable/10/usr.bin/mail/send.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/mail/send.c == --- stable/10/usr.bin/mail/send.c Mon Feb 6 05:29:35 2017 (r313323) +++ stable/10/usr.bin/mail/send.c Mon Feb 6 05:34:47 2017 (r313324) @@ -566,8 +566,13 @@ savemail(char name[], FILE *fi) char buf[BUFSIZ]; int i; time_t now; + mode_t saved_umask; - if ((fo = Fopen(name, "a")) == NULL) { + saved_umask = umask(077); + fo = Fopen(name, "a"); + umask(saved_umask); + + if (fo == NULL) { warn("%s", name); return (-1); } ___ 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"
svn commit: r313325 - head/sys/dev/iwm
Author: adrian Date: Mon Feb 6 05:35:11 2017 New Revision: 313325 URL: https://svnweb.freebsd.org/changeset/base/313325 Log: [iwm] Use notification wait API to wait for calibration to complete. Tested: * 7260, STA mode (2g, 5g) Obtained from:DragonflyBSD commit 1e0cf8ec6fcd77978f5336297ece61a415790f84 Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwmvar.h Modified: head/sys/dev/iwm/if_iwm.c == --- head/sys/dev/iwm/if_iwm.c Mon Feb 6 05:34:47 2017(r313324) +++ head/sys/dev/iwm/if_iwm.c Mon Feb 6 05:35:11 2017(r313325) @@ -284,6 +284,8 @@ struct iwm_nvm_section { uint8_t *data; }; +#define IWM_MVM_UCODE_CALIB_TIMEOUT(2*hz) + static int iwm_store_cscheme(struct iwm_softc *, const uint8_t *, size_t); static int iwm_firmware_store_section(struct iwm_softc *, enum iwm_ucode_type, @@ -2751,6 +2753,28 @@ iwm_send_phy_cfg_cmd(struct iwm_softc *s } static int +iwm_wait_phy_db_entry(struct iwm_softc *sc, + struct iwm_rx_packet *pkt, void *data) +{ + struct iwm_phy_db *phy_db = data; + + if (pkt->hdr.code != IWM_CALIB_RES_NOTIF_PHY_DB) { + if(pkt->hdr.code != IWM_INIT_COMPLETE_NOTIF) { + device_printf(sc->sc_dev, "%s: Unexpected cmd: %d\n", + __func__, pkt->hdr.code); + } + return TRUE; + } + + if (iwm_phy_db_set_section(phy_db, pkt)) { + device_printf(sc->sc_dev, + "%s: iwm_phy_db_set_section failed\n", __func__); + } + + return FALSE; +} + +static int iwm_mvm_load_ucode_wait_alive(struct iwm_softc *sc, enum iwm_ucode_type ucode_type) { @@ -2788,7 +2812,12 @@ iwm_mvm_load_ucode_wait_alive(struct iwm static int iwm_run_init_mvm_ucode(struct iwm_softc *sc, int justnvm) { - int error; + struct iwm_notification_wait calib_wait; + static const uint16_t init_complete[] = { + IWM_INIT_COMPLETE_NOTIF, + IWM_CALIB_RES_NOTIF_PHY_DB + }; + int ret; /* do not operate with rfkill switch turned on */ if ((sc->sc_flags & IWM_FLAG_RFKILL) && !justnvm) { @@ -2797,81 +2826,80 @@ iwm_run_init_mvm_ucode(struct iwm_softc return EPERM; } - sc->sc_init_complete = 0; - if ((error = iwm_mvm_load_ucode_wait_alive(sc, - IWM_UCODE_INIT)) != 0) { - device_printf(sc->sc_dev, "failed to load init firmware\n"); - return error; + iwm_init_notification_wait(sc->sc_notif_wait, + _wait, + init_complete, + nitems(init_complete), + iwm_wait_phy_db_entry, + sc->sc_phy_db); + + /* Will also start the device */ + ret = iwm_mvm_load_ucode_wait_alive(sc, IWM_UCODE_INIT); + if (ret) { + device_printf(sc->sc_dev, "Failed to start INIT ucode: %d\n", + ret); + goto error; } if (justnvm) { - if ((error = iwm_nvm_init(sc)) != 0) { + /* Read nvm */ + ret = iwm_nvm_init(sc); + if (ret) { device_printf(sc->sc_dev, "failed to read nvm\n"); - return error; + goto error; } IEEE80211_ADDR_COPY(sc->sc_ic.ic_macaddr, sc->nvm_data->hw_addr); - - return 0; + goto error; } - if ((error = iwm_send_bt_init_conf(sc)) != 0) { + ret = iwm_send_bt_init_conf(sc); + if (ret) { device_printf(sc->sc_dev, - "failed to send bt coex configuration: %d\n", error); - return error; + "failed to send bt coex configuration: %d\n", ret); + goto error; } /* Init Smart FIFO. */ - error = iwm_mvm_sf_config(sc, IWM_SF_INIT_OFF); - if (error != 0) - return error; - -#if 0 - IWM_DPRINTF(sc, IWM_DEBUG_RESET, - "%s: phy_txant=0x%08x, nvm_valid_tx_ant=0x%02x, valid=0x%02x\n", - __func__, - ((sc->sc_fw_phy_config & IWM_FW_PHY_CFG_TX_CHAIN) - >> IWM_FW_PHY_CFG_TX_CHAIN_POS), - sc->nvm_data->valid_tx_ant, - iwm_fw_valid_tx_ant(sc)); -#endif + ret = iwm_mvm_sf_config(sc, IWM_SF_INIT_OFF); + if (ret) + goto error; /* Send TX valid antennas before triggering calibrations */ - error = iwm_send_tx_ant_cfg(sc, iwm_mvm_get_valid_tx_ant(sc)); - if (error != 0) { + ret = iwm_send_tx_ant_cfg(sc, iwm_mvm_get_valid_tx_ant(sc)); + if (ret) {
svn commit: r313323 - stable/11/usr.bin/mail
Author: delphij Date: Mon Feb 6 05:29:35 2017 New Revision: 313323 URL: https://svnweb.freebsd.org/changeset/base/313323 Log: MFC r312663: When creating record file, use umask 077 instead of the default. Modified: stable/11/usr.bin/mail/send.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/mail/send.c == --- stable/11/usr.bin/mail/send.c Mon Feb 6 05:27:07 2017 (r313322) +++ stable/11/usr.bin/mail/send.c Mon Feb 6 05:29:35 2017 (r313323) @@ -566,8 +566,13 @@ savemail(char name[], FILE *fi) char buf[BUFSIZ]; int i; time_t now; + mode_t saved_umask; - if ((fo = Fopen(name, "a")) == NULL) { + saved_umask = umask(077); + fo = Fopen(name, "a"); + umask(saved_umask); + + if (fo == NULL) { warn("%s", name); return (-1); } ___ 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"
svn commit: r313322 - in head/sys: conf dev/iwm modules/iwm
Author: adrian Date: Mon Feb 6 05:27:07 2017 New Revision: 313322 URL: https://svnweb.freebsd.org/changeset/base/313322 Log: [iwm] Add implementation of the notification wait api from iwlwifi. Obtained from:Linux iwlwifi Obtained from:DragonflyBSD commit 94dc1dadceb57b688036211262d678bc6bbdde37 Added: head/sys/dev/iwm/if_iwm_notif_wait.c (contents, props changed) head/sys/dev/iwm/if_iwm_notif_wait.h (contents, props changed) Modified: head/sys/conf/files head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwmvar.h head/sys/modules/iwm/Makefile Modified: head/sys/conf/files == --- head/sys/conf/files Mon Feb 6 05:27:05 2017(r313321) +++ head/sys/conf/files Mon Feb 6 05:27:07 2017(r313322) @@ -1882,6 +1882,7 @@ dev/iwm/if_iwm.c optional iwm dev/iwm/if_iwm_binding.c optional iwm dev/iwm/if_iwm_led.c optional iwm dev/iwm/if_iwm_mac_ctxt.c optional iwm +dev/netif/iwm/if_iwm_notif_wait.c optional iwm dev/iwm/if_iwm_pcie_trans.coptional iwm dev/iwm/if_iwm_phy_ctxt.c optional iwm dev/iwm/if_iwm_phy_db.coptional iwm Modified: head/sys/dev/iwm/if_iwm.c == --- head/sys/dev/iwm/if_iwm.c Mon Feb 6 05:27:05 2017(r313321) +++ head/sys/dev/iwm/if_iwm.c Mon Feb 6 05:27:07 2017(r313322) @@ -153,6 +153,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -5277,6 +5278,8 @@ iwm_notif_intr(struct iwm_softc *sc) continue; } + iwm_notification_wait_notify(sc->sc_notif_wait, code, pkt); + switch (code) { case IWM_REPLY_RX_PHY_CMD: iwm_mvm_rx_rx_phy_cmd(sc, pkt, data); @@ -5896,6 +5899,12 @@ iwm_attach(device_t dev) callout_init_mtx(>sc_led_blink_to, >sc_mtx, 0); TASK_INIT(>sc_es_task, 0, iwm_endscan_cb, sc); + sc->sc_notif_wait = iwm_notification_wait_init(sc); + if (sc->sc_notif_wait == NULL) { + device_printf(dev, "failed to init notification wait struct\n"); + goto fail; + } + /* Init phy db */ sc->sc_phy_db = iwm_phy_db_init(sc); if (!sc->sc_phy_db) { @@ -6383,6 +6392,11 @@ iwm_detach_local(struct iwm_softc *sc, i /* Finished with the hardware - detach things */ iwm_pci_detach(dev); + if (sc->sc_notif_wait != NULL) { + iwm_notification_wait_free(sc->sc_notif_wait); + sc->sc_notif_wait = NULL; + } + mbufq_drain(>sc_snd); IWM_LOCK_DESTROY(sc); Added: head/sys/dev/iwm/if_iwm_notif_wait.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iwm/if_iwm_notif_wait.cMon Feb 6 05:27:07 2017 (r313322) @@ -0,0 +1,219 @@ +/*- + * Based on BSD-licensed source modules in the Linux iwlwifi driver, + * which were used as the reference documentation for this implementation. + * + ** + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved. + * Copyright(c) 2015 Intel Deutschland GmbH + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, + * USA + * + * The full GNU General Public License is included in this distribution + * in the file called COPYING. + * + * Contact Information: + * Intel Linux Wireless+ * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + * + * BSD LICENSE + * + * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * * Redistributions in
svn commit: r313321 - stable/10/usr.bin/sort
Author: pfg Date: Mon Feb 6 05:27:05 2017 New Revision: 313321 URL: https://svnweb.freebsd.org/changeset/base/313321 Log: MFC r312667: sort - Don't live-loop threads. Worker threads now use a pthread_cond_t to wait for work instead of burning the cpu up. Obtained from:DragonflyBSD (07774aea0ccf64a48fcfad8899e3bf7c8f18277a) Modified: stable/10/usr.bin/sort/radixsort.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/sort/radixsort.c == --- stable/10/usr.bin/sort/radixsort.c Mon Feb 6 05:24:17 2017 (r313320) +++ stable/10/usr.bin/sort/radixsort.c Mon Feb 6 05:27:05 2017 (r313321) @@ -83,12 +83,12 @@ static struct level_stack *g_ls; #if defined(SORT_THREADS) /* stack guarding mutex */ +static pthread_cond_t g_ls_cond; static pthread_mutex_t g_ls_mutex; /* counter: how many items are left */ static size_t sort_left; /* guarding mutex */ -static pthread_mutex_t sort_left_mutex; /* semaphore to count threads */ static sem_t mtsem; @@ -99,23 +99,25 @@ static sem_t mtsem; static inline void sort_left_dec(size_t n) { - - pthread_mutex_lock(_left_mutex); + pthread_mutex_lock(_ls_mutex); sort_left -= n; - pthread_mutex_unlock(_left_mutex); + if (sort_left == 0 && nthreads > 1) + pthread_cond_broadcast(_ls_cond); + pthread_mutex_unlock(_ls_mutex); } /* * Do we have something to sort ? + * + * This routine does not need to be locked. */ static inline bool have_sort_left(void) { bool ret; - pthread_mutex_lock(_left_mutex); ret = (sort_left > 0); - pthread_mutex_unlock(_left_mutex); + return (ret); } @@ -146,6 +148,11 @@ push_ls(struct sort_level* sl) #if defined(SORT_THREADS) if (nthreads > 1) + pthread_cond_signal(_ls_cond); +#endif + +#if defined(SORT_THREADS) + if (nthreads > 1) pthread_mutex_unlock(_ls_mutex); #endif } @@ -184,13 +191,19 @@ pop_ls_mt(void) pthread_mutex_lock(_ls_mutex); - if (g_ls) { - sl = g_ls->sl; - saved_ls = g_ls; - g_ls = g_ls->next; - } else { + for (;;) { + if (g_ls) { + sl = g_ls->sl; + saved_ls = g_ls; + g_ls = g_ls->next; + break; + } sl = NULL; saved_ls = NULL; + + if (have_sort_left() == 0) + break; + pthread_cond_wait(_ls_cond, _ls_mutex); } pthread_mutex_unlock(_ls_mutex); @@ -493,13 +506,8 @@ run_sort_cycle_mt(void) for (;;) { slc = pop_ls_mt(); - if (slc == NULL) { - if (have_sort_left()) { - pthread_yield(); - continue; - } + if (slc == NULL) break; - } run_sort_level_next(slc); } } @@ -510,9 +518,7 @@ run_sort_cycle_mt(void) static void* sort_thread(void* arg) { - run_sort_cycle_mt(); - sem_post(); return (arg); @@ -608,8 +614,7 @@ run_top_sort_level(struct sort_level *sl pthread_t pth; pthread_attr_init(); - pthread_attr_setdetachstate(, - PTHREAD_DETACHED); + pthread_attr_setdetachstate(, PTHREAD_DETACHED); for (;;) { int res = pthread_create(, , @@ -626,7 +631,7 @@ run_top_sort_level(struct sort_level *sl pthread_attr_destroy(); } - for(i = 0; i < nthreads; ++i) + for (i = 0; i < nthreads; ++i) sem_wait(); } #endif /* defined(SORT_THREADS) */ @@ -649,7 +654,7 @@ run_sort(struct sort_list_item **base, s pthread_mutexattr_settype(, PTHREAD_MUTEX_ADAPTIVE_NP); pthread_mutex_init(_ls_mutex, ); - pthread_mutex_init(_left_mutex, ); + pthread_cond_init(_ls_cond, NULL); pthread_mutexattr_destroy(); @@ -677,7 +682,6 @@ run_sort(struct sort_list_item **base, s if (nthreads > 1) { sem_destroy(); pthread_mutex_destroy(_ls_mutex); - pthread_mutex_destroy(_left_mutex); } nthreads = nthreads_save; #endif ___ 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"
svn commit: r313320 - stable/10/usr.bin/mail
Author: delphij Date: Mon Feb 6 05:24:17 2017 New Revision: 313320 URL: https://svnweb.freebsd.org/changeset/base/313320 Log: MFC r312664: Always initialize 'c'. Modified: stable/10/usr.bin/mail/send.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/mail/send.c == --- stable/10/usr.bin/mail/send.c Mon Feb 6 05:22:55 2017 (r313319) +++ stable/10/usr.bin/mail/send.c Mon Feb 6 05:24:17 2017 (r313320) @@ -59,7 +59,7 @@ sendmessage(struct message *mp, FILE *ob FILE *ibuf; char *cp, *cp2, line[LINESIZE]; int ishead, infld, ignoring, dostat, firstline; - int c, length, prefixlen; + int c = 0, length, prefixlen; /* * Compute the prefix string, without trailing whitespace ___ 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"
svn commit: r313319 - stable/11/usr.bin/mail
Author: delphij Date: Mon Feb 6 05:22:55 2017 New Revision: 313319 URL: https://svnweb.freebsd.org/changeset/base/313319 Log: MFC r312664: Always initialize 'c'. Modified: stable/11/usr.bin/mail/send.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/mail/send.c == --- stable/11/usr.bin/mail/send.c Mon Feb 6 05:19:29 2017 (r313318) +++ stable/11/usr.bin/mail/send.c Mon Feb 6 05:22:55 2017 (r313319) @@ -59,7 +59,7 @@ sendmessage(struct message *mp, FILE *ob FILE *ibuf; char *cp, *cp2, line[LINESIZE]; int ishead, infld, ignoring, dostat, firstline; - int c, length, prefixlen; + int c = 0, length, prefixlen; /* * Compute the prefix string, without trailing whitespace ___ 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"
svn commit: r313318 - in head: share/man/man4 sys/dev/cxgbe
Author: np Date: Mon Feb 6 05:19:29 2017 New Revision: 313318 URL: https://svnweb.freebsd.org/changeset/base/313318 Log: cxgbe(4): Allow tunables that control the number of queues to be set to '-n' to tell the driver to create _up to_ 'n' queues if enough cores are available. For example, setting hw.cxgbe.nrxq10g="-32" will result in 16 queues if the system has 16 cores, 32 if it has 32. There is no change in the default number of queues of any type. MFC after:1 week Sponsored by: Chelsio Communications Modified: head/share/man/man4/cxgbe.4 head/sys/dev/cxgbe/t4_main.c Modified: head/share/man/man4/cxgbe.4 == --- head/share/man/man4/cxgbe.4 Mon Feb 6 05:09:42 2017(r313317) +++ head/share/man/man4/cxgbe.4 Mon Feb 6 05:19:29 2017(r313318) @@ -167,6 +167,10 @@ Tunables can be set at the .Xr loader 8 prompt before booting the kernel or stored in .Xr loader.conf 5 . +There are multiple tunables that control the number of queues of various +types. +A negative value for such a tunable instructs the driver to create +up to that many queues if there are enough CPU cores available. .Bl -tag -width indent .It Va hw.cxgbe.ntxq10g Number of tx queues used for a 10Gb or higher-speed port. Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cMon Feb 6 05:09:42 2017 (r313317) +++ head/sys/dev/cxgbe/t4_main.cMon Feb 6 05:19:29 2017 (r313318) @@ -232,8 +232,8 @@ SLIST_HEAD(, uld_info) t4_uld_list; * Tunables. See tweak_tunables() too. * * Each tunable is set to a default value here if it's known at compile-time. - * Otherwise it is set to -1 as an indication to tweak_tunables() that it should - * provide a reasonable default when the driver is loaded. + * Otherwise it is set to -n as an indication to tweak_tunables() that it should + * provide a reasonable default (upto n) when the driver is loaded. * * Tunables applicable to both T4 and T5 are under hw.cxgbe. Those specific to * T5 are under hw.cxl. @@ -243,27 +243,27 @@ SLIST_HEAD(, uld_info) t4_uld_list; * Number of queues for tx and rx, 10G and 1G, NIC and offload. */ #define NTXQ_10G 16 -int t4_ntxq10g = -1; +int t4_ntxq10g = -NTXQ_10G; TUNABLE_INT("hw.cxgbe.ntxq10g", _ntxq10g); #define NRXQ_10G 8 -int t4_nrxq10g = -1; +int t4_nrxq10g = -NRXQ_10G; TUNABLE_INT("hw.cxgbe.nrxq10g", _nrxq10g); #define NTXQ_1G 4 -int t4_ntxq1g = -1; +int t4_ntxq1g = -NTXQ_1G; TUNABLE_INT("hw.cxgbe.ntxq1g", _ntxq1g); #define NRXQ_1G 2 -int t4_nrxq1g = -1; +int t4_nrxq1g = -NRXQ_1G; TUNABLE_INT("hw.cxgbe.nrxq1g", _nrxq1g); #define NTXQ_VI 1 -static int t4_ntxq_vi = -1; +static int t4_ntxq_vi = -NTXQ_VI; TUNABLE_INT("hw.cxgbe.ntxq_vi", _ntxq_vi); #define NRXQ_VI 1 -static int t4_nrxq_vi = -1; +static int t4_nrxq_vi = -NRXQ_VI; TUNABLE_INT("hw.cxgbe.nrxq_vi", _nrxq_vi); static int t4_rsrv_noflowq = 0; @@ -271,37 +271,37 @@ TUNABLE_INT("hw.cxgbe.rsrv_noflowq", #ifdef TCP_OFFLOAD #define NOFLDTXQ_10G 8 -static int t4_nofldtxq10g = -1; +static int t4_nofldtxq10g = -NOFLDTXQ_10G; TUNABLE_INT("hw.cxgbe.nofldtxq10g", _nofldtxq10g); #define NOFLDRXQ_10G 2 -static int t4_nofldrxq10g = -1; +static int t4_nofldrxq10g = -NOFLDRXQ_10G; TUNABLE_INT("hw.cxgbe.nofldrxq10g", _nofldrxq10g); #define NOFLDTXQ_1G 2 -static int t4_nofldtxq1g = -1; +static int t4_nofldtxq1g = -NOFLDTXQ_1G; TUNABLE_INT("hw.cxgbe.nofldtxq1g", _nofldtxq1g); #define NOFLDRXQ_1G 1 -static int t4_nofldrxq1g = -1; +static int t4_nofldrxq1g = -NOFLDRXQ_1G; TUNABLE_INT("hw.cxgbe.nofldrxq1g", _nofldrxq1g); #define NOFLDTXQ_VI 1 -static int t4_nofldtxq_vi = -1; +static int t4_nofldtxq_vi = -NOFLDTXQ_VI; TUNABLE_INT("hw.cxgbe.nofldtxq_vi", _nofldtxq_vi); #define NOFLDRXQ_VI 1 -static int t4_nofldrxq_vi = -1; +static int t4_nofldrxq_vi = -NOFLDRXQ_VI; TUNABLE_INT("hw.cxgbe.nofldrxq_vi", _nofldrxq_vi); #endif #ifdef DEV_NETMAP #define NNMTXQ_VI 2 -static int t4_nnmtxq_vi = -1; +static int t4_nnmtxq_vi = -NNMTXQ_VI; TUNABLE_INT("hw.cxgbe.nnmtxq_vi", _nnmtxq_vi); #define NNMRXQ_VI 2 -static int t4_nnmrxq_vi = -1; +static int t4_nnmrxq_vi = -NNMRXQ_VI; TUNABLE_INT("hw.cxgbe.nnmrxq_vi", _nnmrxq_vi); #endif @@ -9532,6 +9532,22 @@ uld_active(struct adapter *sc, int uld_i #endif /* + * t = ptr to tunable. + * nc = number of CPUs. + * c = compiled in default for that tunable. + */ +static void +calculate_nqueues(int *t, int nc, const int c) +{ + int nq; + + if (*t > 0) + return; + nq = *t < 0 ? -*t : c; + *t = min(nc, nq); +} + +/* * Come up with reasonable defaults for some of the tunables, provided they're * not set by the user (in which case we'll use the values as is). */ @@ -9544,7 +9560,7 @@ tweak_tunables(void) #ifdef RSS t4_ntxq10g =
svn commit: r313317 - head/sys/dev/iwm
Author: adrian Date: Mon Feb 6 05:09:42 2017 New Revision: 313317 URL: https://svnweb.freebsd.org/changeset/base/313317 Log: [iwm] Change 2nd arg of iwm_phy_db_set_section() to struct iwm_rx_packet. * This matches the function declaration in Linux's iwlwifi. Obtained from:DragonflyBSD commit de7995a5e0ebf2d0016a87a0142a98c75db58fb4 Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwm_phy_db.c head/sys/dev/iwm/if_iwm_phy_db.h Modified: head/sys/dev/iwm/if_iwm.c == --- head/sys/dev/iwm/if_iwm.c Mon Feb 6 05:08:21 2017(r313316) +++ head/sys/dev/iwm/if_iwm.c Mon Feb 6 05:09:42 2017(r313317) @@ -5383,13 +5383,9 @@ iwm_notif_intr(struct iwm_softc *sc) wakeup(>sc_uc); break; } - case IWM_CALIB_RES_NOTIF_PHY_DB: { - struct iwm_calib_res_notif_phy_db *phy_db_notif; - phy_db_notif = (void *)pkt->data; - - iwm_phy_db_set_section(sc->sc_phy_db, phy_db_notif); - - break; } + case IWM_CALIB_RES_NOTIF_PHY_DB: + iwm_phy_db_set_section(sc->sc_phy_db, pkt); + break; case IWM_STATISTICS_NOTIFICATION: { struct iwm_notif_statistics *stats; Modified: head/sys/dev/iwm/if_iwm_phy_db.c == --- head/sys/dev/iwm/if_iwm_phy_db.cMon Feb 6 05:08:21 2017 (r313316) +++ head/sys/dev/iwm/if_iwm_phy_db.cMon Feb 6 05:09:42 2017 (r313317) @@ -310,8 +310,10 @@ iwm_phy_db_free(struct iwm_phy_db *phy_d int iwm_phy_db_set_section(struct iwm_phy_db *phy_db, - struct iwm_calib_res_notif_phy_db *phy_db_notif) + struct iwm_rx_packet *pkt) { + struct iwm_calib_res_notif_phy_db *phy_db_notif = + (struct iwm_calib_res_notif_phy_db *)pkt->data; enum iwm_phy_db_section_type type = le16toh(phy_db_notif->type); uint16_t size = le16toh(phy_db_notif->length); struct iwm_phy_db_entry *entry; Modified: head/sys/dev/iwm/if_iwm_phy_db.h == --- head/sys/dev/iwm/if_iwm_phy_db.hMon Feb 6 05:08:21 2017 (r313316) +++ head/sys/dev/iwm/if_iwm_phy_db.hMon Feb 6 05:09:42 2017 (r313317) @@ -111,7 +111,7 @@ struct iwm_calib_res_notif_phy_db; extern struct iwm_phy_db *iwm_phy_db_init(struct iwm_softc *sc); extern void iwm_phy_db_free(struct iwm_phy_db *phy_db); extern int iwm_phy_db_set_section(struct iwm_phy_db *phy_db, -struct iwm_calib_res_notif_phy_db *phy_db_notif); +struct iwm_rx_packet *pkt); extern int iwm_send_phy_db_data(struct iwm_phy_db *phy_db); #endif /* __IF_IWM_PHY_DB_H__ */ ___ 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"
svn commit: r313316 - head/sys/dev/iwm
Author: adrian Date: Mon Feb 6 05:08:21 2017 New Revision: 313316 URL: https://svnweb.freebsd.org/changeset/base/313316 Log: [iwm] Store paging_mem_size field in firmware image information struct. Obtained from:DragonflyBSD commit a8524cc6c440e5ce9490ba2b0507c99ff6777c6d Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwmreg.h head/sys/dev/iwm/if_iwmvar.h Modified: head/sys/dev/iwm/if_iwm.c == --- head/sys/dev/iwm/if_iwm.c Mon Feb 6 05:07:15 2017(r313315) +++ head/sys/dev/iwm/if_iwm.c Mon Feb 6 05:08:21 2017(r313316) @@ -554,6 +554,8 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode_tlv_type tlv_type; const struct firmware *fwp; const uint8_t *data; + uint32_t usniffer_img; + uint32_t paging_mem_size; int error = 0; size_t len; @@ -834,6 +836,38 @@ iwm_read_firmware(struct iwm_softc *sc, goto parse_out; break; + case IWM_UCODE_TLV_PAGING: + if (tlv_len != sizeof(uint32_t)) { + error = EINVAL; + goto parse_out; + } + paging_mem_size = le32toh(*(const uint32_t *)tlv_data); + + IWM_DPRINTF(sc, IWM_DEBUG_FIRMWARE_TLV, + "%s: Paging: paging enabled (size = %u bytes)\n", + __func__, paging_mem_size); + if (paging_mem_size > IWM_MAX_PAGING_IMAGE_SIZE) { + device_printf(sc->sc_dev, + "%s: Paging: driver supports up to %u bytes for paging image\n", + __func__, IWM_MAX_PAGING_IMAGE_SIZE); + error = EINVAL; + goto out; + } + if (paging_mem_size & (IWM_FW_PAGING_SIZE - 1)) { + device_printf(sc->sc_dev, + "%s: Paging: image isn't multiple %u\n", + __func__, IWM_FW_PAGING_SIZE); + error = EINVAL; + goto out; + } + + sc->sc_fw.fw_sects[IWM_UCODE_REGULAR].paging_mem_size = + paging_mem_size; + usniffer_img = IWM_UCODE_REGULAR_USNIFFER; + sc->sc_fw.fw_sects[usniffer_img].paging_mem_size = + paging_mem_size; + break; + case IWM_UCODE_TLV_N_SCAN_CHANNELS: if (tlv_len != sizeof(uint32_t)) { error = EINVAL; Modified: head/sys/dev/iwm/if_iwmreg.h == --- head/sys/dev/iwm/if_iwmreg.hMon Feb 6 05:07:15 2017 (r313315) +++ head/sys/dev/iwm/if_iwmreg.hMon Feb 6 05:08:21 2017 (r313316) @@ -888,6 +888,28 @@ struct iwm_fw_cipher_scheme { uint8_t hw_cipher; } __packed; +/* + * Block paging calculations + */ +#define IWM_PAGE_2_EXP_SIZE 12 /* 4K == 2^12 */ +#define IWM_FW_PAGING_SIZE (1 << IWM_PAGE_2_EXP_SIZE) /* page size is 4KB */ +#define IWM_PAGE_PER_GROUP_2_EXP_SIZE 3 +/* 8 pages per group */ +#define IWM_NUM_OF_PAGE_PER_GROUP (1 << IWM_PAGE_PER_GROUP_2_EXP_SIZE) +/* don't change, support only 32KB size */ +#define IWM_PAGING_BLOCK_SIZE (IWM_NUM_OF_PAGE_PER_GROUP * IWM_FW_PAGING_SIZE) +/* 32K == 2^15 */ +#define IWM_BLOCK_2_EXP_SIZE (IWM_PAGE_2_EXP_SIZE + IWM_PAGE_PER_GROUP_2_EXP_SIZE) + +/* + * Image paging calculations + */ +#define IWM_BLOCK_PER_IMAGE_2_EXP_SIZE 5 +/* 2^5 == 32 blocks per image */ +#define IWM_NUM_OF_BLOCK_PER_IMAGE (1 << IWM_BLOCK_PER_IMAGE_2_EXP_SIZE) +/* maximum image size 1024KB */ +#define IWM_MAX_PAGING_IMAGE_SIZE (IWM_NUM_OF_BLOCK_PER_IMAGE * IWM_PAGING_BLOCK_SIZE) + /** * struct iwm_fw_cscheme_list - a cipher scheme list * @size: a number of entries Modified: head/sys/dev/iwm/if_iwmvar.h == --- head/sys/dev/iwm/if_iwmvar.hMon Feb 6 05:07:15 2017 (r313315) +++ head/sys/dev/iwm/if_iwmvar.hMon Feb 6 05:08:21 2017 (r313316) @@ -181,6 +181,7 @@ struct iwm_fw_info { uint32_t fws_devoff; } fw_sect[IWM_UCODE_SECTION_MAX]; int fw_count; + uint32_t paging_mem_size; } fw_sects[IWM_UCODE_TYPE_MAX]; uint32_t phy_config; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to
svn commit: r313315 - head/sys/dev/iwm
Author: adrian Date: Mon Feb 6 05:07:15 2017 New Revision: 313315 URL: https://svnweb.freebsd.org/changeset/base/313315 Log: [iwm] Get rid of some gratuitous constant renaming wrt. Linux iwlwifi. * IWM_UCODE_SECT_MAX -> IWM_UCODE_SECTION_MAX * IWM_UCODE_TYPE_* -> IWM_UCODE_* (except for IWM_UCODE_TYPE_MAX which stays). Obtained from:DragonflyBSD commit ff4d1fc3ed002c9fb362423da6c45d711b65658a Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwmvar.h Modified: head/sys/dev/iwm/if_iwm.c == --- head/sys/dev/iwm/if_iwm.c Mon Feb 6 05:03:41 2017(r313314) +++ head/sys/dev/iwm/if_iwm.c Mon Feb 6 05:07:15 2017(r313315) @@ -490,7 +490,7 @@ iwm_firmware_store_section(struct iwm_so return EINVAL; fws = >sc_fw.fw_sects[type]; - if (fws->fw_count >= IWM_UCODE_SECT_MAX) + if (fws->fw_count >= IWM_UCODE_SECTION_MAX) return EINVAL; fwone = >fw_sect[fws->fw_count]; @@ -558,7 +558,7 @@ iwm_read_firmware(struct iwm_softc *sc, size_t len; if (fw->fw_status == IWM_FW_STATUS_DONE && - ucode_type != IWM_UCODE_TYPE_INIT) + ucode_type != IWM_UCODE_INIT) return 0; while (fw->fw_status == IWM_FW_STATUS_INPROGRESS) @@ -716,9 +716,9 @@ iwm_read_firmware(struct iwm_softc *sc, } case IWM_UCODE_TLV_SEC_RT: if ((error = iwm_firmware_store_section(sc, - IWM_UCODE_TYPE_REGULAR, tlv_data, tlv_len)) != 0) { + IWM_UCODE_REGULAR, tlv_data, tlv_len)) != 0) { device_printf(sc->sc_dev, - "%s: IWM_UCODE_TYPE_REGULAR: iwm_firmware_store_section() failed; %d\n", + "%s: IWM_UCODE_REGULAR: iwm_firmware_store_section() failed; %d\n", __func__, error); goto parse_out; @@ -726,9 +726,9 @@ iwm_read_firmware(struct iwm_softc *sc, break; case IWM_UCODE_TLV_SEC_INIT: if ((error = iwm_firmware_store_section(sc, - IWM_UCODE_TYPE_INIT, tlv_data, tlv_len)) != 0) { + IWM_UCODE_INIT, tlv_data, tlv_len)) != 0) { device_printf(sc->sc_dev, - "%s: IWM_UCODE_TYPE_INIT: iwm_firmware_store_section() failed; %d\n", + "%s: IWM_UCODE_INIT: iwm_firmware_store_section() failed; %d\n", __func__, error); goto parse_out; @@ -736,9 +736,9 @@ iwm_read_firmware(struct iwm_softc *sc, break; case IWM_UCODE_TLV_SEC_WOWLAN: if ((error = iwm_firmware_store_section(sc, - IWM_UCODE_TYPE_WOW, tlv_data, tlv_len)) != 0) { + IWM_UCODE_WOWLAN, tlv_data, tlv_len)) != 0) { device_printf(sc->sc_dev, - "%s: IWM_UCODE_TYPE_WOW: iwm_firmware_store_section() failed; %d\n", + "%s: IWM_UCODE_WOWLAN: iwm_firmware_store_section() failed; %d\n", __func__, error); goto parse_out; @@ -829,7 +829,7 @@ iwm_read_firmware(struct iwm_softc *sc, case IWM_UCODE_TLV_SEC_RT_USNIFFER: if ((error = iwm_firmware_store_section(sc, - IWM_UCODE_TYPE_REGULAR_USNIFFER, tlv_data, + IWM_UCODE_REGULAR_USNIFFER, tlv_data, tlv_len)) != 0) goto parse_out; break; @@ -2492,7 +2492,7 @@ iwm_load_cpu_sections_8000(struct iwm_so (*first_ucode_section)++; } - for (i = *first_ucode_section; i < IWM_UCODE_SECT_MAX; i++) { + for (i = *first_ucode_section; i < IWM_UCODE_SECTION_MAX; i++) { last_read_idx = i; data = fws->fw_sect[i].fws_data; dlen = fws->fw_sect[i].fws_len; @@ -2764,7 +2764,7 @@ iwm_run_init_mvm_ucode(struct iwm_softc sc->sc_init_complete = 0; if ((error = iwm_mvm_load_ucode_wait_alive(sc, - IWM_UCODE_TYPE_INIT)) != 0) { + IWM_UCODE_INIT)) != 0) { device_printf(sc->sc_dev, "failed to load init firmware\n"); return error; } @@ -4706,7 +4706,7 @@ iwm_init_hw(struct iwm_softc *sc) } /* omstart, this time with the regular firmware */ - error =
svn commit: r313314 - head/sys/dev/iwm
Author: adrian Date: Mon Feb 6 05:03:41 2017 New Revision: 313314 URL: https://svnweb.freebsd.org/changeset/base/313314 Log: [iwm] Sync valid_tx_ant and valid_rx_ant mask handling with iwlwifi. * This fixes the phy_cfg field sent in the iwm_send_phy_cfg_cmd() command, which wasn't taking into account the valid_rx_ant and valid_tx_ant masks from nvm_data before. Tested: * 7260, STA mode, 2G and 5G Obtained from:DragonflyBSD commit cbb82693c18fd71b4eb86855b82d03995f352d65 Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwm_phy_ctxt.c head/sys/dev/iwm/if_iwm_scan.c head/sys/dev/iwm/if_iwm_util.c head/sys/dev/iwm/if_iwm_util.h head/sys/dev/iwm/if_iwmvar.h Modified: head/sys/dev/iwm/if_iwm.c == --- head/sys/dev/iwm/if_iwm.c Mon Feb 6 04:30:18 2017(r313313) +++ head/sys/dev/iwm/if_iwm.c Mon Feb 6 05:03:41 2017(r313314) @@ -771,8 +771,14 @@ iwm_read_firmware(struct iwm_softc *sc, (int) tlv_len); goto parse_out; } - sc->sc_fw_phy_config = + sc->sc_fw.phy_config = le32toh(*(const uint32_t *)tlv_data); + sc->sc_fw.valid_tx_ant = (sc->sc_fw.phy_config & + IWM_FW_PHY_CFG_TX_CHAIN) >> + IWM_FW_PHY_CFG_TX_CHAIN_POS; + sc->sc_fw.valid_rx_ant = (sc->sc_fw.phy_config & + IWM_FW_PHY_CFG_RX_CHAIN) >> + IWM_FW_PHY_CFG_RX_CHAIN_POS; break; case IWM_UCODE_TLV_API_CHANGES_SET: { @@ -1401,12 +1407,13 @@ iwm_mvm_nic_config(struct iwm_softc *sc) { uint8_t radio_cfg_type, radio_cfg_step, radio_cfg_dash; uint32_t reg_val = 0; + uint32_t phy_config = iwm_mvm_get_phy_config(sc); - radio_cfg_type = (sc->sc_fw_phy_config & IWM_FW_PHY_CFG_RADIO_TYPE) >> + radio_cfg_type = (phy_config & IWM_FW_PHY_CFG_RADIO_TYPE) >> IWM_FW_PHY_CFG_RADIO_TYPE_POS; - radio_cfg_step = (sc->sc_fw_phy_config & IWM_FW_PHY_CFG_RADIO_STEP) >> + radio_cfg_step = (phy_config & IWM_FW_PHY_CFG_RADIO_STEP) >> IWM_FW_PHY_CFG_RADIO_STEP_POS; - radio_cfg_dash = (sc->sc_fw_phy_config & IWM_FW_PHY_CFG_RADIO_DASH) >> + radio_cfg_dash = (phy_config & IWM_FW_PHY_CFG_RADIO_DASH) >> IWM_FW_PHY_CFG_RADIO_DASH_POS; /* SKU control */ @@ -2696,7 +2703,7 @@ iwm_send_phy_cfg_cmd(struct iwm_softc *s enum iwm_ucode_type ucode_type = sc->sc_uc_current; /* Set parameters */ - phy_cfg_cmd.phy_cfg = htole32(sc->sc_fw_phy_config); + phy_cfg_cmd.phy_cfg = htole32(iwm_mvm_get_phy_config(sc)); phy_cfg_cmd.calib_control.event_trigger = sc->sc_default_calib[ucode_type].event_trigger; phy_cfg_cmd.calib_control.flow_trigger = @@ -2783,6 +2790,7 @@ iwm_run_init_mvm_ucode(struct iwm_softc if (error != 0) return error; +#if 0 IWM_DPRINTF(sc, IWM_DEBUG_RESET, "%s: phy_txant=0x%08x, nvm_valid_tx_ant=0x%02x, valid=0x%02x\n", __func__, @@ -2790,10 +2798,11 @@ iwm_run_init_mvm_ucode(struct iwm_softc >> IWM_FW_PHY_CFG_TX_CHAIN_POS), sc->nvm_data->valid_tx_ant, iwm_fw_valid_tx_ant(sc)); - +#endif /* Send TX valid antennas before triggering calibrations */ - if ((error = iwm_send_tx_ant_cfg(sc, iwm_fw_valid_tx_ant(sc))) != 0) { + error = iwm_send_tx_ant_cfg(sc, iwm_mvm_get_valid_tx_ant(sc)); + if (error != 0) { device_printf(sc->sc_dev, "failed to send antennas before calibration: %d\n", error); return error; @@ -4238,11 +4247,11 @@ iwm_setrates(struct iwm_softc *sc, struc #if 0 if (txant == 0) - txant = iwm_fw_valid_tx_ant(sc); + txant = iwm_mvm_get_valid_tx_ant(sc); nextant = 1<<(ffs(txant)-1); txant &= ~nextant; #else - nextant = iwm_fw_valid_tx_ant(sc); + nextant = iwm_mvm_get_valid_tx_ant(sc); #endif /* * Map the rate id into a rate index into @@ -4708,7 +4717,8 @@ iwm_init_hw(struct iwm_softc *sc) goto error; } - if ((error = iwm_send_tx_ant_cfg(sc, iwm_fw_valid_tx_ant(sc))) != 0) { + error = iwm_send_tx_ant_cfg(sc, iwm_mvm_get_valid_tx_ant(sc)); + if (error != 0) { device_printf(sc->sc_dev, "antenna config failed\n"); goto error; } Modified: head/sys/dev/iwm/if_iwm_phy_ctxt.c
svn commit: r313312 - head/sys/dev/iwm
Author: adrian Date: Mon Feb 6 03:29:50 2017 New Revision: 313312 URL: https://svnweb.freebsd.org/changeset/base/313312 Log: [iwm] Use chipset configuration structs like iwlwifi does. * This makes it a bit easier to factor out common parts for e.g. the 7000 chipset family. * Add iwm7265d config, and recognize the 7265D chipset variant via the hardware revision. Tested: * 7260, STA mode (2ghz) Obtained from:Dragonflybsd commit cc8d6ccf5583fd45964f3bde9b057ee4f834c0e0 Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwm_pcie_trans.c head/sys/dev/iwm/if_iwmvar.h Modified: head/sys/dev/iwm/if_iwm.c == --- head/sys/dev/iwm/if_iwm.c Mon Feb 6 03:06:11 2017(r313311) +++ head/sys/dev/iwm/if_iwm.c Mon Feb 6 03:29:50 2017(r313312) @@ -165,6 +165,67 @@ __FBSDID("$FreeBSD$"); #include #include +#define IWM_NVM_HW_SECTION_NUM_FAMILY_7000 0 +#define IWM_NVM_HW_SECTION_NUM_FAMILY_8000 10 + +/* lower blocks contain EEPROM image and calibration data */ +#define IWM_OTP_LOW_IMAGE_SIZE_FAMILY_7000 (16 * 512 * sizeof(uint16_t)) /* 16 KB */ +#define IWM_OTP_LOW_IMAGE_SIZE_FAMILY_8000 (32 * 512 * sizeof(uint16_t)) /* 32 KB */ + +#define IWM7260_FW "iwm7260fw" +#define IWM3160_FW "iwm3160fw" +#define IWM7265_FW "iwm7265fw" +#define IWM7265D_FW"iwm7265Dfw" +#define IWM8000_FW "iwm8000Cfw" + +#define IWM_DEVICE_7000_COMMON \ + .device_family = IWM_DEVICE_FAMILY_7000,\ + .eeprom_size = IWM_OTP_LOW_IMAGE_SIZE_FAMILY_7000, \ + .nvm_hw_section_num = IWM_NVM_HW_SECTION_NUM_FAMILY_7000 + +const struct iwm_cfg iwm7260_cfg = { + .fw_name = IWM7260_FW, + IWM_DEVICE_7000_COMMON, + .host_interrupt_operation_mode = 1, +}; + +const struct iwm_cfg iwm3160_cfg = { + .fw_name = IWM3160_FW, + IWM_DEVICE_7000_COMMON, + .host_interrupt_operation_mode = 1, +}; + +const struct iwm_cfg iwm3165_cfg = { + /* XXX IWM7265D_FW doesn't seem to work properly yet */ + .fw_name = IWM7265_FW, + IWM_DEVICE_7000_COMMON, + .host_interrupt_operation_mode = 0, +}; + +const struct iwm_cfg iwm7265_cfg = { + .fw_name = IWM7265_FW, + IWM_DEVICE_7000_COMMON, + .host_interrupt_operation_mode = 0, +}; + +const struct iwm_cfg iwm7265d_cfg = { + /* XXX IWM7265D_FW doesn't seem to work properly yet */ + .fw_name = IWM7265_FW, + IWM_DEVICE_7000_COMMON, + .host_interrupt_operation_mode = 0, +}; + +#define IWM_DEVICE_8000_COMMON \ + .device_family = IWM_DEVICE_FAMILY_8000,\ + .eeprom_size = IWM_OTP_LOW_IMAGE_SIZE_FAMILY_8000, \ + .nvm_hw_section_num = IWM_NVM_HW_SECTION_NUM_FAMILY_8000 + +const struct iwm_cfg iwm8260_cfg = { + .fw_name = IWM8000_FW, + IWM_DEVICE_8000_COMMON, + .host_interrupt_operation_mode = 0, +}; + const uint8_t iwm_nvm_channels[] = { /* 2.4 GHz */ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, @@ -512,12 +573,12 @@ iwm_read_firmware(struct iwm_softc *sc, * fw_fp will be set. */ IWM_UNLOCK(sc); - fwp = firmware_get(sc->sc_fwname); + fwp = firmware_get(sc->cfg->fw_name); IWM_LOCK(sc); if (fwp == NULL) { device_printf(sc->sc_dev, "could not read firmware %s (error %d)\n", - sc->sc_fwname, error); + sc->cfg->fw_name, error); goto out; } fw->fw_fp = fwp; @@ -536,7 +597,7 @@ iwm_read_firmware(struct iwm_softc *sc, if (*(const uint32_t *)fw->fw_fp->data != 0 || le32toh(uhdr->magic) != IWM_TLV_UCODE_MAGIC) { device_printf(sc->sc_dev, "invalid firmware %s\n", - sc->sc_fwname); + sc->cfg->fw_name); error = EINVAL; goto out; } @@ -1370,7 +1431,7 @@ iwm_mvm_nic_config(struct iwm_softc *sc) * (PCIe power is lost before PERST# is asserted), causing ME FW * to lose ownership and not being able to obtain it back. */ - if (sc->sc_device_family == IWM_DEVICE_FAMILY_7000) { + if (sc->cfg->device_family == IWM_DEVICE_FAMILY_7000) { iwm_set_bits_mask_prph(sc, IWM_APMG_PS_CTRL_REG, IWM_APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS, ~IWM_APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS); @@ -1416,7 +1477,7 @@ iwm_nic_rx_init(struct iwm_softc *sc) IWM_WRITE_1(sc, IWM_CSR_INT_COALESCING, IWM_HOST_INT_TIMEOUT_DEF); /* W/A for interrupt coalescing bug in 7260 and 3160 */ - if (sc->host_interrupt_operation_mode) + if (sc->cfg->host_interrupt_operation_mode) IWM_SETBITS(sc,
svn commit: r313311 - head/sys/dev/iwm
Author: adrian Date: Mon Feb 6 03:06:11 2017 New Revision: 313311 URL: https://svnweb.freebsd.org/changeset/base/313311 Log: [iwm] Sync nvm parsing code with Linux iwlwifi. * sc->sc_nvm becomes sc->nvm_data and is now a pointer instead of an inlined struct. * Add sc->eeprom_size and sc->nvm_hw_section_num configuration values to struct iwm_softc. * For now continue to avoid negative error return-values, and use pointer variables for some return values, as before. * Continue to omit LAR (location aware regulatory) related code as well. Tested: * Intel 7260, STA mode (2GHz) Obtained from:dragonflybsd commit 39f8331b1a6f295291e08c377da12a8e7a5436c0 Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwm_scan.c head/sys/dev/iwm/if_iwm_util.c head/sys/dev/iwm/if_iwmreg.h head/sys/dev/iwm/if_iwmvar.h Modified: head/sys/dev/iwm/if_iwm.c == --- head/sys/dev/iwm/if_iwm.c Mon Feb 6 02:20:05 2017(r313310) +++ head/sys/dev/iwm/if_iwm.c Mon Feb 6 03:06:11 2017(r313311) @@ -260,20 +260,23 @@ static intiwm_post_alive(struct iwm_sof static int iwm_nvm_read_chunk(struct iwm_softc *, uint16_t, uint16_t, uint16_t, uint8_t *, uint16_t *); static int iwm_nvm_read_section(struct iwm_softc *, uint16_t, uint8_t *, -uint16_t *, size_t); +uint16_t *, uint32_t); static uint32_tiwm_eeprom_channel_flags(uint16_t); static voidiwm_add_channel_band(struct iwm_softc *, struct ieee80211_channel[], int, int *, int, size_t, const uint8_t[]); static voidiwm_init_channel_map(struct ieee80211com *, int, int *, struct ieee80211_channel[]); -static int iwm_parse_nvm_data(struct iwm_softc *, const uint16_t *, - const uint16_t *, const uint16_t *, - const uint16_t *, const uint16_t *, - const uint16_t *); -static voidiwm_set_hw_address_8000(struct iwm_softc *, - struct iwm_nvm_data *, - const uint16_t *, const uint16_t *); +static struct iwm_nvm_data * + iwm_parse_nvm_data(struct iwm_softc *, const uint16_t *, + const uint16_t *, const uint16_t *, + const uint16_t *, const uint16_t *, + const uint16_t *); +static voidiwm_free_nvm_data(struct iwm_nvm_data *); +static voidiwm_set_hw_address_family_8000(struct iwm_softc *, + struct iwm_nvm_data *, + const uint16_t *, + const uint16_t *); static int iwm_get_sku(const struct iwm_softc *, const uint16_t *, const uint16_t *); static int iwm_get_nvm_version(const struct iwm_softc *, const uint16_t *); @@ -283,8 +286,8 @@ static int iwm_get_n_hw_addrs(const stru const uint16_t *); static voidiwm_set_radio_cfg(const struct iwm_softc *, struct iwm_nvm_data *, uint32_t); -static int iwm_parse_nvm_sections(struct iwm_softc *, - struct iwm_nvm_section *); +static struct iwm_nvm_data * + iwm_parse_nvm_sections(struct iwm_softc *, struct iwm_nvm_section *); static int iwm_nvm_init(struct iwm_softc *); static int iwm_firmware_load_sect(struct iwm_softc *, uint32_t, const uint8_t *, uint32_t); @@ -1646,21 +1649,11 @@ iwm_post_alive(struct iwm_softc *sc) * iwlwifi/mvm/nvm.c */ -/* list of NVM sections we are allowed/need to read */ -const int nvm_to_read[] = { - IWM_NVM_SECTION_TYPE_HW, - IWM_NVM_SECTION_TYPE_SW, - IWM_NVM_SECTION_TYPE_REGULATORY, - IWM_NVM_SECTION_TYPE_CALIBRATION, - IWM_NVM_SECTION_TYPE_PRODUCTION, - IWM_NVM_SECTION_TYPE_HW_8000, - IWM_NVM_SECTION_TYPE_MAC_OVERRIDE, - IWM_NVM_SECTION_TYPE_PHY_SKU, -}; +#define IWM_NVM_HW_SECTION_NUM_FAMILY_7000 0 +#define IWM_NVM_HW_SECTION_NUM_FAMILY_8000 10 /* Default NVM size to read */ #define IWM_NVM_DEFAULT_CHUNK_SIZE (2*1024) -#define IWM_MAX_NVM_SECTION_SIZE 8192 #define IWM_NVM_WRITE_OPCODE 1 #define IWM_NVM_READ_OPCODE 0 @@ -1675,7 +1668,6 @@ static int iwm_nvm_read_chunk(struct iwm_softc *sc, uint16_t section, uint16_t offset, uint16_t length, uint8_t *data, uint16_t *len) { - offset = 0; struct iwm_nvm_access_cmd nvm_access_cmd = { .offset = htole16(offset), .length = htole16(length), @@ -1702,17 +1694,9 @@ iwm_nvm_read_chunk(struct
svn commit: r313310 - head/sys/dev/iwm
Author: adrian Date: Mon Feb 6 02:20:05 2017 New Revision: 313310 URL: https://svnweb.freebsd.org/changeset/base/313310 Log: [iwm] make sure we call iwm_detach_local() only once. Obtained from:DragonflyBSD git ebd4ceab76a6f161362029cbfd08efaedaab0519 Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwmvar.h Modified: head/sys/dev/iwm/if_iwm.c == --- head/sys/dev/iwm/if_iwm.c Mon Feb 6 02:14:34 2017(r313309) +++ head/sys/dev/iwm/if_iwm.c Mon Feb 6 02:20:05 2017(r313310) @@ -5766,6 +5766,7 @@ iwm_attach(device_t dev) int txq_i, i; sc->sc_dev = dev; + sc->sc_attached = 1; IWM_LOCK_INIT(sc); mbufq_init(>sc_snd, ifqmaxlen); callout_init_mtx(>sc_watchdog_to, >sc_mtx, 0); @@ -6218,6 +6219,10 @@ iwm_detach_local(struct iwm_softc *sc, i device_t dev = sc->sc_dev; int i; + if (!sc->sc_attached) + return 0; + sc->sc_attached = 0; + if (do_net80211) ieee80211_draintask(>sc_ic, >sc_es_task); Modified: head/sys/dev/iwm/if_iwmvar.h == --- head/sys/dev/iwm/if_iwmvar.hMon Feb 6 02:14:34 2017 (r313309) +++ head/sys/dev/iwm/if_iwmvar.hMon Feb 6 02:20:05 2017 (r313310) @@ -369,6 +369,7 @@ struct iwm_node { struct iwm_softc { device_tsc_dev; uint32_tsc_debug; + int sc_attached; struct mtx sc_mtx; struct mbufqsc_snd; ___ 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"
svn commit: r313309 - head/sys/dev/iwm
Author: adrian Date: Mon Feb 6 02:14:34 2017 New Revision: 313309 URL: https://svnweb.freebsd.org/changeset/base/313309 Log: [iwm] Sync if_iwm_phy_db code with Linux iwlwifi. Obtained from:Dragonflybsd commit c1019b6bfff36c856f7b4fccbdf3bb13ac27750c Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwm_phy_db.c head/sys/dev/iwm/if_iwm_phy_db.h head/sys/dev/iwm/if_iwmreg.h head/sys/dev/iwm/if_iwmvar.h Modified: head/sys/dev/iwm/if_iwm.c == --- head/sys/dev/iwm/if_iwm.c Mon Feb 6 02:01:22 2017(r313308) +++ head/sys/dev/iwm/if_iwm.c Mon Feb 6 02:14:34 2017(r313309) @@ -4619,11 +4619,9 @@ iwm_init_hw(struct iwm_softc *sc) goto error; } - /* Send phy db control command and then phy db calibration*/ - if ((error = iwm_send_phy_db_data(sc)) != 0) { - device_printf(sc->sc_dev, "phy_db_data failed\n"); + /* Send phy db control command and then phy db calibration */ + if ((error = iwm_send_phy_db_data(sc->sc_phy_db)) != 0) goto error; - } if ((error = iwm_send_phy_cfg_cmd(sc)) != 0) { device_printf(sc->sc_dev, "phy_cfg_cmd failed\n"); @@ -5251,7 +5249,7 @@ iwm_notif_intr(struct iwm_softc *sc) struct iwm_calib_res_notif_phy_db *phy_db_notif; phy_db_notif = (void *)pkt->data; - iwm_phy_db_set_section(sc, phy_db_notif); + iwm_phy_db_set_section(sc->sc_phy_db, phy_db_notif); break; } @@ -5774,6 +5772,13 @@ iwm_attach(device_t dev) callout_init_mtx(>sc_led_blink_to, >sc_mtx, 0); TASK_INIT(>sc_es_task, 0, iwm_endscan_cb, sc); + /* Init phy db */ + sc->sc_phy_db = iwm_phy_db_init(sc); + if (!sc->sc_phy_db) { + device_printf(dev, "Cannot init phy_db\n"); + goto fail; + } + /* PCI attach */ error = iwm_pci_attach(dev); if (error != 0) @@ -6223,7 +6228,8 @@ iwm_detach_local(struct iwm_softc *sc, i ieee80211_ifdetach(>sc_ic); } - iwm_phy_db_free(sc); + iwm_phy_db_free(sc->sc_phy_db); + sc->sc_phy_db = NULL; /* Free descriptor rings */ iwm_free_rx_ring(sc, >rxq); Modified: head/sys/dev/iwm/if_iwm_phy_db.c == --- head/sys/dev/iwm/if_iwm_phy_db.cMon Feb 6 02:01:22 2017 (r313308) +++ head/sys/dev/iwm/if_iwm_phy_db.cMon Feb 6 02:14:34 2017 (r313309) @@ -150,26 +150,104 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include -#include -#include +#include "if_iwmreg.h" +#include "if_iwmvar.h" +#include "if_iwm_debug.h" +#include "if_iwm_util.h" +#include "if_iwm_phy_db.h" + +#define CHANNEL_NUM_SIZE 4 /* num of channels in calib_ch size */ + +struct iwm_phy_db_entry { + uint16_tsize; + uint8_t *data; +}; + +/** + * struct iwm_phy_db - stores phy configuration and calibration data. + * + * @cfg: phy configuration. + * @calib_nch: non channel specific calibration data. + * @calib_ch: channel specific calibration data. + * @n_group_papd: number of entries in papd channel group. + * @calib_ch_group_papd: calibration data related to papd channel group. + * @n_group_txp: number of entries in tx power channel group. + * @calib_ch_group_txp: calibration data related to tx power chanel group. + */ +struct iwm_phy_db { + struct iwm_phy_db_entry cfg; + struct iwm_phy_db_entry calib_nch; + int n_group_papd; + struct iwm_phy_db_entry *calib_ch_group_papd; + int n_group_txp; + struct iwm_phy_db_entry *calib_ch_group_txp; + + struct iwm_softc *sc; +}; + +enum iwm_phy_db_section_type { + IWM_PHY_DB_CFG = 1, + IWM_PHY_DB_CALIB_NCH, + IWM_PHY_DB_UNUSED, + IWM_PHY_DB_CALIB_CHG_PAPD, + IWM_PHY_DB_CALIB_CHG_TXP, + IWM_PHY_DB_MAX +}; + +#define PHY_DB_CMD 0x6c/* TEMP API - The actual is 0x8c */ + +/* + * phy db - configure operational ucode + */ +struct iwm_phy_db_cmd { + uint16_t type; + uint16_t length; + uint8_t data[]; +} __packed; + +/* for parsing of tx power channel group data that comes from the firmware*/ +struct iwm_phy_db_chg_txp { + uint32_t space; + uint16_t max_channel_idx; +} __packed; /* - * BEGIN iwl-phy-db.c + * phy db - Receive phy db chunk after calibrations */ +struct iwm_calib_res_notif_phy_db { + uint16_t type; + uint16_t length; + uint8_t data[]; +} __packed; + +struct iwm_phy_db * +iwm_phy_db_init(struct iwm_softc *sc) +{ + struct iwm_phy_db *phy_db = malloc(sizeof(struct iwm_phy_db), + M_DEVBUF, M_NOWAIT | M_ZERO); + + if (!phy_db) + return phy_db; + + phy_db->sc = sc;
svn commit: r313308 - head/sys/dev/iwm
Author: adrian Date: Mon Feb 6 02:01:22 2017 New Revision: 313308 URL: https://svnweb.freebsd.org/changeset/base/313308 Log: [iwm] The HW Revision stepping constants should be in if_iwmreg.h. Obtained from:dragonflybsd 84292f0c38594c462c719c0e59da5908b93aba5f Modified: head/sys/dev/iwm/if_iwmreg.h head/sys/dev/iwm/if_iwmvar.h Modified: head/sys/dev/iwm/if_iwmreg.h == --- head/sys/dev/iwm/if_iwmreg.hMon Feb 6 01:57:59 2017 (r313307) +++ head/sys/dev/iwm/if_iwmreg.hMon Feb 6 02:01:22 2017 (r313308) @@ -297,6 +297,16 @@ #define IWM_CSR_HW_REV_DASH(_val) (((_val) & 0x003) >> 0) #define IWM_CSR_HW_REV_STEP(_val) (((_val) & 0x00C) >> 2) +/** + * hw_rev values + */ +enum { + IWM_SILICON_A_STEP = 0, + IWM_SILICON_B_STEP, + IWM_SILICON_C_STEP, +}; + + #define IWM_CSR_HW_REV_TYPE_MSK(0x000FFF0) #define IWM_CSR_HW_REV_TYPE_5300 (0x020) #define IWM_CSR_HW_REV_TYPE_5350 (0x030) Modified: head/sys/dev/iwm/if_iwmvar.h == --- head/sys/dev/iwm/if_iwmvar.hMon Feb 6 01:57:59 2017 (r313307) +++ head/sys/dev/iwm/if_iwmvar.hMon Feb 6 02:01:22 2017 (r313308) @@ -432,10 +432,6 @@ struct iwm_softc { int ict_cur; int sc_hw_rev; -#define IWM_SILICON_A_STEP 0 -#define IWM_SILICON_B_STEP 1 -#define IWM_SILICON_C_STEP 2 -#define IWM_SILICON_D_STEP 3 int sc_hw_id; int sc_device_family; #define IWM_DEVICE_FAMILY_7000 1 ___ 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"
svn commit: r313307 - head/sys/dev/iwm
Author: adrian Date: Mon Feb 6 01:57:59 2017 New Revision: 313307 URL: https://svnweb.freebsd.org/changeset/base/313307 Log: [iwm] TODO for QOS support. Modified: head/sys/dev/iwm/if_iwm_mac_ctxt.c Modified: head/sys/dev/iwm/if_iwm_mac_ctxt.c == --- head/sys/dev/iwm/if_iwm_mac_ctxt.c Mon Feb 6 01:57:41 2017 (r313306) +++ head/sys/dev/iwm/if_iwm_mac_ctxt.c Mon Feb 6 01:57:59 2017 (r313307) @@ -318,6 +318,11 @@ iwm_mvm_mac_ctxt_cmd_common(struct iwm_s = htole32((ic->ic_flags & IEEE80211_F_SHSLOT) ? IWM_MAC_FLG_SHORT_SLOT : 0); + /* +* XXX TODO: if we're doing QOS.. +* cmd->qos_flags |= cpu_to_le32(MAC_QOS_FLG_UPDATE_EDCA) +*/ + /* XXX TODO: set wme parameters; also handle getting updated wme parameters */ for (i = 0; i < IWM_AC_NUM+1; i++) { int txf = i; ___ 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"
svn commit: r313306 - head/sys/dev/iwm
Author: adrian Date: Mon Feb 6 01:57:41 2017 New Revision: 313306 URL: https://svnweb.freebsd.org/changeset/base/313306 Log: [iwm] free node reference if rxparams addition fails. Modified: head/sys/dev/iwm/if_iwm.c Modified: head/sys/dev/iwm/if_iwm.c == --- head/sys/dev/iwm/if_iwm.c Sun Feb 5 22:18:45 2017(r313305) +++ head/sys/dev/iwm/if_iwm.c Mon Feb 6 01:57:41 2017(r313306) @@ -2994,8 +2994,11 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, /* rssi is in 1/2db units */ rxs.c_rssi = rssi * 2; rxs.c_nf = sc->sc_noise; - if (ieee80211_add_rx_params(m, ) == 0) + if (ieee80211_add_rx_params(m, ) == 0) { + if (ni) + ieee80211_free_node(ni); goto fail; + } if (ieee80211_radiotap_active_vap(vap)) { struct iwm_rx_radiotap_header *tap = >sc_rxtap; @@ -3042,7 +3045,8 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, return; -fail: counter_u64_add(ic->ic_ierrors, 1); +fail: + counter_u64_add(ic->ic_ierrors, 1); } static int ___ 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: r313037 - in head/sys: amd64/include kern mips/include net powerpc/include sparc64/include
On 05.02.17 19:59, Jason Harmening wrote: Actually attaching the patch this time ( gmail client) On Sun, Feb 5, 2017 at 10:58 AM, Jason Harmening> wrote: Hmm, it's a good idea to consider the possibility of a barrier issue. It wouldn't be the first time we've had such a problem on a weakly-ordered architecture. That said, I don't see a problem in this case. smp_rendezvous_cpus() takes a spinlock and then issues atomic_store_rel_int() to ensure the rendezvous params are visible to other cpus. The latter corresponds to lwsync on powerpc, which AFAIK should be sufficient to ensure visibility of prior stores. For now I'm going with the simpler explanation that I made a bad assumption in the powerpc get_pcpu() and there is some context in which the read of sprg0 doesn't return a consistent pointer value. Unfortunately I don't see where that might be right now. On the mips side, Kurt/Alexander can you test the attached patch? It contains a simple fix to ensure get_pcpu() returns the consistent per-cpu pointer. Here the panic I received with the latest patch you sent. World & kernel are on 313286 + patch. https://people.freebsd.org/~andreast/pcpu/ It is the same panic, pic 2 is with a try to get a core The load issue was a gmake -j8 bootstrap of todays gcc trunk sources. The machine has 2 physical CPU's, two threads pre cpu :) I revert now and see if the situation becomes stable again or if there is something else. Andreas ___ 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: r313037 - in head/sys: amd64/include kern mips/include net powerpc/include sparc64/include
Actually attaching the patch this time ( gmail client) On Sun, Feb 5, 2017 at 10:58 AM, Jason Harmeningwrote: > Hmm, it's a good idea to consider the possibility of a barrier issue. It > wouldn't be the first time we've had such a problem on a weakly-ordered > architecture. That said, I don't see a problem in this case. > smp_rendezvous_cpus() takes a spinlock and then issues > atomic_store_rel_int() to ensure the rendezvous params are visible to > other cpus. The latter corresponds to lwsync on powerpc, which AFAIK > should be sufficient to ensure visibility of prior stores. > > For now I'm going with the simpler explanation that I made a bad > assumption in the powerpc get_pcpu() and there is some context in which > the read of sprg0 doesn't return a consistent pointer value. Unfortunately > I don't see where that might be right now. > > On the mips side, Kurt/Alexander can you test the attached patch? It > contains a simple fix to ensure get_pcpu() returns the consistent per-cpu > pointer. > > On Sat, Feb 4, 2017 at 1:34 PM, Svatopluk Kraus wrote: > >> Probably not related. But when I took short look to the patch to see >> what could go wrong, I walked into the following comment in >> _rm_wlock(): "Assumes rm->rm_writecpus update is visible on other CPUs >> before rm_cleanIPI is called." There is no explicit barrier to ensure >> it. However, there might be some barriers inside of >> smp_rendezvous_cpus(). I have no idea what could happened if this >> assumption is not met. Note that rm_cleanIPI() is affected by the >> patch. >> >> >> >> On Sat, Feb 4, 2017 at 9:39 PM, Jason Harmening >> wrote: >> > Can you post an example of such panic? Only 2 MI pieces were changed, >> > netisr and rmlock. I haven't seen problems on my own amd64/i386/arm >> testing >> > of this, so a backtrace might help to narrow down the cause. >> > >> > On Sat, Feb 4, 2017 at 12:22 PM, Andreas Tobler >> > wrote: >> >> >> >> On 04.02.17 20:54, Jason Harmening wrote: >> >>> >> >>> I suspect this broke rmlocks for mips because the rmlock >> implementation >> >>> takes the address of the per-CPU pc_rm_queue when building tracker >> >>> lists. That address may be later accessed from another CPU and will >> >>> then translate to the wrong physical region if the address was taken >> >>> relative to the globally-constant pcpup VA used on mips. >> >>> >> >>> Regardless, for mips get_pcpup() should be implemented as >> >>> pcpu_find(curcpu) since returning an address that may mean something >> >>> different depending on the CPU seems like a big POLA violation if >> >>> nothing else. >> >>> >> >>> I'm more concerned about the report of powerpc breakage. For powerpc >> we >> >>> simply take each pcpu pointer from the pc_allcpu list (which is the >> same >> >>> value stored in the cpuid_to_pcpu array) and pass it through the >> ap_pcpu >> >>> global to each AP's startup code, which then stores it in sprg0. It >> >>> should be globally unique and won't have the variable-translation >> issues >> >>> seen on mips. Andreas, are you certain this change was responsible >> the >> >>> breakage you saw, and was it the same sort of hang observed on mips? >> >> >> >> >> >> I'm really sure. 313036 booted fine, allowed me to execute heavy >> >> compilation jobs, np. 313037 on the other side gave me various >> patterns of >> >> panics. During startup, but I also succeeded to get into multiuser and >> then >> >> the panic happend during port building. >> >> >> >> I have no deeper inside where pcpu data is used. Justin mentioned >> netisr? >> >> >> >> Andreas >> >> >> > >> > > Index: sys/amd64/include/pcpu.h === --- sys/amd64/include/pcpu.h(revision 313193) +++ sys/amd64/include/pcpu.h(working copy) @@ -78,6 +78,7 @@ extern struct pcpu *pcpup; +#defineget_pcpu() (pcpup) #definePCPU_GET(member)(pcpup->pc_ ## member) #definePCPU_ADD(member, val) (pcpup->pc_ ## member += (val)) #definePCPU_INC(member)PCPU_ADD(member, 1) @@ -203,6 +204,15 @@ } \ } +#defineget_pcpu() __extension__ ({ \ + struct pcpu *__pc; \ + \ + __asm __volatile("movq %%gs:%1,%0" \ + : "=r" (__pc) \ + : "m" (*(struct pcpu *)(__pcpu_offset(pc_prvspace; \ + __pc; \ +}) + #definePCPU_GET(member)__PCPU_GET(pc_ ## member) #definePCPU_ADD(member, val) __PCPU_ADD(pc_ ## member, val) #define
svn commit: r313305 - stable/11/share/misc
Author: bcr (doc committer) Date: Sun Feb 5 22:18:45 2017 New Revision: 313305 URL: https://svnweb.freebsd.org/changeset/base/313305 Log: MFC r303802: Update with the members of the 9th core team. Modified: stable/11/share/misc/organization.dot Directory Properties: stable/11/ (props changed) Modified: stable/11/share/misc/organization.dot == --- stable/11/share/misc/organization.dot Sun Feb 5 21:56:36 2017 (r313304) +++ stable/11/share/misc/organization.dot Sun Feb 5 22:18:45 2017 (r313305) @@ -25,7 +25,7 @@ _misc [label="Miscellaneous Hats"] # Development teams go here alphabetically sorted -core [label="Core Team\nc...@freebsd.org\nbapt, emaste, gavin,\nglebius, gnn, hrs,\npeter, rwatson, theraven"] +core [label="Core Team\nc...@freebsd.org\nallanjude, bapt, bcr,\nbenno, emaste, gnn,\nhrs, jhb, kmoore"] coresecretary [label="Core Team Secretary\ncore-secret...@freebsd.org\nmatthew"] doccommitters [label="Doc/www Committers\ndoc-committ...@freebsd.org"] doceng [label="Documentation Engineering Team\ndoc...@freebsd.org\ngjb, blackend,\ngabor, hrs"] ___ 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"
svn commit: r313304 - stable/11/share/man/man4
Author: bcr (doc committer) Date: Sun Feb 5 21:56:36 2017 New Revision: 313304 URL: https://svnweb.freebsd.org/changeset/base/313304 Log: MFC r308583: Fix a broken link to the USB audio class specs. PR: 214240 Submitted by: Tobias Kortkamp t...@tobik.me Modified: stable/11/share/man/man4/snd_uaudio.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/snd_uaudio.4 == --- stable/11/share/man/man4/snd_uaudio.4 Sun Feb 5 21:31:40 2017 (r313303) +++ stable/11/share/man/man4/snd_uaudio.4 Sun Feb 5 21:56:36 2017 (r313304) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 19, 2015 +.Dd November 12, 2016 .Dt SND_UAUDIO 4 .Os .Sh NAME @@ -73,7 +73,7 @@ for more information. .Xr usb 4 .Rs .%T "USB Audio Class Specifications" -.%U http://www.usb.org/developers/devclass_docs/ +.%U http://www.usb.org/developers/docs/devclass_docs/ .Re .Sh HISTORY The ___ 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"
svn commit: r313303 - in stable/10: sys/kern tests/sys/kern
Author: jilles Date: Sun Feb 5 21:31:40 2017 New Revision: 313303 URL: https://svnweb.freebsd.org/changeset/base/313303 Log: MFC r310096: reaper: Make REAPER_KILL_SUBTREE actually work. Modified: stable/10/sys/kern/kern_procctl.c stable/10/tests/sys/kern/reaper.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_procctl.c == --- stable/10/sys/kern/kern_procctl.c Sun Feb 5 20:55:01 2017 (r313302) +++ stable/10/sys/kern/kern_procctl.c Sun Feb 5 21:31:40 2017 (r313303) @@ -243,7 +243,7 @@ reap_kill(struct thread *td, struct proc return (ECAPMODE); if (rk->rk_sig <= 0 || rk->rk_sig > _SIG_MAXSIG) return (EINVAL); - if ((rk->rk_flags & ~REAPER_KILL_CHILDREN) != 0) + if ((rk->rk_flags & ~(REAPER_KILL_CHILDREN | REAPER_KILL_SUBTREE)) != 0) return (EINVAL); PROC_UNLOCK(p); reap = (p->p_treeflag & P_TREE_REAPER) == 0 ? p->p_reaper : p; Modified: stable/10/tests/sys/kern/reaper.c == --- stable/10/tests/sys/kern/reaper.c Sun Feb 5 20:55:01 2017 (r313302) +++ stable/10/tests/sys/kern/reaper.c Sun Feb 5 21:31:40 2017 (r313303) @@ -639,6 +639,107 @@ ATF_TC_BODY(reaper_kill_normal, tc) ATF_REQUIRE_EQ(0, r); } +ATF_TC_WITHOUT_HEAD(reaper_kill_subtree); +ATF_TC_BODY(reaper_kill_subtree, tc) +{ + struct procctl_reaper_kill params; + ssize_t sr; + pid_t parent, child1, child2, grandchild1, grandchild2, pid; + int r, status; + int pip[2]; + + parent = getpid(); + r = procctl(P_PID, parent, PROC_REAP_ACQUIRE, NULL); + ATF_REQUIRE_EQ(0, r); + + r = pipe(pip); + ATF_REQUIRE_EQ(0, r); + child1 = fork(); + ATF_REQUIRE(child1 != -1); + if (child1 == 0) { + if (close(pip[0]) != 0) + _exit(100); + grandchild1 = fork(); + if (grandchild1 == -1) + _exit(101); + if (grandchild1 == 0) { + if (write(pip[1], &(uint8_t){ 0 }, 1) != 1) + _exit(102); + for (;;) + pause(); + } + for (;;) + pause(); + } + child2 = fork(); + ATF_REQUIRE(child2 != -1); + if (child2 == 0) { + if (close(pip[0]) != 0) + _exit(100); + grandchild2 = fork(); + if (grandchild2 == -1) + _exit(101); + if (grandchild2 == 0) { + if (write(pip[1], &(uint8_t){ 0 }, 1) != 1) + _exit(102); + for (;;) + pause(); + } + for (;;) + pause(); + } + r = close(pip[1]); + ATF_REQUIRE_EQ(0, r); + + sr = read(pip[0], &(uint8_t){ 0 }, 1); + ATF_REQUIRE_EQ(1, sr); + sr = read(pip[0], &(uint8_t){ 0 }, 1); + ATF_REQUIRE_EQ(1, sr); + + params.rk_sig = SIGUSR1; + params.rk_flags = REAPER_KILL_SUBTREE; + params.rk_subtree = child1; + params.rk_killed = 77; + r = procctl(P_PID, parent, PROC_REAP_KILL, ); + ATF_REQUIRE_EQ(0, r); + ATF_REQUIRE_EQ(2, params.rk_killed); + ATF_CHECK_EQ(-1, params.rk_fpid); + + pid = waitpid(child1, , 0); + ATF_REQUIRE_EQ(child1, pid); + ATF_CHECK(WIFSIGNALED(status) && WTERMSIG(status) == SIGUSR1); + + pid = waitpid(-1, , 0); + ATF_REQUIRE(pid > 0); + ATF_CHECK(pid != parent); + ATF_CHECK(pid != child1); + ATF_CHECK(pid != child2); + ATF_CHECK(WIFSIGNALED(status) && WTERMSIG(status) == SIGUSR1); + + params.rk_sig = SIGUSR2; + params.rk_flags = REAPER_KILL_SUBTREE; + params.rk_subtree = child2; + params.rk_killed = 77; + r = procctl(P_PID, parent, PROC_REAP_KILL, ); + ATF_REQUIRE_EQ(0, r); + ATF_REQUIRE_EQ(2, params.rk_killed); + ATF_CHECK_EQ(-1, params.rk_fpid); + + pid = waitpid(child2, , 0); + ATF_REQUIRE_EQ(child2, pid); + ATF_CHECK(WIFSIGNALED(status) && WTERMSIG(status) == SIGUSR2); + + pid = waitpid(-1, , 0); + ATF_REQUIRE(pid > 0); + ATF_CHECK(pid != parent); + ATF_CHECK(pid != child1); + ATF_CHECK(pid != child2); + ATF_CHECK(WIFSIGNALED(status) && WTERMSIG(status) == SIGUSR2); + + r = close(pip[0]); + ATF_REQUIRE_EQ(0, r); +} + ATF_TP_ADD_TCS(tp) { @@ -652,5 +753,6 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, reaper_kill_sigzero); ATF_TP_ADD_TC(tp, reaper_kill_empty); ATF_TP_ADD_TC(tp, reaper_kill_normal); + ATF_TP_ADD_TC(tp, reaper_kill_subtree);
svn commit: r313302 - in stable/11: sys/kern tests/sys/kern
Author: jilles Date: Sun Feb 5 20:55:01 2017 New Revision: 313302 URL: https://svnweb.freebsd.org/changeset/base/313302 Log: MFC r310096: reaper: Make REAPER_KILL_SUBTREE actually work. Modified: stable/11/sys/kern/kern_procctl.c stable/11/tests/sys/kern/reaper.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_procctl.c == --- stable/11/sys/kern/kern_procctl.c Sun Feb 5 20:03:05 2017 (r313301) +++ stable/11/sys/kern/kern_procctl.c Sun Feb 5 20:55:01 2017 (r313302) @@ -243,7 +243,7 @@ reap_kill(struct thread *td, struct proc return (ECAPMODE); if (rk->rk_sig <= 0 || rk->rk_sig > _SIG_MAXSIG) return (EINVAL); - if ((rk->rk_flags & ~REAPER_KILL_CHILDREN) != 0) + if ((rk->rk_flags & ~(REAPER_KILL_CHILDREN | REAPER_KILL_SUBTREE)) != 0) return (EINVAL); PROC_UNLOCK(p); reap = (p->p_treeflag & P_TREE_REAPER) == 0 ? p->p_reaper : p; Modified: stable/11/tests/sys/kern/reaper.c == --- stable/11/tests/sys/kern/reaper.c Sun Feb 5 20:03:05 2017 (r313301) +++ stable/11/tests/sys/kern/reaper.c Sun Feb 5 20:55:01 2017 (r313302) @@ -639,6 +639,107 @@ ATF_TC_BODY(reaper_kill_normal, tc) ATF_REQUIRE_EQ(0, r); } +ATF_TC_WITHOUT_HEAD(reaper_kill_subtree); +ATF_TC_BODY(reaper_kill_subtree, tc) +{ + struct procctl_reaper_kill params; + ssize_t sr; + pid_t parent, child1, child2, grandchild1, grandchild2, pid; + int r, status; + int pip[2]; + + parent = getpid(); + r = procctl(P_PID, parent, PROC_REAP_ACQUIRE, NULL); + ATF_REQUIRE_EQ(0, r); + + r = pipe(pip); + ATF_REQUIRE_EQ(0, r); + child1 = fork(); + ATF_REQUIRE(child1 != -1); + if (child1 == 0) { + if (close(pip[0]) != 0) + _exit(100); + grandchild1 = fork(); + if (grandchild1 == -1) + _exit(101); + if (grandchild1 == 0) { + if (write(pip[1], &(uint8_t){ 0 }, 1) != 1) + _exit(102); + for (;;) + pause(); + } + for (;;) + pause(); + } + child2 = fork(); + ATF_REQUIRE(child2 != -1); + if (child2 == 0) { + if (close(pip[0]) != 0) + _exit(100); + grandchild2 = fork(); + if (grandchild2 == -1) + _exit(101); + if (grandchild2 == 0) { + if (write(pip[1], &(uint8_t){ 0 }, 1) != 1) + _exit(102); + for (;;) + pause(); + } + for (;;) + pause(); + } + r = close(pip[1]); + ATF_REQUIRE_EQ(0, r); + + sr = read(pip[0], &(uint8_t){ 0 }, 1); + ATF_REQUIRE_EQ(1, sr); + sr = read(pip[0], &(uint8_t){ 0 }, 1); + ATF_REQUIRE_EQ(1, sr); + + params.rk_sig = SIGUSR1; + params.rk_flags = REAPER_KILL_SUBTREE; + params.rk_subtree = child1; + params.rk_killed = 77; + r = procctl(P_PID, parent, PROC_REAP_KILL, ); + ATF_REQUIRE_EQ(0, r); + ATF_REQUIRE_EQ(2, params.rk_killed); + ATF_CHECK_EQ(-1, params.rk_fpid); + + pid = waitpid(child1, , 0); + ATF_REQUIRE_EQ(child1, pid); + ATF_CHECK(WIFSIGNALED(status) && WTERMSIG(status) == SIGUSR1); + + pid = waitpid(-1, , 0); + ATF_REQUIRE(pid > 0); + ATF_CHECK(pid != parent); + ATF_CHECK(pid != child1); + ATF_CHECK(pid != child2); + ATF_CHECK(WIFSIGNALED(status) && WTERMSIG(status) == SIGUSR1); + + params.rk_sig = SIGUSR2; + params.rk_flags = REAPER_KILL_SUBTREE; + params.rk_subtree = child2; + params.rk_killed = 77; + r = procctl(P_PID, parent, PROC_REAP_KILL, ); + ATF_REQUIRE_EQ(0, r); + ATF_REQUIRE_EQ(2, params.rk_killed); + ATF_CHECK_EQ(-1, params.rk_fpid); + + pid = waitpid(child2, , 0); + ATF_REQUIRE_EQ(child2, pid); + ATF_CHECK(WIFSIGNALED(status) && WTERMSIG(status) == SIGUSR2); + + pid = waitpid(-1, , 0); + ATF_REQUIRE(pid > 0); + ATF_CHECK(pid != parent); + ATF_CHECK(pid != child1); + ATF_CHECK(pid != child2); + ATF_CHECK(WIFSIGNALED(status) && WTERMSIG(status) == SIGUSR2); + + r = close(pip[0]); + ATF_REQUIRE_EQ(0, r); +} + ATF_TP_ADD_TCS(tp) { @@ -652,5 +753,6 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, reaper_kill_sigzero); ATF_TP_ADD_TC(tp, reaper_kill_empty); ATF_TP_ADD_TC(tp, reaper_kill_normal); + ATF_TP_ADD_TC(tp, reaper_kill_subtree);
svn commit: r313293 - in vendor/compiler-rt/dist: lib/asan lib/lsan lib/sanitizer_common lib/sanitizer_common/tests test/asan/TestCases
Author: dim Date: Sun Feb 5 19:37:47 2017 New Revision: 313293 URL: https://svnweb.freebsd.org/changeset/base/313293 Log: Vendor import of compiler-rt release_40 branch r294123: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_40@294123 Added: vendor/compiler-rt/dist/test/asan/TestCases/malloc-no-intercept.c (contents, props changed) Modified: vendor/compiler-rt/dist/lib/asan/asan_malloc_linux.cc vendor/compiler-rt/dist/lib/asan/asan_malloc_win.cc vendor/compiler-rt/dist/lib/lsan/lsan_interceptors.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_interceptors.h vendor/compiler-rt/dist/lib/sanitizer_common/tests/sanitizer_allocator_testlib.cc Modified: vendor/compiler-rt/dist/lib/asan/asan_malloc_linux.cc == --- vendor/compiler-rt/dist/lib/asan/asan_malloc_linux.cc Sun Feb 5 19:37:44 2017(r313292) +++ vendor/compiler-rt/dist/lib/asan/asan_malloc_linux.cc Sun Feb 5 19:37:47 2017(r313293) @@ -50,12 +50,14 @@ INTERCEPTOR(void, free, void *ptr) { asan_free(ptr, , FROM_MALLOC); } +#if SANITIZER_INTERCEPT_CFREE INTERCEPTOR(void, cfree, void *ptr) { GET_STACK_TRACE_FREE; if (UNLIKELY(IsInDlsymAllocPool(ptr))) return; asan_free(ptr, , FROM_MALLOC); } +#endif // SANITIZER_INTERCEPT_CFREE INTERCEPTOR(void*, malloc, uptr size) { if (UNLIKELY(!asan_inited)) @@ -91,22 +93,24 @@ INTERCEPTOR(void*, realloc, void *ptr, u return asan_realloc(ptr, size, ); } +#if SANITIZER_INTERCEPT_MEMALIGN INTERCEPTOR(void*, memalign, uptr boundary, uptr size) { GET_STACK_TRACE_MALLOC; return asan_memalign(boundary, size, , FROM_MALLOC); } -INTERCEPTOR(void*, aligned_alloc, uptr boundary, uptr size) { - GET_STACK_TRACE_MALLOC; - return asan_memalign(boundary, size, , FROM_MALLOC); -} - INTERCEPTOR(void*, __libc_memalign, uptr boundary, uptr size) { GET_STACK_TRACE_MALLOC; void *res = asan_memalign(boundary, size, , FROM_MALLOC); DTLS_on_libc_memalign(res, size); return res; } +#endif // SANITIZER_INTERCEPT_MEMALIGN + +INTERCEPTOR(void*, aligned_alloc, uptr boundary, uptr size) { + GET_STACK_TRACE_MALLOC; + return asan_memalign(boundary, size, , FROM_MALLOC); +} INTERCEPTOR(uptr, malloc_usable_size, void *ptr) { GET_CURRENT_PC_BP_SP; @@ -114,6 +118,7 @@ INTERCEPTOR(uptr, malloc_usable_size, vo return asan_malloc_usable_size(ptr, pc, bp); } +#if SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO // We avoid including malloc.h for portability reasons. // man mallinfo says the fields are "long", but the implementation uses int. // It doesn't matter much -- we just need to make sure that the libc's mallinfo @@ -131,6 +136,7 @@ INTERCEPTOR(struct fake_mallinfo, mallin INTERCEPTOR(int, mallopt, int cmd, int value) { return -1; } +#endif // SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO INTERCEPTOR(int, posix_memalign, void **memptr, uptr alignment, uptr size) { GET_STACK_TRACE_MALLOC; @@ -143,10 +149,12 @@ INTERCEPTOR(void*, valloc, uptr size) { return asan_valloc(size, ); } +#if SANITIZER_INTERCEPT_PVALLOC INTERCEPTOR(void*, pvalloc, uptr size) { GET_STACK_TRACE_MALLOC; return asan_pvalloc(size, ); } +#endif // SANITIZER_INTERCEPT_PVALLOC INTERCEPTOR(void, malloc_stats, void) { __asan_print_accumulated_stats(); Modified: vendor/compiler-rt/dist/lib/asan/asan_malloc_win.cc == --- vendor/compiler-rt/dist/lib/asan/asan_malloc_win.cc Sun Feb 5 19:37:44 2017(r313292) +++ vendor/compiler-rt/dist/lib/asan/asan_malloc_win.cc Sun Feb 5 19:37:47 2017(r313293) @@ -56,11 +56,6 @@ void _free_base(void *ptr) { } ALLOCATION_FUNCTION_ATTRIBUTE -void cfree(void *ptr) { - CHECK(!"cfree() should not be used on Windows"); -} - -ALLOCATION_FUNCTION_ATTRIBUTE void *malloc(size_t size) { GET_STACK_TRACE_MALLOC; return asan_malloc(size, ); Modified: vendor/compiler-rt/dist/lib/lsan/lsan_interceptors.cc == --- vendor/compiler-rt/dist/lib/lsan/lsan_interceptors.cc Sun Feb 5 19:37:44 2017(r313292) +++ vendor/compiler-rt/dist/lib/lsan/lsan_interceptors.cc Sun Feb 5 19:37:47 2017(r313293) @@ -19,6 +19,7 @@ #include "sanitizer_common/sanitizer_flags.h" #include "sanitizer_common/sanitizer_internal_defs.h" #include "sanitizer_common/sanitizer_linux.h" +#include "sanitizer_common/sanitizer_platform_interceptors.h" #include "sanitizer_common/sanitizer_platform_limits_posix.h" #include "sanitizer_common/sanitizer_tls_get_addr.h" #include "lsan.h" @@ -86,11 +87,26 @@ INTERCEPTOR(void*, realloc, void *q, upt return Reallocate(stack, q, size, 1); } +#if SANITIZER_INTERCEPT_MEMALIGN INTERCEPTOR(void*, memalign, uptr alignment, uptr size) { ENSURE_LSAN_INITED; GET_STACK_TRACE_MALLOC; return
svn commit: r313297 - in vendor/lld/dist: ELF test/ELF
Author: dim Date: Sun Feb 5 19:38:00 2017 New Revision: 313297 URL: https://svnweb.freebsd.org/changeset/base/313297 Log: Vendor import of lld release_40 branch r294123: https://llvm.org/svn/llvm-project/lld/branches/release_40@294123 Added: vendor/lld/dist/test/ELF/relocatable-common.s (contents, props changed) Modified: vendor/lld/dist/ELF/Config.h vendor/lld/dist/ELF/Driver.cpp vendor/lld/dist/ELF/Options.td vendor/lld/dist/ELF/Symbols.cpp vendor/lld/dist/ELF/SyntheticSections.cpp vendor/lld/dist/ELF/Writer.cpp vendor/lld/dist/test/ELF/basic-mips.s vendor/lld/dist/test/ELF/eh-frame-hdr-abs-fde.s vendor/lld/dist/test/ELF/mips-64-disp.s vendor/lld/dist/test/ELF/mips-64-got.s vendor/lld/dist/test/ELF/mips-64-rels.s vendor/lld/dist/test/ELF/mips-got-and-copy.s vendor/lld/dist/test/ELF/mips-got-extsym.s vendor/lld/dist/test/ELF/mips-got-hilo.s vendor/lld/dist/test/ELF/mips-got-redundant.s vendor/lld/dist/test/ELF/mips-got-relocs.s vendor/lld/dist/test/ELF/mips-got-weak.s vendor/lld/dist/test/ELF/mips-got16.s vendor/lld/dist/test/ELF/mips-gp-ext.s vendor/lld/dist/test/ELF/mips-gp-lowest.s vendor/lld/dist/test/ELF/mips-gprel32-relocs-gp0.s vendor/lld/dist/test/ELF/mips-gprel32-relocs.s vendor/lld/dist/test/ELF/mips-hilo-gp-disp.s vendor/lld/dist/test/ELF/mips-n32-rels.s vendor/lld/dist/test/ELF/mips-options.s vendor/lld/dist/test/ELF/mips-tls-64.s vendor/lld/dist/test/ELF/mips-tls-hilo.s vendor/lld/dist/test/ELF/mips-tls-static.s vendor/lld/dist/test/ELF/mips-tls.s vendor/lld/dist/test/ELF/mips-xgot-order.s Modified: vendor/lld/dist/ELF/Config.h == --- vendor/lld/dist/ELF/Config.hSun Feb 5 19:37:57 2017 (r313296) +++ vendor/lld/dist/ELF/Config.hSun Feb 5 19:38:00 2017 (r313297) @@ -98,6 +98,7 @@ struct Configuration { bool Bsymbolic; bool BsymbolicFunctions; bool ColorDiagnostics = false; + bool DefineCommon; bool Demangle = true; bool DisableVerify; bool EhFrameHdr; Modified: vendor/lld/dist/ELF/Driver.cpp == --- vendor/lld/dist/ELF/Driver.cpp Sun Feb 5 19:37:57 2017 (r313296) +++ vendor/lld/dist/ELF/Driver.cpp Sun Feb 5 19:38:00 2017 (r313297) @@ -496,6 +496,8 @@ void LinkerDriver::readConfigs(opt::Inpu Config->Pie = getArg(Args, OPT_pie, OPT_nopie, false); Config->PrintGcSections = Args.hasArg(OPT_print_gc_sections); Config->Relocatable = Args.hasArg(OPT_relocatable); + Config->DefineCommon = getArg(Args, OPT_define_common, OPT_no_define_common, +!Config->Relocatable); Config->Discard = getDiscardOption(Args); Config->SaveTemps = Args.hasArg(OPT_save_temps); Config->SingleRoRx = Args.hasArg(OPT_no_rosegment); Modified: vendor/lld/dist/ELF/Options.td == --- vendor/lld/dist/ELF/Options.td Sun Feb 5 19:37:57 2017 (r313296) +++ vendor/lld/dist/ELF/Options.td Sun Feb 5 19:38:00 2017 (r313297) @@ -45,6 +45,9 @@ def color_diagnostics: F<"color-diagnost def color_diagnostics_eq: J<"color-diagnostics=">, HelpText<"Use colors in diagnostics">; +def define_common: F<"define-common">, + HelpText<"Assign space to common symbols">; + def disable_new_dtags: F<"disable-new-dtags">, HelpText<"Disable new dynamic tags">; @@ -130,6 +133,9 @@ def no_as_needed: F<"no-as-needed">, def no_color_diagnostics: F<"no-color-diagnostics">, HelpText<"Do not use colors in diagnostics">; +def no_define_common: F<"no-define-common">, + HelpText<"Do not assign space to common symbols">; + def no_demangle: F<"no-demangle">, HelpText<"Do not demangle symbol names">; @@ -255,6 +261,9 @@ def alias_Bstatic_dn: F<"dn">, Alias, Alias; def alias_Bstatic_static: F<"static">, Alias; def alias_L__library_path: J<"library-path=">, Alias; +def alias_define_common_d: Flag<["-"], "d">, Alias; +def alias_define_common_dc: F<"dc">, Alias; +def alias_define_common_dp: F<"dp">, Alias; def alias_discard_all_x: Flag<["-"], "x">, Alias; def alias_discard_locals_X: Flag<["-"], "X">, Alias; def alias_dynamic_list: J<"dynamic-list=">, Alias; @@ -320,7 +329,6 @@ def plugin_opt_eq: J<"plugin-opt=">; // Options listed below are silently ignored for now for compatibility. def allow_shlib_undefined: F<"allow-shlib-undefined">; def cref: Flag<["--"], "cref">; -def define_common: F<"define-common">; def demangle: F<"demangle">; def detect_odr_violations: F<"detect-odr-violations">; def g: Flag<["-"], "g">; @@ -347,9 +355,6 @@ def G: JoinedOrSeparate<["-"], "G">; def Qy : F<"Qy">; // Aliases for ignored options -def alias_define_common_d: Flag<["-"], "d">, Alias; -def alias_define_common_dc: F<"dc">, Alias; -def alias_define_common_dp: F<"dp">, Alias; def alias_Map_eq:
svn commit: r313296 - vendor/libc++/libc++-release_40-r294123
Author: dim Date: Sun Feb 5 19:37:57 2017 New Revision: 313296 URL: https://svnweb.freebsd.org/changeset/base/313296 Log: Tag libc++ release_40 branch r294123. Added: vendor/libc++/libc++-release_40-r294123/ - copied from r313295, vendor/libc++/dist/ ___ 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"
svn commit: r313292 - vendor/clang/clang-release_40-r294123
Author: dim Date: Sun Feb 5 19:37:44 2017 New Revision: 313292 URL: https://svnweb.freebsd.org/changeset/base/313292 Log: Tag clang release_40 branch r294123. Added: vendor/clang/clang-release_40-r294123/ - copied from r313291, vendor/clang/dist/ ___ 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"
svn commit: r313299 - vendor/lldb/lldb-release_40-r294123
Author: dim Date: Sun Feb 5 19:38:10 2017 New Revision: 313299 URL: https://svnweb.freebsd.org/changeset/base/313299 Log: Tag lldb release_40 branch r294123. Added: vendor/lldb/lldb-release_40-r294123/ - copied from r313298, vendor/lldb/dist/ ___ 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"
svn commit: r313294 - vendor/compiler-rt/compiler-rt-release_40-r294123
Author: dim Date: Sun Feb 5 19:37:51 2017 New Revision: 313294 URL: https://svnweb.freebsd.org/changeset/base/313294 Log: Tag compiler-rt release_40 branch r294123. Added: vendor/compiler-rt/compiler-rt-release_40-r294123/ - copied from r313293, vendor/compiler-rt/dist/ ___ 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"
svn commit: r313298 - vendor/lld/lld-release_40-r294123
Author: dim Date: Sun Feb 5 19:38:05 2017 New Revision: 313298 URL: https://svnweb.freebsd.org/changeset/base/313298 Log: Tag lld release_40 branch r294123. Added: vendor/lld/lld-release_40-r294123/ - copied from r313297, vendor/lld/dist/ ___ 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"
svn commit: r313291 - in vendor/clang/dist: lib/Sema lib/StaticAnalyzer/Checkers lib/StaticAnalyzer/Core test/Analysis test/SemaObjCXX
Author: dim Date: Sun Feb 5 19:37:40 2017 New Revision: 313291 URL: https://svnweb.freebsd.org/changeset/base/313291 Log: Vendor import of clang release_40 branch r294123: https://llvm.org/svn/llvm-project/cfe/branches/release_40@294123 Added: vendor/clang/dist/test/Analysis/null-deref-static.m Modified: vendor/clang/dist/lib/Sema/SemaExprCXX.cpp vendor/clang/dist/lib/Sema/TreeTransform.h vendor/clang/dist/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/MemRegion.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/RegionStore.cpp vendor/clang/dist/test/Analysis/dispatch-once.m vendor/clang/dist/test/SemaObjCXX/typo-correction.mm Modified: vendor/clang/dist/lib/Sema/SemaExprCXX.cpp == --- vendor/clang/dist/lib/Sema/SemaExprCXX.cpp Sun Feb 5 19:37:35 2017 (r313290) +++ vendor/clang/dist/lib/Sema/SemaExprCXX.cpp Sun Feb 5 19:37:40 2017 (r313291) @@ -7190,14 +7190,6 @@ public: ExprResult TransformBlockExpr(BlockExpr *E) { return Owned(E); } - ExprResult TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { -return Owned(E); - } - - ExprResult TransformObjCIvarRefExpr(ObjCIvarRefExpr *E) { -return Owned(E); - } - ExprResult Transform(Expr *E) { ExprResult Res; while (true) { Modified: vendor/clang/dist/lib/Sema/TreeTransform.h == --- vendor/clang/dist/lib/Sema/TreeTransform.h Sun Feb 5 19:37:35 2017 (r313290) +++ vendor/clang/dist/lib/Sema/TreeTransform.h Sun Feb 5 19:37:40 2017 (r313291) @@ -2932,16 +2932,17 @@ public: ExprResult RebuildObjCIvarRefExpr(Expr *BaseArg, ObjCIvarDecl *Ivar, SourceLocation IvarLoc, bool IsArrow, bool IsFreeIvar) { -// FIXME: We lose track of the IsFreeIvar bit. CXXScopeSpec SS; DeclarationNameInfo NameInfo(Ivar->getDeclName(), IvarLoc); -return getSema().BuildMemberReferenceExpr(BaseArg, BaseArg->getType(), - /*FIXME:*/IvarLoc, IsArrow, - SS, SourceLocation(), - /*FirstQualifierInScope=*/nullptr, - NameInfo, - /*TemplateArgs=*/nullptr, - /*S=*/nullptr); +ExprResult Result = getSema().BuildMemberReferenceExpr( +BaseArg, BaseArg->getType(), +/*FIXME:*/ IvarLoc, IsArrow, SS, SourceLocation(), +/*FirstQualifierInScope=*/nullptr, NameInfo, +/*TemplateArgs=*/nullptr, +/*S=*/nullptr); +if (IsFreeIvar && Result.isUsable()) + cast(Result.get())->setIsFreeIvar(IsFreeIvar); +return Result; } /// \brief Build a new Objective-C property reference expression. Modified: vendor/clang/dist/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp == --- vendor/clang/dist/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp Sun Feb 5 19:37:35 2017(r313290) +++ vendor/clang/dist/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp Sun Feb 5 19:37:40 2017(r313291) @@ -94,11 +94,18 @@ void MacOSXAPIChecker::CheckDispatchOnce bool SuggestStatic = false; os << "Call to '" << FName << "' uses"; if (const VarRegion *VR = dyn_cast(RB)) { +const VarDecl *VD = VR->getDecl(); +// FIXME: These should have correct memory space and thus should be filtered +// out earlier. This branch only fires when we're looking from a block, +// which we analyze as a top-level declaration, onto a static local +// in a function that contains the block. +if (VD->isStaticLocal()) + return; // We filtered out globals earlier, so it must be a local variable // or a block variable which is under UnknownSpaceRegion. if (VR != R) os << " memory within"; -if (VR->getDecl()->hasAttr()) +if (VD->hasAttr()) os << " the block variable '"; else os << " the local variable '"; Modified: vendor/clang/dist/lib/StaticAnalyzer/Core/MemRegion.cpp == --- vendor/clang/dist/lib/StaticAnalyzer/Core/MemRegion.cpp Sun Feb 5 19:37:35 2017(r313290) +++ vendor/clang/dist/lib/StaticAnalyzer/Core/MemRegion.cpp Sun Feb 5 19:37:40 2017(r313291) @@ -816,9 +816,11 @@ const VarRegion* MemRegionManager::getVa const StackFrameContext *STC = V.get(); -if (!STC) +if (!STC) { + // FIXME: Assign a more sensible memory space to static locals + // we see from within blocks that we analyze as top-level declarations. sReg = getUnknownRegion(); -else
svn commit: r313295 - in vendor/libc++/dist: include test/libcxx/containers/associative
Author: dim Date: Sun Feb 5 19:37:54 2017 New Revision: 313295 URL: https://svnweb.freebsd.org/changeset/base/313295 Log: Vendor import of libc++ release_40 branch r294123: https://llvm.org/svn/llvm-project/libcxx/branches/release_40@294123 Added: vendor/libc++/dist/test/libcxx/containers/associative/undef_min_max.pass.cpp (contents, props changed) Modified: vendor/libc++/dist/include/__tree Modified: vendor/libc++/dist/include/__tree == --- vendor/libc++/dist/include/__tree Sun Feb 5 19:37:51 2017 (r313294) +++ vendor/libc++/dist/include/__tree Sun Feb 5 19:37:54 2017 (r313295) @@ -17,6 +17,8 @@ #include #include +#include <__undef_min_max> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif Added: vendor/libc++/dist/test/libcxx/containers/associative/undef_min_max.pass.cpp == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libc++/dist/test/libcxx/containers/associative/undef_min_max.pass.cpp Sun Feb 5 19:37:54 2017(r313295) @@ -0,0 +1,22 @@ +//===--===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===--===// + +#if defined(__GNUC__) +#pragma GCC diagnostic ignored "-W#warnings" +#endif + +#define min THIS IS A NASTY MACRO! +#define max THIS IS A NASTY MACRO! + +#include + +int main() { + std::mapm; + ((void)m); +} ___ 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"
svn commit: r313290 - vendor/llvm/llvm-release_40-r294123
Author: dim Date: Sun Feb 5 19:37:35 2017 New Revision: 313290 URL: https://svnweb.freebsd.org/changeset/base/313290 Log: Tag llvm release_40 branch r294123. Added: vendor/llvm/llvm-release_40-r294123/ - copied from r313289, vendor/llvm/dist/ ___ 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"
svn commit: r313289 - in vendor/llvm/dist: lib/CodeGen/SelectionDAG lib/Transforms/InstCombine lib/Transforms/Scalar test/CodeGen/AMDGPU test/CodeGen/NVPTX test/CodeGen/PowerPC test/Object/Inputs t...
Author: dim Date: Sun Feb 5 19:37:31 2017 New Revision: 313289 URL: https://svnweb.freebsd.org/changeset/base/313289 Log: Vendor import of llvm release_40 branch r294123: https://llvm.org/svn/llvm-project/llvm/branches/release_40@294123 Added: vendor/llvm/dist/test/Object/Inputs/phdr-note.elf-x86-64 (contents, props changed) vendor/llvm/dist/test/Object/Inputs/phdrs.elf-x86-64 (contents, props changed) vendor/llvm/dist/test/Transforms/LoopStrengthReduce/AMDGPU/preserve-addrspace-assert.ll vendor/llvm/dist/test/tools/llvm-objdump/X86/openbsd-headers.test vendor/llvm/dist/test/tools/llvm-objdump/X86/phdrs.test Modified: vendor/llvm/dist/lib/CodeGen/SelectionDAG/DAGCombiner.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineCompares.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopStrengthReduce.cpp vendor/llvm/dist/test/CodeGen/AMDGPU/fma-combine.ll vendor/llvm/dist/test/CodeGen/AMDGPU/mad-combine.ll vendor/llvm/dist/test/CodeGen/NVPTX/fma-assoc.ll vendor/llvm/dist/test/CodeGen/PowerPC/fma-assoc.ll vendor/llvm/dist/test/Transforms/InstCombine/minmax-fold.ll vendor/llvm/dist/tools/llvm-objdump/ELFDump.cpp vendor/llvm/dist/utils/release/test-release.sh Modified: vendor/llvm/dist/lib/CodeGen/SelectionDAG/DAGCombiner.cpp == --- vendor/llvm/dist/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sun Feb 5 15:46:05 2017(r313288) +++ vendor/llvm/dist/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sun Feb 5 19:37:31 2017(r313289) @@ -8123,9 +8123,12 @@ SDValue DAGCombiner::visitFADDForFMAComb } // More folding opportunities when target permits. - if ((AllowFusion || HasFMAD) && Aggressive) { + if (Aggressive) { // fold (fadd (fma x, y, (fmul u, v)), z) -> (fma x, y (fma u, v, z)) -if (N0.getOpcode() == PreferredFusedOpcode && +// FIXME: The UnsafeAlgebra flag should be propagated to FMA/FMAD, but FMF +// are currently only supported on binary nodes. +if (Options.UnsafeFPMath && +N0.getOpcode() == PreferredFusedOpcode && N0.getOperand(2).getOpcode() == ISD::FMUL && N0->hasOneUse() && N0.getOperand(2)->hasOneUse()) { return DAG.getNode(PreferredFusedOpcode, SL, VT, @@ -8137,7 +8140,10 @@ SDValue DAGCombiner::visitFADDForFMAComb } // fold (fadd x, (fma y, z, (fmul u, v)) -> (fma y, z (fma u, v, x)) -if (N1->getOpcode() == PreferredFusedOpcode && +// FIXME: The UnsafeAlgebra flag should be propagated to FMA/FMAD, but FMF +// are currently only supported on binary nodes. +if (Options.UnsafeFPMath && +N1->getOpcode() == PreferredFusedOpcode && N1.getOperand(2).getOpcode() == ISD::FMUL && N1->hasOneUse() && N1.getOperand(2)->hasOneUse()) { return DAG.getNode(PreferredFusedOpcode, SL, VT, @@ -8367,10 +8373,13 @@ SDValue DAGCombiner::visitFSUBForFMAComb } // More folding opportunities when target permits. - if ((AllowFusion || HasFMAD) && Aggressive) { + if (Aggressive) { // fold (fsub (fma x, y, (fmul u, v)), z) // -> (fma x, y (fma u, v, (fneg z))) -if (N0.getOpcode() == PreferredFusedOpcode && +// FIXME: The UnsafeAlgebra flag should be propagated to FMA/FMAD, but FMF +// are currently only supported on binary nodes. +if (Options.UnsafeFPMath && +N0.getOpcode() == PreferredFusedOpcode && N0.getOperand(2).getOpcode() == ISD::FMUL && N0->hasOneUse() && N0.getOperand(2)->hasOneUse()) { return DAG.getNode(PreferredFusedOpcode, SL, VT, @@ -8384,7 +8393,10 @@ SDValue DAGCombiner::visitFSUBForFMAComb // fold (fsub x, (fma y, z, (fmul u, v))) // -> (fma (fneg y), z, (fma (fneg u), v, x)) -if (N1.getOpcode() == PreferredFusedOpcode && +// FIXME: The UnsafeAlgebra flag should be propagated to FMA/FMAD, but FMF +// are currently only supported on binary nodes. +if (Options.UnsafeFPMath && +N1.getOpcode() == PreferredFusedOpcode && N1.getOperand(2).getOpcode() == ISD::FMUL) { SDValue N20 = N1.getOperand(2).getOperand(0); SDValue N21 = N1.getOperand(2).getOperand(1); Modified: vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineCompares.cpp == --- vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineCompares.cpp Sun Feb 5 15:46:05 2017(r313288) +++ vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineCompares.cpp Sun Feb 5 19:37:31 2017(r313289) @@ -4039,11 +4039,6 @@ Instruction *InstCombiner::foldICmpUsing Constant *CMinus1 = ConstantInt::get(Op0->getType(), *CmpC - 1); return new ICmpInst(ICmpInst::ICMP_EQ, Op0, CMinus1); } - // (x (x >s -1) -> true if sign bit clear - if (CmpC->isMinSignedValue()) { -Constant *AllOnes = Constant::getAllOnesValue(Op0->getType()); -return new
Re: svn commit: r313037 - in head/sys: amd64/include kern mips/include net powerpc/include sparc64/include
Hmm, it's a good idea to consider the possibility of a barrier issue. It wouldn't be the first time we've had such a problem on a weakly-ordered architecture. That said, I don't see a problem in this case. smp_rendezvous_cpus() takes a spinlock and then issues atomic_store_rel_int() to ensure the rendezvous params are visible to other cpus. The latter corresponds to lwsync on powerpc, which AFAIK should be sufficient to ensure visibility of prior stores. For now I'm going with the simpler explanation that I made a bad assumption in the powerpc get_pcpu() and there is some context in which the read of sprg0 doesn't return a consistent pointer value. Unfortunately I don't see where that might be right now. On the mips side, Kurt/Alexander can you test the attached patch? It contains a simple fix to ensure get_pcpu() returns the consistent per-cpu pointer. On Sat, Feb 4, 2017 at 1:34 PM, Svatopluk Krauswrote: > Probably not related. But when I took short look to the patch to see > what could go wrong, I walked into the following comment in > _rm_wlock(): "Assumes rm->rm_writecpus update is visible on other CPUs > before rm_cleanIPI is called." There is no explicit barrier to ensure > it. However, there might be some barriers inside of > smp_rendezvous_cpus(). I have no idea what could happened if this > assumption is not met. Note that rm_cleanIPI() is affected by the > patch. > > > > On Sat, Feb 4, 2017 at 9:39 PM, Jason Harmening > wrote: > > Can you post an example of such panic? Only 2 MI pieces were changed, > > netisr and rmlock. I haven't seen problems on my own amd64/i386/arm > testing > > of this, so a backtrace might help to narrow down the cause. > > > > On Sat, Feb 4, 2017 at 12:22 PM, Andreas Tobler > > wrote: > >> > >> On 04.02.17 20:54, Jason Harmening wrote: > >>> > >>> I suspect this broke rmlocks for mips because the rmlock implementation > >>> takes the address of the per-CPU pc_rm_queue when building tracker > >>> lists. That address may be later accessed from another CPU and will > >>> then translate to the wrong physical region if the address was taken > >>> relative to the globally-constant pcpup VA used on mips. > >>> > >>> Regardless, for mips get_pcpup() should be implemented as > >>> pcpu_find(curcpu) since returning an address that may mean something > >>> different depending on the CPU seems like a big POLA violation if > >>> nothing else. > >>> > >>> I'm more concerned about the report of powerpc breakage. For powerpc > we > >>> simply take each pcpu pointer from the pc_allcpu list (which is the > same > >>> value stored in the cpuid_to_pcpu array) and pass it through the > ap_pcpu > >>> global to each AP's startup code, which then stores it in sprg0. It > >>> should be globally unique and won't have the variable-translation > issues > >>> seen on mips. Andreas, are you certain this change was responsible > the > >>> breakage you saw, and was it the same sort of hang observed on mips? > >> > >> > >> I'm really sure. 313036 booted fine, allowed me to execute heavy > >> compilation jobs, np. 313037 on the other side gave me various patterns > of > >> panics. During startup, but I also succeeded to get into multiuser and > then > >> the panic happend during port building. > >> > >> I have no deeper inside where pcpu data is used. Justin mentioned > netisr? > >> > >> Andreas > >> > > > ___ 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: r313260 - head/sys/kern
On 05/02/2017 15:17, Alexey Dokuchaev wrote: On Sun, Feb 05, 2017 at 04:00:06AM +0100, Mateusz Guzik wrote: For instance, plugging an unused variable, a memory leak, doing a lockless check first etc. are all pretty standard and unless there is something unusual going on (e.g. complicated circumstances leading to a leak) there is not much to explain. In particular, I don't see why anyone would explain why leaks are bad on each commit plugging one. Right; these (unused variable, resource leaks) usually do not warrant elaborate explanation. Indeed these are self explanatory The gist is as follows: there are plenty of cases where the kernel wants to atomically replace the value of a particular variable. Sometimes, like in this commit, we want to bump the counter by 1, but only if the current value is not 0. For that we need to read the value, see if it is 0 and if not, try to replace what we read with what we read + 1. We cannot just increment as the value could have changed to 0 in the meantime. But this also means that multiple cpus doing the same operation on the same variable will trip on each other - one will succeed while the rest will have to retry. Prior to this commit, each retry attempt would explicitly re-read the value. This induces cache coherency traffic slowing everyone down. amd64 has the nice property of giving us the value it found eleminating the need to explicitly re-read it. There is similar story on i386 and sparc. Other architectures may also benefit from this, but that I did not benchmark. In short[,] under contention atomic_fcmpset is going to be faster than atomic_cmpset. I did not benchmark this particular change, but a switch of the sort easily gives 10%+ in microbenchmarks on amd64. That said, while one can argue this optimizes the code, it really depessimizes it as something of the sort should have been already employed. Given the above, IMHO it's quite far from an obvious or of manpage-lookup thing, and thus requires proper explanation in the commit log. Absolutely, I would encourage everyone to not only think about others making similar changes but also providing education for those who may uses similar code in other areas. If said changes where using older code as an example, without knowing otherwise they may not use the updated methodologies. Sharing the detail you have done above is fantastic, allowing others to take note without having to do the research that the may well not have time for, with the result being improved code quality moving forward; so thanks for that :) While on this subject are there any official guidelines to writing commit messages, if no should we create some? I'm unaware of any. We might not have official guidelines, but 30%-what/70%-why rule would apply perfectly here. ;-) Sounds like a good guide. Regards Steve ___ 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"
svn commit: r313288 - stable/10/share/skel
Author: jilles Date: Sun Feb 5 15:46:05 2017 New Revision: 313288 URL: https://svnweb.freebsd.org/changeset/base/313288 Log: MFC r312721: skel: Remove reference to deleted part in previous commit to this file. Modified: stable/10/share/skel/dot.shrc Directory Properties: stable/10/ (props changed) Modified: stable/10/share/skel/dot.shrc == --- stable/10/share/skel/dot.shrc Sun Feb 5 15:45:31 2017 (r313287) +++ stable/10/share/skel/dot.shrc Sun Feb 5 15:46:05 2017 (r313288) @@ -13,8 +13,8 @@ # # umask022 -# Uncomment this and comment the above to enable the builtin vi(1) command -# line editor in sh(1), e.g. ESC to go into visual mode. +# Uncomment this to enable the builtin vi(1) command line editor in sh(1), +# e.g. ESC to go into visual mode. # set -o vi ___ 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"
svn commit: r313287 - head/sys/dev/usb/serial
Author: ian Date: Sun Feb 5 15:45:31 2017 New Revision: 313287 URL: https://svnweb.freebsd.org/changeset/base/313287 Log: Add tsw_busy support to usb_serial (ucom). The tty layer uses tsw_busy to poll for busy/idle status of the transmitter hardware during close() and tcdrain(). The ucom layer defines ULSR_TXRDY and ULSR_TSRE bits for the line status register; when both are set, the transmitter is idle. Not all chip drivers maintain those bits in the sc_lsr field, and if the bits never get set the transmitter will always appear busy, causing hangs in tcdrain(). These changes add a new sc_flag bit, UCOM_FLAG_LSRTXIDLE. When this flag is set, ucom_busy() uses the lsr bits to return busy vs. idle state, otherwise it always returns idle (which is effectively what happened before this change because tsw_busy wasn't implemented). For the uftdi chip driver, these changes stop masking out the tx idle bits when processing the status register (because now they're useful), and it calls ucom_use_lsr_txbits() to indicate the bits are maintained by the driver and can be used by ucom_busy(). Differential Revision:https://reviews.freebsd.org/D9183 Modified: head/sys/dev/usb/serial/uftdi.c head/sys/dev/usb/serial/usb_serial.c head/sys/dev/usb/serial/usb_serial.h Modified: head/sys/dev/usb/serial/uftdi.c == --- head/sys/dev/usb/serial/uftdi.c Sun Feb 5 14:25:31 2017 (r313286) +++ head/sys/dev/usb/serial/uftdi.c Sun Feb 5 15:45:31 2017 (r313287) @@ -1123,6 +1123,9 @@ uftdi_attach(device_t dev) FTDI_SIO_SET_DATA_PARITY_NONE | FTDI_SIO_SET_DATA_BITS(8)); + /* Indicate tx bits in sc_lsr can be used to determine busy vs idle. */ + ucom_use_lsr_txbits(>sc_ucom); + error = ucom_attach(>sc_super_ucom, >sc_ucom, 1, sc, _callback, >sc_mtx); if (error) { @@ -1279,16 +1282,20 @@ uftdi_read_callback(struct usb_xfer *xfe offset = 0; /* * Extract packet headers and payload bytes from the buffer. -* Feed payload bytes to ucom/tty layer; OR-accumulate header -* status bits which are transient and could toggle with each -* packet. After processing all packets in the buffer, process -* the accumulated transient MSR and LSR values along with the +* Feed payload bytes to ucom/tty layer; OR-accumulate the +* receiver-related header status bits which are transient and +* could toggle with each packet, but for transmitter-related +* bits keep only the ones from the last packet. +* +* After processing all packets in the buffer, process the +* accumulated transient MSR and LSR values along with the * non-transient bits from the last packet header. */ while (buflen >= UFTDI_IHDRSIZE) { usbd_copy_out(pc, offset, buf, UFTDI_IHDRSIZE); offset += UFTDI_IHDRSIZE; buflen -= UFTDI_IHDRSIZE; + lsr &= ~(ULSR_TXRDY | ULSR_TSRE); lsr |= FTDI_GET_LSR(buf); if (FTDI_GET_MSR(buf) & FTDI_SIO_RI_MASK) msr |= SER_RI; @@ -1311,8 +1318,7 @@ uftdi_read_callback(struct usb_xfer *xfe if (ftdi_msr & FTDI_SIO_RLSD_MASK) msr |= SER_DCD; - if ((sc->sc_msr != msr) || - ((sc->sc_lsr & FTDI_LSR_MASK) != (lsr & FTDI_LSR_MASK))) { + if (sc->sc_msr != msr || sc->sc_lsr != lsr) { DPRINTF("status change msr=0x%02x (0x%02x) " "lsr=0x%02x (0x%02x)\n", msr, sc->sc_msr, lsr, sc->sc_lsr); Modified: head/sys/dev/usb/serial/usb_serial.c == --- head/sys/dev/usb/serial/usb_serial.cSun Feb 5 14:25:31 2017 (r313286) +++ head/sys/dev/usb/serial/usb_serial.cSun Feb 5 15:45:31 2017 (r313287) @@ -161,6 +161,7 @@ static tsw_param_t ucom_param; static tsw_outwakeup_t ucom_outwakeup; static tsw_inwakeup_t ucom_inwakeup; static tsw_free_t ucom_free; +static tsw_busy_t ucom_busy; static struct ttydevsw ucom_class = { .tsw_flags = TF_INITLOCK | TF_CALLOUT, @@ -172,6 +173,7 @@ static struct ttydevsw ucom_class = { .tsw_param = ucom_param, .tsw_modem = ucom_modem, .tsw_free = ucom_free, + .tsw_busy = ucom_busy, }; MODULE_DEPEND(ucom, usb, 1, 1, 1); @@ -1294,6 +1296,27 @@ ucom_outwakeup(struct tty *tp) ucom_start_transfers(sc); } +static bool +ucom_busy(struct tty *tp) +{ + struct ucom_softc *sc =
Re: svn commit: r313260 - head/sys/kern
On Sun, Feb 05, 2017 at 04:00:06AM +0100, Mateusz Guzik wrote: > For instance, plugging an unused variable, a memory leak, doing a > lockless check first etc. are all pretty standard and unless there is > something unusual going on (e.g. complicated circumstances leading to a > leak) there is not much to explain. In particular, I don't see why > anyone would explain why leaks are bad on each commit plugging one. Right; these (unused variable, resource leaks) usually do not warrant elaborate explanation. [ Some linefeeds below were trimmed for brevity ] > The gist is as follows: there are plenty of cases where the kernel wants > to atomically replace the value of a particular variable. Sometimes, > like in this commit, we want to bump the counter by 1, but only if the > current value is not 0. For that we need to read the value, see if it is > 0 and if not, try to replace what we read with what we read + 1. We > cannot just increment as the value could have changed to 0 in the > meantime. > But this also means that multiple cpus doing the same operation on the > same variable will trip on each other - one will succeed while the rest > will have to retry. > Prior to this commit, each retry attempt would explicitly re-read the > value. This induces cache coherency traffic slowing everyone down. > amd64 has the nice property of giving us the value it found eleminating > the need to explicitly re-read it. There is similar story on i386 and > sparc. > Other architectures may also benefit from this, but that I did not > benchmark. > > In short[,] under contention atomic_fcmpset is going to be faster than > atomic_cmpset. > I did not benchmark this particular change, but a switch of the sort > easily gives 10%+ in microbenchmarks on amd64. > That said, while one can argue this optimizes the code, it really > depessimizes it as something of the sort should have been already > employed. Given the above, IMHO it's quite far from an obvious or of manpage-lookup thing, and thus requires proper explanation in the commit log. > > While on this subject are there any official guidelines to writing > > commit messages, if no should we create some? > > I'm unaware of any. We might not have official guidelines, but 30%-what/70%-why rule would apply perfectly here. ;-) ./danfe ___ 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"
svn commit: r313286 - stable/11/share/skel
Author: jilles Date: Sun Feb 5 14:25:31 2017 New Revision: 313286 URL: https://svnweb.freebsd.org/changeset/base/313286 Log: MFC r312721: skel: Remove reference to deleted part in previous commit to this file. Modified: stable/11/share/skel/dot.shrc Directory Properties: stable/11/ (props changed) Modified: stable/11/share/skel/dot.shrc == --- stable/11/share/skel/dot.shrc Sun Feb 5 14:19:19 2017 (r313285) +++ stable/11/share/skel/dot.shrc Sun Feb 5 14:25:31 2017 (r313286) @@ -13,8 +13,8 @@ # # umask022 -# Uncomment this and comment the above to enable the builtin vi(1) command -# line editor in sh(1), e.g. ESC to go into visual mode. +# Uncomment this to enable the builtin vi(1) command line editor in sh(1), +# e.g. ESC to go into visual mode. # set -o vi ___ 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"
svn commit: r313285 - in head/sys: amd64/linux amd64/linux32 i386/linux
Author: dchagin Date: Sun Feb 5 14:19:19 2017 New Revision: 313285 URL: https://svnweb.freebsd.org/changeset/base/313285 Log: Regen after r313284. MFC after:2 week Modified: head/sys/amd64/linux/linux_proto.h head/sys/amd64/linux/linux_syscall.h head/sys/amd64/linux/linux_syscalls.c head/sys/amd64/linux/linux_sysent.c head/sys/amd64/linux/linux_systrace_args.c head/sys/amd64/linux32/linux32_proto.h head/sys/amd64/linux32/linux32_syscall.h head/sys/amd64/linux32/linux32_syscalls.c head/sys/amd64/linux32/linux32_sysent.c head/sys/amd64/linux32/linux32_systrace_args.c head/sys/i386/linux/linux_proto.h head/sys/i386/linux/linux_syscall.h head/sys/i386/linux/linux_syscalls.c head/sys/i386/linux/linux_sysent.c head/sys/i386/linux/linux_systrace_args.c Modified: head/sys/amd64/linux/linux_proto.h == --- head/sys/amd64/linux/linux_proto.h Sun Feb 5 14:17:09 2017 (r313284) +++ head/sys/amd64/linux/linux_proto.h Sun Feb 5 14:19:19 2017 (r313285) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux/syscalls.master 302515 2016-07-10 08:15:50Z dchagin + * created from FreeBSD: head/sys/amd64/linux/syscalls.master 313284 2017-02-05 14:17:09Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -1000,7 +1000,7 @@ struct linux_epoll_pwait_args { struct linux_signalfd_args { register_t dummy; }; -struct linux_timerfd_args { +struct linux_timerfd_create_args { register_t dummy; }; struct linux_eventfd_args { @@ -1044,16 +1044,27 @@ struct linux_pipe2_args { char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_inotify_init1_args { - register_t dummy; + char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_preadv_args { - register_t dummy; + char fd_l_[PADL_(l_ulong)]; l_ulong fd; char fd_r_[PADR_(l_ulong)]; + char vec_l_[PADL_(struct iovec *)]; struct iovec * vec; char vec_r_[PADR_(struct iovec *)]; + char vlen_l_[PADL_(l_ulong)]; l_ulong vlen; char vlen_r_[PADR_(l_ulong)]; + char pos_l_l_[PADL_(l_ulong)]; l_ulong pos_l; char pos_l_r_[PADR_(l_ulong)]; + char pos_h_l_[PADL_(l_ulong)]; l_ulong pos_h; char pos_h_r_[PADR_(l_ulong)]; }; struct linux_pwritev_args { - register_t dummy; -}; -struct linux_rt_tsigqueueinfo_args { - register_t dummy; + char fd_l_[PADL_(l_ulong)]; l_ulong fd; char fd_r_[PADR_(l_ulong)]; + char vec_l_[PADL_(struct iovec *)]; struct iovec * vec; char vec_r_[PADR_(struct iovec *)]; + char vlen_l_[PADL_(l_ulong)]; l_ulong vlen; char vlen_r_[PADR_(l_ulong)]; + char pos_l_l_[PADL_(l_ulong)]; l_ulong pos_l; char pos_l_r_[PADR_(l_ulong)]; + char pos_h_l_[PADL_(l_ulong)]; l_ulong pos_h; char pos_h_r_[PADR_(l_ulong)]; +}; +struct linux_rt_tgsigqueueinfo_args { + char tgid_l_[PADL_(l_pid_t)]; l_pid_t tgid; char tgid_r_[PADR_(l_pid_t)]; + char tid_l_[PADL_(l_pid_t)]; l_pid_t tid; char tid_r_[PADR_(l_pid_t)]; + char sig_l_[PADL_(l_int)]; l_int sig; char sig_r_[PADR_(l_int)]; + char uinfo_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * uinfo; char uinfo_r_[PADR_(l_siginfo_t *)]; }; struct linux_perf_event_open_args { register_t dummy; @@ -1096,19 +1107,141 @@ struct linux_sendmmsg_args { char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)]; }; struct linux_setns_args { - register_t dummy; + char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)]; + char nstype_l_[PADL_(l_int)]; l_int nstype; char nstype_r_[PADR_(l_int)]; +}; +struct linux_getcpu_args { + char cpu_l_[PADL_(l_uint *)]; l_uint * cpu; char cpu_r_[PADR_(l_uint *)]; + char node_l_[PADL_(l_uint *)]; l_uint * node; char node_r_[PADR_(l_uint *)]; + char cache_l_[PADL_(void *)]; void * cache; char cache_r_[PADR_(void *)]; }; struct linux_process_vm_readv_args { - register_t dummy; + char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; + char lvec_l_[PADL_(const struct iovec *)]; const struct iovec * lvec; char lvec_r_[PADR_(const struct iovec *)]; + char liovcnt_l_[PADL_(l_ulong)]; l_ulong liovcnt; char liovcnt_r_[PADR_(l_ulong)]; + char rvec_l_[PADL_(const struct iovec *)]; const struct iovec * rvec; char rvec_r_[PADR_(const struct iovec *)]; + char riovcnt_l_[PADL_(l_ulong)]; l_ulong riovcnt; char riovcnt_r_[PADR_(l_ulong)]; + char flags_l_[PADL_(l_ulong)]; l_ulong flags; char flags_r_[PADR_(l_ulong)]; }; struct linux_process_vm_writev_args { - register_t dummy; + char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; + char lvec_l_[PADL_(const struct iovec *)]; const struct iovec * lvec; char lvec_r_[PADR_(const struct iovec *)]; +
svn commit: r313284 - in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux
Author: dchagin Date: Sun Feb 5 14:17:09 2017 New Revision: 313284 URL: https://svnweb.freebsd.org/changeset/base/313284 Log: Update syscall.master to 4.10-rc6. Also fix comments, a typo, and wrong numbering for a few unimplemented syscalls. For 32-bit Linuxulator, socketcall() syscall was historically the entry point for the sockets API. Starting in Linux 4.3, direct syscalls are provided for the sockets API. Enable it. The initial version of patch was provided by trasz@ and extended by me. Submitted by: trasz MFC after:2 week Differential Revision:https://reviews.freebsd.org/D9381 Modified: head/sys/amd64/linux/linux_dummy.c head/sys/amd64/linux/syscalls.master head/sys/amd64/linux32/linux32_dummy.c head/sys/amd64/linux32/syscalls.master head/sys/compat/linux/linux_socket.h head/sys/i386/linux/linux_dummy.c head/sys/i386/linux/syscalls.master Modified: head/sys/amd64/linux/linux_dummy.c == --- head/sys/amd64/linux/linux_dummy.c Sun Feb 5 14:03:25 2017 (r313283) +++ head/sys/amd64/linux/linux_dummy.c Sun Feb 5 14:17:09 2017 (r313284) @@ -82,41 +82,86 @@ DUMMY(mq_timedreceive); DUMMY(mq_notify); DUMMY(mq_getsetattr); DUMMY(kexec_load); +/* linux 2.6.11: */ DUMMY(add_key); DUMMY(request_key); DUMMY(keyctl); +/* linux 2.6.13: */ DUMMY(ioprio_set); DUMMY(ioprio_get); DUMMY(inotify_init); DUMMY(inotify_add_watch); DUMMY(inotify_rm_watch); +/* linux 2.6.16: */ DUMMY(migrate_pages); DUMMY(unshare); +/* linux 2.6.17: */ DUMMY(splice); DUMMY(tee); DUMMY(sync_file_range); DUMMY(vmsplice); +/* linux 2.6.18: */ DUMMY(move_pages); +/* linux 2.6.22: */ DUMMY(signalfd); -DUMMY(timerfd); +DUMMY(timerfd_create); +/* linux 2.6.25: */ DUMMY(timerfd_settime); DUMMY(timerfd_gettime); +/* linux 2.6.27: */ DUMMY(signalfd4); DUMMY(inotify_init1); +/* linux 2.6.30: */ DUMMY(preadv); DUMMY(pwritev); -DUMMY(rt_tsigqueueinfo); +/* linux 2.6.31: */ +DUMMY(rt_tgsigqueueinfo); DUMMY(perf_event_open); +/* linux 2.6.38: */ DUMMY(fanotify_init); DUMMY(fanotify_mark); +/* linux 2.6.39: */ DUMMY(name_to_handle_at); DUMMY(open_by_handle_at); DUMMY(clock_adjtime); +/* linux 3.0: */ DUMMY(setns); +DUMMY(getcpu); +/* linux 3.2: */ DUMMY(process_vm_readv); DUMMY(process_vm_writev); +/* linux 3.5: */ DUMMY(kcmp); +/* linux 3.8: */ DUMMY(finit_module); +DUMMY(sched_setattr); +DUMMY(sched_getattr); +/* linux 3.14: */ +DUMMY(renameat2); +/* linux 3.15: */ +DUMMY(seccomp); +DUMMY(getrandom); +DUMMY(memfd_create); +DUMMY(kexec_file_load); +/* linux 3.18: */ +DUMMY(bpf); +/* linux 3.19: */ +DUMMY(execveat); +/* linux 4.2: */ +DUMMY(userfaultfd); +/* linux 4.3: */ +DUMMY(membarrier); +/* linux 4.4: */ +DUMMY(mlock2); +/* linux 4.5: */ +DUMMY(copy_file_range); +/* linux 4.6: */ +DUMMY(preadv2); +DUMMY(pwritev2); +/* linux 4.8: */ +DUMMY(pkey_mprotect); +DUMMY(pkey_alloc); +DUMMY(pkey_free); #define DUMMY_XATTR(s) \ int\ Modified: head/sys/amd64/linux/syscalls.master == --- head/sys/amd64/linux/syscalls.masterSun Feb 5 14:03:25 2017 (r313283) +++ head/sys/amd64/linux/syscalls.masterSun Feb 5 14:17:09 2017 (r313284) @@ -11,18 +11,20 @@ ; there is no audit event for the call at this time. For the ; case where the event exists, but we don't want auditing, the ; event should be #defined to AUE_NULL in audit_kevents.h. -; typeone of STD, OBSOL, UNIMPL +; typeone of STD, NOPROTO, UNIMPL ; namepsuedo-prototype of syscall routine ; If one of the following alts is different, then all appear: ; altname name of system call if different ; alttag name of args struct tag if different from [o]`name'"_args" ; altrtyp return type if not int (bogus - syscalls always return int) -; for UNIMPL/OBSOL, name continues with comments +; for UNIMPL, name continues with comments ; types: ; STD always included -; OBSOL obsolete, not included in system, only specifies name ; UNIMPL not implemented, placeholder only +; NOPROTO same as STD except do not create structure or +; function prototype in sys/sysproto.h. Does add a +; definition to syscall.h besides adding a sysent. #include #include @@ -369,7 +371,7 @@ 206AUE_NULLUNIMPL linux_io_setup 207AUE_NULLUNIMPL linux_io_destroy 208AUE_NULLUNIMPL linux_io_getevents -209AUE_NULLUNIMPL inux_io_submit +209AUE_NULLUNIMPL linux_io_submit 210AUE_NULLUNIMPL linux_io_cancel 211AUE_NULLUNIMPL linux_get_thread_area 212AUE_NULLSTD { int
svn commit: r313283 - head/sys/compat/linux
Author: trasz Date: Sun Feb 5 14:03:25 2017 New Revision: 313283 URL: https://svnweb.freebsd.org/changeset/base/313283 Log: Fix linux_pipe() and linux_pipe2() to close file descriptors on copyout error. Reviewed by: dchagin MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D9425 Modified: head/sys/compat/linux/linux_file.c Modified: head/sys/compat/linux/linux_file.c == --- head/sys/compat/linux/linux_file.c Sun Feb 5 13:37:23 2017 (r313282) +++ head/sys/compat/linux/linux_file.c Sun Feb 5 14:03:25 2017 (r313283) @@ -1537,11 +1537,16 @@ linux_pipe(struct thread *td, struct lin #endif error = kern_pipe(td, fildes, 0, NULL, NULL); - if (error) + if (error != 0) return (error); - /* XXX: Close descriptors on error. */ - return (copyout(fildes, args->pipefds, sizeof(fildes))); + error = copyout(fildes, args->pipefds, sizeof(fildes)); + if (error != 0) { + (void)kern_close(td, fildes[0]); + (void)kern_close(td, fildes[1]); + } + + return (error); } int @@ -1564,11 +1569,16 @@ linux_pipe2(struct thread *td, struct li if ((args->flags & LINUX_O_CLOEXEC) != 0) flags |= O_CLOEXEC; error = kern_pipe(td, fildes, flags, NULL, NULL); - if (error) + if (error != 0) return (error); - /* XXX: Close descriptors on error. */ - return (copyout(fildes, args->pipefds, sizeof(fildes))); + error = copyout(fildes, args->pipefds, sizeof(fildes)); + if (error != 0) { + (void)kern_close(td, fildes[0]); + (void)kern_close(td, fildes[1]); + } + + return (error); } int ___ 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"
svn commit: r313282 - in head/sys: kern sys
Author: mjg Date: Sun Feb 5 13:37:23 2017 New Revision: 313282 URL: https://svnweb.freebsd.org/changeset/base/313282 Log: rwlock: move lockstat handling out of inline primitives See r313275 for details. One difference here is that recursion handling was removed from the fallback routine. As it is it was never supposed to see a recursed lock in the first place. Future changes will move it out of inline variants, but right now there is no easy to way to test if the lock is recursed without reading additional words. Modified: head/sys/kern/kern_rwlock.c head/sys/sys/rwlock.h Modified: head/sys/kern/kern_rwlock.c == --- head/sys/kern/kern_rwlock.c Sun Feb 5 13:24:54 2017(r313281) +++ head/sys/kern/kern_rwlock.c Sun Feb 5 13:37:23 2017(r313282) @@ -283,6 +283,7 @@ void _rw_wlock_cookie(volatile uintptr_t *c, const char *file, int line) { struct rwlock *rw; + uintptr_t tid, v; if (SCHEDULER_STOPPED()) return; @@ -296,7 +297,14 @@ _rw_wlock_cookie(volatile uintptr_t *c, ("rw_wlock() of destroyed rwlock @ %s:%d", file, line)); WITNESS_CHECKORDER(>lock_object, LOP_NEWORDER | LOP_EXCLUSIVE, file, line, NULL); - __rw_wlock(rw, curthread, file, line); + tid = (uintptr_t)curthread; + v = RW_UNLOCKED; + if (!_rw_write_lock_fetch(rw, , tid)) + _rw_wlock_hard(rw, v, tid, file, line); + else + LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(rw__acquire, rw, + 0, 0, file, line, LOCKSTAT_WRITER); + LOCK_LOG_LOCK("WLOCK", >lock_object, 0, rw->rw_recurse, file, line); WITNESS_LOCK(>lock_object, LOP_EXCLUSIVE, file, line); TD_LOCKS_INC(curthread); @@ -355,7 +363,11 @@ _rw_wunlock_cookie(volatile uintptr_t *c WITNESS_UNLOCK(>lock_object, LOP_EXCLUSIVE, file, line); LOCK_LOG_LOCK("WUNLOCK", >lock_object, 0, rw->rw_recurse, file, line); - __rw_wunlock(rw, curthread, file, line); + if (rw->rw_recurse) + rw->rw_recurse--; + else + _rw_wunlock_hard(rw, (uintptr_t)curthread, file, line); + TD_LOCKS_DEC(curthread); } @@ -998,13 +1010,12 @@ __rw_wunlock_hard(volatile uintptr_t *c, return; rw = rwlock2rw(c); + MPASS(!rw_recursed(rw)); - if (rw_wlocked(rw) && rw_recursed(rw)) { - rw->rw_recurse--; - if (LOCK_LOG_TEST(>lock_object, 0)) - CTR2(KTR_LOCK, "%s: %p unrecursing", __func__, rw); + LOCKSTAT_PROFILE_RELEASE_RWLOCK(rw__release, rw, + LOCKSTAT_WRITER); + if (_rw_write_unlock(rw, tid)) return; - } KASSERT(rw->rw_lock & (RW_LOCK_READ_WAITERS | RW_LOCK_WRITE_WAITERS), ("%s: neither of the waiter flags are set", __func__)); Modified: head/sys/sys/rwlock.h == --- head/sys/sys/rwlock.h Sun Feb 5 13:24:54 2017(r313281) +++ head/sys/sys/rwlock.h Sun Feb 5 13:37:23 2017(r313282) @@ -84,10 +84,8 @@ #define_rw_write_lock(rw, tid) \ atomic_cmpset_acq_ptr(&(rw)->rw_lock, RW_UNLOCKED, (tid)) -#define_rw_write_lock_fetch(rw, vp, tid) ({ \ - *vp = RW_UNLOCKED; \ - atomic_fcmpset_acq_ptr(&(rw)->rw_lock, vp, (tid)); \ -}) +#define_rw_write_lock_fetch(rw, vp, tid) \ + atomic_fcmpset_acq_ptr(&(rw)->rw_lock, vp, (tid)) /* Release a write lock quickly if there are no waiters. */ #define_rw_write_unlock(rw, tid) \ @@ -102,13 +100,11 @@ /* Acquire a write lock. */ #define__rw_wlock(rw, tid, file, line) do { \ uintptr_t _tid = (uintptr_t)(tid); \ - uintptr_t _v; \ + uintptr_t _v = RW_UNLOCKED; \ \ - if (!_rw_write_lock_fetch((rw), &_v, _tid)) \ + if (__predict_false(LOCKSTAT_PROFILE_ENABLED(rw__acquire) ||\ + !_rw_write_lock_fetch((rw), &_v, _tid)))\ _rw_wlock_hard((rw), _v, _tid, (file), (line)); \ - else\ - LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(rw__acquire, rw, \ - 0, 0, file, line, LOCKSTAT_WRITER); \ } while (0) /* Release a write lock. */ @@ -118,9 +114,8 @@ if ((rw)->rw_recurse)
svn commit: r313281 - in head/sys: compat/freebsd32 compat/linux kern sys
Author: trasz Date: Sun Feb 5 13:24:54 2017 New Revision: 313281 URL: https://svnweb.freebsd.org/changeset/base/313281 Log: Add kern_cpuset_getaffinity() and kern_cpuset_getaffinity(), and use it in compats instead of their sys_*() counterparts. Reviewed by: kib, jhb, dchagin MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D9383 Modified: head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/linux/linux_misc.c head/sys/kern/kern_cpuset.c head/sys/sys/syscallsubr.h Modified: head/sys/compat/freebsd32/freebsd32_misc.c == --- head/sys/compat/freebsd32/freebsd32_misc.c Sun Feb 5 09:54:16 2017 (r313280) +++ head/sys/compat/freebsd32/freebsd32_misc.c Sun Feb 5 13:24:54 2017 (r313281) @@ -2554,30 +2554,18 @@ int freebsd32_cpuset_getaffinity(struct thread *td, struct freebsd32_cpuset_getaffinity_args *uap) { - struct cpuset_getaffinity_args ap; - ap.level = uap->level; - ap.which = uap->which; - ap.id = PAIR32TO64(id_t,uap->id); - ap.cpusetsize = uap->cpusetsize; - ap.mask = uap->mask; - - return (sys_cpuset_getaffinity(td, )); + return (kern_cpuset_getaffinity(td, uap->level, uap->which, + PAIR32TO64(id_t,uap->id), uap->cpusetsize, uap->mask)); } int freebsd32_cpuset_setaffinity(struct thread *td, struct freebsd32_cpuset_setaffinity_args *uap) { - struct cpuset_setaffinity_args ap; - - ap.level = uap->level; - ap.which = uap->which; - ap.id = PAIR32TO64(id_t,uap->id); - ap.cpusetsize = uap->cpusetsize; - ap.mask = uap->mask; - return (sys_cpuset_setaffinity(td, )); + return (kern_cpuset_setaffinity(td, uap->level, uap->which, + PAIR32TO64(id_t,uap->id), uap->cpusetsize, uap->mask)); } int Modified: head/sys/compat/linux/linux_misc.c == --- head/sys/compat/linux/linux_misc.c Sun Feb 5 09:54:16 2017 (r313280) +++ head/sys/compat/linux/linux_misc.c Sun Feb 5 13:24:54 2017 (r313281) @@ -2102,7 +2102,6 @@ linux_sched_getaffinity(struct thread *t { int error; struct thread *tdt; - struct cpuset_getaffinity_args cga; #ifdef DEBUG if (ldebug(sched_getaffinity)) @@ -2117,13 +2116,10 @@ linux_sched_getaffinity(struct thread *t return (ESRCH); PROC_UNLOCK(tdt->td_proc); - cga.level = CPU_LEVEL_WHICH; - cga.which = CPU_WHICH_TID; - cga.id = tdt->td_tid; - cga.cpusetsize = sizeof(cpuset_t); - cga.mask = (cpuset_t *) args->user_mask_ptr; - if ((error = sys_cpuset_getaffinity(td, )) == 0) + error = kern_cpuset_getaffinity(td, CPU_LEVEL_WHICH, CPU_WHICH_TID, + tdt->td_tid, sizeof(cpuset_t), (cpuset_t *)args->user_mask_ptr); + if (error == 0) td->td_retval[0] = sizeof(cpuset_t); return (error); @@ -2136,7 +2132,6 @@ int linux_sched_setaffinity(struct thread *td, struct linux_sched_setaffinity_args *args) { - struct cpuset_setaffinity_args csa; struct thread *tdt; #ifdef DEBUG @@ -2152,13 +2147,9 @@ linux_sched_setaffinity(struct thread *t return (ESRCH); PROC_UNLOCK(tdt->td_proc); - csa.level = CPU_LEVEL_WHICH; - csa.which = CPU_WHICH_TID; - csa.id = tdt->td_tid; - csa.cpusetsize = sizeof(cpuset_t); - csa.mask = (cpuset_t *) args->user_mask_ptr; - return (sys_cpuset_setaffinity(td, )); + return (kern_cpuset_setaffinity(td, CPU_LEVEL_WHICH, CPU_WHICH_TID, + tdt->td_tid, sizeof(cpuset_t), (cpuset_t *) args->user_mask_ptr)); } struct linux_rlimit64 { Modified: head/sys/kern/kern_cpuset.c == --- head/sys/kern/kern_cpuset.c Sun Feb 5 09:54:16 2017(r313280) +++ head/sys/kern/kern_cpuset.c Sun Feb 5 13:24:54 2017(r313281) @@ -1078,6 +1078,15 @@ struct cpuset_getaffinity_args { int sys_cpuset_getaffinity(struct thread *td, struct cpuset_getaffinity_args *uap) { + + return (kern_cpuset_getaffinity(td, uap->level, uap->which, + uap->id, uap->cpusetsize, uap->mask)); +} + +int +kern_cpuset_getaffinity(struct thread *td, cpulevel_t level, cpuwhich_t which, +id_t id, size_t cpusetsize, cpuset_t *maskp) +{ struct thread *ttd; struct cpuset *nset; struct cpuset *set; @@ -1086,18 +1095,17 @@ sys_cpuset_getaffinity(struct thread *td int error; size_t size; - if (uap->cpusetsize < sizeof(cpuset_t) || - uap->cpusetsize > CPU_MAXSIZE / NBBY) + if (cpusetsize < sizeof(cpuset_t) || cpusetsize > CPU_MAXSIZE / NBBY) return (ERANGE); - size = uap->cpusetsize; + size = cpusetsize;
Re: svn commit: r312910 - in head: . etc/etc.pc98 etc/rc.d lib/libsysdecode libexec release release/doc release/doc/en_US.ISO8859-1/hardware release/doc/en_US.ISO8859-1/readme release/doc/share/exampl
I have decided to remove pc98 support on stable/11 as well after 2 weeks to reduce conflicts between head and stable/11. In article <201701280222.v0s2mfsr022...@repo.freebsd.org> Takahashi Yoshihirowrites: > Author: nyan > Date: Sat Jan 28 02:22:15 2017 > New Revision: 312910 > URL: https://svnweb.freebsd.org/changeset/base/312910 > > Log: > Remove pc98 support completely. > I thank all developers and contributors for pc98. > > Relnotes: yes > > Deleted: > head/etc/etc.pc98/ > head/libexec/Makefile.pc98 > head/release/pc98/ > head/sbin/Makefile.pc98 > head/sbin/fdisk_pc98/ > head/share/man/man4/man4.i386/ct.4 > head/share/man/man4/man4.i386/snc.4 > head/share/syscons/keymaps/jp.pc98.iso.kbd > head/share/syscons/keymaps/jp.pc98.kbd > head/share/vt/keymaps/jp.pc98.iso.kbd > head/share/vt/keymaps/jp.pc98.kbd > head/sys/boot/Makefile.pc98 > head/sys/boot/pc98/ > head/sys/conf/Makefile.pc98 > head/sys/conf/files.pc98 > head/sys/conf/options.pc98 > head/sys/dev/aic/aic_cbus.c > head/sys/dev/ata/ata-cbus.c > head/sys/dev/ct/ > head/sys/dev/ed/if_ed98.h > head/sys/dev/ed/if_ed_cbus.c > head/sys/dev/fdc/fdc_cbus.c > head/sys/dev/fe/if_fe_cbus.c > head/sys/dev/ic/i8251.h > head/sys/dev/ic/wd33c93reg.h > head/sys/dev/le/if_le_cbus.c > head/sys/dev/mse/mse_cbus.c > head/sys/dev/snc/ > head/sys/dev/uart/uart_cpu_pc98.c > head/sys/geom/geom_pc98.c > head/sys/geom/geom_pc98_enc.c > head/sys/geom/part/g_part_pc98.c > head/sys/modules/canbepm/ > head/sys/modules/canbus/ > head/sys/modules/ct/ > head/sys/modules/geom/geom_part/geom_part_pc98/ > head/sys/modules/geom/geom_pc98/ > head/sys/modules/pmc/ > head/sys/modules/snc/ > head/sys/pc98/ > head/sys/sys/disk/pc98.h > head/sys/sys/diskpc98.h > head/usr.bin/mkimg/pc98.c > head/usr.bin/mkimg/tests/img-1x1-4096-pc98.qcow.gz.uu > head/usr.bin/mkimg/tests/img-1x1-4096-pc98.qcow2.gz.uu > head/usr.bin/mkimg/tests/img-1x1-4096-pc98.raw.gz.uu > head/usr.bin/mkimg/tests/img-1x1-4096-pc98.vhd.gz.uu > head/usr.bin/mkimg/tests/img-1x1-4096-pc98.vhdf.gz.uu > head/usr.bin/mkimg/tests/img-1x1-4096-pc98.vmdk.gz.uu > head/usr.bin/mkimg/tests/img-1x1-512-pc98.qcow.gz.uu > head/usr.bin/mkimg/tests/img-1x1-512-pc98.qcow2.gz.uu > head/usr.bin/mkimg/tests/img-1x1-512-pc98.raw.gz.uu > head/usr.bin/mkimg/tests/img-1x1-512-pc98.vhd.gz.uu > head/usr.bin/mkimg/tests/img-1x1-512-pc98.vhdf.gz.uu > head/usr.bin/mkimg/tests/img-1x1-512-pc98.vmdk.gz.uu > head/usr.bin/mkimg/tests/img-63x255-4096-pc98.qcow.gz.uu > head/usr.bin/mkimg/tests/img-63x255-4096-pc98.qcow2.gz.uu > head/usr.bin/mkimg/tests/img-63x255-4096-pc98.raw.gz.uu > head/usr.bin/mkimg/tests/img-63x255-4096-pc98.vhd.gz.uu > head/usr.bin/mkimg/tests/img-63x255-4096-pc98.vhdf.gz.uu > head/usr.bin/mkimg/tests/img-63x255-4096-pc98.vmdk.gz.uu > head/usr.bin/mkimg/tests/img-63x255-512-pc98.qcow.gz.uu > head/usr.bin/mkimg/tests/img-63x255-512-pc98.qcow2.gz.uu > head/usr.bin/mkimg/tests/img-63x255-512-pc98.raw.gz.uu > head/usr.bin/mkimg/tests/img-63x255-512-pc98.vhd.gz.uu > head/usr.bin/mkimg/tests/img-63x255-512-pc98.vhdf.gz.uu > head/usr.bin/mkimg/tests/img-63x255-512-pc98.vmdk.gz.uu > head/usr.sbin/boot98cfg/ > head/usr.sbin/bsdinstall/partedit/partedit_pc98.c > Modified: > head/Makefile > head/Makefile.inc1 > head/ObsoleteFiles.inc > head/etc/rc.d/syscons > head/lib/libsysdecode/Makefile > head/lib/libsysdecode/mkioctls > head/release/doc/README > head/release/doc/en_US.ISO8859-1/hardware/article.xml > head/release/doc/en_US.ISO8859-1/readme/article.xml > head/release/doc/share/examples/Makefile.relnotesng > head/release/doc/share/misc/dev.archlist.txt > head/release/doc/share/xml/release.ent > head/release/rc.local > head/rescue/rescue/Makefile > head/sbin/bsdlabel/bsdlabel.8 > head/sbin/bsdlabel/bsdlabel.c > head/sbin/geom/class/part/gpart.8 > head/share/examples/bootforth/frames.4th > head/share/man/man4/adv.4 > head/share/man/man4/ahc.4 > head/share/man/man4/apic.4 > head/share/man/man4/ed.4 > head/share/man/man4/esp.4 > head/share/man/man4/fxp.4 > head/share/man/man4/geom.4 > head/share/man/man4/man4.i386/Makefile > head/share/man/man4/man4.i386/aic.4 > head/share/man/man4/ncr.4 > head/share/man/man4/ncv.4 > head/share/man/man4/sym.4 > head/share/mk/bsd.stand.mk > head/share/mk/local.meta.sys.mk > head/share/syscons/keymaps/INDEX.keymaps > head/share/syscons/keymaps/Makefile > head/share/vt/keymaps/INDEX.keymaps > head/share/vt/keymaps/Makefile > head/sys/Makefile > head/sys/boot/common/Makefile.inc > head/sys/boot/common/isapnp.h > head/sys/boot/ficl/loader.c > head/sys/boot/forth/frames.4th > head/sys/cam/cam_xpt.c > head/sys/conf/NOTES > head/sys/conf/config.mk > head/sys/conf/files > head/sys/conf/files.amd64 > head/sys/conf/files.i386 > head/sys/conf/options >
Re: svn commit: r313272 - in head/sys: kern sys
On Sun, Feb 05, 2017 at 05:20:29AM +, Mateusz Guzik wrote: > Author: mjg > Date: Sun Feb 5 05:20:29 2017 > New Revision: 313272 > URL: https://svnweb.freebsd.org/changeset/base/313272 > > Log: > sx: uninline slock/sunlock > > Shared locking routines explicitly read the value and test it. If the > change attempt fails, they fall back to a regular function which would > retry in a loop. > > The problem is that with many concurrent readers the risk of failure is > pretty > high and even the value returned by fcmpset is very likely going to be stale > by the time the loop in the fallback routine is reached. > > Uninline said primitives. It gives a throughput increase when doing > concurrent > slocks/sunlocks with 80 hardware threads from ~50 mln/s to ~56 mln/s. > > Interestingly, rwlock primitives are already not inlined. > Note that calling to "hard" primitives each is somewhat expensive. In order to remedy part of the cost I intend to introduce uninlined variants which only know how to spin. I have a WIP patch for rwlocks and after I flesh it out I'll adapt it for sx. > Modified: > head/sys/kern/kern_sx.c > head/sys/sys/sx.h > > Modified: head/sys/kern/kern_sx.c > == > --- head/sys/kern/kern_sx.c Sun Feb 5 04:54:20 2017(r313271) > +++ head/sys/kern/kern_sx.c Sun Feb 5 05:20:29 2017(r313272) > @@ -276,29 +276,6 @@ sx_destroy(struct sx *sx) > } > > int > -_sx_slock(struct sx *sx, int opts, const char *file, int line) > -{ > - int error = 0; > - > - if (SCHEDULER_STOPPED()) > - return (0); > - KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), > - ("sx_slock() by idle thread %p on sx %s @ %s:%d", > - curthread, sx->lock_object.lo_name, file, line)); > - KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, > - ("sx_slock() of destroyed sx @ %s:%d", file, line)); > - WITNESS_CHECKORDER(>lock_object, LOP_NEWORDER, file, line, NULL); > - error = __sx_slock(sx, opts, file, line); > - if (!error) { > - LOCK_LOG_LOCK("SLOCK", >lock_object, 0, 0, file, line); > - WITNESS_LOCK(>lock_object, 0, file, line); > - TD_LOCKS_INC(curthread); > - } > - > - return (error); > -} > - > -int > sx_try_slock_(struct sx *sx, const char *file, int line) > { > uintptr_t x; > @@ -391,21 +368,6 @@ sx_try_xlock_(struct sx *sx, const char > } > > void > -_sx_sunlock(struct sx *sx, const char *file, int line) > -{ > - > - if (SCHEDULER_STOPPED()) > - return; > - KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, > - ("sx_sunlock() of destroyed sx @ %s:%d", file, line)); > - _sx_assert(sx, SA_SLOCKED, file, line); > - WITNESS_UNLOCK(>lock_object, 0, file, line); > - LOCK_LOG_LOCK("SUNLOCK", >lock_object, 0, 0, file, line); > - __sx_sunlock(sx, file, line); > - TD_LOCKS_DEC(curthread); > -} > - > -void > _sx_xunlock(struct sx *sx, const char *file, int line) > { > > @@ -840,14 +802,8 @@ _sx_xunlock_hard(struct sx *sx, uintptr_ > kick_proc0(); > } > > -/* > - * This function represents the so-called 'hard case' for sx_slock > - * operation. All 'easy case' failures are redirected to this. Note > - * that ideally this would be a static function, but it needs to be > - * accessible from at least sx.h. > - */ > int > -_sx_slock_hard(struct sx *sx, int opts, const char *file, int line) > +_sx_slock(struct sx *sx, int opts, const char *file, int line) > { > GIANT_DECLARE; > #ifdef ADAPTIVE_SX > @@ -1051,14 +1007,8 @@ _sx_slock_hard(struct sx *sx, int opts, > return (error); > } > > -/* > - * This function represents the so-called 'hard case' for sx_sunlock > - * operation. All 'easy case' failures are redirected to this. Note > - * that ideally this would be a static function, but it needs to be > - * accessible from at least sx.h. > - */ > void > -_sx_sunlock_hard(struct sx *sx, const char *file, int line) > +_sx_sunlock(struct sx *sx, const char *file, int line) > { > uintptr_t x; > int wakeup_swapper; > @@ -1066,6 +1016,7 @@ _sx_sunlock_hard(struct sx *sx, const ch > if (SCHEDULER_STOPPED()) > return; > > + LOCKSTAT_PROFILE_RELEASE_RWLOCK(sx__release, sx, LOCKSTAT_READER); > x = SX_READ_VALUE(sx); > for (;;) { > /* > > Modified: head/sys/sys/sx.h > == > --- head/sys/sys/sx.h Sun Feb 5 04:54:20 2017(r313271) > +++ head/sys/sys/sx.h Sun Feb 5 05:20:29 2017(r313272) > @@ -111,10 +111,8 @@ void _sx_sunlock(struct sx *sx, const ch > void _sx_xunlock(struct sx *sx, const char *file, int line); > int _sx_xlock_hard(struct sx *sx, uintptr_t v, uintptr_t tid, int opts, > const char *file, int line); > -int _sx_slock_hard(struct sx *sx,
Re: svn commit: r313275 - in head/sys: kern sys
On Sun, Feb 05, 2017 at 11:01:28AM +0100, Mateusz Guzik wrote: > On Sun, Feb 05, 2017 at 01:00:11PM +0300, Slawa Olhovchenkov wrote: > > On Sun, Feb 05, 2017 at 08:04:12AM +, Mateusz Guzik wrote: > > > > > Author: mjg > > > Date: Sun Feb 5 08:04:11 2017 > > > New Revision: 313275 > > > URL: https://svnweb.freebsd.org/changeset/base/313275 > > > > > > Log: > > > mtx: move lockstat handling out of inline primitives > > > > > > Lockstat requires checking if it is enabled and if so, calling a 6 > > > argument > > > function. Further, determining whether to call it on unlock requires > > > pre-reading the lock value. > > > > > > This is problematic in at least 3 ways: > > > - more branches in the hot path than necessary > > > - additional cacheline ping pong under contention > > > - bigger code > > > > > > Instead, check first if lockstat handling is necessary and if so, just > > > fall > > > back to regular locking routines. For this purpose a new macro is > > > introduced > > > (LOCKSTAT_PROFILE_ENABLED). > > > > > > LOCK_PROFILING uninlines all primitives. Fold in the current inline lock > > > variant into the _mtx_lock_flags to retain the support. With this change > > > the inline variants are not used when LOCK_PROFILING is defined and thus > > > can ignore its existence. > > > > > > This results in: > > > textdata bss dec hex filename > > > 222596671303208 4994976 285578511b3c21b kernel.orig > > > 217973151303208 4994976 280954991acb40b kernel.patched > > > > > > i.e. about 3% reduction in text size. > > > > > > A remaining action is to remove spurious arguments for internal kernel > > > consumers. > > > > Do you planed MFC all of this? > > Yes, around march. Thanks! ___ 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: r313275 - in head/sys: kern sys
On Sun, Feb 05, 2017 at 01:00:11PM +0300, Slawa Olhovchenkov wrote: > On Sun, Feb 05, 2017 at 08:04:12AM +, Mateusz Guzik wrote: > > > Author: mjg > > Date: Sun Feb 5 08:04:11 2017 > > New Revision: 313275 > > URL: https://svnweb.freebsd.org/changeset/base/313275 > > > > Log: > > mtx: move lockstat handling out of inline primitives > > > > Lockstat requires checking if it is enabled and if so, calling a 6 > > argument > > function. Further, determining whether to call it on unlock requires > > pre-reading the lock value. > > > > This is problematic in at least 3 ways: > > - more branches in the hot path than necessary > > - additional cacheline ping pong under contention > > - bigger code > > > > Instead, check first if lockstat handling is necessary and if so, just > > fall > > back to regular locking routines. For this purpose a new macro is > > introduced > > (LOCKSTAT_PROFILE_ENABLED). > > > > LOCK_PROFILING uninlines all primitives. Fold in the current inline lock > > variant into the _mtx_lock_flags to retain the support. With this change > > the inline variants are not used when LOCK_PROFILING is defined and thus > > can ignore its existence. > > > > This results in: > > text data bss dec hex filename > > 22259667 1303208 4994976 285578511b3c21b kernel.orig > > 21797315 1303208 4994976 280954991acb40b kernel.patched > > > > i.e. about 3% reduction in text size. > > > > A remaining action is to remove spurious arguments for internal kernel > > consumers. > > Do you planed MFC all of this? Yes, around march. -- Mateusz Guzik ___ 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: r313275 - in head/sys: kern sys
On Sun, Feb 05, 2017 at 08:04:12AM +, Mateusz Guzik wrote: > Author: mjg > Date: Sun Feb 5 08:04:11 2017 > New Revision: 313275 > URL: https://svnweb.freebsd.org/changeset/base/313275 > > Log: > mtx: move lockstat handling out of inline primitives > > Lockstat requires checking if it is enabled and if so, calling a 6 argument > function. Further, determining whether to call it on unlock requires > pre-reading the lock value. > > This is problematic in at least 3 ways: > - more branches in the hot path than necessary > - additional cacheline ping pong under contention > - bigger code > > Instead, check first if lockstat handling is necessary and if so, just fall > back to regular locking routines. For this purpose a new macro is introduced > (LOCKSTAT_PROFILE_ENABLED). > > LOCK_PROFILING uninlines all primitives. Fold in the current inline lock > variant into the _mtx_lock_flags to retain the support. With this change > the inline variants are not used when LOCK_PROFILING is defined and thus > can ignore its existence. > > This results in: > textdata bss dec hex filename > 222596671303208 4994976 285578511b3c21b kernel.orig > 217973151303208 4994976 280954991acb40b kernel.patched > > i.e. about 3% reduction in text size. > > A remaining action is to remove spurious arguments for internal kernel > consumers. Do you planed MFC all of this? ___ 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"
svn commit: r313280 - in head/sys: kern sys
Author: mjg Date: Sun Feb 5 09:54:16 2017 New Revision: 313280 URL: https://svnweb.freebsd.org/changeset/base/313280 Log: sx: move lockstat handling out of inline primitives See r313275 for details. Modified: head/sys/kern/kern_sx.c head/sys/sys/sx.h Modified: head/sys/kern/kern_sx.c == --- head/sys/kern/kern_sx.c Sun Feb 5 09:53:13 2017(r313279) +++ head/sys/kern/kern_sx.c Sun Feb 5 09:54:16 2017(r313280) @@ -310,6 +310,7 @@ sx_try_slock_(struct sx *sx, const char int _sx_xlock(struct sx *sx, int opts, const char *file, int line) { + uintptr_t tid, x; int error = 0; if (SCHEDULER_STOPPED()) @@ -321,7 +322,13 @@ _sx_xlock(struct sx *sx, int opts, const ("sx_xlock() of destroyed sx @ %s:%d", file, line)); WITNESS_CHECKORDER(>lock_object, LOP_NEWORDER | LOP_EXCLUSIVE, file, line, NULL); - error = __sx_xlock(sx, curthread, opts, file, line); + tid = (uintptr_t)curthread; + x = SX_LOCK_UNLOCKED; + if (!atomic_fcmpset_acq_ptr(>sx_lock, , tid)) + error = _sx_xlock_hard(sx, x, tid, opts, file, line); + else + LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(sx__acquire, sx, + 0, 0, file, line, LOCKSTAT_WRITER); if (!error) { LOCK_LOG_LOCK("XLOCK", >lock_object, 0, sx->sx_recurse, file, line); @@ -379,7 +386,7 @@ _sx_xunlock(struct sx *sx, const char *f WITNESS_UNLOCK(>lock_object, LOP_EXCLUSIVE, file, line); LOCK_LOG_LOCK("XUNLOCK", >lock_object, 0, sx->sx_recurse, file, line); - __sx_xunlock(sx, curthread, file, line); + _sx_xunlock_hard(sx, (uintptr_t)curthread, file, line); TD_LOCKS_DEC(curthread); } @@ -757,8 +764,13 @@ _sx_xunlock_hard(struct sx *sx, uintptr_ MPASS(!(sx->sx_lock & SX_LOCK_SHARED)); - /* If the lock is recursed, then unrecurse one level. */ - if (sx_xlocked(sx) && sx_recursed(sx)) { + if (!sx_recursed(sx)) { + LOCKSTAT_PROFILE_RELEASE_RWLOCK(sx__release, sx, + LOCKSTAT_WRITER); + if (atomic_cmpset_rel_ptr(>sx_lock, tid, SX_LOCK_UNLOCKED)) + return; + } else { + /* The lock is recursed, unrecurse one level. */ if ((--sx->sx_recurse) == 0) atomic_clear_ptr(>sx_lock, SX_LOCK_RECURSED); if (LOCK_LOG_TEST(>lock_object, 0)) Modified: head/sys/sys/sx.h == --- head/sys/sys/sx.h Sun Feb 5 09:53:13 2017(r313279) +++ head/sys/sys/sx.h Sun Feb 5 09:54:16 2017(r313280) @@ -145,21 +145,19 @@ struct sx_args { * deferred to 'tougher' functions. */ +#if(LOCK_DEBUG == 0) && !defined(SX_NOINLINE) /* Acquire an exclusive lock. */ static __inline int __sx_xlock(struct sx *sx, struct thread *td, int opts, const char *file, int line) { uintptr_t tid = (uintptr_t)td; - uintptr_t v; + uintptr_t v = SX_LOCK_UNLOCKED; int error = 0; - v = SX_LOCK_UNLOCKED; - if (!atomic_fcmpset_acq_ptr(>sx_lock, , tid)) + if (__predict_false(LOCKSTAT_PROFILE_ENABLED(sx__acquire) || + !atomic_fcmpset_acq_ptr(>sx_lock, , tid))) error = _sx_xlock_hard(sx, v, tid, opts, file, line); - else - LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(sx__acquire, sx, - 0, 0, file, line, LOCKSTAT_WRITER); return (error); } @@ -170,12 +168,11 @@ __sx_xunlock(struct sx *sx, struct threa { uintptr_t tid = (uintptr_t)td; - if (sx->sx_recurse == 0) - LOCKSTAT_PROFILE_RELEASE_RWLOCK(sx__release, sx, - LOCKSTAT_WRITER); - if (!atomic_cmpset_rel_ptr(>sx_lock, tid, SX_LOCK_UNLOCKED)) + if (__predict_false(LOCKSTAT_PROFILE_ENABLED(sx__release) || + !atomic_cmpset_rel_ptr(>sx_lock, tid, SX_LOCK_UNLOCKED))) _sx_xunlock_hard(sx, tid, file, line); } +#endif /* * Public interface for lock operations. ___ 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"
svn commit: r313279 - head/sys/kern
Author: mjg Date: Sun Feb 5 09:53:13 2017 New Revision: 313279 URL: https://svnweb.freebsd.org/changeset/base/313279 Log: mtx: fixup r313278, the assignemnt was supposed to go inside the loop Modified: head/sys/kern/kern_mutex.c Modified: head/sys/kern/kern_mutex.c == --- head/sys/kern/kern_mutex.c Sun Feb 5 09:35:17 2017(r313278) +++ head/sys/kern/kern_mutex.c Sun Feb 5 09:53:13 2017(r313279) @@ -782,9 +782,9 @@ thread_lock_flags_(struct thread *td, in #ifdef KDTRACE_HOOKS spin_time -= lockstat_nsecs(>td_lock->lock_object); #endif - v = MTX_UNOWNED; for (;;) { retry: + v = MTX_UNOWNED; spinlock_enter(); m = td->td_lock; KASSERT(m->mtx_lock != MTX_DESTROYED, ___ 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"
svn commit: r313278 - head/sys/kern
Author: mjg Date: Sun Feb 5 09:35:17 2017 New Revision: 313278 URL: https://svnweb.freebsd.org/changeset/base/313278 Log: mtx: fix up _mtx_obtain_lock_fetch usage in thread lock Since _mtx_obtain_lock_fetch no longer sets the argument to MTX_UNOWNED, callers have to do it on their own. Modified: head/sys/kern/kern_mutex.c Modified: head/sys/kern/kern_mutex.c == --- head/sys/kern/kern_mutex.c Sun Feb 5 08:51:41 2017(r313277) +++ head/sys/kern/kern_mutex.c Sun Feb 5 09:35:17 2017(r313278) @@ -782,6 +782,7 @@ thread_lock_flags_(struct thread *td, in #ifdef KDTRACE_HOOKS spin_time -= lockstat_nsecs(>td_lock->lock_object); #endif + v = MTX_UNOWNED; for (;;) { retry: spinlock_enter(); ___ 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"
svn commit: r313277 - head/usr.bin/sed
Author: delphij Date: Sun Feb 5 08:51:41 2017 New Revision: 313277 URL: https://svnweb.freebsd.org/changeset/base/313277 Log: Restore r312404: Use S_ISREG instead of manual & (also it's better to compare the result from & and the pattern instead of just assuming it's one bit value). Pointed out by Tianjie Mao . MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D4827 Modified: head/usr.bin/sed/main.c Modified: head/usr.bin/sed/main.c == --- head/usr.bin/sed/main.c Sun Feb 5 08:24:37 2017(r313276) +++ head/usr.bin/sed/main.c Sun Feb 5 08:51:41 2017(r313277) @@ -391,7 +391,7 @@ mf_fgets(SPACE *sp, enum e_spflag spflag if (inplace != NULL) { if (lstat(fname, ) != 0) err(1, "%s", fname); - if (!(sb.st_mode & S_IFREG)) + if (!S_ISREG(sb.st_mode)) errx(1, "%s: %s %s", fname, "in-place editing only", "works for regular files"); ___ 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"
svn commit: r313276 - head/etc
Author: ngie Date: Sun Feb 5 08:24:37 2017 New Revision: 313276 URL: https://svnweb.freebsd.org/changeset/base/313276 Log: Use kldload -n when loading if_deqna This fixes if_deqna from being loaded by accident twice if it's already loaded in the kernel. MFC after:1 week Sponsored by: Dell EMC Isilon Modified: head/etc/devd.conf Modified: head/etc/devd.conf == --- head/etc/devd.conf Sun Feb 5 08:04:11 2017(r313275) +++ head/etc/devd.conf Sun Feb 5 08:24:37 2017(r313276) @@ -272,7 +272,7 @@ nomatch 10 { match "bus" "pccard[0-9]+"; match "manufacturer" "0x1234"; match "product" "0x2323"; - action "kldload if_deqna"; + action "kldload -n if_deqna"; }; attach 10 { device-name "deqna[0-9]+"; ___ 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"
svn commit: r313275 - in head/sys: kern sys
Author: mjg Date: Sun Feb 5 08:04:11 2017 New Revision: 313275 URL: https://svnweb.freebsd.org/changeset/base/313275 Log: mtx: move lockstat handling out of inline primitives Lockstat requires checking if it is enabled and if so, calling a 6 argument function. Further, determining whether to call it on unlock requires pre-reading the lock value. This is problematic in at least 3 ways: - more branches in the hot path than necessary - additional cacheline ping pong under contention - bigger code Instead, check first if lockstat handling is necessary and if so, just fall back to regular locking routines. For this purpose a new macro is introduced (LOCKSTAT_PROFILE_ENABLED). LOCK_PROFILING uninlines all primitives. Fold in the current inline lock variant into the _mtx_lock_flags to retain the support. With this change the inline variants are not used when LOCK_PROFILING is defined and thus can ignore its existence. This results in: text data bss dec hex filename 22259667 1303208 4994976 285578511b3c21b kernel.orig 21797315 1303208 4994976 280954991acb40b kernel.patched i.e. about 3% reduction in text size. A remaining action is to remove spurious arguments for internal kernel consumers. Modified: head/sys/kern/kern_mutex.c head/sys/sys/lockstat.h head/sys/sys/mutex.h head/sys/sys/sdt.h Modified: head/sys/kern/kern_mutex.c == --- head/sys/kern/kern_mutex.c Sun Feb 5 06:51:45 2017(r313274) +++ head/sys/kern/kern_mutex.c Sun Feb 5 08:04:11 2017(r313275) @@ -265,6 +265,7 @@ void __mtx_lock_flags(volatile uintptr_t *c, int opts, const char *file, int line) { struct mtx *m; + uintptr_t tid, v; if (SCHEDULER_STOPPED()) return; @@ -282,7 +283,13 @@ __mtx_lock_flags(volatile uintptr_t *c, WITNESS_CHECKORDER(>lock_object, (opts & ~MTX_RECURSE) | LOP_NEWORDER | LOP_EXCLUSIVE, file, line, NULL); - __mtx_lock(m, curthread, opts, file, line); + tid = (uintptr_t)curthread; + v = MTX_UNOWNED; + if (!_mtx_obtain_lock_fetch(m, , tid)) + _mtx_lock_sleep(m, v, tid, opts, file, line); + else + LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(adaptive__acquire, + m, 0, 0, file, line); LOCK_LOG_LOCK("LOCK", >lock_object, opts, m->mtx_recurse, file, line); WITNESS_LOCK(>lock_object, (opts & ~MTX_RECURSE) | LOP_EXCLUSIVE, @@ -310,7 +317,7 @@ __mtx_unlock_flags(volatile uintptr_t *c line); mtx_assert(m, MA_OWNED); - __mtx_unlock(m, curthread, opts, file, line); + __mtx_unlock_sleep(c, opts, file, line); TD_LOCKS_DEC(curthread); } @@ -887,20 +894,17 @@ __mtx_unlock_sleep(volatile uintptr_t *c { struct mtx *m; struct turnstile *ts; - uintptr_t v; if (SCHEDULER_STOPPED()) return; m = mtxlock2mtx(c); - v = MTX_READ_VALUE(m); - if (v == (uintptr_t)curthread) { + if (!mtx_recursed(m)) { + LOCKSTAT_PROFILE_RELEASE_LOCK(adaptive__release, m); if (_mtx_release_lock(m, (uintptr_t)curthread)) return; - } - - if (mtx_recursed(m)) { + } else { if (--(m->mtx_recurse) == 0) atomic_clear_ptr(>mtx_lock, MTX_RECURSED); if (LOCK_LOG_TEST(>lock_object, opts)) Modified: head/sys/sys/lockstat.h == --- head/sys/sys/lockstat.h Sun Feb 5 06:51:45 2017(r313274) +++ head/sys/sys/lockstat.h Sun Feb 5 08:04:11 2017(r313275) @@ -107,6 +107,10 @@ extern int lockstat_enabled; LOCKSTAT_RECORD1(probe, lp, a); \ } while (0) +#ifndef LOCK_PROFILING +#defineLOCKSTAT_PROFILE_ENABLED(probe) SDT_PROBE_ENABLED(lockstat, , , probe) +#endif + struct lock_object; uint64_t lockstat_nsecs(struct lock_object *); @@ -130,6 +134,10 @@ uint64_t lockstat_nsecs(struct lock_obje #defineLOCKSTAT_PROFILE_RELEASE_RWLOCK(probe, lp, a) \ LOCKSTAT_PROFILE_RELEASE_LOCK(probe, lp) +#ifndef LOCK_PROFILING +#defineLOCKSTAT_PROFILE_ENABLED(probe) 0 +#endif + #endif /* !KDTRACE_HOOKS */ #endif /* _KERNEL */ #endif /* _SYS_LOCKSTAT_H */ Modified: head/sys/sys/mutex.h == --- head/sys/sys/mutex.hSun Feb 5 06:51:45 2017(r313274) +++ head/sys/sys/mutex.hSun Feb 5 08:04:11 2017(r313275) @@ -171,10 +171,8 @@ void thread_lock_flags_(struct thread *, #define _mtx_obtain_lock(mp, tid) \ atomic_cmpset_acq_ptr(&(mp)->mtx_lock,