From owner-svn-src-head@freebsd.org Sun Jan 7 00:44:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C9C5DFDCAC; Sun, 7 Jan 2018 00:44:24 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BC126A807; Sun, 7 Jan 2018 00:44:24 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74BE019D62; Sun, 7 Jan 2018 00:44:23 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w070iNRt047873; Sun, 7 Jan 2018 00:44:23 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w070iMGX047862; Sun, 7 Jan 2018 00:44:22 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201801070044.w070iMGX047862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sun, 7 Jan 2018 00:44:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327662 - in head: . tests/sys/geom/class/eli X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: . tests/sys/geom/class/eli X-SVN-Commit-Revision: 327662 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 00:44:24 -0000 Author: asomers Date: Sun Jan 7 00:44:22 2018 New Revision: 327662 URL: https://svnweb.freebsd.org/changeset/base/327662 Log: geli: convert most tests from TAP to ATF I'm leaving readonly_test and nokey_test alone for now. In a future commit they should be broken up into several smaller test cases and distributed between multiple files. Reviewed by: ngie MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D13717 Added: head/tests/sys/geom/class/eli/attach_test.sh (contents, props changed) head/tests/sys/geom/class/eli/configure_test.sh (contents, props changed) head/tests/sys/geom/class/eli/detach_test.sh (contents, props changed) head/tests/sys/geom/class/eli/integrity_test.sh (contents, props changed) Deleted: head/tests/sys/geom/class/eli/attach_d_test.sh head/tests/sys/geom/class/eli/configure_b_B_test.sh head/tests/sys/geom/class/eli/detach_l_test.sh head/tests/sys/geom/class/eli/init_B_test.sh head/tests/sys/geom/class/eli/init_J_test.sh head/tests/sys/geom/class/eli/init_a_test.sh head/tests/sys/geom/class/eli/init_alias_test.sh head/tests/sys/geom/class/eli/init_i_P_test.sh head/tests/sys/geom/class/eli/integrity_copy_test.sh head/tests/sys/geom/class/eli/integrity_data_test.sh head/tests/sys/geom/class/eli/integrity_hmac_test.sh head/tests/sys/geom/class/eli/onetime_a_test.sh head/tests/sys/geom/class/eli/onetime_d_test.sh Modified: head/ObsoleteFiles.inc head/tests/sys/geom/class/eli/Makefile head/tests/sys/geom/class/eli/conf.sh head/tests/sys/geom/class/eli/delkey_test.sh head/tests/sys/geom/class/eli/init_test.sh head/tests/sys/geom/class/eli/kill_test.sh head/tests/sys/geom/class/eli/onetime_test.sh head/tests/sys/geom/class/eli/resize_test.sh head/tests/sys/geom/class/eli/setkey_test.sh Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sun Jan 7 00:38:34 2018 (r327661) +++ head/ObsoleteFiles.inc Sun Jan 7 00:44:22 2018 (r327662) @@ -38,6 +38,20 @@ # xargs -n1 | sort | uniq -d; # done +# 20180106: Convert most geli(8) tests to ATF +OLD_FILES+=tests/sys/geom/class/eli/attach_d_test.sh +OLD_FILES+=tests/sys/geom/class/eli/configure_b_B_test.sh +OLD_FILES+=tests/sys/geom/class/eli/detach_l_test.sh +OLD_FILES+=tests/sys/geom/class/eli/init_B_test.sh +OLD_FILES+=tests/sys/geom/class/eli/init_J_test.sh +OLD_FILES+=tests/sys/geom/class/eli/init_a_test.sh +OLD_FILES+=tests/sys/geom/class/eli/init_alias_test.sh +OLD_FILES+=tests/sys/geom/class/eli/init_i_P_test.sh +OLD_FILES+=tests/sys/geom/class/eli/integrity_copy_test.sh +OLD_FILES+=tests/sys/geom/class/eli/integrity_data_test.sh +OLD_FILES+=tests/sys/geom/class/eli/integrity_hmac_test.sh +OLD_FILES+=tests/sys/geom/class/eli/onetime_a_test.sh +OLD_FILES+=tests/sys/geom/class/eli/onetime_d_test.sh # 20171230: Remove /etc/skel from mtree OLD_DIRS+=/etc/skel # 20171208: Remove basename_r(3) Modified: head/tests/sys/geom/class/eli/Makefile ============================================================================== --- head/tests/sys/geom/class/eli/Makefile Sun Jan 7 00:38:34 2018 (r327661) +++ head/tests/sys/geom/class/eli/Makefile Sun Jan 7 00:44:22 2018 (r327662) @@ -7,36 +7,20 @@ PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} ATF_TESTS_C= pbkdf2_test +ATF_TESTS_SH+= attach_test +ATF_TESTS_SH+= configure_test +ATF_TESTS_SH+= delkey_test +ATF_TESTS_SH+= detach_test +ATF_TESTS_SH+= init_test +ATF_TESTS_SH+= integrity_test +ATF_TESTS_SH+= kill_test +ATF_TESTS_SH+= onetime_test +ATF_TESTS_SH+= resize_test +ATF_TESTS_SH+= setkey_test -TAP_TESTS_SH+= attach_d_test -TAP_TESTS_SH+= configure_b_B_test -TAP_TESTS_SH+= delkey_test -TAP_TESTS_SH+= detach_l_test -TAP_TESTS_SH+= init_B_test -TAP_TESTS_SH+= init_J_test -TAP_TESTS_SH+= init_a_test -TAP_TESTS_SH+= init_alias_test -TAP_TESTS_SH+= init_i_P_test -TAP_TESTS_SH+= init_test -TAP_TESTS_SH+= integrity_copy_test -TAP_TESTS_SH+= integrity_data_test -TAP_TESTS_SH+= integrity_hmac_test -TAP_TESTS_SH+= kill_test TAP_TESTS_SH+= nokey_test -TAP_TESTS_SH+= onetime_a_test -TAP_TESTS_SH+= onetime_d_test -TAP_TESTS_SH+= onetime_test TAP_TESTS_SH+= readonly_test -TAP_TESTS_SH+= resize_test -TAP_TESTS_SH+= setkey_test -TEST_METADATA.init_a_test+= timeout="3600" -TEST_METADATA.init_test+= timeout="600" -TEST_METADATA.integrity_copy_test+= timeout="3600" -TEST_METADATA.integrity_data_test+= timeout="1800" -TEST_METADATA.integrity_hmac_test+= timeout="1800" -TEST_METADATA.onetime_a_test+= timeout="1800" -TEST_METADATA.onetime_test+= timeout="1800" ${PACKAGE}FILES+= conf.sh Added: head/tests/sys/geom/class/eli/attach_test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/geom/class/eli/attach_test.sh Sun Jan 7 00:44:22 2018 (r327662) @@ -0,0 +1,45 @@ +# $FreeBSD$ + +atf_test_case attach_d cleanup +attach_d_head() +{ + atf_set "descr" "geli attach -d will cause the provider to detach on last close" + atf_set "require.user" "root" +} +attach_d_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) + + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + + atf_check geli init -B none -P -K keyfile ${md} + atf_check geli attach -d -p -k keyfile ${md} + + # Be sure it doesn't detach on read. + atf_check dd if=/dev/${md}.eli of=/dev/null status=none + sleep 1 + if [ ! -c /dev/${md}.eli ]; then + atf_fail "Detached on last close of a reader" + fi + + # It should detach on last close of a writer + true > /dev/${md}.eli + sleep 1 + if [ -c /dev/${md}.eli ]; then + atf_fail "Did not detach on last close of a writer" + fi + +} +attach_d_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case attach_d +} Modified: head/tests/sys/geom/class/eli/conf.sh ============================================================================== --- head/tests/sys/geom/class/eli/conf.sh Sun Jan 7 00:38:34 2018 (r327661) +++ head/tests/sys/geom/class/eli/conf.sh Sun Jan 7 00:44:22 2018 (r327662) @@ -2,8 +2,19 @@ # $FreeBSD$ class="eli" -base=`basename $0` +base=$(atf_get ident) +[ -z "$base" ] && base=`basename $0` # for TAP compatibility +TEST_MDS_FILE=md.devs +attach_md() +{ + local test_md + + test_md=$(mdconfig -a "$@") || atf_fail "failed to allocate md(4)" + echo $test_md >> $TEST_MDS_FILE || exit + echo $test_md +} + # Execute `func` for each combination of cipher, sectorsize, and hmac algo # `func` usage should be: # func @@ -23,7 +34,11 @@ for_each_geli_config() { for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 \ hmac/sha384 hmac/sha512; do for secsize in 512 1024 2048 4096 8192; do - bytes=`expr $secsize \* $sectors + 512`b + # Double the requested sector size to allow + # for the HMACs' storage space. + osecsize=$(( $secsize * 2 )) + # geli needs 512B for the label. + bytes=`expr $osecsize \* $sectors + 512`b md=$(attach_md -t malloc -s $bytes) ${func} $cipher $aalgo $secsize geli detach ${md} 2>/dev/null @@ -50,6 +65,7 @@ for_each_geli_config_nointegrity() { ealgo=${cipher%%:*} keylen=${cipher##*:} for secsize in 512 1024 2048 4096 8192; do + # geli needs 512B for the label. bytes=`expr $secsize \* $sectors + 512`b md=$(attach_md -t malloc -s $bytes) ${func} $cipher $secsize @@ -69,8 +85,9 @@ geli_test_cleanup() mdconfig -d -u $md 2>/dev/null done < $TEST_MDS_FILE fi - rm -f "$TEST_MDS_FILE" + true } +# TODO: remove the trap statement once all TAP tests are converted trap geli_test_cleanup ABRT EXIT INT TERM . `dirname $0`/../geom_subr.sh Added: head/tests/sys/geom/class/eli/configure_test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/geom/class/eli/configure_test.sh Sun Jan 7 00:44:22 2018 (r327662) @@ -0,0 +1,59 @@ +# $FreeBSD$ + +atf_test_case configure_b_B cleanup +configure_b_B_head() +{ + atf_set "descr" "geli configure -b will set the BOOT flag" + atf_set "require.user" "root" +} +configure_b_B_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) + + atf_check geli init -B none -P -K /dev/null ${md} + + atf_check -s exit:0 -o match:'flags: 0x0$' geli dump ${md} + + atf_check geli init -B none -b -P -K /dev/null ${md} + + atf_check -s exit:0 -o match:'flags: 0x2$' geli dump ${md} + + atf_check geli configure -B ${md} + + atf_check -s exit:0 -o match:'flags: 0x0$' geli dump ${md} + + atf_check geli configure -b ${md} + + atf_check -s exit:0 -o match:'flags: 0x2$' geli dump ${md} + + atf_check geli attach -p -k /dev/null ${md} + + atf_check -s exit:0 -o match:'^Flags: .*BOOT' geli list ${md}.eli + + atf_check geli configure -B ${md} + + atf_check -o not-match:'^Flags: .*BOOT' geli list ${md}.eli + + atf_check -s exit:0 -o match:'flags: 0x0$' geli dump ${md} + + atf_check geli configure -b ${md} + + atf_check -s exit:0 -o match:'^Flags: .*BOOT' geli list ${md}.eli + + atf_check -s exit:0 -o match:'flags: 0x2$' geli dump ${md} + + atf_check geli detach ${md} +} +configure_b_B_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case configure_b_B +} Modified: head/tests/sys/geom/class/eli/delkey_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/delkey_test.sh Sun Jan 7 00:38:34 2018 (r327661) +++ head/tests/sys/geom/class/eli/delkey_test.sh Sun Jan 7 00:44:22 2018 (r327662) @@ -1,140 +1,86 @@ #!/bin/sh # $FreeBSD$ -. $(dirname $0)/conf.sh +atf_test_case delkey cleanup +delkey_head() +{ + atf_set "descr" "geli delkey can destroy the master key" + atf_set "require.user" "root" +} +delkey_body() +{ + . $(atf_get_srcdir)/conf.sh -base=`basename $0` -sectors=100 -keyfile1=`mktemp $base.XXXXXX` || exit 1 -keyfile2=`mktemp $base.XXXXXX` || exit 1 -keyfile3=`mktemp $base.XXXXXX` || exit 1 -keyfile4=`mktemp $base.XXXXXX` || exit 1 -md=$(attach_md -t malloc -s `expr $sectors + 1`) + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) -echo "1..14" + atf_check dd if=/dev/random of=keyfile1 bs=512 count=16 status=none + atf_check dd if=/dev/random of=keyfile2 bs=512 count=16 status=none + atf_check dd if=/dev/random of=keyfile3 bs=512 count=16 status=none + atf_check dd if=/dev/random of=keyfile4 bs=512 count=16 status=none -dd if=/dev/random of=${keyfile1} bs=512 count=16 >/dev/null 2>&1 -dd if=/dev/random of=${keyfile2} bs=512 count=16 >/dev/null 2>&1 -dd if=/dev/random of=${keyfile3} bs=512 count=16 >/dev/null 2>&1 -dd if=/dev/random of=${keyfile4} bs=512 count=16 >/dev/null 2>&1 + atf_check geli init -B none -P -K keyfile1 ${md} + atf_check geli attach -p -k keyfile1 ${md} + atf_check -s exit:0 -o ignore geli setkey -n 1 -P -K keyfile2 ${md} -geli init -B none -P -K $keyfile1 ${md} -geli attach -p -k $keyfile1 ${md} -geli setkey -n 1 -P -K $keyfile2 ${md} + # Remove key 0 for attached provider. + atf_check geli delkey -n 0 ${md} + atf_check geli detach ${md} -# Remove key 0 for attached provider. -geli delkey -n 0 ${md} -if [ $? -eq 0 ]; then - echo "ok 1" -else - echo "not ok 1" -fi -geli detach ${md} + # We cannot use keyfile1 anymore. + atf_check -s not-exit:0 -e match:"Wrong key" \ + geli attach -p -k keyfile1 ${md} -# We cannot use keyfile1 anymore. -geli attach -p -k $keyfile1 ${md} 2>/dev/null -if [ $? -ne 0 ]; then - echo "ok 2" -else - echo "not ok 2" -fi + # Attach with key 1. + atf_check geli attach -p -k keyfile2 ${md} -# Attach with key 1. -geli attach -p -k $keyfile2 ${md} -if [ $? -eq 0 ]; then - echo "ok 3" -else - echo "not ok 3" -fi + # We cannot remove last key without -f option (for attached provider). + atf_check -s not-exit:0 -e match:"This is the last Master Key" \ + geli delkey -n 1 ${md} -# We cannot remove last key without -f option (for attached provider). -geli delkey -n 1 ${md} 2>/dev/null -if [ $? -ne 0 ]; then - echo "ok 4" -else - echo "not ok 4" -fi + # Remove last key for attached provider. + atf_check geli delkey -f -n 1 ${md} -# Remove last key for attached provider. -geli delkey -f -n 1 ${md} -if [ $? -eq 0 ]; then - echo "ok 5" -else - echo "not ok 5" -fi + # If there are no valid keys, but provider is attached, we can save situation. + atf_check -s exit:0 -o ignore geli setkey -n 0 -P -K keyfile3 ${md} + atf_check geli detach ${md} -# If there are no valid keys, but provider is attached, we can save situation. -geli setkey -n 0 -P -K $keyfile3 ${md} -if [ $? -eq 0 ]; then - echo "ok 6" -else - echo "not ok 6" -fi -geli detach ${md} + # We cannot use keyfile2 anymore. + atf_check -s not-exit:0 -e match:"Wrong key" \ + geli attach -p -k keyfile2 ${md} -# We cannot use keyfile2 anymore. -geli attach -p -k $keyfile2 ${md} 2>/dev/null -if [ $? -ne 0 ]; then - echo "ok 7" -else - echo "not ok 7" -fi + # Attach with key 0. + atf_check geli attach -p -k keyfile3 ${md} -# Attach with key 0. -geli attach -p -k $keyfile3 ${md} -if [ $? -eq 0 ]; then - echo "ok 8" -else - echo "not ok 8" -fi + # Setup key 1. + atf_check -s exit:0 -o ignore geli setkey -n 1 -P -K keyfile4 ${md} + atf_check geli detach ${md} -# Setup key 1. -geli setkey -n 1 -P -K $keyfile4 ${md} -if [ $? -eq 0 ]; then - echo "ok 9" -else - echo "not ok 9" -fi -geli detach ${md} + # Remove key 1 for detached provider. + atf_check geli delkey -n 1 ${md} -# Remove key 1 for detached provider. -geli delkey -n 1 ${md} -if [ $? -eq 0 ]; then - echo "ok 10" -else - echo "not ok 10" -fi + # We cannot use keyfile4 anymore. + atf_check -s not-exit:0 -e match:"Wrong key" \ + geli attach -p -k keyfile4 ${md} -# We cannot use keyfile4 anymore. -geli attach -p -k $keyfile4 ${md} 2>/dev/null -if [ $? -ne 0 ]; then - echo "ok 11" -else - echo "not ok 11" -fi + # We cannot remove last key without -f option (for detached provider). + atf_check -s not-exit:0 -e match:"This is the last Master Key" \ + geli delkey -n 0 ${md} -# We cannot remove last key without -f option (for detached provider). -geli delkey -n 0 ${md} 2>/dev/null -if [ $? -ne 0 ]; then - echo "ok 12" -else - echo "not ok 12" -fi + # Remove last key for detached provider. + atf_check geli delkey -f -n 0 ${md} -# Remove last key for detached provider. -geli delkey -f -n 0 ${md} -if [ $? -eq 0 ]; then - echo "ok 13" -else - echo "not ok 13" -fi + # We cannot use keyfile3 anymore. + atf_check -s not-exit:0 -e match:"No valid keys" \ + geli attach -p -k keyfile3 ${md} +} +delkey_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} -# We cannot use keyfile3 anymore. -geli attach -p -k $keyfile3 ${md} 2>/dev/null -if [ $? -ne 0 ]; then - echo "ok 14" -else - echo "not ok 14" -fi - -rm -f $keyfile1 $keyfile2 $keyfile3 $keyfile4 +atf_init_test_cases() +{ + atf_add_test_case delkey +} Added: head/tests/sys/geom/class/eli/detach_test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/geom/class/eli/detach_test.sh Sun Jan 7 00:44:22 2018 (r327662) @@ -0,0 +1,46 @@ +# $FreeBSD$ + +atf_test_case detach_l cleanup +detach_l_head() +{ + atf_set "descr" "geli detach -l will cause a provider to detach on last close" + atf_set "require.user" "root" +} +detach_l_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) + + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + + atf_check geli init -B none -P -K keyfile ${md} + atf_check geli attach -p -k keyfile ${md} + + # Be sure it doesn't detach before 'detach -l'. + atf_check dd if=/dev/${md}.eli of=/dev/null status=none + sleep 1 + if [ ! -c /dev/${md}.eli ]; then + atf_fail "provider detached on last close without detach -l" + fi + atf_check geli detach -l ${md} + if [ ! -c /dev/${md}.eli ]; then + atf_fail "Provider detached before last close" + fi + atf_check dd if=/dev/${md}.eli of=/dev/null status=none + sleep 1 + if [ -c /dev/${md}.eli ]; then + atf_fail "Provider did not detach on last close" + fi +} +detach_l_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case detach_l +} Modified: head/tests/sys/geom/class/eli/init_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/init_test.sh Sun Jan 7 00:38:34 2018 (r327661) +++ head/tests/sys/geom/class/eli/init_test.sh Sun Jan 7 00:44:22 2018 (r327662) @@ -1,50 +1,368 @@ #!/bin/sh # $FreeBSD$ -. $(dirname $0)/conf.sh +init_test() +{ + cipher=$1 + secsize=$2 + ealgo=${cipher%%:*} + keylen=${cipher##*:} -base=`basename $0` -sectors=32 -keyfile=`mktemp $base.XXXXXX` || exit 1 -rnd=`mktemp $base.XXXXXX` || exit 1 + atf_check -s exit:0 -e ignore \ + geli init -B none -e $ealgo -l $keylen -P -K keyfile -s $secsize ${md} + atf_check geli attach -p -k keyfile ${md} -echo "1..200" + secs=`diskinfo /dev/${md}.eli | awk '{print $4}'` -do_test() { + atf_check dd if=/dev/random of=rnd bs=${secsize} count=${secs} status=none + atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${secs} status=none + + md_rnd=`dd if=rnd bs=${secsize} count=${secs} status=none | md5` + atf_check_equal 0 $? + md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + atf_check_equal 0 $? + md_edev=`dd if=/dev/${md} bs=${secsize} count=${secs} status=none | md5` + atf_check_equal 0 $? + + if [ ${md_rnd} != ${md_ddev} ]; then + atf_fail "Miscompare for ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + if [ ${md_rnd} == ${md_edev} ]; then + atf_fail "Data was not encrypted for ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi +} +atf_test_case init cleanup +init_head() +{ + atf_set "descr" "Basic I/O with geli" + atf_set "require.user" "root" + atf_set "timeout" 600 +} +init_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=32 + + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + atf_check dd if=/dev/random of=rnd bs=8192 count=${sectors} status=none + for_each_geli_config_nointegrity init_test +} +init_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + +atf_test_case init_B cleanup +init_B_head() +{ + atf_set "descr" "init -B can select an alternate backup metadata file" + atf_set "require.user" "root" +} +init_B_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + + md=$(attach_md -t malloc -s $sectors) + + # -B none + rm -f /var/backups/${md}.eli + atf_check -s exit:0 -o ignore geli init -B none -P -K keyfile ${md} + if [ -f /var/backups/${md}.eli ]; then + atf_fail "geli created a backup file even with -B none" + fi + + # no -B + rm -f /var/backups/${md}.eli + atf_check -s exit:0 -o ignore geli init -P -K keyfile ${md} + if [ ! -f /var/backups/${md}.eli ]; then + atf_fail "geli did not create a backup file" + fi + atf_check geli clear ${md} + atf_check -s not-exit:0 -e ignore geli attach -p -k keyfile ${md} + atf_check -s exit:0 -o ignore geli restore /var/backups/${md}.eli ${md} + atf_check -s exit:0 -o ignore geli attach -p -k keyfile ${md} + atf_check geli detach ${md} + rm -f /var/backups/${md}.eli + + # -B file + rm -f backupfile + atf_check -s exit:0 -o ignore \ + geli init -B backupfile -P -K keyfile ${md} + if [ ! -f backupfile ]; then + atf_fail "geli init -B did not create a backup file" + fi + atf_check geli clear ${md} + atf_check -s not-exit:0 -e ignore geli attach -p -k keyfile ${md} + atf_check geli restore backupfile ${md} + atf_check geli attach -p -k keyfile ${md} +} +init_B_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + +atf_test_case init_J cleanup +init_J_head() +{ + atf_set "descr" "init -J accepts a passfile" + atf_set "require.user" "root" +} +init_J_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) + + atf_check dd if=/dev/random of=keyfile0 bs=512 count=16 status=none + atf_check dd if=/dev/random of=keyfile1 bs=512 count=16 status=none + dd if=/dev/random bs=512 count=16 status=none | sha1 > passfile0 + atf_check_equal 0 $? + dd if=/dev/random bs=512 count=16 status=none | sha1 > passfile1 + atf_check_equal 0 $? + + for iter in -1 0 64; do + atf_check -s not-exit:0 -e ignore \ + geli init -i ${iter} -B none -J passfile0 -P ${md} + atf_check -s not-exit:0 -e ignore \ + geli init -i ${iter} -B none -J passfile0 -P -K keyfile0 ${md} + atf_check geli init -i ${iter} -B none -J passfile0 -K keyfile0 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile0 -p ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -j passfile0 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -j keyfile0 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k passfile0 -p ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -j keyfile0 -k passfile0 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -j keyfile0 -k keyfile0 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -j passfile0 -k passfile0 ${md} + atf_check -s exit:0 -e ignore \ + geli attach -j passfile0 -k keyfile0 ${md} + atf_check -s exit:0 -e ignore geli detach ${md} + atf_check -s exit:0 -e ignore -x \ + "cat keyfile0 | geli attach -j passfile0 -k - ${md}" + atf_check -s exit:0 -e ignore geli detach ${md} + atf_check -s exit:0 -e ignore -x \ + "cat passfile0 | geli attach -j - -k keyfile0 ${md}" + atf_check -s exit:0 -e ignore geli detach ${md} + + atf_check -s not-exit:0 -e ignore \ + geli init -i ${iter} -B none -J passfile0 -J passfile1 -P ${md} + atf_check -s not-exit:0 -e ignore \ + geli init -i ${iter} -B none -J passfile0 -J passfile1 -P -K keyfile0 -K keyfile1 ${md} + atf_check -s exit:0 -e ignore \ + geli init -i ${iter} -B none -J passfile0 -J passfile1 -K keyfile0 -K keyfile1 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile0 -p ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile1 -p ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -j passfile0 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -j passfile1 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile0 -k keyfile1 -p ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -j passfile0 -j passfile1 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile0 -j passfile0 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile0 -j passfile1 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile1 -j passfile0 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile1 -j passfile1 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile0 -j passfile0 -j passfile1 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile1 -j passfile0 -j passfile1 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile0 -k keyfile1 -j passfile0 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile0 -k keyfile1 -j passfile1 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile1 -k keyfile0 -j passfile0 -j passfile1 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile0 -k keyfile1 -j passfile1 -j passfile0 ${md} + atf_check -s not-exit:0 -e ignore \ + geli attach -k keyfile1 -k keyfile0 -j passfile1 -j passfile0 ${md} + atf_check -s exit:0 -e ignore \ + geli attach -j passfile0 -j passfile1 -k keyfile0 -k keyfile1 ${md} + atf_check -s exit:0 -e ignore geli detach ${md} + atf_check -s exit:0 -e ignore -x \ + "cat passfile0 | geli attach -j - -j passfile1 -k keyfile0 -k keyfile1 ${md}" + atf_check -s exit:0 -e ignore geli detach ${md} + atf_check -s exit:0 -e ignore -x \ + "cat passfile1 | geli attach -j passfile0 -j - -k keyfile0 -k keyfile1 ${md}" + atf_check -s exit:0 -e ignore geli detach ${md} + atf_check -s exit:0 -e ignore -x \ + "cat keyfile0 | geli attach -j passfile0 -j passfile1 -k - -k keyfile1 ${md}" + atf_check -s exit:0 -e ignore geli detach ${md} + atf_check -s exit:0 -e ignore -x \ + "cat keyfile1 | geli attach -j passfile0 -j passfile1 -k keyfile0 -k - ${md}" + atf_check -s exit:0 -e ignore geli detach ${md} + atf_check -s exit:0 -e ignore -x \ + "cat keyfile0 keyfile1 | geli attach -j passfile0 -j passfile1 -k - ${md}" + atf_check -s exit:0 -e ignore geli detach ${md} + atf_check -s exit:0 -e ignore -x \ + "cat passfile0 passfile1 | awk '{printf \"%s\", \$0}' | geli attach -j - -k keyfile0 -k keyfile1 ${md}" + atf_check -s exit:0 -e ignore geli detach ${md} + done +} +init_J_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + +init_a_test() +{ cipher=$1 - secsize=$2 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - geli init -B none -e $ealgo -l $keylen -P -K $keyfile -s $secsize ${md} 2>/dev/null - geli attach -p -k $keyfile ${md} + atf_check -s exit:0 -e ignore geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K keyfile -s $secsize ${md} + atf_check geli attach -p -k keyfile ${md} secs=`diskinfo /dev/${md}.eli | awk '{print $4}'` - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/${md}.eli bs=${secsize} count=${secs} 2>/dev/null + atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${secs} status=none - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - md_edev=`dd if=/dev/${md} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_rnd=`dd if=rnd bs=${secsize} count=${secs} status=none | md5` + atf_check_equal 0 $? + md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${secs} status=none | md5` + atf_check_equal 0 $? - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + if [ ${md_rnd} != ${md_ddev} ]; then + atf_fail "Miscompare for aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" fi - i=$((i+1)) - if [ ${md_rnd} != ${md_edev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" +} +atf_test_case init_a cleanup +init_a_head() +{ + atf_set "descr" "I/O with geli and HMACs" + atf_set "require.user" "root" + atf_set "timeout" 3600 +} +init_a_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + atf_check dd if=/dev/random of=rnd bs=8192 count=${sectors} status=none + for_each_geli_config init_a_test + true +} +init_a_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + +init_alias_test() { + ealgo=$1 + keylen=$2 + expected_ealgo=$3 + expected_keylen=$4 + + atf_check geli init -B none -e $ealgo -l $keylen -P -K keyfile ${md} + atf_check geli attach -p -k keyfile ${md} + real_ealgo=`geli list ${md}.eli | awk '/EncryptionAlgorithm/ {print $2}'` + real_keylen=`geli list ${md}.eli | awk '/KeyLength/ {print $2}'` + + if [ "${real_ealgo}" != "${expected_ealgo}" ]; then + atf_fail "expected ${expected_ealgo} but got ${real_ealgo}" fi - i=$((i+1)) + + if [ "${real_keylen}" != "${expected_keylen}" ]; then + atf_fail "expected ${expected_keylen} but got ${real_keylen}" + fi + atf_check geli detach ${md} } +atf_test_case init_alias cleanup +init_alias_head() +{ + atf_set "descr" "geli init accepts cipher aliases" + atf_set "require.user" "root" +} +init_alias_body() +{ + . $(atf_get_srcdir)/conf.sh -i=1 -dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 -for_each_geli_config_nointegrity do_test + md=$(attach_md -t malloc -s 1024k) + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none -rm -f $rnd -rm -f $keyfile + for spec in aes:0:AES-XTS:128 aes:128:AES-XTS:128 aes:256:AES-XTS:256 \ + 3des:0:3DES-CBC:192 3des:192:3DES-CBC:192 \ + blowfish:0:Blowfish-CBC:128 blowfish:128:Blowfish-CBC:128 \ + blowfish:160:Blowfish-CBC:160 blowfish:192:Blowfish-CBC:192 \ + blowfish:224:Blowfish-CBC:224 blowfish:256:Blowfish-CBC:256 \ + blowfish:288:Blowfish-CBC:288 blowfish:352:Blowfish-CBC:352 \ + blowfish:384:Blowfish-CBC:384 blowfish:416:Blowfish-CBC:416 \ + blowfish:448:Blowfish-CBC:448 \ + camellia:0:CAMELLIA-CBC:128 camellia:128:CAMELLIA-CBC:128 \ + camellia:256:CAMELLIA-CBC:256 ; do + + ealgo=`echo $spec | cut -d : -f 1` + keylen=`echo $spec | cut -d : -f 2` + expected_ealgo=`echo $spec | cut -d : -f 3` + expected_keylen=`echo $spec | cut -d : -f 4` + + init_alias_test $ealgo $keylen $expected_ealgo $expected_keylen + done +} +init_alias_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + +atf_test_case init_i_P cleanup +init_i_P_head() +{ + atf_set "descr" "geli: Options -i and -P are mutually exclusive" + atf_set "require.user" "root" +} +init_i_P_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) + + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + + atf_check -s exit:1 -e "match:Options -i and -P are mutually exclusive"\ + geli init -B none -i 64 -P -K keyfile $md +} +init_i_P_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case init + atf_add_test_case init_B + atf_add_test_case init_J + atf_add_test_case init_a + atf_add_test_case init_alias + atf_add_test_case init_i_P +} Added: head/tests/sys/geom/class/eli/integrity_test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/geom/class/eli/integrity_test.sh Sun Jan 7 00:44:22 2018 (r327662) @@ -0,0 +1,160 @@ +# $FreeBSD$ + +copy_test() { + cipher=$1 + aalgo=$2 + secsize=$3 + ealgo=${cipher%%:*} + keylen=${cipher##*:} + + atf_check -s exit:0 -e ignore \ + geli init -B none -a $aalgo -e $ealgo -l $keylen -P \ + -K keyfile -s $secsize ${md} + atf_check geli attach -p -k keyfile ${md} + + atf_check dd if=/dev/random of=/dev/${md}.eli bs=${secsize} count=1 status=none + + atf_check geli detach ${md} + # Copy first small sector to the second small sector. + # This should be detected as corruption. + atf_check dd if=/dev/${md} of=sector bs=512 count=1 status=none + atf_check dd if=sector of=/dev/${md} bs=512 count=1 seek=1 status=none + atf_check geli attach -p -k keyfile ${md} + + atf_check -s not-exit:0 -e ignore \ + dd if=/dev/${md}.eli of=/dev/null bs=${secsize} count=1 + + # Fix the corruption + atf_check dd if=/dev/random of=/dev/${md}.eli bs=${secsize} count=2 status=none + atf_check dd if=/dev/${md}.eli of=/dev/null bs=${secsize} count=2 status=none + + # Copy first big sector to the second big sector. + # This should be detected as corruption. + ms=`diskinfo /dev/${md} | awk '{print $3 - 512}'` + ns=`diskinfo /dev/${md}.eli | awk '{print $4}'` + usecsize=`echo "($ms / $ns) - (($ms / $ns) % 512)" | bc` + atf_check geli detach ${md} + atf_check dd if=/dev/${md} bs=512 count=$(( ${usecsize} / 512 )) seek=$(( $secsize / 512 )) of=sector status=none + atf_check dd of=/dev/${md} bs=512 count=$(( ${usecsize} / 512 )) seek=$(( $secsize / 256 )) if=sector status=none + atf_check -s exit:0 -e ignore geli attach -p -k keyfile ${md} + atf_check -s not-exit:0 -e ignore \ + dd if=/dev/${md}.eli of=/dev/null bs=${secsize} count=$ns +} + +atf_test_case copy cleanup +copy_head() +{ + atf_set "descr" "geli will detect misdirected writes as corruption" + atf_set "require.user" "root" + atf_set "timeout" 3600 +} +copy_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=2 + + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + for_each_geli_config copy_test +} +copy_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + + +data_test() { + cipher=$1 + aalgo=$2 + secsize=$3 + ealgo=${cipher%%:*} + keylen=${cipher##*:} + + atf_check -s exit:0 -e ignore \ + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K keyfile \ + -s $secsize ${md} + + # Corrupt 8 bytes of data. + atf_check dd if=/dev/${md} of=sector bs=512 count=1 status=none + atf_check dd if=/dev/random of=sector bs=1 count=8 seek=64 conv=notrunc status=none + atf_check dd if=sector of=/dev/${md} bs=512 count=1 status=none + atf_check geli attach -p -k keyfile ${md} + + # Try to read from the corrupt sector + atf_check -s not-exit:0 -e ignore \ + dd if=/dev/${md}.eli of=/dev/null bs=${secsize} count=1 +} + +atf_test_case data cleanup +data_head() +{ + atf_set "descr" "With HMACs, geli will detect data corruption" + atf_set "require.user" "root" + atf_set "timeout" 1800 +} +data_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=2 + + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Jan 7 02:19:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA4F7E5D185; Sun, 7 Jan 2018 02:19:55 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 856826EB0D; Sun, 7 Jan 2018 02:19:55 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A918D1AE67; Sun, 7 Jan 2018 02:19:54 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w072JskF085252; Sun, 7 Jan 2018 02:19:54 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w072Jsx2085251; Sun, 7 Jan 2018 02:19:54 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801070219.w072Jsx2085251@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 7 Jan 2018 02:19:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327665 - head/sys/dev/extres/syscon X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/dev/extres/syscon X-SVN-Commit-Revision: 327665 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 02:19:55 -0000 Author: kevans Date: Sun Jan 7 02:19:54 2018 New Revision: 327665 URL: https://svnweb.freebsd.org/changeset/base/327665 Log: Fix bogus pass for syscon_generic introduced in r327621 ian@ pointed out that BUS_PASS_DEFAULT + $anything is bogus, given that BUS_PASS_DEFAULT is defined as __INT_MAX. Instead, we take a page out of imx6_usbphy's book and use BUS_PASS_DEFAULT - 1000 to achieve the desired effect of syscon_generic attaching before if_awg and other potential consumers, but late enough that more specialized implementations should have no problem attaching instead. Reported by: ian Modified: head/sys/dev/extres/syscon/syscon_generic.c Modified: head/sys/dev/extres/syscon/syscon_generic.c ============================================================================== --- head/sys/dev/extres/syscon/syscon_generic.c Sun Jan 7 01:08:10 2018 (r327664) +++ head/sys/dev/extres/syscon/syscon_generic.c Sun Jan 7 02:19:54 2018 (r327665) @@ -206,6 +206,11 @@ static device_method_t syscon_generic_dmethods[] = { DEFINE_CLASS_0(syscon_generic, syscon_generic_driver, syscon_generic_dmethods, sizeof(struct syscon_generic_softc)); static devclass_t syscon_generic_devclass; +/* + * syscon_generic needs to attach before other devices that may require it, such + * as if_awg, but later than others to give way for more specialized syscon + * implementations. + */ EARLY_DRIVER_MODULE(syscon_generic, simplebus, syscon_generic_driver, - syscon_generic_devclass, 0, 0, BUS_PASS_DEFAULT + BUS_PASS_ORDER_FIRST); + syscon_generic_devclass, 0, 0, BUS_PASS_DEFAULT - 1000); MODULE_VERSION(syscon_generic, 1); From owner-svn-src-head@freebsd.org Sun Jan 7 02:30:10 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43A55E5DBE8; Sun, 7 Jan 2018 02:30:10 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1F0816F053; Sun, 7 Jan 2018 02:30:10 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75EE51B039; Sun, 7 Jan 2018 02:30:09 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w072U9EO089382; Sun, 7 Jan 2018 02:30:09 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w072U9FX089379; Sun, 7 Jan 2018 02:30:09 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201801070230.w072U9FX089379@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sun, 7 Jan 2018 02:30:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327666 - head/tests/sys/geom/class/eli X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/tests/sys/geom/class/eli X-SVN-Commit-Revision: 327666 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 02:30:10 -0000 Author: asomers Date: Sun Jan 7 02:30:08 2018 New Revision: 327666 URL: https://svnweb.freebsd.org/changeset/base/327666 Log: geli: fix parallel execution of tests The trick is not to destroy an md(4) device during a test. That can create a "double-free" situation, because we also destroy md devices during test cleanup. MFC after: 2 weeks Modified: head/tests/sys/geom/class/eli/conf.sh head/tests/sys/geom/class/eli/init_test.sh head/tests/sys/geom/class/eli/onetime_test.sh Modified: head/tests/sys/geom/class/eli/conf.sh ============================================================================== --- head/tests/sys/geom/class/eli/conf.sh Sun Jan 7 02:19:54 2018 (r327665) +++ head/tests/sys/geom/class/eli/conf.sh Sun Jan 7 02:30:08 2018 (r327666) @@ -4,6 +4,7 @@ class="eli" base=$(atf_get ident) [ -z "$base" ] && base=`basename $0` # for TAP compatibility +MAX_SECSIZE=8192 TEST_MDS_FILE=md.devs attach_md() @@ -21,6 +22,11 @@ attach_md() for_each_geli_config() { func=$1 + # Double the sector size to allow for the HMACs' storage space. + osecsize=$(( $MAX_SECSIZE * 2 )) + # geli needs 512B for the label. + bytes=`expr $osecsize \* $sectors + 512`b + md=$(attach_md -t malloc -s $bytes) for cipher in aes-xts:128 aes-xts:256 \ aes-cbc:128 aes-cbc:192 aes-cbc:256 \ 3des-cbc:192 \ @@ -33,16 +39,9 @@ for_each_geli_config() { keylen=${cipher##*:} for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 \ hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - # Double the requested sector size to allow - # for the HMACs' storage space. - osecsize=$(( $secsize * 2 )) - # geli needs 512B for the label. - bytes=`expr $osecsize \* $sectors + 512`b - md=$(attach_md -t malloc -s $bytes) + for secsize in 512 1024 2048 4096 $MAX_SECSIZE; do ${func} $cipher $aalgo $secsize geli detach ${md} 2>/dev/null - mdconfig -d -u ${md} 2>/dev/null done done done @@ -54,6 +53,9 @@ for_each_geli_config() { for_each_geli_config_nointegrity() { func=$1 + # geli needs 512B for the label. + bytes=`expr $MAX_SECSIZE \* $sectors + 512`b + md=$(attach_md -t malloc -s $bytes) for cipher in aes-xts:128 aes-xts:256 \ aes-cbc:128 aes-cbc:192 aes-cbc:256 \ 3des-cbc:192 \ @@ -64,13 +66,9 @@ for_each_geli_config_nointegrity() { camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do ealgo=${cipher%%:*} keylen=${cipher##*:} - for secsize in 512 1024 2048 4096 8192; do - # geli needs 512B for the label. - bytes=`expr $secsize \* $sectors + 512`b - md=$(attach_md -t malloc -s $bytes) + for secsize in 512 1024 2048 4096 $MAX_SECSIZE; do ${func} $cipher $secsize geli detach ${md} 2>/dev/null - mdconfig -d -u ${md} 2>/dev/null done done } Modified: head/tests/sys/geom/class/eli/init_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/init_test.sh Sun Jan 7 02:19:54 2018 (r327665) +++ head/tests/sys/geom/class/eli/init_test.sh Sun Jan 7 02:30:08 2018 (r327666) @@ -9,19 +9,18 @@ init_test() keylen=${cipher##*:} atf_check -s exit:0 -e ignore \ - geli init -B none -e $ealgo -l $keylen -P -K keyfile -s $secsize ${md} + geli init -B none -e $ealgo -l $keylen -P -K keyfile + -s $secsize ${md} atf_check geli attach -p -k keyfile ${md} - secs=`diskinfo /dev/${md}.eli | awk '{print $4}'` + atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${sectors} \ + status=none - atf_check dd if=/dev/random of=rnd bs=${secsize} count=${secs} status=none - atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${secs} status=none - - md_rnd=`dd if=rnd bs=${secsize} count=${secs} status=none | md5` + md_rnd=`dd if=rnd bs=${secsize} count=${sectors} status=none | md5` atf_check_equal 0 $? - md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${sectors} status=none | md5` atf_check_equal 0 $? - md_edev=`dd if=/dev/${md} bs=${secsize} count=${secs} status=none | md5` + md_edev=`dd if=/dev/${md} bs=${secsize} count=${sectors} status=none | md5` atf_check_equal 0 $? if [ ${md_rnd} != ${md_ddev} ]; then @@ -45,7 +44,8 @@ init_body() sectors=32 atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none - atf_check dd if=/dev/random of=rnd bs=8192 count=${sectors} status=none + atf_check dd if=/dev/random of=rnd bs=$MAX_SECSIZE count=${sectors} \ + status=none for_each_geli_config_nointegrity init_test } init_cleanup() @@ -235,16 +235,16 @@ init_a_test() ealgo=${cipher%%:*} keylen=${cipher##*:} - atf_check -s exit:0 -e ignore geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K keyfile -s $secsize ${md} + atf_check -s exit:0 -e ignore \ + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K keyfile \ + -s $secsize ${md} atf_check geli attach -p -k keyfile ${md} - secs=`diskinfo /dev/${md}.eli | awk '{print $4}'` + atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${sectors} status=none - atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${secs} status=none - - md_rnd=`dd if=rnd bs=${secsize} count=${secs} status=none | md5` + md_rnd=`dd if=rnd bs=${secsize} count=${sectors} status=none | md5` atf_check_equal 0 $? - md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${secs} status=none | md5` + md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${sectors} status=none | md5` atf_check_equal 0 $? if [ ${md_rnd} != ${md_ddev} ]; then @@ -265,7 +265,8 @@ init_a_body() sectors=100 atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none - atf_check dd if=/dev/random of=rnd bs=8192 count=${sectors} status=none + atf_check dd if=/dev/random of=rnd bs=$MAX_SECSIZE count=${sectors} \ + status=none for_each_geli_config init_a_test true } @@ -348,7 +349,7 @@ init_i_P_body() atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none - atf_check -s exit:1 -e "match:Options -i and -P are mutually exclusive"\ + atf_check -s not-exit:0 -e "match:Options -i and -P are mutually exclusive"\ geli init -B none -i 64 -P -K keyfile $md } init_i_P_cleanup() Modified: head/tests/sys/geom/class/eli/onetime_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/onetime_test.sh Sun Jan 7 02:19:54 2018 (r327665) +++ head/tests/sys/geom/class/eli/onetime_test.sh Sun Jan 7 02:30:08 2018 (r327666) @@ -10,16 +10,14 @@ onetime_test() atf_check -s exit:0 -o ignore -e ignore \ geli onetime -e $ealgo -l $keylen -s $secsize ${md} - secs=`diskinfo /dev/${md}.eli | awk '{print $4}'` + atf_check dd if=/dev/random of=rnd bs=${secsize} count=${sectors} status=none + atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${sectors} status=none - atf_check dd if=/dev/random of=rnd bs=${secsize} count=${secs} status=none - atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${secs} status=none - - md_rnd=`dd if=rnd bs=${secsize} count=${secs} status=none | md5` + md_rnd=`dd if=rnd bs=${secsize} count=${sectors} status=none | md5` atf_check_equal 0 $? - md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${secs} status=none | md5` + md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${sectors} status=none | md5` atf_check_equal 0 $? - md_edev=`dd if=/dev/${md} bs=${secsize} count=${secs} status=none | md5` + md_edev=`dd if=/dev/${md} bs=${secsize} count=${sectors} status=none | md5` atf_check_equal 0 $? if [ ${md_rnd} != ${md_ddev} ]; then @@ -41,6 +39,7 @@ onetime_body() . $(atf_get_srcdir)/conf.sh sectors=100 + dd if=/dev/random of=rnd bs=${MAX_SECSIZE} count=${sectors} status=none for_each_geli_config_nointegrity onetime_test } onetime_cleanup() @@ -60,13 +59,11 @@ onetime_a_test() atf_check -s exit:0 -o ignore -e ignore \ geli onetime -a $aalgo -e $ealgo -l $keylen -s $secsize ${md} - secs=`diskinfo /dev/${md}.eli | awk '{print $4}'` + atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${sectors} status=none - atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${secs} status=none - - md_rnd=`dd if=rnd bs=${secsize} count=${secs} status=none | md5` + md_rnd=`dd if=rnd bs=${secsize} count=${sectors} status=none | md5` atf_check_equal 0 $? - md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${secs} status=none | md5` + md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${sectors} status=none | md5` atf_check_equal 0 $? if [ ${md_rnd} != ${md_ddev} ]; then From owner-svn-src-head@freebsd.org Sun Jan 7 03:31:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D85D3E6213C; Sun, 7 Jan 2018 03:31:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B3FC3722D7; Sun, 7 Jan 2018 03:31:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B0CC1BCD4; Sun, 7 Jan 2018 03:31:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w073VtWL019149; Sun, 7 Jan 2018 03:31:55 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w073Vttb019148; Sun, 7 Jan 2018 03:31:55 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801070331.w073Vttb019148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 7 Jan 2018 03:31:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327669 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 327669 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 03:31:57 -0000 Author: kevans Date: Sun Jan 7 03:31:55 2018 New Revision: 327669 URL: https://svnweb.freebsd.org/changeset/base/327669 Log: aw_sid: Add method for reading keys via prctl registers Technically supported on the later SoCs, this will only really be used to add support for the H3 sid. The H3 has a silicon bug that manifests itself by returning garbled rootkeys unless first read via the prctl registers. Modified: head/sys/arm/allwinner/aw_sid.c Modified: head/sys/arm/allwinner/aw_sid.c ============================================================================== --- head/sys/arm/allwinner/aw_sid.c Sun Jan 7 02:59:27 2018 (r327668) +++ head/sys/arm/allwinner/aw_sid.c Sun Jan 7 03:31:55 2018 (r327669) @@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -48,6 +50,16 @@ __FBSDID("$FreeBSD$"); #include +/* efuse registers */ +#define SID_PRCTL 0x40 +#define SID_PRCTL_OFFSET_MASK 0xff +#define SID_PRCTL_OFFSET(n) (((n) & SID_PRCTL_OFFSET_MASK) << 16) +#define SID_PRCTL_LOCK (0xac << 8) +#define SID_PRCTL_READ (0x01 << 1) +#define SID_PRCTL_WRITE (0x01 << 0) +#define SID_PRKEY 0x50 +#define SID_RDKEY 0x60 + #define SID_SRAM 0x200 #define SID_THERMAL_CALIB0 (SID_SRAM + 0x34) #define SID_THERMAL_CALIB1 (SID_SRAM + 0x38) @@ -56,6 +68,7 @@ __FBSDID("$FreeBSD$"); struct aw_sid_conf { bus_size_t rootkey_offset; + bool has_prctl; bool has_thermal; }; @@ -69,11 +82,13 @@ static const struct aw_sid_conf a20_conf = { static const struct aw_sid_conf a64_conf = { .rootkey_offset = SID_SRAM, + .has_prctl = true, .has_thermal = true, }; static const struct aw_sid_conf a83t_conf = { .rootkey_offset = SID_SRAM, + .has_prctl = true, .has_thermal = true, }; @@ -88,6 +103,7 @@ static struct ofw_compat_data compat_data[] = { struct aw_sid_softc { struct resource *res; struct aw_sid_conf *sid_conf; + struct mtx prctl_mtx; }; static struct aw_sid_softc *aw_sid_sc; @@ -105,8 +121,37 @@ enum sid_keys { #define WR4(sc, reg, val) bus_write_4((sc)->res, (reg), (val)) static int aw_sid_sysctl(SYSCTL_HANDLER_ARGS); +static int aw_sid_prctl_read(device_t dev, bus_size_t offset, uint32_t *val); + +/* + * offset here is offset into efuse space, rather than offset into sid register + * space. This form of read is only an option for newer SoC: A83t, H3, A64 + */ static int +aw_sid_prctl_read(device_t dev, bus_size_t offset, uint32_t *val) +{ + struct aw_sid_softc *sc; + uint32_t readval; + + sc = device_get_softc(dev); + if (!sc->sid_conf->has_prctl) + return (1); + + mtx_lock(&sc->prctl_mtx); + readval = SID_PRCTL_OFFSET(offset) | SID_PRCTL_LOCK | SID_PRCTL_READ; + WR4(sc, SID_PRCTL, readval); + /* Read bit will be cleared once read has concluded */ + while (RD4(sc, SID_PRCTL) & SID_PRCTL_READ) + continue; + readval = RD4(sc, SID_RDKEY); + mtx_unlock(&sc->prctl_mtx); + *val = readval; + + return (0); +} + +static int aw_sid_probe(device_t dev) { if (!ofw_bus_status_okay(dev)) @@ -131,8 +176,9 @@ aw_sid_attach(device_t dev) return (ENXIO); } - aw_sid_sc = sc; + mtx_init(&sc->prctl_mtx, device_get_nameunit(dev), NULL, MTX_DEF); sc->sid_conf = (struct aw_sid_conf *)ofw_bus_search_compatible(dev, compat_data)->ocd_data; + aw_sid_sc = sc; SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), From owner-svn-src-head@freebsd.org Sun Jan 7 04:59:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A6F0E68822; Sun, 7 Jan 2018 04:59:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFCF76668; Sun, 7 Jan 2018 04:59:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9568A1CA61; Sun, 7 Jan 2018 04:59:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w074xSb5052268; Sun, 7 Jan 2018 04:59:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w074xSaZ052266; Sun, 7 Jan 2018 04:59:28 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801070459.w074xSaZ052266@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 7 Jan 2018 04:59:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327670 - in head: share/man/man4 sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: share/man/man4 sys/arm/allwinner X-SVN-Commit-Revision: 327670 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 04:59:29 -0000 Author: kevans Date: Sun Jan 7 04:59:28 2018 New Revision: 327670 URL: https://svnweb.freebsd.org/changeset/base/327670 Log: aw_sid(4): Add support for Allwinner H3 The sid controller on the H3 is generally identical in location, size, and efuse offset to the a64 and the a83t. The main difference is that the H3 has a silicon bug that sometimes causes the rootkey (at least) to be garbled unless first read by the prctl registers. This device is currently not in our DTS and, as of now, is not yet present in mainline Linux DTS. Tested on: OrangePi One Modified: head/share/man/man4/aw_sid.4 head/sys/arm/allwinner/aw_sid.c Modified: head/share/man/man4/aw_sid.4 ============================================================================== --- head/share/man/man4/aw_sid.4 Sun Jan 7 03:31:55 2018 (r327669) +++ head/share/man/man4/aw_sid.4 Sun Jan 7 04:59:28 2018 (r327670) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 2, 2018 +.Dd January 6, 2018 .Dt AW_SID 4 .Os .Sh NAME @@ -52,6 +52,8 @@ allwinner,sun7i-a20-sid allwinner,sun50i-a64-sid .It allwinner,sun8i-a83t-sid +.It +allwinner,sun8i-h3-sid .El .Sh SYSCTL VARIABLES The following read-only variables are available via Modified: head/sys/arm/allwinner/aw_sid.c ============================================================================== --- head/sys/arm/allwinner/aw_sid.c Sun Jan 7 03:31:55 2018 (r327669) +++ head/sys/arm/allwinner/aw_sid.c Sun Jan 7 04:59:28 2018 (r327670) @@ -67,36 +67,51 @@ __FBSDID("$FreeBSD$"); #define ROOT_KEY_SIZE 4 struct aw_sid_conf { + bus_size_t efuse_size; bus_size_t rootkey_offset; bool has_prctl; bool has_thermal; + bool requires_prctl_read; }; static const struct aw_sid_conf a10_conf = { + .efuse_size = 0x10, .rootkey_offset = 0, }; static const struct aw_sid_conf a20_conf = { + .efuse_size = 0x10, .rootkey_offset = 0, }; static const struct aw_sid_conf a64_conf = { + .efuse_size = 0x100, .rootkey_offset = SID_SRAM, .has_prctl = true, .has_thermal = true, }; static const struct aw_sid_conf a83t_conf = { + .efuse_size = 0x100, .rootkey_offset = SID_SRAM, .has_prctl = true, .has_thermal = true, }; +static const struct aw_sid_conf h3_conf = { + .efuse_size = 0x100, + .rootkey_offset = SID_SRAM, + .has_prctl = true, + .has_thermal = true, + .requires_prctl_read = true, +}; + static struct ofw_compat_data compat_data[] = { { "allwinner,sun4i-a10-sid", (uintptr_t)&a10_conf}, { "allwinner,sun7i-a20-sid", (uintptr_t)&a20_conf}, { "allwinner,sun50i-a64-sid", (uintptr_t)&a64_conf}, { "allwinner,sun8i-a83t-sid", (uintptr_t)&a83t_conf}, + { "allwinner,sun8i-h3-sid", (uintptr_t)&h3_conf}, { NULL, 0 } }; @@ -168,6 +183,8 @@ static int aw_sid_attach(device_t dev) { struct aw_sid_softc *sc; + bus_size_t i; + uint32_t val; sc = device_get_softc(dev); @@ -179,6 +196,19 @@ aw_sid_attach(device_t dev) mtx_init(&sc->prctl_mtx, device_get_nameunit(dev), NULL, MTX_DEF); sc->sid_conf = (struct aw_sid_conf *)ofw_bus_search_compatible(dev, compat_data)->ocd_data; aw_sid_sc = sc; + + /* + * This set of reads is solely for working around a silicon bug on some + * SoC that require a prctl read in order for direct register access to + * return a non-garbled value. Hence, the values we read are simply + * ignored. + */ + if (sc->sid_conf->requires_prctl_read) + for (i = 0; i < sc->sid_conf->efuse_size; i += 4) + if (aw_sid_prctl_read(dev, i, &val) != 0) { + device_printf(dev, "failed prctl read\n"); + return (ENXIO); + } SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), From owner-svn-src-head@freebsd.org Sun Jan 7 05:38:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 719CAE6A6FC; Sun, 7 Jan 2018 05:38:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4E23977A1E; Sun, 7 Jan 2018 05:38:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8EE771D0F5; Sun, 7 Jan 2018 05:38:53 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w075croB068640; Sun, 7 Jan 2018 05:38:53 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w075crox068639; Sun, 7 Jan 2018 05:38:53 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801070538.w075crox068639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 7 Jan 2018 05:38:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327671 - head/sbin/ldconfig X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/sbin/ldconfig X-SVN-Commit-Revision: 327671 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 05:38:54 -0000 Author: eadler Date: Sun Jan 7 05:38:53 2018 New Revision: 327671 URL: https://svnweb.freebsd.org/changeset/base/327671 Log: ldconfig(8): clarify language for files The previous language did not make it clear that 'Files' are the files specified above. Clarify it. Reported by: dana Reviewed by: dana MFC After: 1 week Modified: head/sbin/ldconfig/ldconfig.8 Modified: head/sbin/ldconfig/ldconfig.8 ============================================================================== --- head/sbin/ldconfig/ldconfig.8 Sun Jan 7 04:59:28 2018 (r327670) +++ head/sbin/ldconfig/ldconfig.8 Sun Jan 7 05:38:53 2018 (r327671) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 19, 2013 +.Dd January 6, 2018 .Dt LDCONFIG 8 .Os .Sh NAME @@ -58,7 +58,9 @@ the overhead that would otherwise result from the dire operations the dynamic linker would have to perform to load the required shared libraries. .Pp -Files named on the command line are expected to contain directories +Alternatively, +.Ar files +may be specified; these are expected to contain directories to scan for shared libraries. Each directory's pathname must start on a new line. From owner-svn-src-head@freebsd.org Sun Jan 7 07:09:01 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BEFEE5AC5D; Sun, 7 Jan 2018 07:09:01 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 07C4A7A369; Sun, 7 Jan 2018 07:09:01 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52AFB1DF5C; Sun, 7 Jan 2018 07:09:00 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w07790gr005800; Sun, 7 Jan 2018 07:09:00 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w07790UI005799; Sun, 7 Jan 2018 07:09:00 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201801070709.w07790UI005799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 7 Jan 2018 07:09:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327672 - head/bin/cat X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/bin/cat X-SVN-Commit-Revision: 327672 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 07:09:01 -0000 Author: delphij Date: Sun Jan 7 07:08:59 2018 New Revision: 327672 URL: https://svnweb.freebsd.org/changeset/base/327672 Log: stddef.h is not used by cat.c, remove the include. Modified: head/bin/cat/cat.c Modified: head/bin/cat/cat.c ============================================================================== --- head/bin/cat/cat.c Sun Jan 7 05:38:53 2018 (r327671) +++ head/bin/cat/cat.c Sun Jan 7 07:08:59 2018 (r327672) @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include From owner-svn-src-head@freebsd.org Sun Jan 7 09:55:48 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76CC1E63218; Sun, 7 Jan 2018 09:55:48 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4EB9D7F58B; Sun, 7 Jan 2018 09:55:46 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id a1694042; Sun, 7 Jan 2018 10:55:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h= mime-version:content-type:content-transfer-encoding:date:from:to :cc:subject:in-reply-to:references:message-id; s=mail; bh=dHeQsY 7JicdZxRCIelLgf25sbjk=; b=rMkd/Sygcmhsz2xMbEp43iQXHALIKLGRsI8z3w oZDOJeQzeJFYdtFr29Lfh+n0tvou8ds7cdA0PotQsLTW9Iqnv1vXzNDxSQWmtsA3 8+dzpiH0H4j97+aos22Lnov3MRUhMTtyqIeRTkzf4UmPPkRfs6x9icE4Hlbl1FrZ UPPBM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h= mime-version:content-type:content-transfer-encoding:date:from:to :cc:subject:in-reply-to:references:message-id; q=dns; s=mail; b= b9sxhBxdh5Ac73OKf2bLQvRodiDhiL3qkhYVBfhLLBhseSA9G2glbiaMQuJP3VgF 0GFi8jBMrATQC5Gz+n4DUj0nOs0iUUl3uYLY91mAW8oxgSwGq4Y5jEX/5M0fGy07 iNVNSjGsVAKQI5rIxiHhMpGrTfqVdvmUlcjLbmBsOEY= Received: from webmail.megadrive.org (www1.blih.net [212.83.177.180]) by mail.blih.net (OpenSMTPD) with ESMTP id 9c75bae9; Sun, 7 Jan 2018 10:55:44 +0100 (CET) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 07 Jan 2018 10:55:43 +0100 From: Emmanuel Vadot To: Kyle Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-src-committers@freebsd.org Subject: Re: svn commit: r327665 - head/sys/dev/extres/syscon Organization: Bidouilliste In-Reply-To: <201801070219.w072Jsx2085251@repo.freebsd.org> References: <201801070219.w072Jsx2085251@repo.freebsd.org> Message-ID: X-Sender: manu@bidouilliste.com User-Agent: Roundcube Webmail/1.1.1 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 09:55:48 -0000 On 2018-01-07 03:19, Kyle Evans wrote: > Author: kevans > Date: Sun Jan 7 02:19:54 2018 > New Revision: 327665 > URL: https://svnweb.freebsd.org/changeset/base/327665 > > Log: > Fix bogus pass for syscon_generic introduced in r327621 > > ian@ pointed out that BUS_PASS_DEFAULT + $anything is bogus, given > that > BUS_PASS_DEFAULT is defined as __INT_MAX. Instead, we take a page out > of > imx6_usbphy's book and use BUS_PASS_DEFAULT - 1000 to achieve the > desired > effect of syscon_generic attaching before if_awg and other potential > consumers, but late enough that more specialized implementations > should have > no problem attaching instead. > > Reported by: ian > > Modified: > head/sys/dev/extres/syscon/syscon_generic.c > > Modified: head/sys/dev/extres/syscon/syscon_generic.c > ============================================================================== > --- head/sys/dev/extres/syscon/syscon_generic.c Sun Jan 7 01:08:10 > 2018 (r327664) > +++ head/sys/dev/extres/syscon/syscon_generic.c Sun Jan 7 02:19:54 > 2018 (r327665) > @@ -206,6 +206,11 @@ static device_method_t syscon_generic_dmethods[] = > { > DEFINE_CLASS_0(syscon_generic, syscon_generic_driver, > syscon_generic_dmethods, > sizeof(struct syscon_generic_softc)); > static devclass_t syscon_generic_devclass; > +/* > + * syscon_generic needs to attach before other devices that may > require it, such > + * as if_awg, but later than others to give way for more specialized > syscon > + * implementations. > + */ I think that the comment should be more generic, syscon_generic will only be match for the "syscon" compatible, if a driver needs to attach at a specific pass, it should be subclassed and use the other compatible in the node. All the syscon node I've seen always have a specific compatible and a fallback to "syscon". > EARLY_DRIVER_MODULE(syscon_generic, simplebus, syscon_generic_driver, > - syscon_generic_devclass, 0, 0, BUS_PASS_DEFAULT + > BUS_PASS_ORDER_FIRST); > + syscon_generic_devclass, 0, 0, BUS_PASS_DEFAULT - 1000); > MODULE_VERSION(syscon_generic, 1); -- Emmanuel Vadot From owner-svn-src-head@freebsd.org Sun Jan 7 13:21:03 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D559E6CFF4; Sun, 7 Jan 2018 13:21:03 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 288653099; Sun, 7 Jan 2018 13:21:03 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C49421BA5; Sun, 7 Jan 2018 13:21:02 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w07DL2JZ064477; Sun, 7 Jan 2018 13:21:02 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w07DL2hN064072; Sun, 7 Jan 2018 13:21:02 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201801071321.w07DL2hN064072@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sun, 7 Jan 2018 13:21:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327674 - in head: share/man/man9 sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: in head: share/man/man9 sys/kern sys/sys X-SVN-Commit-Revision: 327674 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 13:21:03 -0000 Author: kp Date: Sun Jan 7 13:21:01 2018 New Revision: 327674 URL: https://svnweb.freebsd.org/changeset/base/327674 Log: Introduce mallocarray() in the kernel Similar to calloc() the mallocarray() function checks for integer overflows before allocating memory. It does not zero memory, unless the M_ZERO flag is set. Reviewed by: pfg, vangyzen (previous version), imp (previous version) Obtained from: OpenBSD Differential Revision: https://reviews.freebsd.org/D13766 Modified: head/share/man/man9/malloc.9 head/sys/kern/kern_malloc.c head/sys/sys/malloc.h Modified: head/share/man/man9/malloc.9 ============================================================================== --- head/share/man/man9/malloc.9 Sun Jan 7 10:29:15 2018 (r327673) +++ head/share/man/man9/malloc.9 Sun Jan 7 13:21:01 2018 (r327674) @@ -45,6 +45,8 @@ .In sys/malloc.h .Ft void * .Fn malloc "unsigned long size" "struct malloc_type *type" "int flags" +.Ft void * +.Fn mallocarray "size_t nmemb" "size_t size" "struct malloc_type *type" "int flags" .Ft void .Fn free "void *addr" "struct malloc_type *type" .Ft void * @@ -64,6 +66,14 @@ object whose size is specified by .Fa size . .Pp The +.Fn mallocarray +function allocates uninitialized memory in kernel address space for an +array of +.Fa nmemb +entries whose size is specified by +.Fa size . +.Pp +The .Fn free function releases memory at address .Fa addr @@ -152,6 +162,15 @@ functions cannot return if .Dv M_WAITOK is specified. +The +.Fn mallocarray +function can return +.Dv NULL +if the multiplication of +.Fa nmemb +and +.Fa size +would cause an integer overflow. .It Dv M_USE_RESERVE Indicates that the system can use its reserve of memory to satisfy the request. Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Sun Jan 7 10:29:15 2018 (r327673) +++ head/sys/kern/kern_malloc.c Sun Jan 7 13:21:01 2018 (r327674) @@ -4,6 +4,7 @@ * Copyright (c) 1987, 1991, 1993 * The Regents of the University of California. * Copyright (c) 2005-2009 Robert N. M. Watson + * Copyright (c) 2008 Otto Moerbeek (mallocarray) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -532,6 +533,22 @@ malloc(unsigned long size, struct malloc_type *mtp, in va = redzone_setup(va, osize); #endif return ((void *) va); +} + +/* + * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX + * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW + */ +#define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 8 / 2)) +void * +mallocarray(size_t nmemb, size_t size, struct malloc_type *type, int flags) +{ + + if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && + nmemb > 0 && SIZE_MAX / nmemb < size) + return (NULL); + + return (malloc(size * nmemb, type, flags)); } /* Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Sun Jan 7 10:29:15 2018 (r327673) +++ head/sys/sys/malloc.h Sun Jan 7 13:21:01 2018 (r327674) @@ -177,6 +177,9 @@ void *contigmalloc(unsigned long size, struct malloc_t void free(void *addr, struct malloc_type *type); void *malloc(unsigned long size, struct malloc_type *type, int flags) __malloc_like __result_use_check __alloc_size(1); +void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, + int flags) __malloc_like __result_use_check + __alloc_size(1) __alloc_size(2); void malloc_init(void *); int malloc_last_fail(void); void malloc_type_allocated(struct malloc_type *type, unsigned long size); From owner-svn-src-head@freebsd.org Sun Jan 7 13:35:16 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 895C7E6DAED; Sun, 7 Jan 2018 13:35:16 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 507AC3AB2; Sun, 7 Jan 2018 13:35:16 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A68421DC9; Sun, 7 Jan 2018 13:35:15 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w07DZFDw069855; Sun, 7 Jan 2018 13:35:15 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w07DZFWh069854; Sun, 7 Jan 2018 13:35:15 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201801071335.w07DZFWh069854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sun, 7 Jan 2018 13:35:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327675 - head/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/netpfil/pf X-SVN-Commit-Revision: 327675 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 13:35:16 -0000 Author: kp Date: Sun Jan 7 13:35:15 2018 New Revision: 327675 URL: https://svnweb.freebsd.org/changeset/base/327675 Log: pf: Avoid integer overflow issues by using mallocarray() iso. malloc() pfioctl() handles several ioctl that takes variable length input, these include: - DIOCRADDTABLES - DIOCRDELTABLES - DIOCRGETTABLES - DIOCRGETTSTATS - DIOCRCLRTSTATS - DIOCRSETTFLAGS All of them take a pfioc_table struct as input from userland. One of its elements (pfrio_size) is used in a buffer length calculation. The calculation contains an integer overflow which if triggered can lead to out of bound reads and writes later on. Reported by: Ilja Van Sprundel Modified: head/sys/netpfil/pf/pf_ioctl.c Modified: head/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- head/sys/netpfil/pf/pf_ioctl.c Sun Jan 7 13:21:01 2018 (r327674) +++ head/sys/netpfil/pf/pf_ioctl.c Sun Jan 7 13:35:15 2018 (r327675) @@ -2531,7 +2531,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); @@ -2555,7 +2560,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); @@ -2579,7 +2589,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } PF_RULES_RLOCK(); error = pfr_get_tables(&io->pfrio_table, pfrts, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -2600,7 +2615,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_tstats); - pfrtstats = malloc(totlen, M_TEMP, M_WAITOK); + pfrtstats = mallocarray(io->pfrio_size, + sizeof(struct pfr_tstats), M_TEMP, M_WAITOK); + if (! pfrtstats) { + error = ENOMEM; + break; + } PF_RULES_WLOCK(); error = pfr_get_tstats(&io->pfrio_table, pfrtstats, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -2621,7 +2641,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); @@ -2645,7 +2670,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); @@ -2684,7 +2714,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2711,7 +2746,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2739,7 +2779,12 @@ DIOCCHANGEADDR_error: } count = max(io->pfrio_size, io->pfrio_size2); totlen = count * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(count, sizeof(struct pfr_addr), M_TEMP, + M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2767,7 +2812,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } PF_RULES_RLOCK(); error = pfr_get_addrs(&io->pfrio_table, pfras, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -2788,7 +2838,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_astats); - pfrastats = malloc(totlen, M_TEMP, M_WAITOK); + pfrastats = mallocarray(io->pfrio_size, + sizeof(struct pfr_astats), M_TEMP, M_WAITOK); + if (! pfrastats) { + error = ENOMEM; + break; + } PF_RULES_RLOCK(); error = pfr_get_astats(&io->pfrio_table, pfrastats, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -2809,7 +2864,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2836,7 +2896,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2863,7 +2928,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2905,7 +2975,12 @@ DIOCCHANGEADDR_error: break; } totlen = sizeof(struct pfioc_trans_e) * io->size; - ioes = malloc(totlen, M_TEMP, M_WAITOK); + ioes = mallocarray(io->size, sizeof(struct pfioc_trans_e), + M_TEMP, M_WAITOK); + if (! ioes) { + error = ENOMEM; + break; + } error = copyin(io->array, ioes, totlen); if (error) { free(ioes, M_TEMP); @@ -2971,7 +3046,12 @@ DIOCCHANGEADDR_error: break; } totlen = sizeof(struct pfioc_trans_e) * io->size; - ioes = malloc(totlen, M_TEMP, M_WAITOK); + ioes = mallocarray(io->size, sizeof(struct pfioc_trans_e), + M_TEMP, M_WAITOK); + if (! ioes) { + error = ENOMEM; + break; + } error = copyin(io->array, ioes, totlen); if (error) { free(ioes, M_TEMP); @@ -3037,7 +3117,12 @@ DIOCCHANGEADDR_error: break; } totlen = sizeof(struct pfioc_trans_e) * io->size; - ioes = malloc(totlen, M_TEMP, M_WAITOK); + ioes = mallocarray(io->size, sizeof(struct pfioc_trans_e), + M_TEMP, M_WAITOK); + if (! ioes) { + error = ENOMEM; + break; + } error = copyin(io->array, ioes, totlen); if (error) { free(ioes, M_TEMP); @@ -3238,7 +3323,12 @@ DIOCCHANGEADDR_error: } bufsiz = io->pfiio_size * sizeof(struct pfi_kif); - ifstore = malloc(bufsiz, M_TEMP, M_WAITOK); + ifstore = mallocarray(io->pfiio_size, sizeof(struct pfi_kif), + M_TEMP, M_WAITOK); + if (! ifstore) { + error = ENOMEM; + break; + } PF_RULES_RLOCK(); pfi_get_ifaces(io->pfiio_name, ifstore, &io->pfiio_size); PF_RULES_RUNLOCK(); From owner-svn-src-head@freebsd.org Sun Jan 7 13:39:13 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEE9DE6DD2B; Sun, 7 Jan 2018 13:39:13 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9977D3C6B; Sun, 7 Jan 2018 13:39:13 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB4B421DCA; Sun, 7 Jan 2018 13:39:12 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w07DdCrN070033; Sun, 7 Jan 2018 13:39:12 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w07DdCaX070032; Sun, 7 Jan 2018 13:39:12 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201801071339.w07DdCaX070032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sun, 7 Jan 2018 13:39:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327676 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 327676 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 13:39:13 -0000 Author: kp Date: Sun Jan 7 13:39:12 2018 New Revision: 327676 URL: https://svnweb.freebsd.org/changeset/base/327676 Log: linuxkpi: Implement kcalloc() based on mallocarray() This means we now get integer overflow protection, which Linux code might expect as it is also provided by kcalloc() in Linux. Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/slab.h Sun Jan 7 13:35:15 2018 (r327675) +++ head/sys/compat/linuxkpi/common/include/linux/slab.h Sun Jan 7 13:39:12 2018 (r327676) @@ -46,7 +46,6 @@ MALLOC_DECLARE(M_KMALLOC); #define kzalloc(size, flags) kmalloc(size, (flags) | __GFP_ZERO) #define kzalloc_node(size, flags, node) kmalloc(size, (flags) | __GFP_ZERO) #define kfree_const(ptr) kfree(ptr) -#define kcalloc(n, size, flags) kmalloc((n) * (size), (flags) | __GFP_ZERO) #define vzalloc(size) __vmalloc(size, GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, 0) #define vfree(arg) kfree(arg) #define kvfree(arg) kfree(arg) @@ -98,6 +97,13 @@ static inline void * kmalloc(size_t size, gfp_t flags) { return (malloc(size, M_KMALLOC, linux_check_m_flags(flags))); +} + +static inline void * +kcalloc(size_t n, size_t size, gfp_t flags) +{ + flags |= __GFP_ZERO; + return (mallocarray(n, size, M_KMALLOC, linux_check_m_flags(flags))); } static inline void * From owner-svn-src-head@freebsd.org Sun Jan 7 13:41:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1CA2E6DFF3; Sun, 7 Jan 2018 13:41:07 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7B93C3FCE; Sun, 7 Jan 2018 13:41:07 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD6CA21DF9; Sun, 7 Jan 2018 13:41:06 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w07Df6ID070846; Sun, 7 Jan 2018 13:41:06 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w07Df62R070845; Sun, 7 Jan 2018 13:41:06 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201801071341.w07Df62R070845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sun, 7 Jan 2018 13:41:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327677 - head/sys/contrib/vchiq/interface/compat X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/contrib/vchiq/interface/compat X-SVN-Commit-Revision: 327677 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 13:41:07 -0000 Author: kp Date: Sun Jan 7 13:41:06 2018 New Revision: 327677 URL: https://svnweb.freebsd.org/changeset/base/327677 Log: vchiq: Use mallocarray() to provide kcalloc() This means we now also provide integer overflow protection, like the Linux kcalloc(). Modified: head/sys/contrib/vchiq/interface/compat/vchi_bsd.h Modified: head/sys/contrib/vchiq/interface/compat/vchi_bsd.h ============================================================================== --- head/sys/contrib/vchiq/interface/compat/vchi_bsd.h Sun Jan 7 13:39:12 2018 (r327676) +++ head/sys/contrib/vchiq/interface/compat/vchi_bsd.h Sun Jan 7 13:41:06 2018 (r327677) @@ -329,7 +329,8 @@ device_rlprintf(int pps, device_t dev, const char *fmt MALLOC_DECLARE(M_VCHI); #define kmalloc(size, flags) malloc((size), M_VCHI, M_NOWAIT | M_ZERO) -#define kcalloc(n, size, flags) malloc((n) * (size), M_VCHI, M_NOWAIT | M_ZERO) +#define kcalloc(n, size, flags) mallocarray((n), (size), M_VCHI, \ + M_NOWAIT | M_ZERO) #define kzalloc(a, b) kcalloc(1, (a), (b)) #define kfree(p) free(p, M_VCHI) From owner-svn-src-head@freebsd.org Sun Jan 7 14:44:33 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A70F0E706FF; Sun, 7 Jan 2018 14:44:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B7B4691D0; Sun, 7 Jan 2018 14:44:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w07EiNVx027025 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 7 Jan 2018 16:44:26 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w07EiNVx027025 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w07EiNY4027024; Sun, 7 Jan 2018 16:44:23 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 7 Jan 2018 16:44:23 +0200 From: Konstantin Belousov To: Kristof Provost Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r327675 - head/sys/netpfil/pf Message-ID: <20180107144423.GD1684@kib.kiev.ua> References: <201801071335.w07DZFWh069854@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201801071335.w07DZFWh069854@repo.freebsd.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 14:44:33 -0000 On Sun, Jan 07, 2018 at 01:35:15PM +0000, Kristof Provost wrote: > Author: kp > Date: Sun Jan 7 13:35:15 2018 > New Revision: 327675 > URL: https://svnweb.freebsd.org/changeset/base/327675 > > Log: > pf: Avoid integer overflow issues by using mallocarray() iso. malloc() > > pfioctl() handles several ioctl that takes variable length input, these > include: > - DIOCRADDTABLES > - DIOCRDELTABLES > - DIOCRGETTABLES > - DIOCRGETTSTATS > - DIOCRCLRTSTATS > - DIOCRSETTFLAGS > > All of them take a pfioc_table struct as input from userland. One of > its elements (pfrio_size) is used in a buffer length calculation. > The calculation contains an integer overflow which if triggered can lead > to out of bound reads and writes later on. So the size of the allocation is controlled directly from the userspace ? This is an easy DoS, and by itself is perhaps bigger issue than the overflow. > > Reported by: Ilja Van Sprundel > > Modified: > head/sys/netpfil/pf/pf_ioctl.c > > Modified: head/sys/netpfil/pf/pf_ioctl.c > ============================================================================== > --- head/sys/netpfil/pf/pf_ioctl.c Sun Jan 7 13:21:01 2018 (r327674) > +++ head/sys/netpfil/pf/pf_ioctl.c Sun Jan 7 13:35:15 2018 (r327675) > @@ -2531,7 +2531,12 @@ DIOCCHANGEADDR_error: > break; > } > totlen = io->pfrio_size * sizeof(struct pfr_table); > - pfrts = malloc(totlen, M_TEMP, M_WAITOK); > + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), > + M_TEMP, M_WAITOK); > + if (! pfrts) { > + error = ENOMEM; > + break; > + } > error = copyin(io->pfrio_buffer, pfrts, totlen); > if (error) { > free(pfrts, M_TEMP); > @@ -2555,7 +2560,12 @@ DIOCCHANGEADDR_error: > break; > } > totlen = io->pfrio_size * sizeof(struct pfr_table); > - pfrts = malloc(totlen, M_TEMP, M_WAITOK); > + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), > + M_TEMP, M_WAITOK); > + if (! pfrts) { > + error = ENOMEM; > + break; > + } > error = copyin(io->pfrio_buffer, pfrts, totlen); > if (error) { > free(pfrts, M_TEMP); > @@ -2579,7 +2589,12 @@ DIOCCHANGEADDR_error: > break; > } > totlen = io->pfrio_size * sizeof(struct pfr_table); > - pfrts = malloc(totlen, M_TEMP, M_WAITOK); > + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), > + M_TEMP, M_WAITOK); > + if (! pfrts) { > + error = ENOMEM; > + break; > + } > PF_RULES_RLOCK(); > error = pfr_get_tables(&io->pfrio_table, pfrts, > &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); > @@ -2600,7 +2615,12 @@ DIOCCHANGEADDR_error: > break; > } > totlen = io->pfrio_size * sizeof(struct pfr_tstats); > - pfrtstats = malloc(totlen, M_TEMP, M_WAITOK); > + pfrtstats = mallocarray(io->pfrio_size, > + sizeof(struct pfr_tstats), M_TEMP, M_WAITOK); > + if (! pfrtstats) { > + error = ENOMEM; > + break; > + } > PF_RULES_WLOCK(); > error = pfr_get_tstats(&io->pfrio_table, pfrtstats, > &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); > @@ -2621,7 +2641,12 @@ DIOCCHANGEADDR_error: > break; > } > totlen = io->pfrio_size * sizeof(struct pfr_table); > - pfrts = malloc(totlen, M_TEMP, M_WAITOK); > + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), > + M_TEMP, M_WAITOK); > + if (! pfrts) { > + error = ENOMEM; > + break; > + } > error = copyin(io->pfrio_buffer, pfrts, totlen); > if (error) { > free(pfrts, M_TEMP); > @@ -2645,7 +2670,12 @@ DIOCCHANGEADDR_error: > break; > } > totlen = io->pfrio_size * sizeof(struct pfr_table); > - pfrts = malloc(totlen, M_TEMP, M_WAITOK); > + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), > + M_TEMP, M_WAITOK); > + if (! pfrts) { > + error = ENOMEM; > + break; > + } > error = copyin(io->pfrio_buffer, pfrts, totlen); > if (error) { > free(pfrts, M_TEMP); > @@ -2684,7 +2714,12 @@ DIOCCHANGEADDR_error: > break; > } > totlen = io->pfrio_size * sizeof(struct pfr_addr); > - pfras = malloc(totlen, M_TEMP, M_WAITOK); > + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), > + M_TEMP, M_WAITOK); > + if (! pfras) { > + error = ENOMEM; > + break; > + } > error = copyin(io->pfrio_buffer, pfras, totlen); > if (error) { > free(pfras, M_TEMP); > @@ -2711,7 +2746,12 @@ DIOCCHANGEADDR_error: > break; > } > totlen = io->pfrio_size * sizeof(struct pfr_addr); > - pfras = malloc(totlen, M_TEMP, M_WAITOK); > + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), > + M_TEMP, M_WAITOK); > + if (! pfras) { > + error = ENOMEM; > + break; > + } > error = copyin(io->pfrio_buffer, pfras, totlen); > if (error) { > free(pfras, M_TEMP); > @@ -2739,7 +2779,12 @@ DIOCCHANGEADDR_error: > } > count = max(io->pfrio_size, io->pfrio_size2); > totlen = count * sizeof(struct pfr_addr); > - pfras = malloc(totlen, M_TEMP, M_WAITOK); > + pfras = mallocarray(count, sizeof(struct pfr_addr), M_TEMP, > + M_WAITOK); > + if (! pfras) { > + error = ENOMEM; > + break; > + } > error = copyin(io->pfrio_buffer, pfras, totlen); > if (error) { > free(pfras, M_TEMP); > @@ -2767,7 +2812,12 @@ DIOCCHANGEADDR_error: > break; > } > totlen = io->pfrio_size * sizeof(struct pfr_addr); > - pfras = malloc(totlen, M_TEMP, M_WAITOK); > + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), > + M_TEMP, M_WAITOK); > + if (! pfras) { > + error = ENOMEM; > + break; > + } > PF_RULES_RLOCK(); > error = pfr_get_addrs(&io->pfrio_table, pfras, > &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); > @@ -2788,7 +2838,12 @@ DIOCCHANGEADDR_error: > break; > } > totlen = io->pfrio_size * sizeof(struct pfr_astats); > - pfrastats = malloc(totlen, M_TEMP, M_WAITOK); > + pfrastats = mallocarray(io->pfrio_size, > + sizeof(struct pfr_astats), M_TEMP, M_WAITOK); > + if (! pfrastats) { > + error = ENOMEM; > + break; > + } > PF_RULES_RLOCK(); > error = pfr_get_astats(&io->pfrio_table, pfrastats, > &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); > @@ -2809,7 +2864,12 @@ DIOCCHANGEADDR_error: > break; > } > totlen = io->pfrio_size * sizeof(struct pfr_addr); > - pfras = malloc(totlen, M_TEMP, M_WAITOK); > + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), > + M_TEMP, M_WAITOK); > + if (! pfras) { > + error = ENOMEM; > + break; > + } > error = copyin(io->pfrio_buffer, pfras, totlen); > if (error) { > free(pfras, M_TEMP); > @@ -2836,7 +2896,12 @@ DIOCCHANGEADDR_error: > break; > } > totlen = io->pfrio_size * sizeof(struct pfr_addr); > - pfras = malloc(totlen, M_TEMP, M_WAITOK); > + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), > + M_TEMP, M_WAITOK); > + if (! pfras) { > + error = ENOMEM; > + break; > + } > error = copyin(io->pfrio_buffer, pfras, totlen); > if (error) { > free(pfras, M_TEMP); > @@ -2863,7 +2928,12 @@ DIOCCHANGEADDR_error: > break; > } > totlen = io->pfrio_size * sizeof(struct pfr_addr); > - pfras = malloc(totlen, M_TEMP, M_WAITOK); > + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), > + M_TEMP, M_WAITOK); > + if (! pfras) { > + error = ENOMEM; > + break; > + } > error = copyin(io->pfrio_buffer, pfras, totlen); > if (error) { > free(pfras, M_TEMP); > @@ -2905,7 +2975,12 @@ DIOCCHANGEADDR_error: > break; > } > totlen = sizeof(struct pfioc_trans_e) * io->size; > - ioes = malloc(totlen, M_TEMP, M_WAITOK); > + ioes = mallocarray(io->size, sizeof(struct pfioc_trans_e), > + M_TEMP, M_WAITOK); > + if (! ioes) { > + error = ENOMEM; > + break; > + } > error = copyin(io->array, ioes, totlen); > if (error) { > free(ioes, M_TEMP); > @@ -2971,7 +3046,12 @@ DIOCCHANGEADDR_error: > break; > } > totlen = sizeof(struct pfioc_trans_e) * io->size; > - ioes = malloc(totlen, M_TEMP, M_WAITOK); > + ioes = mallocarray(io->size, sizeof(struct pfioc_trans_e), > + M_TEMP, M_WAITOK); > + if (! ioes) { > + error = ENOMEM; > + break; > + } > error = copyin(io->array, ioes, totlen); > if (error) { > free(ioes, M_TEMP); > @@ -3037,7 +3117,12 @@ DIOCCHANGEADDR_error: > break; > } > totlen = sizeof(struct pfioc_trans_e) * io->size; > - ioes = malloc(totlen, M_TEMP, M_WAITOK); > + ioes = mallocarray(io->size, sizeof(struct pfioc_trans_e), > + M_TEMP, M_WAITOK); > + if (! ioes) { > + error = ENOMEM; > + break; > + } > error = copyin(io->array, ioes, totlen); > if (error) { > free(ioes, M_TEMP); > @@ -3238,7 +3323,12 @@ DIOCCHANGEADDR_error: > } > > bufsiz = io->pfiio_size * sizeof(struct pfi_kif); > - ifstore = malloc(bufsiz, M_TEMP, M_WAITOK); > + ifstore = mallocarray(io->pfiio_size, sizeof(struct pfi_kif), > + M_TEMP, M_WAITOK); > + if (! ifstore) { > + error = ENOMEM; > + break; > + } > PF_RULES_RLOCK(); > pfi_get_ifaces(io->pfiio_name, ifstore, &io->pfiio_size); > PF_RULES_RUNLOCK(); From owner-svn-src-head@freebsd.org Sun Jan 7 16:24:35 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26297E748E1; Sun, 7 Jan 2018 16:24:35 +0000 (UTC) (envelope-from srs0=cu0q=ec=freebsd.org=kp@codepro.be) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E2ACE6CF27; Sun, 7 Jan 2018 16:24:34 +0000 (UTC) (envelope-from srs0=cu0q=ec=freebsd.org=kp@codepro.be) Received: from [10.0.2.164] (ptr-8ripyyhthbnp0l0tszn.18120a2.ip6.access.telenet.be [IPv6:2a02:1811:2419:4e02:e0f1:72a1:d72b:ec03]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id EB44EAC73; Sun, 7 Jan 2018 17:24:31 +0100 (CET) From: "Kristof Provost" To: "Konstantin Belousov" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r327675 - head/sys/netpfil/pf Date: Sun, 07 Jan 2018 17:25:02 +0100 X-Mailer: MailMate (2.0BETAr6102) Message-ID: In-Reply-To: <20180107144423.GD1684@kib.kiev.ua> References: <201801071335.w07DZFWh069854@repo.freebsd.org> <20180107144423.GD1684@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 16:24:35 -0000 On 7 Jan 2018, at 15:44, Konstantin Belousov wrote: > On Sun, Jan 07, 2018 at 01:35:15PM +0000, Kristof Provost wrote: >> Author: kp >> Date: Sun Jan 7 13:35:15 2018 >> New Revision: 327675 >> URL: https://svnweb.freebsd.org/changeset/base/327675 >> >> Log: >> pf: Avoid integer overflow issues by using mallocarray() iso. >> malloc() >> >> pfioctl() handles several ioctl that takes variable length input, >> these >> include: >> - DIOCRADDTABLES >> - DIOCRDELTABLES >> - DIOCRGETTABLES >> - DIOCRGETTSTATS >> - DIOCRCLRTSTATS >> - DIOCRSETTFLAGS >> >> All of them take a pfioc_table struct as input from userland. One >> of >> its elements (pfrio_size) is used in a buffer length calculation. >> The calculation contains an integer overflow which if triggered can >> lead >> to out of bound reads and writes later on. > So the size of the allocation is controlled directly from the > userspace ? > This is an easy DoS, and by itself is perhaps bigger issue than the > overflow. Yes, although only as root. I’m not sure what the best way of handling that would be. It’s not easy to determine limits for these sizes. Any arbitrary value might break someone’s use case. OpenBSD tend to copy in individual entries one at a time. This avoids having to allocate memory for all of them in one go, but I don’t like mixing user pointers and kernel pointers. It’s far too easy to lose track of what’s been copied in and what’s still in user space. Regards, Kristof From owner-svn-src-head@freebsd.org Sun Jan 7 17:55:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7F26E783BD; Sun, 7 Jan 2018 17:55:14 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A781F702FC; Sun, 7 Jan 2018 17:55:14 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w07HtCFJ017656; Sun, 7 Jan 2018 09:55:12 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w07HtCAU017655; Sun, 7 Jan 2018 09:55:12 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201801071755.w07HtCAU017655@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r327674 - in head: share/man/man9 sys/kern sys/sys In-Reply-To: <201801071321.w07DL2hN064072@repo.freebsd.org> To: Kristof Provost Date: Sun, 7 Jan 2018 09:55:12 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 17:55:14 -0000 [ Charset UTF-8 unsupported, converting... ] > Author: kp > Date: Sun Jan 7 13:21:01 2018 > New Revision: 327674 > URL: https://svnweb.freebsd.org/changeset/base/327674 > > Log: > Introduce mallocarray() in the kernel > > Similar to calloc() the mallocarray() function checks for integer > overflows before allocating memory. > It does not zero memory, unless the M_ZERO flag is set. > > Reviewed by: pfg, vangyzen (previous version), imp (previous version) > Obtained from: OpenBSD > Differential Revision: https://reviews.freebsd.org/D13766 > > Modified: > head/share/man/man9/malloc.9 > head/sys/kern/kern_malloc.c > head/sys/sys/malloc.h > > Modified: head/share/man/man9/malloc.9 > ============================================================================== > --- head/share/man/man9/malloc.9 Sun Jan 7 10:29:15 2018 (r327673) > +++ head/share/man/man9/malloc.9 Sun Jan 7 13:21:01 2018 (r327674) > @@ -45,6 +45,8 @@ > .In sys/malloc.h > .Ft void * > .Fn malloc "unsigned long size" "struct malloc_type *type" "int flags" > +.Ft void * > +.Fn mallocarray "size_t nmemb" "size_t size" "struct malloc_type *type" "int flags" > .Ft void > .Fn free "void *addr" "struct malloc_type *type" > .Ft void * > @@ -64,6 +66,14 @@ object whose size is specified by > .Fa size . > .Pp > The > +.Fn mallocarray > +function allocates uninitialized memory in kernel address space for an > +array of > +.Fa nmemb > +entries whose size is specified by > +.Fa size . > +.Pp > +The > .Fn free > function releases memory at address > .Fa addr > @@ -152,6 +162,15 @@ functions cannot return > if > .Dv M_WAITOK > is specified. > +The > +.Fn mallocarray > +function can return > +.Dv NULL > +if the multiplication of > +.Fa nmemb > +and > +.Fa size > +would cause an integer overflow. > .It Dv M_USE_RESERVE > Indicates that the system can use its reserve of memory to satisfy the > request. > > Modified: head/sys/kern/kern_malloc.c > ============================================================================== > --- head/sys/kern/kern_malloc.c Sun Jan 7 10:29:15 2018 (r327673) > +++ head/sys/kern/kern_malloc.c Sun Jan 7 13:21:01 2018 (r327674) > @@ -4,6 +4,7 @@ > * Copyright (c) 1987, 1991, 1993 > * The Regents of the University of California. > * Copyright (c) 2005-2009 Robert N. M. Watson > + * Copyright (c) 2008 Otto Moerbeek (mallocarray) Is this code really over a decade old???? or is this a typo? > * All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > @@ -532,6 +533,22 @@ malloc(unsigned long size, struct malloc_type *mtp, in > va = redzone_setup(va, osize); > #endif > return ((void *) va); > +} > + > +/* > + * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX > + * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW > + */ > +#define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 8 / 2)) > +void * > +mallocarray(size_t nmemb, size_t size, struct malloc_type *type, int flags) > +{ > + > + if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && > + nmemb > 0 && SIZE_MAX / nmemb < size) > + return (NULL); > + > + return (malloc(size * nmemb, type, flags)); > } > > /* > > Modified: head/sys/sys/malloc.h > ============================================================================== > --- head/sys/sys/malloc.h Sun Jan 7 10:29:15 2018 (r327673) > +++ head/sys/sys/malloc.h Sun Jan 7 13:21:01 2018 (r327674) > @@ -177,6 +177,9 @@ void *contigmalloc(unsigned long size, struct malloc_t > void free(void *addr, struct malloc_type *type); > void *malloc(unsigned long size, struct malloc_type *type, int flags) > __malloc_like __result_use_check __alloc_size(1); > +void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, > + int flags) __malloc_like __result_use_check > + __alloc_size(1) __alloc_size(2); > void malloc_init(void *); > int malloc_last_fail(void); > void malloc_type_allocated(struct malloc_type *type, unsigned long size); > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sun Jan 7 18:00:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43D88E788BC; Sun, 7 Jan 2018 18:00:47 +0000 (UTC) (envelope-from srs0=cu0q=ec=freebsd.org=kp@codepro.be) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0CCA670704; Sun, 7 Jan 2018 18:00:46 +0000 (UTC) (envelope-from srs0=cu0q=ec=freebsd.org=kp@codepro.be) Received: from [10.0.2.164] (ptr-8ripyyhthbnp0l0tszn.18120a2.ip6.access.telenet.be [IPv6:2a02:1811:2419:4e02:e0f1:72a1:d72b:ec03]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id 1D862ADE1; Sun, 7 Jan 2018 19:00:44 +0100 (CET) From: "Kristof Provost" To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r327674 - in head: share/man/man9 sys/kern sys/sys Date: Sun, 07 Jan 2018 19:00:43 +0100 X-Mailer: MailMate (2.0BETAr6102) Message-ID: <89EADF3F-DFCB-4EE7-8FE6-5129B77411EB@FreeBSD.org> In-Reply-To: <201801071755.w07HtCAU017655@pdx.rh.CN85.dnsmgr.net> References: <201801071755.w07HtCAU017655@pdx.rh.CN85.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 18:00:47 -0000 On 7 Jan 2018, at 18:55, Rodney W. Grimes wrote: > [ Charset UTF-8 unsupported, converting... ] >> Author: kp >> Date: Sun Jan 7 13:21:01 2018 >> New Revision: 327674 >> URL: https://svnweb.freebsd.org/changeset/base/327674 >> >> Log: >> Introduce mallocarray() in the kernel >> >> Similar to calloc() the mallocarray() function checks for integer >> overflows before allocating memory. >> It does not zero memory, unless the M_ZERO flag is set. >> >> Reviewed by: pfg, vangyzen (previous version), imp (previous = >> version) >> Obtained from: OpenBSD >> Differential Revision: https://reviews.freebsd.org/D13766 >> >> Modified: head/sys/kern/kern_malloc.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/kern/kern_malloc.c Sun Jan 7 10:29:15 2018 (r327673) >> +++ head/sys/kern/kern_malloc.c Sun Jan 7 13:21:01 2018 (r327674) >> @@ -4,6 +4,7 @@ >> * Copyright (c) 1987, 1991, 1993 >> * The Regents of the University of California. >> * Copyright (c) 2005-2009 Robert N. M. Watson >> + * Copyright (c) 2008 Otto Moerbeek (mallocarray) > > Is this code really over a decade old???? or is this a typo? > > That=E2=80=99s the copyright statement OpenBSD have for it, and that=E2=80= =99s where = it came from: https://github.com/openbsd/src/blob/3031d9a2ee043e48086ede83d43c1e37d034a= ff4/sys/kern/kern_malloc.c#L705 Regards, Kristof From owner-svn-src-head@freebsd.org Sun Jan 7 18:02:36 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 593CDE789B9; Sun, 7 Jan 2018 18:02:36 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 21E5870A9E; Sun, 7 Jan 2018 18:02:35 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w07I2Ycj017700; Sun, 7 Jan 2018 10:02:34 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w07I2YEB017699; Sun, 7 Jan 2018 10:02:34 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201801071802.w07I2YEB017699@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r327676 - head/sys/compat/linuxkpi/common/include/linux In-Reply-To: <201801071339.w07DdCaX070032@repo.freebsd.org> To: Kristof Provost Date: Sun, 7 Jan 2018 10:02:34 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 18:02:36 -0000 [ Charset UTF-8 unsupported, converting... ] > Author: kp > Date: Sun Jan 7 13:39:12 2018 > New Revision: 327676 > URL: https://svnweb.freebsd.org/changeset/base/327676 > > Log: > linuxkpi: Implement kcalloc() based on mallocarray() > > This means we now get integer overflow protection, which Linux code > might expect as it is also provided by kcalloc() in Linux. > > Modified: > head/sys/compat/linuxkpi/common/include/linux/slab.h > > Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h > ============================================================================== > --- head/sys/compat/linuxkpi/common/include/linux/slab.h Sun Jan 7 13:35:15 2018 (r327675) > +++ head/sys/compat/linuxkpi/common/include/linux/slab.h Sun Jan 7 13:39:12 2018 (r327676) > @@ -46,7 +46,6 @@ MALLOC_DECLARE(M_KMALLOC); > #define kzalloc(size, flags) kmalloc(size, (flags) | __GFP_ZERO) > #define kzalloc_node(size, flags, node) kmalloc(size, (flags) | __GFP_ZERO) > #define kfree_const(ptr) kfree(ptr) > -#define kcalloc(n, size, flags) kmalloc((n) * (size), (flags) | __GFP_ZERO) Would not: #define kcalloc(n, size, flags) mallocarray(mallocarray((n), (size), M_KMALLOC, linux_check_m_flags((flags | __GFP_ZERO)) work just fine, saving a call and stack use of about framesize + 32 bytes? > #define vzalloc(size) __vmalloc(size, GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, 0) > #define vfree(arg) kfree(arg) > #define kvfree(arg) kfree(arg) > @@ -98,6 +97,13 @@ static inline void * > kmalloc(size_t size, gfp_t flags) > { > return (malloc(size, M_KMALLOC, linux_check_m_flags(flags))); > +} > + > +static inline void * > +kcalloc(size_t n, size_t size, gfp_t flags) > +{ > + flags |= __GFP_ZERO; > + return (mallocarray(n, size, M_KMALLOC, linux_check_m_flags(flags))); > } > > static inline void * > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sun Jan 7 18:06:31 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9F56E78DB8; Sun, 7 Jan 2018 18:06:31 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B61B170F7B; Sun, 7 Jan 2018 18:06:31 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE17124921; Sun, 7 Jan 2018 18:06:30 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w07I6UVe084571; Sun, 7 Jan 2018 18:06:30 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w07I6U84084570; Sun, 7 Jan 2018 18:06:30 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201801071806.w07I6U84084570@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 7 Jan 2018 18:06:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327678 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 327678 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 18:06:32 -0000 Author: ian Date: Sun Jan 7 18:06:30 2018 New Revision: 327678 URL: https://svnweb.freebsd.org/changeset/base/327678 Log: Use EVENTHANDLER_DIRECT_INVOKE() for device events, for better performance. Modified: head/sys/kern/subr_bus.c Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Sun Jan 7 13:41:06 2018 (r327677) +++ head/sys/kern/subr_bus.c Sun Jan 7 18:06:30 2018 (r327678) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -146,6 +147,10 @@ struct device { static MALLOC_DEFINE(M_BUS, "bus", "Bus data structures"); static MALLOC_DEFINE(M_BUS_SC, "bus-sc", "Bus data structures, softc"); +EVENTHANDLER_LIST_DEFINE(device_attach); +EVENTHANDLER_LIST_DEFINE(device_detach); +EVENTHANDLER_LIST_DEFINE(dev_lookup); + static void devctl2_init(void); #define DRIVERNAME(d) ((d)? d->name : "no driver") @@ -2938,7 +2943,7 @@ device_attach(device_t dev) else dev->state = DS_ATTACHED; dev->flags &= ~DF_DONENOMATCH; - EVENTHANDLER_INVOKE(device_attach, dev); + EVENTHANDLER_DIRECT_INVOKE(device_attach, dev); devadded(dev); return (0); } @@ -2972,12 +2977,14 @@ device_detach(device_t dev) if (dev->state != DS_ATTACHED) return (0); - EVENTHANDLER_INVOKE(device_detach, dev, EVHDEV_DETACH_BEGIN); + EVENTHANDLER_DIRECT_INVOKE(device_detach, dev, EVHDEV_DETACH_BEGIN); if ((error = DEVICE_DETACH(dev)) != 0) { - EVENTHANDLER_INVOKE(device_detach, dev, EVHDEV_DETACH_FAILED); + EVENTHANDLER_DIRECT_INVOKE(device_detach, dev, + EVHDEV_DETACH_FAILED); return (error); } else { - EVENTHANDLER_INVOKE(device_detach, dev, EVHDEV_DETACH_COMPLETE); + EVENTHANDLER_DIRECT_INVOKE(device_detach, dev, + EVHDEV_DETACH_COMPLETE); } devremoved(dev); if (!device_is_quiet(dev)) @@ -5330,7 +5337,7 @@ find_device(struct devreq *req, device_t *devp) /* Finally, give device enumerators a chance. */ dev = NULL; - EVENTHANDLER_INVOKE(dev_lookup, req->dr_name, &dev); + EVENTHANDLER_DIRECT_INVOKE(dev_lookup, req->dr_name, &dev); if (dev == NULL) return (ENOENT); *devp = dev; From owner-svn-src-head@freebsd.org Sun Jan 7 18:07:23 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 970A5E78E75; Sun, 7 Jan 2018 18:07:23 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 73679710D0; Sun, 7 Jan 2018 18:07:23 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE06D24922; Sun, 7 Jan 2018 18:07:22 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w07I7Ms5084642; Sun, 7 Jan 2018 18:07:22 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w07I7MQm084641; Sun, 7 Jan 2018 18:07:22 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201801071807.w07I7MQm084641@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 7 Jan 2018 18:07:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327679 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 327679 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 18:07:23 -0000 Author: ian Date: Sun Jan 7 18:07:22 2018 New Revision: 327679 URL: https://svnweb.freebsd.org/changeset/base/327679 Log: Use EVENTHANDLER_DIRECT_INVOKE for [un]mount events, for better performance. Modified: head/sys/kern/vfs_mount.c Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Sun Jan 7 18:06:30 2018 (r327678) +++ head/sys/kern/vfs_mount.c Sun Jan 7 18:07:22 2018 (r327679) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -91,6 +92,9 @@ struct mntlist mountlist = TAILQ_HEAD_INITIALIZER(moun struct mtx mountlist_mtx; MTX_SYSINIT(mountlist, &mountlist_mtx, "mountlist", MTX_DEF); +EVENTHANDLER_LIST_DEFINE(vfs_mounted); +EVENTHANDLER_LIST_DEFINE(vfs_unmounted); + /* * Global opts, taken by all filesystems */ @@ -865,7 +869,7 @@ vfs_domount_first( if (VFS_ROOT(mp, LK_EXCLUSIVE, &newdp)) panic("mount: lost mount"); VOP_UNLOCK(vp, 0); - EVENTHANDLER_INVOKE(vfs_mounted, mp, newdp, td); + EVENTHANDLER_DIRECT_INVOKE(vfs_mounted, mp, newdp, td); VOP_UNLOCK(newdp, 0); mountcheckdirs(vp, newdp); vrele(newdp); @@ -1401,7 +1405,7 @@ dounmount(struct mount *mp, int flags, struct thread * mtx_lock(&mountlist_mtx); TAILQ_REMOVE(&mountlist, mp, mnt_list); mtx_unlock(&mountlist_mtx); - EVENTHANDLER_INVOKE(vfs_unmounted, mp, td); + EVENTHANDLER_DIRECT_INVOKE(vfs_unmounted, mp, td); if (coveredvp != NULL) { coveredvp->v_mountedhere = NULL; VOP_UNLOCK(coveredvp, 0); From owner-svn-src-head@freebsd.org Sun Jan 7 18:30:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 923CBE79E08; Sun, 7 Jan 2018 18:30:08 +0000 (UTC) (envelope-from srs0=cu0q=ec=freebsd.org=kp@codepro.be) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 59B3B722E3; Sun, 7 Jan 2018 18:30:08 +0000 (UTC) (envelope-from srs0=cu0q=ec=freebsd.org=kp@codepro.be) Received: from [10.0.2.164] (ptr-8ripyyhthbnp0l0tszn.18120a2.ip6.access.telenet.be [IPv6:2a02:1811:2419:4e02:e0f1:72a1:d72b:ec03]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id 181FBAE7A; Sun, 7 Jan 2018 19:30:06 +0100 (CET) From: "Kristof Provost" To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r327676 - head/sys/compat/linuxkpi/common/include/linux Date: Sun, 07 Jan 2018 19:30:04 +0100 X-Mailer: MailMate (2.0BETAr6102) Message-ID: <219974D5-0240-49D9-8DE4-C1FBCEF74776@FreeBSD.org> In-Reply-To: <201801071802.w07I2YEB017699@pdx.rh.CN85.dnsmgr.net> References: <201801071802.w07I2YEB017699@pdx.rh.CN85.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 18:30:08 -0000 On 7 Jan 2018, at 19:02, Rodney W. Grimes wrote: > [ Charset UTF-8 unsupported, converting... ] >> Author: kp >> Date: Sun Jan 7 13:39:12 2018 >> New Revision: 327676 >> URL: https://svnweb.freebsd.org/changeset/base/327676 >> >> Log: >> linuxkpi: Implement kcalloc() based on mallocarray() >> >> This means we now get integer overflow protection, which Linux code >> might expect as it is also provided by kcalloc() in Linux. >> >> Modified: >> head/sys/compat/linuxkpi/common/include/linux/slab.h >> >> Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/compat/linuxkpi/common/include/linux/slab.h Sun Jan 7 = >> 13:35:15 2018 (r327675) >> +++ head/sys/compat/linuxkpi/common/include/linux/slab.h Sun Jan 7 = >> 13:39:12 2018 (r327676) >> @@ -46,7 +46,6 @@ MALLOC_DECLARE(M_KMALLOC); >> #define kzalloc(size, flags) kmalloc(size, (flags) | __GFP_ZERO) >> #define kzalloc_node(size, flags, node) kmalloc(size, (flags) | = >> __GFP_ZERO) >> #define kfree_const(ptr) kfree(ptr) >> -#define kcalloc(n, size, flags) kmalloc((n) * (size), = >> (flags) | __GFP_ZERO) > > Would not: > #define kcalloc(n, size, flags) mallocarray(mallocarray((n), = > (size), M_KMALLOC, linux_check_m_flags((flags | __GFP_ZERO)) > work just fine, saving a call and stack use of about framesize + 32 = > bytes? > > It would also work, but it=E2=80=99d have to be split up into multiple li= nes = then. I thought it=E2=80=99d be more readable as a function. It=E2=80=99s an inline function, so it won=E2=80=99t actually use stack s= pace in = practice. Also, it used to call kmalloc(), which is also an inline function, so at = worst we=E2=80=99ve traded one function for another. Regards, Kristof From owner-svn-src-head@freebsd.org Sun Jan 7 18:37:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54EFCE7A3E1; Sun, 7 Jan 2018 18:37:44 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C04B729C7; Sun, 7 Jan 2018 18:37:43 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w07Ibf29017915; Sun, 7 Jan 2018 10:37:41 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w07Ibfxb017914; Sun, 7 Jan 2018 10:37:41 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201801071837.w07Ibfxb017914@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r327676 - head/sys/compat/linuxkpi/common/include/linux In-Reply-To: <219974D5-0240-49D9-8DE4-C1FBCEF74776@FreeBSD.org> To: Kristof Provost Date: Sun, 7 Jan 2018 10:37:41 -0800 (PST) CC: rgrimes@FreeBSD.org, src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Reply-To: rgrimes@FreeBSD.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 18:37:44 -0000 > On 7 Jan 2018, at 19:02, Rodney W. Grimes wrote: > >> Author: kp > >> Date: Sun Jan 7 13:39:12 2018 > >> New Revision: 327676 > >> URL: https://svnweb.freebsd.org/changeset/base/327676 > >> > >> Log: > >> linuxkpi: Implement kcalloc() based on mallocarray() > >> > >> This means we now get integer overflow protection, which Linux code > >> might expect as it is also provided by kcalloc() in Linux. > >> > >> Modified: > >> head/sys/compat/linuxkpi/common/include/linux/slab.h > >> > >> Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h > >> ============================================================================== > >> --- head/sys/compat/linuxkpi/common/include/linux/slab.h Sun Jan 7 > >> 13:35:15 2018 (r327675) > >> +++ head/sys/compat/linuxkpi/common/include/linux/slab.h Sun Jan 7 > >> 13:39:12 2018 (r327676) > >> @@ -46,7 +46,6 @@ MALLOC_DECLARE(M_KMALLOC); > >> #define kzalloc(size, flags) kmalloc(size, (flags) | __GFP_ZERO) > >> #define kzalloc_node(size, flags, node) kmalloc(size, (flags) | > >> __GFP_ZERO) > >> #define kfree_const(ptr) kfree(ptr) > >> -#define kcalloc(n, size, flags) kmalloc((n) * (size), > >> (flags) | __GFP_ZERO) > > > > Would not: > > #define kcalloc(n, size, flags) mallocarray(mallocarray((n), > > (size), M_KMALLOC, linux_check_m_flags((flags | __GFP_ZERO)) > > work just fine, saving a call and stack use of about framesize + 32 > > bytes? > > > > > It would also work, but it?d have to be split up into multiple lines > then. But it would retain the direct macro form, your change changes it from a #define which is evaluated at pre proc time to a function call that is evaluated at compile time. The resulting code from a -O0 well be different because of this. > I thought it?d be more readable as a function. If that is the only reason I would rather see it retain the same form as all the other allocs. > It?s an inline function, so it won?t actually use stack space in > practice. That depends on compiler and optimization levels. > Also, it used to call kmalloc(), which is also an inline function, so at > worst we?ve traded one function for another. I am not sure, well the inlining of all compilers unwrap 2 levels? -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sun Jan 7 18:53:03 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64D13E7AD8E; Sun, 7 Jan 2018 18:53:03 +0000 (UTC) (envelope-from srs0=cu0q=ec=freebsd.org=kp@codepro.be) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 15C4073320; Sun, 7 Jan 2018 18:53:03 +0000 (UTC) (envelope-from srs0=cu0q=ec=freebsd.org=kp@codepro.be) Received: from [10.0.2.164] (ptr-8ripyyhthbnp0l0tszn.18120a2.ip6.access.telenet.be [IPv6:2a02:1811:2419:4e02:e0f1:72a1:d72b:ec03]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id 03FEEAEDF; Sun, 7 Jan 2018 19:53:00 +0100 (CET) From: "Kristof Provost" To: rgrimes@FreeBSD.org Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r327676 - head/sys/compat/linuxkpi/common/include/linux Date: Sun, 07 Jan 2018 19:52:59 +0100 X-Mailer: MailMate (2.0BETAr6102) Message-ID: In-Reply-To: <201801071837.w07Ibfxb017914@pdx.rh.CN85.dnsmgr.net> References: <201801071837.w07Ibfxb017914@pdx.rh.CN85.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 18:53:03 -0000 On 7 Jan 2018, at 19:37, Rodney W. Grimes wrote: >> On 7 Jan 2018, at 19:02, Rodney W. Grimes wrote: >>>> Author: kp >>>> Date: Sun Jan 7 13:39:12 2018 >>>> New Revision: 327676 >>>> URL: https://svnweb.freebsd.org/changeset/base/327676 >>>> >>>> Log: >>>> linuxkpi: Implement kcalloc() based on mallocarray() >>>> >>>> This means we now get integer overflow protection, which Linux = >>>> code >>>> might expect as it is also provided by kcalloc() in Linux. >>>> >>>> Modified: >>>> head/sys/compat/linuxkpi/common/include/linux/slab.h >>>> >>>> Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/sys/compat/linuxkpi/common/include/linux/slab.h Sun Jan 7 >>>> 13:35:15 2018 (r327675) >>>> +++ head/sys/compat/linuxkpi/common/include/linux/slab.h Sun Jan 7 >>>> 13:39:12 2018 (r327676) >>>> @@ -46,7 +46,6 @@ MALLOC_DECLARE(M_KMALLOC); >>>> #define kzalloc(size, flags) kmalloc(size, (flags) | __GFP_ZERO) >>>> #define kzalloc_node(size, flags, node) kmalloc(size, (flags) | >>>> __GFP_ZERO) >>>> #define kfree_const(ptr) kfree(ptr) >>>> -#define kcalloc(n, size, flags) kmalloc((n) * (size), >>>> (flags) | __GFP_ZERO) >>> >>> Would not: >>> #define kcalloc(n, size, flags) mallocarray(mallocarray((n), >>> (size), M_KMALLOC, linux_check_m_flags((flags | __GFP_ZERO)) >>> work just fine, saving a call and stack use of about framesize + 32 >>> bytes? >>> >>> >> It would also work, but it?d have to be split up into multiple lines >> then. > > But it would retain the direct macro form, your change changes it > from a #define which is evaluated at pre proc time to a function > call that is evaluated at compile time. The resulting code from > a -O0 well be different because of this. > Indeed. It=E2=80=99s not something I=E2=80=99d worry about as anyone who = cares about = it being fast (as opposed to easier to debug for example) would build it = as -O2/-O3. >> I thought it?d be more readable as a function. > > If that is the only reason I would rather see it retain the > same form as all the other allocs. > How does this look? diff --git a/sys/compat/linuxkpi/common/include/linux/slab.h = b/sys/compat/linuxkpi/common/include/linux/slab.h index 1f8ec82db98..5551211c281 100644 --- a/sys/compat/linuxkpi/common/include/linux/slab.h +++ b/sys/compat/linuxkpi/common/include/linux/slab.h @@ -46,6 +46,9 @@ MALLOC_DECLARE(M_KMALLOC); #define kzalloc(size, flags) kmalloc(size, (flags) | __GFP_ZERO) #define kzalloc_node(size, flags, node) kmalloc(size, (flags) | = __GFP_ZERO) #define kfree_const(ptr) kfree(ptr) +#define kcalloc(n, size, flags) mallocarray((n), (size), \ + M_KMALLOC, \ + linux_check_m_flags((flags | __GFP_ZERO))) #define vzalloc(size) __vmalloc(size, GFP_KERNEL | __GFP_NOWARN | = __GFP_ZERO, 0) #define vfree(arg) kfree(arg) #define kvfree(arg) kfree(arg) @@ -99,13 +102,6 @@ kmalloc(size_t size, gfp_t flags) return (malloc(size, M_KMALLOC, linux_check_m_flags(flags))); } = -static inline void * -kcalloc(size_t n, size_t size, gfp_t flags) -{ - flags |=3D __GFP_ZERO; - return (mallocarray(n, size, M_KMALLOC, linux_check_m_flags(flags))); -} - static inline void * __vmalloc(size_t size, gfp_t flags, int other) { Regards, Kristof From owner-svn-src-head@freebsd.org Sun Jan 7 19:07:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D37AE7B849; Sun, 7 Jan 2018 19:07:54 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC8B773EAC; Sun, 7 Jan 2018 19:07:53 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w07J7pRd018032; Sun, 7 Jan 2018 11:07:51 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w07J7pUF018031; Sun, 7 Jan 2018 11:07:51 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201801071907.w07J7pUF018031@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r327676 - head/sys/compat/linuxkpi/common/include/linux In-Reply-To: To: Kristof Provost Date: Sun, 7 Jan 2018 11:07:51 -0800 (PST) CC: rgrimes@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 19:07:54 -0000 > On 7 Jan 2018, at 19:37, Rodney W. Grimes wrote: > >> On 7 Jan 2018, at 19:02, Rodney W. Grimes wrote: > >>>> Author: kp > >>>> Date: Sun Jan 7 13:39:12 2018 > >>>> New Revision: 327676 > >>>> URL: https://svnweb.freebsd.org/changeset/base/327676 > >>>> > >>>> Log: > >>>> linuxkpi: Implement kcalloc() based on mallocarray() > >>>> > >>>> This means we now get integer overflow protection, which Linux > >>>> code > >>>> might expect as it is also provided by kcalloc() in Linux. > >>>> > >>>> Modified: > >>>> head/sys/compat/linuxkpi/common/include/linux/slab.h > >>>> > >>>> Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h > >>>> ============================================================================== > >>>> --- head/sys/compat/linuxkpi/common/include/linux/slab.h Sun Jan 7 > >>>> 13:35:15 2018 (r327675) > >>>> +++ head/sys/compat/linuxkpi/common/include/linux/slab.h Sun Jan 7 > >>>> 13:39:12 2018 (r327676) > >>>> @@ -46,7 +46,6 @@ MALLOC_DECLARE(M_KMALLOC); > >>>> #define kzalloc(size, flags) kmalloc(size, (flags) | __GFP_ZERO) > >>>> #define kzalloc_node(size, flags, node) kmalloc(size, (flags) | > >>>> __GFP_ZERO) > >>>> #define kfree_const(ptr) kfree(ptr) > >>>> -#define kcalloc(n, size, flags) kmalloc((n) * (size), > >>>> (flags) | __GFP_ZERO) > >>> > >>> Would not: > >>> #define kcalloc(n, size, flags) mallocarray(mallocarray((n), > >>> (size), M_KMALLOC, linux_check_m_flags((flags | __GFP_ZERO)) > >>> work just fine, saving a call and stack use of about framesize + 32 > >>> bytes? > >>> > >>> > >> It would also work, but it?d have to be split up into multiple lines > >> then. > > > > But it would retain the direct macro form, your change changes it > > from a #define which is evaluated at pre proc time to a function > > call that is evaluated at compile time. The resulting code from > > a -O0 well be different because of this. > > > Indeed. It?s not something I?d worry about as anyone who cares about > it being fast (as opposed to easier to debug for example) would build it > as -O2/-O3. > > >> I thought it?d be more readable as a function. > > > > If that is the only reason I would rather see it retain the > > same form as all the other allocs. > > > How does this look? > > diff --git a/sys/compat/linuxkpi/common/include/linux/slab.h > b/sys/compat/linuxkpi/common/include/linux/slab.h > index 1f8ec82db98..5551211c281 100644 > --- a/sys/compat/linuxkpi/common/include/linux/slab.h > +++ b/sys/compat/linuxkpi/common/include/linux/slab.h > @@ -46,6 +46,9 @@ MALLOC_DECLARE(M_KMALLOC); > #define kzalloc(size, flags) kmalloc(size, (flags) | __GFP_ZERO) > #define kzalloc_node(size, flags, node) kmalloc(size, (flags) | > __GFP_ZERO) > #define kfree_const(ptr) kfree(ptr) > +#define kcalloc(n, size, flags) mallocarray((n), (size), \ > + M_KMALLOC, \ > + linux_check_m_flags((flags | __GFP_ZERO))) > #define vzalloc(size) __vmalloc(size, GFP_KERNEL | __GFP_NOWARN | > __GFP_ZERO, 0) > #define vfree(arg) kfree(arg) > #define kvfree(arg) kfree(arg) > @@ -99,13 +102,6 @@ kmalloc(size_t size, gfp_t flags) > return (malloc(size, M_KMALLOC, linux_check_m_flags(flags))); > } > > -static inline void * > -kcalloc(size_t n, size_t size, gfp_t flags) > -{ > - flags |= __GFP_ZERO; > - return (mallocarray(n, size, M_KMALLOC, linux_check_m_flags(flags))); > -} > - > static inline void * > __vmalloc(size_t size, gfp_t flags, int other) > { > > Regards, > Kristof Should probably revert and go through review, I would at least wait for comments from others. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sun Jan 7 20:28:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E11FE5ACDB; Sun, 7 Jan 2018 20:28:19 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DCF1C77328; Sun, 7 Jan 2018 20:28:18 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1EF4F25F95; Sun, 7 Jan 2018 20:28:18 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w07KSHKr044609; Sun, 7 Jan 2018 20:28:17 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w07KSHpF044608; Sun, 7 Jan 2018 20:28:17 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201801072028.w07KSHpF044608@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 7 Jan 2018 20:28:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327681 - head/sys/modules/gpio/gpiobus X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/modules/gpio/gpiobus X-SVN-Commit-Revision: 327681 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 20:28:19 -0000 Author: jhibbits Date: Sun Jan 7 20:28:17 2018 New Revision: 327681 URL: https://svnweb.freebsd.org/changeset/base/327681 Log: Add missing file to gpiobus module ofw_gpiobus.c is needed when FDT is used. MFC after: 2 weeks Modified: head/sys/modules/gpio/gpiobus/Makefile Modified: head/sys/modules/gpio/gpiobus/Makefile ============================================================================== --- head/sys/modules/gpio/gpiobus/Makefile Sun Jan 7 18:33:19 2018 (r327680) +++ head/sys/modules/gpio/gpiobus/Makefile Sun Jan 7 20:28:17 2018 (r327681) @@ -36,6 +36,10 @@ SRCS= gpiobus.c gpioc.c SRCS+= gpio_if.c gpio_if.h gpiobus_if.c gpiobus_if.h ofw_bus_if.h SRCS+= device_if.h bus_if.h opt_platform.h +.if !empty(OPT_FDT) +SRCS+= ofw_gpiobus.c +.endif + CFLAGS+= -I. -I${SRCTOP}/sys/dev/gpio/ .include From owner-svn-src-head@freebsd.org Sun Jan 7 21:57:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77893E60DF7; Sun, 7 Jan 2018 21:57:53 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 52C0C7ACBB; Sun, 7 Jan 2018 21:57:53 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B3C226DF4; Sun, 7 Jan 2018 21:57:52 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w07LvqAt082185; Sun, 7 Jan 2018 21:57:52 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w07LvqPR082184; Sun, 7 Jan 2018 21:57:52 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201801072157.w07LvqPR082184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sun, 7 Jan 2018 21:57:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327682 - head/tests/sys/geom/class/eli X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/tests/sys/geom/class/eli X-SVN-Commit-Revision: 327682 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 21:57:53 -0000 Author: asomers Date: Sun Jan 7 21:57:52 2018 New Revision: 327682 URL: https://svnweb.freebsd.org/changeset/base/327682 Log: Fix typo from r327666 MFC after: 13 days X-MFC-With: 327666 Modified: head/tests/sys/geom/class/eli/init_test.sh Modified: head/tests/sys/geom/class/eli/init_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/init_test.sh Sun Jan 7 20:28:17 2018 (r327681) +++ head/tests/sys/geom/class/eli/init_test.sh Sun Jan 7 21:57:52 2018 (r327682) @@ -9,7 +9,7 @@ init_test() keylen=${cipher##*:} atf_check -s exit:0 -e ignore \ - geli init -B none -e $ealgo -l $keylen -P -K keyfile + geli init -B none -e $ealgo -l $keylen -P -K keyfile \ -s $secsize ${md} atf_check geli attach -p -k keyfile ${md} From owner-svn-src-head@freebsd.org Sun Jan 7 22:21:09 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21E12E62495; Sun, 7 Jan 2018 22:21:09 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F029F7BDCE; Sun, 7 Jan 2018 22:21:08 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3ACEC2724A; Sun, 7 Jan 2018 22:21:08 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w07ML8i2092796; Sun, 7 Jan 2018 22:21:08 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w07ML7AE092788; Sun, 7 Jan 2018 22:21:07 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201801072221.w07ML7AE092788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sun, 7 Jan 2018 22:21:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327683 - in head: . tests/sys/geom/class/eli X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: . tests/sys/geom/class/eli X-SVN-Commit-Revision: 327683 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 22:21:09 -0000 Author: asomers Date: Sun Jan 7 22:21:07 2018 New Revision: 327683 URL: https://svnweb.freebsd.org/changeset/base/327683 Log: geli: convert remaining TAP tests to ATF MFC after: 2 weeks Deleted: head/tests/sys/geom/class/eli/nokey_test.sh head/tests/sys/geom/class/eli/readonly_test.sh Modified: head/ObsoleteFiles.inc head/tests/sys/geom/class/eli/Makefile head/tests/sys/geom/class/eli/attach_test.sh head/tests/sys/geom/class/eli/conf.sh head/tests/sys/geom/class/eli/delkey_test.sh head/tests/sys/geom/class/eli/init_test.sh head/tests/sys/geom/class/eli/kill_test.sh head/tests/sys/geom/class/eli/setkey_test.sh Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sun Jan 7 21:57:52 2018 (r327682) +++ head/ObsoleteFiles.inc Sun Jan 7 22:21:07 2018 (r327683) @@ -38,6 +38,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20180107: Convert remaining geli(8) tests to ATF +OLD_FILES+=tests/sys/geom/class/eli/nokey_test.sh +OLD_FILES+=tests/sys/geom/class/eli/readonly_test.sh # 20180106: Convert most geli(8) tests to ATF OLD_FILES+=tests/sys/geom/class/eli/attach_d_test.sh OLD_FILES+=tests/sys/geom/class/eli/configure_b_B_test.sh Modified: head/tests/sys/geom/class/eli/Makefile ============================================================================== --- head/tests/sys/geom/class/eli/Makefile Sun Jan 7 21:57:52 2018 (r327682) +++ head/tests/sys/geom/class/eli/Makefile Sun Jan 7 22:21:07 2018 (r327683) @@ -18,10 +18,6 @@ ATF_TESTS_SH+= onetime_test ATF_TESTS_SH+= resize_test ATF_TESTS_SH+= setkey_test -TAP_TESTS_SH+= nokey_test -TAP_TESTS_SH+= readonly_test - - ${PACKAGE}FILES+= conf.sh .for t in ${TAP_TESTS_SH} Modified: head/tests/sys/geom/class/eli/attach_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/attach_test.sh Sun Jan 7 21:57:52 2018 (r327682) +++ head/tests/sys/geom/class/eli/attach_test.sh Sun Jan 7 22:21:07 2018 (r327683) @@ -39,7 +39,62 @@ attach_d_cleanup() geli_test_cleanup } +atf_test_case attach_r cleanup +attach_r_head() +{ + atf_set "descr" "geli attach -r will create a readonly provider" + atf_set "require.user" "root" +} +attach_r_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + + atf_check geli init -B none -P -K keyfile ${md} + atf_check geli attach -r -p -k keyfile ${md} + + atf_check -o match:"^Flags: .*READ-ONLY" geli list ${md}.eli + + # Verify that writes are verbotten + atf_check -s not-exit:0 -e match:"Read-only" \ + dd if=/dev/zero of=/dev/${md}.eli count=1 +} +attach_r_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + +atf_test_case nokey cleanup +nokey_head() +{ + atf_set "descr" "geli attach fails if called with no key component" + atf_set "require.user" "root" +} +nokey_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + + atf_check geli init -B none -P -K keyfile ${md} + atf_check -s not-exit:0 -e match:"No key components given" \ + geli attach -p ${md} 2>/dev/null +} +nokey_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + atf_init_test_cases() { atf_add_test_case attach_d + atf_add_test_case attach_r + atf_add_test_case nokey } Modified: head/tests/sys/geom/class/eli/conf.sh ============================================================================== --- head/tests/sys/geom/class/eli/conf.sh Sun Jan 7 21:57:52 2018 (r327682) +++ head/tests/sys/geom/class/eli/conf.sh Sun Jan 7 22:21:07 2018 (r327683) @@ -3,7 +3,6 @@ class="eli" base=$(atf_get ident) -[ -z "$base" ] && base=`basename $0` # for TAP compatibility MAX_SECSIZE=8192 TEST_MDS_FILE=md.devs @@ -85,7 +84,5 @@ geli_test_cleanup() fi true } -# TODO: remove the trap statement once all TAP tests are converted -trap geli_test_cleanup ABRT EXIT INT TERM . `dirname $0`/../geom_subr.sh Modified: head/tests/sys/geom/class/eli/delkey_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/delkey_test.sh Sun Jan 7 21:57:52 2018 (r327682) +++ head/tests/sys/geom/class/eli/delkey_test.sh Sun Jan 7 22:21:07 2018 (r327683) @@ -80,7 +80,35 @@ delkey_cleanup() geli_test_cleanup } +atf_test_case delkey_readonly cleanup +delkey_readonly_head() +{ + atf_set "descr" "geli delkey cannot work on a read-only provider" + atf_set "require.user" "root" +} +delkey_readonly_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + + atf_check geli init -B none -P -K keyfile ${md} + atf_check geli attach -r -p -k keyfile ${md} + + atf_check -s not-exit:0 -e match:"read-only" geli delkey -n 0 ${md} + # Even with -f (force) it should still fail + atf_check -s not-exit:0 -e match:"read-only" geli delkey -f -n 0 ${md} +} +delkey_readonly_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + atf_init_test_cases() { atf_add_test_case delkey + atf_add_test_case delkey_readonly } Modified: head/tests/sys/geom/class/eli/init_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/init_test.sh Sun Jan 7 21:57:52 2018 (r327682) +++ head/tests/sys/geom/class/eli/init_test.sh Sun Jan 7 22:21:07 2018 (r327683) @@ -358,6 +358,28 @@ init_i_P_cleanup() geli_test_cleanup } +atf_test_case nokey cleanup +nokey_head() +{ + atf_set "descr" "geli init fails if called with no key component" + atf_set "require.user" "root" +} +nokey_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) + + atf_check -s not-exit:0 -e match:"No key components given" \ + geli init -B none -P ${md} +} +nokey_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + atf_init_test_cases() { atf_add_test_case init @@ -366,4 +388,5 @@ atf_init_test_cases() atf_add_test_case init_a atf_add_test_case init_alias atf_add_test_case init_i_P + atf_add_test_case nokey } Modified: head/tests/sys/geom/class/eli/kill_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/kill_test.sh Sun Jan 7 21:57:52 2018 (r327682) +++ head/tests/sys/geom/class/eli/kill_test.sh Sun Jan 7 22:21:07 2018 (r327683) @@ -65,7 +65,38 @@ kill_cleanup() geli_test_cleanup } +atf_test_case kill_readonly cleanup +kill_readonly_head() +{ + atf_set "descr" "geli kill will not destroy the keys of a readonly provider" + atf_set "require.user" "root" +} +kill_readonly_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + + atf_check geli init -B none -P -K keyfile ${md} + # Attach read-only + atf_check geli attach -r -p -k keyfile ${md} + + atf_check geli kill ${md} + # The provider will be detached + atf_check [ ! -c /dev/${md}.eli ] + # But its keys should not be destroyed + atf_check geli attach -p -k keyfile ${md} +} +kill_readonly_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + atf_init_test_cases() { atf_add_test_case kill + atf_add_test_case kill_readonly } Modified: head/tests/sys/geom/class/eli/setkey_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/setkey_test.sh Sun Jan 7 21:57:52 2018 (r327682) +++ head/tests/sys/geom/class/eli/setkey_test.sh Sun Jan 7 22:21:07 2018 (r327683) @@ -92,7 +92,73 @@ setkey_cleanup() geli_test_cleanup } +atf_test_case setkey_readonly cleanup +setkey_readonly_head() +{ + atf_set "descr" "geli setkey cannot change the keys of a readonly provider" + atf_set "require.user" "root" +} +setkey_readonly_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) + atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + + atf_check geli init -B none -P -K keyfile ${md} + atf_check geli attach -r -p -k keyfile ${md} + + atf_check -s not-exit:0 -e match:"read-only" \ + geli setkey -n 1 -P -K /dev/null ${md} +} +setkey_readonly_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + +atf_test_case nokey cleanup +nokey_head() +{ + atf_set "descr" "geli setkey can change the key for an existing provider" + atf_set "require.user" "root" +} +nokey_body() +{ + . $(atf_get_srcdir)/conf.sh + + sectors=100 + md=$(attach_md -t malloc -s `expr $sectors + 1`) + atf_check dd if=/dev/random of=keyfile1 bs=512 count=16 status=none + atf_check dd if=/dev/random of=keyfile2 bs=512 count=16 status=none + + atf_check geli init -B none -P -K keyfile1 ${md} + + # Try to set the key for a detached device without providing any + # components for the old key. + atf_check -s not-exit:0 -e match:"No key components given" \ + geli setkey -n 0 -p -P -K keyfile2 ${md} + + # Try to set the key for a detached device without providing any + # components for the new key + atf_check -s not-exit:0 -e match:"No key components given" \ + geli setkey -n 0 -p -k keyfile1 -P ${md} + + # Try to set a new key for an attached device with no components + atf_check geli attach -p -k keyfile1 ${md} + atf_check -s not-exit:0 -e match:"No key components given" \ + geli setkey -n 0 -P ${md} +} +nokey_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + geli_test_cleanup +} + atf_init_test_cases() { atf_add_test_case setkey + atf_add_test_case setkey_readonly + atf_add_test_case nokey } From owner-svn-src-head@freebsd.org Sun Jan 7 22:38:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F08C7E63301; Sun, 7 Jan 2018 22:38:46 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CD2EF7C76D; Sun, 7 Jan 2018 22:38:46 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A32727444; Sun, 7 Jan 2018 22:38:46 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w07McjVM099236; Sun, 7 Jan 2018 22:38:45 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w07McjLP099234; Sun, 7 Jan 2018 22:38:45 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201801072238.w07McjLP099234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Sun, 7 Jan 2018 22:38:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327684 - in head/sys/compat: cloudabi32 cloudabi64 X-SVN-Group: head X-SVN-Commit-Author: ed X-SVN-Commit-Paths: in head/sys/compat: cloudabi32 cloudabi64 X-SVN-Commit-Revision: 327684 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 22:38:47 -0000 Author: ed Date: Sun Jan 7 22:38:45 2018 New Revision: 327684 URL: https://svnweb.freebsd.org/changeset/base/327684 Log: Use mallocarray(9) in CloudABI kernel code where possible. Submitted by: pfg@ Modified: head/sys/compat/cloudabi32/cloudabi32_sock.c head/sys/compat/cloudabi64/cloudabi64_sock.c Modified: head/sys/compat/cloudabi32/cloudabi32_sock.c ============================================================================== --- head/sys/compat/cloudabi32/cloudabi32_sock.c Sun Jan 7 22:21:07 2018 (r327683) +++ head/sys/compat/cloudabi32/cloudabi32_sock.c Sun Jan 7 22:38:45 2018 (r327684) @@ -60,7 +60,7 @@ cloudabi32_sys_sock_recv(struct thread *td, /* Convert iovecs to native format. */ if (ri.ri_data_len > UIO_MAXIOV) return (EINVAL); - iov = malloc(ri.ri_data_len * sizeof(struct iovec), + iov = mallocarray(ri.ri_data_len, sizeof(struct iovec), M_SOCKET, M_WAITOK); user_iov = TO_PTR(ri.ri_data); for (i = 0; i < ri.ri_data_len; i++) { @@ -104,7 +104,7 @@ cloudabi32_sys_sock_send(struct thread *td, /* Convert iovecs to native format. */ if (si.si_data_len > UIO_MAXIOV) return (EINVAL); - iov = malloc(si.si_data_len * sizeof(struct iovec), + iov = mallocarray(si.si_data_len, sizeof(struct iovec), M_SOCKET, M_WAITOK); user_iov = TO_PTR(si.si_data); for (i = 0; i < si.si_data_len; i++) { Modified: head/sys/compat/cloudabi64/cloudabi64_sock.c ============================================================================== --- head/sys/compat/cloudabi64/cloudabi64_sock.c Sun Jan 7 22:21:07 2018 (r327683) +++ head/sys/compat/cloudabi64/cloudabi64_sock.c Sun Jan 7 22:38:45 2018 (r327684) @@ -60,7 +60,7 @@ cloudabi64_sys_sock_recv(struct thread *td, /* Convert iovecs to native format. */ if (ri.ri_data_len > UIO_MAXIOV) return (EINVAL); - iov = malloc(ri.ri_data_len * sizeof(struct iovec), + iov = mallocarray(ri.ri_data_len, sizeof(struct iovec), M_SOCKET, M_WAITOK); user_iov = TO_PTR(ri.ri_data); for (i = 0; i < ri.ri_data_len; i++) { @@ -104,7 +104,7 @@ cloudabi64_sys_sock_send(struct thread *td, /* Convert iovecs to native format. */ if (si.si_data_len > UIO_MAXIOV) return (EINVAL); - iov = malloc(si.si_data_len * sizeof(struct iovec), + iov = mallocarray(si.si_data_len, sizeof(struct iovec), M_SOCKET, M_WAITOK); user_iov = TO_PTR(si.si_data); for (i = 0; i < si.si_data_len; i++) { From owner-svn-src-head@freebsd.org Mon Jan 8 00:10:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF5CCE68548; Mon, 8 Jan 2018 00:10:46 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A196B7F949; Mon, 8 Jan 2018 00:10:46 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA595282BD; Mon, 8 Jan 2018 00:10:45 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w080Aj8s037228; Mon, 8 Jan 2018 00:10:45 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w080AjJj037225; Mon, 8 Jan 2018 00:10:45 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201801080010.w080AjJj037225@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 8 Jan 2018 00:10:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327685 - head/tests/sys/geom/class/eli X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/tests/sys/geom/class/eli X-SVN-Commit-Revision: 327685 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 00:10:47 -0000 Author: asomers Date: Mon Jan 8 00:10:45 2018 New Revision: 327685 URL: https://svnweb.freebsd.org/changeset/base/327685 Log: geli: optimize tests Reduce the geli tests' runtime by about a third: * In integrity_test:copy, use a file-backed md(4) device instead of a malloc'd one. That way we can corrupt the underlying storage without needing to detach and reattach the geli device. * In integrity_test:{copy, hmac, data} and onetime_test:{onetime, onetime_a}, move reads of /dev/random out of the loop. MFC after: 2 weeks Modified: head/tests/sys/geom/class/eli/conf.sh head/tests/sys/geom/class/eli/integrity_test.sh head/tests/sys/geom/class/eli/onetime_test.sh Modified: head/tests/sys/geom/class/eli/conf.sh ============================================================================== --- head/tests/sys/geom/class/eli/conf.sh Sun Jan 7 22:38:45 2018 (r327684) +++ head/tests/sys/geom/class/eli/conf.sh Mon Jan 8 00:10:45 2018 (r327685) @@ -20,12 +20,22 @@ attach_md() # func for_each_geli_config() { func=$1 + backing_filename=$2 # Double the sector size to allow for the HMACs' storage space. osecsize=$(( $MAX_SECSIZE * 2 )) # geli needs 512B for the label. bytes=`expr $osecsize \* $sectors + 512`b - md=$(attach_md -t malloc -s $bytes) + + if [ -n "$backing_filename" ]; then + # Use a file-backed md(4) device, so we can deliberatly corrupt + # it without detaching the geli device first. + truncate -s $bytes backing_file + md=$(attach_md -t vnode -f backing_file) + else + md=$(attach_md -t malloc -s $bytes) + fi + for cipher in aes-xts:128 aes-xts:256 \ aes-cbc:128 aes-cbc:192 aes-cbc:256 \ 3des-cbc:192 \ Modified: head/tests/sys/geom/class/eli/integrity_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/integrity_test.sh Sun Jan 7 22:38:45 2018 (r327684) +++ head/tests/sys/geom/class/eli/integrity_test.sh Mon Jan 8 00:10:45 2018 (r327685) @@ -12,31 +12,32 @@ copy_test() { -K keyfile -s $secsize ${md} atf_check geli attach -p -k keyfile ${md} - atf_check dd if=/dev/random of=/dev/${md}.eli bs=${secsize} count=1 status=none + atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=1 status=none - atf_check geli detach ${md} # Copy first small sector to the second small sector. # This should be detected as corruption. - atf_check dd if=/dev/${md} of=sector bs=512 count=1 status=none - atf_check dd if=sector of=/dev/${md} bs=512 count=1 seek=1 status=none - atf_check geli attach -p -k keyfile ${md} + atf_check dd if=backing_file of=sector bs=512 count=1 \ + conv=notrunc status=none + atf_check dd if=sector of=backing_file bs=512 count=1 seek=1 \ + conv=notrunc status=none atf_check -s not-exit:0 -e ignore \ dd if=/dev/${md}.eli of=/dev/null bs=${secsize} count=1 # Fix the corruption - atf_check dd if=/dev/random of=/dev/${md}.eli bs=${secsize} count=2 status=none - atf_check dd if=/dev/${md}.eli of=/dev/null bs=${secsize} count=2 status=none + atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=2 status=none + atf_check dd if=/dev/${md}.eli of=/dev/null bs=${secsize} count=2 \ + status=none # Copy first big sector to the second big sector. # This should be detected as corruption. ms=`diskinfo /dev/${md} | awk '{print $3 - 512}'` ns=`diskinfo /dev/${md}.eli | awk '{print $4}'` usecsize=`echo "($ms / $ns) - (($ms / $ns) % 512)" | bc` - atf_check geli detach ${md} - atf_check dd if=/dev/${md} bs=512 count=$(( ${usecsize} / 512 )) seek=$(( $secsize / 512 )) of=sector status=none - atf_check dd of=/dev/${md} bs=512 count=$(( ${usecsize} / 512 )) seek=$(( $secsize / 256 )) if=sector status=none - atf_check -s exit:0 -e ignore geli attach -p -k keyfile ${md} + atf_check dd if=backing_file bs=512 count=$(( ${usecsize} / 512 )) \ + seek=$(( $secsize / 512 )) of=sector conv=notrunc status=none + atf_check dd of=backing_file bs=512 count=$(( ${usecsize} / 512 )) \ + seek=$(( $secsize / 256 )) if=sector conv=notrunc status=none atf_check -s not-exit:0 -e ignore \ dd if=/dev/${md}.eli of=/dev/null bs=${secsize} count=$ns } @@ -55,7 +56,9 @@ copy_body() sectors=2 atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none - for_each_geli_config copy_test + dd if=/dev/random of=rnd bs=${MAX_SECSIZE} count=${sectors} status=none + + for_each_geli_config copy_test backing_file } copy_cleanup() { @@ -77,7 +80,7 @@ data_test() { # Corrupt 8 bytes of data. atf_check dd if=/dev/${md} of=sector bs=512 count=1 status=none - atf_check dd if=/dev/random of=sector bs=1 count=8 seek=64 conv=notrunc status=none + atf_check dd if=rnd of=sector bs=1 count=8 seek=64 conv=notrunc status=none atf_check dd if=sector of=/dev/${md} bs=512 count=1 status=none atf_check geli attach -p -k keyfile ${md} @@ -100,6 +103,7 @@ data_body() sectors=2 atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + dd if=/dev/random of=rnd bs=${MAX_SECSIZE} count=${sectors} status=none for_each_geli_config data_test } data_cleanup() @@ -121,7 +125,7 @@ hmac_test() { # Corrupt 8 bytes of HMAC. atf_check dd if=/dev/${md} of=sector bs=512 count=1 status=none - atf_check dd if=/dev/random of=sector bs=1 count=16 conv=notrunc status=none + atf_check dd if=rnd of=sector bs=1 count=16 conv=notrunc status=none atf_check dd if=sector of=/dev/${md} bs=512 count=1 status=none atf_check geli attach -p -k keyfile ${md} @@ -144,6 +148,7 @@ hmac_body() sectors=2 atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none + dd if=/dev/random of=rnd bs=${MAX_SECSIZE} count=${sectors} status=none for_each_geli_config hmac_test } hmac_cleanup() Modified: head/tests/sys/geom/class/eli/onetime_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/onetime_test.sh Sun Jan 7 22:38:45 2018 (r327684) +++ head/tests/sys/geom/class/eli/onetime_test.sh Mon Jan 8 00:10:45 2018 (r327685) @@ -10,7 +10,6 @@ onetime_test() atf_check -s exit:0 -o ignore -e ignore \ geli onetime -e $ealgo -l $keylen -s $secsize ${md} - atf_check dd if=/dev/random of=rnd bs=${secsize} count=${sectors} status=none atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${sectors} status=none md_rnd=`dd if=rnd bs=${secsize} count=${sectors} status=none | md5` @@ -82,7 +81,8 @@ onetime_a_body() . $(atf_get_srcdir)/conf.sh sectors=8 - atf_check dd if=/dev/random of=rnd bs=1024 count=1024 status=none + atf_check dd if=/dev/random of=rnd bs=$MAX_SECSIZE count=$sectors \ + status=none for_each_geli_config onetime_a_test } onetime_a_cleanup() From owner-svn-src-head@freebsd.org Mon Jan 8 07:47:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 730C9E7E2EB; Mon, 8 Jan 2018 07:47:08 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id CEBAB6E9AF; Mon, 8 Jan 2018 07:47:05 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from [IPv6:2a02:c7f:1e13:cf00:341b:263b:a811:3894] (unknown [IPv6:2a02:c7f:1e13:cf00:341b:263b:a811:3894]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id B75784EBDB; Mon, 8 Jan 2018 07:37:45 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: svn commit: r327684 - in head/sys/compat: cloudabi32 cloudabi64 From: Andrew Turner In-Reply-To: <201801072238.w07McjLP099234@repo.freebsd.org> Date: Mon, 8 Jan 2018 07:37:44 +0000 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <8D8CA434-2A87-44D9-AC27-5166802FBBC2@fubar.geek.nz> References: <201801072238.w07McjLP099234@repo.freebsd.org> To: Ed Schouten X-Mailer: Apple Mail (2.3445.5.20) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 07:47:08 -0000 > On 7 Jan 2018, at 22:38, Ed Schouten wrote: >=20 > Author: ed > Date: Sun Jan 7 22:38:45 2018 > New Revision: 327684 > URL: https://svnweb.freebsd.org/changeset/base/327684 >=20 > Log: > Use mallocarray(9) in CloudABI kernel code where possible. >=20 > Submitted by: pfg@ >=20 > Modified: > head/sys/compat/cloudabi32/cloudabi32_sock.c > head/sys/compat/cloudabi64/cloudabi64_sock.c >=20 > Modified: head/sys/compat/cloudabi32/cloudabi32_sock.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/compat/cloudabi32/cloudabi32_sock.c Sun Jan 7 = 22:21:07 2018 (r327683) > +++ head/sys/compat/cloudabi32/cloudabi32_sock.c Sun Jan 7 = 22:38:45 2018 (r327684) > @@ -60,7 +60,7 @@ cloudabi32_sys_sock_recv(struct thread *td, > /* Convert iovecs to native format. */ > if (ri.ri_data_len > UIO_MAXIOV) > return (EINVAL); > - iov =3D malloc(ri.ri_data_len * sizeof(struct iovec), > + iov =3D mallocarray(ri.ri_data_len, sizeof(struct iovec), > M_SOCKET, M_WAITOK); Won=E2=80=99t this lead to a NULL pointer dereference on overflow? = mallocarray can return NULL even with M_WAITOK. Andrew From owner-svn-src-head@freebsd.org Mon Jan 8 09:20:09 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE24DE5DCE1; Mon, 8 Jan 2018 09:20:09 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 956AF72080; Mon, 8 Jan 2018 09:20:09 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B77D12DB24; Mon, 8 Jan 2018 09:20:08 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w089K8dS068923; Mon, 8 Jan 2018 09:20:08 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w089K8Ur068921; Mon, 8 Jan 2018 09:20:08 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201801080920.w089K8Ur068921@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Mon, 8 Jan 2018 09:20:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327689 - head/lib/libcasper/services/cap_dns X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/services/cap_dns X-SVN-Commit-Revision: 327689 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 09:20:09 -0000 Author: oshogbo Date: Mon Jan 8 09:20:08 2018 New Revision: 327689 URL: https://svnweb.freebsd.org/changeset/base/327689 Log: Document the DNS Casper service. Reviewed by: brueffer@, bcr@ Differential Revision: https://reviews.freebsd.org/D13762 Added: head/lib/libcasper/services/cap_dns/cap_dns.3 (contents, props changed) Modified: head/lib/libcasper/services/cap_dns/Makefile Modified: head/lib/libcasper/services/cap_dns/Makefile ============================================================================== --- head/lib/libcasper/services/cap_dns/Makefile Mon Jan 8 08:37:31 2018 (r327688) +++ head/lib/libcasper/services/cap_dns/Makefile Mon Jan 8 09:20:08 2018 (r327689) @@ -24,4 +24,14 @@ CFLAGS+=-I${.CURDIR} HAS_TESTS= SUBDIR.${MK_TESTS}+= tests +MAN+= cap_dns.3 + +MLINKS+=cap_dns.3 libcap_dns.3 +MLINKS+=cap_dns.3 cap_gethostbyname.3 +MLINKS+=cap_dns.3 cap_gethostbyname2.3 +MLINKS+=cap_dns.3 cap_gethostbyaddr.3 +MLINKS+=cap_dns.3 cap_getnameinfo.3 +MLINKS+=cap_dns.3 cap_dns_type_limit.3 +MLINKS+=cap_dns.3 cap_dns_family_limit.3 + .include Added: head/lib/libcasper/services/cap_dns/cap_dns.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libcasper/services/cap_dns/cap_dns.3 Mon Jan 8 09:20:08 2018 (r327689) @@ -0,0 +1,205 @@ +.\" Copyright (c) 2018 Mariusz Zaborski +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd January 8, 2018 +.Dt CAP_DNS 3 +.Os +.Sh NAME +.Nm cap_gethostbyname , +.Nm cap_gethostbyname2 , +.Nm cap_gethostbyaddr , +.Nm cap_getnameinfo , +.Nm cap_dns_type_limit , +.Nm cap_dns_family_limit +.Nd "library for getting network host entry in capability mode" +.Sh LIBRARY +.Lb libcap_dns +.Sh SYNOPSIS +.In sys/nv.h +.In libcasper.h +.In casper/cap_dns.h +.Ft "struct hostent *" +.Fn cap_gethostbyname "const cap_channel_t *chan" "const char *name" +.Ft "struct hostent *" +.Fn cap_gethostbyname2 "const cap_channel_t *chan" "const char *name" "int af" +.Ft "struct hostent *" +.Fn cap_gethostbyaddr "const cap_channel_t *chan" "const void *addr" "socklen_t len" "int af" +.Ft "int" +.Fn cap_getnameinfo "const cap_channel_t *chan" "const void *name" "int namelen" +.Ft "int" +.Fn cap_dns_type_limit "cap_channel_t *chan" "const char * const *types" "size_t ntypes" +.Ft "int" +.Fn cap_dns_family_limit "const cap_channel_t *chan" "const int *families" "size_t nfamilies" +.Sh DESCRIPTION +The functions +.Fn cap_gethostbyname , +.Fn cap_gethostbyname2 , +.Fn cep_gethostbyaddr +and +.Xr cap_getnameinfo +are respectively equivalent to +.Xr gethostbyname 2 , +.Xr gethostbyname2 2 , +.Xr gethostbyaddr 2 +and +.Xr getnameinfo 2 +except that the connection to the +.Nm system.dns +service needs to be provided. +.Pp +The +.Fn cap_dns_type_limit +function limits the functions allowed in the service. +The +.Fa types +variable can be set to +.Dv ADDR +or +.Dv NAME . +See the +.Sx LIMITS +section for more details. +The +.Fa ntpyes +variable contains the number of +.Fa types +provided. +.Pp +The +.Fn cap_dns_family_limit +functions allows to limit address families. +For details see +.Sx LIMITS . +The +.Fa nfamilies +variable contains the number of +.Fa families +provided. +.Sh LIMITS +The preferred way of setting limits is to use the +.Fn cap_dns_type_limit +and +.Fn cap_dns_family_limit +functions, but the limits of service can be set also using +.Xr cap_limit_set 3 . +The nvlist for that function can contain the following values and types: +.Bl -ohang -offset indent +.It type ( NV_TYPE_STRING ) +The +.Va type +can have two values: +.Dv ADDR +or +.Dv NAME . +The +.Dv ADDR +means that functions +.Fn cap_gethostbyname , +.Fn cap_gethostbyname2 +and +.Fn cap_gethostbyaddr +are allowed. +In case when +.Va type +is set to +.Dv NAME +the +.Fn cap_getnameinfo +function is allowed. +.It family ( NV_TYPE_NUMBER ) +The +.Va family +limits service to one of the address families (e.g. +.Dv AF_INET , AF_INET6 , +etc.). +.Sh EXAMPLES +The following example first opens a capability to casper and then uses this +capability to create the +.Nm system.dns +casper service and uses it to resolve an IP address. +.Bd -literal +cap_channel_t *capcas, *capdns; +const char *typelimit = "ADDR"; +int familylimit; +const char *ipstr = "127.0.0.1"; +struct in_addr ip; +struct hostent *hp; + +/* Open capability to Casper. */ +capcas = cap_init(); +if (capcas == NULL) + err(1, "Unable to contact Casper"); + +/* Enter capability mode sandbox. */ +if (cap_enter() < 0 && errno != ENOSYS) + err(1, "Unable to enter capability mode"); + +/* Use Casper capability to create capability to the system.dns service. */ +capdns = cap_service_open(capcas, "system.dns"); +if (capdns == NULL) + err(1, "Unable to open system.dns service"); + +/* Close Casper capability, we don't need it anymore. */ +cap_close(capcas); + +/* Limit system.dns to reverse DNS lookups. */ +if (cap_dns_type_limit(capdns, &typelimit, 1) < 0) + err(1, "Unable to limit access to the system.dns service"); + +/* Limit system.dns to reserve IPv4 addresses */ +familylimit = AF_INET; +if (cap_dns_family_limit(capdns, &familylimit, 1) < 0) + err(1, "Unable to limit access to the system.dns service"); + +/* Convert IP address in C-string to in_addr. */ +if (!inet_aton(ipstr, &ip)) + errx(1, "Unable to parse IP address %s.", ipstr); + +/* Find hostname for the given IP address. */ +hp = cap_gethostbyaddr(capdns, (const void *)&ip, sizeof(ip), AF_INET); +if (hp == NULL) + errx(1, "No name associated with %s.", ipstr); + +printf("Name associated with %s is %s.\\n", ipstr, hp->h_name); +.Ed +.Sh SEE ALSO +.Xr cap_enter 2 , +.Xr err 3 , +.Xr gethostbyaddr 3 , +.Xr gethostbyname 3 , +.Xr gethostbyname2 3 , +.Xr getnameinfo 3, +.Xr nv 3 , +.Xr capsicum 4 +.Sh AUTHORS +The +.Nm cap_dns +service was implemented by +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net +under sponsorship from the FreeBSD Foundation. +.Pp +This manual page was written by +.An Mariusz Zaborski Aq Mt oshogbo@FreeBSD.org . From owner-svn-src-head@freebsd.org Mon Jan 8 10:23:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9D51E62495; Mon, 8 Jan 2018 10:23:32 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A17367444A; Mon, 8 Jan 2018 10:23:32 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D385F2E65C; Mon, 8 Jan 2018 10:23:31 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w08ANVGv097684; Mon, 8 Jan 2018 10:23:31 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w08ANVNi097681; Mon, 8 Jan 2018 10:23:31 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201801081023.w08ANVNi097681@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 8 Jan 2018 10:23:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327690 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 327690 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 10:23:32 -0000 Author: andrew Date: Mon Jan 8 10:23:31 2018 New Revision: 327690 URL: https://svnweb.freebsd.org/changeset/base/327690 Log: Move some of the common thread switching code into C. This will help with future optimisations, e.g. using Address Space IDs (asid). MFC after: 1 week Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/pmap.c head/sys/arm64/arm64/swtch.S head/sys/arm64/include/pmap.h Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Mon Jan 8 09:20:08 2018 (r327689) +++ head/sys/arm64/arm64/pmap.c Mon Jan 8 10:23:31 2018 (r327690) @@ -4660,6 +4660,38 @@ pmap_activate(struct thread *td) critical_exit(); } +struct pcb * +pmap_switch(struct thread *old, struct thread *new) +{ + struct pcb *pcb; + + /* Store the new curthread */ + PCPU_SET(curthread, new); + + /* And the new pcb */ + pcb = new->td_pcb; + PCPU_SET(curpcb, pcb); + + /* + * TODO: We may need to flush the cache here if switching + * to a user process. + */ + + __asm __volatile( + /* Switch to the new pmap */ + "msr ttbr0_el1, %0 \n" + "isb \n" + + /* Invalidate the TLB */ + "dsb ishst \n" + "tlbi vmalle1is \n" + "dsb ish \n" + "isb \n" + : : "r"(new->td_proc->p_md.md_l0addr)); + + return (pcb); +} + void pmap_sync_icache(pmap_t pmap, vm_offset_t va, vm_size_t sz) { Modified: head/sys/arm64/arm64/swtch.S ============================================================================== --- head/sys/arm64/arm64/swtch.S Mon Jan 8 09:20:08 2018 (r327689) +++ head/sys/arm64/arm64/swtch.S Mon Jan 8 10:23:31 2018 (r327690) @@ -70,33 +70,16 @@ ENTRY(cpu_throw) #ifdef VFP /* Backup the new thread pointer around a call to C code */ - mov x19, x1 + mov x19, x0 + mov x20, x1 bl vfp_discard - mov x1, x19 + mov x1, x20 + mov x0, x19 #endif - /* Store the new curthread */ - str x1, [x18, #PC_CURTHREAD] - /* And the new pcb */ - ldr x4, [x1, #TD_PCB] - str x4, [x18, #PC_CURPCB] + bl pmap_switch + mov x4, x0 - /* - * TODO: We may need to flush the cache here. - */ - - /* Switch to the new pmap */ - ldr x28, [x1, #TD_PROC] - ldr x5, [x28, #(P_MD + MD_L0ADDR)] - msr ttbr0_el1, x5 - isb - - /* Invalidate the TLB */ - dsb ishst - tlbi vmalle1 - dsb ish - isb - /* If we are single stepping, enable it */ ldr w5, [x4, #PCB_FLAGS] set_step_flag w5, x6 @@ -161,45 +144,25 @@ ENTRY(cpu_switch) ldr w5, [x4, #PCB_FLAGS] clear_step_flag w5, x6 -#ifdef VFP mov x19, x0 mov x20, x1 mov x21, x2 + +#ifdef VFP /* Load the pcb address */ mov x1, x4 bl vfp_save_state - mov x2, x21 mov x1, x20 mov x0, x19 #endif - /* Store the new curthread */ - str x1, [x18, #PC_CURTHREAD] + bl pmap_switch + /* Move the new pcb out of the way */ + mov x4, x0 - /* - * Restore the saved context and set it as curpcb. - */ - ldr x4, [x1, #TD_PCB] - str x4, [x18, #PC_CURPCB] - - /* - * TODO: We may need to flush the cache here if switching - * to a user process. - */ - - /* Load the new proc address */ - ldr x28, [x1, #TD_PROC] - - /* Switch to the new pmap */ - ldr x5, [x28, #(P_MD + MD_L0ADDR)] - msr ttbr0_el1, x5 - isb - - /* Invalidate the TLB */ - dsb ishst - tlbi vmalle1 - dsb ish - isb + mov x2, x21 + mov x1, x20 + mov x0, x19 /* * Release the old thread. This doesn't need to be a store-release Modified: head/sys/arm64/include/pmap.h ============================================================================== --- head/sys/arm64/include/pmap.h Mon Jan 8 09:20:08 2018 (r327689) +++ head/sys/arm64/include/pmap.h Mon Jan 8 10:23:31 2018 (r327690) @@ -106,6 +106,8 @@ struct pv_chunk { typedef struct pmap *pmap_t; +struct thread; + #ifdef _KERNEL extern struct pmap kernel_pmap_store; #define kernel_pmap (&kernel_pmap_store) @@ -155,6 +157,8 @@ bool pmap_get_tables(pmap_t, vm_offset_t, pd_entry_t * pd_entry_t **, pt_entry_t **); int pmap_fault(pmap_t, uint64_t, uint64_t); + +struct pcb *pmap_switch(struct thread *, struct thread *); #define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list)) From owner-svn-src-head@freebsd.org Mon Jan 8 11:08:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE7D4E64645; Mon, 8 Jan 2018 11:08:46 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 918A175E20; Mon, 8 Jan 2018 11:08:46 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2DA32ECFB; Mon, 8 Jan 2018 11:08:45 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w08B8j0G014904; Mon, 8 Jan 2018 11:08:45 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w08B8jN5014903; Mon, 8 Jan 2018 11:08:45 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201801081108.w08B8jN5014903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 8 Jan 2018 11:08:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327691 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 327691 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 11:08:46 -0000 Author: andrew Date: Mon Jan 8 11:08:45 2018 New Revision: 327691 URL: https://svnweb.freebsd.org/changeset/base/327691 Log: Only install the new pagetable pointer into ttbr0_el1 when it differs from the existing value. MFC after: 1 week Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Mon Jan 8 10:23:31 2018 (r327690) +++ head/sys/arm64/arm64/pmap.c Mon Jan 8 11:08:45 2018 (r327691) @@ -4677,17 +4677,20 @@ pmap_switch(struct thread *old, struct thread *new) * to a user process. */ - __asm __volatile( - /* Switch to the new pmap */ - "msr ttbr0_el1, %0 \n" - "isb \n" + if (old == NULL || + old->td_proc->p_md.md_l0addr != new->td_proc->p_md.md_l0addr) { + __asm __volatile( + /* Switch to the new pmap */ + "msr ttbr0_el1, %0 \n" + "isb \n" - /* Invalidate the TLB */ - "dsb ishst \n" - "tlbi vmalle1is \n" - "dsb ish \n" - "isb \n" - : : "r"(new->td_proc->p_md.md_l0addr)); + /* Invalidate the TLB */ + "dsb ishst \n" + "tlbi vmalle1is \n" + "dsb ish \n" + "isb \n" + : : "r"(new->td_proc->p_md.md_l0addr)); + } return (pcb); } From owner-svn-src-head@freebsd.org Mon Jan 8 13:43:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 043FAE6D627; Mon, 8 Jan 2018 13:43:14 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D38527BE84; Mon, 8 Jan 2018 13:43:13 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1D1EF69D; Mon, 8 Jan 2018 13:43:13 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w08DhC2u094278; Mon, 8 Jan 2018 13:43:12 GMT (envelope-from fabient@FreeBSD.org) Received: (from fabient@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w08DhCjV094277; Mon, 8 Jan 2018 13:43:12 GMT (envelope-from fabient@FreeBSD.org) Message-Id: <201801081343.w08DhCjV094277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fabient set sender to fabient@FreeBSD.org using -f From: Fabien Thomas Date: Mon, 8 Jan 2018 13:43:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327696 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: fabient X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 327696 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 13:43:14 -0000 Author: fabient Date: Mon Jan 8 13:43:12 2018 New Revision: 327696 URL: https://svnweb.freebsd.org/changeset/base/327696 Log: Fix uninitialized crp_retw_id when using asynchronous crypto drivers with defered callbacks. Submitted by: emeric.poupon@stormshield.eu Reported by: mav@ Reviewed by: fabient@ Modified: head/sys/opencrypto/crypto.c Modified: head/sys/opencrypto/crypto.c ============================================================================== --- head/sys/opencrypto/crypto.c Mon Jan 8 13:19:15 2018 (r327695) +++ head/sys/opencrypto/crypto.c Mon Jan 8 13:43:12 2018 (r327696) @@ -896,11 +896,12 @@ crypto_dispatch(struct cryptop *crp) binuptime(&crp->crp_tstamp); #endif + crp->crp_retw_id = crp->crp_sid % crypto_workers_num; + if (CRYPTOP_ASYNC(crp)) { if (crp->crp_flags & CRYPTO_F_ASYNC_KEEPORDER) { struct crypto_ret_worker *ret_worker; - crp->crp_retw_id = crp->crp_sid % crypto_workers_num; ret_worker = CRYPTO_RETW(crp->crp_retw_id); CRYPTO_RETW_LOCK(ret_worker); From owner-svn-src-head@freebsd.org Mon Jan 8 15:14:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7628DE71D8A for ; Mon, 8 Jan 2018 15:14:14 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-yb0-x22e.google.com (mail-yb0-x22e.google.com [IPv6:2607:f8b0:4002:c09::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 317A37F879 for ; Mon, 8 Jan 2018 15:14:14 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-yb0-x22e.google.com with SMTP id f16so4629454ybn.0 for ; Mon, 08 Jan 2018 07:14:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=1vKUdDJF2q8Lg0HRJf6EmQK7A3e4gIX0T7O9lmc8wpM=; b=totnRVf9t4/2iTDP70DxOfw+qYHmQPLICZBhFf+9HP04t8zdDPkJf8w1tBUs26KXSI FkSVYRiszeOCqwWKueHftOjHvYV+TEnb0PqXto5B3r3ZTV1ZIBVo16M07s1WadmS6d6d yoVCra1G3qF/rxSTJEWiQbKmkJ0Te6Ouv4OKLkFLlnd3INBusyR9hjwWhLeBekBaj7ux hsWWIy2k+jLcGV2PuvRe9eC44X/l+s6lXIsqqaWoCVJFgwyrEZB0F13jtEjoAwNYsXuk TQVAVGkO5PlYEtQYa5AEaIUT8vADu7zdKFfu5Dl+btFoXXWai7rnla5rBX74U58hKxgE CJ/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=1vKUdDJF2q8Lg0HRJf6EmQK7A3e4gIX0T7O9lmc8wpM=; b=UwGwNqR475DTngYHFeQlm40QVk4Nils6ksOxTp7WsEL7lIJZ47nHGhIVvry5m3Lvmk ZsFbb/FIO0VS/LpfHaqDggNnSLMTHVir5CAsEjueqAd/WKJlZtm8IBvzNyXUE7mqFddD O86McSRw4F3aAnor2ol00Lh4PKsyBlpbvi/gVIIr6Ix2AxBZaOLKEJjrG5Dwnn2Xur9z ZyJtI/Cl4u5VIIUbHNAKuR0NrfAzKEhroWPbsN9ngxqtjBH4lT38e/6tO/tuHSvr1ppv IywK63WWTGWzTU0YQFboweXXntByrht59dB9wxeo+G1ZIJEEKGbKerE3w89c5NByixia SCUg== X-Gm-Message-State: AKGB3mI58l17P9/YDlHnR71m+KHLoDW2qOelx2V57dHeN5Cx2p0zGDpN PnuDMRH9zA0Z8ZG4P0af6cbmsiKZp254jUVFVrzLow== X-Google-Smtp-Source: ACJfBouCUzYvMazQcVThk+pW/bwJWC9QEbRbMNrdrwKX8JSv++2Q6BzRBS0bD9+QeZHZACTdBKOIBm09a+gsbH2fLqY= X-Received: by 10.37.239.5 with SMTP id g5mr1841433ybd.226.1515424453231; Mon, 08 Jan 2018 07:14:13 -0800 (PST) MIME-Version: 1.0 Received: by 10.129.85.17 with HTTP; Mon, 8 Jan 2018 07:13:42 -0800 (PST) In-Reply-To: <8D8CA434-2A87-44D9-AC27-5166802FBBC2@fubar.geek.nz> References: <201801072238.w07McjLP099234@repo.freebsd.org> <8D8CA434-2A87-44D9-AC27-5166802FBBC2@fubar.geek.nz> From: Ed Schouten Date: Mon, 8 Jan 2018 16:13:42 +0100 Message-ID: Subject: Re: svn commit: r327684 - in head/sys/compat: cloudabi32 cloudabi64 To: Andrew Turner Cc: Ed Schouten , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 15:14:14 -0000 Hi Andrew, 2018-01-08 8:37 GMT+01:00 Andrew Turner : > Won=E2=80=99t this lead to a NULL pointer dereference on overflow? malloc= array can return NULL even with M_WAITOK. Yes, it will, but an overflow shouldn't happen in the first place. ri_data_len is compared with UIO_MAXIOV a few lines above. Even if an overflow would happen, this would cause a kernel panic due to a NULL pointer dereference later on, which is likely easier to debug than some piece of code that overruns a buffer. In this case, mallocarray() is preferred, because it makes it more obvious that we're allocating a buffer that is accessed as an array, as opposed to single structure. --=20 Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands From owner-svn-src-head@freebsd.org Mon Jan 8 15:29:03 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF242E7281C for ; Mon, 8 Jan 2018 15:29:03 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic312-35.consmr.mail.ne1.yahoo.com (sonic312-35.consmr.mail.ne1.yahoo.com [66.163.191.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 91C4F80154 for ; Mon, 8 Jan 2018 15:29:02 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1515425342; bh=qCWPCvfC/NeNLjWqtNypZ1SEfRSYmXmJgxGyeOsPIyE=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=pglKajKfJIc2rtJHEh8OX+bvad730R5PZrMdsbArO5oxEsMz76cuJQEpQAWKA62PjhTRmCZLWF1Hm93ez7TIc+kpdh7ocmpzKc9G5gZZMBE6jgjr9NoJsSIWNQNZzk0J/bOQhP7dewYOq5Cseps68QwGF59Esh99M0J3chSNCoumb8BbuuBPgCccA3r4tE2dMu+G6YKxivU6RvHDqgdYxVtSkVC6lCw4rDObgGgLsGhHULpbWlDTZgOU54ARDh41mV7xv/aNeHwW7UL9dC38EEWjoEzXg8gX2wITvl5O2wALHdTWtOBFdrOMEM/leafNewz/6Hqpkq7oRlkCykeriw== X-YMail-OSG: fpEclCYVM1n7ws2ySi7L7Bhb7n4shomKURrrQznn_oOW8JEjSJUpAq_fzixQD2x w0u1lS3spC03zSwI6bHl1EDwuqVFaC0k3a9V.8Ybo0HDlcwhbX.tqSeDWPLoPXxZnRY8wL2awZgE Aq66IFfdDYubDicP6AjcOHyea3hj0On2U8JvDFCDOBcjzu6J.KgpJmDcCVGyuKnXSmJN..2szVpQ CmZtYnONDEJGtgTt9o3aGa6Zggrjop4PhTwiI7CdJ3UzieLomWfcKQhNtjJlge39Vta9Otl_oDRw jKPNCxYQme_7duPx02klzCj2P703RzWBPB8jouPjXQ57DNZuABAIsdxsFoP0O2r.x6sdk_wVOqpv m.3Z2WZ66LPdkBHz8F.uPqjRHJAzMzoiPPQ.XR0VTB4GGobk44nK17q0faUC0_7MO.YXgi3D.xGt lrOXISuUlHW1OxIBOmB2gzSG2rBj9wucvY_Gg5F0BZZilqqdc8V.IUQttuY_6QVltewMYuAXM Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.ne1.yahoo.com with HTTP; Mon, 8 Jan 2018 15:29:02 +0000 Received: from smtpgate103.mail.ne1.yahoo.com (EHLO [192.168.0.6]) ([216.155.193.162]) by smtp414.mail.ne1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID f4ea58c48869a7f2ae5062e2c9ea97de; Mon, 08 Jan 2018 15:08:47 +0000 (UTC) Subject: Re: svn commit: r327684 - in head/sys/compat: cloudabi32 cloudabi64 To: Andrew Turner , Ed Schouten Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801072238.w07McjLP099234@repo.freebsd.org> <8D8CA434-2A87-44D9-AC27-5166802FBBC2@fubar.geek.nz> From: Pedro Giffuni Organization: FreeBSD Project Message-ID: <191085f4-3496-e063-474f-3193a3188275@FreeBSD.org> Date: Mon, 8 Jan 2018 10:08:47 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <8D8CA434-2A87-44D9-AC27-5166802FBBC2@fubar.geek.nz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 15:29:03 -0000 Hi; On 08/01/2018 02:37, Andrew Turner wrote: >> On 7 Jan 2018, at 22:38, Ed Schouten wrote: >> >> Author: ed >> Date: Sun Jan 7 22:38:45 2018 >> New Revision: 327684 >> URL: https://svnweb.freebsd.org/changeset/base/327684 >> >> Log: >> Use mallocarray(9) in CloudABI kernel code where possible. >> >> Submitted by: pfg@ >> >> Modified: >> head/sys/compat/cloudabi32/cloudabi32_sock.c >> head/sys/compat/cloudabi64/cloudabi64_sock.c >> >> Modified: head/sys/compat/cloudabi32/cloudabi32_sock.c >> ============================================================================== >> --- head/sys/compat/cloudabi32/cloudabi32_sock.c Sun Jan 7 22:21:07 2018 (r327683) >> +++ head/sys/compat/cloudabi32/cloudabi32_sock.c Sun Jan 7 22:38:45 2018 (r327684) >> @@ -60,7 +60,7 @@ cloudabi32_sys_sock_recv(struct thread *td, >> /* Convert iovecs to native format. */ >> if (ri.ri_data_len > UIO_MAXIOV) >> return (EINVAL); >> - iov = malloc(ri.ri_data_len * sizeof(struct iovec), >> + iov = mallocarray(ri.ri_data_len, sizeof(struct iovec), >> M_SOCKET, M_WAITOK); > Won’t this lead to a NULL pointer dereference on overflow? mallocarray can return NULL even with M_WAITOK. I think you are right: for the M_WAITOK case we should do the check outside the malloc. Compilers and static checkers should be giving out a warning since mallocarray() has the __result_use_check attribute (is that working!?). In the case of malloc(9) we should remove the attribute since we can by using M_WAITOK. And yes, this patch should be reverted. Pedro. From owner-svn-src-head@freebsd.org Mon Jan 8 15:37:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2608DE72FCA for ; Mon, 8 Jan 2018 15:37:46 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic304-35.consmr.mail.ne1.yahoo.com (sonic304-35.consmr.mail.ne1.yahoo.com [66.163.191.161]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EBE30808A2 for ; Mon, 8 Jan 2018 15:37:45 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1515425864; bh=4cazRHlfbyA+0ug4ZwsxSG7jbOfiBLQTLjefHHmXOc0=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=D5pftbG52co1bqUuUQz4atjrKX/EwnBAEKVW0F8XKcJnaCIc12v+nnwp+LfqiJvV/wKX6UryUPMU03mHqXSeWY7HLsjnjDqCHgbgH4GLvi67zNpyRj/gt5M3uSm2sy+rNjXL4bjIQk903/L9SOKge4rlMHInh5amKMK6yztnPCvw3n49VgzJVtW+vg6A3vju4FlB/uriIqK+7NNbWIB3hvbEWwF8gWD3voE7KtoC7S5KseeQw0x80jThVgLR2h6n7ccwX6bzgVMpfJd9fE/JgMTLQB44r8VcGK24AykmB70BNoDI98JtnyApoHmElLdTHNCwxa9gNYNDwRQG9tTV6g== X-YMail-OSG: BCiWKAYVM1n8XErNf.XQW7lDpwoDCLHrJHxYWxTXYROPOdYcz_nB2ZZ9yPF6rm. vp0QHs7yabK4Gp.mEJ7OR0vNbisuiymlt_hcTkbkjiaTKR5Un6K4843IkC4GVXzFSC60.LxRnwx6 FTiA45l_Fz9EYKgIcFVJdeke.4W.0HKSrTO9KfTKB.bzuXgg.hRr2fpPeUVNwyQ0dfF1Q6PJbwH0 kK4iNmx21IScKtyNb4WEAmzm1szm8AoxFcJXlJytdlNM2ueOduhOOoYzNRTupzQJIqTw6J0RjHOp wO3I_MUGfIJrGHQua.V0Zrs9eesiffmh1Ddzq5VyMLXlgTOcWJI3aAbEAmpn.3cIe6VZuTYM6uTX PfJto5ElDEiumklfZ1R2o_NSjmBnU.v1y4AAmSxzHuZ7msw6VZG24Vp.Tpiiwg47GAGpmhT9vAE9 w9Eia857PZu8ZsI5rZ0VWpceJKaJKRZbquF_MmEEuzHp1Syd4rLXGnkdk9Aa5J3Lxh7Stihb. Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.ne1.yahoo.com with HTTP; Mon, 8 Jan 2018 15:37:44 +0000 Received: from smtpgate105.mail.ne1.yahoo.com (EHLO [192.168.0.6]) ([216.155.193.135]) by smtp403.mail.ne1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 9d400679ba3fce3720889955d9c8c284; Mon, 08 Jan 2018 15:37:41 +0000 (UTC) Subject: Re: svn commit: r327684 - in head/sys/compat: cloudabi32 cloudabi64 To: Ed Schouten , Andrew Turner Cc: Ed Schouten , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801072238.w07McjLP099234@repo.freebsd.org> <8D8CA434-2A87-44D9-AC27-5166802FBBC2@fubar.geek.nz> From: Pedro Giffuni Message-ID: <0a6ad324-46f2-9270-5abd-dbc3e734cc8b@FreeBSD.org> Date: Mon, 8 Jan 2018 10:37:40 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 15:37:46 -0000 On 01/08/18 10:13, Ed Schouten wrote: > Hi Andrew, > > 2018-01-08 8:37 GMT+01:00 Andrew Turner : >> Won’t this lead to a NULL pointer dereference on overflow? mallocarray can return NULL even with M_WAITOK. > Yes, it will, but an overflow shouldn't happen in the first place. > ri_data_len is compared with UIO_MAXIOV a few lines above. Even if an > overflow would happen, this would cause a kernel panic due to a NULL > pointer dereference later on, which is likely easier to debug than > some piece of code that overruns a buffer. > > In this case, mallocarray() is preferred, because it makes it more > obvious that we're allocating a buffer that is accessed as an array, > as opposed to single structure. > OK... The behavior of mallocarray() somewhat inconsistent with malloc(9), realloc(9) and reallocf(9) but this is clearly documented., so we just assume the developer knows what he/she is doing :). Pedro. From owner-svn-src-head@freebsd.org Mon Jan 8 15:41:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A35D7E7336F; Mon, 8 Jan 2018 15:41:49 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8053D80D60; Mon, 8 Jan 2018 15:41:49 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C85C219EC; Mon, 8 Jan 2018 15:41:48 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w08FfmBF052730; Mon, 8 Jan 2018 15:41:48 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w08Ffmm0052729; Mon, 8 Jan 2018 15:41:48 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801081541.w08Ffmm0052729@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 8 Jan 2018 15:41:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327697 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 327697 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 15:41:49 -0000 Author: pfg Date: Mon Jan 8 15:41:48 2018 New Revision: 327697 URL: https://svnweb.freebsd.org/changeset/base/327697 Log: malloc(9): drop the __result_use_check attribute for the kernel allocator. The __result_use_check attribute was brought to the kernel malloc in r281203 for consistency with the userland malloc. For the case of the M_WAITOK flag, the kernel malloc(), realloc(), and reallocf() cannot return NULL so in that case the __result_use_check attribute makes no sense. We don't have any way of conditionalizing such attributes so just drop it. MFC after: 3 days Modified: head/sys/sys/malloc.h Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Mon Jan 8 13:43:12 2018 (r327696) +++ head/sys/sys/malloc.h Mon Jan 8 15:41:48 2018 (r327697) @@ -176,7 +176,7 @@ void *contigmalloc(unsigned long size, struct malloc_t __alloc_size(1) __alloc_align(6); void free(void *addr, struct malloc_type *type); void *malloc(unsigned long size, struct malloc_type *type, int flags) - __malloc_like __result_use_check __alloc_size(1); + __malloc_like __alloc_size(1); void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, int flags) __malloc_like __result_use_check __alloc_size(1) __alloc_size(2); @@ -187,7 +187,7 @@ void malloc_type_freed(struct malloc_type *type, unsig void malloc_type_list(malloc_type_list_func_t *, void *); void malloc_uninit(void *); void *realloc(void *addr, unsigned long size, struct malloc_type *type, - int flags) __result_use_check __alloc_size(2); + int flags) __alloc_size(2); void *reallocf(void *addr, unsigned long size, struct malloc_type *type, int flags) __alloc_size(2); From owner-svn-src-head@freebsd.org Mon Jan 8 15:41:50 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4677DE73372; Mon, 8 Jan 2018 15:41:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 224F380D62; Mon, 8 Jan 2018 15:41:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 754A719ED; Mon, 8 Jan 2018 15:41:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w08FfnEG052773; Mon, 8 Jan 2018 15:41:49 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w08Ffn7M052772; Mon, 8 Jan 2018 15:41:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201801081541.w08Ffn7M052772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 8 Jan 2018 15:41:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327698 - head/sys/geom/mirror X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/geom/mirror X-SVN-Commit-Revision: 327698 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 15:41:50 -0000 Author: markj Date: Mon Jan 8 15:41:49 2018 New Revision: 327698 URL: https://svnweb.freebsd.org/changeset/base/327698 Log: Release the queue lock before restarting the worker loop. Reported and tested by: pho MFC after: 3 days Sponsored by: Dell EMC Isilon Modified: head/sys/geom/mirror/g_mirror.c Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Mon Jan 8 15:41:48 2018 (r327697) +++ head/sys/geom/mirror/g_mirror.c Mon Jan 8 15:41:49 2018 (r327698) @@ -1964,8 +1964,10 @@ g_mirror_worker(void *arg) continue; } } - if (g_mirror_event_first(sc) != NULL) + if (g_mirror_event_first(sc) != NULL) { + mtx_unlock(&sc->sc_queue_mtx); continue; + } sx_xunlock(&sc->sc_lock); MSLEEP(sc, &sc->sc_queue_mtx, PRIBIO | PDROP, "m:w1", timeout * hz); From owner-svn-src-head@freebsd.org Mon Jan 8 15:54:31 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A986E73DF1; Mon, 8 Jan 2018 15:54:31 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D732481906; Mon, 8 Jan 2018 15:54:30 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 257B41BF9; Mon, 8 Jan 2018 15:54:30 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w08FsUwN058394; Mon, 8 Jan 2018 15:54:30 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w08FsUvX058393; Mon, 8 Jan 2018 15:54:30 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801081554.w08FsUvX058393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 8 Jan 2018 15:54:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327699 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 327699 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 15:54:31 -0000 Author: pfg Date: Mon Jan 8 15:54:29 2018 New Revision: 327699 URL: https://svnweb.freebsd.org/changeset/base/327699 Log: Revert r327697: malloc(9): drop the __result_use_check attribute for the kernel allocator. My bad: __result_use_check just checks the for the general and we always want to make sure allocated memory is used, not only checked for nullness. Add it to reallocf since that was missing. Modified: head/sys/sys/malloc.h Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Mon Jan 8 15:41:49 2018 (r327698) +++ head/sys/sys/malloc.h Mon Jan 8 15:54:29 2018 (r327699) @@ -176,7 +176,7 @@ void *contigmalloc(unsigned long size, struct malloc_t __alloc_size(1) __alloc_align(6); void free(void *addr, struct malloc_type *type); void *malloc(unsigned long size, struct malloc_type *type, int flags) - __malloc_like __alloc_size(1); + __malloc_like __result_use_check __alloc_size(1); void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, int flags) __malloc_like __result_use_check __alloc_size(1) __alloc_size(2); @@ -187,9 +187,9 @@ void malloc_type_freed(struct malloc_type *type, unsig void malloc_type_list(malloc_type_list_func_t *, void *); void malloc_uninit(void *); void *realloc(void *addr, unsigned long size, struct malloc_type *type, - int flags) __alloc_size(2); + int flags) __result_use_check __alloc_size(2); void *reallocf(void *addr, unsigned long size, struct malloc_type *type, - int flags) __alloc_size(2); + int flags) __result_use_check __alloc_size(2); struct malloc_type *malloc_desc2type(const char *desc); #endif /* _KERNEL */ From owner-svn-src-head@freebsd.org Mon Jan 8 15:56:42 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5DA7CE73FB7; Mon, 8 Jan 2018 15:56:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 390D881AC0; Mon, 8 Jan 2018 15:56:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6DE821BFA; Mon, 8 Jan 2018 15:56:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w08Fufe7058539; Mon, 8 Jan 2018 15:56:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w08FufTl058537; Mon, 8 Jan 2018 15:56:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201801081556.w08FufTl058537@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 8 Jan 2018 15:56:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327700 - head/sys/geom/mirror X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/geom/mirror X-SVN-Commit-Revision: 327700 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 15:56:42 -0000 Author: markj Date: Mon Jan 8 15:56:40 2018 New Revision: 327700 URL: https://svnweb.freebsd.org/changeset/base/327700 Log: Sort and remove unneeded includes. MFC after: 1 week Sponsored by: Dell EMC Isilon Modified: head/sys/geom/mirror/g_mirror.c head/sys/geom/mirror/g_mirror_ctl.c Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Mon Jan 8 15:54:29 2018 (r327699) +++ head/sys/geom/mirror/g_mirror.c Mon Jan 8 15:56:40 2018 (r327700) @@ -31,22 +31,22 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include -#include +#include #include #include +#include #include -#include +#include #include +#include +#include #include -#include -#include -#include + #include -#include -#include -#include #include FEATURE(geom_mirror, "GEOM mirroring support"); Modified: head/sys/geom/mirror/g_mirror_ctl.c ============================================================================== --- head/sys/geom/mirror/g_mirror_ctl.c Mon Jan 8 15:54:29 2018 (r327699) +++ head/sys/geom/mirror/g_mirror_ctl.c Mon Jan 8 15:56:40 2018 (r327700) @@ -31,24 +31,17 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include -#include #include #include -#include -#include -#include -#include #include -#include -#include -#include +#include +#include + #include #include -#include -#include #include - static struct g_mirror_softc * g_mirror_find_device(struct g_class *mp, const char *name) From owner-svn-src-head@freebsd.org Mon Jan 8 15:58:22 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D88BE7410C for ; Mon, 8 Jan 2018 15:58:22 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic312-35.consmr.mail.ne1.yahoo.com (sonic312-35.consmr.mail.ne1.yahoo.com [66.163.191.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D6DC781C59 for ; Mon, 8 Jan 2018 15:58:21 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1515427100; bh=yAzStCyWs8ONtL+8q4Nxb5AoFkj+V+evVoU8JrYSGVg=; h=Subject:From:To:References:Date:In-Reply-To:From:Subject; b=dmRX50hmw9xdaTe75Xu4xZafRYW6WvXZ0S38tg/U1oL1unOmhzIDQrR23xEPK24AVD/AiLYRlMrUHQHYtgCzGcRTy6TlRq3cNVenim6dnZtjgzfTrx6HSLAU0hnK+W+nwp+ntADCvKSO5P4EE5bkYDoYOXTvcQgIB7FFPiJ+OhoJ3Df6O1aQPQUeMpFyEmXHNQCrzvNMxak+3nhtqjtrj+stuUQFV7Xe6hENtFwo+TB/Mtw4BDJLO+kEAYLjgcWQ8rNa4J2UjZPwc3uwdLnUoBZhDw9jidzg/YnazxhVdykrcKWG3WOfvTItuQbCA6YzktiemlUx5BVcha7Lp6DW9A== X-YMail-OSG: KYFlW.YVM1mPY6R7By2zeBKxgkMBCj6pcYUIX541P0aXisX7lPJtQSVHjPl_2pu aNh6pMmI4s7ofI2SjR2gD4aoirJZGzHP9Pgy9ktESJXrFdeuaSqPHk5pn1eiB_Ro55aMhPQdVy7k XrdKSBtz0TeZndZS58dhxA029FjULHUDgXCTjRvtE2p6.F87e4dJK58nmE5wGQMVlXiPRWsyUB.4 UL_Y9TRtuVrE10fXXKLtXPaaBCERwDbz94WmQ9X0VwtBuQlWLOpq35RTcVKcgPNojMq58aRns_34 lI8y2eBT2q8Krk_B7g_rC3A36aOInTXQMHy0h9WxnrjAX2ESCp6uJzctEbMXKKPCdss_tcDsyG4z 5CUPqk77TfsTBcCGp8zllgKNHTnH1nFle3xOMghmjCQQ3UjShfZH97NeY7tdjImS_3Kx3xXXMWTD D3NJWkpq9P9a53QO9vfiTbKHyDrB98TiV0hoif3MKvGj7RcqKJsaW9sL5nJy_1N6BFqMBLbur Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.ne1.yahoo.com with HTTP; Mon, 8 Jan 2018 15:58:20 +0000 Received: from smtpgate103.mail.ne1.yahoo.com (EHLO [192.168.0.6]) ([216.155.193.162]) by smtp401.mail.ne1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID ae7b781f65a9251b0c615b8e61e02acf; Mon, 08 Jan 2018 15:58:16 +0000 (UTC) Subject: Re: svn commit: r327697 - head/sys/sys From: Pedro Giffuni To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801081541.w08Ffmm0052729@repo.freebsd.org> Message-ID: Date: Mon, 8 Jan 2018 10:58:16 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <201801081541.w08Ffmm0052729@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 15:58:22 -0000 On 01/08/18 10:41, Pedro F. Giffuni wrote: > Author: pfg > Date: Mon Jan 8 15:41:48 2018 > New Revision: 327697 > URL: https://svnweb.freebsd.org/changeset/base/327697 > > Log: > malloc(9): drop the __result_use_check attribute for the kernel allocator. > > The __result_use_check attribute was brought to the kernel malloc in > r281203 for consistency with the userland malloc. > > For the case of the M_WAITOK flag, the kernel malloc(), realloc(), and > reallocf() cannot return NULL so in that case the __result_use_check > attribute makes no sense. Bah ... I misinterpreted the attribute (hate it when that happens) reverted in r327697, sorry for the code churn. Pedro. From owner-svn-src-head@freebsd.org Mon Jan 8 16:09:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E46D8E74A3C; Mon, 8 Jan 2018 16:09:11 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A005F824ED; Mon, 8 Jan 2018 16:09:11 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w08G99DU022352; Mon, 8 Jan 2018 08:09:09 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w08G9941022351; Mon, 8 Jan 2018 08:09:09 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201801081609.w08G9941022351@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r327699 - head/sys/sys In-Reply-To: <201801081554.w08FsUvX058393@repo.freebsd.org> To: "Pedro F. Giffuni" Date: Mon, 8 Jan 2018 08:09:08 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 16:09:12 -0000 > Author: pfg > Date: Mon Jan 8 15:54:29 2018 > New Revision: 327699 > URL: https://svnweb.freebsd.org/changeset/base/327699 > > Log: > Revert r327697: > malloc(9): drop the __result_use_check attribute for the kernel allocator. > > My bad: __result_use_check just checks the for the general and we always > want to make sure allocated memory is used, not only checked for nullness. > > Add it to reallocf since that was missing. Please try not to combine a revert with an add, it makes it messy to try and figure out things in the future when only the svn log is being used to analyze stuff as digging in mail archives becomes painful. Revert, then commit the add standalone, is the better sequence in this type of situation. > > Modified: > head/sys/sys/malloc.h > > Modified: head/sys/sys/malloc.h > ============================================================================== > --- head/sys/sys/malloc.h Mon Jan 8 15:41:49 2018 (r327698) > +++ head/sys/sys/malloc.h Mon Jan 8 15:54:29 2018 (r327699) > @@ -176,7 +176,7 @@ void *contigmalloc(unsigned long size, struct malloc_t > __alloc_size(1) __alloc_align(6); > void free(void *addr, struct malloc_type *type); > void *malloc(unsigned long size, struct malloc_type *type, int flags) > - __malloc_like __alloc_size(1); > + __malloc_like __result_use_check __alloc_size(1); > void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, > int flags) __malloc_like __result_use_check > __alloc_size(1) __alloc_size(2); > @@ -187,9 +187,9 @@ void malloc_type_freed(struct malloc_type *type, unsig > void malloc_type_list(malloc_type_list_func_t *, void *); > void malloc_uninit(void *); > void *realloc(void *addr, unsigned long size, struct malloc_type *type, > - int flags) __alloc_size(2); > + int flags) __result_use_check __alloc_size(2); > void *reallocf(void *addr, unsigned long size, struct malloc_type *type, > - int flags) __alloc_size(2); > + int flags) __result_use_check __alloc_size(2); > > struct malloc_type *malloc_desc2type(const char *desc); > #endif /* _KERNEL */ > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Mon Jan 8 16:13:48 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F4133E74FED for ; Mon, 8 Jan 2018 16:13:47 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22d.google.com (mail-io0-x22d.google.com [IPv6:2607:f8b0:4001:c06::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B232A82D1D for ; Mon, 8 Jan 2018 16:13:47 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22d.google.com with SMTP id x67so14712220ioi.9 for ; Mon, 08 Jan 2018 08:13:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=U2dO0pIfCdQu/wrL3eiThJHNpORugumxOOcai+t91Ao=; b=L86bI7P+kyp0LqV6YMiQ+YTEv8a4rDczkiL0jqGKT7983zkAbIXeflpwG/CLqK+TEN BzRuTNa2+KuaF8o5jjL9buJxYGB8udKyyqziVOfOB7oX2PS17RsCo3XCtRG1iS1XZfSE eGFotCJlNSoKvfsXM6t60+p9xAnDOWxA5kJrN3/2sjhBeAOA3vTc5tXbCCjvWpI1wpwL 4UaeJEhqVQ6Zdc10qtmErOKwzTDS1AKGEtRhZFLbr3Lw6+gm3jW4Lz6N5F7IGJdYFY/l oqpwEANhtwoSMoThcbcvqb6vn732rDe9AXR9MCOO5Ri1SKcCzng39pl056psCr1jtIzm Inqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=U2dO0pIfCdQu/wrL3eiThJHNpORugumxOOcai+t91Ao=; b=RNuK2uF2Q+TgMO2yLgAYiVwY2MEXoNoMRkT6S7omtd5HCqzcZy3293h/OmPq4eL0f8 QO0SI7z1GkKPSKm+VPyMKy4clQ9KEXOcZUqetfhAHKy8F66C/Z31zBS+jt4XqWT2SKE3 4F7qp0TCPrcttYee+52LjgC4/xx2jx2JDi9KOfqMJVkFa3OwiECcXzTd32Q3+No432CS Wb4J0ex02ZjnGesyTwJkwLAniWc4mOA9DtmQSbqs/GIhe2CJi0RchBu3WiBLuQPTUMPh 6SVXBdspz1l7fxce/G4fuQ4IziBHR+ZMPRe2K41WegM2BmtjceAgJLmC5ywC3iXsqIpW 64Ng== X-Gm-Message-State: AKGB3mL9o0EEhKzuwho9NSgqK3kezAyreED99f08NKwEsjdEyNheXzz/ O8Y6jNwqUFKPhv9iMOSPJR2wCLzQRaLAU0yqtgQsPQ== X-Google-Smtp-Source: ACJfBos8I1+y5+c194BRf/4iuCmIysd4xsSPPVcrHvm4+Y6bEMTNquMhBzJbmlGemSIr7m2JAvabxw0JbWVL45FV9tI= X-Received: by 10.36.3.144 with SMTP id e138mr12011934ite.97.1515428027019; Mon, 08 Jan 2018 08:13:47 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.160.217 with HTTP; Mon, 8 Jan 2018 08:13:46 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:a84a:1e5c:a3af:9943] Received: by 10.79.160.217 with HTTP; Mon, 8 Jan 2018 08:13:46 -0800 (PST) In-Reply-To: <0a6ad324-46f2-9270-5abd-dbc3e734cc8b@FreeBSD.org> References: <201801072238.w07McjLP099234@repo.freebsd.org> <8D8CA434-2A87-44D9-AC27-5166802FBBC2@fubar.geek.nz> <0a6ad324-46f2-9270-5abd-dbc3e734cc8b@FreeBSD.org> From: Warner Losh Date: Mon, 8 Jan 2018 09:13:46 -0700 X-Google-Sender-Auth: 2GrbBeM6NyxWZTmwilXOd65Ynnw Message-ID: Subject: Re: svn commit: r327684 - in head/sys/compat: cloudabi32 cloudabi64 To: Pedro Giffuni Cc: Ed Schouten , Andrew Turner , Ed Schouten , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 16:13:48 -0000 On Jan 8, 2018 8:37 AM, "Pedro Giffuni" wrote: On 01/08/18 10:13, Ed Schouten wrote: > Hi Andrew, > > 2018-01-08 8:37 GMT+01:00 Andrew Turner : > >> Won=E2=80=99t this lead to a NULL pointer dereference on overflow? mallo= carray >> can return NULL even with M_WAITOK. >> > Yes, it will, but an overflow shouldn't happen in the first place. > ri_data_len is compared with UIO_MAXIOV a few lines above. Even if an > overflow would happen, this would cause a kernel panic due to a NULL > pointer dereference later on, which is likely easier to debug than > some piece of code that overruns a buffer. > > In this case, mallocarray() is preferred, because it makes it more > obvious that we're allocating a buffer that is accessed as an array, > as opposed to single structure. > > OK... The behavior of mallocarray() somewhat inconsistent with malloc(9), realloc(9) and reallocf(9) but this is clearly documented., so we just assume the developer knows what he/she is doing :). This is one reason it didn't go in before... the error semantics suck... we re are a poor match for existing code. Warner From owner-svn-src-head@freebsd.org Mon Jan 8 16:18:36 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB813E75501 for ; Mon, 8 Jan 2018 16:18:36 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9BA3883135 for ; Mon, 8 Jan 2018 16:18:36 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 84a4b9c7-f48f-11e7-8486-0934409070aa X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id 84a4b9c7-f48f-11e7-8486-0934409070aa; Mon, 08 Jan 2018 16:18:10 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w08GISK5002547; Mon, 8 Jan 2018 09:18:28 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1515428308.44630.2.camel@freebsd.org> Subject: Re: svn commit: r327684 - in head/sys/compat: cloudabi32 cloudabi64 From: Ian Lepore To: Warner Losh , Pedro Giffuni Cc: Ed Schouten , Andrew Turner , Ed Schouten , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Mon, 08 Jan 2018 09:18:28 -0700 In-Reply-To: References: <201801072238.w07McjLP099234@repo.freebsd.org> <8D8CA434-2A87-44D9-AC27-5166802FBBC2@fubar.geek.nz> <0a6ad324-46f2-9270-5abd-dbc3e734cc8b@FreeBSD.org> Content-Type: text/plain; charset="iso-8859-7" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 16:18:36 -0000 On Mon, 2018-01-08 at 09:13 -0700, Warner Losh wrote: > On Jan 8, 2018 8:37 AM, "Pedro Giffuni" wrote: > > > On 01/08/18 10:13, Ed Schouten wrote: > > > > > Hi Andrew, > > > > 2018-01-08 8:37 GMT+01:00 Andrew Turner : > > > > > > > > Won¢t this lead to a NULL pointer dereference on overflow? mallocarray > > > can return NULL even with M_WAITOK. > > > > > Yes, it will, but an overflow shouldn't happen in the first place. > > ri_data_len is compared with UIO_MAXIOV a few lines above. Even if an > > overflow would happen, this would cause a kernel panic due to a NULL > > pointer dereference later on, which is likely easier to debug than > > some piece of code that overruns a buffer. > > > > In this case, mallocarray() is preferred, because it makes it more > > obvious that we're allocating a buffer that is accessed as an array, > > as opposed to single structure. > > > > OK... > The behavior of mallocarray() somewhat inconsistent with malloc(9), > realloc(9) and reallocf(9) but this is clearly documented., so we just > assume the developer knows what he/she is doing :). > > > This is one reason it didn't go in before... the error semantics suck... we > re are a poor match for existing code. > > Warner Yeah, having a bunch of functions with malloc in the name, all taking the same M_WAITOK flag, but that flag has different implications for calling code in regards to just one of the malloc functions... that's just a recipe for creating bugs.  It makes this whole function a bad idea. -- Ian From owner-svn-src-head@freebsd.org Mon Jan 8 16:29:43 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA269E75FDE; Mon, 8 Jan 2018 16:29:43 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk0-x233.google.com (mail-qk0-x233.google.com [IPv6:2607:f8b0:400d:c09::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9CE0683C06; Mon, 8 Jan 2018 16:29:43 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk0-x233.google.com with SMTP id w184so6657538qka.2; Mon, 08 Jan 2018 08:29:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=Im9tOxLlSvn4x7toFrNKTqrwnJWBNtBzr8+nJnv26Ug=; b=NRdP5O7fMCKczxgMGYbEo94auOqhWq97hbwf9FoEsqiXCJbZh/pKPsOEGVHDRR8mag I42KSlw6Tdv9xKDC+kXYKXJ6iFtQDwUKHsvONZWLbWMu/XqWOzQ5Mn9r6XbSISqLdQNR oKf7wfJ5znbmkP5yRlBsbM9uSIhdp/rroTCankcT3FZagXzATg05oLxEOHfWY+cJC2ZL 1FYeDdsECV4jQlv9odUdQcnWq7URXbMqaS9QGcGuSTklWkBK+FsS2RZ/sj7hH8g4Ebke pG0HfhHeQslK9tOCD6/5ZJWkdgRBfkcUBoV5AumqV4BM5sECeYCN4pbA76knAtnZ/SB+ APZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=Im9tOxLlSvn4x7toFrNKTqrwnJWBNtBzr8+nJnv26Ug=; b=ODHB3hc8oqDlRhyc1/sg53xIyiKYayXTTS+NBfmnq5z/t3SOgV9zvWOypiLpabIjJr CadESgf7kqDAujtAzfgwHOo+7hzTMDfymdI8/1HzKnLxLWRF810suNBQQDYQsLFw+GjS FUUZ2m0tVC6Q59QL/6stxGjW2vnNwZErojx36TMOuTmTZm48zF3EGyb+deyj63xS53vI E0ShYapwyrj3OB2wtrGmCqeWDlwlpKQ7qAvM7Zc3TKRgZkNAcPCPkL5ZB5rXqNyndme6 KxaDvCfijkWbSEzVPAMd9SFIEdAP5zgxhGuGt6cWyuL+Y1zMorOjG9c3GHTKEunmHKFI Ur7A== X-Gm-Message-State: AKwxytdUCOe+ph+92mycNeC4sKTzOPcN7QRGCOAT6vCdqDBFCg3FXf0n q7039yPC2niPrhfwruauamN4OOSd X-Google-Smtp-Source: ACJfBos+tSxR5x9fb7SUN8NXBIVAOgwBe/3uH6iF2UmdNo15o7Sy3ukER2R+aamjNIZu9qS2upNacA== X-Received: by 10.55.143.193 with SMTP id r184mr16078526qkd.193.1515428982259; Mon, 08 Jan 2018 08:29:42 -0800 (PST) Received: from raichu (toroon0560w-lp140-02-70-49-169-112.dsl.bell.ca. [70.49.169.112]) by smtp.gmail.com with ESMTPSA id m44sm7797504qtc.9.2018.01.08.08.29.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jan 2018 08:29:41 -0800 (PST) Sender: Mark Johnston Date: Mon, 8 Jan 2018 11:29:38 -0500 From: Mark Johnston To: Ian Lepore Cc: Warner Losh , Pedro Giffuni , Ed Schouten , Andrew Turner , Ed Schouten , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r327684 - in head/sys/compat: cloudabi32 cloudabi64 Message-ID: <20180108162938.GD2412@raichu> References: <201801072238.w07McjLP099234@repo.freebsd.org> <8D8CA434-2A87-44D9-AC27-5166802FBBC2@fubar.geek.nz> <0a6ad324-46f2-9270-5abd-dbc3e734cc8b@FreeBSD.org> <1515428308.44630.2.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1515428308.44630.2.camel@freebsd.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 16:29:44 -0000 On Mon, Jan 08, 2018 at 09:18:28AM -0700, Ian Lepore wrote: > On Mon, 2018-01-08 at 09:13 -0700, Warner Losh wrote: > > On Jan 8, 2018 8:37 AM, "Pedro Giffuni" wrote: > > On 01/08/18 10:13, Ed Schouten wrote: > > > > > > > > Hi Andrew, > > > > > > 2018-01-08 8:37 GMT+01:00 Andrew Turner : > > > > > > > > > > > Won’t this lead to a NULL pointer dereference on overflow? mallocarray > > > > can return NULL even with M_WAITOK. > > > > > > > Yes, it will, but an overflow shouldn't happen in the first place. > > > ri_data_len is compared with UIO_MAXIOV a few lines above. Even if an > > > overflow would happen, this would cause a kernel panic due to a NULL > > > pointer dereference later on, which is likely easier to debug than > > > some piece of code that overruns a buffer. > > > > > > In this case, mallocarray() is preferred, because it makes it more > > > obvious that we're allocating a buffer that is accessed as an array, > > > as opposed to single structure. > > > > > > OK... > > The behavior of mallocarray() somewhat inconsistent with malloc(9), > > realloc(9) and reallocf(9) but this is clearly documented., so we just > > assume the developer knows what he/she is doing :). > > > > > > This is one reason it didn't go in before... the error semantics suck... we > > re are a poor match for existing code. > > > > Warner > > Yeah, having a bunch of functions with malloc in the name, all taking > the same M_WAITOK flag, but that flag has different implications for > calling code in regards to just one of the malloc functions... contigmalloc(M_WAITOK) isn't guaranteed to succeed either. In that case, M_WAITOK just means "try harder to defragment physical memory in the request space before giving up." > that's just a recipe for creating bugs.  It makes this whole function a bad > idea. A NULL return value from mallocarray() indicates a bug in the caller. I don't see why it isn't preferable to crash quickly and loudly in that case. From owner-svn-src-head@freebsd.org Mon Jan 8 17:02:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC978E77CF1 for ; Mon, 8 Jan 2018 17:02:46 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22c.google.com (mail-io0-x22c.google.com [IPv6:2607:f8b0:4001:c06::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC5A32A0C for ; Mon, 8 Jan 2018 17:02:46 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22c.google.com with SMTP id e20so15057356iof.12 for ; Mon, 08 Jan 2018 09:02:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=unTpTTy5P5yekblp+kxMeO/ogtZMPUK2fYnEk0u73O0=; b=XCecOU/uNDpaoqlC80WBaaJWOwROagFQdlQwNbJ3k199hnna+jKuknyX2ddmkHiIIL rk/b1EYpSA8xhZqcLJGO92tAqz8t7bAt9FNcLY6Om9q9yCfTStjvUVQYcI0PuFq3TOrl KtP7hS1DfRIQn7qdPSz9eMFkAjdGSLrDqP5bivbibrTO4G0lRXi11fW85oEBcRRp4JCy VxpRcD1Y5tRyxLrDvpQYdwCXVDYQoDofNxEnhcDq1D+H4VcRl5XNzGftdlIIu4axoDfZ JzSDqdQlVma+Y6H/xuio60MA3jwAD6qv+JQwr8XkftleWudWnbIrDVIkBSa9nRzTA9oX QAyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=unTpTTy5P5yekblp+kxMeO/ogtZMPUK2fYnEk0u73O0=; b=SYJFApxZyl+ioFtu00kIfmysIwTR5iRii8H5E60HPX72hoyNoz8kj9wJTwx05n3kjO /rJlbVHU9VVAn4ZtRfF9u9x8MO8PbsPSFTUNHwHqkCgjgJo/bMPwxtMD8NAl25TRLXe+ rVBZHSyLjtKiZIyG9jCLB5wWd/kHs4wDFcBMlzZW2MN/rFyqcuEQI6rv32SLzuIHGk9V +/TYOGDazh9uGvZg88FCcDOmp+GvyKfrKAXu7VtvEdAo5p5NUHP3qxxhtaa7MCoy60ax L+bRq80qe6VIazjIQ7G7slTEGrSn6cG5SWV33h9JqJlR7Dt2XHN754xbaLbFQTv3X2FG YThQ== X-Gm-Message-State: AKwxytcXB7VN3I8lMq10SpjjhaD07kUyUsryLNwWdJgOnUxjJf6rVa/P vQQ+zJ5M3R64YVwsTPb0Q06AxDFKrwcxoZSmRZk20A== X-Google-Smtp-Source: ACJfBot5MLf47CGTojacU1hu8Zxwg3+gS8wBCrYqgTMujYBR8G0WRHXTK6o8VfSxKTZtihBNbnZ3Y4loIv1p23MJmz4= X-Received: by 10.36.91.210 with SMTP id g201mr8912782itb.50.1515430965869; Mon, 08 Jan 2018 09:02:45 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.160.217 with HTTP; Mon, 8 Jan 2018 09:02:45 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20180108162938.GD2412@raichu> References: <201801072238.w07McjLP099234@repo.freebsd.org> <8D8CA434-2A87-44D9-AC27-5166802FBBC2@fubar.geek.nz> <0a6ad324-46f2-9270-5abd-dbc3e734cc8b@FreeBSD.org> <1515428308.44630.2.camel@freebsd.org> <20180108162938.GD2412@raichu> From: Warner Losh Date: Mon, 8 Jan 2018 10:02:45 -0700 X-Google-Sender-Auth: H2NfmkKECbc5gxtf5L3fpojOZjk Message-ID: Subject: Re: svn commit: r327684 - in head/sys/compat: cloudabi32 cloudabi64 To: Mark Johnston Cc: Ian Lepore , Pedro Giffuni , Ed Schouten , Andrew Turner , Ed Schouten , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 17:02:47 -0000 On Mon, Jan 8, 2018 at 9:29 AM, Mark Johnston wrote: > On Mon, Jan 08, 2018 at 09:18:28AM -0700, Ian Lepore wrote: > > On Mon, 2018-01-08 at 09:13 -0700, Warner Losh wrote: > > > On Jan 8, 2018 8:37 AM, "Pedro Giffuni" wrote: > > > On 01/08/18 10:13, Ed Schouten wrote: > > > > > > > > > > > Hi Andrew, > > > > > > > > 2018-01-08 8:37 GMT+01:00 Andrew Turner : > > > > > > > > > > > > > > Won=E2=80=99t this lead to a NULL pointer dereference on overflow= ? > mallocarray > > > > > can return NULL even with M_WAITOK. > > > > > > > > > Yes, it will, but an overflow shouldn't happen in the first place. > > > > ri_data_len is compared with UIO_MAXIOV a few lines above. Even if = an > > > > overflow would happen, this would cause a kernel panic due to a NUL= L > > > > pointer dereference later on, which is likely easier to debug than > > > > some piece of code that overruns a buffer. > > > > > > > > In this case, mallocarray() is preferred, because it makes it more > > > > obvious that we're allocating a buffer that is accessed as an array= , > > > > as opposed to single structure. > > > > > > > > OK... > > > The behavior of mallocarray() somewhat inconsistent with malloc(9), > > > realloc(9) and reallocf(9) but this is clearly documented., so we jus= t > > > assume the developer knows what he/she is doing :). > > > > > > > > > This is one reason it didn't go in before... the error semantics > suck... we > > > re are a poor match for existing code. > > > > > > Warner > > > > Yeah, having a bunch of functions with malloc in the name, all taking > > the same M_WAITOK flag, but that flag has different implications for > > calling code in regards to just one of the malloc functions... > > contigmalloc(M_WAITOK) isn't guaranteed to succeed either. In that case, > M_WAITOK just means "try harder to defragment physical memory in the > request space before giving up." > > > that's just a recipe for creating bugs. It makes this whole function a > bad > > idea. > > A NULL return value from mallocarray() indicates a bug in the caller. I > don't see why it isn't preferable to crash quickly and loudly in that > case. > When this came up before, people wanted a check_mallocarray(a, b) so they could centralize all the integer overflow knowledge in one place... Seems like we're creating ABIs that are more error prone than the problem we're trying to catch... Warner From owner-svn-src-head@freebsd.org Mon Jan 8 17:28:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 16929E794AC; Mon, 8 Jan 2018 17:28:53 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DFB146367D; Mon, 8 Jan 2018 17:28:52 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id B39975A9F15; Mon, 8 Jan 2018 17:28:50 +0000 (UTC) Date: Mon, 8 Jan 2018 17:28:50 +0000 From: Brooks Davis To: Ed Schouten Cc: Andrew Turner , Ed Schouten , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r327684 - in head/sys/compat: cloudabi32 cloudabi64 Message-ID: <20180108172850.GI95035@spindle.one-eyed-alien.net> References: <201801072238.w07McjLP099234@repo.freebsd.org> <8D8CA434-2A87-44D9-AC27-5166802FBBC2@fubar.geek.nz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SUk9VBj82R8Xhb8H" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 17:28:53 -0000 --SUk9VBj82R8Xhb8H Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 08, 2018 at 04:13:42PM +0100, Ed Schouten wrote: > Hi Andrew, >=20 > 2018-01-08 8:37 GMT+01:00 Andrew Turner : > > Won???t this lead to a NULL pointer dereference on overflow? mallocarra= y can return NULL even with M_WAITOK. >=20 > Yes, it will, but an overflow shouldn't happen in the first place. > ri_data_len is compared with UIO_MAXIOV a few lines above. Even if an > overflow would happen, this would cause a kernel panic due to a NULL > pointer dereference later on, which is likely easier to debug than > some piece of code that overruns a buffer. Given that the overflow is due to a bug, there's an argument we should panic rather than returning NULL even in the M_NOWAIT case so we produce a useful message in exactly the right place. -- Brooks --SUk9VBj82R8Xhb8H Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJaU6pSAAoJEKzQXbSebgfAoBkH/1qw/k1rmZfSDF2NG9MK26VK iYSOYHlCQsy/H50X5a1QIeXWvWJvHPrctqS40i5l5R32lo9I9NEolAmEy2/TI2CW 9VlMG7zqQ9jPTtK0wbKg/rZtcxX4pSTRLRFnFNm0HDUzqqXCHUoJ/+7SRhYvnRkI ZXbgKm9XCKKyBAVazu1Cu1UmmwhUS30+xx6zxX1KVjFB8pgsk6ildJGEf7xp2sR8 VRmAyCKy3KW+1iqx4/BgSd1zuJIPbXU74fCSp/ueFKOkSPay6XktmgKzraeGzYh+ /hZXqIf444h/+QO1m+GYW862T8/fNom017D9xnl23F6yA5yLRaLyabLPMSdoAtY= =KNFw -----END PGP SIGNATURE----- --SUk9VBj82R8Xhb8H-- From owner-svn-src-head@freebsd.org Mon Jan 8 18:08:09 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1D8FE7BBF1; Mon, 8 Jan 2018 18:08:09 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-x232.google.com (mail-io0-x232.google.com [IPv6:2607:f8b0:4001:c06::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AB1076A48F; Mon, 8 Jan 2018 18:08:09 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-x232.google.com with SMTP id q188so15567700iod.1; Mon, 08 Jan 2018 10:08:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=vzmIsZVqzoC8kFyncDcqshvN9zlsRaDR3B2vkRk4KTU=; b=mBsMP1PPPm1YVByBbmFBN990pqVKFMSP7+RLr15gGJPw/nNgEsBbE4c5UmaNDohkWs 5FTm/vXsmFj6Id+CbUmKvw/8NUih+lh+3R55PUNnZDjCvf+aJ/ry2VTnX3XYrMRlquLJ DxTVnVRnepD6vLrXoZAZbv2re9URh6cyobUATh233QN+HySLccpTIM9gX8xX18ZBwnSC KYPxYSZ33/oAbii1EJXTu9OK6R/kVnVJF3N3E9A7eHFGDPvyATWezrPk+ATxDDcDSbUv M5l/GcCYXlLsxW/hwnpwQRv5aG+GdWWrG92uLyLRFkbK4Oew8chXHx+SfuRuzF82IePt 2ntQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=vzmIsZVqzoC8kFyncDcqshvN9zlsRaDR3B2vkRk4KTU=; b=YXni+AX6ObE5uUHlhohw0IA6nIrXuSTehGaNBn62tP+q4xYzIENLjXOCydhICRZDK6 VCwvZhoNKmTO5oYo3qroW1CTN0w3PGH28by8dyfk3ZQNID03ZO23aG4LAHwokqPVe/by 38xSbapzhfcH2iK0l1jf51XvATHHTxoSobPRU1MTr89n6m9RpThpYQiBAcYHTvuoTsGY QNo5xqNjrSRd0lZkthKIazKuG0YGFRBagS5IXccwiHX1XdDmmUhCKzGHt2fVYFt/gD1y 83FnFlrc+CQZU3pljUUUTaznv00B7KPswnq0Wd7dvt7+0bWVn64oFHKC83/xbr9M48hq 0n/w== X-Gm-Message-State: AKGB3mK7mmKrj7sjxNzF8xUMMK1tCpb7jJyhKt2ONIWO7qFQblQqxnJe YvR6e1c51Qc3KdwnKCLx/6a81ncVy9zSQjpH2em9ERVW X-Google-Smtp-Source: ACJfBouIYKdvxerTQ5qC6SjOyrfgrnqjZKy681McOKVn4XjZoMEa9DiMp89Cz8/as2mzLGQyv+whV6osL8W5bby540Q= X-Received: by 10.36.47.207 with SMTP id j198mr12381787itj.119.1515434888913; Mon, 08 Jan 2018 10:08:08 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.15.193 with HTTP; Mon, 8 Jan 2018 10:08:08 -0800 (PST) In-Reply-To: <201801081541.w08Ffmm0052729@repo.freebsd.org> References: <201801081541.w08Ffmm0052729@repo.freebsd.org> From: Conrad Meyer Date: Mon, 8 Jan 2018 10:08:08 -0800 Message-ID: Subject: Re: svn commit: r327697 - head/sys/sys To: "Pedro F. Giffuni" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 18:08:10 -0000 Hi, Response inline. On Mon, Jan 8, 2018 at 7:41 AM, Pedro F. Giffuni wrote: > Author: pfg > Date: Mon Jan 8 15:41:48 2018 > New Revision: 327697 > URL: https://svnweb.freebsd.org/changeset/base/327697 > > Log: > malloc(9): drop the __result_use_check attribute for the kernel allocator. > > The __result_use_check attribute was brought to the kernel malloc in > r281203 for consistency with the userland malloc. > > For the case of the M_WAITOK flag, the kernel malloc(), realloc(), and > reallocf() cannot return NULL so in that case the __result_use_check > attribute makes no sense. > > We don't have any way of conditionalizing such attributes so just drop it. Could we conditionalize the attribute using two different names and a macro that inspected the (typically) constant flags argument? Something like this: #define malloc(s, t, f) \ (__builtin_constant_p(f) && (f & M_WAITOK) != 0) ? _malloc_waitok(s, t, f) : _malloc(s, t, f) void *_malloc(...) __malloc_like __alloc_size(1); void *_malloc_waitok(...) __malloc_like __result_use_check __alloc_size(1); The two names would just be aliases, or one could invoke the other as an inline function. Best, Conrad From owner-svn-src-head@freebsd.org Mon Jan 8 18:44:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1C32E7DF4F; Mon, 8 Jan 2018 18:44:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 638F36C532; Mon, 8 Jan 2018 18:44:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B90A3C16; Mon, 8 Jan 2018 18:44:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w08IiaxV033486; Mon, 8 Jan 2018 18:44:36 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w08Iia97033485; Mon, 8 Jan 2018 18:44:36 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801081844.w08Iia97033485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 8 Jan 2018 18:44:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327703 - head/stand/mips/beri/boot2 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/stand/mips/beri/boot2 X-SVN-Commit-Revision: 327703 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 18:44:37 -0000 Author: jhb Date: Mon Jan 8 18:44:36 2018 New Revision: 327703 URL: https://svnweb.freebsd.org/changeset/base/327703 Log: Define __dmadat after #include'ing ufsread.c. The __dmadat variable is a statically allocated I/O buffer. The type is declared in the ufsread.c source file and clang warns if a variable is defined before it's type is declared. Sponsored by: DARPA / AFRL Modified: head/stand/mips/beri/boot2/boot2.c Modified: head/stand/mips/beri/boot2/boot2.c ============================================================================== --- head/stand/mips/beri/boot2/boot2.c Mon Jan 8 18:42:40 2018 (r327702) +++ head/stand/mips/beri/boot2/boot2.c Mon Jan 8 18:44:36 2018 (r327703) @@ -118,8 +118,6 @@ static const unsigned char flags[NOPT] = { static const char *const dev_nm[] = {"dram", "cfi", "sdcard"}; static const u_int dev_nm_count = nitems(dev_nm); -static struct dmadat __dmadat; - static struct dsk { unsigned type; /* BOOTINFO_DEV_TYPE_x object type. */ uintptr_t unitptr; /* Unit number or pointer to object. */ @@ -149,9 +147,10 @@ static int dskread(void *, unsigned, unsigned); static int xputc(int); static int xgetc(int); - #define UFS_SMALL_CGBASE #include "ufsread.c" + +static struct dmadat __dmadat; static inline int xfsread(ufs_ino_t inode, void *buf, size_t nbyte) From owner-svn-src-head@freebsd.org Mon Jan 8 18:46:12 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F16CE7E08A; Mon, 8 Jan 2018 18:46:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E36906C715; Mon, 8 Jan 2018 18:46:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9D263C17; Mon, 8 Jan 2018 18:46:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w08IkAV7033599; Mon, 8 Jan 2018 18:46:10 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w08IkApk033598; Mon, 8 Jan 2018 18:46:10 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801081846.w08IkApk033598@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 8 Jan 2018 18:46:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327704 - head/stand/mips/beri/loader X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/stand/mips/beri/loader X-SVN-Commit-Revision: 327704 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 18:46:12 -0000 Author: jhb Date: Mon Jan 8 18:46:10 2018 New Revision: 327704 URL: https://svnweb.freebsd.org/changeset/base/327704 Log: Fix printf missing format variables warnings. Include the failing kernel file name for errors in beri_elf64_exec(). Sponsored by: DARPA / AFRL Modified: head/stand/mips/beri/loader/exec.c Modified: head/stand/mips/beri/loader/exec.c ============================================================================== --- head/stand/mips/beri/loader/exec.c Mon Jan 8 18:44:36 2018 (r327703) +++ head/stand/mips/beri/loader/exec.c Mon Jan 8 18:46:10 2018 (r327704) @@ -80,14 +80,14 @@ beri_elf64_exec(struct preloaded_file *fp) md = file_findmetadata(fp, MODINFOMD_ELFHDR); if (md == NULL) { - printf("%s: file_findmetadata failed\n"); + printf("%s: file_findmetadata failed\n", fp->f_name); return (EFTYPE); } ehdr = (Elf_Ehdr *)md->md_data; error = md_load64(fp->f_args, &mdp); if (error) { - printf("%s: md_load64 failed\n"); + printf("%s: md_load64 failed\n", fp->f_name); return (error); } From owner-svn-src-head@freebsd.org Mon Jan 8 18:47:36 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0D90E7E262; Mon, 8 Jan 2018 18:47:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CC1446C96E; Mon, 8 Jan 2018 18:47:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 14DE83C1D; Mon, 8 Jan 2018 18:47:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w08IlZnT033685; Mon, 8 Jan 2018 18:47:35 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w08IlZ7F033684; Mon, 8 Jan 2018 18:47:35 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801081847.w08IlZ7F033684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 8 Jan 2018 18:47:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327705 - head/stand/mips/beri/common X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/stand/mips/beri/common X-SVN-Commit-Revision: 327705 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 18:47:37 -0000 Author: jhb Date: Mon Jan 8 18:47:35 2018 New Revision: 327705 URL: https://svnweb.freebsd.org/changeset/base/327705 Log: Use instead of and in boot code. In the freestanding boot compile environment, standard headers are not available. Curiously, only building with clang exposed this as compiles with external GCC still succeeded. Sponsored by: DARPA / AFRL Modified: head/stand/mips/beri/common/sdcard.c Modified: head/stand/mips/beri/common/sdcard.c ============================================================================== --- head/stand/mips/beri/common/sdcard.c Mon Jan 8 18:46:10 2018 (r327704) +++ head/stand/mips/beri/common/sdcard.c Mon Jan 8 18:47:35 2018 (r327705) @@ -33,8 +33,7 @@ #include #include -#include -#include +#include /* From owner-svn-src-head@freebsd.org Mon Jan 8 19:02:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 118E5E5922C for ; Mon, 8 Jan 2018 19:02:11 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22c.google.com (mail-it0-x22c.google.com [IPv6:2607:f8b0:4001:c0b::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CA5FA6D9D5 for ; Mon, 8 Jan 2018 19:02:10 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22c.google.com with SMTP id b5so8647321itc.3 for ; Mon, 08 Jan 2018 11:02:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=RIaf12sFUpJVrwa1KFQE11SGUvvMkEGGgvsWdlkrxqw=; b=SMdqxwXlBlksJychW225RJeHBQjmUqLRzmOKNqvexmKRljMi0qXBvAnzDn+KNTgiC+ 1hAMwY2vF9m4g0AHZAVNFhNBwFR9EXKsWd5RjgW3wVdKFml0txFOjKaV6ERn9JwoIU96 H5+ECPX5asYsn/ACy7ZkNKiVuHPBfkk0II09NeeicoHZ3V1d+c2ZHYBWz9cPUAqqkhP1 wCQsLmagjMRQDfr+unCZfP7hPFVrYSG4PWMy8zs5DiWR451XAvdUNf2iZGSUdJtTWQ8A XI9dS/wvFKI/Csu6/wXQgVZEnXEXN2PyFiCEr3yQtrxs+OqOIjUDK/18pEifYcywgKcW r07g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=RIaf12sFUpJVrwa1KFQE11SGUvvMkEGGgvsWdlkrxqw=; b=kM5Ds/pzmPEuhK/F5xQPSELsi46lNbHs4BJZdJKjhjNkom4nby6Vchln+KICCkRn7y kTqqBTkcAuaLOup7IQ/Gknp2uTyWGwcyRfHxcuEFGLavJzWQllAB9WqaKxqbJjLLIAWG HF1RjGV07toGfJe7yC/ZpKAeI7hVpXPE8ezVAY1Vjk/4SfPQ1yq66N1sadiyt5KFDJK/ LeUeV5ANUnT0z7pUgv3emWS/PsrMNdznqkP8pe2YTgpNbgeebokzxYucdEviNZusDNtz dDvmHhMq7cH9YCN4/f3VTSTMgxNws5FJfC8X+LVqbn6IwQmEtwN5dd92JhjieqgjJR8v QvDg== X-Gm-Message-State: AKGB3mJGqCV5/OAMKfJUS5IlHaMYA43t4fz8S5tZyZ7AW5mSX6jst2w9 xOAuU8ACrXAmgmV/LBkFXNEq1QOELhlfzBM/ApKTlQ== X-Google-Smtp-Source: ACJfBovjMjZdTdjyofvO5b2rBPBK6Xo7201Z18c/4/rvXjnhp5nexQpzu4zPjADphOI2hU+VqjpEJwbSf/UHmYDJPUo= X-Received: by 10.36.1.16 with SMTP id 16mr5920178itk.115.1515438130141; Mon, 08 Jan 2018 11:02:10 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.160.217 with HTTP; Mon, 8 Jan 2018 11:02:09 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <201801081847.w08IlZ7F033684@repo.freebsd.org> References: <201801081847.w08IlZ7F033684@repo.freebsd.org> From: Warner Losh Date: Mon, 8 Jan 2018 12:02:09 -0700 X-Google-Sender-Auth: G_NiX0Xu7iCpuPdpkPnQQzuty3U Message-ID: Subject: Re: svn commit: r327705 - head/stand/mips/beri/common To: John Baldwin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 19:02:11 -0000 This should have been a nop... libsa specifically creates 'safe' headers for all the standard ones. Ah, libsa creates a perfectly fine stdint.h, but not a inttypes.h... Warner On Mon, Jan 8, 2018 at 11:47 AM, John Baldwin wrote: > Author: jhb > Date: Mon Jan 8 18:47:35 2018 > New Revision: 327705 > URL: https://svnweb.freebsd.org/changeset/base/327705 > > Log: > Use instead of and in boot code. > > In the freestanding boot compile environment, standard headers are not > available. Curiously, only building with clang exposed this as compiles > with external GCC still succeeded. > > Sponsored by: DARPA / AFRL > > Modified: > head/stand/mips/beri/common/sdcard.c > > Modified: head/stand/mips/beri/common/sdcard.c > ============================================================ > ================== > --- head/stand/mips/beri/common/sdcard.c Mon Jan 8 18:46:10 2018 > (r327704) > +++ head/stand/mips/beri/common/sdcard.c Mon Jan 8 18:47:35 2018 > (r327705) > @@ -33,8 +33,7 @@ > #include > #include > > -#include > -#include > +#include > > > /* > > From owner-svn-src-head@freebsd.org Mon Jan 8 20:08:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6B75E5E12A for ; Mon, 8 Jan 2018 20:08:15 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic302-36.consmr.mail.gq1.yahoo.com (sonic302-36.consmr.mail.gq1.yahoo.com [98.137.68.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C151C7136C for ; Mon, 8 Jan 2018 20:08:15 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1515442088; bh=mUMIJf2mzkP+cCeDslERQ+/yADweFxTy/aJRum1lRbM=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=Tk4mpd8WhyhH4HiOp9YpAQk51OeoVyZmIGg5iWcBaa1fC9O2pMlRkvYmtWEw1Y871hSUmJwgbqYHfEy+VKd219xkZWnskDX9xHhTWFXjfm+yCBNDqeQTg8J4yVe0G/pQ769lQSnLGhyo9tw4LPAU4vNRrP1b6luL/B4FBRcW0D7zBD18VKgVQ5zUKRBV8V9tIqrxwPc9sn/7dhZLvDdeO4DJNDAWsVzrumpPDi+1re5UvqhYPZd4IIWRmok63WPeKWw/dL85VllfE2JgC+u+oGLJVvXqdGZGgtKMiG05urpoT6eT8gttOYnpN0jFrWk7s0BX3/t60Q4/WRav3327KQ== X-YMail-OSG: pPdtcRkVM1ms67vhmjHuuRBCOnLToajNqaerhKu6JvOl4ZquSbttYP.cf_nUMwc 55r2P5AOSdO3B0K3UH02_lGZ5zm3uy5z4NkESlgWujX27XrYxYqmgFjmWHAkDZNVZ8xHz9qBbmxY yC0AS9jQXIkfxiCWVoGYd5TRqj6lw1v6djJmEwTgMB39U2hufvX0c.QQggJL0yDwKDE_mdnkd1OB NqywQnGr4MHW8OGPUX8I.xUeEf.0j7BVBCzYRRJ1xWufK8cjHUyz7POlrbIgfE6jB3LvO8RzBC0Z ElWOq4wP5QeZaSJxoU84rs_D.UyCNHy_8oNUpeEkGaZiagKUu2EFGSX5HsIo6p7jSZBeHlgvHmIM 9lRM0V5V4TYNoVAxFeXbjza_ueSoOWMvGz5FGyco9.MpvyCzwWTo4Rgny0PagdOJkWZzlXeKzIDC NEBcgyt0EAV25kTYoyVrprQNOAk3naZfoKRJXVTdWIvpta6MHDk8bBQo_ZJw46frGJxeCwIGg Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.gq1.yahoo.com with HTTP; Mon, 8 Jan 2018 20:08:08 +0000 Received: from smtp102.rhel.mail.gq1.yahoo.com (EHLO [192.168.0.6]) ([216.39.57.211]) by smtp410.mail.gq1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID c1b5a2f9f5d40448375d855a6ae635ce; Mon, 08 Jan 2018 20:08:04 +0000 (UTC) Subject: Re: svn commit: r327697 - head/sys/sys To: Conrad Meyer Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801081541.w08Ffmm0052729@repo.freebsd.org> From: Pedro Giffuni Organization: FreeBSD Project Message-ID: <1665ddb4-64ad-5d01-902e-2a77a8f5b50c@FreeBSD.org> Date: Mon, 8 Jan 2018 15:08:04 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 20:08:16 -0000 Hi; On 08/01/2018 13:08, Conrad Meyer wrote: > Hi, > > Response inline. > > On Mon, Jan 8, 2018 at 7:41 AM, Pedro F. Giffuni wrote: >> Author: pfg >> Date: Mon Jan 8 15:41:48 2018 >> New Revision: 327697 >> URL: https://svnweb.freebsd.org/changeset/base/327697 >> >> Log: >> malloc(9): drop the __result_use_check attribute for the kernel allocator. >> >> The __result_use_check attribute was brought to the kernel malloc in >> r281203 for consistency with the userland malloc. >> >> For the case of the M_WAITOK flag, the kernel malloc(), realloc(), and >> reallocf() cannot return NULL so in that case the __result_use_check >> attribute makes no sense. >> >> We don't have any way of conditionalizing such attributes so just drop it. > Could we conditionalize the attribute using two different names and a > macro that inspected the (typically) constant flags argument? > Something like this: > > #define malloc(s, t, f) \ > (__builtin_constant_p(f) && (f & M_WAITOK) != 0) ? > _malloc_waitok(s, t, f) : _malloc(s, t, f) > void *_malloc(...) __malloc_like __alloc_size(1); > void *_malloc_waitok(...) __malloc_like __result_use_check __alloc_size(1); > > The two names would just be aliases, or one could invoke the other as > an inline function. That would work but I completely misunderstood the GCC attribute. Quoting the GCC documentation: ____ warn_unused_result The warn_unused_result attribute causes a warning to be emitted if a caller of the function with this attribute does not use its return value. This is useful for functions where not checking the result is either a security problem or always a bug, such as realloc. ____ Retrospectively, our attribute is badly named but it was very difficult to come up with a good name. Pedro. From owner-svn-src-head@freebsd.org Mon Jan 8 20:14:18 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38458E5E836; Mon, 8 Jan 2018 20:14:18 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 124A7718B0; Mon, 8 Jan 2018 20:14:18 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FC6D4B9D; Mon, 8 Jan 2018 20:14:17 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w08KEHVf071636; Mon, 8 Jan 2018 20:14:17 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w08KEGv8071627; Mon, 8 Jan 2018 20:14:16 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201801082014.w08KEGv8071627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 8 Jan 2018 20:14:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327706 - in head/sys: conf contrib/zstd/lib/freebsd X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: conf contrib/zstd/lib/freebsd X-SVN-Commit-Revision: 327706 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 20:14:18 -0000 Author: cem Date: Mon Jan 8 20:14:16 2018 New Revision: 327706 URL: https://svnweb.freebsd.org/changeset/base/327706 Log: Integrate zstd into the kernel Mock userspace headers and include mocked headers first in compilation command to inject kernel headers and override e.g., malloc(3) with malloc(9). Submitted by: allanjude Reviewed by: imp (earlier version), bapt (earlier version) Differential Revision: https://reviews.freebsd.org/D10407 Added: head/sys/contrib/zstd/lib/freebsd/ head/sys/contrib/zstd/lib/freebsd/stddef.h (contents, props changed) head/sys/contrib/zstd/lib/freebsd/stdint.h (contents, props changed) head/sys/contrib/zstd/lib/freebsd/stdio.h (contents, props changed) head/sys/contrib/zstd/lib/freebsd/stdlib.h (contents, props changed) head/sys/contrib/zstd/lib/freebsd/string.h (contents, props changed) head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h (contents, props changed) head/sys/contrib/zstd/lib/freebsd/zstd_kmalloc.c (contents, props changed) Modified: head/sys/conf/files head/sys/conf/kern.pre.mk Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Jan 8 18:47:35 2018 (r327705) +++ head/sys/conf/files Mon Jan 8 20:14:16 2018 (r327706) @@ -626,6 +626,23 @@ contrib/ngatm/netnatm/sig/sig_unimsgcpy.c optional nga compile-with "${NORMAL_C} -I$S/contrib/ngatm" contrib/ngatm/netnatm/sig/sig_verify.c optional ngatm_uni \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" +# Zstd +contrib/zstd/lib/freebsd/zstd_kmalloc.c standard compile-with ${ZSTD_C} +contrib/zstd/lib/common/zstd_common.c standard compile-with ${ZSTD_C} +contrib/zstd/lib/common/fse_decompress.c standard compile-with ${ZSTD_C} +contrib/zstd/lib/common/entropy_common.c standard compile-with ${ZSTD_C} +contrib/zstd/lib/common/error_private.c standard compile-with ${ZSTD_C} +contrib/zstd/lib/common/xxhash.c standard compile-with ${ZSTD_C} +contrib/zstd/lib/compress/zstd_compress.c standard compile-with ${ZSTD_C} +contrib/zstd/lib/compress/fse_compress.c standard compile-with ${ZSTD_C} +contrib/zstd/lib/compress/huf_compress.c standard compile-with ${ZSTD_C} +contrib/zstd/lib/compress/zstd_double_fast.c standard compile-with ${ZSTD_C} +contrib/zstd/lib/compress/zstd_fast.c standard compile-with ${ZSTD_C} +contrib/zstd/lib/compress/zstd_lazy.c standard compile-with ${ZSTD_C} +contrib/zstd/lib/compress/zstd_ldm.c standard compile-with ${ZSTD_C} +contrib/zstd/lib/compress/zstd_opt.c standard compile-with ${ZSTD_C} +contrib/zstd/lib/decompress/zstd_decompress.c standard compile-with ${ZSTD_C} +contrib/zstd/lib/decompress/huf_decompress.c standard compile-with ${ZSTD_C} crypto/blowfish/bf_ecb.c optional ipsec | ipsec_support crypto/blowfish/bf_skey.c optional crypto | ipsec | ipsec_support crypto/camellia/camellia.c optional crypto | ipsec | ipsec_support Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Mon Jan 8 18:47:35 2018 (r327705) +++ head/sys/conf/kern.pre.mk Mon Jan 8 20:14:16 2018 (r327706) @@ -132,6 +132,9 @@ NORMAL_FW= uudecode -o ${.TARGET} ${.ALLSRC} NORMAL_FWO= ${LD} -b binary --no-warn-mismatch -d -warn-common -r \ -m ${LD_EMULATION} -o ${.TARGET} ${.ALLSRC:M*.fw} +# for ZSTD in the kernel (include zstd/lib/freebsd before other CFLAGS) +ZSTD_C= ${CC} -c -DZSTD_HEAPMODE=1 -I$S/contrib/zstd/lib/freebsd ${CFLAGS} -I$S/contrib/zstd/lib -I$S/contrib/zstd/lib/common ${WERROR} -Wno-missing-prototypes ${PROF} ${.IMPSRC} + # Common for dtrace / zfs CDDL_CFLAGS= -DFREEBSD_NAMECACHE -nostdinc -I$S/cddl/compat/opensolaris -I$S/cddl/contrib/opensolaris/uts/common -I$S -I$S/cddl/contrib/opensolaris/common ${CFLAGS} -Wno-unknown-pragmas -Wno-missing-prototypes -Wno-undef -Wno-strict-prototypes -Wno-cast-qual -Wno-parentheses -Wno-redundant-decls -Wno-missing-braces -Wno-uninitialized -Wno-unused -Wno-inline -Wno-switch -Wno-pointer-arith -Wno-unknown-pragmas CDDL_CFLAGS+= -include $S/cddl/compat/opensolaris/sys/debug_compat.h Added: head/sys/contrib/zstd/lib/freebsd/stddef.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/zstd/lib/freebsd/stddef.h Mon Jan 8 20:14:16 2018 (r327706) @@ -0,0 +1,3 @@ +/* This file is in the public domain */ +/* $FreeBSD$ */ +#include "zstd_kfreebsd.h" Added: head/sys/contrib/zstd/lib/freebsd/stdint.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/zstd/lib/freebsd/stdint.h Mon Jan 8 20:14:16 2018 (r327706) @@ -0,0 +1,3 @@ +/* This file is in the public domain */ +/* $FreeBSD$ */ +#include "zstd_kfreebsd.h" Added: head/sys/contrib/zstd/lib/freebsd/stdio.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/zstd/lib/freebsd/stdio.h Mon Jan 8 20:14:16 2018 (r327706) @@ -0,0 +1,3 @@ +/* This file is in the public domain */ +/* $FreeBSD$ */ +#include "zstd_kfreebsd.h" Added: head/sys/contrib/zstd/lib/freebsd/stdlib.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/zstd/lib/freebsd/stdlib.h Mon Jan 8 20:14:16 2018 (r327706) @@ -0,0 +1,3 @@ +/* This file is in the public domain */ +/* $FreeBSD$ */ +#include "zstd_kfreebsd.h" Added: head/sys/contrib/zstd/lib/freebsd/string.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/zstd/lib/freebsd/string.h Mon Jan 8 20:14:16 2018 (r327706) @@ -0,0 +1,3 @@ +/* This file is in the public domain */ +/* $FreeBSD$ */ +#include "zstd_kfreebsd.h" Added: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Mon Jan 8 20:14:16 2018 (r327706) @@ -0,0 +1,56 @@ +/*- + * Copyright (c) 2014-2015 Allan Jude + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef ZSTD_KFREEBSD_H +#define ZSTD_KFREEBSD_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _KERNEL +#include /* size_t */ +#include /* memcpy, memset */ +#ifndef BUILDING_ZFS +#include /* ptrdiff_t */ +#endif +#include + +MALLOC_DECLARE(M_ZSTD); + +#define malloc(x) (malloc)((x), M_ZSTD, M_WAITOK) +#define free(x) (free)((x), M_ZSTD) +/* in zstd's use of calloc, a is always 1 */ +#define calloc(a,b) (malloc)((a)*(b), M_ZSTD, M_WAITOK | M_ZERO) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* ZSTD_KFREEBSD_H */ Added: head/sys/contrib/zstd/lib/freebsd/zstd_kmalloc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/zstd/lib/freebsd/zstd_kmalloc.c Mon Jan 8 20:14:16 2018 (r327706) @@ -0,0 +1,33 @@ +/*- + * Copyright (c) 2016-2017 Allan Jude + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include + +MALLOC_DEFINE(M_ZSTD, "zstd", "ZSTD Compressor"); From owner-svn-src-head@freebsd.org Mon Jan 8 20:18:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3CAEE5EF1F for ; Mon, 8 Jan 2018 20:18:54 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic302-36.consmr.mail.gq1.yahoo.com (sonic302-36.consmr.mail.gq1.yahoo.com [98.137.68.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AFC7771E70 for ; Mon, 8 Jan 2018 20:18:54 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1515442733; bh=IXOnRaga6Kz0tUV0s9PivkXdauWg6Ns6jiUL+zpiKjg=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=fe1oN27GNz4Q8jLFpMv6liZsN1fQOldICEdmoyxhhQ6TfXrnukr0b+LFiXl8VU6W6ckwHvHVS+oQ31qzEt7vtj11t1vk0NyYBTxJ5Bbm5CcoNrg582cKnReRUaGesselLnxO4VMw8j4lfXge3nkKQUyUxic4/rwiDScl/H9csBQGvkaaZANqwJrbgNQ/eB9qU7vTdmUF7T5YPWi1Vt2Z5DN5KQTs3oIkN5WkCVPAvh5eWyeY98rSHvaq/PxPAwJ9yhQ+seraAMponLVEQJNHBRh6Czpv2XpYYlJo24pN4fSM1sTVi0qpZw1B2FHenzzgy/C4l17VzuHbFnFveId8Ew== X-YMail-OSG: uD4CU.AVM1nUTsvejlLAS4b15.dXuUh8xP6euafbnd896MPdDkxo3J0XsVrMU0A ECJ2COnjqOvcP6MU_P5d9zYb6OEzoUJUV2_AegZOySxVY6jNPM18g5A0_91NSAA1L43RI3lNATpz jQP1dwCdWkTcf550gTeNKl8zkli6hhJk5hShJqu5zrLjzkxZ2hQ.4DTn_3GFrCaDoT2r0Rt0tW9l rlktlSuBLbrtxiYresnluiwXDTd.18SWO4bfNog3nUh.i5lm4Ql4g1i3pshLj36bcW7yLIdEKQOU C4eW8zQXXXUjIcYkBtr5kDC6SOm1AAOizwlTkRXO0v737HbkhDCDFD3UY7y9Q.KDOHRzLdI9._hK 7VqNQKb1CSzyRQeDuNt35cOxNELcMIZ4zCPbyESlgHPHbwaLDZUc5Sanb3G8qdxcIuWQj8QoJC1f zyo1x7.BuhNfDw5W9A64adp2elvq4Pg60hFTZGAqZs7DGblSp_9HBDSgn3jpIa1XCRhwrQ_E. Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.gq1.yahoo.com with HTTP; Mon, 8 Jan 2018 20:18:53 +0000 Received: from smtp110.rhel.mail.gq1.yahoo.com (EHLO [192.168.0.6]) ([216.39.57.225]) by smtp415.mail.gq1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 37dde62ddfb6676b2daab4b6d9436738; Mon, 08 Jan 2018 20:18:49 +0000 (UTC) Subject: Re: svn commit: r327699 - head/sys/sys To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801081609.w08G9941022351@pdx.rh.CN85.dnsmgr.net> From: Pedro Giffuni Organization: FreeBSD Project Message-ID: Date: Mon, 8 Jan 2018 15:18:50 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <201801081609.w08G9941022351@pdx.rh.CN85.dnsmgr.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 20:18:54 -0000 On 08/01/2018 11:09, Rodney W. Grimes wrote: >> Author: pfg >> Date: Mon Jan 8 15:54:29 2018 >> New Revision: 327699 >> URL: https://svnweb.freebsd.org/changeset/base/327699 >> >> Log: >> Revert r327697: >> malloc(9): drop the __result_use_check attribute for the kernel allocator. >> >> My bad: __result_use_check just checks the for the general and we always >> want to make sure allocated memory is used, not only checked for nullness. >> >> Add it to reallocf since that was missing. > Please try not to combine a revert with an add, it makes it messy > to try and figure out things in the future when only the svn log > is being used to analyze stuff as digging in mail archives becomes > painful. > > Revert, then commit the add standalone, is the better sequence in > this type of situation. Not that any of this is defined in our committers guide but IMHO "svn revert" is just a tool, pretty much as "svn move" and "svn copy". The idea is to make a committers' life easier: making two commits for such a simple change is not "easier". In this case the change is rather consistent: I added __result_use_check to the three functions that needed it. The commit log is not only clear on why the revert happened but also explains the additional one line change. When I MFC it, I will merge both changes for repository consistency but the log will basically mention that I am adding __result_use_check to reallocf(). Pedro. >> Modified: >> head/sys/sys/malloc.h >> >> Modified: head/sys/sys/malloc.h >> ============================================================================== >> --- head/sys/sys/malloc.h Mon Jan 8 15:41:49 2018 (r327698) >> +++ head/sys/sys/malloc.h Mon Jan 8 15:54:29 2018 (r327699) >> @@ -176,7 +176,7 @@ void *contigmalloc(unsigned long size, struct malloc_t >> __alloc_size(1) __alloc_align(6); >> void free(void *addr, struct malloc_type *type); >> void *malloc(unsigned long size, struct malloc_type *type, int flags) >> - __malloc_like __alloc_size(1); >> + __malloc_like __result_use_check __alloc_size(1); >> void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, >> int flags) __malloc_like __result_use_check >> __alloc_size(1) __alloc_size(2); >> @@ -187,9 +187,9 @@ void malloc_type_freed(struct malloc_type *type, unsig >> void malloc_type_list(malloc_type_list_func_t *, void *); >> void malloc_uninit(void *); >> void *realloc(void *addr, unsigned long size, struct malloc_type *type, >> - int flags) __alloc_size(2); >> + int flags) __result_use_check __alloc_size(2); >> void *reallocf(void *addr, unsigned long size, struct malloc_type *type, >> - int flags) __alloc_size(2); >> + int flags) __result_use_check __alloc_size(2); >> >> struct malloc_type *malloc_desc2type(const char *desc); >> #endif /* _KERNEL */ >> >> Pedro. From owner-svn-src-head@freebsd.org Mon Jan 8 20:28:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D657EE5F8DA; Mon, 8 Jan 2018 20:28:00 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f170.google.com (mail-io0-f170.google.com [209.85.223.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A65F3728F1; Mon, 8 Jan 2018 20:27:59 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f170.google.com with SMTP id z130so15986617ioe.13; Mon, 08 Jan 2018 12:27:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=eicwRyrtt8nnK8urFqWz+x5fXTQF6E0niTcCr2g8N4c=; b=HIXlU8tRNQBpYHK1NTH9HlHQ6vOCelYQ4+zKcGs33iQGkCFnOgedh2yPKh64HukQmx Ly3CNt8t1pjKr7Zc48Dz7/kVbhsu+g1JvTsqsiobhSxFFK2rZS4SyezJ+VCopJG2Q67v uyp6pNYg8fEth4iy7OVoG9zky2r+bbrttfv6yDQkOB6f7manKpU9D/ZB9Dvaj7KR37LP HNF75N1LFlj0XbkTd/iuQJpFfRPVeNgtP46ZQvrUR1b1RwetsNQa3y+j5ZA+C5OKn9YI a3s2y88npZGwYoa0+AzQFqWmDc5seGIHpoxXRbTrGZ1EQtkk4JJGUMX0XxdUuhMNWPN7 sAbQ== X-Gm-Message-State: AKGB3mITyh1feL5Acfv9YFk0i3Rkq2EOc27LWTnDTKCU3ICHMmB6GRum /HAsLcMDmPa/bJmRO7t57yvlrRp5 X-Google-Smtp-Source: ACJfBosEL/M5T9/a+cQreHvPIOjVorAhaviVOm1sYK3JKgvJqYfDUL/VYiq/qt3pXqSe5UpidBfIAg== X-Received: by 10.107.180.201 with SMTP id d192mr12086813iof.270.1515443279018; Mon, 08 Jan 2018 12:27:59 -0800 (PST) Received: from mail-it0-f45.google.com (mail-it0-f45.google.com. [209.85.214.45]) by smtp.gmail.com with ESMTPSA id v19sm7566758ite.4.2018.01.08.12.27.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jan 2018 12:27:58 -0800 (PST) Received: by mail-it0-f45.google.com with SMTP id p124so1904745ite.1; Mon, 08 Jan 2018 12:27:58 -0800 (PST) X-Received: by 10.36.7.65 with SMTP id f62mr13307198itf.75.1515443278518; Mon, 08 Jan 2018 12:27:58 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.15.193 with HTTP; Mon, 8 Jan 2018 12:27:58 -0800 (PST) In-Reply-To: References: <201801081609.w08G9941022351@pdx.rh.CN85.dnsmgr.net> From: Conrad Meyer Date: Mon, 8 Jan 2018 12:27:58 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r327699 - head/sys/sys To: Pedro Giffuni Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 20:28:00 -0000 I'm (again, atypically) with rgrimes here. Revert has a specific meaning and shouldn't be used like this. Making a commit with the subject "Revert rXXX" that does more than just "svn revert rXXX" makes life harder for developers looking at code history after you. Making two separate commits for two different changes (revert, then add the annotation) is not burdensome. Best, Conrad On Mon, Jan 8, 2018 at 12:18 PM, Pedro Giffuni wrote: > > On 08/01/2018 11:09, Rodney W. Grimes wrote: >>> >>> Author: pfg >>> Date: Mon Jan 8 15:54:29 2018 >>> New Revision: 327699 >>> URL: https://svnweb.freebsd.org/changeset/base/327699 >>> >>> Log: >>> Revert r327697: >>> malloc(9): drop the __result_use_check attribute for the kernel >>> allocator. >>> My bad: __result_use_check just checks the for the general and we >>> always >>> want to make sure allocated memory is used, not only checked for >>> nullness. >>> Add it to reallocf since that was missing. >> >> Please try not to combine a revert with an add, it makes it messy >> to try and figure out things in the future when only the svn log >> is being used to analyze stuff as digging in mail archives becomes >> painful. >> >> Revert, then commit the add standalone, is the better sequence in >> this type of situation. > > > Not that any of this is defined in our committers guide but IMHO "svn > revert" is just a tool, pretty much as "svn move" and "svn copy". The idea > is to make a committers' life easier: making two commits for such a simple > change is not "easier". > > In this case the change is rather consistent: I added __result_use_check to > the three functions that needed it. > The commit log is not only clear on why the revert happened but also > explains the additional one line change. > > When I MFC it, I will merge both changes for repository consistency but the > log will basically mention that I am adding __result_use_check to > reallocf(). > > > Pedro. > >>> Modified: >>> head/sys/sys/malloc.h >>> >>> Modified: head/sys/sys/malloc.h >>> >>> ============================================================================== >>> --- head/sys/sys/malloc.h Mon Jan 8 15:41:49 2018 (r327698) >>> +++ head/sys/sys/malloc.h Mon Jan 8 15:54:29 2018 (r327699) >>> @@ -176,7 +176,7 @@ void *contigmalloc(unsigned long size, struct >>> malloc_t >>> __alloc_size(1) __alloc_align(6); >>> void free(void *addr, struct malloc_type *type); >>> void *malloc(unsigned long size, struct malloc_type *type, int flags) >>> - __malloc_like __alloc_size(1); >>> + __malloc_like __result_use_check __alloc_size(1); >>> void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, >>> int flags) __malloc_like __result_use_check >>> __alloc_size(1) __alloc_size(2); >>> @@ -187,9 +187,9 @@ void malloc_type_freed(struct malloc_type >>> *type, unsig >>> void malloc_type_list(malloc_type_list_func_t *, void *); >>> void malloc_uninit(void *); >>> void *realloc(void *addr, unsigned long size, struct malloc_type >>> *type, >>> - int flags) __alloc_size(2); >>> + int flags) __result_use_check __alloc_size(2); >>> void *reallocf(void *addr, unsigned long size, struct malloc_type >>> *type, >>> - int flags) __alloc_size(2); >>> + int flags) __result_use_check __alloc_size(2); >>> struct malloc_type *malloc_desc2type(const char *desc); >>> #endif /* _KERNEL */ >>> >>> > > Pedro. > From owner-svn-src-head@freebsd.org Mon Jan 8 20:54:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA5BDE6194F for ; Mon, 8 Jan 2018 20:54:55 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic303-37.consmr.mail.gq1.yahoo.com (sonic303-37.consmr.mail.gq1.yahoo.com [98.137.64.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B34107428C for ; Mon, 8 Jan 2018 20:54:55 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1515444889; bh=iEC/mt6zffQ+/zwfu+XtNCn6QggpYN7DB0vLjNpx4Ws=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=V07PXJcfkm47eaik4k7gF2/SJIhHsM3H8TFJTxN2cltxnVgYRgddgxTUGULdVZkUCGVIUEZmefodoWZBuM0kF772ANCEmioQwuRtVrdrLZptUbG9gzDE0aaSM2FDe8GfpdUV//m3+saNpdk9jLdxvdrZYIHFEBtrMbAAa5sV3HHFVcz8vvWenum7IAt4RZxTHhivrU0a/h6yppyVX/fGxE5/jwYOwOjtcl9etmRuKGNCPbCN3kGb/cw/gz7z39Nk3rtKatVsr2hT/DR+UD/z+F9pywuZzlfs+VhfhdnESRlMQxznEY2euQYRrIVQB+ZRAlzA8mhzIxtcYxRGHVSnxg== X-YMail-OSG: 6.QGtxEVM1kQ1RUq5HhxbejaQEeRXzn8VKD6Sgy5vqN3tzwG8LY3iqyKk.ehc4x orCik4LmWzlB92KKOwD8ti8.0Ilpc7O88Fm.PJE58zC2JTh4FLRiGFDUpfq3kuV8MKasO3N7Yrc5 ZEMFzcaojYaYQN1Fb3GLYRch0Gg2GfzLXEZQion5NMvgzZ5hCH_3G62wf7z1s2kML6yQ0eMB3Hii BXemOhFxAxwUFzTWYdh1xCeAiv1XofxQA2kb57WYz0Cil.40n.rlxIurmZG4oqhIKzxsI1kLFJkj y6ikDan8z9VyOTyFE7o70HhqLbh64gW12yOPf449LbKySjvnjewvyAjDXfS4Ff7RnyhOb3qcpJnJ NSwJIz_p2GDVjQm8xiG8Fz8q2AXVAeS56Ywc3v9e73IdlHlADus0DHNseEP_JyVfmxWWA6wT._Bk TPes_0L.Hjq6YAJpi.Gx8rMmgKp2bmMLTF62SDNuZGrL.RIO.JWNMcwU075zG_d30ZOWRW3J. Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.gq1.yahoo.com with HTTP; Mon, 8 Jan 2018 20:54:49 +0000 Received: from smtp110.rhel.mail.gq1.yahoo.com (EHLO [192.168.0.6]) ([216.39.57.225]) by smtp403.mail.gq1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 281cf99df4003b4738c94627c89ec3de; Mon, 08 Jan 2018 20:54:44 +0000 (UTC) Subject: Re: svn commit: r327699 - head/sys/sys To: cem@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801081609.w08G9941022351@pdx.rh.CN85.dnsmgr.net> From: Pedro Giffuni Organization: FreeBSD Project Message-ID: <89964e3f-a982-f0e5-a7ff-9c13a5ebe61c@FreeBSD.org> Date: Mon, 8 Jan 2018 15:54:45 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 20:54:56 -0000 Hello; On 08/01/2018 15:27, Conrad Meyer wrote: > I'm (again, atypically) with rgrimes here. Revert has a specific > meaning and shouldn't be used like this. Making a commit with the > subject "Revert rXXX" that does more than just "svn revert rXXX" makes > life harder for developers looking at code history after you. Making > two separate commits for two different changes (revert, then add the > annotation) is not burdensome. > > Best, > Conrad Yeah, I understand where that comes from and I will take it into account for future commits, but I think it should be *documented* and not assume that everybody  thinks that is the way version control is supposed to be used. Pedro. > On Mon, Jan 8, 2018 at 12:18 PM, Pedro Giffuni wrote: >> On 08/01/2018 11:09, Rodney W. Grimes wrote: >>>> Author: pfg >>>> Date: Mon Jan 8 15:54:29 2018 >>>> New Revision: 327699 >>>> URL: https://svnweb.freebsd.org/changeset/base/327699 >>>> >>>> Log: >>>> Revert r327697: >>>> malloc(9): drop the __result_use_check attribute for the kernel >>>> allocator. >>>> My bad: __result_use_check just checks the for the general and we >>>> always >>>> want to make sure allocated memory is used, not only checked for >>>> nullness. >>>> Add it to reallocf since that was missing. >>> Please try not to combine a revert with an add, it makes it messy >>> to try and figure out things in the future when only the svn log >>> is being used to analyze stuff as digging in mail archives becomes >>> painful. >>> >>> Revert, then commit the add standalone, is the better sequence in >>> this type of situation. >> >> Not that any of this is defined in our committers guide but IMHO "svn >> revert" is just a tool, pretty much as "svn move" and "svn copy". The idea >> is to make a committers' life easier: making two commits for such a simple >> change is not "easier". >> >> In this case the change is rather consistent: I added __result_use_check to >> the three functions that needed it. >> The commit log is not only clear on why the revert happened but also >> explains the additional one line change. >> >> When I MFC it, I will merge both changes for repository consistency but the >> log will basically mention that I am adding __result_use_check to >> reallocf(). >> >> >> Pedro. >> >>>> Modified: >>>> head/sys/sys/malloc.h >>>> >>>> Modified: head/sys/sys/malloc.h >>>> >>>> ============================================================================== >>>> --- head/sys/sys/malloc.h Mon Jan 8 15:41:49 2018 (r327698) >>>> +++ head/sys/sys/malloc.h Mon Jan 8 15:54:29 2018 (r327699) >>>> @@ -176,7 +176,7 @@ void *contigmalloc(unsigned long size, struct >>>> malloc_t >>>> __alloc_size(1) __alloc_align(6); >>>> void free(void *addr, struct malloc_type *type); >>>> void *malloc(unsigned long size, struct malloc_type *type, int flags) >>>> - __malloc_like __alloc_size(1); >>>> + __malloc_like __result_use_check __alloc_size(1); >>>> void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, >>>> int flags) __malloc_like __result_use_check >>>> __alloc_size(1) __alloc_size(2); >>>> @@ -187,9 +187,9 @@ void malloc_type_freed(struct malloc_type >>>> *type, unsig >>>> void malloc_type_list(malloc_type_list_func_t *, void *); >>>> void malloc_uninit(void *); >>>> void *realloc(void *addr, unsigned long size, struct malloc_type >>>> *type, >>>> - int flags) __alloc_size(2); >>>> + int flags) __result_use_check __alloc_size(2); >>>> void *reallocf(void *addr, unsigned long size, struct malloc_type >>>> *type, >>>> - int flags) __alloc_size(2); >>>> + int flags) __result_use_check __alloc_size(2); >>>> struct malloc_type *malloc_desc2type(const char *desc); >>>> #endif /* _KERNEL */ >>>> >>>> >> Pedro. >> From owner-svn-src-head@freebsd.org Mon Jan 8 21:09:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED4F4E626E9; Mon, 8 Jan 2018 21:09:49 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f41.google.com (mail-it0-f41.google.com [209.85.214.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BC10174D9B; Mon, 8 Jan 2018 21:09:49 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f41.google.com with SMTP id b77so5905020itd.0; Mon, 08 Jan 2018 13:09:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=UtIY/7oD1qfTcaZMU3aWih/Uu4InNUC3exw7PTOwpnQ=; b=qAvwdIZEtEhL9iiTFMrFtmvWQbbwI3mtle0x0qA65Ba1QePRJbmNB08aVV1C206Oxc BNlsrI3EW3jg5roOfgr6aQLbaaTQ71P35zVGYs+4FME+1zWM7pGOBn+2wWh78n46tkMt 50gQMTke1fDtDzPXbCrNod88EpWh43Z/ZoR+0xYu5VyDuCmLJ2BWsOKyZ8s52Bi50YgS 8sXLgRmN+JrMBebd3oMJIMR3r2Mf1Lc9sf067m8EePYJs3Bc/tmza+avtDoo+nZrZ14P sLH/cbhiZla+RatSvigWR6n93/+xRav+jbVPYUozBD+ElRCFqgXRvE/Qp1ht2XIdGHCi Rs8Q== X-Gm-Message-State: AKwxytdsIFRj0liZ3vbr0IYxDp5WjQcuneogYZeHNzJm0UlwWe0cL1cm WzSxUDks1QB3oD3OUj5SX1U89A0h X-Google-Smtp-Source: ACJfBouR3Tu89hnY0HZEL8oFEpdzsp/9/VjihhrDtlh7MXGqS1Tj1FlyS7tYT6++GmT5w5S/i4dtBQ== X-Received: by 10.36.79.132 with SMTP id c126mr5922694itb.45.1515445782952; Mon, 08 Jan 2018 13:09:42 -0800 (PST) Received: from mail-io0-f176.google.com (mail-io0-f176.google.com. [209.85.223.176]) by smtp.gmail.com with ESMTPSA id p68sm7192688itc.26.2018.01.08.13.09.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jan 2018 13:09:42 -0800 (PST) Received: by mail-io0-f176.google.com with SMTP id e20so16116976iof.12; Mon, 08 Jan 2018 13:09:42 -0800 (PST) X-Received: by 10.107.53.223 with SMTP id k92mr13296236ioo.38.1515445782501; Mon, 08 Jan 2018 13:09:42 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.15.193 with HTTP; Mon, 8 Jan 2018 13:09:42 -0800 (PST) In-Reply-To: <89964e3f-a982-f0e5-a7ff-9c13a5ebe61c@FreeBSD.org> References: <201801081609.w08G9941022351@pdx.rh.CN85.dnsmgr.net> <89964e3f-a982-f0e5-a7ff-9c13a5ebe61c@FreeBSD.org> From: Conrad Meyer Date: Mon, 8 Jan 2018 13:09:42 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r327699 - head/sys/sys To: Pedro Giffuni Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 21:09:50 -0000 On Mon, Jan 8, 2018 at 12:54 PM, Pedro Giffuni wrote: > Yeah, I understand where that comes from and I will take it into account = for > future commits, but I think it should be *documented* and not assume that > everybody thinks that is the way version control is supposed to be used. If you want to document it somewhere, I don't think anyone will stop you. In general, we do have a bunch of unwritten guidelines that are either inferred from reading SVN log / source or explicitly requested via review (pre- or post-commit). I don't think it would hurt to document. I don't know if this specific topic is really a FreeBSD guideline or not, but it's a good practice when using any version control system. (You could do the same thing with 'git revert' =E2=80=94 make additions on = top of the revert commit =E2=80=94 and it would be equally a bad practice with that tool.) The only downsides I see are: 0. No one is interested in spending time writing this down and dealing with the inevitable bikeshedding, 1. Consensus may shift over time, and 2. People don't want to spend a ton of time reading rules Best, Conrad From owner-svn-src-head@freebsd.org Mon Jan 8 21:27:43 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A76D7E63A6A; Mon, 8 Jan 2018 21:27:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5CF2975EDA; Mon, 8 Jan 2018 21:27:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 99C4B5771; Mon, 8 Jan 2018 21:27:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w08LRg0G001649; Mon, 8 Jan 2018 21:27:42 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w08LRfqm001641; Mon, 8 Jan 2018 21:27:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201801082127.w08LRfqm001641@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 8 Jan 2018 21:27:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327707 - in head: share/man/man5 sys/conf sys/ddb sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head: share/man/man5 sys/conf sys/ddb sys/kern sys/sys X-SVN-Commit-Revision: 327707 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 21:27:43 -0000 Author: markj Date: Mon Jan 8 21:27:41 2018 New Revision: 327707 URL: https://svnweb.freebsd.org/changeset/base/327707 Log: Generalize the gzio API. We currently use a set of subroutines in kern_gzio.c to perform compression of user and kernel core dumps. In the interest of adding support for other compression algorithms (zstd) in this role without complicating the API consumers, add a simple compressor API which can be used to select an algorithm. Also change the (non-default) GZIO kernel option to not enable compressed user cores by default. It's not clear that such a default would be desirable with support for multiple algorithms implemented, and it's inconsistent in that it isn't applied to kernel dumps. Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D13632 Added: head/sys/kern/subr_compressor.c - copied, changed from r327706, head/sys/kern/kern_gzio.c head/sys/sys/compressor.h - copied, changed from r327706, head/sys/sys/gzio.h Deleted: head/sys/kern/kern_gzio.c head/sys/sys/gzio.h Modified: head/share/man/man5/core.5 head/sys/conf/files head/sys/ddb/db_textdump.c head/sys/kern/imgact_elf.c head/sys/kern/kern_shutdown.c head/sys/kern/kern_sig.c head/sys/sys/conf.h head/sys/sys/imgact.h Modified: head/share/man/man5/core.5 ============================================================================== --- head/share/man/man5/core.5 Mon Jan 8 20:14:16 2018 (r327706) +++ head/share/man/man5/core.5 Mon Jan 8 21:27:41 2018 (r327707) @@ -28,7 +28,7 @@ .\" @(#)core.5 8.3 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd October 5, 2015 +.Dd January 8, 2018 .Dt CORE 5 .Os .Sh NAME @@ -67,8 +67,8 @@ generating it). .Pp The following format specifiers may be used in the .Va kern.corefile -sysctl to insert additional information into the resulting core file -name: +sysctl to insert additional information into the resulting core +filename: .Bl -tag -width "1234567890" -compact -offset "12345" .It Em \&%H Machine hostname. @@ -108,17 +108,17 @@ is included in the kernel configuration file: GZIO .El .Pp -When the GZIO option is included, the following sysctls control whether core -files will be compressed: -.Bl -tag -width "kern.compress_user_cores_gzlevel" -compact -offset "12345" -.It Em kern.compress_user_cores_gzlevel -Gzip compression level. -Defaults to 6. +The following sysctl control core file compression: +.Bl -tag -width "kern.compress_user_cores_level" -compact -offset "12345" .It Em kern.compress_user_cores -Actually compress user cores. -Compressed core files will have a suffix of +Enable compression of user cores. +A value of 1 configures gzip compression. +gzip-compressed core files will have a suffix of .Ql .gz -appended to them. +appended to their filenames. +.It Em kern.compress_user_cores_level +Compression level. +Defaults to 6. .El .Sh NOTES Corefiles are written with open file descriptor information as an ELF note. @@ -153,6 +153,7 @@ command can be used: .Dl sysctl kern.corefile=/var/coredumps/\&%U/\&%N.core .Sh SEE ALSO .Xr gdb 1 , +.Xr gzip 1 , .Xr kgdb 1 , .Xr setrlimit 2 , .Xr sigaction 2 , Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Jan 8 20:14:16 2018 (r327706) +++ head/sys/conf/files Mon Jan 8 21:27:41 2018 (r327707) @@ -3767,7 +3767,6 @@ kern/kern_exit.c standard kern/kern_fail.c standard kern/kern_ffclock.c standard kern/kern_fork.c standard -kern/kern_gzio.c optional gzio kern/kern_hhook.c standard kern/kern_idle.c standard kern/kern_intr.c standard @@ -3843,6 +3842,7 @@ kern/subr_bus_dma.c standard kern/subr_bufring.c standard kern/subr_capability.c standard kern/subr_clock.c standard +kern/subr_compressor.c standard kern/subr_counter.c standard kern/subr_devstat.c standard kern/subr_disk.c standard Modified: head/sys/ddb/db_textdump.c ============================================================================== --- head/sys/ddb/db_textdump.c Mon Jan 8 20:14:16 2018 (r327706) +++ head/sys/ddb/db_textdump.c Mon Jan 8 21:27:41 2018 (r327707) @@ -454,8 +454,8 @@ textdump_dumpsys(struct dumperinfo *di) /* * Disable EKCD because we don't provide encrypted textdumps. */ - kdc = di->kdc; - di->kdc = NULL; + kdc = di->kdcrypto; + di->kdcrypto = NULL; /* * Position the start of the dump so that we'll write the kernel dump @@ -512,7 +512,7 @@ textdump_dumpsys(struct dumperinfo *di) /* * Restore EKCD status. */ - di->kdc = kdc; + di->kdcrypto = kdc; } /*- Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Mon Jan 8 20:14:16 2018 (r327706) +++ head/sys/kern/imgact_elf.c Mon Jan 8 21:27:41 2018 (r327707) @@ -36,13 +36,12 @@ __FBSDID("$FreeBSD$"); #include "opt_capsicum.h" #include "opt_compat.h" -#include "opt_gzio.h" #include #include +#include #include #include -#include #include #include #include @@ -1185,9 +1184,12 @@ struct coredump_params { struct ucred *file_cred; struct thread *td; struct vnode *vp; - struct gzio_stream *gzs; + struct compressor *comp; }; +extern int compress_user_cores; +extern int compress_user_cores_level; + static void cb_put_phdr(vm_map_entry_t, void *); static void cb_size_segment(vm_map_entry_t, void *); static int core_write(struct coredump_params *, const void *, size_t, off_t, @@ -1219,9 +1221,6 @@ static void note_procstat_rlimit(void *, struct sbuf * static void note_procstat_umask(void *, struct sbuf *, size_t *); static void note_procstat_vmmap(void *, struct sbuf *, size_t *); -#ifdef GZIO -extern int compress_user_cores_gzlevel; - /* * Write out a core segment to the compression stream. */ @@ -1241,7 +1240,7 @@ compress_chunk(struct coredump_params *p, char *base, error = copyin(base, buf, chunk_len); if (error != 0) bzero(buf, chunk_len); - error = gzio_write(p->gzs, buf, chunk_len); + error = compressor_write(p->comp, buf, chunk_len); if (error != 0) break; base += chunk_len; @@ -1251,13 +1250,12 @@ compress_chunk(struct coredump_params *p, char *base, } static int -core_gz_write(void *base, size_t len, off_t offset, void *arg) +core_compressed_write(void *base, size_t len, off_t offset, void *arg) { return (core_write((struct coredump_params *)arg, base, len, offset, UIO_SYSSPACE)); } -#endif /* GZIO */ static int core_write(struct coredump_params *p, const void *base, size_t len, @@ -1275,10 +1273,9 @@ core_output(void *base, size_t len, off_t offset, stru { int error; -#ifdef GZIO - if (p->gzs != NULL) + if (p->comp != NULL) return (compress_chunk(p, base, tmpbuf, len)); -#endif + /* * EFAULT is a non-fatal error that we can get, for example, * if the segment is backed by a file but extends beyond its @@ -1323,11 +1320,9 @@ sbuf_drain_core_output(void *arg, const char *data, in locked = PROC_LOCKED(p->td->td_proc); if (locked) PROC_UNLOCK(p->td->td_proc); -#ifdef GZIO - if (p->gzs != NULL) - error = gzio_write(p->gzs, __DECONST(char *, data), len); + if (p->comp != NULL) + error = compressor_write(p->comp, __DECONST(char *, data), len); else -#endif error = core_write(p, __DECONST(void *, data), len, p->offset, UIO_SYSSPACE); if (locked) @@ -1362,11 +1357,7 @@ __elfN(coredump)(struct thread *td, struct vnode *vp, struct note_info *ninfo; void *hdr, *tmpbuf; size_t hdrsize, notesz, coresize; -#ifdef GZIO - boolean_t compress; - compress = (flags & IMGACT_CORE_COMPRESS) != 0; -#endif hdr = NULL; tmpbuf = NULL; TAILQ_INIT(¬elst); @@ -1391,7 +1382,7 @@ __elfN(coredump)(struct thread *td, struct vnode *vp, params.file_cred = NOCRED; params.td = td; params.vp = vp; - params.gzs = NULL; + params.comp = NULL; #ifdef RACCT if (racct_enable) { @@ -1409,18 +1400,17 @@ __elfN(coredump)(struct thread *td, struct vnode *vp, goto done; } -#ifdef GZIO /* Create a compression stream if necessary. */ - if (compress) { - params.gzs = gzio_init(core_gz_write, GZIO_DEFLATE, - CORE_BUF_SIZE, compress_user_cores_gzlevel, ¶ms); - if (params.gzs == NULL) { + if (compress_user_cores != 0) { + params.comp = compressor_init(core_compressed_write, + compress_user_cores, CORE_BUF_SIZE, + compress_user_cores_level, ¶ms); + if (params.comp == NULL) { error = EFAULT; goto done; } tmpbuf = malloc(CORE_BUF_SIZE, M_TEMP, M_WAITOK | M_ZERO); } -#endif /* * Allocate memory for building the header, fill it up, @@ -1446,10 +1436,8 @@ __elfN(coredump)(struct thread *td, struct vnode *vp, offset += php->p_filesz; php++; } -#ifdef GZIO - if (error == 0 && compress) - error = gzio_flush(params.gzs); -#endif + if (error == 0 && params.comp != NULL) + error = compressor_flush(params.comp); } if (error) { log(LOG_WARNING, @@ -1458,13 +1446,9 @@ __elfN(coredump)(struct thread *td, struct vnode *vp, } done: -#ifdef GZIO - if (compress) { - free(tmpbuf, M_TEMP); - if (params.gzs != NULL) - gzio_fini(params.gzs); - } -#endif + free(tmpbuf, M_TEMP); + if (params.comp != NULL) + compressor_fini(params.comp); while ((ninfo = TAILQ_FIRST(¬elst)) != NULL) { TAILQ_REMOVE(¬elst, ninfo, link); free(ninfo, M_TEMP); Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Mon Jan 8 20:14:16 2018 (r327706) +++ head/sys/kern/kern_shutdown.c Mon Jan 8 21:27:41 2018 (r327707) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" #include "opt_ekcd.h" -#include "opt_gzio.h" #include "opt_kdb.h" #include "opt_panic.h" #include "opt_sched.h" @@ -52,10 +51,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include -#include #include #include #include @@ -174,23 +173,21 @@ struct kerneldumpcrypto { }; #endif -#ifdef GZIO -struct kerneldumpgz { - struct gzio_stream *kdgz_stream; - uint8_t *kdgz_buf; - size_t kdgz_resid; +struct kerneldumpcomp { + struct compressor *kdc_stream; + uint8_t *kdc_buf; + size_t kdc_resid; }; -static struct kerneldumpgz *kerneldumpgz_create(struct dumperinfo *di, +static struct kerneldumpcomp *kerneldumpcomp_create(struct dumperinfo *di, uint8_t compression); -static void kerneldumpgz_destroy(struct dumperinfo *di); -static int kerneldumpgz_write_cb(void *cb, size_t len, off_t off, void *arg); +static void kerneldumpcomp_destroy(struct dumperinfo *di); +static int kerneldumpcomp_write_cb(void *base, size_t len, off_t off, void *arg); static int kerneldump_gzlevel = 6; SYSCTL_INT(_kern, OID_AUTO, kerneldump_gzlevel, CTLFLAG_RWTUN, &kerneldump_gzlevel, 0, - "Kernel crash dump gzip compression level"); -#endif /* GZIO */ + "Kernel crash dump compression level"); /* * Variable panicstr contains argument to first call to panic; used as flag @@ -986,39 +983,37 @@ kerneldumpcrypto_dumpkeysize(const struct kerneldumpcr } #endif /* EKCD */ -#ifdef GZIO -static struct kerneldumpgz * -kerneldumpgz_create(struct dumperinfo *di, uint8_t compression) +static struct kerneldumpcomp * +kerneldumpcomp_create(struct dumperinfo *di, uint8_t compression) { - struct kerneldumpgz *kdgz; + struct kerneldumpcomp *kdcomp; if (compression != KERNELDUMP_COMP_GZIP) return (NULL); - kdgz = malloc(sizeof(*kdgz), M_DUMPER, M_WAITOK | M_ZERO); - kdgz->kdgz_stream = gzio_init(kerneldumpgz_write_cb, GZIO_DEFLATE, - di->maxiosize, kerneldump_gzlevel, di); - if (kdgz->kdgz_stream == NULL) { - free(kdgz, M_DUMPER); + kdcomp = malloc(sizeof(*kdcomp), M_DUMPER, M_WAITOK | M_ZERO); + kdcomp->kdc_stream = compressor_init(kerneldumpcomp_write_cb, + COMPRESS_GZIP, di->maxiosize, kerneldump_gzlevel, di); + if (kdcomp->kdc_stream == NULL) { + free(kdcomp, M_DUMPER); return (NULL); } - kdgz->kdgz_buf = malloc(di->maxiosize, M_DUMPER, M_WAITOK | M_NODUMP); - return (kdgz); + kdcomp->kdc_buf = malloc(di->maxiosize, M_DUMPER, M_WAITOK | M_NODUMP); + return (kdcomp); } static void -kerneldumpgz_destroy(struct dumperinfo *di) +kerneldumpcomp_destroy(struct dumperinfo *di) { - struct kerneldumpgz *kdgz; + struct kerneldumpcomp *kdcomp; - kdgz = di->kdgz; - if (kdgz == NULL) + kdcomp = di->kdcomp; + if (kdcomp == NULL) return; - gzio_fini(kdgz->kdgz_stream); - explicit_bzero(kdgz->kdgz_buf, di->maxiosize); - free(kdgz->kdgz_buf, M_DUMPER); - free(kdgz, M_DUMPER); + compressor_fini(kdcomp->kdc_stream); + explicit_bzero(kdcomp->kdc_buf, di->maxiosize); + free(kdcomp->kdc_buf, M_DUMPER); + free(kdcomp, M_DUMPER); } -#endif /* GZIO */ /* Registration of dumpers */ int @@ -1041,14 +1036,14 @@ set_dumper(struct dumperinfo *di, const char *devname, return (EBUSY); dumper = *di; dumper.blockbuf = NULL; - dumper.kdc = NULL; - dumper.kdgz = NULL; + dumper.kdcrypto = NULL; + dumper.kdcomp = NULL; if (encryption != KERNELDUMP_ENC_NONE) { #ifdef EKCD - dumper.kdc = kerneldumpcrypto_create(di->blocksize, encryption, - key, encryptedkeysize, encryptedkey); - if (dumper.kdc == NULL) { + dumper.kdcrypto = kerneldumpcrypto_create(di->blocksize, + encryption, key, encryptedkeysize, encryptedkey); + if (dumper.kdcrypto == NULL) { error = EINVAL; goto cleanup; } @@ -1065,7 +1060,6 @@ set_dumper(struct dumperinfo *di, const char *devname, } if (compression != KERNELDUMP_COMP_NONE) { -#ifdef GZIO /* * We currently can't support simultaneous encryption and * compression. @@ -1074,31 +1068,25 @@ set_dumper(struct dumperinfo *di, const char *devname, error = EOPNOTSUPP; goto cleanup; } - dumper.kdgz = kerneldumpgz_create(&dumper, compression); - if (dumper.kdgz == NULL) { + dumper.kdcomp = kerneldumpcomp_create(&dumper, compression); + if (dumper.kdcomp == NULL) { error = EINVAL; goto cleanup; } -#else - error = EOPNOTSUPP; - goto cleanup; -#endif } dumper.blockbuf = malloc(di->blocksize, M_DUMPER, M_WAITOK | M_ZERO); return (0); cleanup: #ifdef EKCD - if (dumper.kdc != NULL) { - explicit_bzero(dumper.kdc, sizeof(*dumper.kdc) + - dumper.kdc->kdc_dumpkeysize); - free(dumper.kdc, M_EKCD); + if (dumper.kdcrypto != NULL) { + explicit_bzero(dumper.kdcrypto, sizeof(*dumper.kdcrypto) + + dumper.kdcrypto->kdc_dumpkeysize); + free(dumper.kdcrypto, M_EKCD); } #endif -#ifdef GZIO - kerneldumpgz_destroy(&dumper); -#endif + kerneldumpcomp_destroy(&dumper); if (dumper.blockbuf != NULL) { explicit_bzero(dumper.blockbuf, dumper.blocksize); @@ -1168,7 +1156,7 @@ dump_encrypted_write(struct dumperinfo *di, void *virt int error; size_t nbytes; - kdc = di->kdc; + kdc = di->kdcrypto; while (length > 0) { nbytes = MIN(length, sizeof(buf)); @@ -1194,7 +1182,7 @@ dump_write_key(struct dumperinfo *di, off_t offset) { struct kerneldumpcrypto *kdc; - kdc = di->kdc; + kdc = di->kdcrypto; if (kdc == NULL) return (0); return (dump_write(di, kdc->kdc_dumpkey, 0, offset, @@ -1202,9 +1190,8 @@ dump_write_key(struct dumperinfo *di, off_t offset) } #endif /* EKCD */ -#ifdef GZIO static int -kerneldumpgz_write_cb(void *base, size_t length, off_t offset, void *arg) +kerneldumpcomp_write_cb(void *base, size_t length, off_t offset, void *arg) { struct dumperinfo *di; size_t resid, rlength; @@ -1227,12 +1214,11 @@ kerneldumpgz_write_cb(void *base, size_t length, off_t } resid = length - rlength; memmove(di->blockbuf, (uint8_t *)base + rlength, resid); - di->kdgz->kdgz_resid = resid; + di->kdcomp->kdc_resid = resid; return (EAGAIN); } return (_dump_append(di, base, 0, length)); } -#endif /* GZIO */ /* * Write a kerneldumpheader at the specified offset. The header structure is 512 @@ -1290,10 +1276,10 @@ dump_start(struct dumperinfo *di, struct kerneldumphea uint32_t keysize; #ifdef EKCD - int error = kerneldumpcrypto_init(di->kdc); + int error = kerneldumpcrypto_init(di->kdcrypto); if (error != 0) return (error); - keysize = kerneldumpcrypto_dumpkeysize(di->kdc); + keysize = kerneldumpcrypto_dumpkeysize(di->kdcrypto); #else keysize = 0; #endif @@ -1301,8 +1287,7 @@ dump_start(struct dumperinfo *di, struct kerneldumphea dumpextent = dtoh64(kdh->dumpextent); if (di->mediasize < SIZEOF_METADATA + dumpextent + 2 * di->blocksize + keysize) { -#ifdef GZIO - if (di->kdgz != NULL) { + if (di->kdcomp != NULL) { /* * We don't yet know how much space the compressed dump * will occupy, so try to use the whole swap partition @@ -1315,7 +1300,6 @@ dump_start(struct dumperinfo *di, struct kerneldumphea 2 * di->blocksize - keysize; kdh->dumpextent = htod64(dumpextent); } else -#endif return (E2BIG); } @@ -1333,7 +1317,7 @@ _dump_append(struct dumperinfo *di, void *virtual, vm_ int error; #ifdef EKCD - if (di->kdc != NULL) + if (di->kdcrypto != NULL) error = dump_encrypted_write(di, virtual, physical, di->dumpoff, length); else @@ -1353,18 +1337,16 @@ int dump_append(struct dumperinfo *di, void *virtual, vm_offset_t physical, size_t length) { -#ifdef GZIO void *buf; - if (di->kdgz != NULL) { - /* Bounce through a buffer to avoid gzip CRC errors. */ + if (di->kdcomp != NULL) { + /* Bounce through a buffer to avoid CRC errors. */ if (length > di->maxiosize) return (EINVAL); - buf = di->kdgz->kdgz_buf; + buf = di->kdcomp->kdc_buf; memmove(buf, virtual, length); - return (gzio_write(di->kdgz->kdgz_stream, buf, length)); + return (compressor_write(di->kdcomp->kdc_stream, buf, length)); } -#endif return (_dump_append(di, virtual, physical, length)); } @@ -1399,20 +1381,19 @@ dump_finish(struct dumperinfo *di, struct kerneldumphe extent = dtoh64(kdh->dumpextent); #ifdef EKCD - keysize = kerneldumpcrypto_dumpkeysize(di->kdc); + keysize = kerneldumpcrypto_dumpkeysize(di->kdcrypto); #else keysize = 0; #endif -#ifdef GZIO - if (di->kdgz != NULL) { - error = gzio_flush(di->kdgz->kdgz_stream); + if (di->kdcomp != NULL) { + error = compressor_flush(di->kdcomp->kdc_stream); if (error == EAGAIN) { /* We have residual data in di->blockbuf. */ error = dump_write(di, di->blockbuf, 0, di->dumpoff, di->blocksize); - di->dumpoff += di->kdgz->kdgz_resid; - di->kdgz->kdgz_resid = 0; + di->dumpoff += di->kdcomp->kdc_resid; + di->kdcomp->kdc_resid = 0; } if (error != 0) return (error); @@ -1426,9 +1407,8 @@ dump_finish(struct dumperinfo *di, struct kerneldumphe kdh->parity = 0; kdh->parity = kerneldump_parity(kdh); - gzio_reset(di->kdgz->kdgz_stream); + compressor_reset(di->kdcomp->kdc_stream); } -#endif /* * Write kerneldump headers at the beginning and end of the dump extent. @@ -1471,7 +1451,7 @@ dump_init_header(const struct dumperinfo *di, struct k kdh->dumpextent = kdh->dumplength; kdh->dumptime = htod64(time_second); #ifdef EKCD - kdh->dumpkeysize = htod32(kerneldumpcrypto_dumpkeysize(di->kdc)); + kdh->dumpkeysize = htod32(kerneldumpcrypto_dumpkeysize(di->kdcrypto)); #else kdh->dumpkeysize = 0; #endif @@ -1482,10 +1462,8 @@ dump_init_header(const struct dumperinfo *di, struct k kdh->versionstring[dstsize - 2] = '\n'; if (panicstr != NULL) strlcpy(kdh->panicstring, panicstr, sizeof(kdh->panicstring)); -#ifdef GZIO - if (di->kdgz != NULL) + if (di->kdcomp != NULL) kdh->compression = KERNELDUMP_COMP_GZIP; -#endif kdh->parity = kerneldump_parity(kdh); } Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Mon Jan 8 20:14:16 2018 (r327706) +++ head/sys/kern/kern_sig.c Mon Jan 8 21:27:41 2018 (r327707) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" -#include "opt_gzio.h" #include "opt_ktrace.h" #include @@ -51,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -3255,18 +3255,31 @@ SYSCTL_PROC(_debug, OID_AUTO, ncores, CTLTYPE_INT|CTLF #define GZ_SUFFIX ".gz" -#ifdef GZIO -static int compress_user_cores = 1; -SYSCTL_INT(_kern, OID_AUTO, compress_user_cores, CTLFLAG_RWTUN, - &compress_user_cores, 0, "Compression of user corefiles"); +int compress_user_cores = 0; -int compress_user_cores_gzlevel = 6; -SYSCTL_INT(_kern, OID_AUTO, compress_user_cores_gzlevel, CTLFLAG_RWTUN, - &compress_user_cores_gzlevel, 0, "Corefile gzip compression level"); -#else -static int compress_user_cores = 0; -#endif +static int +sysctl_compress_user_cores(SYSCTL_HANDLER_ARGS) +{ + int error, val; + val = compress_user_cores; + error = sysctl_handle_int(oidp, &val, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if (val != 0 && !compressor_avail(val)) + return (EINVAL); + compress_user_cores = val; + return (error); +} +SYSCTL_PROC(_kern, OID_AUTO, compress_user_cores, CTLTYPE_INT | CTLFLAG_RWTUN, + 0, sizeof(int), sysctl_compress_user_cores, "I", + "Enable compression of user corefiles (" __XSTRING(COMPRESS_GZIP) " = gzip)"); + +int compress_user_cores_level = 6; +SYSCTL_INT(_kern, OID_AUTO, compress_user_cores_level, CTLFLAG_RWTUN, + &compress_user_cores_level, 0, + "Corefile compression level"); + /* * Protect the access to corefilename[] by allproc_lock. */ @@ -3363,7 +3376,7 @@ corefile_open(const char *comm, uid_t uid, pid_t pid, } sx_sunlock(&corefilename_lock); free(hostname, M_TEMP); - if (compress) + if (compress == COMPRESS_GZIP) sbuf_printf(&sb, GZ_SUFFIX); if (sbuf_error(&sb) != 0) { log(LOG_ERR, "pid %ld (%s), uid (%lu): corename is too " @@ -3529,8 +3542,7 @@ coredump(struct thread *td) PROC_UNLOCK(p); if (p->p_sysent->sv_coredump != NULL) { - error = p->p_sysent->sv_coredump(td, vp, limit, - compress_user_cores ? IMGACT_CORE_COMPRESS : 0); + error = p->p_sysent->sv_coredump(td, vp, limit, 0); } else { error = ENOSYS; } Copied and modified: head/sys/kern/subr_compressor.c (from r327706, head/sys/kern/kern_gzio.c) ============================================================================== --- head/sys/kern/kern_gzio.c Mon Jan 8 20:14:16 2018 (r327706, copy source) +++ head/sys/kern/subr_compressor.c Mon Jan 8 21:27:41 2018 (r327707) @@ -1,6 +1,8 @@ /*- - * Copyright (c) 2014 Mark Johnston + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * + * Copyright (c) 2014, 2017 Mark Johnston + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -24,56 +26,88 @@ * SUCH DAMAGE. */ +/* + * Subroutines used for writing compressed user process and kernel core dumps. + */ + #include __FBSDID("$FreeBSD$"); +#include "opt_gzio.h" + #include -#include +#include #include +#include #include -#include -#define KERN_GZ_HDRLEN 10 /* gzip header length */ -#define KERN_GZ_TRAILERLEN 8 /* gzip trailer length */ -#define KERN_GZ_MAGIC1 0x1f /* first magic byte */ -#define KERN_GZ_MAGIC2 0x8b /* second magic byte */ +MALLOC_DEFINE(M_COMPRESS, "compressor", "kernel compression subroutines"); -MALLOC_DEFINE(M_GZIO, "gzio", "zlib state"); +struct compressor_methods { + int format; + void *(* const init)(size_t, int); + void (* const reset)(void *); + int (* const write)(void *, void *, size_t, compressor_cb_t, void *); + void (* const fini)(void *); +}; -struct gzio_stream { - uint8_t * gz_buffer; /* output buffer */ - size_t gz_bufsz; /* total buffer size */ +struct compressor { + const struct compressor_methods *methods; + compressor_cb_t cb; + void *priv; + void *arg; +}; + +SET_DECLARE(compressors, struct compressor_methods); + +#ifdef GZIO + +#include + +struct gz_stream { + uint8_t *gz_buffer; /* output buffer */ + size_t gz_bufsz; /* output buffer size */ off_t gz_off; /* offset into the output stream */ - enum gzio_mode gz_mode; /* stream mode */ uint32_t gz_crc; /* stream CRC32 */ - gzio_cb gz_cb; /* output callback */ - void * gz_arg; /* private callback arg */ z_stream gz_stream; /* zlib state */ }; -static void * gz_alloc(void *, u_int, u_int); -static void gz_free(void *, void *); -static int gz_write(struct gzio_stream *, void *, u_int, int); +static void *gz_init(size_t maxiosize, int level); +static void gz_reset(void *stream); +static int gz_write(void *stream, void *data, size_t len, compressor_cb_t, + void *); +static void gz_fini(void *stream); -struct gzio_stream * -gzio_init(gzio_cb cb, enum gzio_mode mode, size_t bufsz, int level, void *arg) +static void * +gz_alloc(void *arg __unused, u_int n, u_int sz) { - struct gzio_stream *s; - int error; - if (bufsz < KERN_GZ_HDRLEN) - return (NULL); - if (mode != GZIO_DEFLATE) - return (NULL); + /* + * Memory for zlib state is allocated using M_NODUMP since it may be + * used to compress a kernel dump, and we don't want zlib to attempt to + * compress its own state. + */ + return (malloc(n * sz, M_COMPRESS, M_WAITOK | M_ZERO | M_NODUMP)); +} - s = gz_alloc(NULL, 1, sizeof(*s)); - s->gz_bufsz = bufsz; - s->gz_buffer = gz_alloc(NULL, 1, s->gz_bufsz); - s->gz_mode = mode; - s->gz_cb = cb; - s->gz_arg = arg; +static void +gz_free(void *arg __unused, void *ptr) +{ + free(ptr, M_COMPRESS); +} + +static void * +gz_init(size_t maxiosize, int level) +{ + struct gz_stream *s; + int error; + + s = gz_alloc(NULL, 1, roundup2(sizeof(*s), PAGE_SIZE)); + s->gz_buffer = gz_alloc(NULL, 1, maxiosize); + s->gz_bufsz = maxiosize; + s->gz_stream.zalloc = gz_alloc; s->gz_stream.zfree = gz_free; s->gz_stream.opaque = NULL; @@ -85,98 +119,57 @@ gzio_init(gzio_cb cb, enum gzio_mode mode, size_t bufs if (error != 0) goto fail; - gzio_reset(s); + gz_reset(s); return (s); fail: - gz_free(NULL, s->gz_buffer); gz_free(NULL, s); return (NULL); } -void -gzio_reset(struct gzio_stream *s) +static void +gz_reset(void *stream) { + struct gz_stream *s; uint8_t *hdr; + const size_t hdrlen = 10; - (void)deflateReset(&s->gz_stream); - + s = stream; s->gz_off = 0; s->gz_crc = ~0U; + (void)deflateReset(&s->gz_stream); s->gz_stream.avail_out = s->gz_bufsz; s->gz_stream.next_out = s->gz_buffer; /* Write the gzip header to the output buffer. */ hdr = s->gz_buffer; - memset(hdr, 0, KERN_GZ_HDRLEN); - hdr[0] = KERN_GZ_MAGIC1; - hdr[1] = KERN_GZ_MAGIC2; + memset(hdr, 0, hdrlen); + hdr[0] = 0x1f; + hdr[1] = 0x8b; hdr[2] = Z_DEFLATED; hdr[9] = OS_CODE; - s->gz_stream.next_out += KERN_GZ_HDRLEN; - s->gz_stream.avail_out -= KERN_GZ_HDRLEN; + s->gz_stream.next_out += hdrlen; + s->gz_stream.avail_out -= hdrlen; } -int -gzio_write(struct gzio_stream *s, void *data, u_int len) -{ - - return (gz_write(s, data, len, Z_NO_FLUSH)); -} - -int -gzio_flush(struct gzio_stream *s) -{ - - return (gz_write(s, NULL, 0, Z_FINISH)); -} - -void -gzio_fini(struct gzio_stream *s) -{ - - (void)deflateEnd(&s->gz_stream); - gz_free(NULL, s->gz_buffer); - gz_free(NULL, s); -} - -static void * -gz_alloc(void *arg __unused, u_int n, u_int sz) -{ - - /* - * Memory for zlib state is allocated using M_NODUMP since it may be - * used to compress a kernel dump, and we don't want zlib to attempt to - * compress its own state. - */ - return (malloc(n * sz, M_GZIO, M_WAITOK | M_ZERO | M_NODUMP)); -} - -static void -gz_free(void *arg __unused, void *ptr) -{ - - free(ptr, M_GZIO); -} - static int -gz_write(struct gzio_stream *s, void *buf, u_int len, int zflag) +gz_write(void *stream, void *data, size_t len, compressor_cb_t cb, + void *arg) { - uint8_t trailer[KERN_GZ_TRAILERLEN]; + struct gz_stream *s; + uint8_t trailer[8]; size_t room; - int error, zerror; + int error, zerror, zflag; - KASSERT(zflag == Z_FINISH || zflag == Z_NO_FLUSH, - ("unexpected flag %d", zflag)); - KASSERT(s->gz_mode == GZIO_DEFLATE, - ("invalid stream mode %d", s->gz_mode)); + s = stream; + zflag = data == NULL ? Z_FINISH : Z_NO_FLUSH; if (len > 0) { s->gz_stream.avail_in = len; - s->gz_stream.next_in = buf; - s->gz_crc = crc32_raw(buf, len, s->gz_crc); + s->gz_stream.next_in = data; + s->gz_crc = crc32_raw(data, len, s->gz_crc); } else s->gz_crc ^= ~0U; @@ -202,14 +195,13 @@ gz_write(struct gzio_stream *s, void *buf, u_int len, ((uint32_t *)trailer)[0] = s->gz_crc; ((uint32_t *)trailer)[1] = s->gz_stream.total_in; - room = MIN(KERN_GZ_TRAILERLEN, + room = MIN(sizeof(trailer), s->gz_bufsz - len); memcpy(s->gz_buffer + len, trailer, room); len += room; } - error = s->gz_cb(s->gz_buffer, len, s->gz_off, - s->gz_arg); + error = cb(s->gz_buffer, len, s->gz_off, arg); if (error != 0) break; @@ -221,13 +213,103 @@ gz_write(struct gzio_stream *s, void *buf, u_int len, * If we couldn't pack the trailer into the output * buffer, write it out now. */ - if (zerror == Z_STREAM_END && room < KERN_GZ_TRAILERLEN) - error = s->gz_cb(trailer + room, - KERN_GZ_TRAILERLEN - room, s->gz_off, - s->gz_arg); + if (zerror == Z_STREAM_END && room < sizeof(trailer)) + error = cb(trailer + room, + sizeof(trailer) - room, s->gz_off, arg); } } while (zerror != Z_STREAM_END && (zflag == Z_FINISH || s->gz_stream.avail_in > 0)); return (error); +} + +static void +gz_fini(void *stream) +{ + struct gz_stream *s; + + s = stream; + (void)deflateEnd(&s->gz_stream); + gz_free(NULL, s->gz_buffer); + gz_free(NULL, s); +} + +struct compressor_methods gzip_methods = { + .format = COMPRESS_GZIP, + .init = gz_init, + .reset = gz_reset, + .write = gz_write, + .fini = gz_fini, +}; +DATA_SET(compressors, gzip_methods); + +#endif /* GZIO */ + +bool +compressor_avail(int format) +{ + struct compressor_methods **iter; + + SET_FOREACH(iter, compressors) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Jan 9 00:00:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 744B0E6CBDE; Tue, 9 Jan 2018 00:00:56 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FEC07BF6B; Tue, 9 Jan 2018 00:00:56 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 916087000; Tue, 9 Jan 2018 00:00:55 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0900twW068920; Tue, 9 Jan 2018 00:00:55 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0900t4Y068919; Tue, 9 Jan 2018 00:00:55 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201801090000.w0900t4Y068919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Tue, 9 Jan 2018 00:00:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327709 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 327709 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 00:00:56 -0000 Author: scottl Date: Tue Jan 9 00:00:55 2018 New Revision: 327709 URL: https://svnweb.freebsd.org/changeset/base/327709 Log: Protect against a possible NULL deference from an accessor function. Obtained from: Netflix Modified: head/sys/cam/cam_periph.h Modified: head/sys/cam/cam_periph.h ============================================================================== --- head/sys/cam/cam_periph.h Mon Jan 8 22:59:36 2018 (r327708) +++ head/sys/cam/cam_periph.h Tue Jan 9 00:00:55 2018 (r327709) @@ -202,7 +202,10 @@ int cam_periph_error(union ccb *ccb, cam_flags camfla static __inline struct mtx * cam_periph_mtx(struct cam_periph *periph) { - return (xpt_path_mtx(periph->path)); + if (periph != NULL) + return (xpt_path_mtx(periph->path)); + else + return (NULL); } #define cam_periph_owned(periph) \ From owner-svn-src-head@freebsd.org Tue Jan 9 00:11:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 780C0E6DA76; Tue, 9 Jan 2018 00:11:00 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5326D7C82E; Tue, 9 Jan 2018 00:11:00 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A739271AF; Tue, 9 Jan 2018 00:10:59 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w090Axab071499; Tue, 9 Jan 2018 00:10:59 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w090AxKX071496; Tue, 9 Jan 2018 00:10:59 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201801090010.w090AxKX071496@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Tue, 9 Jan 2018 00:10:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327710 - in head/sys/cam: . ata scsi X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in head/sys/cam: . ata scsi X-SVN-Commit-Revision: 327710 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 00:11:00 -0000 Author: scottl Date: Tue Jan 9 00:10:59 2018 New Revision: 327710 URL: https://svnweb.freebsd.org/changeset/base/327710 Log: Don't hold the periph lock when calling into cam_periph_runccb() from the ada and da dump routines. This avoids difficult locking problems from needing to be handled. While it might seem like this would leave the periphs unprotected during dump, they were aleady at risk of unexpected removal due to the dump functions not keeping refcount state across the many calls that come in during a dump. This is an exercise for future work. Obtained from: Netflix Modified: head/sys/cam/ata/ata_da.c head/sys/cam/cam_periph.c head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Tue Jan 9 00:00:55 2018 (r327709) +++ head/sys/cam/ata/ata_da.c Tue Jan 9 00:10:59 2018 (r327710) @@ -1062,15 +1062,12 @@ adadump(void *arg, void *virtual, vm_offset_t physical dp = arg; periph = dp->d_drv1; softc = (struct ada_softc *)periph->softc; - cam_periph_lock(periph); secsize = softc->params.secsize; lba = offset / secsize; count = length / secsize; - if ((periph->flags & CAM_PERIPH_INVALID) != 0) { - cam_periph_unlock(periph); + if ((periph->flags & CAM_PERIPH_INVALID) != 0) return (ENXIO); - } memset(&ataio, 0, sizeof(ataio)); if (length > 0) { @@ -1098,7 +1095,6 @@ adadump(void *arg, void *virtual, vm_offset_t physical if (error != 0) printf("Aborting dump due to I/O error.\n"); - cam_periph_unlock(periph); return (error); } @@ -1129,7 +1125,6 @@ adadump(void *arg, void *virtual, vm_offset_t physical if (error != 0) xpt_print(periph->path, "Synchronize cache failed\n"); } - cam_periph_unlock(periph); return (error); } Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Tue Jan 9 00:00:55 2018 (r327709) +++ head/sys/cam/cam_periph.c Tue Jan 9 00:10:59 2018 (r327710) @@ -1160,8 +1160,6 @@ cam_periph_runccb(union ccb *ccb, struct bintime ltime; int error; bool must_poll; - struct mtx *periph_mtx; - struct cam_periph *periph; uint32_t timeout = 1; starttime = NULL; @@ -1188,20 +1186,20 @@ cam_periph_runccb(union ccb *ccb, * stopped for dumping, except when we call doadump from ddb. While the * scheduler is running in this case, we still need to poll the I/O to * avoid sleeping waiting for the ccb to complete. + * + * XXX To avoid locking problems, dumping/polling callers must call + * without a periph lock held. */ must_poll = dumping; ccb->ccb_h.cbfcnp = cam_periph_done; - periph = xpt_path_periph(ccb->ccb_h.path); - periph_mtx = cam_periph_mtx(periph); /* * If we're polling, then we need to ensure that we have ample resources - * in the periph. We also need to drop the periph lock while we're polling. + * in the periph. * cam_periph_error can reschedule the ccb by calling xpt_action and returning * ERESTART, so we have to effect the polling in the do loop below. */ if (must_poll) { - mtx_unlock(periph_mtx); timeout = xpt_poll_setup(ccb); } @@ -1226,9 +1224,6 @@ cam_periph_runccb(union ccb *ccb, error = 0; } while (error == ERESTART); } - - if (must_poll) - mtx_lock(periph_mtx); if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { cam_release_devq(ccb->ccb_h.path, Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Tue Jan 9 00:00:55 2018 (r327709) +++ head/sys/cam/scsi/scsi_da.c Tue Jan 9 00:10:59 2018 (r327710) @@ -1647,13 +1647,10 @@ dadump(void *arg, void *virtual, vm_offset_t physical, dp = arg; periph = dp->d_drv1; softc = (struct da_softc *)periph->softc; - cam_periph_lock(periph); secsize = softc->params.secsize; - if ((softc->flags & DA_FLAG_PACK_INVALID) != 0) { - cam_periph_unlock(periph); + if ((softc->flags & DA_FLAG_PACK_INVALID) != 0) return (ENXIO); - } memset(&csio, 0, sizeof(csio)); if (length > 0) { @@ -1676,7 +1673,6 @@ dadump(void *arg, void *virtual, vm_offset_t physical, 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); if (error != 0) printf("Aborting dump due to I/O error.\n"); - cam_periph_unlock(periph); return (error); } @@ -1700,7 +1696,6 @@ dadump(void *arg, void *virtual, vm_offset_t physical, if (error != 0) xpt_print(periph->path, "Synchronize cache failed\n"); } - cam_periph_unlock(periph); return (error); } From owner-svn-src-head@freebsd.org Tue Jan 9 00:17:16 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3B2BE6DEE0; Tue, 9 Jan 2018 00:17:16 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AF9777CBA2; Tue, 9 Jan 2018 00:17:16 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA858730F; Tue, 9 Jan 2018 00:17:15 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w090HFCO074104; Tue, 9 Jan 2018 00:17:15 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w090HFkx074103; Tue, 9 Jan 2018 00:17:15 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201801090017.w090HFkx074103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Tue, 9 Jan 2018 00:17:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327711 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 327711 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 00:17:16 -0000 Author: scottl Date: Tue Jan 9 00:17:15 2018 New Revision: 327711 URL: https://svnweb.freebsd.org/changeset/base/327711 Log: Don't hold the periph locks during dump. Obtained from: Netflix Modified: head/sys/cam/nvme/nvme_da.c Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Tue Jan 9 00:10:59 2018 (r327710) +++ head/sys/cam/nvme/nvme_da.c Tue Jan 9 00:17:15 2018 (r327711) @@ -388,15 +388,12 @@ ndadump(void *arg, void *virtual, vm_offset_t physical dp = arg; periph = dp->d_drv1; softc = (struct nda_softc *)periph->softc; - cam_periph_lock(periph); secsize = softc->disk->d_sectorsize; lba = offset / secsize; count = length / secsize; - if ((periph->flags & CAM_PERIPH_INVALID) != 0) { - cam_periph_unlock(periph); + if ((periph->flags & CAM_PERIPH_INVALID) != 0) return (ENXIO); - } /* xpt_get_ccb returns a zero'd allocation for the ccb, mimic that here */ memset(&nvmeio, 0, sizeof(nvmeio)); @@ -408,7 +405,6 @@ ndadump(void *arg, void *virtual, vm_offset_t physical 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); if (error != 0) printf("Aborting dump due to I/O error %d.\n", error); - cam_periph_unlock(periph); return (error); } @@ -422,7 +418,6 @@ ndadump(void *arg, void *virtual, vm_offset_t physical 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); if (error != 0) xpt_print(periph->path, "flush cmd failed\n"); - cam_periph_unlock(periph); return (error); } From owner-svn-src-head@freebsd.org Tue Jan 9 01:47:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92E18E7573D; Tue, 9 Jan 2018 01:47:49 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B4348165D; Tue, 9 Jan 2018 01:47:49 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w091lkck024683; Mon, 8 Jan 2018 17:47:46 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w091lkxB024682; Mon, 8 Jan 2018 17:47:46 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201801090147.w091lkxB024682@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r327699 - head/sys/sys In-Reply-To: To: Pedro Giffuni Date: Mon, 8 Jan 2018 17:47:46 -0800 (PST) CC: rgrimes@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 01:47:49 -0000 [ Charset UTF-8 unsupported, converting... ] > > On 08/01/2018 11:09, Rodney W. Grimes wrote: > >> Author: pfg > >> Date: Mon Jan 8 15:54:29 2018 > >> New Revision: 327699 > >> URL: https://svnweb.freebsd.org/changeset/base/327699 > >> > >> Log: > >> Revert r327697: > >> malloc(9): drop the __result_use_check attribute for the kernel allocator. > >> > >> My bad: __result_use_check just checks the for the general and we always > >> want to make sure allocated memory is used, not only checked for nullness. > >> > >> Add it to reallocf since that was missing. > > Please try not to combine a revert with an add, it makes it messy > > to try and figure out things in the future when only the svn log > > is being used to analyze stuff as digging in mail archives becomes > > painful. > > > > Revert, then commit the add standalone, is the better sequence in > > this type of situation. > > Not that any of this is defined in our committers guide but IMHO "svn > revert" is just a tool, pretty much as "svn move" and "svn copy". The > idea is to make a committers' life easier: making two commits for such a > simple change is not "easier". It is easier for other commiters to clearly see now, and in the future, exactly what was what. Please do not only think of yourself making the commit, think of all the others that try to read the diffs and understand exactly what is being done and why it is being done. By seperating the revert from the change one reading these can quickly go, yep that simple reverted what was done and move past it. And then when the commit for the new change comes in it is clear that yes, that does exactly what it says it does. Also your now forced to merge a bad commit, and a revert of that bad commit+delta to do a MFC. If this had been done with a pure revert only and then a commit of the correct fix you could of just merged the correct fix. > > In this case the change is rather consistent: I added __result_use_check > to the three functions that needed it. The change is mixed in with the noise of a revert. > The commit log is not only clear on why the revert happened but also > explains the additional one line change. I did not say the commit log was unclear, your correct, it is clear, I am saying that the operation mechanism here is general just a poor way to work in a vcs. > When I MFC it, I will merge both changes for repository consistency but > the log will basically mention that I am adding __result_use_check to > reallocf(). And what well the mergeinfo be? > > Pedro. > >> Modified: > >> head/sys/sys/malloc.h > >> > >> Modified: head/sys/sys/malloc.h > >> ============================================================================== > >> --- head/sys/sys/malloc.h Mon Jan 8 15:41:49 2018 (r327698) > >> +++ head/sys/sys/malloc.h Mon Jan 8 15:54:29 2018 (r327699) > >> @@ -176,7 +176,7 @@ void *contigmalloc(unsigned long size, struct malloc_t > >> __alloc_size(1) __alloc_align(6); > >> void free(void *addr, struct malloc_type *type); > >> void *malloc(unsigned long size, struct malloc_type *type, int flags) > >> - __malloc_like __alloc_size(1); > >> + __malloc_like __result_use_check __alloc_size(1); > >> void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, > >> int flags) __malloc_like __result_use_check > >> __alloc_size(1) __alloc_size(2); > >> @@ -187,9 +187,9 @@ void malloc_type_freed(struct malloc_type *type, unsig > >> void malloc_type_list(malloc_type_list_func_t *, void *); > >> void malloc_uninit(void *); > >> void *realloc(void *addr, unsigned long size, struct malloc_type *type, > >> - int flags) __alloc_size(2); > >> + int flags) __result_use_check __alloc_size(2); > >> void *reallocf(void *addr, unsigned long size, struct malloc_type *type, > >> - int flags) __alloc_size(2); > >> + int flags) __result_use_check __alloc_size(2); > >> > >> struct malloc_type *malloc_desc2type(const char *desc); > >> #endif /* _KERNEL */ > >> > >> > > Pedro. > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Tue Jan 9 02:08:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA1A6E77667; Tue, 9 Jan 2018 02:08:19 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 85BCB828B1; Tue, 9 Jan 2018 02:08:19 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w0928Ihr024761; Mon, 8 Jan 2018 18:08:18 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w0928IvH024760; Mon, 8 Jan 2018 18:08:18 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201801090208.w0928IvH024760@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r327699 - head/sys/sys In-Reply-To: <89964e3f-a982-f0e5-a7ff-9c13a5ebe61c@FreeBSD.org> To: Pedro Giffuni Date: Mon, 8 Jan 2018 18:08:18 -0800 (PST) CC: cem@freebsd.org, src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 02:08:19 -0000 [ Charset UTF-8 unsupported, converting... ] > Hello; > > On 08/01/2018 15:27, Conrad Meyer wrote: > > I'm (again, atypically) with rgrimes here. Revert has a specific > > meaning and shouldn't be used like this. Making a commit with the > > subject "Revert rXXX" that does more than just "svn revert rXXX" makes > > life harder for developers looking at code history after you. Making > > two separate commits for two different changes (revert, then add the > > annotation) is not burdensome. > > > > Best, > > Conrad > > Yeah, I understand where that comes from and I will take it into account > for future commits, but I think it should be *documented* and not assume > that everybody?s I agree, we should have a section in the commiters guide on doing reverts. We should also have one on how to merge code to other branches and how to format commit messages for merged code. Most of these things should be taught during mentorship, perhaps even a check list for mentor/mentee to make sure they have done most, if not all, of some specific set of things before they are releaesed. I would also like to see a standardize of the revert log format by adding a Revert: line to the template so that it is there in a very standard form that this reverts revision rXXXXXX > thinks that is the way version control is supposed to be > used. My background taught me that this is how document control should be used. Vcs is just an automated form of document control. We should also try to do more seperatation of style changes vs functional changes. It just makes things easier to both review and understand. Same with a function add done with a refactor of code, mixing the two in one commit, even in one differential review, makes it harder to understand what is just simply a refactor, and what is the new code. Nothing wrong with making 3 commits in a row to the same area, style, refactor, functional change. This makes it very easy to analyze the changes and IMHO could reduce the rate of breakage. I believe phabricator has the tooling to stack these as well? Dependent diffs or some such thing? > Pedro. > > > On Mon, Jan 8, 2018 at 12:18 PM, Pedro Giffuni wrote: > >> On 08/01/2018 11:09, Rodney W. Grimes wrote: > >>>> Author: pfg > >>>> Date: Mon Jan 8 15:54:29 2018 > >>>> New Revision: 327699 > >>>> URL: https://svnweb.freebsd.org/changeset/base/327699 > >>>> > >>>> Log: > >>>> Revert r327697: > >>>> malloc(9): drop the __result_use_check attribute for the kernel > >>>> allocator. > >>>> My bad: __result_use_check just checks the for the general and we > >>>> always > >>>> want to make sure allocated memory is used, not only checked for > >>>> nullness. > >>>> Add it to reallocf since that was missing. > >>> Please try not to combine a revert with an add, it makes it messy > >>> to try and figure out things in the future when only the svn log > >>> is being used to analyze stuff as digging in mail archives becomes > >>> painful. > >>> > >>> Revert, then commit the add standalone, is the better sequence in > >>> this type of situation. > >> > >> Not that any of this is defined in our committers guide but IMHO "svn > >> revert" is just a tool, pretty much as "svn move" and "svn copy". The idea > >> is to make a committers' life easier: making two commits for such a simple > >> change is not "easier". > >> > >> In this case the change is rather consistent: I added __result_use_check to > >> the three functions that needed it. > >> The commit log is not only clear on why the revert happened but also > >> explains the additional one line change. > >> > >> When I MFC it, I will merge both changes for repository consistency but the > >> log will basically mention that I am adding __result_use_check to > >> reallocf(). > >> > >> > >> Pedro. > >> > >>>> Modified: > >>>> head/sys/sys/malloc.h > >>>> > >>>> Modified: head/sys/sys/malloc.h > >>>> > >>>> ============================================================================== > >>>> --- head/sys/sys/malloc.h Mon Jan 8 15:41:49 2018 (r327698) > >>>> +++ head/sys/sys/malloc.h Mon Jan 8 15:54:29 2018 (r327699) > >>>> @@ -176,7 +176,7 @@ void *contigmalloc(unsigned long size, struct > >>>> malloc_t > >>>> __alloc_size(1) __alloc_align(6); > >>>> void free(void *addr, struct malloc_type *type); > >>>> void *malloc(unsigned long size, struct malloc_type *type, int flags) > >>>> - __malloc_like __alloc_size(1); > >>>> + __malloc_like __result_use_check __alloc_size(1); > >>>> void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, > >>>> int flags) __malloc_like __result_use_check > >>>> __alloc_size(1) __alloc_size(2); > >>>> @@ -187,9 +187,9 @@ void malloc_type_freed(struct malloc_type > >>>> *type, unsig > >>>> void malloc_type_list(malloc_type_list_func_t *, void *); > >>>> void malloc_uninit(void *); > >>>> void *realloc(void *addr, unsigned long size, struct malloc_type > >>>> *type, > >>>> - int flags) __alloc_size(2); > >>>> + int flags) __result_use_check __alloc_size(2); > >>>> void *reallocf(void *addr, unsigned long size, struct malloc_type > >>>> *type, > >>>> - int flags) __alloc_size(2); > >>>> + int flags) __result_use_check __alloc_size(2); > >>>> struct malloc_type *malloc_desc2type(const char *desc); > >>>> #endif /* _KERNEL */ > >>>> > >>>> > >> Pedro. > >> > > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Tue Jan 9 03:28:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23704E7DB7E; Tue, 9 Jan 2018 03:28:25 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 009E92FCD; Tue, 9 Jan 2018 03:28:25 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58ED611602; Tue, 9 Jan 2018 03:28:24 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w093SOUs053960; Tue, 9 Jan 2018 03:28:24 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w093SOVW053959; Tue, 9 Jan 2018 03:28:24 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201801090328.w093SOVW053959@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 9 Jan 2018 03:28:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327715 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 327715 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 03:28:25 -0000 Author: cem Date: Tue Jan 9 03:28:24 2018 New Revision: 327715 URL: https://svnweb.freebsd.org/changeset/base/327715 Log: Fix Zstd kernel build with GCC 4.2 By disabling the -Winline warning. Fixes the powerpc and sparc64 build after r327706. Note: MIPS and RISCV builds still broken due to absense of __ctzdi2 (aka __builtin_ctzll) in their libgcc or libcompiler-rt libraries. Reported by: markj Sponsored by: Dell EMC Isilon Modified: head/sys/conf/kern.pre.mk Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Tue Jan 9 01:41:55 2018 (r327714) +++ head/sys/conf/kern.pre.mk Tue Jan 9 03:28:24 2018 (r327715) @@ -133,7 +133,7 @@ NORMAL_FWO= ${LD} -b binary --no-warn-mismatch -d -war -m ${LD_EMULATION} -o ${.TARGET} ${.ALLSRC:M*.fw} # for ZSTD in the kernel (include zstd/lib/freebsd before other CFLAGS) -ZSTD_C= ${CC} -c -DZSTD_HEAPMODE=1 -I$S/contrib/zstd/lib/freebsd ${CFLAGS} -I$S/contrib/zstd/lib -I$S/contrib/zstd/lib/common ${WERROR} -Wno-missing-prototypes ${PROF} ${.IMPSRC} +ZSTD_C= ${CC} -c -DZSTD_HEAPMODE=1 -I$S/contrib/zstd/lib/freebsd ${CFLAGS} -I$S/contrib/zstd/lib -I$S/contrib/zstd/lib/common ${WERROR} -Wno-inline -Wno-missing-prototypes ${PROF} ${.IMPSRC} # Common for dtrace / zfs CDDL_CFLAGS= -DFREEBSD_NAMECACHE -nostdinc -I$S/cddl/compat/opensolaris -I$S/cddl/contrib/opensolaris/uts/common -I$S -I$S/cddl/contrib/opensolaris/common ${CFLAGS} -Wno-unknown-pragmas -Wno-missing-prototypes -Wno-undef -Wno-strict-prototypes -Wno-cast-qual -Wno-parentheses -Wno-redundant-decls -Wno-missing-braces -Wno-uninitialized -Wno-unused -Wno-inline -Wno-switch -Wno-pointer-arith -Wno-unknown-pragmas From owner-svn-src-head@freebsd.org Tue Jan 9 05:11:48 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79E98E6142F; Tue, 9 Jan 2018 05:11:48 +0000 (UTC) (envelope-from mizhka@gmail.com) Received: from mail-qt0-x229.google.com (mail-qt0-x229.google.com [IPv6:2607:f8b0:400d:c0d::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 332A169A09; Tue, 9 Jan 2018 05:11:48 +0000 (UTC) (envelope-from mizhka@gmail.com) Received: by mail-qt0-x229.google.com with SMTP id s3so485640qtb.10; Mon, 08 Jan 2018 21:11:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=fFMkpVIAXWaK8qOG0m8lNr+VRLMKk6MpR4muKf/9ydo=; b=UqKjTFXVNBY1DuwXruJCCIXZ4Qa7aPGDTR/HHta0RWnLGmpXaFIZufy58UuzG2eqXJ mC1dEBkWuYlCzw0a+LW1CPHu1JPIolabXEPVrxmWCuX9gJub304Jlo7x9fxggpsY45EX xSeNuBCZfntVL8Chyg5dYm9wWxwQVBeUaAkjqe7IKdX+xIgeAdRloUw1Z3y7j3PgM1iR 3UGWXsDcq+1t2m6Tmg50WK1Cw6j/7ayZYQS/6Wvi41feSu9tRXSVU2jkZp8omJhh7Lsq O3F9dB9ZRFvAfbd0ZIYw4yr967lV9S27RMeQBACaLSHhcXd/Mcv/zDO+rpRq8ccilERj ZLkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=fFMkpVIAXWaK8qOG0m8lNr+VRLMKk6MpR4muKf/9ydo=; b=aDHi3kW2nVo8yMb4unp8CrH06Lf3PrxMpetrBKO7chvFkykrkNL135LxyFLKl22ovJ g/WB1N3z75of60OPw7nHFioptySyYdA+90vA3OweyZ8Z/13YeDqcXRwB+JNOXyF3U7ze pBVohnSX6Hk9A5WYADXbl9/oB3wAfChPp3N2vRydbz9nM5v2zf2255Qj4vUdzO4zQs19 /CjO+zin0sP39tbQUpzkukcJBP9SMoJg9OtEnaPvcWlA1i1FOEQHeNVTnHHcKGUkC9ZA 5iOgr/GePeB1zM8XrJZ8xQbz6svfAjG5dYqyito4KyXq4krNQrcv+KaGcHjeEvyB+ims GCwg== X-Gm-Message-State: AKwxytd5RYX9FYYQY+JK6fLn0aTlPEMiF6BxCrbO1trcdorbs2j2LmEh +BX8buYh8mEAzs/kxAjiQLQ7mynU3Wa1JKl1DMEB6w== X-Google-Smtp-Source: ACJfBouJy/ITyoitLH7i+EvyoiQZUBcwP4ie6V2yYbGevbebDsdJbdWwaMzF3tad6LPoYgwtyioDB9Qhzf+2350/JUE= X-Received: by 10.200.41.1 with SMTP id y1mr18736304qty.162.1515474707181; Mon, 08 Jan 2018 21:11:47 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.89.244 with HTTP; Mon, 8 Jan 2018 21:11:46 -0800 (PST) In-Reply-To: <201801090328.w093SOVW053959@repo.freebsd.org> References: <201801090328.w093SOVW053959@repo.freebsd.org> From: Michael Zhilin Date: Tue, 9 Jan 2018 08:11:46 +0300 Message-ID: Subject: Re: svn commit: r327715 - head/sys/conf To: Conrad Meyer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 05:11:48 -0000 Hi, Could you please tell what is plan to back MIPS works? Thanks! On Tue, Jan 9, 2018 at 6:28 AM, Conrad Meyer wrote: > Author: cem > Date: Tue Jan 9 03:28:24 2018 > New Revision: 327715 > URL: https://svnweb.freebsd.org/changeset/base/327715 > > Log: > Fix Zstd kernel build with GCC 4.2 > > By disabling the -Winline warning. Fixes the powerpc and sparc64 build > after r327706. > > Note: MIPS and RISCV builds still broken due to absense of __ctzdi2 (aka > __builtin_ctzll) in their libgcc or libcompiler-rt libraries. > > Reported by: markj > Sponsored by: Dell EMC Isilon > > Modified: > head/sys/conf/kern.pre.mk > > Modified: head/sys/conf/kern.pre.mk > ============================================================ > ================== > --- head/sys/conf/kern.pre.mk Tue Jan 9 01:41:55 2018 (r327714) > +++ head/sys/conf/kern.pre.mk Tue Jan 9 03:28:24 2018 (r327715) > @@ -133,7 +133,7 @@ NORMAL_FWO= ${LD} -b binary --no-warn-mismatch -d -war > -m ${LD_EMULATION} -o ${.TARGET} ${.ALLSRC:M*.fw} > > # for ZSTD in the kernel (include zstd/lib/freebsd before other CFLAGS) > -ZSTD_C= ${CC} -c -DZSTD_HEAPMODE=1 -I$S/contrib/zstd/lib/freebsd > ${CFLAGS} -I$S/contrib/zstd/lib -I$S/contrib/zstd/lib/common ${WERROR} > -Wno-missing-prototypes ${PROF} ${.IMPSRC} > +ZSTD_C= ${CC} -c -DZSTD_HEAPMODE=1 -I$S/contrib/zstd/lib/freebsd > ${CFLAGS} -I$S/contrib/zstd/lib -I$S/contrib/zstd/lib/common ${WERROR} > -Wno-inline -Wno-missing-prototypes ${PROF} ${.IMPSRC} > > # Common for dtrace / zfs > CDDL_CFLAGS= -DFREEBSD_NAMECACHE -nostdinc -I$S/cddl/compat/opensolaris > -I$S/cddl/contrib/opensolaris/uts/common -I$S > -I$S/cddl/contrib/opensolaris/common ${CFLAGS} -Wno-unknown-pragmas > -Wno-missing-prototypes -Wno-undef -Wno-strict-prototypes -Wno-cast-qual > -Wno-parentheses -Wno-redundant-decls -Wno-missing-braces > -Wno-uninitialized -Wno-unused -Wno-inline -Wno-switch -Wno-pointer-arith > -Wno-unknown-pragmas > > From owner-svn-src-head@freebsd.org Tue Jan 9 06:44:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30C2EE66FA8; Tue, 9 Jan 2018 06:44:00 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B63E6CB20; Tue, 9 Jan 2018 06:44:00 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3280913627; Tue, 9 Jan 2018 06:43:59 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w096hxRV037347; Tue, 9 Jan 2018 06:43:59 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w096hxBt037346; Tue, 9 Jan 2018 06:43:59 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201801090643.w096hxBt037346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 9 Jan 2018 06:43:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327718 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 327718 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 06:44:00 -0000 Author: cy Date: Tue Jan 9 06:43:58 2018 New Revision: 327718 URL: https://svnweb.freebsd.org/changeset/base/327718 Log: When growing the state, also grow the seed array. Otherwise memory that was not allocated will be accessed. This necessitated refactoring state seed allocation from ipf_state_soft_init() into a new common ipf_state_seed_alloc() function as it is now also used by ipf_state_rehash() when changing the size of the state hash table in addition to by ipf_state_soft_init() during initialization. According to Christos Zoulas : The bug was encountered by a NetBSD vendor who's customer machines had large ipfilter states. The bug was reliably triggered by resizing the state variables using "ipf -T". Submitted by: Christos Zoulas Reviewed by: delphij, rgrimes Obtained from: NetBSD ip_state.c CVS revs r1.9 and r1.10 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D13755 Modified: head/sys/contrib/ipfilter/netinet/ip_state.c Modified: head/sys/contrib/ipfilter/netinet/ip_state.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_state.c Tue Jan 9 06:10:57 2018 (r327717) +++ head/sys/contrib/ipfilter/netinet/ip_state.c Tue Jan 9 06:43:58 2018 (r327718) @@ -301,7 +301,33 @@ ipf_state_soft_destroy(softc, arg) KFREE(softs); } +static void * +ipf_state_seed_alloc(u_int state_size, u_int state_max) +{ + u_int i; + u_long *state_seed; + KMALLOCS(state_seed, u_long *, state_size * sizeof(*state_seed)); + if (state_seed == NULL) + return NULL; + for (i = 0; i < state_size; i++) { + /* + * XXX - ipf_state_seed[X] should be a random number of sorts. + */ +#if FREEBSD_GE_REV(400000) + state_seed[i] = arc4random(); +#else + state_seed[i] = ((u_long)state_seed + i) * state_size; + state_seed[i] ^= 0xa5a55a5a; + state_seed[i] *= (u_long)state_seed; + state_seed[i] ^= 0x5a5aa5a5; + state_seed[i] *= state_max; +#endif + } + return state_seed; +} + + /* ------------------------------------------------------------------------ */ /* Function: ipf_state_soft_init */ /* Returns: int - 0 == success, -1 == failure */ @@ -333,27 +359,11 @@ ipf_state_soft_init(softc, arg) bzero((char *)softs->ipf_state_table, softs->ipf_state_size * sizeof(ipstate_t *)); - KMALLOCS(softs->ipf_state_seed, u_long *, - softs->ipf_state_size * sizeof(*softs->ipf_state_seed)); + softs->ipf_state_seed = ipf_state_seed_alloc(softs->ipf_state_size, + softs->ipf_state_max); if (softs->ipf_state_seed == NULL) return -2; - for (i = 0; i < softs->ipf_state_size; i++) { - /* - * XXX - ipf_state_seed[X] should be a random number of sorts. - */ -#if FREEBSD_GE_REV(400000) - softs->ipf_state_seed[i] = arc4random(); -#else - softs->ipf_state_seed[i] = ((u_long)softs->ipf_state_seed + i) * - softs->ipf_state_size; - softs->ipf_state_seed[i] ^= 0xa5a55a5a; - softs->ipf_state_seed[i] *= (u_long)softs->ipf_state_seed; - softs->ipf_state_seed[i] ^= 0x5a5aa5a5; - softs->ipf_state_seed[i] *= softs->ipf_state_max; -#endif - } - KMALLOCS(softs->ipf_state_stats.iss_bucketlen, u_int *, softs->ipf_state_size * sizeof(u_int)); if (softs->ipf_state_stats.iss_bucketlen == NULL) @@ -5259,6 +5269,7 @@ ipf_state_rehash(softc, t, p) { ipf_state_softc_t *softs = softc->ipf_state_soft; ipstate_t **newtab, *is; + u_long *newseed; u_int *bucketlens; u_int maxbucket; u_int newsize; @@ -5285,6 +5296,14 @@ ipf_state_rehash(softc, t, p) return ENOMEM; } + newseed = ipf_state_seed_alloc(newsize, softs->ipf_state_max); + if (newseed == NULL) { + KFREES(bucketlens, newsize * sizeof(*bucketlens)); + KFREES(newtab, newsize * sizeof(*newtab)); + IPFERROR(100037); + return ENOMEM; + } + for (maxbucket = 0, i = newsize; i > 0; i >>= 1) maxbucket++; maxbucket *= 2; @@ -5299,6 +5318,12 @@ ipf_state_rehash(softc, t, p) softs->ipf_state_size * sizeof(*softs->ipf_state_table)); } softs->ipf_state_table = newtab; + + if (softs->ipf_state_seed != NULL) { + KFREES(softs->ipf_state_seed, + softs->ipf_state_size * sizeof(*softs->ipf_state_seed)); + } + softs->ipf_state_seed = newseed; if (softs->ipf_state_stats.iss_bucketlen != NULL) { KFREES(softs->ipf_state_stats.iss_bucketlen, From owner-svn-src-head@freebsd.org Tue Jan 9 06:51:43 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10893E6771B; Tue, 9 Jan 2018 06:51:43 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E04376CF1B; Tue, 9 Jan 2018 06:51:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D398137A8; Tue, 9 Jan 2018 06:51:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w096pgWv038362; Tue, 9 Jan 2018 06:51:42 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w096pghv038361; Tue, 9 Jan 2018 06:51:42 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801090651.w096pghv038361@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Tue, 9 Jan 2018 06:51:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327719 - head/sbin/ldconfig X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/sbin/ldconfig X-SVN-Commit-Revision: 327719 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 06:51:43 -0000 Author: eadler Date: Tue Jan 9 06:51:41 2018 New Revision: 327719 URL: https://svnweb.freebsd.org/changeset/base/327719 Log: ldconfig(8): use .Nm instead of 'ldconfig' Modified: head/sbin/ldconfig/ldconfig.8 Modified: head/sbin/ldconfig/ldconfig.8 ============================================================================== --- head/sbin/ldconfig/ldconfig.8 Tue Jan 9 06:43:58 2018 (r327718) +++ head/sbin/ldconfig/ldconfig.8 Tue Jan 9 06:51:41 2018 (r327719) @@ -159,9 +159,10 @@ file. In particular, the .Ev LD_LIBRARY_PATH is not used to search for libraries. -Thus, the role of ldconfig is dual. -In -addition to building a set of hints for quick lookup, it also serves to +Thus, the role of +.Nm +is dual. +In addition to building a set of hints for quick lookup, it also serves to specify the trusted collection of directories from which shared objects can be safely loaded. .Sh FILES From owner-svn-src-head@freebsd.org Tue Jan 9 09:47:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5645E724FB; Tue, 9 Jan 2018 09:47:49 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3494F73E68; Tue, 9 Jan 2018 09:47:48 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from freyja.zeit4.iv.bundesimmobilien.de ([87.138.105.249]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0Mh6lB-1eDCur1wMT-00MIsq; Tue, 09 Jan 2018 10:47:40 +0100 Date: Tue, 9 Jan 2018 10:47:39 +0100 From: "O. Hartmann" To: Conrad Meyer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r327706 - in head/sys: conf contrib/zstd/lib/freebsd Message-ID: <20180109104739.3fc77a44@freyja.zeit4.iv.bundesimmobilien.de> In-Reply-To: <201801082014.w08KEGv8071627@repo.freebsd.org> References: <201801082014.w08KEGv8071627@repo.freebsd.org> Organization: Walstatt MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:LCiGe+WMAl9TJzSyGS2IyLeOBsZzTiXOMD9x0yCW9W/ELr0CzWL 8NDCMQG6mb9htltt0RmrpZVWFHSGUut+GLOzRf/5gZjvZ3Vhlmjrf2nvhbeeQDoyGnZ/zTm d4C6FDAHfW1vwLOMWtuHv9fHsEEEMGC+y/Saq9CGh3k5/64LABCVFOG8GwPnNzKPidG3Seg 2rWIGIjLFVG+Mq6hefPPQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:kN61OvadJds=:yJmWFM7gmP11c+Y8uGl4us UzMXNbA8l+lR8U+1AfZthJ6PhtQSpAmdrsdz18fHWK/q4I/RE2kwvHmKcEsCO4wCvbeh0YOv3 4OwATJ9kAUZXVq3w3tgdzUv8E1jik15N+0CPEg1qMC9G6eHNvNzzzWFbgfHvykYvFSuMrUdMD Rizt7CXse0YqEbyrY1WHm0jvHdZK+H00YbMpNCumpyvMEPDOzGTs4U18lRXeHy0g6qTbnPv3s 2CN5IeRrwtbnY8CoroSaLc46XV6W+H9DnBziKXv2WjI1QmJdpJ7ArtFrChVRH9j7ij1/7uSdC +hMZ6JTR4Q7q46YYpGMfkLduz6l0oymGCU/aEW/BqiOYKhJU8p58Z5iM6eIemKyg+mfbeW6/o h8O0iy4xwXIeEZRBCazUZxZz0sUin0V3PWDMKmX2aAdEuJWZGZe2KdMXStmr+Y3MCpB0WNSv9 DPRj0o3lqZ9hAMxYUFnSYzonFFcr0o+UtoMpHj3Y2eYl3vViBVjP9ldPwjFcDEtTcvLBnoDDX yOBojLeaqvszOgm86f7RBlL3TdcuiZbGXssymve/6WwQH6tcaNXu2/VnQNz8wKGxQGwbLg2sk 0ni89J6yDXdRNDeDiqRMps71/5pcbrYabcMd70qmDlS8RZzbVh1NrUkSf/zU7jPsCgloH7BfS /ssyGDVMdWngeQcDLndH9yG0gXqXv5RieMNjRbskOvay307HtxfWBFYf4apMp2pFM/JGEM3pF lXd5+jHC6iH3jR1WFBmGDBT4iAiqeAX71UzjV02KCzSJNlvyJ7+RPCWcudvGl+Xp22elJVmFF wOopGDx0TEVlnwmp9RumlVUuOtVAnExgWL8CLlp8jvNPhkVldY= X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 09:47:49 -0000 On Mon, 8 Jan 2018 20:14:16 +0000 (UTC) Conrad Meyer wrote: > Author: cem > Date: Mon Jan 8 20:14:16 2018 > New Revision: 327706 > URL: https://svnweb.freebsd.org/changeset/base/327706 > > Log: > Integrate zstd into the kernel > > Mock userspace headers and include mocked headers first in compilation > command to inject kernel headers and override e.g., malloc(3) with > malloc(9). > > Submitted by: allanjude > Reviewed by: imp (earlier version), bapt (earlier version) > Differential Revision: https://reviews.freebsd.org/D10407 > > Added: > head/sys/contrib/zstd/lib/freebsd/ > head/sys/contrib/zstd/lib/freebsd/stddef.h (contents, props changed) > head/sys/contrib/zstd/lib/freebsd/stdint.h (contents, props changed) > head/sys/contrib/zstd/lib/freebsd/stdio.h (contents, props changed) > head/sys/contrib/zstd/lib/freebsd/stdlib.h (contents, props changed) > head/sys/contrib/zstd/lib/freebsd/string.h (contents, props changed) > head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h (contents, props > changed) head/sys/contrib/zstd/lib/freebsd/zstd_kmalloc.c (contents, props > changed) Modified: > head/sys/conf/files > head/sys/conf/kern.pre.mk > > Modified: head/sys/conf/files > ============================================================================== > --- head/sys/conf/files Mon Jan 8 18:47:35 2018 (r327705) > +++ head/sys/conf/files Mon Jan 8 20:14:16 2018 (r327706) > @@ -626,6 +626,23 @@ contrib/ngatm/netnatm/sig/sig_unimsgcpy.c optional nga > compile-with "${NORMAL_C} -I$S/contrib/ngatm" > contrib/ngatm/netnatm/sig/sig_verify.c optional ngatm_uni \ > compile-with "${NORMAL_C} -I$S/contrib/ngatm" > +# Zstd > +contrib/zstd/lib/freebsd/zstd_kmalloc.c standard compile-with > ${ZSTD_C} +contrib/zstd/lib/common/zstd_common.c standard > compile-with ${ZSTD_C} +contrib/zstd/lib/common/fse_decompress.c > standard compile-with ${ZSTD_C} > +contrib/zstd/lib/common/entropy_common.c standard compile-with > ${ZSTD_C} +contrib/zstd/lib/common/error_private.c standard > compile-with ${ZSTD_C} +contrib/zstd/lib/common/xxhash.c > standard compile-with ${ZSTD_C} > +contrib/zstd/lib/compress/zstd_compress.c standard compile-with > ${ZSTD_C} +contrib/zstd/lib/compress/fse_compress.c standard > compile-with ${ZSTD_C} +contrib/zstd/lib/compress/huf_compress.c > standard compile-with ${ZSTD_C} > +contrib/zstd/lib/compress/zstd_double_fast.c standard compile-with > ${ZSTD_C} +contrib/zstd/lib/compress/zstd_fast.c standard > compile-with ${ZSTD_C} +contrib/zstd/lib/compress/zstd_lazy.c > standard compile-with ${ZSTD_C} > +contrib/zstd/lib/compress/zstd_ldm.c standard compile-with > ${ZSTD_C} +contrib/zstd/lib/compress/zstd_opt.c standard > compile-with ${ZSTD_C} +contrib/zstd/lib/decompress/zstd_decompress.c > standard compile-with ${ZSTD_C} > +contrib/zstd/lib/decompress/huf_decompress.c standard compile-with > ${ZSTD_C} crypto/blowfish/bf_ecb.c optional ipsec | ipsec_support > crypto/blowfish/bf_skey.c optional crypto | ipsec | ipsec_support > crypto/camellia/camellia.c optional crypto | ipsec | ipsec_support > > Modified: head/sys/conf/kern.pre.mk > ============================================================================== > --- head/sys/conf/kern.pre.mk Mon Jan 8 18:47:35 2018 (r327705) > +++ head/sys/conf/kern.pre.mk Mon Jan 8 20:14:16 2018 (r327706) > @@ -132,6 +132,9 @@ NORMAL_FW= uudecode -o ${.TARGET} ${.ALLSRC} > NORMAL_FWO= ${LD} -b binary --no-warn-mismatch -d -warn-common -r \ > -m ${LD_EMULATION} -o ${.TARGET} ${.ALLSRC:M*.fw} > > +# for ZSTD in the kernel (include zstd/lib/freebsd before other CFLAGS) > +ZSTD_C= ${CC} -c -DZSTD_HEAPMODE=1 -I$S/contrib/zstd/lib/freebsd ${CFLAGS} > -I$S/contrib/zstd/lib -I$S/contrib/zstd/lib/common ${WERROR} > -Wno-missing-prototypes ${PROF} ${.IMPSRC} + # Common for dtrace / zfs > CDDL_CFLAGS= -DFREEBSD_NAMECACHE -nostdinc > -I$S/cddl/compat/opensolaris -I$S/cddl/contrib/opensolaris/uts/common -I$S > -I$S/cddl/contrib/opensolaris/common ${CFLAGS} -Wno-unknown-pragmas > -Wno-missing-prototypes -Wno-undef -Wno-strict-prototypes -Wno-cast-qual > -Wno-parentheses -Wno-redundant-decls -Wno-missing-braces -Wno-uninitialized > -Wno-unused -Wno-inline -Wno-switch -Wno-pointer-arith -Wno-unknown-pragmas > CDDL_CFLAGS+= -include $S/cddl/compat/opensolaris/sys/debug_compat.h > > Added: head/sys/contrib/zstd/lib/freebsd/stddef.h > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/contrib/zstd/lib/freebsd/stddef.h Mon Jan 8 20:14:16 > 2018 (r327706) @@ -0,0 +1,3 @@ > +/* This file is in the public domain */ > +/* $FreeBSD$ */ > +#include "zstd_kfreebsd.h" > > Added: head/sys/contrib/zstd/lib/freebsd/stdint.h > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/contrib/zstd/lib/freebsd/stdint.h Mon Jan 8 20:14:16 > 2018 (r327706) @@ -0,0 +1,3 @@ > +/* This file is in the public domain */ > +/* $FreeBSD$ */ > +#include "zstd_kfreebsd.h" > > Added: head/sys/contrib/zstd/lib/freebsd/stdio.h > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/contrib/zstd/lib/freebsd/stdio.h Mon Jan 8 20:14:16 > 2018 (r327706) @@ -0,0 +1,3 @@ > +/* This file is in the public domain */ > +/* $FreeBSD$ */ > +#include "zstd_kfreebsd.h" > > Added: head/sys/contrib/zstd/lib/freebsd/stdlib.h > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/contrib/zstd/lib/freebsd/stdlib.h Mon Jan 8 20:14:16 > 2018 (r327706) @@ -0,0 +1,3 @@ > +/* This file is in the public domain */ > +/* $FreeBSD$ */ > +#include "zstd_kfreebsd.h" > > Added: head/sys/contrib/zstd/lib/freebsd/string.h > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/contrib/zstd/lib/freebsd/string.h Mon Jan 8 20:14:16 > 2018 (r327706) @@ -0,0 +1,3 @@ > +/* This file is in the public domain */ > +/* $FreeBSD$ */ > +#include "zstd_kfreebsd.h" > > Added: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Mon Jan 8 > 20:14:16 2018 (r327706) @@ -0,0 +1,56 @@ > +/*- > + * Copyright (c) 2014-2015 Allan Jude > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > + > +#ifndef ZSTD_KFREEBSD_H > +#define ZSTD_KFREEBSD_H > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +#ifdef _KERNEL > +#include /* size_t */ > +#include /* memcpy, memset */ > +#ifndef BUILDING_ZFS > +#include /* ptrdiff_t */ > +#endif > +#include > + > +MALLOC_DECLARE(M_ZSTD); > + > +#define malloc(x) (malloc)((x), M_ZSTD, M_WAITOK) > +#define free(x) (free)((x), M_ZSTD) > +/* in zstd's use of calloc, a is always 1 */ > +#define calloc(a,b) (malloc)((a)*(b), M_ZSTD, M_WAITOK | M_ZERO) > +#endif > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* ZSTD_KFREEBSD_H */ > > Added: head/sys/contrib/zstd/lib/freebsd/zstd_kmalloc.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/contrib/zstd/lib/freebsd/zstd_kmalloc.c Mon Jan 8 > 20:14:16 2018 (r327706) @@ -0,0 +1,33 @@ > +/*- > + * Copyright (c) 2016-2017 Allan Jude > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > + > +#include > +#include > +#include > + > +MALLOC_DEFINE(M_ZSTD, "zstd", "ZSTD Compressor"); > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" It seems that CURRENT is unwilling to build due to the error shown below: [...] --- fse_decompress.o --- In file included from /usr/src/sys/contrib/zstd/lib/common/fse_decompress.c:41: /usr/src/sys/contrib/zstd/lib/common/bitstream.h:71:12: fatal error: 'immintrin.h' file not found # include /* support for bextr (experimental) */ ^~~~~~~~~~~~~ --- modules-all --- From owner-svn-src-head@freebsd.org Tue Jan 9 10:33:12 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96392E74E5A; Tue, 9 Jan 2018 10:33:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5865375DD5; Tue, 9 Jan 2018 10:33:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB91115BD6; Tue, 9 Jan 2018 10:33:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09AXBXw034579; Tue, 9 Jan 2018 10:33:11 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09AXBdC034578; Tue, 9 Jan 2018 10:33:11 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801091033.w09AXBdC034578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 9 Jan 2018 10:33:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327721 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 327721 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 10:33:12 -0000 Author: kib Date: Tue Jan 9 10:33:11 2018 New Revision: 327721 URL: https://svnweb.freebsd.org/changeset/base/327721 Log: Postpone the disassotiation of the background write buffer with devvp so that buf_complete() sees fully constructed buffer. This is a NOP right now, but will be needed by the forthcoming SU change. Reported and tested by: pho Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Tue Jan 9 09:26:16 2018 (r327720) +++ head/sys/ufs/ffs/ffs_vfsops.c Tue Jan 9 10:33:11 2018 (r327721) @@ -2045,7 +2045,6 @@ ffs_backgroundwritedone(struct buf *bp) /* * Process dependencies then return any unfinished ones. */ - pbrelvp(bp); if (!LIST_EMPTY(&bp->b_dep) && (bp->b_ioflags & BIO_ERROR) == 0) buf_complete(bp); #ifdef SOFTUPDATES @@ -2058,6 +2057,7 @@ ffs_backgroundwritedone(struct buf *bp) */ bp->b_flags |= B_NOCACHE; bp->b_flags &= ~B_CACHE; + pbrelvp(bp); /* * Prevent brelse() from trying to keep and re-dirtying bp on From owner-svn-src-head@freebsd.org Tue Jan 9 10:44:18 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81C0AE75701; Tue, 9 Jan 2018 10:44:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5B3E9763C0; Tue, 9 Jan 2018 10:44:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9031E15D84; Tue, 9 Jan 2018 10:44:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09AiHcm038616; Tue, 9 Jan 2018 10:44:17 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09AiHJN038615; Tue, 9 Jan 2018 10:44:17 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801091044.w09AiHJN038615@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 9 Jan 2018 10:44:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327722 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 327722 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 10:44:18 -0000 Author: kib Date: Tue Jan 9 10:44:17 2018 New Revision: 327722 URL: https://svnweb.freebsd.org/changeset/base/327722 Log: When handling write completion, take SU lock around calls to handle_written_XXX() in case of processing the buffer with an error. Tested by: pho (as part of the bigger patch) Reviewed by: mckusick (as part of the bigger patch) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Tue Jan 9 10:33:11 2018 (r327721) +++ head/sys/ufs/ffs/ffs_softdep.c Tue Jan 9 10:44:17 2018 (r327722) @@ -10978,12 +10978,17 @@ softdep_disk_write_complete(bp) struct freeblks *freeblks; struct buf *sbp; + if ((wk = LIST_FIRST(&bp->b_dep)) == NULL) + return; + ump = VFSTOUFS(wk->wk_mp); + /* * If an error occurred while doing the write, then the data * has not hit the disk and the dependencies cannot be processed. * But we do have to go through and roll forward any dependencies * that were rolled back before the disk write. */ + ACQUIRE_LOCK(ump); if ((bp->b_ioflags & BIO_ERROR) != 0 && (bp->b_flags & B_INVAL) == 0) { LIST_FOREACH(wk, &bp->b_dep, wk_list) { switch (wk->wk_type) { @@ -11011,18 +11016,15 @@ softdep_disk_write_complete(bp) continue; } } + FREE_LOCK(ump); return; } - if ((wk = LIST_FIRST(&bp->b_dep)) == NULL) - return; - ump = VFSTOUFS(wk->wk_mp); LIST_INIT(&reattach); /* * This lock must not be released anywhere in this code segment. */ sbp = NULL; owk = NULL; - ACQUIRE_LOCK(ump); while ((wk = LIST_FIRST(&bp->b_dep)) != NULL) { WORKLIST_REMOVE(wk); atomic_add_long(&dep_write[wk->wk_type], 1); From owner-svn-src-head@freebsd.org Tue Jan 9 10:51:45 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95BD1E75CCF; Tue, 9 Jan 2018 10:51:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 700FE769A7; Tue, 9 Jan 2018 10:51:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADAA515ED2; Tue, 9 Jan 2018 10:51:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09ApieC040460; Tue, 9 Jan 2018 10:51:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09ApiRW040458; Tue, 9 Jan 2018 10:51:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801091051.w09ApiRW040458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 9 Jan 2018 10:51:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327723 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 327723 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 10:51:45 -0000 Author: kib Date: Tue Jan 9 10:51:44 2018 New Revision: 327723 URL: https://svnweb.freebsd.org/changeset/base/327723 Log: Generalize the fix from r322757 and apply it to several more places. The code accesses bp->b_dep without owning the ufs mount softdep lock, which makes it possible for the derefenced workitem to be freed in parallel. In particular, the deallocate_dependencies(), softdep_disk_io_initiation() and softdep_disk_write_complete() are affected. Move the code to safely calculate ump from the buffer with dependencies into the helper softdep_bp_to_mp() and use it for all found cases. Tested by: pho (as part of the bigger patch) Reviewed by: mckusick (as part of the bigger patch) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Tue Jan 9 10:44:17 2018 (r327722) +++ head/sys/ufs/ffs/ffs_softdep.c Tue Jan 9 10:51:44 2018 (r327723) @@ -906,6 +906,7 @@ static int request_cleanup(struct mount *, int); static int softdep_request_cleanup_flush(struct mount *, struct ufsmount *); static void schedule_cleanup(struct mount *); static void softdep_ast_cleanup_proc(struct thread *); +static struct ufsmount *softdep_bp_to_mp(struct buf *bp); static int process_worklist_item(struct mount *, int, int); static void process_removes(struct vnode *); static void process_truncates(struct vnode *); @@ -7249,9 +7250,9 @@ deallocate_dependencies(bp, freeblks, off) struct worklist *wk, *wkn; struct ufsmount *ump; - if ((wk = LIST_FIRST(&bp->b_dep)) == NULL) + ump = softdep_bp_to_mp(bp); + if (ump == NULL) goto done; - ump = VFSTOUFS(wk->wk_mp); ACQUIRE_LOCK(ump); LIST_FOREACH_SAFE(wk, &bp->b_dep, wk_list, wkn) { switch (wk->wk_type) { @@ -9976,9 +9977,9 @@ softdep_disk_io_initiation(bp) panic("softdep_disk_io_initiation: Writing buffer with " "background write in progress: %p", bp); - if ((wk = LIST_FIRST(&bp->b_dep)) == NULL) + ump = softdep_bp_to_mp(bp); + if (ump == NULL) return; - ump = VFSTOUFS(wk->wk_mp); marker.wk_type = D_LAST + 1; /* Not a normal workitem */ PHOLD(curproc); /* Don't swap out kernel stack */ @@ -10978,9 +10979,9 @@ softdep_disk_write_complete(bp) struct freeblks *freeblks; struct buf *sbp; - if ((wk = LIST_FIRST(&bp->b_dep)) == NULL) + ump = softdep_bp_to_mp(bp); + if (ump == NULL) return; - ump = VFSTOUFS(wk->wk_mp); /* * If an error occurred while doing the write, then the data @@ -11020,8 +11021,9 @@ softdep_disk_write_complete(bp) return; } LIST_INIT(&reattach); + /* - * This lock must not be released anywhere in this code segment. + * Ump SU lock must not be released anywhere in this code segment. */ sbp = NULL; owk = NULL; @@ -13895,6 +13897,39 @@ softdep_freework(wkhd) FREE_LOCK(ump); } +static struct ufsmount * +softdep_bp_to_mp(bp) + struct buf *bp; +{ + struct mount *mp; + struct vnode *vp; + + if (LIST_EMPTY(&bp->b_dep)) + return (NULL); + vp = bp->b_vp; + + /* + * The ump mount point is stable after we get a correct + * pointer, since bp is locked and this prevents unmount from + * proceeding. But to get to it, we cannot dereference bp->b_dep + * head wk_mp, because we do not yet own SU ump lock and + * workitem might be freed while dereferenced. + */ +retry: + if (vp->v_type == VCHR) { + VI_LOCK(vp); + mp = vp->v_type == VCHR ? vp->v_rdev->si_mountpt : NULL; + VI_UNLOCK(vp); + if (mp == NULL) + goto retry; + } else if (vp->v_type == VREG || vp->v_type == VDIR) { + mp = vp->v_mount; + } else { + return (NULL); + } + return (VFSTOUFS(mp)); +} + /* * Function to determine if the buffer has outstanding dependencies * that will cause a roll-back if the buffer is written. If wantcount @@ -13918,36 +13953,12 @@ softdep_count_dependencies(bp, wantcount) struct newblk *newblk; struct mkdir *mkdir; struct diradd *dap; - struct vnode *vp; - struct mount *mp; int i, retval; - retval = 0; - if (LIST_EMPTY(&bp->b_dep)) + ump = softdep_bp_to_mp(bp); + if (ump == NULL) return (0); - vp = bp->b_vp; - - /* - * The ump mount point is stable after we get a correct - * pointer, since bp is locked and this prevents unmount from - * proceed. But to get to it, we cannot dereference bp->b_dep - * head wk_mp, because we do not yet own SU ump lock and - * workitem might be freed while dereferenced. - */ -retry: - if (vp->v_type == VCHR) { - VI_LOCK(vp); - mp = vp->v_type == VCHR ? vp->v_rdev->si_mountpt : NULL; - VI_UNLOCK(vp); - if (mp == NULL) - goto retry; - } else if (vp->v_type == VREG) { - mp = vp->v_mount; - } else { - return (0); - } - ump = VFSTOUFS(mp); - + retval = 0; ACQUIRE_LOCK(ump); LIST_FOREACH(wk, &bp->b_dep, wk_list) { switch (wk->wk_type) { From owner-svn-src-head@freebsd.org Tue Jan 9 13:42:10 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30ED8E7DEAC; Tue, 9 Jan 2018 13:42:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0C5DB7CF81; Tue, 9 Jan 2018 13:42:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B86617A35; Tue, 9 Jan 2018 13:42:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09Dg9SF013507; Tue, 9 Jan 2018 13:42:09 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09Dg97C013506; Tue, 9 Jan 2018 13:42:09 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201801091342.w09Dg97C013506@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 9 Jan 2018 13:42:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327724 - head/sys/dev/usb X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/usb X-SVN-Commit-Revision: 327724 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 13:42:10 -0000 Author: avg Date: Tue Jan 9 13:42:08 2018 New Revision: 327724 URL: https://svnweb.freebsd.org/changeset/base/327724 Log: usbdevs: add ASMedia vendor ID MFC after: 1 week Modified: head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue Jan 9 10:51:44 2018 (r327723) +++ head/sys/dev/usb/usbdevs Tue Jan 9 13:42:08 2018 (r327724) @@ -707,6 +707,7 @@ vendor WCH2 0x1a86 QinHeng Electronics vendor STELERA 0x1a8d Stelera Wireless vendor SEL 0x1adb Schweitzer Engineering Laboratories vendor CORSAIR 0x1b1c Corsair +vendor ASM 0x1b21 ASMedia Technology vendor MATRIXORBITAL 0x1b3d Matrix Orbital vendor OVISLINK 0x1b75 OvisLink vendor TML 0x1b91 The Mobility Lab From owner-svn-src-head@freebsd.org Tue Jan 9 13:43:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57050E7DF6D; Tue, 9 Jan 2018 13:43:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 309A47D112; Tue, 9 Jan 2018 13:43:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 629DF17A64; Tue, 9 Jan 2018 13:43:04 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09Dh462013585; Tue, 9 Jan 2018 13:43:04 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09Dh489013584; Tue, 9 Jan 2018 13:43:04 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201801091343.w09Dh489013584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 9 Jan 2018 13:43:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327725 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 327725 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 13:43:05 -0000 Author: avg Date: Tue Jan 9 13:43:04 2018 New Revision: 327725 URL: https://svnweb.freebsd.org/changeset/base/327725 Log: zfs_mount: restore a bit of ifdef-out illumos code And correctly mark the end of the replacement FreeBSD code. MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Jan 9 13:42:08 2018 (r327724) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Jan 9 13:43:04 2018 (r327725) @@ -1629,13 +1629,21 @@ zfs_mount(vfs_t *vfsp) * can be interrogated. */ if ((uap->flags & MS_DATA) && uap->datalen > 0) + return (SET_ERROR(EINVAL)); + + /* + * Get the objset name (the "special" mount argument). + */ + if (error = pn_get(uap->spec, fromspace, &spn)) + return (error); + + osname = spn.pn_path; #else /* !illumos */ if (!prison_allow(td->td_ucred, PR_ALLOW_MOUNT_ZFS)) return (SET_ERROR(EPERM)); if (vfs_getopt(vfsp->mnt_optnew, "from", (void **)&osname, NULL)) return (SET_ERROR(EINVAL)); -#endif /* illumos */ /* * If full-owner-access is enabled and delegated administration is @@ -1645,6 +1653,7 @@ zfs_mount(vfs_t *vfsp) dsl_deleg_access(osname, ZFS_DELEG_PERM_MOUNT, cr) != ECANCELED) { secpolicy_fs_mount_clearopts(cr, vfsp); } +#endif /* illumos */ /* * Check for mount privilege? From owner-svn-src-head@freebsd.org Tue Jan 9 14:22:20 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1FBBAE7F75C; Tue, 9 Jan 2018 14:22:20 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EED117E7CC; Tue, 9 Jan 2018 14:22:19 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FE11180CC; Tue, 9 Jan 2018 14:22:19 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09EMJb5029554; Tue, 9 Jan 2018 14:22:19 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09EMJpB029552; Tue, 9 Jan 2018 14:22:19 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201801091422.w09EMJpB029552@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 9 Jan 2018 14:22:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327726 - head/sys/amd64/vmm/amd X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/amd64/vmm/amd X-SVN-Commit-Revision: 327726 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 14:22:20 -0000 Author: avg Date: Tue Jan 9 14:22:18 2018 New Revision: 327726 URL: https://svnweb.freebsd.org/changeset/base/327726 Log: vmm/svm: contigmalloc of the whole svm_softc is excessive This is a followup to r307903. struct svm_softc takes more than 200 kilobytes while what we really need is 3 contiguous pages for I/O permission map and 2 contiguous pages for MSR permission map. Other physically mapped structures have a size of a single page, so a proper alignment is sufficient for their correct mapping. Thus, only the permission maps are allocated with contigmalloc now, the softc is allocated with a regular malloc. Additionally, this commit adds a check that malloc returns memory with the expected page alignment and that contigmalloc does not fail. Unfortunately, at present svm_vminit() is expected to always succeed and there is no way to report an error. So, a contigmalloc failure leads to a panic. We should probably fix this. MFC after: 2 weeks Modified: head/sys/amd64/vmm/amd/svm.c head/sys/amd64/vmm/amd/svm_softc.h Modified: head/sys/amd64/vmm/amd/svm.c ============================================================================== --- head/sys/amd64/vmm/amd/svm.c Tue Jan 9 13:43:04 2018 (r327725) +++ head/sys/amd64/vmm/amd/svm.c Tue Jan 9 14:22:18 2018 (r327726) @@ -517,15 +517,26 @@ svm_vminit(struct vm *vm, pmap_t pmap) vm_paddr_t msrpm_pa, iopm_pa, pml4_pa; int i; - svm_sc = contigmalloc(sizeof (*svm_sc), M_SVM, M_WAITOK | M_ZERO, - 0, ~(vm_paddr_t)0, PAGE_SIZE, 0); + svm_sc = malloc(sizeof (*svm_sc), M_SVM, M_WAITOK | M_ZERO); + if (((uintptr_t)svm_sc & PAGE_MASK) != 0) + panic("malloc of svm_softc not aligned on page boundary"); + + svm_sc->msr_bitmap = contigmalloc(SVM_MSR_BITMAP_SIZE, M_SVM, + M_WAITOK, 0, ~(vm_paddr_t)0, PAGE_SIZE, 0); + if (svm_sc->msr_bitmap == NULL) + panic("contigmalloc of SVM MSR bitmap failed"); + svm_sc->iopm_bitmap = contigmalloc(SVM_IO_BITMAP_SIZE, M_SVM, + M_WAITOK, 0, ~(vm_paddr_t)0, PAGE_SIZE, 0); + if (svm_sc->iopm_bitmap == NULL) + panic("contigmalloc of SVM IO bitmap failed"); + svm_sc->vm = vm; svm_sc->nptp = (vm_offset_t)vtophys(pmap->pm_pml4); /* * Intercept read and write accesses to all MSRs. */ - memset(svm_sc->msr_bitmap, 0xFF, sizeof(svm_sc->msr_bitmap)); + memset(svm_sc->msr_bitmap, 0xFF, SVM_MSR_BITMAP_SIZE); /* * Access to the following MSRs is redirected to the VMCB when the @@ -553,7 +564,7 @@ svm_vminit(struct vm *vm, pmap_t pmap) svm_msr_rd_ok(svm_sc->msr_bitmap, MSR_EFER); /* Intercept access to all I/O ports. */ - memset(svm_sc->iopm_bitmap, 0xFF, sizeof(svm_sc->iopm_bitmap)); + memset(svm_sc->iopm_bitmap, 0xFF, SVM_IO_BITMAP_SIZE); iopm_pa = vtophys(svm_sc->iopm_bitmap); msrpm_pa = vtophys(svm_sc->msr_bitmap); @@ -2043,7 +2054,9 @@ svm_vmcleanup(void *arg) { struct svm_softc *sc = arg; - contigfree(sc, sizeof (*sc), M_SVM); + contigfree(sc->iopm_bitmap, SVM_IO_BITMAP_SIZE, M_SVM); + contigfree(sc->msr_bitmap, SVM_MSR_BITMAP_SIZE, M_SVM); + free(sc, M_SVM); } static register_t * Modified: head/sys/amd64/vmm/amd/svm_softc.h ============================================================================== --- head/sys/amd64/vmm/amd/svm_softc.h Tue Jan 9 13:43:04 2018 (r327725) +++ head/sys/amd64/vmm/amd/svm_softc.h Tue Jan 9 14:22:18 2018 (r327726) @@ -56,13 +56,13 @@ struct svm_vcpu { * SVM softc, one per virtual machine. */ struct svm_softc { - uint8_t iopm_bitmap[SVM_IO_BITMAP_SIZE]; /* shared by all vcpus */ - uint8_t msr_bitmap[SVM_MSR_BITMAP_SIZE]; /* shared by all vcpus */ uint8_t apic_page[VM_MAXCPU][PAGE_SIZE]; struct svm_vcpu vcpu[VM_MAXCPU]; vm_offset_t nptp; /* nested page table */ + uint8_t *iopm_bitmap; /* shared by all vcpus */ + uint8_t *msr_bitmap; /* shared by all vcpus */ struct vm *vm; -} __aligned(PAGE_SIZE); +}; CTASSERT((offsetof(struct svm_softc, nptp) & PAGE_MASK) == 0); From owner-svn-src-head@freebsd.org Tue Jan 9 14:33:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 427F7E7FCA7; Tue, 9 Jan 2018 14:33:07 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1A6C97EF85; Tue, 9 Jan 2018 14:33:07 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A22A182AA; Tue, 9 Jan 2018 14:33:06 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09EX6Zb034745; Tue, 9 Jan 2018 14:33:06 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09EX5ef034740; Tue, 9 Jan 2018 14:33:05 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201801091433.w09EX5ef034740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 9 Jan 2018 14:33:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327727 - in head/sys: arm64/arm64 arm64/include conf X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys: arm64/arm64 arm64/include conf X-SVN-Commit-Revision: 327727 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 14:33:07 -0000 Author: andrew Date: Tue Jan 9 14:33:05 2018 New Revision: 327727 URL: https://svnweb.freebsd.org/changeset/base/327727 Log: Add a framework to install CPU errata on arm64. Each erratum can encode a mask and value to compare with the Main ID Register. If these match then a function is called to handle the installation of the erratum workaround. No errata are currently handled, however this will change soon in a future commit. MFC after: 1 week Sponsored by: DARPA, AFRL Added: head/sys/arm64/arm64/cpu_errata.c (contents, props changed) Modified: head/sys/arm64/arm64/machdep.c head/sys/arm64/arm64/mp_machdep.c head/sys/arm64/include/cpu.h head/sys/conf/files.arm64 Added: head/sys/arm64/arm64/cpu_errata.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/arm64/cpu_errata.c Tue Jan 9 14:33:05 2018 (r327727) @@ -0,0 +1,68 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2018 Andrew Turner + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include + +typedef void (cpu_quirk_install)(void); +struct cpu_quirks { + cpu_quirk_install *quirk_install; + u_int midr_mask; + u_int midr_value; +}; + +static cpu_quirk_install install_psci_bp_hardening; + +static struct cpu_quirks cpu_quirks[] = { +}; + +void +install_cpu_errata(void) +{ + u_int midr; + size_t i; + + midr = get_midr(); + + for (i = 0; i < nitems(cpu_quirks); i++) { + if ((midr & cpu_quirks[i].midr_mask) == + cpu_quirks[i].midr_value) { + cpu_quirks[i].quirk_install(); + } + } +} Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Tue Jan 9 14:22:18 2018 (r327726) +++ head/sys/arm64/arm64/machdep.c Tue Jan 9 14:33:05 2018 (r327727) @@ -172,6 +172,7 @@ cpu_startup(void *dummy) undef_init(); identify_cpu(); + install_cpu_errata(); vm_ksubmap_init(&kmi); bufinit(); Modified: head/sys/arm64/arm64/mp_machdep.c ============================================================================== --- head/sys/arm64/arm64/mp_machdep.c Tue Jan 9 14:22:18 2018 (r327726) +++ head/sys/arm64/arm64/mp_machdep.c Tue Jan 9 14:33:05 2018 (r327727) @@ -282,6 +282,7 @@ init_secondary(uint64_t cpu) * runtime chip identification. */ identify_cpu(); + install_cpu_errata(); intr_pic_init_secondary(); Modified: head/sys/arm64/include/cpu.h ============================================================================== --- head/sys/arm64/include/cpu.h Tue Jan 9 14:22:18 2018 (r327726) +++ head/sys/arm64/include/cpu.h Tue Jan 9 14:33:05 2018 (r327727) @@ -150,6 +150,7 @@ void cpu_halt(void) __dead2; void cpu_reset(void) __dead2; void fork_trampoline(void); void identify_cpu(void); +void install_cpu_errata(void); void print_cpu_features(u_int); void swi_vm(void *v); Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Tue Jan 9 14:22:18 2018 (r327726) +++ head/sys/conf/files.arm64 Tue Jan 9 14:33:05 2018 (r327727) @@ -96,6 +96,7 @@ arm64/arm64/bzero.S standard arm64/arm64/clock.c standard arm64/arm64/copyinout.S standard arm64/arm64/copystr.c standard +arm64/arm64/cpu_errata.c standard arm64/arm64/cpufunc_asm.S standard arm64/arm64/db_disasm.c optional ddb arm64/arm64/db_interface.c optional ddb From owner-svn-src-head@freebsd.org Tue Jan 9 15:57:12 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40D7DE6015D; Tue, 9 Jan 2018 15:57:12 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EDE7182CEE; Tue, 9 Jan 2018 15:57:10 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1888118FBB; Tue, 9 Jan 2018 15:57:10 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09Fv9Ne069137; Tue, 9 Jan 2018 15:57:09 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09Fv9Z2069135; Tue, 9 Jan 2018 15:57:09 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201801091557.w09Fv9Z2069135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 9 Jan 2018 15:57:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327728 - head/sys/dev/psci X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/psci X-SVN-Commit-Revision: 327728 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 15:57:12 -0000 Author: andrew Date: Tue Jan 9 15:57:09 2018 New Revision: 327728 URL: https://svnweb.freebsd.org/changeset/base/327728 Log: Add a function to find the PSCI version the firmware implements from outside the PSCI driver. MFC after: 1 week Sponsored by: DARPA, AFRL Modified: head/sys/dev/psci/psci.c head/sys/dev/psci/psci.h Modified: head/sys/dev/psci/psci.c ============================================================================== --- head/sys/dev/psci/psci.c Tue Jan 9 14:33:05 2018 (r327727) +++ head/sys/dev/psci/psci.c Tue Jan 9 15:57:09 2018 (r327728) @@ -314,7 +314,7 @@ psci_attach(device_t dev, psci_initfn_t psci_init) } static int -psci_get_version(struct psci_softc *sc) +_psci_get_version(struct psci_softc *sc) { uint32_t fnid; @@ -326,6 +326,15 @@ psci_get_version(struct psci_softc *sc) return (PSCI_RETVAL_NOT_SUPPORTED); } +int +psci_get_version(void) +{ + + if (psci_softc == NULL) + return (PSCI_RETVAL_NOT_SUPPORTED); + return (_psci_get_version(psci_softc)); +} + #ifdef FDT static int psci_fdt_callfn(psci_callfn_t *callfn) @@ -487,7 +496,7 @@ psci_v0_2_init(device_t dev) sc->psci_fnids[PSCI_FN_SYSTEM_OFF] = PSCI_FNID_SYSTEM_OFF; sc->psci_fnids[PSCI_FN_SYSTEM_RESET] = PSCI_FNID_SYSTEM_RESET; - version = psci_get_version(sc); + version = _psci_get_version(sc); if (version == PSCI_RETVAL_NOT_SUPPORTED) return (1); Modified: head/sys/dev/psci/psci.h ============================================================================== --- head/sys/dev/psci/psci.h Tue Jan 9 14:33:05 2018 (r327727) +++ head/sys/dev/psci/psci.h Tue Jan 9 15:57:09 2018 (r327728) @@ -41,6 +41,7 @@ int psci_cpu_on(unsigned long, unsigned long, unsigned int psci_hvc_despatch(register_t, register_t, register_t, register_t); int psci_smc_despatch(register_t, register_t, register_t, register_t); +int psci_get_version(void); /* * PSCI return codes. From owner-svn-src-head@freebsd.org Tue Jan 9 16:11:35 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1EDA4E60F04; Tue, 9 Jan 2018 16:11:35 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED0BA83AE4; Tue, 9 Jan 2018 16:11:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38E83192A4; Tue, 9 Jan 2018 16:11:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09GBY1L076190; Tue, 9 Jan 2018 16:11:34 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09GBYV5076188; Tue, 9 Jan 2018 16:11:34 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801091611.w09GBYV5076188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 9 Jan 2018 16:11:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327729 - in head/sys: cam/scsi i386/isa X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: cam/scsi i386/isa X-SVN-Commit-Revision: 327729 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 16:11:35 -0000 Author: imp Date: Tue Jan 9 16:11:33 2018 New Revision: 327729 URL: https://svnweb.freebsd.org/changeset/base/327729 Log: Remove ccbque.h from i386/isa. inline ccbque.h into scsi_low.h. The file isn't MD, so shouldn't live in i386/isa. It's only used by scsi_low, so move it there so no new clients accidentally grow. scsi_low may not even still work, and the locking here is still SPL based. CAM should do the right thing, but I've received no reports of these cards still working. At least it compiles still and there's one fewer files in sys/i386/isa. While I'm here, ansify and de-splize. CCB_MWANTED appears to be a clear-only flag, but I've not changed that. Differential Review: https://reviews.freebsd.org/D13672 Deleted: head/sys/i386/isa/ccbque.h Modified: head/sys/cam/scsi/scsi_low.c head/sys/cam/scsi/scsi_low.h Modified: head/sys/cam/scsi/scsi_low.c ============================================================================== --- head/sys/cam/scsi/scsi_low.c Tue Jan 9 15:57:09 2018 (r327728) +++ head/sys/cam/scsi/scsi_low.c Tue Jan 9 16:11:33 2018 (r327729) @@ -88,6 +88,65 @@ __FBSDID("$FreeBSD$"); #include /************************************************************** + * CCB Macros + **************************************************************/ + +/* (II) static allocated memory */ +#define GENERIC_CCB_STATIC_ALLOC(DEV, CCBTYPE) \ +static struct CCBTYPE##que CCBTYPE##que; + +/* (III) functions */ +#define GENERIC_CCB(DEV, CCBTYPE, CHAIN) \ + \ +void \ +DEV##_init_ccbque(int count) \ +{ \ + if (CCBTYPE##que.maxccb == 0) \ + TAILQ_INIT(&CCBTYPE##que.CCBTYPE##tab); \ + CCBTYPE##que.maxccb += count; \ +} \ + \ +struct CCBTYPE * \ +DEV##_get_ccb(void) \ +{ \ + struct CCBTYPE *cb; \ + \ + if (CCBTYPE##que.count < CCBTYPE##que.maxccb) \ + { \ + CCBTYPE##que.count ++; \ + cb = TAILQ_FIRST(&(CCBTYPE##que.CCBTYPE##tab)); \ + if (cb != NULL) { \ + TAILQ_REMOVE(&CCBTYPE##que.CCBTYPE##tab, cb, CHAIN);\ + goto out; \ + } else { \ + cb = malloc(sizeof(*cb), M_DEVBUF, M_NOWAIT | M_ZERO); \ + if (cb != NULL) \ + goto out; \ + } \ + CCBTYPE##que.count --; \ + } \ + \ + cb = NULL; \ + \ +out: \ + return cb; \ +} \ + \ +void \ +DEV##_free_ccb(struct CCBTYPE *cb) \ +{ \ + \ + TAILQ_INSERT_TAIL(&CCBTYPE##que.CCBTYPE##tab, cb, CHAIN); \ + CCBTYPE##que.count --; \ + \ + if (CCBTYPE##que.flags & CCB_MWANTED) \ + { \ + CCBTYPE##que.flags &= ~CCB_MWANTED; \ + wakeup ((caddr_t) &CCBTYPE##que.count); \ + } \ +} + +/************************************************************** * Constants **************************************************************/ #define SCSI_LOW_POLL_HZ 1000 Modified: head/sys/cam/scsi/scsi_low.h ============================================================================== --- head/sys/cam/scsi/scsi_low.h Tue Jan 9 15:57:09 2018 (r327728) +++ head/sys/cam/scsi/scsi_low.h Tue Jan 9 16:11:33 2018 (r327729) @@ -57,7 +57,61 @@ #include #include -#include +/************ ccbque.h ***************************/ + +/* $NetBSD$ */ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * [NetBSD for NEC PC98 series] + * Copyright (c) 1994, 1995, 1996 NetBSD/pc98 porting staff. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ +/* + * Common command control queue funcs. + * Written by N. Honda. + */ + +#define CCB_MWANTED 0x01 + +/* (I) structure and prototype */ +#define GENERIC_CCB_ASSERT(DEV, CCBTYPE) \ +TAILQ_HEAD(CCBTYPE##tab, CCBTYPE); \ +struct CCBTYPE##que { \ + struct CCBTYPE##tab CCBTYPE##tab; \ + int count; \ + int maxccb; \ + u_int flags; \ +}; \ + \ +void DEV##_init_ccbque(int); \ +struct CCBTYPE *DEV##_get_ccb(void); \ +void DEV##_free_ccb(struct CCBTYPE *); /******** functions macro ************************/ From owner-svn-src-head@freebsd.org Tue Jan 9 16:28:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F298E61D03; Tue, 9 Jan 2018 16:28:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2AFA4A61; Tue, 9 Jan 2018 16:28:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6378919495; Tue, 9 Jan 2018 16:28:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09GSkEH082295; Tue, 9 Jan 2018 16:28:46 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09GSkxc082294; Tue, 9 Jan 2018 16:28:46 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801091628.w09GSkxc082294@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 9 Jan 2018 16:28:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327730 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 327730 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 16:28:47 -0000 Author: kib Date: Tue Jan 9 16:28:45 2018 New Revision: 327730 URL: https://svnweb.freebsd.org/changeset/base/327730 Log: Fix year. Noted by: oshogbo Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/share/man/man4/smp.4 Modified: head/share/man/man4/smp.4 ============================================================================== --- head/share/man/man4/smp.4 Tue Jan 9 16:11:33 2018 (r327729) +++ head/share/man/man4/smp.4 Tue Jan 9 16:28:45 2018 (r327730) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 6, 2017 +.Dd January 6, 2018 .Dt SMP 4 .Os .Sh NAME From owner-svn-src-head@freebsd.org Tue Jan 9 16:42:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24E36E628E6; Tue, 9 Jan 2018 16:42:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 00A471E1E; Tue, 9 Jan 2018 16:42:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4169E197AE; Tue, 9 Jan 2018 16:42:25 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09GgPAi091363; Tue, 9 Jan 2018 16:42:25 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09GgP5B091362; Tue, 9 Jan 2018 16:42:25 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801091642.w09GgP5B091362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 9 Jan 2018 16:42:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327731 - head/sys/dev/acpica X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/acpica X-SVN-Commit-Revision: 327731 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 16:42:26 -0000 Author: imp Date: Tue Jan 9 16:42:24 2018 New Revision: 327731 URL: https://svnweb.freebsd.org/changeset/base/327731 Log: Consolidate two identical copies of sysres_ids. Modified: head/sys/dev/acpica/acpi.c Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Tue Jan 9 16:28:45 2018 (r327730) +++ head/sys/dev/acpica/acpi.c Tue Jan 9 16:42:24 2018 (r327731) @@ -95,6 +95,9 @@ struct acpi_interface { int num; }; +static char *sysres_ids[] = { "PNP0C01", "PNP0C02", NULL }; +static char *pcilink_ids[] = { "PNP0C0F", NULL }; + /* Global mutex for locking access to the ACPI subsystem. */ struct mtx acpi_mutex; struct callout acpi_sleep_timer; @@ -1168,7 +1171,6 @@ acpi_sysres_alloc(device_t dev) struct resource_list *rl; struct resource_list_entry *rle; struct rman *rm; - char *sysres_ids[] = { "PNP0C01", "PNP0C02", NULL }; device_t *children; int child_count, i; @@ -1215,9 +1217,6 @@ acpi_sysres_alloc(device_t dev) } return (0); } - -static char *pcilink_ids[] = { "PNP0C0F", NULL }; -static char *sysres_ids[] = { "PNP0C01", "PNP0C02", NULL }; /* * Reserve declared resources for devices found during attach once system From owner-svn-src-head@freebsd.org Tue Jan 9 17:43:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62270E66349; Tue, 9 Jan 2018 17:43:53 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3DECF63CD9; Tue, 9 Jan 2018 17:43:53 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (astound-66-234-199-215.ca.astound.net [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 19B8810A8C2; Tue, 9 Jan 2018 12:43:52 -0500 (EST) From: John Baldwin To: Warner Losh Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r327705 - head/stand/mips/beri/common Date: Tue, 09 Jan 2018 09:05:56 -0800 Message-ID: <1620808.I0a57TDRna@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: References: <201801081847.w08IlZ7F033684@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Tue, 09 Jan 2018 12:43:52 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 17:43:53 -0000 On Monday, January 08, 2018 12:02:09 PM Warner Losh wrote: > This should have been a nop... libsa specifically creates 'safe' headers > for all the standard ones. > > Ah, libsa creates a perfectly fine stdint.h, but not a inttypes.h... Would you prefer it to use stdint.h and stdio.h rather than stand.h? > Warner > > On Mon, Jan 8, 2018 at 11:47 AM, John Baldwin wrote: > > > Author: jhb > > Date: Mon Jan 8 18:47:35 2018 > > New Revision: 327705 > > URL: https://svnweb.freebsd.org/changeset/base/327705 > > > > Log: > > Use instead of and in boot code. > > > > In the freestanding boot compile environment, standard headers are not > > available. Curiously, only building with clang exposed this as compiles > > with external GCC still succeeded. > > > > Sponsored by: DARPA / AFRL > > > > Modified: > > head/stand/mips/beri/common/sdcard.c > > > > Modified: head/stand/mips/beri/common/sdcard.c > > ============================================================ > > ================== > > --- head/stand/mips/beri/common/sdcard.c Mon Jan 8 18:46:10 2018 > > (r327704) > > +++ head/stand/mips/beri/common/sdcard.c Mon Jan 8 18:47:35 2018 > > (r327705) > > @@ -33,8 +33,7 @@ > > #include > > #include > > > > -#include > > -#include > > +#include > > > > > > /* > > > > -- John Baldwin From owner-svn-src-head@freebsd.org Tue Jan 9 17:48:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09101E66726 for ; Tue, 9 Jan 2018 17:48:32 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x231.google.com (mail-it0-x231.google.com [IPv6:2607:f8b0:4001:c0b::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BFA6E63F97 for ; Tue, 9 Jan 2018 17:48:31 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x231.google.com with SMTP id b77so9393098itd.0 for ; Tue, 09 Jan 2018 09:48:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=uA8gvuG8XsN5vBKk5CKpE9fdUEEYCKwKpQRxIkuKqNg=; b=URxWOIHKeQ5cYWtDoG0N8yPNsLXNwSbeiCT7K31Zy21izxo6MwrZpAav2I0I6BLT5o OJZXqxyOU4IVcQ+XO0IIqYNoxR/kMzWvrHgG/q2YF1miKhYh4M/SoIabj8DKw6zQZGag AMkZA8pAGL3Zt4Xmu4BNZ512LTUMPnsNRATSPSHJmcAxI3N2zA8s7cHmx+iQTGFTOhiB hXXJ0o/RXFjFu5A00z7RQ8k0d+XQDoAc6JXXgquxgH3+GNKh96WD7AAFA9m5GDkM1imj HYanU8869uIXH4VFs8qJiX7Wn45R+IQeoVT+cMrjdUha9kot33CVMCOrdT+C7JkgQrSA Pp/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=uA8gvuG8XsN5vBKk5CKpE9fdUEEYCKwKpQRxIkuKqNg=; b=Si4eK9yxABv6tDpQtQWw0XB4zlO+wWPeM0khmxBwyT9gvou/esOAtixFU4uhYNXhpc MjhM1c/fxi1C9INcTe660EYxk3ANES5owT+GZzA5ZtVOX7H5alLztLYaxFv/NUl4tqLN zIXJv7t6gX7PrNtAXl1klGTcwkImFcnJXoOa7KyMNJug+e5g/Qj+OANBlY7hKYuUL1wi FMhelTcZJpa6GHv+sK8ecIG9y1nK6lY2bWeXR5OvB7kvRTiJWxhdtHERbSdPZP1Ila0O f0RqQEJKz7PKJa+LiFMSDKW0qDsUtqwoxsKdBzPPqzjxszR+rDHySe/6+958Nol9Jgwu O20A== X-Gm-Message-State: AKGB3mIUvT+AaZQGX3Li2M0KMti0u+GmD2vNz07dcZO/5d3cKWRd9aqd 5Lqxurk9FtwES7tBnEjbocRnYpcve8ZOcnNdMP36vQ== X-Google-Smtp-Source: ACJfBouWn8LLRwpGP7K7bW/Cx37XEXo211orzaCH2Xp92uHYSGH2jLDGcAECHZpR41Cwl1y+BmFCmhD/rdmh0O5CZ5s= X-Received: by 10.36.74.200 with SMTP id k191mr17037618itb.69.1515520110840; Tue, 09 Jan 2018 09:48:30 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.160.217 with HTTP; Tue, 9 Jan 2018 09:48:30 -0800 (PST) X-Originating-IP: [50.253.109.65] In-Reply-To: <1620808.I0a57TDRna@ralph.baldwin.cx> References: <201801081847.w08IlZ7F033684@repo.freebsd.org> <1620808.I0a57TDRna@ralph.baldwin.cx> From: Warner Losh Date: Tue, 9 Jan 2018 10:48:30 -0700 X-Google-Sender-Auth: _7LeqX-G8ElTKISAwH5jLcrZtRU Message-ID: Subject: Re: svn commit: r327705 - head/stand/mips/beri/common To: John Baldwin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 17:48:32 -0000 On Tue, Jan 9, 2018 at 10:05 AM, John Baldwin wrote: > On Monday, January 08, 2018 12:02:09 PM Warner Losh wrote: > > This should have been a nop... libsa specifically creates 'safe' headers > > for all the standard ones. > > > > Ah, libsa creates a perfectly fine stdint.h, but not a inttypes.h... > > Would you prefer it to use stdint.h and stdio.h rather than stand.h? No. stand.h is fine. I just wondered why you hit issues at all with stdio.h. inttypes.h isn't supported because we don't implement the extra functions defined there over stdint.h, so it should have given an error when included. I'm just surprised I didn't catch it in my universe.sh script that I use to build all loaders though... Warner > > Warner > > > > On Mon, Jan 8, 2018 at 11:47 AM, John Baldwin wrote: > > > > > Author: jhb > > > Date: Mon Jan 8 18:47:35 2018 > > > New Revision: 327705 > > > URL: https://svnweb.freebsd.org/changeset/base/327705 > > > > > > Log: > > > Use instead of and in boot code. > > > > > > In the freestanding boot compile environment, standard headers are > not > > > available. Curiously, only building with clang exposed this as > compiles > > > with external GCC still succeeded. > > > > > > Sponsored by: DARPA / AFRL > > > > > > Modified: > > > head/stand/mips/beri/common/sdcard.c > > > > > > Modified: head/stand/mips/beri/common/sdcard.c > > > ============================================================ > > > ================== > > > --- head/stand/mips/beri/common/sdcard.c Mon Jan 8 18:46:10 > 2018 > > > (r327704) > > > +++ head/stand/mips/beri/common/sdcard.c Mon Jan 8 18:47:35 > 2018 > > > (r327705) > > > @@ -33,8 +33,7 @@ > > > #include > > > #include > > > > > > -#include > > > -#include > > > +#include > > > > > > > > > /* > > > > > > > > > -- > John Baldwin > From owner-svn-src-head@freebsd.org Tue Jan 9 19:02:43 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DBFFE6AE66; Tue, 9 Jan 2018 19:02:43 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 18FDA6B3D1; Tue, 9 Jan 2018 19:02:43 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B5C71AF67; Tue, 9 Jan 2018 19:02:42 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09J2g1T049858; Tue, 9 Jan 2018 19:02:42 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09J2gRS049857; Tue, 9 Jan 2018 19:02:42 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201801091902.w09J2gRS049857@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 9 Jan 2018 19:02:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327735 - head/tests/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/tests/sys/netpfil/pf X-SVN-Commit-Revision: 327735 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 19:02:43 -0000 Author: kp Date: Tue Jan 9 19:02:42 2018 New Revision: 327735 URL: https://svnweb.freebsd.org/changeset/base/327735 Log: pf tests: Fix pft_ping.py to work with scapy 2.3.3 Scapy requires the Raw payload to be a string, which was not the case. This caused the pft_ping.py script to fail, which in turn caused the test to fail. Modified: head/tests/sys/netpfil/pf/pft_ping.py Modified: head/tests/sys/netpfil/pf/pft_ping.py ============================================================================== --- head/tests/sys/netpfil/pf/pft_ping.py Tue Jan 9 17:41:34 2018 (r327734) +++ head/tests/sys/netpfil/pf/pft_ping.py Tue Jan 9 19:02:42 2018 (r327735) @@ -79,7 +79,7 @@ def ping(send_if, dst_ip, args): ether = sp.Ether() ip = sp.IP(dst=dst_ip) icmp = sp.ICMP(type='echo-request') - raw = sp.Raw(PAYLOAD_MAGIC) + raw = sp.Raw(str(PAYLOAD_MAGIC)) if args.send_tos: ip.tos = int(args.send_tos[0]) From owner-svn-src-head@freebsd.org Tue Jan 9 19:41:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1E66E6D615; Tue, 9 Jan 2018 19:41:11 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9BAC46CBEB; Tue, 9 Jan 2018 19:41:11 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC43B1B56D; Tue, 9 Jan 2018 19:41:10 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09JfAh4064371; Tue, 9 Jan 2018 19:41:10 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09JfAvF064370; Tue, 9 Jan 2018 19:41:10 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201801091941.w09JfAvF064370@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Tue, 9 Jan 2018 19:41:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327736 - head/sys/powerpc/conf X-SVN-Group: head X-SVN-Commit-Author: nwhitehorn X-SVN-Commit-Paths: head/sys/powerpc/conf X-SVN-Commit-Revision: 327736 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 19:41:11 -0000 Author: nwhitehorn Date: Tue Jan 9 19:41:10 2018 New Revision: 327736 URL: https://svnweb.freebsd.org/changeset/base/327736 Log: Add XHCI support to powerpc64 GENERIC. This is useful to get input devices supported on newer POWER hardware and in graphical VMs run on the same, which are typically XHCI-only. The 32-bit GENERIC kernel, which does not run on hardware made in the last decade and is unlikely to encounter XHCI devices, is left unchanged. PR: kern/224940 Submitted by: Gustavo Romero MFC after: 1 week Modified: head/sys/powerpc/conf/GENERIC64 Modified: head/sys/powerpc/conf/GENERIC64 ============================================================================== --- head/sys/powerpc/conf/GENERIC64 Tue Jan 9 19:02:42 2018 (r327735) +++ head/sys/powerpc/conf/GENERIC64 Tue Jan 9 19:41:10 2018 (r327736) @@ -173,6 +173,7 @@ options USB_DEBUG # enable debug msgs device uhci # UHCI PCI->USB interface device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface +device xhci # XHCI PCI->USB interface device usb # USB Bus (required) device uhid # "Human Interface Devices" device ukbd # Keyboard From owner-svn-src-head@freebsd.org Tue Jan 9 20:06:30 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1BB71E6EC13; Tue, 9 Jan 2018 20:06:30 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) by mx1.freebsd.org (Postfix) with ESMTP id 7C5A16DCF2; Tue, 9 Jan 2018 20:06:29 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Subject: Re: svn commit: r327706 - in head/sys: conf contrib/zstd/lib/freebsd To: "O. Hartmann" , Conrad Meyer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801082014.w08KEGv8071627@repo.freebsd.org> <20180109104739.3fc77a44@freyja.zeit4.iv.bundesimmobilien.de> From: Jung-uk Kim Message-ID: Date: Tue, 9 Jan 2018 15:06:23 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180109104739.3fc77a44@freyja.zeit4.iv.bundesimmobilien.de> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="OjetDBMHcicdtFM2d9KFQ5unK6VeKr8gi" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 20:06:30 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --OjetDBMHcicdtFM2d9KFQ5unK6VeKr8gi Content-Type: multipart/mixed; boundary="hlOuFXcISLJWP5wSum5yijB0ocDxzKtlj"; protected-headers="v1" From: Jung-uk Kim To: "O. Hartmann" , Conrad Meyer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r327706 - in head/sys: conf contrib/zstd/lib/freebsd References: <201801082014.w08KEGv8071627@repo.freebsd.org> <20180109104739.3fc77a44@freyja.zeit4.iv.bundesimmobilien.de> In-Reply-To: <20180109104739.3fc77a44@freyja.zeit4.iv.bundesimmobilien.de> --hlOuFXcISLJWP5wSum5yijB0ocDxzKtlj Content-Type: multipart/mixed; boundary="------------7E711460D23535621727A074" Content-Language: en-US This is a multi-part message in MIME format. --------------7E711460D23535621727A074 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01/09/2018 04:47, O. Hartmann wrote: > On Mon, 8 Jan 2018 20:14:16 +0000 (UTC) > Conrad Meyer wrote: >=20 >> Author: cem >> Date: Mon Jan 8 20:14:16 2018 >> New Revision: 327706 >> URL: https://svnweb.freebsd.org/changeset/base/327706 >> >> Log: >> Integrate zstd into the kernel >> =20 >> Mock userspace headers and include mocked headers first in compilati= on >> command to inject kernel headers and override e.g., malloc(3) with >> malloc(9). >> =20 >> Submitted by: allanjude >> Reviewed by: imp (earlier version), bapt (earlier version) >> Differential Revision: https://reviews.freebsd.org/D10407 >> >> Added: >> head/sys/contrib/zstd/lib/freebsd/ >> head/sys/contrib/zstd/lib/freebsd/stddef.h (contents, props change= d) >> head/sys/contrib/zstd/lib/freebsd/stdint.h (contents, props change= d) >> head/sys/contrib/zstd/lib/freebsd/stdio.h (contents, props changed= ) >> head/sys/contrib/zstd/lib/freebsd/stdlib.h (contents, props change= d) >> head/sys/contrib/zstd/lib/freebsd/string.h (contents, props change= d) >> head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h (contents, props= >> changed) head/sys/contrib/zstd/lib/freebsd/zstd_kmalloc.c (contents,= props >> changed) Modified: >> head/sys/conf/files >> head/sys/conf/kern.pre.mk =2E.. > It seems that CURRENT is unwilling to build due to the error shown belo= w: >=20 > [...] > --- fse_decompress.o --- > In file included from /usr/src/sys/contrib/zstd/lib/common/fse_decompre= ss.c:41: > /usr/src/sys/contrib/zstd/lib/common/bitstream.h:71:12: fatal error: > 'immintrin.h' file not found # include /* support for = bextr > (experimental) */ ^~~~~~~~~~~~~ > --- modules-all --- I reported the same problem yesterday but I didn't get any reply yet. Basically, if CPUTYPE is set in /etc/make.conf and the CPU supports BMI instructions, it breaks. You can use the attached patch as a stopgap. Please note the patch was updated after r327715. Jung-uk Kim --------------7E711460D23535621727A074 Content-Type: text/x-patch; name="zstd.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="zstd.diff" Index: sys/conf/kern.pre.mk =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/conf/kern.pre.mk (revision 327736) +++ sys/conf/kern.pre.mk (working copy) @@ -133,7 +133,7 @@ NORMAL_FWO=3D ${LD} -b binary --no-warn-mismatch -d -m ${LD_EMULATION} -o ${.TARGET} ${.ALLSRC:M*.fw} =20 # for ZSTD in the kernel (include zstd/lib/freebsd before other CFLAGS) -ZSTD_C=3D ${CC} -c -DZSTD_HEAPMODE=3D1 -I$S/contrib/zstd/lib/freebsd ${C= FLAGS} -I$S/contrib/zstd/lib -I$S/contrib/zstd/lib/common ${WERROR} -Wno-= inline -Wno-missing-prototypes ${PROF} ${.IMPSRC} +ZSTD_C=3D ${CC} -c -DZSTD_HEAPMODE=3D1 -U__BMI__ -I$S/contrib/zstd/lib/f= reebsd ${CFLAGS} -I$S/contrib/zstd/lib -I$S/contrib/zstd/lib/common ${WER= ROR} -Wno-inline -Wno-missing-prototypes ${PROF} ${.IMPSRC} =20 # Common for dtrace / zfs CDDL_CFLAGS=3D -DFREEBSD_NAMECACHE -nostdinc -I$S/cddl/compat/opensolari= s -I$S/cddl/contrib/opensolaris/uts/common -I$S -I$S/cddl/contrib/opensol= aris/common ${CFLAGS} -Wno-unknown-pragmas -Wno-missing-prototypes -Wno-u= ndef -Wno-strict-prototypes -Wno-cast-qual -Wno-parentheses -Wno-redundan= t-decls -Wno-missing-braces -Wno-uninitialized -Wno-unused -Wno-inline -W= no-switch -Wno-pointer-arith -Wno-unknown-pragmas --------------7E711460D23535621727A074-- --hlOuFXcISLJWP5wSum5yijB0ocDxzKtlj-- --OjetDBMHcicdtFM2d9KFQ5unK6VeKr8gi Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEl1bqgKaRyqfWXu/CfJ+WJvzb8UYFAlpVIL8ACgkQfJ+WJvzb 8UaONwgAj4jnrogWEJ4FIIvf7qwgtnyX7jrcEq5VaHWVE2KS1lN5hfuuYGAFgwM+ NbClJVCxN7FVKaxha8aCgJFOJgIDX4gESTi++YL3b+29FbzOuCh379vjdB5AIYYg oiMKqsdj8PyvR08QWttl6gpfkQ5G/Goo6n8t+ouxwCHz/c4Mrmb7/24GwaTXuwMf fRjcwK3Poc9APgQaP6oJRnfgcTtP1ggOZuSu+s6zRl3C68eY0VRXv36yOIDFjiVo gEVn5AjYhXfeiz782ouPDaIc3N3To5bl3W0jOr0nzxda6Vr4xXAYuw/9GoSXgqCg DaS3cRrKtJvKvnJVT6HyYwqsr4dWMw== =vAtt -----END PGP SIGNATURE----- --OjetDBMHcicdtFM2d9KFQ5unK6VeKr8gi-- From owner-svn-src-head@freebsd.org Tue Jan 9 20:20:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4B95E6FC1B; Tue, 9 Jan 2018 20:20:02 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 315826E904; Tue, 9 Jan 2018 20:20:01 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from thor.intern.walstatt.dynvpn.de ([78.55.187.186]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MTO3f-1ePPpu0BgF-00SKqP; Tue, 09 Jan 2018 21:19:53 +0100 Date: Tue, 9 Jan 2018 21:19:12 +0100 From: "O. Hartmann" To: Jung-uk Kim Cc: "O. Hartmann" , Conrad Meyer , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r327706 - in head/sys: conf contrib/zstd/lib/freebsd Message-ID: <20180109211939.1c4dc54e@thor.intern.walstatt.dynvpn.de> In-Reply-To: References: <201801082014.w08KEGv8071627@repo.freebsd.org> <20180109104739.3fc77a44@freyja.zeit4.iv.bundesimmobilien.de> Organization: WALSTATT User-Agent: OutScare 3.1415926 X-Operating-System: ImNotAnOperatingSystem 3.141592527 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/Mmi/ZVwQtN6Pz_uT3+x_xTl"; protocol="application/pgp-signature" X-Provags-ID: V03:K0:8Geq15TH/TiQ97G44TgfpDNJoMHscMNTvE2Nlv8JIs3u5isgh9E Q70XP58Y2Am1Flo7bLJjBJWDU7eQkCMRNjR1eUTqIxyTgbzkXaoQEQqlSLNX2DvzJnf6/18 sIuP0YXa2LRT5HfW466T6ul+S9CL8iLheMvH14evWAZuIm6gpWR/o/e9dnvxmFgSjdYQCqM xPZ6rua8FqwdnH/N7giGQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:JLRue7ufKqE=:tydmPbY5kk8kanHMW7A1Ee RzF0AY4xKtGn1qFeNoEv0yNQj/MQSp8lgJPBuf+VDeoiwHaX59NsVKsYFAnF4s2HGDP5pMBnj tgIk6cx50yuImzDSyEG23IQDYY3c80q2A6YX4xTibptkvV8GLgZSi8KE1/oAV3bgSgiSIki5k Nfc0bQZ06I8DcOgbQgbK+gXPLMyUD7NbQWHShptTsFRM862yrafFWtDxMjrloK0evWUeS6jDc W5OeSznbiZy6WxglSm9w8JoCbha9RbITeku1RjNrFPd0/Uzb9xylAHWHZXK2BjaRIgghGKLgJ vxZUyvR/2XBbR9hfC19AG/KvFfqgHw8PBDZbM9zdefEcxGFuTIne3JUxw6i2K0GzsBJPLhhpY A4b0rmgSV6GQPS3jI0+liG6MmgMDTKeB5iMGJxHVzXRQYeF21FwVEkZYWTG7OKCDFzKopfUvc iLjoQFuFAQynz9jYfMhm1OkLuHYKfAAGpV/zOWJZWZ53ymtbgeJBP57cUzmBWW4KnlF9DszZt i5t+I8alUx0dExiaaOgCt3EwsPaYxPz2sDBdYk3nE5KdQBGEA56q37HbkIAmvl6CA10snJg0S gVk3I9Co11dixAOFcKoiAoYCgtd2iDkSVff+fZ/0gn7f1zRDH4fIJdqKRMzWQQ8mTZMpWmbaU i22QDNa5UYlR/bNzvfHXv60cMsmivlBOD6mUJUk0NGHmxr0SrCqCfE2x2HB6WJhZJjTlrQYic /yi2j9Si1dHIdayJ/jTGTJiOOK11TFaOwIh0q8afYliRPy7bOk0oWcqIWoC5uqtwoaZ2Yh2Dy L4vIwUq7Q8EME/1ms5uYyuNk0dv+Q== X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 20:20:02 -0000 --Sig_/Mmi/ZVwQtN6Pz_uT3+x_xTl Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Am Tue, 9 Jan 2018 15:06:23 -0500 Jung-uk Kim schrieb: > On 01/09/2018 04:47, O. Hartmann wrote: > > On Mon, 8 Jan 2018 20:14:16 +0000 (UTC) > > Conrad Meyer wrote: > > =20 > >> Author: cem > >> Date: Mon Jan 8 20:14:16 2018 > >> New Revision: 327706 > >> URL: https://svnweb.freebsd.org/changeset/base/327706 > >> > >> Log: > >> Integrate zstd into the kernel > >> =20 > >> Mock userspace headers and include mocked headers first in compilati= on > >> command to inject kernel headers and override e.g., malloc(3) with > >> malloc(9). > >> =20 > >> Submitted by: allanjude > >> Reviewed by: imp (earlier version), bapt (earlier version) > >> Differential Revision: https://reviews.freebsd.org/D10407 > >> > >> Added: > >> head/sys/contrib/zstd/lib/freebsd/ > >> head/sys/contrib/zstd/lib/freebsd/stddef.h (contents, props change= d) > >> head/sys/contrib/zstd/lib/freebsd/stdint.h (contents, props change= d) > >> head/sys/contrib/zstd/lib/freebsd/stdio.h (contents, props changed) > >> head/sys/contrib/zstd/lib/freebsd/stdlib.h (contents, props change= d) > >> head/sys/contrib/zstd/lib/freebsd/string.h (contents, props change= d) > >> head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h (contents, props > >> changed) head/sys/contrib/zstd/lib/freebsd/zstd_kmalloc.c (contents,= props > >> changed) Modified: > >> head/sys/conf/files > >> head/sys/conf/kern.pre.mk =20 >=20 > ... >=20 > > It seems that CURRENT is unwilling to build due to the error shown belo= w: > >=20 > > [...] > > --- fse_decompress.o --- > > In file included from /usr/src/sys/contrib/zstd/lib/common/fse_decompre= ss.c:41: > > /usr/src/sys/contrib/zstd/lib/common/bitstream.h:71:12: fatal error: > > 'immintrin.h' file not found # include /* support for = bextr > > (experimental) */ ^~~~~~~~~~~~~ > > --- modules-all --- =20 >=20 > I reported the same problem yesterday but I didn't get any reply yet. > Basically, if CPUTYPE is set in /etc/make.conf and the CPU supports BMI > instructions, it breaks. You can use the attached patch as a stopgap. > Please note the patch was updated after r327715. >=20 > Jung-uk Kim Thank you very much. Didn't receive any answere, too, so far. Indeed, CPUTYPE is set and compilation breaks on all >=3D Haswell CPUs, whi= le C2D and IvyBridge do ... Regards, Oliver --=20 O. Hartmann Ich widerspreche der Nutzung oder =C3=9Cbermittlung meiner Daten f=C3=BCr Werbezwecke oder f=C3=BCr die Markt- oder Meinungsforschung (=C2=A7 28 Abs.= 4 BDSG). --Sig_/Mmi/ZVwQtN6Pz_uT3+x_xTl Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iLUEARMKAB0WIQQZVZMzAtwC2T/86TrS528fyFhYlAUCWlUj2wAKCRDS528fyFhY lHSWAgCS8DrlD3TrszNjlhkGAfP/X+Gw6vdIaqKyAf2Sx+Kdy1V3hOeS2nhQ4XvZ ThxYtmeNUYgPMH8capRo1DrHOoIHAf9sI5TCDIjbnUx+fPSEiYltjf4Gi2T/XW0S TVLgCAe+oovU8LWoJMbEYdvwgAJ3gTIeQMwhq97rw9WN6hdnTl9l =SB9O -----END PGP SIGNATURE----- --Sig_/Mmi/ZVwQtN6Pz_uT3+x_xTl-- From owner-svn-src-head@freebsd.org Tue Jan 9 20:35:59 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A2EEE709E1; Tue, 9 Jan 2018 20:35:59 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 543FD6F611; Tue, 9 Jan 2018 20:35:59 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 910561BE73; Tue, 9 Jan 2018 20:35:58 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09KZwUd089334; Tue, 9 Jan 2018 20:35:58 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09KZwUs089333; Tue, 9 Jan 2018 20:35:58 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201801092035.w09KZwUs089333@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 9 Jan 2018 20:35:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327737 - head/etc/rc.d X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/etc/rc.d X-SVN-Commit-Revision: 327737 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 20:35:59 -0000 Author: cy Date: Tue Jan 9 20:35:58 2018 New Revision: 327737 URL: https://svnweb.freebsd.org/changeset/base/327737 Log: USNO and possibly others have misinterpreted the maining of the leapseconds last-update field and incorrectly increment it when changing the file even though the leapsecond data has not changed. For instance, if a leapsecond file is obtained from USNO, when it expires it will not be replaced by a newer file from other sources because it has an incorrect later last-update (version). This corrects r304780. PR: 225029 Submitted by: ian MFC after: 3 days Modified: head/etc/rc.d/ntpd Modified: head/etc/rc.d/ntpd ============================================================================== --- head/etc/rc.d/ntpd Tue Jan 9 19:41:10 2018 (r327736) +++ head/etc/rc.d/ntpd Tue Jan 9 20:35:58 2018 (r327737) @@ -144,9 +144,9 @@ ntpd_fetch_leapfile() { done ntp_ver_no_tmp=$(get_ntp_leapfile_ver $ntp_tmp_leapfile) ntp_expiry_tmp=$(get_ntp_leapfile_expiry $ntp_tmp_leapfile) - if [ "$ntp_ver_no_tmp" -gt "$ntp_ver_no_db" -o \ - "$ntp_ver_no_tmp" -eq "$ntp_ver_no_db" -a \ - "$ntp_expiry_tmp" -gt "$ntp_expiry_db" ]; then + if [ "$ntp_expiry_tmp" -gt "$ntp_expiry_db" -o \ + "$ntp_expiry_tmp" -eq "$ntp_expiry_db" -a \ + "$ntp_ver_no_tmp" -gt "$ntp_ver_no_db" ]; then $verbose using $url as $ntp_db_leapfile mv $ntp_tmp_leapfile $ntp_db_leapfile else From owner-svn-src-head@freebsd.org Tue Jan 9 20:53:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A756E71D86; Tue, 9 Jan 2018 20:53:32 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1D6317073F; Tue, 9 Jan 2018 20:53:32 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 357991C1DE; Tue, 9 Jan 2018 20:53:31 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09KrVYv098503; Tue, 9 Jan 2018 20:53:31 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09KrV2L098502; Tue, 9 Jan 2018 20:53:31 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201801092053.w09KrV2L098502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 9 Jan 2018 20:53:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327738 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 327738 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 20:53:32 -0000 Author: cem Date: Tue Jan 9 20:53:30 2018 New Revision: 327738 URL: https://svnweb.freebsd.org/changeset/base/327738 Log: Fix Zstd x86 kernel build with -march= Disable Zstd experimental support for __BMI__ intrinsics, when built with -march=foo supporting such intrinsics, to avoid attempting to include immintrin.h. If a later Zstd marks the support non-experimental, we may want to revisit this approach. Submitted by: jkim Reported by: jkim, "Oliver Hartmann" Modified: head/sys/conf/kern.pre.mk Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Tue Jan 9 20:35:58 2018 (r327737) +++ head/sys/conf/kern.pre.mk Tue Jan 9 20:53:30 2018 (r327738) @@ -133,7 +133,7 @@ NORMAL_FWO= ${LD} -b binary --no-warn-mismatch -d -war -m ${LD_EMULATION} -o ${.TARGET} ${.ALLSRC:M*.fw} # for ZSTD in the kernel (include zstd/lib/freebsd before other CFLAGS) -ZSTD_C= ${CC} -c -DZSTD_HEAPMODE=1 -I$S/contrib/zstd/lib/freebsd ${CFLAGS} -I$S/contrib/zstd/lib -I$S/contrib/zstd/lib/common ${WERROR} -Wno-inline -Wno-missing-prototypes ${PROF} ${.IMPSRC} +ZSTD_C= ${CC} -c -DZSTD_HEAPMODE=1 -I$S/contrib/zstd/lib/freebsd ${CFLAGS} -I$S/contrib/zstd/lib -I$S/contrib/zstd/lib/common ${WERROR} -Wno-inline -Wno-missing-prototypes ${PROF} -U__BMI__ ${.IMPSRC} # Common for dtrace / zfs CDDL_CFLAGS= -DFREEBSD_NAMECACHE -nostdinc -I$S/cddl/compat/opensolaris -I$S/cddl/contrib/opensolaris/uts/common -I$S -I$S/cddl/contrib/opensolaris/common ${CFLAGS} -Wno-unknown-pragmas -Wno-missing-prototypes -Wno-undef -Wno-strict-prototypes -Wno-cast-qual -Wno-parentheses -Wno-redundant-decls -Wno-missing-braces -Wno-uninitialized -Wno-unused -Wno-inline -Wno-switch -Wno-pointer-arith -Wno-unknown-pragmas From owner-svn-src-head@freebsd.org Tue Jan 9 21:02:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82FFAE7268C; Tue, 9 Jan 2018 21:02:41 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5D16870F35; Tue, 9 Jan 2018 21:02:41 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8073C1C385; Tue, 9 Jan 2018 21:02:40 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09L2efk002943; Tue, 9 Jan 2018 21:02:40 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09L2eGm002942; Tue, 9 Jan 2018 21:02:40 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201801092102.w09L2eGm002942@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 9 Jan 2018 21:02:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327739 - head/contrib/subversion/subversion/svn svnadmin/hooks/scripts X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/contrib/subversion/subversion/svn svnadmin/hooks/scripts X-SVN-Commit-Revision: 327739 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 21:02:41 -0000 Author: asomers Date: Tue Jan 9 21:02:39 2018 New Revision: 327739 URL: https://svnweb.freebsd.org/changeset/base/327739 Log: Add Pull Request to the Subversion commit template Reviewed by: emaste MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D13178 Modified: head/contrib/subversion/subversion/svn/util.c Changes in other areas also in this revision: Modified: svnadmin/hooks/scripts/log-police.py Modified: head/contrib/subversion/subversion/svn/util.c ============================================================================== --- head/contrib/subversion/subversion/svn/util.c Tue Jan 9 20:53:30 2018 (r327738) +++ head/contrib/subversion/subversion/svn/util.c Tue Jan 9 21:02:39 2018 (r327739) @@ -352,6 +352,7 @@ static const char *prefixes[] = { "Relnotes:", "Security:", "Sponsored by:", + "Pull Request:", "Differential Revision:", }; @@ -443,6 +444,7 @@ svn_cl__get_log_message(const char **log_msg, if (sponsored_by != NULL) svn_stringbuf_appendcstr(default_msg, sponsored_by); svn_stringbuf_appendcstr(default_msg, APR_EOL_STR); + svn_stringbuf_appendcstr(default_msg, "Pull Request:\t" APR_EOL_STR); svn_stringbuf_appendcstr(default_msg, "Differential Revision:\t" APR_EOL_STR); svn_stringbuf_appendcstr(default_msg, EDITOR_EOF_PREFIX); svn_stringbuf_appendcstr(default_msg, APR_EOL_STR); @@ -458,6 +460,7 @@ svn_cl__get_log_message(const char **log_msg, svn_stringbuf_appendcstr(default_msg, "> Relnotes: Set to 'yes' for mention in release notes." APR_EOL_STR); svn_stringbuf_appendcstr(default_msg, "> Security: Vulnerability reference (one per line) or description." APR_EOL_STR); svn_stringbuf_appendcstr(default_msg, "> Sponsored by: If the change was sponsored by an organization." APR_EOL_STR); + svn_stringbuf_appendcstr(default_msg, "> Pull Request: https://github.com/freebsd/freebsd/pull/### (*full* GitHub URL needed)." APR_EOL_STR); svn_stringbuf_appendcstr(default_msg, "> Differential Revision: https://reviews.freebsd.org/D### (*full* phabric URL needed)." APR_EOL_STR); svn_stringbuf_appendcstr(default_msg, "> Empty fields above will be automatically removed." APR_EOL_STR); svn_stringbuf_appendcstr(default_msg, APR_EOL_STR); From owner-svn-src-head@freebsd.org Tue Jan 9 21:12:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 924FAE73024; Tue, 9 Jan 2018 21:12:54 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6D89571862; Tue, 9 Jan 2018 21:12:54 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC3601C56B; Tue, 9 Jan 2018 21:12:53 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09LCrhj007090; Tue, 9 Jan 2018 21:12:53 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09LCrHT007089; Tue, 9 Jan 2018 21:12:53 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201801092112.w09LCrHT007089@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 9 Jan 2018 21:12:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327740 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 327740 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 21:12:54 -0000 Author: bdrewery Date: Tue Jan 9 21:12:53 2018 New Revision: 327740 URL: https://svnweb.freebsd.org/changeset/base/327740 Log: Bump version for r327597 adding cpucontrol -e support Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Tue Jan 9 21:02:39 2018 (r327739) +++ head/sys/sys/param.h Tue Jan 9 21:12:53 2018 (r327740) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200054 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200055 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Tue Jan 9 21:23:17 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 816DBE7395D; Tue, 9 Jan 2018 21:23:17 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 56BDB7205B; Tue, 9 Jan 2018 21:23:17 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F6F41C749; Tue, 9 Jan 2018 21:23:16 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09LNGXP011540; Tue, 9 Jan 2018 21:23:16 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09LNGV1011539; Tue, 9 Jan 2018 21:23:16 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201801092123.w09LNGV1011539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Tue, 9 Jan 2018 21:23:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327741 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 327741 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 21:23:17 -0000 Author: scottl Date: Tue Jan 9 21:23:16 2018 New Revision: 327741 URL: https://svnweb.freebsd.org/changeset/base/327741 Log: Hold a refcount on the periph while running the allocation queue. This will allow sub-transports to release their probe pseudo-device with fewer convoluted restrictions. Obtained from: Netflix Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Tue Jan 9 21:12:53 2018 (r327740) +++ head/sys/cam/cam_xpt.c Tue Jan 9 21:23:16 2018 (r327741) @@ -3383,6 +3383,7 @@ xpt_run_allocq(struct cam_periph *periph, int sleep) cam_periph_assert(periph, MA_OWNED); if (periph->periph_allocating) return; + cam_periph_doacquire(periph); periph->periph_allocating = 1; CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("xpt_run_allocq(%p)\n", periph)); device = periph->path->device; @@ -3426,6 +3427,7 @@ restart: if (ccb != NULL) xpt_release_ccb(ccb); periph->periph_allocating = 0; + cam_periph_release_locked(periph); } static void From owner-svn-src-head@freebsd.org Tue Jan 9 21:24:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20114E73B88; Tue, 9 Jan 2018 21:24:07 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9CFC772235; Tue, 9 Jan 2018 21:24:06 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC2321C74E; Tue, 9 Jan 2018 21:24:05 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09LO5VJ011612; Tue, 9 Jan 2018 21:24:05 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09LO5l3011611; Tue, 9 Jan 2018 21:24:05 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201801092124.w09LO5l3011611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Tue, 9 Jan 2018 21:24:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327742 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 327742 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 21:24:07 -0000 Author: scottl Date: Tue Jan 9 21:24:05 2018 New Revision: 327742 URL: https://svnweb.freebsd.org/changeset/base/327742 Log: Release the held refcount on the probe periph when probing is done, now that r327741 lets this happen. Obtained from: Netflix Modified: head/sys/cam/nvme/nvme_xpt.c Modified: head/sys/cam/nvme/nvme_xpt.c ============================================================================== --- head/sys/cam/nvme/nvme_xpt.c Tue Jan 9 21:23:16 2018 (r327741) +++ head/sys/cam/nvme/nvme_xpt.c Tue Jan 9 21:24:05 2018 (r327742) @@ -318,8 +318,7 @@ nvme_probe_start(struct cam_periph *periph, union ccb xpt_done(start_ccb); } cam_periph_invalidate(periph); - /* Can't release periph since we hit a (possibly bogus) assertion */ -// cam_periph_release_locked(periph); + cam_periph_release_locked(periph); } static void From owner-svn-src-head@freebsd.org Tue Jan 9 22:48:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 733E3E77DF7; Tue, 9 Jan 2018 22:48:14 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4E29C756ED; Tue, 9 Jan 2018 22:48:14 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8BB011D468; Tue, 9 Jan 2018 22:48:13 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09MmDSw046085; Tue, 9 Jan 2018 22:48:13 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09MmDG1046084; Tue, 9 Jan 2018 22:48:13 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801092248.w09MmDG1046084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 9 Jan 2018 22:48:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327751 - head/include X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/include X-SVN-Commit-Revision: 327751 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 22:48:14 -0000 Author: pfg Date: Tue Jan 9 22:48:13 2018 New Revision: 327751 URL: https://svnweb.freebsd.org/changeset/base/327751 Log: Use the __result_use_check attribute also for reallocf(3). The GCC attribute causes a warning to be emitted if a caller of the function with this attribute does not use its return value. Unlike the traditional realloc, with reallocf(3) we don't have to check for NULL values but we still have to make sure the result is used. MFC after: 3 days Modified: head/include/stdlib.h Modified: head/include/stdlib.h ============================================================================== --- head/include/stdlib.h Tue Jan 9 22:00:06 2018 (r327750) +++ head/include/stdlib.h Tue Jan 9 22:48:13 2018 (r327751) @@ -304,7 +304,7 @@ int radixsort(const unsigned char **, int, const unsi unsigned); void *reallocarray(void *, size_t, size_t) __result_use_check __alloc_size(2) __alloc_size(3); -void *reallocf(void *, size_t) __alloc_size(2); +void *reallocf(void *, size_t) __result_use_check __alloc_size(2); int rpmatch(const char *); void setprogname(const char *); int sradixsort(const unsigned char **, int, const unsigned char *, From owner-svn-src-head@freebsd.org Tue Jan 9 23:57:30 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BF84E7B726; Tue, 9 Jan 2018 23:57:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3867277D47; Tue, 9 Jan 2018 23:57:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8BB821DFA6; Tue, 9 Jan 2018 23:57:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09NvTaU075280; Tue, 9 Jan 2018 23:57:29 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09NvTFO075279; Tue, 9 Jan 2018 23:57:29 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801092357.w09NvTFO075279@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 9 Jan 2018 23:57:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327752 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 327752 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 23:57:30 -0000 Author: jhb Date: Tue Jan 9 23:57:29 2018 New Revision: 327752 URL: https://svnweb.freebsd.org/changeset/base/327752 Log: Add a counter to track in-flight AIO requests using unmapped I/O. MFC after: 2 weeks Sponsored by: Chelsio Communications Modified: head/sys/kern/vfs_aio.c Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Tue Jan 9 22:48:13 2018 (r327751) +++ head/sys/kern/vfs_aio.c Tue Jan 9 23:57:29 2018 (r327752) @@ -150,6 +150,11 @@ static int num_buf_aio = 0; SYSCTL_INT(_vfs_aio, OID_AUTO, num_buf_aio, CTLFLAG_RD, &num_buf_aio, 0, "Number of aio requests presently handled by the buf subsystem"); +static int num_unmapped_aio = 0; +SYSCTL_INT(_vfs_aio, OID_AUTO, num_unmapped_aio, CTLFLAG_RD, &num_unmapped_aio, + 0, + "Number of aio requests presently handled by unmapped I/O buffers"); + /* Number of async I/O processes in the process of being started */ /* XXX This should be local to aio_aqueue() */ static int num_aio_resv_start = 0; @@ -1305,6 +1310,7 @@ aio_qphysio(struct proc *p, struct kaiocb *job) bp->bio_ma_offset = poff; bp->bio_data = unmapped_buf; bp->bio_flags |= BIO_UNMAPPED; + atomic_add_int(&num_unmapped_aio, 1); } /* Perform transfer. */ @@ -2365,7 +2371,8 @@ aio_physwakeup(struct bio *bp) AIO_LOCK(ki); ki->kaio_buffer_count--; AIO_UNLOCK(ki); - } + } else + atomic_subtract_int(&num_unmapped_aio, 1); vm_page_unhold_pages(job->pages, job->npages); bp = job->bp; From owner-svn-src-head@freebsd.org Wed Jan 10 00:02:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1AB5E7BC77; Wed, 10 Jan 2018 00:02:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CD41D782CC; Wed, 10 Jan 2018 00:02:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2192F1E13A; Wed, 10 Jan 2018 00:02:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0A027C1079443; Wed, 10 Jan 2018 00:02:07 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0A026Oi079442; Wed, 10 Jan 2018 00:02:06 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801100002.w0A026Oi079442@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 10 Jan 2018 00:02:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327753 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 327753 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 00:02:08 -0000 Author: jhb Date: Wed Jan 10 00:02:06 2018 New Revision: 327753 URL: https://svnweb.freebsd.org/changeset/base/327753 Log: Simplify some logic by merging an if test with a subsequent switch. Specifically, in aio_queue_file() the code was doing this: if (opcode == LIO_SYNC) { ... } switch (opcode) { ... case LIO_SYNC: ... } This moves the body of the if statement into the LIO_SYNC case of the switch statement. MFC after: 2 weeks Sponsored by: Chelsio Communications Modified: head/sys/kern/vfs_aio.c Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Tue Jan 9 23:57:29 2018 (r327752) +++ head/sys/kern/vfs_aio.c Wed Jan 10 00:02:06 2018 (r327753) @@ -1736,7 +1736,13 @@ queueit: return (EOPNOTSUPP); } - if (opcode == LIO_SYNC) { + switch (job->uaiocb.aio_lio_opcode) { + case LIO_READ: + case LIO_WRITE: + aio_schedule(job, aio_process_rw); + error = 0; + break; + case LIO_SYNC: AIO_LOCK(ki); TAILQ_FOREACH(job2, &ki->kaio_jobqueue, plist) { if (job2->fd_file == job->fd_file && @@ -1758,15 +1764,6 @@ queueit: return (0); } AIO_UNLOCK(ki); - } - - switch (opcode) { - case LIO_READ: - case LIO_WRITE: - aio_schedule(job, aio_process_rw); - error = 0; - break; - case LIO_SYNC: aio_schedule(job, aio_process_sync); error = 0; break; From owner-svn-src-head@freebsd.org Wed Jan 10 00:08:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D80AE7C2C2; Wed, 10 Jan 2018 00:08:58 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2861878691; Wed, 10 Jan 2018 00:08:58 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 78A4C1E15B; Wed, 10 Jan 2018 00:08:57 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0A08v6s079688; Wed, 10 Jan 2018 00:08:57 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0A08veS079687; Wed, 10 Jan 2018 00:08:57 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201801100008.w0A08veS079687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Wed, 10 Jan 2018 00:08:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327754 - head/sys/dev/md X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: head/sys/dev/md X-SVN-Commit-Revision: 327754 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 00:08:58 -0000 Author: jtl Date: Wed Jan 10 00:08:57 2018 New Revision: 327754 URL: https://svnweb.freebsd.org/changeset/base/327754 Log: Fix backwards MD_VERIFY logic for md devices. If the MD_VERIFY flag is set, we should use O_VERIFY. If the MD_VERIFY flag is not set, we should not. Reviewed by: stevek Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D13814 Modified: head/sys/dev/md/md.c Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Wed Jan 10 00:02:06 2018 (r327753) +++ head/sys/dev/md/md.c Wed Jan 10 00:08:57 2018 (r327754) @@ -1392,7 +1392,7 @@ mdcreate_vnode(struct md_s *sc, struct md_ioctl *mdio, * set the FWRITE mask before trying to open the backing store. */ flags = FREAD | ((mdio->md_options & MD_READONLY) ? 0 : FWRITE) \ - | ((mdio->md_options & MD_VERIFY) ? 0 : O_VERIFY); + | ((mdio->md_options & MD_VERIFY) ? O_VERIFY : 0); NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, sc->file, td); error = vn_open(&nd, &flags, 0, NULL); if (error != 0) From owner-svn-src-head@freebsd.org Wed Jan 10 00:18:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44A4BE7CAE1; Wed, 10 Jan 2018 00:18:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1EC5B78CF1; Wed, 10 Jan 2018 00:18:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5599D1E2FB; Wed, 10 Jan 2018 00:18:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0A0Imb1083684; Wed, 10 Jan 2018 00:18:48 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0A0ImEb083683; Wed, 10 Jan 2018 00:18:48 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801100018.w0A0ImEb083683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 10 Jan 2018 00:18:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327755 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 327755 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 00:18:49 -0000 Author: jhb Date: Wed Jan 10 00:18:47 2018 New Revision: 327755 URL: https://svnweb.freebsd.org/changeset/base/327755 Log: Allow the fast-path for disk AIO requests to fail requests. - If aio_qphysio() returns a non-zero error code, fail the request rather than queueing it to the AIO kproc pool to be retried via the slow path. Currently this means that if vm_fault_quick_hold_pages() reports an error, EFAULT is returned from the fast-path rather than retrying the request in the slow path where it will still fail with EFAULT. - If aio_qphysio() wishes to use the fast path for a device that doesn't support unmapped I/O but there are already the maximum number of such requests in flight, fail with EAGAIN as we do for other AIO resource limits rather than queueing the request to the AIO kproc pool. - Move the opcode check for aio_qphysio() out of the caller and into aio_qphysio() to simplify some logic and remove two goto's while here. It also uses a whitelist (only supported for LIO_READ / LIO_WRITE) rather than a blacklist (skipped for LIO_SYNC). PR: 217261 Submitted by: jkim (an earlier version) MFC after: 2 weeks Sponsored by: Chelsio Communications Modified: head/sys/kern/vfs_aio.c Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Wed Jan 10 00:08:57 2018 (r327754) +++ head/sys/kern/vfs_aio.c Wed Jan 10 00:18:47 2018 (r327755) @@ -1228,6 +1228,9 @@ aio_qphysio(struct proc *p, struct kaiocb *job) cb = &job->uaiocb; fp = job->fd_file; + if (!(cb->aio_lio_opcode == LIO_WRITE || + cb->aio_lio_opcode == LIO_READ)) + return (-1); if (fp == NULL || fp->f_type != DTYPE_VNODE) return (-1); @@ -1268,7 +1271,7 @@ aio_qphysio(struct proc *p, struct kaiocb *job) goto unref; } if (ki->kaio_buffer_count >= ki->kaio_ballowed_count) { - error = -1; + error = EAGAIN; goto unref; } @@ -1700,27 +1703,13 @@ aio_queue_file(struct file *fp, struct kaiocb *job) struct kaiocb *job2; struct vnode *vp; struct mount *mp; - int error, opcode; + int error; bool safe; ki = job->userproc->p_aioinfo; - opcode = job->uaiocb.aio_lio_opcode; - if (opcode == LIO_SYNC) - goto queueit; - - if ((error = aio_qphysio(job->userproc, job)) == 0) - goto done; -#if 0 - /* - * XXX: This means qphysio() failed with EFAULT. The current - * behavior is to retry the operation via fo_read/fo_write. - * Wouldn't it be better to just complete the request with an - * error here? - */ - if (error > 0) - goto done; -#endif -queueit: + error = aio_qphysio(job->userproc, job); + if (error >= 0) + return (error); safe = false; if (fp->f_type == DTYPE_VNODE) { vp = fp->f_vnode; @@ -1770,7 +1759,6 @@ queueit: default: error = EINVAL; } -done: return (error); } From owner-svn-src-head@freebsd.org Wed Jan 10 02:28:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E3ACE5CECB; Wed, 10 Jan 2018 02:28:11 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5A1667D23E; Wed, 10 Jan 2018 02:28:11 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 97E611F862; Wed, 10 Jan 2018 02:28:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0A2SAY9038026; Wed, 10 Jan 2018 02:28:10 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0A2SA4k038025; Wed, 10 Jan 2018 02:28:10 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201801100228.w0A2SA4k038025@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 10 Jan 2018 02:28:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327756 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 327756 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 02:28:11 -0000 Author: ian Date: Wed Jan 10 02:28:10 2018 New Revision: 327756 URL: https://svnweb.freebsd.org/changeset/base/327756 Log: Bugfix: on RTC chips with a 32-bit binary counter, after reading the time, return immediately rather than falling through to the logic that reads BCD-encoded time. Modified: head/sys/dev/iicbus/ds13rtc.c Modified: head/sys/dev/iicbus/ds13rtc.c ============================================================================== --- head/sys/dev/iicbus/ds13rtc.c Wed Jan 10 00:18:47 2018 (r327755) +++ head/sys/dev/iicbus/ds13rtc.c Wed Jan 10 02:28:10 2018 (r327756) @@ -364,9 +364,8 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) /* If the chip counts time in binary, we just read and return it. */ if (sc->flags & SC_F_BINARY) { - if ((err = read_timeword(sc, &ts->tv_sec)) != 0) - return (err); ts->tv_nsec = 0; + return (read_timeword(sc, &ts->tv_sec)); } /* From owner-svn-src-head@freebsd.org Wed Jan 10 02:32:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B03EAE5D490; Wed, 10 Jan 2018 02:32:00 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8D2367D772; Wed, 10 Jan 2018 02:32:00 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E74E91F9C0; Wed, 10 Jan 2018 02:31:59 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0A2Vxsp038912; Wed, 10 Jan 2018 02:31:59 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0A2Vx0h038911; Wed, 10 Jan 2018 02:31:59 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201801100231.w0A2Vx0h038911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 10 Jan 2018 02:31:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327757 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 327757 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 02:32:00 -0000 Author: ian Date: Wed Jan 10 02:31:59 2018 New Revision: 327757 URL: https://svnweb.freebsd.org/changeset/base/327757 Log: Bugfix: don't lose the am/pm mode flag when setting the time. Unlike most RTC chips that have a control register bit for am/pm mode, the DS13xx series uses one of the high bits in the hour register. Thus, when setting the time in am/pm mode, the am/pm mode flag has to be ORed into the hour. Modified: head/sys/dev/iicbus/ds13rtc.c Modified: head/sys/dev/iicbus/ds13rtc.c ============================================================================== --- head/sys/dev/iicbus/ds13rtc.c Wed Jan 10 02:28:10 2018 (r327756) +++ head/sys/dev/iicbus/ds13rtc.c Wed Jan 10 02:31:59 2018 (r327757) @@ -415,7 +415,7 @@ ds13rtc_settime(device_t dev, struct timespec *ts) struct time_regs tregs; struct ds13rtc_softc *sc; int err; - uint8_t cflag, statreg, pmflag; + uint8_t cflag, statreg, pmflags; sc = device_get_softc(dev); @@ -432,11 +432,12 @@ ds13rtc_settime(device_t dev, struct timespec *ts) clock_ts_to_ct(ts, &ct); /* If the chip is in AMPM mode deal with the PM flag. */ - pmflag = 0; + pmflags = 0; if (sc->flags & SC_F_AMPM) { + pmflags = DS13xx_B_HOUR_AMPM; if (ct.hour >= 12) { ct.hour -= 12; - pmflag = DS13xx_B_HOUR_PM; + pmflags |= DS13xx_B_HOUR_PM; } if (ct.hour == 0) ct.hour = 12; @@ -451,7 +452,7 @@ ds13rtc_settime(device_t dev, struct timespec *ts) tregs.sec = TOBCD(ct.sec); tregs.min = TOBCD(ct.min); - tregs.hour = TOBCD(ct.hour) | pmflag; + tregs.hour = TOBCD(ct.hour) | pmflags; tregs.day = TOBCD(ct.day); tregs.month = TOBCD(ct.mon) | cflag; tregs.year = TOBCD(ct.year % 100); From owner-svn-src-head@freebsd.org Wed Jan 10 02:57:04 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76594E608EB; Wed, 10 Jan 2018 02:57:04 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D8387E236; Wed, 10 Jan 2018 02:57:04 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B6221FD0B; Wed, 10 Jan 2018 02:57:03 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0A2v3S1050274; Wed, 10 Jan 2018 02:57:03 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0A2v3Sj050273; Wed, 10 Jan 2018 02:57:03 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201801100257.w0A2v3Sj050273@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 10 Jan 2018 02:57:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327758 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 327758 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 02:57:04 -0000 Author: ian Date: Wed Jan 10 02:57:03 2018 New Revision: 327758 URL: https://svnweb.freebsd.org/changeset/base/327758 Log: Convert a collection of unrelated bitwise flags to a collection of boolean vars in the softc. It makes the code more compact and readable, and actually uses less memory too. Modified: head/sys/dev/iicbus/ds13rtc.c Modified: head/sys/dev/iicbus/ds13rtc.c ============================================================================== --- head/sys/dev/iicbus/ds13rtc.c Wed Jan 10 02:31:59 2018 (r327757) +++ head/sys/dev/iicbus/ds13rtc.c Wed Jan 10 02:57:03 2018 (r327758) @@ -162,16 +162,14 @@ struct time_regs { struct ds13rtc_softc { device_t dev; device_t busdev; - u_int flags; /* SC_F_* flags */ u_int chiptype; /* Type of DS13xx chip */ uint8_t secaddr; /* Address of seconds register */ uint8_t osfaddr; /* Address of register with OSF */ + bool use_ampm; /* Use AM/PM mode. */ + bool use_century; /* Use the Century bit. */ + bool is_binary_counter; /* Chip has 32-bit binary counter. */ }; -#define SC_F_BINARY (1u << 0) /* Time is 32-bit binary counter */ -#define SC_F_AMPM (1u << 1) /* Use PM flag in hours reg */ -#define SC_F_CENTURY (1u << 2) /* Use century bit */ - /* * We use the compat_data table to look up hint strings in the non-FDT case, so * define the struct locally when we don't get it from ofw_bus_subr.h. @@ -326,14 +324,14 @@ ds13rtc_start(void *arg) * chips that do AM/PM mode, the flag bit is in the hours register, * which is secaddr+2. */ - if ((sc->chiptype != TYPE_DS1340) && !(sc->flags & SC_F_BINARY)) { + if ((sc->chiptype != TYPE_DS1340) && !sc->is_binary_counter) { if (read_reg(sc, sc->secaddr + 2, &statreg) != 0) { device_printf(sc->dev, "cannot read RTC clock AM/PM bit\n"); return; } if (statreg & DS13xx_B_HOUR_AMPM) - sc->flags |= SC_F_AMPM; + sc->use_ampm = true; } /* @@ -363,7 +361,7 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) return (EINVAL); /* hardware is good, time is not. */ /* If the chip counts time in binary, we just read and return it. */ - if (sc->flags & SC_F_BINARY) { + if (sc->is_binary_counter) { ts->tv_nsec = 0; return (read_timeword(sc, &ts->tv_sec)); } @@ -376,7 +374,7 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) return (err); } - if (sc->flags & SC_F_AMPM) + if (sc->use_ampm) hourmask = DS13xx_M_12HOUR; else hourmask = DS13xx_M_24HOUR; @@ -389,7 +387,7 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) ct.year = FROMBCD(tregs.year & DS13xx_M_YEAR); ct.nsec = 0; - if (sc->flags & SC_F_AMPM) { + if (sc->use_ampm) { if (ct.hour == 12) ct.hour = 0; if (tregs.hour & DS13xx_B_HOUR_PM) @@ -400,7 +398,7 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) * If this chip has a century bit, honor it. Otherwise let * clock_ct_to_ts() infer the century from the 2-digit year. */ - if (sc->flags & SC_F_CENTURY) + if (sc->use_century) ct.year += (tregs.month & DS13xx_B_MONTH_CENTURY) ? 2000 : 1900; err = clock_ct_to_ts(&ct, ts); @@ -426,14 +424,14 @@ ds13rtc_settime(device_t dev, struct timespec *ts) ts->tv_sec -= utc_offset(); /* If the chip counts time in binary, store tv_sec and we're done. */ - if (sc->flags & SC_F_BINARY) + if (sc->is_binary_counter) return (write_timeword(sc, ts->tv_sec)); clock_ts_to_ct(ts, &ct); /* If the chip is in AMPM mode deal with the PM flag. */ pmflags = 0; - if (sc->flags & SC_F_AMPM) { + if (sc->use_ampm) { pmflags = DS13xx_B_HOUR_AMPM; if (ct.hour >= 12) { ct.hour -= 12; @@ -445,7 +443,7 @@ ds13rtc_settime(device_t dev, struct timespec *ts) /* If the chip has a century bit, set it as needed. */ cflag = 0; - if (sc->flags & SC_F_CENTURY) { + if (sc->use_century) { if (ct.year >= 2000) cflag |= DS13xx_B_MONTH_CENTURY; } @@ -572,7 +570,7 @@ ds13rtc_attach(device_t dev) case TYPE_DS1342: case TYPE_DS1375: sc->osfaddr = DS133x_R_STATUS; - sc->flags |= SC_F_CENTURY; + sc->use_century = true; break; case TYPE_DS1340: sc->osfaddr = DS1340_R_STATUS; @@ -581,7 +579,7 @@ ds13rtc_attach(device_t dev) case TYPE_DS1372: case TYPE_DS1374: sc->osfaddr = DS137x_R_STATUS; - sc->flags |= SC_F_BINARY; + sc->is_binary_counter = true; break; case TYPE_DS1388: sc->osfaddr = DS1388_R_STATUS; From owner-svn-src-head@freebsd.org Wed Jan 10 02:57:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 253E6E60984; Wed, 10 Jan 2018 02:57:24 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F26997E379; Wed, 10 Jan 2018 02:57:23 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3030B1FD0C; Wed, 10 Jan 2018 02:57:23 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0A2vNEv050328; Wed, 10 Jan 2018 02:57:23 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0A2vN6Q050327; Wed, 10 Jan 2018 02:57:23 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201801100257.w0A2vN6Q050327@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Wed, 10 Jan 2018 02:57:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327759 - head/lib/libcasper/services/cap_dns X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/services/cap_dns X-SVN-Commit-Revision: 327759 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 02:57:24 -0000 Author: oshogbo Date: Wed Jan 10 02:57:22 2018 New Revision: 327759 URL: https://svnweb.freebsd.org/changeset/base/327759 Log: Fix markup. Modified: head/lib/libcasper/services/cap_dns/cap_dns.3 Modified: head/lib/libcasper/services/cap_dns/cap_dns.3 ============================================================================== --- head/lib/libcasper/services/cap_dns/cap_dns.3 Wed Jan 10 02:57:03 2018 (r327758) +++ head/lib/libcasper/services/cap_dns/cap_dns.3 Wed Jan 10 02:57:22 2018 (r327759) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 8, 2018 +.Dd January 10, 2018 .Dt CAP_DNS 3 .Os .Sh NAME @@ -59,7 +59,7 @@ The functions .Fn cap_gethostbyname2 , .Fn cep_gethostbyaddr and -.Xr cap_getnameinfo +.Fn cap_getnameinfo are respectively equivalent to .Xr gethostbyname 2 , .Xr gethostbyname2 2 , From owner-svn-src-head@freebsd.org Wed Jan 10 05:06:22 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C85BE67A15; Wed, 10 Jan 2018 05:06:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 580B482BFB; Wed, 10 Jan 2018 05:06:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FE4C2128E; Wed, 10 Jan 2018 05:06:21 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0A56LYj005132; Wed, 10 Jan 2018 05:06:21 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0A56Lp7005131; Wed, 10 Jan 2018 05:06:21 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201801100506.w0A56Lp7005131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 10 Jan 2018 05:06:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327760 - head/sys/geom/mirror X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/geom/mirror X-SVN-Commit-Revision: 327760 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 05:06:22 -0000 Author: markj Date: Wed Jan 10 05:06:21 2018 New Revision: 327760 URL: https://svnweb.freebsd.org/changeset/base/327760 Log: Avoid referencing a possibly freed consumer after r327496. g_mirror_regular_request() may free the gmirror consumer for a disk if that disk is being disconnected, after which we must not dereference the consumer pointer. CID: 1384280 X-MFC with: r327496 Modified: head/sys/geom/mirror/g_mirror.c Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Wed Jan 10 02:57:22 2018 (r327759) +++ head/sys/geom/mirror/g_mirror.c Wed Jan 10 05:06:21 2018 (r327760) @@ -906,16 +906,12 @@ g_mirror_done(struct bio *bp) } static void -g_mirror_regular_request_error(struct g_mirror_softc *sc, struct bio *bp) +g_mirror_regular_request_error(struct g_mirror_softc *sc, + struct g_mirror_disk *disk, struct bio *bp) { - struct g_mirror_disk *disk; - disk = bp->bio_from->private; - if (bp->bio_cmd == BIO_FLUSH && bp->bio_error == EOPNOTSUPP) return; - if (disk == NULL) - return; if ((disk->d_flags & G_MIRROR_DISK_FLAG_BROKEN) == 0) { disk->d_flags |= G_MIRROR_DISK_FLAG_BROKEN; @@ -942,6 +938,7 @@ g_mirror_regular_request_error(struct g_mirror_softc * static void g_mirror_regular_request(struct g_mirror_softc *sc, struct bio *bp) { + struct g_mirror_disk *disk; struct bio *pbp; g_topology_assert_not(); @@ -952,7 +949,8 @@ g_mirror_regular_request(struct g_mirror_softc *sc, st bp->bio_from->index--; if (bp->bio_cmd == BIO_WRITE || bp->bio_cmd == BIO_DELETE) sc->sc_writes--; - if (bp->bio_from->private == NULL) { + disk = bp->bio_from->private; + if (disk == NULL) { g_topology_lock(); g_mirror_kill_consumer(sc, bp->bio_from); g_topology_unlock(); @@ -999,7 +997,8 @@ g_mirror_regular_request(struct g_mirror_softc *sc, st } else if (bp->bio_error != 0) { if (pbp->bio_error == 0) pbp->bio_error = bp->bio_error; - g_mirror_regular_request_error(sc, bp); + if (disk != NULL) + g_mirror_regular_request_error(sc, disk, bp); switch (pbp->bio_cmd) { case BIO_DELETE: case BIO_WRITE: From owner-svn-src-head@freebsd.org Wed Jan 10 05:29:04 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 441E0E68B88; Wed, 10 Jan 2018 05:29:04 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0446E836B1; Wed, 10 Jan 2018 05:29:04 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 390F0215C2; Wed, 10 Jan 2018 05:29:03 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0A5T3R2013625; Wed, 10 Jan 2018 05:29:03 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0A5T33b013624; Wed, 10 Jan 2018 05:29:03 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201801100529.w0A5T33b013624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Wed, 10 Jan 2018 05:29:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327761 - head/sbin/camcontrol X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/sbin/camcontrol X-SVN-Commit-Revision: 327761 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 05:29:04 -0000 Author: scottl Date: Wed Jan 10 05:29:02 2018 New Revision: 327761 URL: https://svnweb.freebsd.org/changeset/base/327761 Log: Implement the ability to query NVME for its controller data so that it will be shown when issueing the 'camcontrol devlist' command. Obtained from: Netflix Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Wed Jan 10 05:06:21 2018 (r327760) +++ head/sbin/camcontrol/camcontrol.c Wed Jan 10 05:29:02 2018 (r327761) @@ -275,6 +275,7 @@ camcontrol_optret getoption(struct camcontrol_opts *ta static int getdevlist(struct cam_device *device); #endif /* MINIMALISTIC */ static int getdevtree(int argc, char **argv, char *combinedopt); +static int print_dev_nvme(struct device_match_result *dev_result, char *tmpstr); #ifndef MINIMALISTIC static int testunitready(struct cam_device *device, int task_attr, int retry_count, int timeout, int quiet); @@ -623,6 +624,12 @@ getdevtree(int argc, char **argv, char *combinedopt) sizeof(fw)); sprintf(tmpstr, "<%s %s %s %s>", vendor, product, revision, fw); + } else if (dev_result->protocol == PROTO_NVME) { + if (print_dev_nvme(dev_result, + &tmpstr[0]) != 0) { + skip_device = 1; + break; + } } else { sprintf(tmpstr, "<>"); } @@ -676,6 +683,58 @@ getdevtree(int argc, char **argv, char *combinedopt) close(fd); return (error); +} + +static int +print_dev_nvme(struct device_match_result *dev_result, char *tmpstr) +{ + union ccb *ccb; + struct ccb_dev_advinfo *advi; + struct cam_device *dev; + struct nvme_controller_data cdata; + char vendor[64], product[64]; + + dev = cam_open_btl(dev_result->path_id, dev_result->target_id, + dev_result->target_lun, O_RDWR, NULL); + if (dev == NULL) { + warnx("%s", cam_errbuf); + return (1); + } + + ccb = cam_getccb(dev); + if (ccb == NULL) { + warnx("couldn't allocate CCB"); + cam_close_device(dev); + return (1); + } + + advi = &ccb->cdai; + advi->ccb_h.flags = CAM_DIR_IN; + advi->ccb_h.func_code = XPT_DEV_ADVINFO; + advi->flags = CDAI_FLAG_NONE; + advi->buftype = CDAI_TYPE_NVME_CNTRL; + advi->bufsiz = sizeof(struct nvme_controller_data); + advi->buf = (uint8_t *)&cdata; + + if (cam_send_ccb(dev, ccb) < 0) { + warn("error sending CAMIOCOMMAND ioctl"); + cam_freeccb(ccb); + cam_close_device(dev); + return(1); + } + if (advi->ccb_h.status != CAM_REQ_CMP) { + warnx("got CAM error %#x", advi->ccb_h.status); + cam_freeccb(ccb); + cam_close_device(dev); + return(1); + } + cam_strvis(vendor, cdata.mn, sizeof(cdata.mn), sizeof(vendor)); + cam_strvis(product, cdata.fr, sizeof(cdata.fr), sizeof(product)); + sprintf(tmpstr, "<%s %s>", vendor, product); + + cam_freeccb(ccb); + cam_close_device(dev); + return (0); } #ifndef MINIMALISTIC From owner-svn-src-head@freebsd.org Wed Jan 10 05:52:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C22F9E69D88; Wed, 10 Jan 2018 05:52:25 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 84E6584258; Wed, 10 Jan 2018 05:52:25 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD71821A7C; Wed, 10 Jan 2018 05:52:24 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0A5qOxo025757; Wed, 10 Jan 2018 05:52:24 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0A5qOrc025756; Wed, 10 Jan 2018 05:52:24 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201801100552.w0A5qOrc025756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Wed, 10 Jan 2018 05:52:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327762 - head/sbin/camcontrol X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/sbin/camcontrol X-SVN-Commit-Revision: 327762 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 05:52:25 -0000 Author: scottl Date: Wed Jan 10 05:52:24 2018 New Revision: 327762 URL: https://svnweb.freebsd.org/changeset/base/327762 Log: Refactor code related to 'camcontrol devlist' Obtained from: Netflix Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Wed Jan 10 05:29:02 2018 (r327761) +++ head/sbin/camcontrol/camcontrol.c Wed Jan 10 05:52:24 2018 (r327762) @@ -275,6 +275,11 @@ camcontrol_optret getoption(struct camcontrol_opts *ta static int getdevlist(struct cam_device *device); #endif /* MINIMALISTIC */ static int getdevtree(int argc, char **argv, char *combinedopt); +static int print_dev_scsi(struct device_match_result *dev_result, char *tmpstr); +static int print_dev_ata(struct device_match_result *dev_result, char *tmpstr); +static int print_dev_semb(struct device_match_result *dev_result, char *tmpstr); +static int print_dev_mmcsd(struct device_match_result *dev_result, + char *tmpstr); static int print_dev_nvme(struct device_match_result *dev_result, char *tmpstr); #ifndef MINIMALISTIC static int testunitready(struct cam_device *device, int task_attr, @@ -555,8 +560,7 @@ getdevtree(int argc, char **argv, char *combinedopt) } case DEV_MATCH_DEVICE: { struct device_match_result *dev_result; - char vendor[16], product[48], revision[16]; - char fw[5], tmpstr[256]; + char tmpstr[256]; if (busonly == 1) break; @@ -573,57 +577,30 @@ getdevtree(int argc, char **argv, char *combinedopt) skip_device = 0; if (dev_result->protocol == PROTO_SCSI) { - cam_strvis(vendor, dev_result->inq_data.vendor, - sizeof(dev_result->inq_data.vendor), - sizeof(vendor)); - cam_strvis(product, - dev_result->inq_data.product, - sizeof(dev_result->inq_data.product), - sizeof(product)); - cam_strvis(revision, - dev_result->inq_data.revision, - sizeof(dev_result->inq_data.revision), - sizeof(revision)); - sprintf(tmpstr, "<%s %s %s>", vendor, product, - revision); + if (print_dev_scsi(dev_result, + &tmpstr[0]) != 0) { + skip_device = 1; + break; + } } else if (dev_result->protocol == PROTO_ATA || dev_result->protocol == PROTO_SATAPM) { - cam_strvis(product, - dev_result->ident_data.model, - sizeof(dev_result->ident_data.model), - sizeof(product)); - cam_strvis(revision, - dev_result->ident_data.revision, - sizeof(dev_result->ident_data.revision), - sizeof(revision)); - sprintf(tmpstr, "<%s %s>", product, - revision); - } else if (dev_result->protocol == PROTO_MMCSD) { - if (strlen(dev_result->mmc_ident_data.model) > 0) { - sprintf(tmpstr, "<%s>", dev_result->mmc_ident_data.model); - } else { - sprintf(tmpstr, "<%s card>", - dev_result->mmc_ident_data.card_features & CARD_FEATURE_SDIO ? "SDIO" : "unknown"); + if (print_dev_ata(dev_result, + &tmpstr[0]) != 0) { + skip_device = 1; + break; } + } else if (dev_result->protocol == PROTO_MMCSD){ + if (print_dev_mmcsd(dev_result, + &tmpstr[0]) != 0) { + skip_device = 1; + break; + } } else if (dev_result->protocol == PROTO_SEMB) { - struct sep_identify_data *sid; - - sid = (struct sep_identify_data *) - &dev_result->ident_data; - cam_strvis(vendor, sid->vendor_id, - sizeof(sid->vendor_id), - sizeof(vendor)); - cam_strvis(product, sid->product_id, - sizeof(sid->product_id), - sizeof(product)); - cam_strvis(revision, sid->product_rev, - sizeof(sid->product_rev), - sizeof(revision)); - cam_strvis(fw, sid->firmware_rev, - sizeof(sid->firmware_rev), - sizeof(fw)); - sprintf(tmpstr, "<%s %s %s %s>", - vendor, product, revision, fw); + if (print_dev_semb(dev_result, + &tmpstr[0]) != 0) { + skip_device = 1; + break; + } } else if (dev_result->protocol == PROTO_NVME) { if (print_dev_nvme(dev_result, &tmpstr[0]) != 0) { @@ -683,6 +660,70 @@ getdevtree(int argc, char **argv, char *combinedopt) close(fd); return (error); +} + +static int +print_dev_scsi(struct device_match_result *dev_result, char *tmpstr) +{ + char vendor[16], product[48], revision[16]; + + cam_strvis(vendor, dev_result->inq_data.vendor, + sizeof(dev_result->inq_data.vendor), sizeof(vendor)); + cam_strvis(product, dev_result->inq_data.product, + sizeof(dev_result->inq_data.product), sizeof(product)); + cam_strvis(revision, dev_result->inq_data.revision, + sizeof(dev_result->inq_data.revision), sizeof(revision)); + sprintf(tmpstr, "<%s %s %s>", vendor, product, revision); + + return (0); +} + +static int +print_dev_ata(struct device_match_result *dev_result, char *tmpstr) +{ + char product[48], revision[16]; + + cam_strvis(product, dev_result->ident_data.model, + sizeof(dev_result->ident_data.model), sizeof(product)); + cam_strvis(revision, dev_result->ident_data.revision, + sizeof(dev_result->ident_data.revision), sizeof(revision)); + sprintf(tmpstr, "<%s %s>", product, revision); + + return (0); +} + +static int +print_dev_semb(struct device_match_result *dev_result, char *tmpstr) +{ + struct sep_identify_data *sid; + char vendor[16], product[48], revision[16], fw[5]; + + sid = (struct sep_identify_data *)&dev_result->ident_data; + cam_strvis(vendor, sid->vendor_id, + sizeof(sid->vendor_id), sizeof(vendor)); + cam_strvis(product, sid->product_id, + sizeof(sid->product_id), sizeof(product)); + cam_strvis(revision, sid->product_rev, + sizeof(sid->product_rev), sizeof(revision)); + cam_strvis(fw, sid->firmware_rev, + sizeof(sid->firmware_rev), sizeof(fw)); + sprintf(tmpstr, "<%s %s %s %s>", vendor, product, revision, fw); + + return (0); +} + +static int +print_dev_mmcsd(struct device_match_result *dev_result, char *tmpstr) +{ + + if (strlen(dev_result->mmc_ident_data.model) > 0) { + sprintf(tmpstr, "<%s>", dev_result->mmc_ident_data.model); + } else { + sprintf(tmpstr, "<%s card>", + dev_result->mmc_ident_data.card_features & + CARD_FEATURE_SDIO ? "SDIO" : "unknown"); + } + return (0); } static int From owner-svn-src-head@freebsd.org Wed Jan 10 06:31:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D74B4E6B7B5; Wed, 10 Jan 2018 06:31:00 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B175537C; Wed, 10 Jan 2018 06:31:00 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6A7F21F52; Wed, 10 Jan 2018 06:30:59 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0A6UxJG041387; Wed, 10 Jan 2018 06:30:59 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0A6UxLT041383; Wed, 10 Jan 2018 06:30:59 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201801100630.w0A6UxLT041383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 10 Jan 2018 06:30:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327763 - in head/sys: conf contrib/zstd/lib/freebsd X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: conf contrib/zstd/lib/freebsd X-SVN-Commit-Revision: 327763 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 06:31:00 -0000 Author: cem Date: Wed Jan 10 06:30:59 2018 New Revision: 327763 URL: https://svnweb.freebsd.org/changeset/base/327763 Log: Finally, fix Zstd kernel build on MIPS and RISC-V Add an implementation of the intrinsics invoked by __builtin_ctz{,ll} and __builtin_clz{,ll}, and include this compilation unit on platforms that lack assembly intrinsics for those builtins (MIPS and RISC-V). Future cleanup work might involve bringing these into a mini libcompiler-rt for the standalone kernel environment. Or cleaning up the approach upstream takes for builtins in standalone environments (or just FreeBSD). For now, at least this builds, and doesn't require modifying the vendor code. Reported by: jeff, markj, mizhka Reviewed by: jhb (earlier version), rpokala (comment text earlier version) Sponsored by: Dell EMC Isilon Added: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c (contents, props changed) Modified: head/sys/conf/files.mips head/sys/conf/files.riscv Modified: head/sys/conf/files.mips ============================================================================== --- head/sys/conf/files.mips Wed Jan 10 05:52:24 2018 (r327762) +++ head/sys/conf/files.mips Wed Jan 10 06:30:59 2018 (r327763) @@ -112,3 +112,6 @@ cddl/compat/opensolaris/kern/opensolaris_atomic.c opti cddl/dev/dtrace/mips/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}" cddl/dev/dtrace/mips/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" cddl/dev/fbt/mips/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}" + +# Zstd +contrib/zstd/lib/freebsd/zstd_kfreebsd.c standard compile-with ${ZSTD_C} Modified: head/sys/conf/files.riscv ============================================================================== --- head/sys/conf/files.riscv Wed Jan 10 05:52:24 2018 (r327762) +++ head/sys/conf/files.riscv Wed Jan 10 06:30:59 2018 (r327763) @@ -56,3 +56,6 @@ riscv/riscv/uio_machdep.c standard riscv/riscv/uma_machdep.c standard riscv/riscv/unwind.c optional ddb | kdtrace_hooks | stack riscv/riscv/vm_machdep.c standard + +# Zstd +contrib/zstd/lib/freebsd/zstd_kfreebsd.c standard compile-with ${ZSTD_C} Added: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c Wed Jan 10 06:30:59 2018 (r327763) @@ -0,0 +1,75 @@ +/*- + * Copyright (c) 2018 Conrad Meyer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include "zstd_kfreebsd.h" + +/* + * The kernel as a standalone target does not link against libgcc or + * libcompiler-rt. On platforms (e.g., MIPS and RISCV) that do not have a + * direct assembly implementation of the relevant builtin functions that zstd + * references, the compiler converts them into calls to the runtime library + * intrinsics. Since the kernel does not link against the runtime libraries, + * this results in a failure to link the kernel. + * + * The goal of the following definitions is to use supported kernel constructs + * to implement the same functionality, without adding diff to the Zstd contrib + * code. + * + * A subsequent enhancement might create a mini compiler-rt library for kernel + * use and move these over there instead. + */ + +/* Count trailing zeros */ +int +__ctzsi2(int x) +{ + if (x == 0) + return (sizeof(x) * NBBY); + return (ffs(x) - 1); +} + +long long +__ctzdi2(long long x) +{ + if (x == 0) + return (sizeof(x) * NBBY); + return (ffsll(x) - 1); +} + +/* Count leading zeros */ +int +__clzsi2(int x) +{ + return (sizeof(x) * NBBY - fls(x)); +} + +long long +__clzdi2(long long x) +{ + return (sizeof(x) * NBBY - flsll(x)); +} From owner-svn-src-head@freebsd.org Wed Jan 10 14:59:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 709E1E60366; Wed, 10 Jan 2018 14:59:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 44A0E78638; Wed, 10 Jan 2018 14:59:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6D73A270E7; Wed, 10 Jan 2018 14:58:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AEwxwU054950; Wed, 10 Jan 2018 14:58:59 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AEwxLJ054948; Wed, 10 Jan 2018 14:58:59 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801101458.w0AEwxLJ054948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 10 Jan 2018 14:58:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327766 - in head: . sys/sys usr.sbin usr.sbin/digictl X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: . sys/sys usr.sbin usr.sbin/digictl X-SVN-Commit-Revision: 327766 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 14:59:00 -0000 Author: imp Date: Wed Jan 10 14:58:58 2018 New Revision: 327766 URL: https://svnweb.freebsd.org/changeset/base/327766 Log: Remove vestiges of digi(4) driver, first attempted in r305235 with more in r317426. There's nothing in the tree that references digiio.h (apart from digictl(8)), so no driver implements it. Since digictl(8) was only used to control digi(4) devices, it too should go. Deleted: head/sys/sys/digiio.h head/usr.sbin/digictl/Makefile head/usr.sbin/digictl/Makefile.depend head/usr.sbin/digictl/digictl.8 head/usr.sbin/digictl/digictl.c Modified: head/ObsoleteFiles.inc head/usr.sbin/Makefile Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Jan 10 09:06:07 2018 (r327765) +++ head/ObsoleteFiles.inc Wed Jan 10 14:58:58 2018 (r327766) @@ -38,6 +38,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20180109: Remove vestiges of digi(4) driver +OLD_FILES+=usr/include/sys/digiio.h +OLD_FILES+=usr/sbin/digictl +OLD_FILES+=usr/share/man/man8/digictl.8.gz # 20180107: Convert remaining geli(8) tests to ATF OLD_FILES+=tests/sys/geom/class/eli/nokey_test.sh OLD_FILES+=tests/sys/geom/class/eli/readonly_test.sh Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Wed Jan 10 09:06:07 2018 (r327765) +++ head/usr.sbin/Makefile Wed Jan 10 14:58:58 2018 (r327766) @@ -22,7 +22,6 @@ SUBDIR= adduser \ devctl \ devinfo \ devmatch \ - digictl \ diskinfo \ dumpcis \ etcupdate \ From owner-svn-src-head@freebsd.org Wed Jan 10 14:59:20 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD230E603EB; Wed, 10 Jan 2018 14:59:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A74AD78789; Wed, 10 Jan 2018 14:59:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E498C270E8; Wed, 10 Jan 2018 14:59:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AExJmF055029; Wed, 10 Jan 2018 14:59:19 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AExJWM055025; Wed, 10 Jan 2018 14:59:19 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801101459.w0AExJWM055025@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 10 Jan 2018 14:59:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327767 - in head/sys: conf i386/bios i386/conf i386/isa X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: conf i386/bios i386/conf i386/isa X-SVN-Commit-Revision: 327767 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 14:59:20 -0000 Author: imp Date: Wed Jan 10 14:59:19 2018 New Revision: 327767 URL: https://svnweb.freebsd.org/changeset/base/327767 Log: Retire pmtimer driver. Move time fixing into apm driver. Move Iwasaki-san's copyright over. Remove FIXME code that couldn't possibly work. Call tc_settime() with our estimate of the delta we've been alseep (the one we print) to adjust the time. Not sure what to do about callouts, so keep the small #ifdef in place there. Differential Revision: https://reviews.freebsd.org/D13823 Deleted: head/sys/i386/isa/pmtimer.c Modified: head/sys/conf/files.i386 head/sys/i386/bios/apm.c head/sys/i386/conf/GENERIC head/sys/i386/conf/NOTES Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Wed Jan 10 14:58:58 2018 (r327766) +++ head/sys/conf/files.i386 Wed Jan 10 14:59:19 2018 (r327767) @@ -520,7 +520,6 @@ i386/ibcs2/ibcs2_util.c optional ibcs2 i386/ibcs2/ibcs2_xenix.c optional ibcs2 i386/ibcs2/ibcs2_xenix_sysent.c optional ibcs2 i386/ibcs2/imgact_coff.c optional ibcs2 -i386/isa/pmtimer.c optional pmtimer i386/isa/prof_machdep.c optional profiling-routine i386/linux/imgact_linux.c optional compat_linux i386/linux/linux_dummy.c optional compat_linux Modified: head/sys/i386/bios/apm.c ============================================================================== --- head/sys/i386/bios/apm.c Wed Jan 10 14:58:58 2018 (r327766) +++ head/sys/i386/bios/apm.c Wed Jan 10 14:59:19 2018 (r327767) @@ -16,6 +16,32 @@ * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) */ +/*- + * Copyright (c) 2000 Mitsuru IWASAKI + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + #include __FBSDID("$FreeBSD$"); @@ -38,6 +64,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -205,7 +232,7 @@ static int apm_driver_version(int version) { struct apm_softc *sc = &apm_softc; - + sc->bios.r.eax = (APM_BIOS << 8) | APM_DRVVERSION; sc->bios.r.ebx = 0x0; sc->bios.r.ecx = version; @@ -220,28 +247,28 @@ apm_driver_version(int version) return (1); } - + /* engage/disengage power management (APM 1.1 or later) */ static int apm_engage_disengage_pm(int engage) { struct apm_softc *sc = &apm_softc; - + sc->bios.r.eax = (APM_BIOS << 8) | APM_ENGAGEDISENGAGEPM; sc->bios.r.ebx = PMDV_ALLDEV; sc->bios.r.ecx = engage; sc->bios.r.edx = 0; return (apm_bioscall()); } - + /* get PM event */ static u_int apm_getevent(void) { struct apm_softc *sc = &apm_softc; - + sc->bios.r.eax = (APM_BIOS << 8) | APM_GETPMEVENT; - + sc->bios.r.ebx = 0; sc->bios.r.ecx = 0; sc->bios.r.edx = 0; @@ -249,18 +276,18 @@ apm_getevent(void) return (PMEV_NOEVENT); return (sc->bios.r.ebx & 0xffff); } - + /* suspend entire system */ static int apm_suspend_system(int state) { struct apm_softc *sc = &apm_softc; - + sc->bios.r.eax = (APM_BIOS << 8) | APM_SETPWSTATE; sc->bios.r.ebx = PMDV_ALLDEV; sc->bios.r.ecx = state; sc->bios.r.edx = 0; - + if (apm_bioscall()) { printf("Entire system suspend failure: errcode = %d\n", 0xff & (sc->bios.r.eax >> 8)); @@ -280,7 +307,7 @@ int apm_display(int newstate) { struct apm_softc *sc = &apm_softc; - + sc->bios.r.eax = (APM_BIOS << 8) | APM_SETPWSTATE; sc->bios.r.ebx = PMDV_DISP0; sc->bios.r.ecx = newstate ? PMST_APMENABLED:PMST_SUSPEND; @@ -331,12 +358,10 @@ apm_battery_low(void) static struct apmhook * apm_add_hook(struct apmhook **list, struct apmhook *ah) { - int s; struct apmhook *p, *prev; APM_DPRINT("Add hook \"%s\"\n", ah->ah_name); - s = splhigh(); if (ah == NULL) panic("illegal apm_hook!"); prev = NULL; @@ -351,30 +376,25 @@ apm_add_hook(struct apmhook **list, struct apmhook *ah ah->ah_next = prev->ah_next; prev->ah_next = ah; } - splx(s); return ah; } static void apm_del_hook(struct apmhook **list, struct apmhook *ah) { - int s; struct apmhook *p, *prev; - s = splhigh(); prev = NULL; for (p = *list; p != NULL; prev = p, p = p->ah_next) if (p == ah) goto deleteit; panic("Tried to delete unregistered apm_hook."); - goto nosuchnode; + return; deleteit: if (prev != NULL) prev->ah_next = p->ah_next; else *list = p->ah_next; -nosuchnode: - splx(s); } @@ -468,7 +488,7 @@ apm_do_standby(void) sc->standbys = sc->standby_countdown = 0; /* - * As far as standby, we don't need to execute + * As far as standby, we don't need to execute * all of suspend hooks. */ if (apm_suspend_system(PMST_STANDBY) == 0) @@ -1047,6 +1067,53 @@ apm_processevent(void) } while (apm_event != PMEV_NOEVENT); } +static struct timeval suspend_time; +static struct timeval diff_time; + +static int +apm_rtc_suspend(void *arg __unused) +{ + + microtime(&diff_time); + inittodr(0); + microtime(&suspend_time); + timevalsub(&diff_time, &suspend_time); + return (0); +} + +static int +apm_rtc_resume(void *arg __unused) +{ + u_int second, minute, hour; + struct timeval resume_time, tmp_time; + struct timespec ts; + + /* modified for adjkerntz */ + timer_restore(); /* restore the all timers */ + inittodr(0); /* adjust time to RTC */ + microtime(&resume_time); + getmicrotime(&tmp_time); + timevaladd(&tmp_time, &diff_time); + /* Calculate the delta time suspended */ + timevalsub(&resume_time, &suspend_time); + + second = ts.tv_sec = resume_time.tv_sec; + ts.tv_nsec = 0; + tc_setclock(&ts); + +#ifdef PMTIMER_FIXUP_CALLTODO + /* Fixup the calltodo list with the delta time. */ + adjust_timeout_calltodo(&resume_time); +#endif /* PMTIMER_FIXUP_CALLTODO */ + hour = second / 3600; + second %= 3600; + minute = second / 60; + second %= 60; + log(LOG_NOTICE, "wakeup from sleeping state (slept %02d:%02d:%02d)\n", + hour, minute, second); + return (0); +} + /* * Attach APM: * @@ -1128,7 +1195,7 @@ apm_attach(device_t dev) } /* Power the system off using APM */ - EVENTHANDLER_REGISTER(shutdown_final, apm_power_off, NULL, + EVENTHANDLER_REGISTER(shutdown_final, apm_power_off, NULL, SHUTDOWN_PRI_LAST); /* Register APM again to pass the correct argument of pm_func. */ @@ -1142,6 +1209,15 @@ apm_attach(device_t dev) UID_ROOT, GID_OPERATOR, 0664, "apm"); make_dev(&apm_cdevsw, APMDEV_CTL, UID_ROOT, GID_OPERATOR, 0660, "apmctl"); + + sc->sc_suspend.ah_fun = apm_rtc_suspend; + sc->sc_suspend.ah_arg = sc; + apm_hook_establish(APM_HOOK_SUSPEND, &sc->sc_suspend); + + sc->sc_resume.ah_fun = apm_rtc_resume; + sc->sc_resume.ah_arg = sc; + apm_hook_establish(APM_HOOK_RESUME, &sc->sc_resume); + return 0; } @@ -1362,7 +1438,7 @@ apmwrite(struct cdev *dev, struct uio *uio, int ioflag if ((error = uiomove((caddr_t)&event_type, sizeof(u_int), uio))) return(error); - if (event_type < 0 || event_type >= APM_NPMEV) + if (event_type >= APM_NPMEV) return(EINVAL); if (sc->event_filter[event_type] == 0) { Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Wed Jan 10 14:58:58 2018 (r327766) +++ head/sys/i386/conf/GENERIC Wed Jan 10 14:59:19 2018 (r327767) @@ -207,8 +207,6 @@ device agp # support several AGP chipsets # Power management support (see NOTES for more options) #device apm -# Add suspend/resume support for the i8254. -device pmtimer # PCCARD (PCMCIA) support # PCMCIA and cardbus bridge support Modified: head/sys/i386/conf/NOTES ============================================================================== --- head/sys/i386/conf/NOTES Wed Jan 10 14:58:58 2018 (r327766) +++ head/sys/i386/conf/NOTES Wed Jan 10 14:59:19 2018 (r327767) @@ -774,7 +774,6 @@ device hyperv # HyperV drivers # smapi: System Management Application Program Interface driver # smbios: DMI/SMBIOS entry point # vpd: Vital Product Data kernel interface -# pmtimer: Adjust system timer at wakeup time # pbio: Parallel (8255 PPI) basic I/O (mode 0) port (e.g. Advantech PCL-724) # asmc: Apple System Management Controller # si: Specialix International SI/XIO or SX intelligent serial card driver @@ -808,7 +807,6 @@ device ipmi device smapi device smbios device vpd -device pmtimer device pbio hint.pbio.0.at="isa" hint.pbio.0.port="0x360" From owner-svn-src-head@freebsd.org Wed Jan 10 15:21:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CBC1E6180E; Wed, 10 Jan 2018 15:21:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3838979582; Wed, 10 Jan 2018 15:21:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 800B327493; Wed, 10 Jan 2018 15:21:36 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AFLaFn067563; Wed, 10 Jan 2018 15:21:36 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AFLanA067562; Wed, 10 Jan 2018 15:21:36 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201801101521.w0AFLanA067562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 10 Jan 2018 15:21:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327768 - head/sys/geom/mirror X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/geom/mirror X-SVN-Commit-Revision: 327768 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 15:21:37 -0000 Author: markj Date: Wed Jan 10 15:21:36 2018 New Revision: 327768 URL: https://svnweb.freebsd.org/changeset/base/327768 Log: Clarify the use of the gmirror flag mask constants. MFC after: 1 week Sponsored by: Dell EMC Isilon Modified: head/sys/geom/mirror/g_mirror.h Modified: head/sys/geom/mirror/g_mirror.h ============================================================================== --- head/sys/geom/mirror/g_mirror.h Wed Jan 10 14:59:19 2018 (r327767) +++ head/sys/geom/mirror/g_mirror.h Wed Jan 10 15:21:36 2018 (r327768) @@ -62,6 +62,8 @@ #define G_MIRROR_DISK_FLAG_HARDCODED 0x0000000000000010ULL #define G_MIRROR_DISK_FLAG_BROKEN 0x0000000000000020ULL #define G_MIRROR_DISK_FLAG_CANDELETE 0x0000000000000040ULL + +/* Per-disk flags which are recorded in on-disk metadata. */ #define G_MIRROR_DISK_FLAG_MASK (G_MIRROR_DISK_FLAG_DIRTY | \ G_MIRROR_DISK_FLAG_SYNCHRONIZING | \ G_MIRROR_DISK_FLAG_FORCE_SYNC | \ @@ -70,6 +72,8 @@ #define G_MIRROR_DEVICE_FLAG_NOAUTOSYNC 0x0000000000000001ULL #define G_MIRROR_DEVICE_FLAG_NOFAILSYNC 0x0000000000000002ULL + +/* Mirror flags which are recorded in on-disk metadata. */ #define G_MIRROR_DEVICE_FLAG_MASK (G_MIRROR_DEVICE_FLAG_NOAUTOSYNC | \ G_MIRROR_DEVICE_FLAG_NOFAILSYNC) From owner-svn-src-head@freebsd.org Wed Jan 10 15:55:09 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76002E63DD3; Wed, 10 Jan 2018 15:55:09 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 462127B519; Wed, 10 Jan 2018 15:55:09 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E9B827A96; Wed, 10 Jan 2018 15:55:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AFt85O081321; Wed, 10 Jan 2018 15:55:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AFt82v081320; Wed, 10 Jan 2018 15:55:08 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201801101555.w0AFt82v081320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 10 Jan 2018 15:55:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327769 - in head/tests/sys/geom/class: eli mirror X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/tests/sys/geom/class: eli mirror X-SVN-Commit-Revision: 327769 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 15:55:09 -0000 Author: markj Date: Wed Jan 10 15:55:07 2018 New Revision: 327769 URL: https://svnweb.freebsd.org/changeset/base/327769 Log: Remove the executable bit from some recently added test scripts. Modified: Directory Properties: head/tests/sys/geom/class/eli/attach_test.sh (props changed) head/tests/sys/geom/class/eli/configure_test.sh (props changed) head/tests/sys/geom/class/eli/detach_test.sh (props changed) head/tests/sys/geom/class/eli/integrity_test.sh (props changed) head/tests/sys/geom/class/mirror/10_test.sh (props changed) head/tests/sys/geom/class/mirror/11_test.sh (props changed) head/tests/sys/geom/class/mirror/12_test.sh (props changed) head/tests/sys/geom/class/mirror/13_test.sh (props changed) From owner-svn-src-head@freebsd.org Wed Jan 10 16:01:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6659E644D1; Wed, 10 Jan 2018 16:01:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8F1437BB21; Wed, 10 Jan 2018 16:01:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7BD027BDC; Wed, 10 Jan 2018 16:01:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AG1P5W084527; Wed, 10 Jan 2018 16:01:25 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AG1PQ9084525; Wed, 10 Jan 2018 16:01:25 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801101601.w0AG1PQ9084525@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 10 Jan 2018 16:01:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327770 - head/usr.bin/clang/lld X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.bin/clang/lld X-SVN-Commit-Revision: 327770 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 16:01:26 -0000 Author: emaste Date: Wed Jan 10 16:01:25 2018 New Revision: 327770 URL: https://svnweb.freebsd.org/changeset/base/327770 Log: lld: introduce basic man page Upstream lld has no man page. Introduce a basic one for FreeBSD based on ld.lld --help, with a brief introduction and additional detail for some options. We'll continue refining this in FreeBSD, and then submit it upstream once the first round of edits are complete. Submitted by: krion, Arshan Khanifar, emaste, bjk MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D13813 Added: head/usr.bin/clang/lld/ld.lld.1 (contents, props changed) Modified: head/usr.bin/clang/lld/Makefile Modified: head/usr.bin/clang/lld/Makefile ============================================================================== --- head/usr.bin/clang/lld/Makefile Wed Jan 10 15:55:07 2018 (r327769) +++ head/usr.bin/clang/lld/Makefile Wed Jan 10 16:01:25 2018 (r327770) @@ -7,9 +7,10 @@ LLD_SRCS= ${LLVM_SRCS}/tools/lld PACKAGE= lld PROG_CXX= ld.lld -MAN= + .if ${MK_LLD_IS_LD} != "no" SYMLINKS= ${PROG_CXX} ${BINDIR}/ld +MLINKS= ld.lld.1 ld.1 .endif CFLAGS+= -I${LLD_SRCS}/ELF Added: head/usr.bin/clang/lld/ld.lld.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/clang/lld/ld.lld.1 Wed Jan 10 16:01:25 2018 (r327770) @@ -0,0 +1,364 @@ +.\"- +.\" Copyright (c) 2018 Kirill Ponomarev +.\" Copyright (c) 2018 The FreeBSD Foundation +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd January 10, 2018 +.Dt LD.LLD 1 +.Os +.Sh NAME +.Nm ld.lld +.Nd ELF linker from the LLVM project +.Sh SYNOPSIS +.Nm ld.lld +.Op Ar options +.Ar objfile ... +.Sh DESCRIPTION +A linker takes one or more object, archive and library files, and combines +them into an output file (an executable, a shared library, or another object +file). +It relocates code and data from the input files and resolves symbol +references between them. +.Pp +.Nm +is a drop-in replacement for the GNU BFD and gold linkers. +It accepts most of the same command line arguments and linker scripts +as GNU linkers. +.Pp +The following options are available: +.Bl -tag -width indent +.It Fl -allow-multiple-definition +Allow multiple definitions. +.It Fl -as-needed +Only set +.Dv DT_NEEDED +for shared libraries if used. +.It Fl -auxiliary Ar value +Set the +.Dv DT_AUXILIARY +field to the specified name. +.It Fl -Bdynamic +Link against shared libraries. +.It Fl -Bstatic +Do not link against shared libraries. +.It Fl -Bsymbolic-functions +Bind defined function symbols locally. +.It Fl -Bsymbolic +Bind defined symbols locally. +.It Fl -build-id= Ns Ar value +Generate a build ID note. +.It Fl -build-id +Generate a build ID note. +.It Fl -color-diagnostics= Ns Ar value +Use colors in diagnostics. +.It Fl -color-diagnostics +Use colors in diagnostics. +.It Fl -compress-debug-sections= Ns Ar value +Compress DWARF debug sections. +.It Fl -define-common +Assign space to common symbols. +.It Fl -defsym= Ns Ar value +Define a symbol alias. +.It Fl -demangle +Demangle symbol names. +.It Fl -disable-new-dtags +Disable new dynamic tags. +.It Fl -discard-all +Delete all local symbols. +.It Fl -discard-locals +Delete temporary local symbols. +.It Fl -discard-none +Keep all symbols in the symbol table. +.It Fl -dynamic-linker Ar value +Specify the dynamic linker to be used for a dynamically linked executable. +This is recorded in an ELF segment of type +.Dv PT_INTERP . +.It Fl -dynamic-list Ar value +Read a list of dynamic symbols. +.It Fl -eh-frame-hdr +Request creation of +.Li .eh_frame_hdr +section and +.Dv PT_GNU_EH_FRAME +segment header. +.It Fl -emit-relocs +Generate relocations in the output. +.It Fl -enable-new-dtags +Enable new dynamic tags. +.It Fl -end-lib +End a grouping of objects that should be treated as if they were together +in an archive. +.It Fl -entry Ar entry +Name of entry point symbol. +.It Fl -error-limit Ar value +Maximum number of errors to emit before stopping. +A value of zero indicates that there is no limit. +.It Fl -error-unresolved-symbols +Report unresolved symbols as errors. +.It Fl -exclude-libs Ar value +Exclude static libraries from automatic export. +.It Fl -export-dynamic-symbol Ar value +Put a symbol in the dynamic symbol table. +.It Fl -export-dynamic +Put symbols in the dynamic symbol table. +.It Fl -fatal-warnings +Treat warnings as errors. +.It Fl -filter= Ns Ar value +Set the +.Dv DT_FILTER +field to the specified value. +.It Fl -fini Ar symbol +Specify a finalizer function. +.It Fl -format= Ns Ar input-format +Change the input format of the inputs following this option. +.It Fl -full-shutdown +Perform a full shutdown instead of calling +.Fn _exit . +.It Fl -gc-sections +Enable garbage collection of unused sections. +.It Fl -gdb-index +Generate +.Li .gdb_index +section. +.It Fl -hash-style Ar value +Specify hash style (sysv, gnu or both). +.It Fl -help +Print a usage message. +.It Fl -icf=all +Enable identical code folding. +.It Fl -icf=none +Disable identical code folding. +.It Fl -image-base= Ns Ar value +Set the base address to +.Ar value . +.It Fl -init Ar symbol +Specify an initializer function. +.It Fl -lto-aa-pipeline= Ns Ar value +AA pipeline to run during LTO. +Used in conjunction with +.Fl -lto-newpm-passes . +.It Fl -lto-newpm-passes= Ns Ar value +Passes to run during LTO. +.It Fl -lto-O Ar opt-level +Optimization level for LTO. +.It Fl -lto-partitions= Ns Ar value +Number of LTO codegen partitions. +.It Fl L Ar dir +Add a directory to the library search path. +.It Fl l Ar libName +Root name of library to use. +.It Fl -Map Ar value +Print a link map to the specified file. +.It Fl m Ar value +Set target emulation. +.It Fl -no-as-needed +Always set +.Dv DT_NEEDED +for shared libraries. +.It Fl -no-color-diagnostics +Do not use colors in diagnostics. +.It Fl -no-define-common +Do not assign space to common symbols. +.It Fl -no-demangle +Do not demangle symbol names. +.It Fl -no-dynamic-linker +Inhibit output of an +.Li .interp +section. +.It Fl -no-gc-sections +Disable garbage collection of unused sections. +.It Fl -no-gnu-unique +Disable STB_GNU_UNIQUE symbol binding. +.It Fl -no-rosegment +Do not put read-only non-executable sections in their own segment. +.It Fl -no-threads +Do not run the linker multi-threaded. +.It Fl -no-undefined-version +Report version scripts that refer undefined symbols. +.It Fl -no-undefined +Report unresolved symbols even if the linker is creating a shared library. +.It Fl -no-whole-archive +Restores the default behavior of loading archive members. +.It Fl -noinhibit-exec +Retain the executable output file whenever it is still usable. +.It Fl -nopie +Do not create a position independent executable. +.It Fl -nostdlib +Only search directories specified on the command line. +.It Fl -oformat Ar format +Specify the binary format for the output object file. +.It Fl -omagic +Set the text and data sections to be readable and writable. +.It Fl -opt-remarks-filename Ar value +YAML output file for optimization remarks. +.It Fl -opt-remarks-with-hotness +Include hotness information in the optimization remarks file. +.It Fl O Ar value +Optimize output file size. +.It Fl o Ar path +Write the output executable, library or object to +.Ar path . +If not specified, +.Dv a.out +is used as a default. +.It Fl -pie +Create a position independent executable. +.It Fl -print-gc-sections +List removed unused sections. +.It Fl -print-map +Print a link map to the standard output. +.It Fl -relocatable +Create relocatable object file. +.It Fl -reproduce Ar value +Dump linker invocation and input files for debugging. +.It Fl -retain-symbols-file= Ns Ar file +Retain only the symbols listed in the file. +.It Fl -rpath Ar value +Add a +.Dv DT_RUNPATH +to the output. +.It Fl -rsp-quoting= Ns Ar value +Quoting style for response files. +The supported values are +.Ar windows +and +.Ar posix . +.It Fl -script Ar value +Read linker script from the path +.Ar value . +.It Fl -section-start Ar address +Set address of section. +.It Fl -shared +Build a shared object. +.It Fl -soname= Ns Ar value +Set +.Dv DT_SONAME +to +.Ar value . +.It Fl -sort-section Ar value +Specifies sections sorting rule when linkerscript is used. +.It Fl -start-lib +Start a grouping of objects that should be treated as if they were together +in an archive. +.It Fl -strip-all +Strip all symbols. +.It Fl -strip-debug +Strip debugging information. +.It Fl -symbol-ordering-file Ar value +Lay out sections in the order specified by the symbol file. +.It Fl -sysroot= Ns Ar value +Set the system root. +.It Fl -target1-abs +Interpret +.Dv R_ARM_TARGET1 +as +.Dv R_ARM_ABS32 . +.It Fl -target1-rel +Interpret +.Dv R_ARM_TARGET1 +as +.Dv R_ARM_REL32 . +.It Fl -target2=type +Interpret +.Dv R_ARM_TARGET2 +as +.Ar type , +where +.Ar type +is one of +.Li rel , +.Li abs , +or +.Li got-rel . +.It Fl -Tbss Ar value +Same as +.Fl -section-start +with +.Li .bss +as the sectionname. +.It Fl -Tdata Ar value +Same as +.Fl -section-start +with +.Li .data +as the sectionname. +.It Fl -thinlto-cache-dir= Ns Ar value +Path to ThinLTO cached object file directory. +.It Fl -thinlto-cache-policy Ar value +Pruning policy for the ThinLTO cache. +.It Fl -thinlto-jobs= Ns Ar value +Number of ThinLTO jobs. +.It Fl -threads +Run the linker multi-threaded. +.It Fl -trace-symbol Ar value +Trace references to symbols. +.It Fl -trace +Print the names of the input files. +.It Fl -Ttext Ar value +Same as +.Fl -section-start +with +.Li .text +as the sectionname. +.It Fl -undefined Ar value +Force undefined symbol during linking. +.It Fl -unresolved-symbols= Ns Ar value +Determine how to handle unresolved symbols. +.It Fl -verbose +Verbose mode. +.It Fl -version-script Ar value +Read a version script. +.It Fl V , Fl -version +Display the version number and exit. +.It Fl v +Display the version number, and proceed with linking if object files are +specified. +.It Fl -warn-common +Warn about duplicate common symbols. +.It Fl -warn-unresolved-symbols +Report unresolved symbols as warnings. +.It Fl -whole-archive +Force load of all members in a static library. +.It Fl -wrap Ar symbol +Use wrapper functions for symbol. +.It Fl z Ar option +Linker option extensions. +.Bl -tag -width indent +.It Cm notext +Allow relocations against read-only segments. +Sets the +.Dv DT_TEXTREL flag in the +.Dv DYNAMIC +section. +.It Cm text +Do not allow relocations against read-only segments. +This is the default. +.El +.El +.Sh IMPLEMENTATION NOTES +The targets supported by +.Nm +are: +elf32-i386 elf32-iamcu elf32-littlearm elf32-ntradbigmips elf32-ntradlittlemips elf32-powerpc elf32-tradbigmips elf32-tradlittlemips elf32-x86-64 elf64-amdgpu elf64-littleaarch64 elf64-powerpc elf64-tradbigmips elf64-tradlittlemips elf64-x86-64 From owner-svn-src-head@freebsd.org Wed Jan 10 16:31:20 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F23FE65F45; Wed, 10 Jan 2018 16:31:20 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 566547CF4C; Wed, 10 Jan 2018 16:31:19 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w0AGVBc5032088; Wed, 10 Jan 2018 08:31:11 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w0AGVAEV032087; Wed, 10 Jan 2018 08:31:10 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201801101631.w0AGVAEV032087@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r327767 - in head/sys: conf i386/bios i386/conf i386/isa In-Reply-To: <201801101459.w0AExJWM055025@repo.freebsd.org> To: Warner Losh Date: Wed, 10 Jan 2018 08:31:10 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 16:31:20 -0000 [ Charset UTF-8 unsupported, converting... ] > Author: imp > Date: Wed Jan 10 14:59:19 2018 > New Revision: 327767 > URL: https://svnweb.freebsd.org/changeset/base/327767 > > Log: > Retire pmtimer driver. Move time fixing into apm driver. Move > Iwasaki-san's copyright over. Remove FIXME code that couldn't possibly > work. Call tc_settime() with our estimate of the delta we've been > alseep (the one we print) to adjust the time. Not sure what to do > about callouts, so keep the small #ifdef in place there. > > Differential Revision: https://reviews.freebsd.org/D13823 RELNOTES: ? Reason I ask is this effects custom kernel config file(s) > Deleted: > head/sys/i386/isa/pmtimer.c > Modified: > head/sys/conf/files.i386 > head/sys/i386/bios/apm.c > head/sys/i386/conf/GENERIC > head/sys/i386/conf/NOTES > > Modified: head/sys/conf/files.i386 > ============================================================================== > --- head/sys/conf/files.i386 Wed Jan 10 14:58:58 2018 (r327766) > +++ head/sys/conf/files.i386 Wed Jan 10 14:59:19 2018 (r327767) > @@ -520,7 +520,6 @@ i386/ibcs2/ibcs2_util.c optional ibcs2 > i386/ibcs2/ibcs2_xenix.c optional ibcs2 > i386/ibcs2/ibcs2_xenix_sysent.c optional ibcs2 > i386/ibcs2/imgact_coff.c optional ibcs2 > -i386/isa/pmtimer.c optional pmtimer > i386/isa/prof_machdep.c optional profiling-routine > i386/linux/imgact_linux.c optional compat_linux > i386/linux/linux_dummy.c optional compat_linux > > Modified: head/sys/i386/bios/apm.c > ============================================================================== > --- head/sys/i386/bios/apm.c Wed Jan 10 14:58:58 2018 (r327766) > +++ head/sys/i386/bios/apm.c Wed Jan 10 14:59:19 2018 (r327767) > @@ -16,6 +16,32 @@ > * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) > */ > > +/*- > + * Copyright (c) 2000 Mitsuru IWASAKI > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + */ > + > #include > __FBSDID("$FreeBSD$"); > > @@ -38,6 +64,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > > @@ -205,7 +232,7 @@ static int > apm_driver_version(int version) > { > struct apm_softc *sc = &apm_softc; > - > + > sc->bios.r.eax = (APM_BIOS << 8) | APM_DRVVERSION; > sc->bios.r.ebx = 0x0; > sc->bios.r.ecx = version; > @@ -220,28 +247,28 @@ apm_driver_version(int version) > > return (1); > } > - > + > /* engage/disengage power management (APM 1.1 or later) */ > static int > apm_engage_disengage_pm(int engage) > { > struct apm_softc *sc = &apm_softc; > - > + > sc->bios.r.eax = (APM_BIOS << 8) | APM_ENGAGEDISENGAGEPM; > sc->bios.r.ebx = PMDV_ALLDEV; > sc->bios.r.ecx = engage; > sc->bios.r.edx = 0; > return (apm_bioscall()); > } > - > + > /* get PM event */ > static u_int > apm_getevent(void) > { > struct apm_softc *sc = &apm_softc; > - > + > sc->bios.r.eax = (APM_BIOS << 8) | APM_GETPMEVENT; > - > + > sc->bios.r.ebx = 0; > sc->bios.r.ecx = 0; > sc->bios.r.edx = 0; > @@ -249,18 +276,18 @@ apm_getevent(void) > return (PMEV_NOEVENT); > return (sc->bios.r.ebx & 0xffff); > } > - > + > /* suspend entire system */ > static int > apm_suspend_system(int state) > { > struct apm_softc *sc = &apm_softc; > - > + > sc->bios.r.eax = (APM_BIOS << 8) | APM_SETPWSTATE; > sc->bios.r.ebx = PMDV_ALLDEV; > sc->bios.r.ecx = state; > sc->bios.r.edx = 0; > - > + > if (apm_bioscall()) { > printf("Entire system suspend failure: errcode = %d\n", > 0xff & (sc->bios.r.eax >> 8)); > @@ -280,7 +307,7 @@ int > apm_display(int newstate) > { > struct apm_softc *sc = &apm_softc; > - > + > sc->bios.r.eax = (APM_BIOS << 8) | APM_SETPWSTATE; > sc->bios.r.ebx = PMDV_DISP0; > sc->bios.r.ecx = newstate ? PMST_APMENABLED:PMST_SUSPEND; > @@ -331,12 +358,10 @@ apm_battery_low(void) > static struct apmhook * > apm_add_hook(struct apmhook **list, struct apmhook *ah) > { > - int s; > struct apmhook *p, *prev; > > APM_DPRINT("Add hook \"%s\"\n", ah->ah_name); > > - s = splhigh(); > if (ah == NULL) > panic("illegal apm_hook!"); > prev = NULL; > @@ -351,30 +376,25 @@ apm_add_hook(struct apmhook **list, struct apmhook *ah > ah->ah_next = prev->ah_next; > prev->ah_next = ah; > } > - splx(s); > return ah; > } > > static void > apm_del_hook(struct apmhook **list, struct apmhook *ah) > { > - int s; > struct apmhook *p, *prev; > > - s = splhigh(); > prev = NULL; > for (p = *list; p != NULL; prev = p, p = p->ah_next) > if (p == ah) > goto deleteit; > panic("Tried to delete unregistered apm_hook."); > - goto nosuchnode; > + return; > deleteit: > if (prev != NULL) > prev->ah_next = p->ah_next; > else > *list = p->ah_next; > -nosuchnode: > - splx(s); > } > > > @@ -468,7 +488,7 @@ apm_do_standby(void) > sc->standbys = sc->standby_countdown = 0; > > /* > - * As far as standby, we don't need to execute > + * As far as standby, we don't need to execute > * all of suspend hooks. > */ > if (apm_suspend_system(PMST_STANDBY) == 0) > @@ -1047,6 +1067,53 @@ apm_processevent(void) > } while (apm_event != PMEV_NOEVENT); > } > > +static struct timeval suspend_time; > +static struct timeval diff_time; > + > +static int > +apm_rtc_suspend(void *arg __unused) > +{ > + > + microtime(&diff_time); > + inittodr(0); > + microtime(&suspend_time); > + timevalsub(&diff_time, &suspend_time); > + return (0); > +} > + > +static int > +apm_rtc_resume(void *arg __unused) > +{ > + u_int second, minute, hour; > + struct timeval resume_time, tmp_time; > + struct timespec ts; > + > + /* modified for adjkerntz */ > + timer_restore(); /* restore the all timers */ > + inittodr(0); /* adjust time to RTC */ > + microtime(&resume_time); > + getmicrotime(&tmp_time); > + timevaladd(&tmp_time, &diff_time); > + /* Calculate the delta time suspended */ > + timevalsub(&resume_time, &suspend_time); > + > + second = ts.tv_sec = resume_time.tv_sec; > + ts.tv_nsec = 0; > + tc_setclock(&ts); > + > +#ifdef PMTIMER_FIXUP_CALLTODO > + /* Fixup the calltodo list with the delta time. */ > + adjust_timeout_calltodo(&resume_time); > +#endif /* PMTIMER_FIXUP_CALLTODO */ > + hour = second / 3600; > + second %= 3600; > + minute = second / 60; > + second %= 60; > + log(LOG_NOTICE, "wakeup from sleeping state (slept %02d:%02d:%02d)\n", > + hour, minute, second); > + return (0); > +} > + > /* > * Attach APM: > * > @@ -1128,7 +1195,7 @@ apm_attach(device_t dev) > } > > /* Power the system off using APM */ > - EVENTHANDLER_REGISTER(shutdown_final, apm_power_off, NULL, > + EVENTHANDLER_REGISTER(shutdown_final, apm_power_off, NULL, > SHUTDOWN_PRI_LAST); > > /* Register APM again to pass the correct argument of pm_func. */ > @@ -1142,6 +1209,15 @@ apm_attach(device_t dev) > UID_ROOT, GID_OPERATOR, 0664, "apm"); > make_dev(&apm_cdevsw, APMDEV_CTL, > UID_ROOT, GID_OPERATOR, 0660, "apmctl"); > + > + sc->sc_suspend.ah_fun = apm_rtc_suspend; > + sc->sc_suspend.ah_arg = sc; > + apm_hook_establish(APM_HOOK_SUSPEND, &sc->sc_suspend); > + > + sc->sc_resume.ah_fun = apm_rtc_resume; > + sc->sc_resume.ah_arg = sc; > + apm_hook_establish(APM_HOOK_RESUME, &sc->sc_resume); > + > return 0; > } > > @@ -1362,7 +1438,7 @@ apmwrite(struct cdev *dev, struct uio *uio, int ioflag > if ((error = uiomove((caddr_t)&event_type, sizeof(u_int), uio))) > return(error); > > - if (event_type < 0 || event_type >= APM_NPMEV) > + if (event_type >= APM_NPMEV) > return(EINVAL); > > if (sc->event_filter[event_type] == 0) { > > Modified: head/sys/i386/conf/GENERIC > ============================================================================== > --- head/sys/i386/conf/GENERIC Wed Jan 10 14:58:58 2018 (r327766) > +++ head/sys/i386/conf/GENERIC Wed Jan 10 14:59:19 2018 (r327767) > @@ -207,8 +207,6 @@ device agp # support several AGP chipsets > > # Power management support (see NOTES for more options) > #device apm > -# Add suspend/resume support for the i8254. > -device pmtimer > > # PCCARD (PCMCIA) support > # PCMCIA and cardbus bridge support > > Modified: head/sys/i386/conf/NOTES > ============================================================================== > --- head/sys/i386/conf/NOTES Wed Jan 10 14:58:58 2018 (r327766) > +++ head/sys/i386/conf/NOTES Wed Jan 10 14:59:19 2018 (r327767) > @@ -774,7 +774,6 @@ device hyperv # HyperV drivers > # smapi: System Management Application Program Interface driver > # smbios: DMI/SMBIOS entry point > # vpd: Vital Product Data kernel interface > -# pmtimer: Adjust system timer at wakeup time > # pbio: Parallel (8255 PPI) basic I/O (mode 0) port (e.g. Advantech PCL-724) > # asmc: Apple System Management Controller > # si: Specialix International SI/XIO or SX intelligent serial card driver > @@ -808,7 +807,6 @@ device ipmi > device smapi > device smbios > device vpd > -device pmtimer > device pbio > hint.pbio.0.at="isa" > hint.pbio.0.port="0x360" > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Wed Jan 10 16:48:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B736E66DD9 for ; Wed, 10 Jan 2018 16:48:07 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x235.google.com (mail-it0-x235.google.com [IPv6:2607:f8b0:4001:c0b::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 546D37D9BA for ; Wed, 10 Jan 2018 16:48:07 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x235.google.com with SMTP id p139so143541itb.1 for ; Wed, 10 Jan 2018 08:48:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=6diGcD6B09T3qQZPIjt4mPFdA2juNNGJT/pXzdNH4h4=; b=l4oJs0hMdUbwEFplaaEeqbrVlmRZpbOaaDNhnjLV7wb+Pom8vYAQLhkOxxdAt6nMk/ 6lfzBoLrvXb5+MQVV8J3S5gMjyrolni8gZF/0djOeDlKuuVZWtlXAG5HcX63cI6oqCv/ 7xqlKvhUmxQdHqQw/mBbf8a+dXddSg5JqHCDViYv7CgLckuCSdYqiww7ePFIkpAlLNeC 7/6jCnYgo6uYLZfWGD0k8aXEGnNVVzxR/UKLIuHGmHHYvbwLnPrlNumFm7rphi/A3pUg N/nQECuJirG2b8BGWTciZTCIl8xk3U60YMMg/UYjIoz5Jf5I79IjkK1FSj9cu4PITDiS jCiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=6diGcD6B09T3qQZPIjt4mPFdA2juNNGJT/pXzdNH4h4=; b=eDce8V0Z3EVrY6sTq2/r4U9QkkFBebJbECiRGU2FtCAlDgr9JW/SAejjUa9P9emXwH mazGLndIbk1uMqHUiYA6Zo8KRiwnvN++TsEJx4sUASpwt0DJF3LbH3eoBZE1PuoW2pSF ApemWJxgggiAsFApYXL54n1/doRHJaWTWmKevw77ppHi8cCTIzUVlvSpsxPY5YfgMq2H bV3k+esbWCBOpTFDeqzYWZ3GcelELIeqH8zlmwathG76cp53tHY1Sv7sWiHgRbO5AL8Z 7HjrvryvffE8HFC/X/hcXLllojT/4iPwPHTlomcPInL1f9V7zH2J/cTbFUa0b+ZbZVyT gUhQ== X-Gm-Message-State: AKGB3mIIMImolfcEUa6XHZUbqQknxFQILNMeRKy9UAJgXv6AGWqx27qc s+LcsEP3gM7CFtoxjflsUpbpUKaC9LWt8XnHnQkW/w== X-Google-Smtp-Source: ACJfBosjKkc9u0QdUeN3wcvhjSnfeWblrLei5EBsw6DvXHwFjwb7XvPVBBt4tJrdS39tEBa15I+qnc2eiR4Y0K1d0tc= X-Received: by 10.36.74.200 with SMTP id k191mr20594083itb.69.1515602886457; Wed, 10 Jan 2018 08:48:06 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.160.217 with HTTP; Wed, 10 Jan 2018 08:48:05 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <201801101631.w0AGVAEV032087@pdx.rh.CN85.dnsmgr.net> References: <201801101459.w0AExJWM055025@repo.freebsd.org> <201801101631.w0AGVAEV032087@pdx.rh.CN85.dnsmgr.net> From: Warner Losh Date: Wed, 10 Jan 2018 09:48:05 -0700 X-Google-Sender-Auth: R1yjYNAk42gSJ5vUU2d2FTFL4XE Message-ID: Subject: Re: svn commit: r327767 - in head/sys: conf i386/bios i386/conf i386/isa To: "Rodney W. Grimes" Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 16:48:07 -0000 On Wed, Jan 10, 2018 at 9:31 AM, Rodney W. Grimes < freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > [ Charset UTF-8 unsupported, converting... ] > > Author: imp > > Date: Wed Jan 10 14:59:19 2018 > > New Revision: 327767 > > URL: https://svnweb.freebsd.org/changeset/base/327767 > > > > Log: > > Retire pmtimer driver. Move time fixing into apm driver. Move > > Iwasaki-san's copyright over. Remove FIXME code that couldn't possibly > > work. Call tc_settime() with our estimate of the delta we've been > > alseep (the one we print) to adjust the time. Not sure what to do > > about callouts, so keep the small #ifdef in place there. > > > > Differential Revision: https://reviews.freebsd.org/D13823 > > RELNOTES: ? > Reason I ask is this effects custom kernel config file(s) Don't know. We don't normally document every kernel config file changes that's required. Warner > > Deleted: > > head/sys/i386/isa/pmtimer.c > > Modified: > > head/sys/conf/files.i386 > > head/sys/i386/bios/apm.c > > head/sys/i386/conf/GENERIC > > head/sys/i386/conf/NOTES > > > > Modified: head/sys/conf/files.i386 > > ============================================================ > ================== > > --- head/sys/conf/files.i386 Wed Jan 10 14:58:58 2018 (r327766) > > +++ head/sys/conf/files.i386 Wed Jan 10 14:59:19 2018 (r327767) > > @@ -520,7 +520,6 @@ i386/ibcs2/ibcs2_util.c optional ibcs2 > > i386/ibcs2/ibcs2_xenix.c optional ibcs2 > > i386/ibcs2/ibcs2_xenix_sysent.c optional ibcs2 > > i386/ibcs2/imgact_coff.c optional ibcs2 > > -i386/isa/pmtimer.c optional pmtimer > > i386/isa/prof_machdep.c optional profiling-routine > > i386/linux/imgact_linux.c optional compat_linux > > i386/linux/linux_dummy.c optional compat_linux > > > > Modified: head/sys/i386/bios/apm.c > > ============================================================ > ================== > > --- head/sys/i386/bios/apm.c Wed Jan 10 14:58:58 2018 (r327766) > > +++ head/sys/i386/bios/apm.c Wed Jan 10 14:59:19 2018 (r327767) > > @@ -16,6 +16,32 @@ > > * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) > > */ > > > > +/*- > > + * Copyright (c) 2000 Mitsuru IWASAKI > > + * All rights reserved. > > + * > > + * Redistribution and use in source and binary forms, with or without > > + * modification, are permitted provided that the following conditions > > + * are met: > > + * 1. Redistributions of source code must retain the above copyright > > + * notice, this list of conditions and the following disclaimer. > > + * 2. Redistributions in binary form must reproduce the above copyright > > + * notice, this list of conditions and the following disclaimer in > the > > + * documentation and/or other materials provided with the > distribution. > > + * > > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' > AND > > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR > PURPOSE > > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE > LIABLE > > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > CONSEQUENTIAL > > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE > GOODS > > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, > STRICT > > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN > ANY WAY > > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY > OF > > + * SUCH DAMAGE. > > + */ > > + > > #include > > __FBSDID("$FreeBSD$"); > > > > @@ -38,6 +64,7 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > > #include > > +#include > > #include > > #include > > > > @@ -205,7 +232,7 @@ static int > > apm_driver_version(int version) > > { > > struct apm_softc *sc = &apm_softc; > > - > > + > > sc->bios.r.eax = (APM_BIOS << 8) | APM_DRVVERSION; > > sc->bios.r.ebx = 0x0; > > sc->bios.r.ecx = version; > > @@ -220,28 +247,28 @@ apm_driver_version(int version) > > > > return (1); > > } > > - > > + > > /* engage/disengage power management (APM 1.1 or later) */ > > static int > > apm_engage_disengage_pm(int engage) > > { > > struct apm_softc *sc = &apm_softc; > > - > > + > > sc->bios.r.eax = (APM_BIOS << 8) | APM_ENGAGEDISENGAGEPM; > > sc->bios.r.ebx = PMDV_ALLDEV; > > sc->bios.r.ecx = engage; > > sc->bios.r.edx = 0; > > return (apm_bioscall()); > > } > > - > > + > > /* get PM event */ > > static u_int > > apm_getevent(void) > > { > > struct apm_softc *sc = &apm_softc; > > - > > + > > sc->bios.r.eax = (APM_BIOS << 8) | APM_GETPMEVENT; > > - > > + > > sc->bios.r.ebx = 0; > > sc->bios.r.ecx = 0; > > sc->bios.r.edx = 0; > > @@ -249,18 +276,18 @@ apm_getevent(void) > > return (PMEV_NOEVENT); > > return (sc->bios.r.ebx & 0xffff); > > } > > - > > + > > /* suspend entire system */ > > static int > > apm_suspend_system(int state) > > { > > struct apm_softc *sc = &apm_softc; > > - > > + > > sc->bios.r.eax = (APM_BIOS << 8) | APM_SETPWSTATE; > > sc->bios.r.ebx = PMDV_ALLDEV; > > sc->bios.r.ecx = state; > > sc->bios.r.edx = 0; > > - > > + > > if (apm_bioscall()) { > > printf("Entire system suspend failure: errcode = %d\n", > > 0xff & (sc->bios.r.eax >> 8)); > > @@ -280,7 +307,7 @@ int > > apm_display(int newstate) > > { > > struct apm_softc *sc = &apm_softc; > > - > > + > > sc->bios.r.eax = (APM_BIOS << 8) | APM_SETPWSTATE; > > sc->bios.r.ebx = PMDV_DISP0; > > sc->bios.r.ecx = newstate ? PMST_APMENABLED:PMST_SUSPEND; > > @@ -331,12 +358,10 @@ apm_battery_low(void) > > static struct apmhook * > > apm_add_hook(struct apmhook **list, struct apmhook *ah) > > { > > - int s; > > struct apmhook *p, *prev; > > > > APM_DPRINT("Add hook \"%s\"\n", ah->ah_name); > > > > - s = splhigh(); > > if (ah == NULL) > > panic("illegal apm_hook!"); > > prev = NULL; > > @@ -351,30 +376,25 @@ apm_add_hook(struct apmhook **list, struct apmhook > *ah > > ah->ah_next = prev->ah_next; > > prev->ah_next = ah; > > } > > - splx(s); > > return ah; > > } > > > > static void > > apm_del_hook(struct apmhook **list, struct apmhook *ah) > > { > > - int s; > > struct apmhook *p, *prev; > > > > - s = splhigh(); > > prev = NULL; > > for (p = *list; p != NULL; prev = p, p = p->ah_next) > > if (p == ah) > > goto deleteit; > > panic("Tried to delete unregistered apm_hook."); > > - goto nosuchnode; > > + return; > > deleteit: > > if (prev != NULL) > > prev->ah_next = p->ah_next; > > else > > *list = p->ah_next; > > -nosuchnode: > > - splx(s); > > } > > > > > > @@ -468,7 +488,7 @@ apm_do_standby(void) > > sc->standbys = sc->standby_countdown = 0; > > > > /* > > - * As far as standby, we don't need to execute > > + * As far as standby, we don't need to execute > > * all of suspend hooks. > > */ > > if (apm_suspend_system(PMST_STANDBY) == 0) > > @@ -1047,6 +1067,53 @@ apm_processevent(void) > > } while (apm_event != PMEV_NOEVENT); > > } > > > > +static struct timeval suspend_time; > > +static struct timeval diff_time; > > + > > +static int > > +apm_rtc_suspend(void *arg __unused) > > +{ > > + > > + microtime(&diff_time); > > + inittodr(0); > > + microtime(&suspend_time); > > + timevalsub(&diff_time, &suspend_time); > > + return (0); > > +} > > + > > +static int > > +apm_rtc_resume(void *arg __unused) > > +{ > > + u_int second, minute, hour; > > + struct timeval resume_time, tmp_time; > > + struct timespec ts; > > + > > + /* modified for adjkerntz */ > > + timer_restore(); /* restore the all timers */ > > + inittodr(0); /* adjust time to RTC */ > > + microtime(&resume_time); > > + getmicrotime(&tmp_time); > > + timevaladd(&tmp_time, &diff_time); > > + /* Calculate the delta time suspended */ > > + timevalsub(&resume_time, &suspend_time); > > + > > + second = ts.tv_sec = resume_time.tv_sec; > > + ts.tv_nsec = 0; > > + tc_setclock(&ts); > > + > > +#ifdef PMTIMER_FIXUP_CALLTODO > > + /* Fixup the calltodo list with the delta time. */ > > + adjust_timeout_calltodo(&resume_time); > > +#endif /* PMTIMER_FIXUP_CALLTODO */ > > + hour = second / 3600; > > + second %= 3600; > > + minute = second / 60; > > + second %= 60; > > + log(LOG_NOTICE, "wakeup from sleeping state (slept > %02d:%02d:%02d)\n", > > + hour, minute, second); > > + return (0); > > +} > > + > > /* > > * Attach APM: > > * > > @@ -1128,7 +1195,7 @@ apm_attach(device_t dev) > > } > > > > /* Power the system off using APM */ > > - EVENTHANDLER_REGISTER(shutdown_final, apm_power_off, NULL, > > + EVENTHANDLER_REGISTER(shutdown_final, apm_power_off, NULL, > > SHUTDOWN_PRI_LAST); > > > > /* Register APM again to pass the correct argument of pm_func. */ > > @@ -1142,6 +1209,15 @@ apm_attach(device_t dev) > > UID_ROOT, GID_OPERATOR, 0664, "apm"); > > make_dev(&apm_cdevsw, APMDEV_CTL, > > UID_ROOT, GID_OPERATOR, 0660, "apmctl"); > > + > > + sc->sc_suspend.ah_fun = apm_rtc_suspend; > > + sc->sc_suspend.ah_arg = sc; > > + apm_hook_establish(APM_HOOK_SUSPEND, &sc->sc_suspend); > > + > > + sc->sc_resume.ah_fun = apm_rtc_resume; > > + sc->sc_resume.ah_arg = sc; > > + apm_hook_establish(APM_HOOK_RESUME, &sc->sc_resume); > > + > > return 0; > > } > > > > @@ -1362,7 +1438,7 @@ apmwrite(struct cdev *dev, struct uio *uio, int > ioflag > > if ((error = uiomove((caddr_t)&event_type, sizeof(u_int), uio))) > > return(error); > > > > - if (event_type < 0 || event_type >= APM_NPMEV) > > + if (event_type >= APM_NPMEV) > > return(EINVAL); > > > > if (sc->event_filter[event_type] == 0) { > > > > Modified: head/sys/i386/conf/GENERIC > > ============================================================ > ================== > > --- head/sys/i386/conf/GENERIC Wed Jan 10 14:58:58 2018 > (r327766) > > +++ head/sys/i386/conf/GENERIC Wed Jan 10 14:59:19 2018 > (r327767) > > @@ -207,8 +207,6 @@ device agp # support > several AGP chipsets > > > > # Power management support (see NOTES for more options) > > #device apm > > -# Add suspend/resume support for the i8254. > > -device pmtimer > > > > # PCCARD (PCMCIA) support > > # PCMCIA and cardbus bridge support > > > > Modified: head/sys/i386/conf/NOTES > > ============================================================ > ================== > > --- head/sys/i386/conf/NOTES Wed Jan 10 14:58:58 2018 (r327766) > > +++ head/sys/i386/conf/NOTES Wed Jan 10 14:59:19 2018 (r327767) > > @@ -774,7 +774,6 @@ device hyperv # HyperV drivers > > # smapi: System Management Application Program Interface driver > > # smbios: DMI/SMBIOS entry point > > # vpd: Vital Product Data kernel interface > > -# pmtimer: Adjust system timer at wakeup time > > # pbio: Parallel (8255 PPI) basic I/O (mode 0) port (e.g. Advantech > PCL-724) > > # asmc: Apple System Management Controller > > # si: Specialix International SI/XIO or SX intelligent serial card > driver > > @@ -808,7 +807,6 @@ device ipmi > > device smapi > > device smbios > > device vpd > > -device pmtimer > > device pbio > > hint.pbio.0.at="isa" > > hint.pbio.0.port="0x360" > > > > > > -- > Rod Grimes > rgrimes@freebsd.org > From owner-svn-src-head@freebsd.org Wed Jan 10 16:51:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25ABAE67133; Wed, 10 Jan 2018 16:51:37 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp004.me.com (mr11p00im-asmtp004.me.com [17.110.69.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 08E0E7DD2C; Wed, 10 Jan 2018 16:51:37 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.mr11p00im-asmtp004.me.com by mr11p00im-asmtp004.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0P2C00E00KJ9MD00@mr11p00im-asmtp004.me.com>; Wed, 10 Jan 2018 16:51:29 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=04042017; t=1515603089; bh=m2jknCVbn89Ark0avQyFBKq277y6M5dRFYJ81klTME0=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=ETpoOBd4pl6yvqBfIG/iIyvqtH2o9fg2emkwy8zxKSHHlVXgqEzEQ1bZG/aP/zCbj Vu+oSUeRdTJS/sCtCe7eEu1tqrWmIux0or5AWG3ABCAEktmtKO63rOg5OoAFw0lktf q6UYcQwdPR5Y72kiTqPSn+sdSm22fVEpTdyOj7JLZp29p1jVQBlm+iEjM9wXY9EvpA eMVl9ZjXaexyAgmsIQiFibACmqY/MLxDxW14CW8V7M5VT3GqNq8wYUgnmyFMVMyvIQ 30thRlJbQ5gxT1mpqpuzKw0sS0b+lDRz0FYKPWeMNSSfZhO7cJ6NpYFfDhql9Axwfq aMZDz1hJ2YUjQ== Received: from icloud.com ([127.0.0.1]) by mr11p00im-asmtp004.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0P2C00P57MTR3B00@mr11p00im-asmtp004.me.com>; Wed, 10 Jan 2018 16:51:28 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-10_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1801100236 User-Agent: Microsoft-MacOutlook/f.29.0.171205 Date: Wed, 10 Jan 2018 08:51:27 -0800 Subject: Re: svn commit: r327763 - in head/sys: conf contrib/zstd/lib/freebsd From: Ravi Pokala To: Conrad Meyer , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-id: Thread-topic: svn commit: r327763 - in head/sys: conf contrib/zstd/lib/freebsd References: <201801100630.w0A6UxLT041383@repo.freebsd.org> In-reply-to: <201801100630.w0A6UxLT041383@repo.freebsd.org> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 16:51:37 -0000 Hi Conrad, Alas, this still doesn't look right on RISC-V: zstd_kfreebsd.o: In function `__ctzdi2': /usr/home/rpokala/freebsd/clean/base/head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c:58: undefined reference to `ffsll' I got substantively the same error both before and after `pkg upgrade' brought in updated RISC-V stuff: riscv64-binutils (2.29.51.20170726 -> 2.29_20180105,1) riscv64-gcc (7.1.1 -> 7.2.0) Thanks, Ravi (rpokala@) -----Original Message----- From: on behalf of Conrad Meyer Date: 2018-01-09, Tuesday at 22:30 To: , , Subject: svn commit: r327763 - in head/sys: conf contrib/zstd/lib/freebsd Author: cem Date: Wed Jan 10 06:30:59 2018 New Revision: 327763 URL: https://svnweb.freebsd.org/changeset/base/327763 Log: Finally, fix Zstd kernel build on MIPS and RISC-V Add an implementation of the intrinsics invoked by __builtin_ctz{,ll} and __builtin_clz{,ll}, and include this compilation unit on platforms that lack assembly intrinsics for those builtins (MIPS and RISC-V). Future cleanup work might involve bringing these into a mini libcompiler-rt for the standalone kernel environment. Or cleaning up the approach upstream takes for builtins in standalone environments (or just FreeBSD). For now, at least this builds, and doesn't require modifying the vendor code. Reported by: jeff, markj, mizhka Reviewed by: jhb (earlier version), rpokala (comment text earlier version) Sponsored by: Dell EMC Isilon Added: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c (contents, props changed) Modified: head/sys/conf/files.mips head/sys/conf/files.riscv Modified: head/sys/conf/files.mips ============================================================================== --- head/sys/conf/files.mips Wed Jan 10 05:52:24 2018 (r327762) +++ head/sys/conf/files.mips Wed Jan 10 06:30:59 2018 (r327763) @@ -112,3 +112,6 @@ cddl/compat/opensolaris/kern/opensolaris_atomic.c opti cddl/dev/dtrace/mips/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}" cddl/dev/dtrace/mips/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" cddl/dev/fbt/mips/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}" + +# Zstd +contrib/zstd/lib/freebsd/zstd_kfreebsd.c standard compile-with ${ZSTD_C} Modified: head/sys/conf/files.riscv ============================================================================== --- head/sys/conf/files.riscv Wed Jan 10 05:52:24 2018 (r327762) +++ head/sys/conf/files.riscv Wed Jan 10 06:30:59 2018 (r327763) @@ -56,3 +56,6 @@ riscv/riscv/uio_machdep.c standard riscv/riscv/uma_machdep.c standard riscv/riscv/unwind.c optional ddb | kdtrace_hooks | stack riscv/riscv/vm_machdep.c standard + +# Zstd +contrib/zstd/lib/freebsd/zstd_kfreebsd.c standard compile-with ${ZSTD_C} Added: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c Wed Jan 10 06:30:59 2018 (r327763) @@ -0,0 +1,75 @@ +/*- + * Copyright (c) 2018 Conrad Meyer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include "zstd_kfreebsd.h" + +/* + * The kernel as a standalone target does not link against libgcc or + * libcompiler-rt. On platforms (e.g., MIPS and RISCV) that do not have a + * direct assembly implementation of the relevant builtin functions that zstd + * references, the compiler converts them into calls to the runtime library + * intrinsics. Since the kernel does not link against the runtime libraries, + * this results in a failure to link the kernel. + * + * The goal of the following definitions is to use supported kernel constructs + * to implement the same functionality, without adding diff to the Zstd contrib + * code. + * + * A subsequent enhancement might create a mini compiler-rt library for kernel + * use and move these over there instead. + */ + +/* Count trailing zeros */ +int +__ctzsi2(int x) +{ + if (x == 0) + return (sizeof(x) * NBBY); + return (ffs(x) - 1); +} + +long long +__ctzdi2(long long x) +{ + if (x == 0) + return (sizeof(x) * NBBY); + return (ffsll(x) - 1); +} + +/* Count leading zeros */ +int +__clzsi2(int x) +{ + return (sizeof(x) * NBBY - fls(x)); +} + +long long +__clzdi2(long long x) +{ + return (sizeof(x) * NBBY - flsll(x)); +} From owner-svn-src-head@freebsd.org Wed Jan 10 16:51:57 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C1DEE671B9; Wed, 10 Jan 2018 16:51:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 157227DFA6; Wed, 10 Jan 2018 16:51:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47501484; Wed, 10 Jan 2018 16:51:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AGpu6f004968; Wed, 10 Jan 2018 16:51:56 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AGpu91004966; Wed, 10 Jan 2018 16:51:56 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801101651.w0AGpu91004966@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 10 Jan 2018 16:51:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327771 - in head/sys: conf i386/i386 i386/isa X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: conf i386/i386 i386/isa X-SVN-Commit-Revision: 327771 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 16:51:57 -0000 Author: imp Date: Wed Jan 10 16:51:55 2018 New Revision: 327771 URL: https://svnweb.freebsd.org/changeset/base/327771 Log: Move prof_machdep.c to it's more traditional place under i386/i386. Added: head/sys/i386/i386/prof_machdep.c (contents, props changed) - copied, changed from r327770, head/sys/i386/isa/prof_machdep.c Deleted: head/sys/i386/isa/ Modified: head/sys/conf/files.i386 Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Wed Jan 10 16:01:25 2018 (r327770) +++ head/sys/conf/files.i386 Wed Jan 10 16:51:55 2018 (r327771) @@ -493,6 +493,7 @@ i386/i386/mpboot.s optional smp i386/i386/npx.c standard i386/i386/perfmon.c optional perfmon i386/i386/pmap.c standard +i386/i386/prof_machdep.c optional profiling-routine i386/i386/ptrace_machdep.c standard i386/i386/support.s standard i386/i386/swtch.s standard @@ -520,7 +521,6 @@ i386/ibcs2/ibcs2_util.c optional ibcs2 i386/ibcs2/ibcs2_xenix.c optional ibcs2 i386/ibcs2/ibcs2_xenix_sysent.c optional ibcs2 i386/ibcs2/imgact_coff.c optional ibcs2 -i386/isa/prof_machdep.c optional profiling-routine i386/linux/imgact_linux.c optional compat_linux i386/linux/linux_dummy.c optional compat_linux i386/linux/linux_machdep.c optional compat_linux Copied and modified: head/sys/i386/i386/prof_machdep.c (from r327770, head/sys/i386/isa/prof_machdep.c) ============================================================================== From owner-svn-src-head@freebsd.org Wed Jan 10 16:52:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D781E67368; Wed, 10 Jan 2018 16:52:02 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1A3F87DFD2; Wed, 10 Jan 2018 16:52:02 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 496DE48A; Wed, 10 Jan 2018 16:52:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AGq10o005026; Wed, 10 Jan 2018 16:52:01 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AGq1e2005025; Wed, 10 Jan 2018 16:52:01 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801101652.w0AGq1e2005025@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 10 Jan 2018 16:52:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327772 - head X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 327772 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 16:52:02 -0000 Author: imp Date: Wed Jan 10 16:52:00 2018 New Revision: 327772 URL: https://svnweb.freebsd.org/changeset/base/327772 Log: Docuent pmtimer driver removal. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Jan 10 16:51:55 2018 (r327771) +++ head/UPDATING Wed Jan 10 16:52:00 2018 (r327772) @@ -51,6 +51,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** +20180110: + On i386, pmtimer has been removed. It's functionality has been folded + into apm. It was a nop on ACPI. Users may need to remove it from kernel + config files. + 20180104: The use of RSS hash from the network card aka flowid has been disabled by default for lagg(4) as it's currently incompatible with From owner-svn-src-head@freebsd.org Wed Jan 10 16:56:04 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B8C5E67686; Wed, 10 Jan 2018 16:56:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D983D7E359; Wed, 10 Jan 2018 16:56:03 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9F924B4; Wed, 10 Jan 2018 16:56:02 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AGu2Tl007600; Wed, 10 Jan 2018 16:56:02 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AGu2OV007599; Wed, 10 Jan 2018 16:56:02 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801101656.w0AGu2OV007599@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 10 Jan 2018 16:56:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327773 - head/usr.sbin/digictl X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/usr.sbin/digictl X-SVN-Commit-Revision: 327773 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 16:56:04 -0000 Author: imp Date: Wed Jan 10 16:56:02 2018 New Revision: 327773 URL: https://svnweb.freebsd.org/changeset/base/327773 Log: Catchup to removing this directory Deleted: head/usr.sbin/digictl/ From owner-svn-src-head@freebsd.org Wed Jan 10 16:58:22 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44E4DE6791F; Wed, 10 Jan 2018 16:58:22 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 22A297E4FF; Wed, 10 Jan 2018 16:58:22 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 612CBAEEB; Wed, 10 Jan 2018 16:58:21 +0000 (UTC) Date: Wed, 10 Jan 2018 16:58:21 +0000 From: Alexey Dokuchaev To: Warner Losh Cc: "Rodney W. Grimes" , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers , Warner Losh Subject: Re: svn commit: r327767 - in head/sys: conf i386/bios i386/conf i386/isa Message-ID: <20180110165821.GA69465@FreeBSD.org> References: <201801101459.w0AExJWM055025@repo.freebsd.org> <201801101631.w0AGVAEV032087@pdx.rh.CN85.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 16:58:22 -0000 On Wed, Jan 10, 2018 at 09:48:05AM -0700, Warner Losh wrote: > On Wed, Jan 10, 2018 at 9:31 AM, Rodney W. Grimes wrote: > > > New Revision: 327767 > > > URL: https://svnweb.freebsd.org/changeset/base/327767 > > > > > > Log: > > > Retire pmtimer driver. Move time fixing into apm driver. Move > > > Iwasaki-san's copyright over. Remove FIXME code that couldn't possibly > > > work. Call tc_settime() with our estimate of the delta we've been > > > alseep (the one we print) to adjust the time. Not sure what to do > > > about callouts, so keep the small #ifdef in place there. > > > > > > Differential Revision: https://reviews.freebsd.org/D13823 > > > > RELNOTES: ? > > Reason I ask is this effects custom kernel config file(s) > > Don't know. We don't normally document every kernel config file changes > that's required. Well, `pmtimer' is a bit special. It is required in the kernel config in order to preserve time counting during suspend (not sure about amd64, but at least on i386, "device pmtimer" is required to be in kernel config for timekeeping while sleeping). ./danfe From owner-svn-src-head@freebsd.org Wed Jan 10 17:01:43 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3480CE67BD1 for ; Wed, 10 Jan 2018 17:01:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x233.google.com (mail-it0-x233.google.com [IPv6:2607:f8b0:4001:c0b::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E708E7E7EC for ; Wed, 10 Jan 2018 17:01:42 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x233.google.com with SMTP id c16so164912itc.5 for ; Wed, 10 Jan 2018 09:01:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Z14fbbqa3TKgxQR8UqCfTxtroV0hsH2kORlUZktUpiI=; b=K6bz6sYwT+2/rKUjUYtL8jBXv2xIKH7S71dYGjntfQ2OjHZG9eaamqVujiIVcZ/Zei +l71v21rMNx0qhxK2468T5tOOZw+HBqmTtb6Awq6OpjQaZMA5K5gahrtKZYDJ5NVXyG2 tW2pRG8DOk0WBwXr2eAtoiTuMLA90R8TQmCFjyR0kcQNjSPuUBUTnfT8fWwaUF17FOW9 jUbobDmfmVd6MssKIbdXU+0J16ANoB8dJ/OqmX/3WhC91rJtsrU3Bp9ETC9Fd0Y3SLyV MObympXuH24h8ucZIKh8EkuWL9M8SLpoOs0dhBChZqdIsCtQRfnKrtbwo2IzBkUi9JCP EVfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Z14fbbqa3TKgxQR8UqCfTxtroV0hsH2kORlUZktUpiI=; b=F2K/ZF75qvKccwbRWx5lRHRWCrWXDRtwEO/3eJY9ndUwlMm7ZxY/wQGD4z3JlnGvHE kyuocXeD65zTmpcfa3XBGITh7jj6goiE5kBeaPV2uti+FwK6vLXX2U4eaoz9yNUp2T7S GrEfFCMfu5XQEKGo5gtvGfJqGnEBX28jGthOuB6bLIAPZ4GgFVI+Z6/zHZ4dgw8byV5V rtE+Gma/YYLEWN912KxjxnTkX3znekcXCAUEa7wf20XXOs+IhHUZYnsywsLLZFuURzD4 1kHzAPf+ehlhgbGzF2AsKpHun6MBGn5y8s8dPPZFeTlkuwIiFplySO/VxIcpi/VUhNda 1PgQ== X-Gm-Message-State: AKGB3mJzMvkEUjmp8m08M/IOOB8stJwtq3UN0wC9bmb+7JspjkF2KI5g 58MCD7HOBCn8hLdaB10IUcjpSzgn6kNyRKSuApAOSg== X-Google-Smtp-Source: ACJfBovfhmrzyD1ijZf8vQ17Q37dMTkkVmP3w7EWj0uzHTtYhpp2V1J1xmv4zSgMilOfr8qg7LBMbPfMhHs4MDIM80s= X-Received: by 10.36.74.200 with SMTP id k191mr20637676itb.69.1515603702200; Wed, 10 Jan 2018 09:01:42 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.160.217 with HTTP; Wed, 10 Jan 2018 09:01:41 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20180110165821.GA69465@FreeBSD.org> References: <201801101459.w0AExJWM055025@repo.freebsd.org> <201801101631.w0AGVAEV032087@pdx.rh.CN85.dnsmgr.net> <20180110165821.GA69465@FreeBSD.org> From: Warner Losh Date: Wed, 10 Jan 2018 10:01:41 -0700 X-Google-Sender-Auth: hPMWm9T2XPeWbx6rHoMnrMaz5PA Message-ID: Subject: Re: svn commit: r327767 - in head/sys: conf i386/bios i386/conf i386/isa To: Alexey Dokuchaev Cc: "Rodney W. Grimes" , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers , Warner Losh Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 17:01:43 -0000 On Wed, Jan 10, 2018 at 9:58 AM, Alexey Dokuchaev wrote: > On Wed, Jan 10, 2018 at 09:48:05AM -0700, Warner Losh wrote: > > On Wed, Jan 10, 2018 at 9:31 AM, Rodney W. Grimes wrote: > > > > New Revision: 327767 > > > > URL: https://svnweb.freebsd.org/changeset/base/327767 > > > > > > > > Log: > > > > Retire pmtimer driver. Move time fixing into apm driver. Move > > > > Iwasaki-san's copyright over. Remove FIXME code that couldn't > possibly > > > > work. Call tc_settime() with our estimate of the delta we've been > > > > alseep (the one we print) to adjust the time. Not sure what to do > > > > about callouts, so keep the small #ifdef in place there. > > > > > > > > Differential Revision: https://reviews.freebsd.org/D13823 > > > > > > RELNOTES: ? > > > Reason I ask is this effects custom kernel config file(s) > > > > Don't know. We don't normally document every kernel config file changes > > that's required. > > Well, `pmtimer' is a bit special. It is required in the kernel config in > order to preserve time counting during suspend (not sure about amd64, but > at least on i386, "device pmtimer" is required to be in kernel config for > timekeeping while sleeping). > It's only required for APM. ACPI it's a nop. And it didn't (until I believe that I fixed it) even adjust the time for APM. On APM it just prints how long the sleep was. Warner From owner-svn-src-head@freebsd.org Wed Jan 10 17:14:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 910DAE68C30 for ; Wed, 10 Jan 2018 17:14:26 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x234.google.com (mail-io0-x234.google.com [IPv6:2607:f8b0:4001:c06::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5202A7F41E for ; Wed, 10 Jan 2018 17:14:26 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x234.google.com with SMTP id k18so179707ioc.11 for ; Wed, 10 Jan 2018 09:14:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=PgKNrTscNkp8UxoP4w7DSfx+ZuSqkCCN7q6zUWgka0E=; b=lu8CDv05+o1IJePZlDOGlRyfSBHpaYh/0gXd6aLjIMu1Eit9dia9NQ4EMd2YaIC2wA /s5G0RE5/A7fL0SXnZVXPPjk9RB2M/LZd4aJLq3A5G3I+it+2+AFZ2L1+dZpOVSaESTw 0SXslHSmqeMjaz8PoNKGgvuOS76XggF7MTr8meMwnKGiUZwRB5Ix5+Cg0IPXY98ufN+v O9mygwBnlnKBErBLBEmfhON/aDFetuEGTvJsinJU04WL4eMlQP7Y6yvz1GNLfiHIS06F dc/KmVCI7hlFKK1GYT+4tj2uBWl8s+9mdlvgEDZNLiKTQtduhgJn3YYY6x4VeqDEDt14 JYLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=PgKNrTscNkp8UxoP4w7DSfx+ZuSqkCCN7q6zUWgka0E=; b=PSz1h4r5uTFjw2rGOiOg+OiG1GjZ7cpLFAN8aAcxtVShIhnlX3JNl2dt7JEvd+k4e4 somYMKgG9hX/S+m+zi0ARtFdJP9RNY0+gKJ9U2Mf8TlqWBJfI1CWOlFB9ZT2z6pZIRbx skRBOIBE9/E9ut9aZde3/nJ/mIftfo2E9ATeyoSmi2AIWTwcQ+HaL7VMO2R83xQHhYv5 lGG3wXpNzjbiesuKS871GNmyDYEo3M238xltdBEwI6Od2WXEiVsFIv1IvOrK9QYD66id eqSinDb315K70Nv+YD1Fcvv6gvqX1mBKVsr9SYRCcHh6gFCFKmdhmjWmKMWl3eudXUnM g0YQ== X-Gm-Message-State: AKGB3mJbiT3OSfUZ37cqs3u3fJ/NBUTPXZI/sc7sAyaexaPEkfy03vrI 3UKmfJPTLpaFr7XqWk2ORaZNaG/g+reYXSC+caWiiQ== X-Google-Smtp-Source: ACJfBou2DTy6RO/inYTEroPyYqBgax5B7sms7y1NolrwH3kuhaLhgV8uVJt7KW4fZp2BhPBdj2fTfmQ9/SncCzcXOrs= X-Received: by 10.107.180.151 with SMTP id d145mr17227961iof.136.1515604465415; Wed, 10 Jan 2018 09:14:25 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.160.217 with HTTP; Wed, 10 Jan 2018 09:14:24 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: References: <201801101459.w0AExJWM055025@repo.freebsd.org> <201801101631.w0AGVAEV032087@pdx.rh.CN85.dnsmgr.net> <20180110165821.GA69465@FreeBSD.org> From: Warner Losh Date: Wed, 10 Jan 2018 10:14:24 -0700 X-Google-Sender-Auth: GEuAve0McutLQipCKoo8O41IStY Message-ID: Subject: Re: svn commit: r327767 - in head/sys: conf i386/bios i386/conf i386/isa To: Alexey Dokuchaev Cc: "Rodney W. Grimes" , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers , Warner Losh Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 17:14:26 -0000 On Wed, Jan 10, 2018 at 10:01 AM, Warner Losh wrote: > > > On Wed, Jan 10, 2018 at 9:58 AM, Alexey Dokuchaev > wrote: > >> On Wed, Jan 10, 2018 at 09:48:05AM -0700, Warner Losh wrote: >> > On Wed, Jan 10, 2018 at 9:31 AM, Rodney W. Grimes wrote: >> > > > New Revision: 327767 >> > > > URL: https://svnweb.freebsd.org/changeset/base/327767 >> > > > >> > > > Log: >> > > > Retire pmtimer driver. Move time fixing into apm driver. Move >> > > > Iwasaki-san's copyright over. Remove FIXME code that couldn't >> possibly >> > > > work. Call tc_settime() with our estimate of the delta we've been >> > > > alseep (the one we print) to adjust the time. Not sure what to do >> > > > about callouts, so keep the small #ifdef in place there. >> > > > >> > > > Differential Revision: https://reviews.freebsd.org/D13823 >> > > >> > > RELNOTES: ? >> > > Reason I ask is this effects custom kernel config file(s) >> > >> > Don't know. We don't normally document every kernel config file changes >> > that's required. >> >> Well, `pmtimer' is a bit special. It is required in the kernel config in >> order to preserve time counting during suspend (not sure about amd64, but >> at least on i386, "device pmtimer" is required to be in kernel config for >> timekeeping while sleeping). >> > > It's only required for APM. ACPI it's a nop. > This part is true. Well, it was only required for APM. Not it's not required at all since, like ACPI, APM sets the time internally. > And it didn't (until I believe that I fixed it) even adjust the time for > APM. On APM it just prints how long the sleep was. > That last bit of what I wrote was wrong. The FIXME lead me to believe time wasn't being set, but the inittodr(0) sets time. Warner From owner-svn-src-head@freebsd.org Wed Jan 10 17:14:45 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E708E68CA2; Wed, 10 Jan 2018 17:14:45 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A9437F566; Wed, 10 Jan 2018 17:14:45 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 7938AB74F; Wed, 10 Jan 2018 17:14:44 +0000 (UTC) Date: Wed, 10 Jan 2018 17:14:44 +0000 From: Alexey Dokuchaev To: Warner Losh Cc: "Rodney W. Grimes" , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers , Warner Losh Subject: Re: svn commit: r327767 - in head/sys: conf i386/bios i386/conf i386/isa Message-ID: <20180110171444.GA85022@FreeBSD.org> References: <201801101459.w0AExJWM055025@repo.freebsd.org> <201801101631.w0AGVAEV032087@pdx.rh.CN85.dnsmgr.net> <20180110165821.GA69465@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 17:14:45 -0000 On Wed, Jan 10, 2018 at 10:01:41AM -0700, Warner Losh wrote: > On Wed, Jan 10, 2018 at 9:58 AM, Alexey Dokuchaev wrote: > > On Wed, Jan 10, 2018 at 09:48:05AM -0700, Warner Losh wrote: > > > On Wed, Jan 10, 2018 at 9:31 AM, Rodney W. Grimes wrote: > > > > > New Revision: 327767 > > > > > URL: https://svnweb.freebsd.org/changeset/base/327767 > > > > > > > > > > Log: > > > > > Retire pmtimer driver. Move time fixing into apm driver. Move > > > > > Iwasaki-san's copyright over. Remove FIXME code that couldn't > > possibly > > > > > work. Call tc_settime() with our estimate of the delta we've been > > > > > alseep (the one we print) to adjust the time. Not sure what to do > > > > > about callouts, so keep the small #ifdef in place there. > > > > > > > > > > Differential Revision: https://reviews.freebsd.org/D13823 > > > > > > > > RELNOTES: ? > > > > Reason I ask is this effects custom kernel config file(s) > > > > > > Don't know. We don't normally document every kernel config file changes > > > that's required. > > > > Well, `pmtimer' is a bit special. It is required in the kernel config in > > order to preserve time counting during suspend (not sure about amd64, but > > at least on i386, "device pmtimer" is required to be in kernel config for > > timekeeping while sleeping). > > It's only required for APM. ACPI it's a nop. > > And it didn't (until I believe that I fixed it) even adjust the time for > APM. On APM it just prints how long the sleep was. Not sure of now, but at least back in 2013 pmtimer was required on my i386 ACPI-ish laptop (it is still required now, but I just don't run -CURRENT): https://lists.freebsd.org/pipermail/svn-src-all/2013-May/069020.html ./danfe From owner-svn-src-head@freebsd.org Wed Jan 10 17:20:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76AF9E691E8 for ; Wed, 10 Jan 2018 17:20:19 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x233.google.com (mail-it0-x233.google.com [IPv6:2607:f8b0:4001:c0b::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 374867F959 for ; Wed, 10 Jan 2018 17:20:19 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x233.google.com with SMTP id p139so266579itb.1 for ; Wed, 10 Jan 2018 09:20:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Ro03w/bqno8X+23SQeloL4vwPWyl0URLsEIMVhLDumE=; b=SlEyT49iSFZPChNC74dIfMldKcsVz9+pB3tx++TpppC3tyyFOYW29nDHK9d1yVpJ61 8CDk4ZTskgbKbf1f0dkNpIjmQlhW5szNjfd4fytszvVCTSHpGOx88sj+ZoKkIPVy2JXp JqqwyWzzay6aJPLDk7rCSKjTJPu4/n1rjTnwEhI8d8uW6zXCZPpKyxsKLTzcagvUb7bx LiaO2lFRbM6F18G2rrbQuCv9nku4K6yTeOLE1fQu5y1VGLnya8qSz4qN3X/7UzOnXSvy FoWZSlDLmV8efmpgpikFyx9PFq9AX9lR8vUeVy7YF2TvbYMCDC76G5TgqzpeyEQRQRmA c21Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Ro03w/bqno8X+23SQeloL4vwPWyl0URLsEIMVhLDumE=; b=TfEf9kYLanKqYVOkgeXR/LUMJqeW8nnK0AI0Mt1wNoe/vOpKdwK9d98MKnwPiXebIv CVySOYVXxyAFxLeIMnCuw5XV49ACHGZLqhPOZQwQjwg9FJIpOpdRdx7haVxhbvADIUb8 yaUsakE50tKBU2EFDw86BAcrvIoF8D/klGLlZU/1CR9fAfhKv25u6MyCgNAw0tbO8MII FCah5Kp1V+dUvtdVXikNQxKJHshxS0fdDxnIa8CmKLp/+CIrTH7cCPCnKWjd1fzFJETW z01xRRCaJT/27lAUgfPnJsxWDUyTZnOb6frvwKX6KzrCwItK2li734mYLY+Jp7iNiTIL UXPQ== X-Gm-Message-State: AKGB3mL5mEgGGOc7GRYWta0tOAINfCPabdT3KFatIHBVoq5dGZMECpVQ tPHXV5hhepIsU8Ow7lOw2VRlRIIFG1XeBeqZ6bJ8Mw== X-Google-Smtp-Source: ACJfBosBg5tqtdCZb487OTKas90l+0/Ft8JdZdbxQLkrFrwzfCos7SiFmisyxGb4I8llqeqAVc0gU4M2nN7mDCISHZg= X-Received: by 10.36.74.200 with SMTP id k191mr20706107itb.69.1515604818300; Wed, 10 Jan 2018 09:20:18 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.160.217 with HTTP; Wed, 10 Jan 2018 09:20:17 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20180110171444.GA85022@FreeBSD.org> References: <201801101459.w0AExJWM055025@repo.freebsd.org> <201801101631.w0AGVAEV032087@pdx.rh.CN85.dnsmgr.net> <20180110165821.GA69465@FreeBSD.org> <20180110171444.GA85022@FreeBSD.org> From: Warner Losh Date: Wed, 10 Jan 2018 10:20:17 -0700 X-Google-Sender-Auth: x4k1i6h9bIC6F_07sEh7qmRo_ls Message-ID: Subject: Re: svn commit: r327767 - in head/sys: conf i386/bios i386/conf i386/isa To: Alexey Dokuchaev Cc: "Rodney W. Grimes" , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers , Warner Losh Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 17:20:19 -0000 On Wed, Jan 10, 2018 at 10:14 AM, Alexey Dokuchaev wrote: > On Wed, Jan 10, 2018 at 10:01:41AM -0700, Warner Losh wrote: > > On Wed, Jan 10, 2018 at 9:58 AM, Alexey Dokuchaev > wrote: > > > On Wed, Jan 10, 2018 at 09:48:05AM -0700, Warner Losh wrote: > > > > On Wed, Jan 10, 2018 at 9:31 AM, Rodney W. Grimes wrote: > > > > > > New Revision: 327767 > > > > > > URL: https://svnweb.freebsd.org/changeset/base/327767 > > > > > > > > > > > > Log: > > > > > > Retire pmtimer driver. Move time fixing into apm driver. Move > > > > > > Iwasaki-san's copyright over. Remove FIXME code that couldn't > > > possibly > > > > > > work. Call tc_settime() with our estimate of the delta we've > been > > > > > > alseep (the one we print) to adjust the time. Not sure what to > do > > > > > > about callouts, so keep the small #ifdef in place there. > > > > > > > > > > > > Differential Revision: https://reviews.freebsd.org/D13823 > > > > > > > > > > RELNOTES: ? > > > > > Reason I ask is this effects custom kernel config file(s) > > > > > > > > Don't know. We don't normally document every kernel config file > changes > > > > that's required. > > > > > > Well, `pmtimer' is a bit special. It is required in the kernel config > in > > > order to preserve time counting during suspend (not sure about amd64, > but > > > at least on i386, "device pmtimer" is required to be in kernel config > for > > > timekeeping while sleeping). > > > > It's only required for APM. ACPI it's a nop. > > > > And it didn't (until I believe that I fixed it) even adjust the time for > > APM. On APM it just prints how long the sleep was. > > Not sure of now, but at least back in 2013 pmtimer was required on my i386 > ACPI-ish laptop (it is still required now, but I just don't run -CURRENT): > > https://lists.freebsd.org/pipermail/svn-src-all/2013-May/069020.html It's been a nop in ACPI only on -current. Prior to making it a nop on current ACPI set the time, it was a nop for amd64. Warner From owner-svn-src-head@freebsd.org Wed Jan 10 17:25:09 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F14A7E6969E; Wed, 10 Jan 2018 17:25:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CB63C7FE56; Wed, 10 Jan 2018 17:25:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 14EF8986; Wed, 10 Jan 2018 17:25:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AHP8Jh020381; Wed, 10 Jan 2018 17:25:08 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AHP8Ca020379; Wed, 10 Jan 2018 17:25:08 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801101725.w0AHP8Ca020379@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 10 Jan 2018 17:25:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327774 - in head: . sys/i386/bios X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: . sys/i386/bios X-SVN-Commit-Revision: 327774 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 17:25:10 -0000 Author: imp Date: Wed Jan 10 17:25:08 2018 New Revision: 327774 URL: https://svnweb.freebsd.org/changeset/base/327774 Log: inittodr(0) actually sets the time, so there's no need to call tc_setclock(). It's redundant. Tweak UPDATING based on code review of past releases. Relnotes: yes (for the removal of pmtimer) Modified: head/UPDATING head/sys/i386/bios/apm.c Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Jan 10 16:56:02 2018 (r327773) +++ head/UPDATING Wed Jan 10 17:25:08 2018 (r327774) @@ -53,8 +53,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: 20180110: On i386, pmtimer has been removed. It's functionality has been folded - into apm. It was a nop on ACPI. Users may need to remove it from kernel - config files. + into apm. It was a nop on ACPI in current for a while now (but was still + needed on i386 in FreeBSD 11 and earlier). Users may need to remove it + from kernel config files. 20180104: The use of RSS hash from the network card aka flowid has been Modified: head/sys/i386/bios/apm.c ============================================================================== --- head/sys/i386/bios/apm.c Wed Jan 10 16:56:02 2018 (r327773) +++ head/sys/i386/bios/apm.c Wed Jan 10 17:25:08 2018 (r327774) @@ -1086,7 +1086,6 @@ apm_rtc_resume(void *arg __unused) { u_int second, minute, hour; struct timeval resume_time, tmp_time; - struct timespec ts; /* modified for adjkerntz */ timer_restore(); /* restore the all timers */ @@ -1097,14 +1096,11 @@ apm_rtc_resume(void *arg __unused) /* Calculate the delta time suspended */ timevalsub(&resume_time, &suspend_time); - second = ts.tv_sec = resume_time.tv_sec; - ts.tv_nsec = 0; - tc_setclock(&ts); - #ifdef PMTIMER_FIXUP_CALLTODO /* Fixup the calltodo list with the delta time. */ adjust_timeout_calltodo(&resume_time); #endif /* PMTIMER_FIXUP_CALLTODO */ + second = resume_time.tv_sec; hour = second / 3600; second %= 3600; minute = second / 60; From owner-svn-src-head@freebsd.org Wed Jan 10 17:30:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9899E69AED; Wed, 10 Jan 2018 17:30:14 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8639B801FC; Wed, 10 Jan 2018 17:30:14 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id D7903BF5C; Wed, 10 Jan 2018 17:30:13 +0000 (UTC) Date: Wed, 10 Jan 2018 17:30:13 +0000 From: Alexey Dokuchaev To: Warner Losh Cc: "Rodney W. Grimes" , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers , Warner Losh Subject: Re: svn commit: r327767 - in head/sys: conf i386/bios i386/conf i386/isa Message-ID: <20180110173013.GB85022@FreeBSD.org> References: <201801101459.w0AExJWM055025@repo.freebsd.org> <201801101631.w0AGVAEV032087@pdx.rh.CN85.dnsmgr.net> <20180110165821.GA69465@FreeBSD.org> <20180110171444.GA85022@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 17:30:14 -0000 On Wed, Jan 10, 2018 at 10:20:17AM -0700, Warner Losh wrote: > On Wed, Jan 10, 2018 at 10:14 AM, Alexey Dokuchaev wrote: > > ... > > Not sure of now, but at least back in 2013 pmtimer was required on my > > i386 ACPI-ish laptop (it is still required now, but I just don't run > > -CURRENT): > > > > https://lists.freebsd.org/pipermail/svn-src-all/2013-May/069020.html > > It's been a nop in ACPI only on -current. Ah, OK, that probably explains it then. I'll try it out later on amd64 laptop running fresh -CURRENT and report of any problems. Thanks, ./danfe From owner-svn-src-head@freebsd.org Wed Jan 10 17:32:48 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C6D7E69E2F for ; Wed, 10 Jan 2018 17:32:48 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x230.google.com (mail-it0-x230.google.com [IPv6:2607:f8b0:4001:c0b::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2C536806FC for ; Wed, 10 Jan 2018 17:32:48 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x230.google.com with SMTP id x42so287278ita.4 for ; Wed, 10 Jan 2018 09:32:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=CLiDO2f8N3ngeMlof5YxRzo6ISPp+AxaoikvtFnDn/0=; b=g+gFC1o81EPBek8Hi9NpWerztNn1NPWTcNHt8nTK+AxlBA3TN7PQa/5rJaSmak8NQm HpXLTDlt/A+/cOXPBOrV/kKEY7MDwMxAFdYDgGYxjl3M2/tBl+A9yyOv/KJR8yTal5lP dlxiLkd+tj6COhGBXClG/OBYyXXBARmuGRwsmqlj9kVOlVY8npVUlM04TsC5TPiFDPUG /DIxNN5RuHGQcMjTJXcJB5iqrQbDnXcH/V0PW7SGeFR6JM/0n8C0vY4za1+8DxJ4iag3 3k/tojAoZ34vPbuyMgIQyjuRFVKPwxnVOCNNAWrvY0ztJAxft3TOLl+1+lwUtfwJjHly 18Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=CLiDO2f8N3ngeMlof5YxRzo6ISPp+AxaoikvtFnDn/0=; b=b8TO4Wc8rZqJxoWPANC/CPX3blGazORr0pIRLPZrk5FQLVJMEdYZrF7mxBwJ+Kb7aa eF591QyArLt6d7/CE8Lh9+5q9JEMRHFVvgXFza9/eGYKGP6MtI5eViOG4shHeW/xGj48 MIpnBwZOEWyKYPnHbpR/vAXrwqoDG7NtCJ/eW8eQ9nQsDa4kIWLdUdXRTKJw0YEcu8YM 9q26PNjwgAu/rvwNeEFVX6f4PyCPMmTF83hJM3dkXFofiADKjlbiD28eRB/9rAeRmY07 fadmNwIVrIKsd1sstJ2WrnLOEAlDJVWNkSePrZBpbBr2el3ZMWJGYW2TCmm6uSNyUtBg WYHA== X-Gm-Message-State: AKGB3mJ3ALAb3Tvf8hbKJjIBPT8Y1Ckd/Mr7mvCFMtLvDlkeJ0y8yy6K Q/oV9sQwkiSTAcLuNyn4PYHfxcGDJy6oKlrXm6n/FQ== X-Google-Smtp-Source: ACJfBotvCNvsYQwRiUyKR23XzcaoyGKveMdmTy01iyt6f5F1mbttc5eobkbJNARSwmruyE1Hv6+CY4fG4ctzNSWNyVw= X-Received: by 10.36.74.200 with SMTP id k191mr20747595itb.69.1515605567412; Wed, 10 Jan 2018 09:32:47 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.160.217 with HTTP; Wed, 10 Jan 2018 09:32:46 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20180110173013.GB85022@FreeBSD.org> References: <201801101459.w0AExJWM055025@repo.freebsd.org> <201801101631.w0AGVAEV032087@pdx.rh.CN85.dnsmgr.net> <20180110165821.GA69465@FreeBSD.org> <20180110171444.GA85022@FreeBSD.org> <20180110173013.GB85022@FreeBSD.org> From: Warner Losh Date: Wed, 10 Jan 2018 10:32:46 -0700 X-Google-Sender-Auth: I6fliNITA_a1EITP9mYz3YC7b4w Message-ID: Subject: Re: svn commit: r327767 - in head/sys: conf i386/bios i386/conf i386/isa To: Alexey Dokuchaev Cc: "Rodney W. Grimes" , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers , Warner Losh Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 17:32:48 -0000 On Wed, Jan 10, 2018 at 10:30 AM, Alexey Dokuchaev wrote: > On Wed, Jan 10, 2018 at 10:20:17AM -0700, Warner Losh wrote: > > On Wed, Jan 10, 2018 at 10:14 AM, Alexey Dokuchaev wrote: > > > ... > > > Not sure of now, but at least back in 2013 pmtimer was required on my > > > i386 ACPI-ish laptop (it is still required now, but I just don't run > > > -CURRENT): > > > > > > https://lists.freebsd.org/pipermail/svn-src-all/2013-May/069020.html > > > > It's been a nop in ACPI only on -current. > > Ah, OK, that probably explains it then. I'll try it out later on amd64 > laptop running fresh -CURRENT and report of any problems. Thanks, > pmtimer was removed from amd64 some time ago... Please let me know if you hit any snags. Warner From owner-svn-src-head@freebsd.org Wed Jan 10 17:35:01 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9ACB4E6A0C1; Wed, 10 Jan 2018 17:35:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 77177808FB; Wed, 10 Jan 2018 17:35:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9BF1B35; Wed, 10 Jan 2018 17:35:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AHZ0FQ024904; Wed, 10 Jan 2018 17:35:00 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AHZ02v024903; Wed, 10 Jan 2018 17:35:00 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201801101735.w0AHZ02v024903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 10 Jan 2018 17:35:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327775 - head/sys/dev/amdsbwd X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/amdsbwd X-SVN-Commit-Revision: 327775 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 17:35:01 -0000 Author: avg Date: Wed Jan 10 17:35:00 2018 New Revision: 327775 URL: https://svnweb.freebsd.org/changeset/base/327775 Log: amdsbwd: fix handling of timeout values beyond the supported range The driver now fully observes watchdog(9) protocol. Previously a too large timeout was silently clamped while the correct behavior is to disable the watchdog and leave the error as is (i.e. to not report success). Also, previously a too small value caused the timer to stop while the correct behavior is to use the minimal supported value. MFC after: 2 weeks Modified: head/sys/dev/amdsbwd/amdsbwd.c Modified: head/sys/dev/amdsbwd/amdsbwd.c ============================================================================== --- head/sys/dev/amdsbwd/amdsbwd.c Wed Jan 10 17:25:08 2018 (r327774) +++ head/sys/dev/amdsbwd/amdsbwd.c Wed Jan 10 17:35:00 2018 (r327775) @@ -210,21 +210,30 @@ static void amdsbwd_event(void *arg, unsigned int cmd, int *error) { struct amdsbwd_softc *sc = arg; - unsigned int timeout; + uint64_t timeout; - /* convert from power-of-two-ns to WDT ticks */ - cmd &= WD_INTERVAL; - if (cmd < WD_TO_1SEC) - cmd = 0; - if (cmd) { - timeout = ((uint64_t)1 << (cmd - WD_TO_1MS)) / sc->ms_per_tick; + if (cmd != 0) { + timeout = 0; + cmd &= WD_INTERVAL; + if (cmd >= WD_TO_1MS) { + timeout = (uint64_t)1 << (cmd - WD_TO_1MS); + timeout = timeout / sc->ms_per_tick; + } + /* For a too short timeout use 1 tick. */ + if (timeout == 0) + timeout = 1; + /* For a too long timeout stop the timer. */ if (timeout > sc->max_ticks) - timeout = sc->max_ticks; - if (timeout != sc->timeout) { + timeout = 0; + } else { + timeout = 0; + } + + if (timeout != 0) { + if (timeout != sc->timeout) amdsbwd_tmr_set(sc, timeout); - if (!sc->active) - amdsbwd_tmr_enable(sc); - } + if (!sc->active) + amdsbwd_tmr_enable(sc); amdsbwd_tmr_reload(sc); *error = 0; } else { From owner-svn-src-head@freebsd.org Wed Jan 10 17:36:45 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37587E6A265; Wed, 10 Jan 2018 17:36:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 12D4580ABF; Wed, 10 Jan 2018 17:36:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AF2CB36; Wed, 10 Jan 2018 17:36:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AHaiJt025021; Wed, 10 Jan 2018 17:36:44 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AHai3n025020; Wed, 10 Jan 2018 17:36:44 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801101736.w0AHai3n025020@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 10 Jan 2018 17:36:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327776 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 327776 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 17:36:45 -0000 Author: jhb Date: Wed Jan 10 17:36:43 2018 New Revision: 327776 URL: https://svnweb.freebsd.org/changeset/base/327776 Log: Include ffsll() on riscv kernels. Modified: head/sys/conf/files.riscv Modified: head/sys/conf/files.riscv ============================================================================== --- head/sys/conf/files.riscv Wed Jan 10 17:35:00 2018 (r327775) +++ head/sys/conf/files.riscv Wed Jan 10 17:36:43 2018 (r327776) @@ -14,6 +14,7 @@ kern/subr_dummy_vdso_tc.c standard libkern/bcmp.c standard libkern/ffs.c standard libkern/ffsl.c standard +libkern/ffsll.c standard libkern/fls.c standard libkern/flsl.c standard libkern/flsll.c standard From owner-svn-src-head@freebsd.org Wed Jan 10 17:39:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C578E6A566; Wed, 10 Jan 2018 17:39:00 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DBAE880DD0; Wed, 10 Jan 2018 17:38:59 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 32E7FC676; Wed, 10 Jan 2018 17:38:59 +0000 (UTC) Date: Wed, 10 Jan 2018 17:38:59 +0000 From: Alexey Dokuchaev To: Warner Losh Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers , Warner Losh , "Rodney W. Grimes" Subject: Re: svn commit: r327767 - in head/sys: conf i386/bios i386/conf i386/isa Message-ID: <20180110173859.GC85022@FreeBSD.org> References: <201801101459.w0AExJWM055025@repo.freebsd.org> <201801101631.w0AGVAEV032087@pdx.rh.CN85.dnsmgr.net> <20180110165821.GA69465@FreeBSD.org> <20180110171444.GA85022@FreeBSD.org> <20180110173013.GB85022@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 17:39:00 -0000 On Wed, Jan 10, 2018 at 10:32:46AM -0700, Warner Losh wrote: > On Wed, Jan 10, 2018 at 10:30 AM, Alexey Dokuchaev wrote: > > On Wed, Jan 10, 2018 at 10:20:17AM -0700, Warner Losh wrote: > > > On Wed, Jan 10, 2018 at 10:14 AM, Alexey Dokuchaev wrote: > > > > ... > > > > Not sure of now, but at least back in 2013 pmtimer was required on my > > > > i386 ACPI-ish laptop (it is still required now, but I just don't run > > > > -CURRENT): > > > > > > > > https://lists.freebsd.org/pipermail/svn-src-all/2013-May/069020.html > > > > > > It's been a nop in ACPI only on -current. > > > > Ah, OK, that probably explains it then. I'll try it out later on amd64 > > laptop running fresh -CURRENT and report of any problems. Thanks, > > pmtimer was removed from amd64 some time ago... Please let me know if you > hit any snags. Right. I'll also try fresh -CURRENT on that i386 laptop of mine, just to make sure we've covered all it. ./danfe From owner-svn-src-head@freebsd.org Wed Jan 10 17:51:03 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6A69E6B063; Wed, 10 Jan 2018 17:51:03 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9FE1581A80; Wed, 10 Jan 2018 17:51:03 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E809CD20; Wed, 10 Jan 2018 17:51:02 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AHp246029823; Wed, 10 Jan 2018 17:51:02 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AHp2gw029822; Wed, 10 Jan 2018 17:51:02 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201801101751.w0AHp2gw029822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 10 Jan 2018 17:51:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327777 - head/sys/fs/nullfs X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/fs/nullfs X-SVN-Commit-Revision: 327777 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 17:51:03 -0000 Author: trasz Date: Wed Jan 10 17:51:02 2018 New Revision: 327777 URL: https://svnweb.freebsd.org/changeset/base/327777 Log: Make nullfs properly report MNT_AUTOMOUNTED set on the nullfs mount itself, instead of copying from the underlying filesystem. PR: 224851 Reported by: Jamie Landeg-Jones Tested by: Jamie Landeg-Jones MFC after: 2 weeks Modified: head/sys/fs/nullfs/null_vfsops.c Modified: head/sys/fs/nullfs/null_vfsops.c ============================================================================== --- head/sys/fs/nullfs/null_vfsops.c Wed Jan 10 17:36:43 2018 (r327776) +++ head/sys/fs/nullfs/null_vfsops.c Wed Jan 10 17:51:02 2018 (r327777) @@ -320,7 +320,8 @@ nullfs_statfs(mp, sbp) /* now copy across the "interesting" information and fake the rest */ sbp->f_type = mstat->f_type; sbp->f_flags = (sbp->f_flags & (MNT_RDONLY | MNT_NOEXEC | MNT_NOSUID | - MNT_UNION | MNT_NOSYMFOLLOW)) | (mstat->f_flags & ~MNT_ROOTFS); + MNT_UNION | MNT_NOSYMFOLLOW | MNT_AUTOMOUNTED)) | + (mstat->f_flags & ~(MNT_ROOTFS | MNT_AUTOMOUNTED)); sbp->f_bsize = mstat->f_bsize; sbp->f_iosize = mstat->f_iosize; sbp->f_blocks = mstat->f_blocks; From owner-svn-src-head@freebsd.org Wed Jan 10 17:55:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD15AE6B4B0; Wed, 10 Jan 2018 17:55:54 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 98E0081D9E; Wed, 10 Jan 2018 17:55:54 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (astound-66-234-199-215.ca.astound.net [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 7539710AC13; Wed, 10 Jan 2018 12:55:47 -0500 (EST) From: John Baldwin To: Ravi Pokala Cc: Conrad Meyer , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r327763 - in head/sys: conf contrib/zstd/lib/freebsd Date: Wed, 10 Jan 2018 09:37 -0800 Message-ID: <9917534.mS5UWR88gL@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: References: <201801100630.w0A6UxLT041383@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 10 Jan 2018 12:55:47 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 17:55:54 -0000 On Wednesday, January 10, 2018 08:51:27 AM Ravi Pokala wrote: > Hi Conrad, > > Alas, this still doesn't look right on RISC-V: > > zstd_kfreebsd.o: In function `__ctzdi2': > /usr/home/rpokala/freebsd/clean/base/head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c:58: undefined reference to `ffsll' > > I got substantively the same error both before and after `pkg upgrade' brought in updated RISC-V stuff: > > riscv64-binutils (2.29.51.20170726 -> 2.29_20180105,1) > riscv64-gcc (7.1.1 -> 7.2.0) > > Thanks, Try r327776. -- John Baldwin From owner-svn-src-head@freebsd.org Wed Jan 10 17:55:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1A6EE6B4BB; Wed, 10 Jan 2018 17:55:55 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8EE0681DA0; Wed, 10 Jan 2018 17:55:55 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (astound-66-234-199-215.ca.astound.net [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id DD42F10AF2A; Wed, 10 Jan 2018 12:55:48 -0500 (EST) From: John Baldwin To: Warner Losh Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r327705 - head/stand/mips/beri/common Date: Wed, 10 Jan 2018 09:20:05 -0800 Message-ID: <46003356.LuRHu4Xbkq@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: References: <201801081847.w08IlZ7F033684@repo.freebsd.org> <1620808.I0a57TDRna@ralph.baldwin.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 10 Jan 2018 12:55:49 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 17:55:55 -0000 On Tuesday, January 09, 2018 10:48:30 AM Warner Losh wrote: > On Tue, Jan 9, 2018 at 10:05 AM, John Baldwin wrote: > > > On Monday, January 08, 2018 12:02:09 PM Warner Losh wrote: > > > This should have been a nop... libsa specifically creates 'safe' headers > > > for all the standard ones. > > > > > > Ah, libsa creates a perfectly fine stdint.h, but not a inttypes.h... > > > > Would you prefer it to use stdint.h and stdio.h rather than stand.h? > > > No. stand.h is fine. I just wondered why you hit issues at all with > stdio.h. inttypes.h isn't supported because we don't implement the extra > functions defined there over stdint.h, so it should have given an error > when included. I'm just surprised I didn't catch it in my universe.sh > script that I use to build all loaders though... FWIW, compiling with external GCC did not trip over this (so in-tree GCC probably didn't either). Only compiling with clang (for which I still have some out-of-tree patches) tripped over this. -- John Baldwin From owner-svn-src-head@freebsd.org Wed Jan 10 17:55:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0163E6B4B1; Wed, 10 Jan 2018 17:55:54 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 98E3B81D9F; Wed, 10 Jan 2018 17:55:54 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (astound-66-234-199-215.ca.astound.net [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id E703910A7DB; Wed, 10 Jan 2018 12:55:45 -0500 (EST) From: John Baldwin To: Warner Losh Cc: Alexey Dokuchaev , "Rodney W. Grimes" , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers , Warner Losh Subject: Re: svn commit: r327767 - in head/sys: conf i386/bios i386/conf i386/isa Date: Wed, 10 Jan 2018 09:38:46 -0800 Message-ID: <5012765.tdQagMdlRk@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: References: <201801101459.w0AExJWM055025@repo.freebsd.org> <20180110171444.GA85022@FreeBSD.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 10 Jan 2018 12:55:46 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 17:55:54 -0000 On Wednesday, January 10, 2018 10:20:17 AM Warner Losh wrote: > On Wed, Jan 10, 2018 at 10:14 AM, Alexey Dokuchaev > wrote: > > > On Wed, Jan 10, 2018 at 10:01:41AM -0700, Warner Losh wrote: > > > On Wed, Jan 10, 2018 at 9:58 AM, Alexey Dokuchaev > > wrote: > > > > On Wed, Jan 10, 2018 at 09:48:05AM -0700, Warner Losh wrote: > > > > > On Wed, Jan 10, 2018 at 9:31 AM, Rodney W. Grimes wrote: > > > > > > > New Revision: 327767 > > > > > > > URL: https://svnweb.freebsd.org/changeset/base/327767 > > > > > > > > > > > > > > Log: > > > > > > > Retire pmtimer driver. Move time fixing into apm driver. Move > > > > > > > Iwasaki-san's copyright over. Remove FIXME code that couldn't > > > > possibly > > > > > > > work. Call tc_settime() with our estimate of the delta we've > > been > > > > > > > alseep (the one we print) to adjust the time. Not sure what to > > do > > > > > > > about callouts, so keep the small #ifdef in place there. > > > > > > > > > > > > > > Differential Revision: https://reviews.freebsd.org/D13823 > > > > > > > > > > > > RELNOTES: ? > > > > > > Reason I ask is this effects custom kernel config file(s) > > > > > > > > > > Don't know. We don't normally document every kernel config file > > changes > > > > > that's required. > > > > > > > > Well, `pmtimer' is a bit special. It is required in the kernel config > > in > > > > order to preserve time counting during suspend (not sure about amd64, > > but > > > > at least on i386, "device pmtimer" is required to be in kernel config > > for > > > > timekeeping while sleeping). > > > > > > It's only required for APM. ACPI it's a nop. > > > > > > And it didn't (until I believe that I fixed it) even adjust the time for > > > APM. On APM it just prints how long the sleep was. > > > > Not sure of now, but at least back in 2013 pmtimer was required on my i386 > > ACPI-ish laptop (it is still required now, but I just don't run -CURRENT): > > > > https://lists.freebsd.org/pipermail/svn-src-all/2013-May/069020.html > > > It's been a nop in ACPI only on -current. Prior to making it a nop on > current ACPI set the time, it was a nop for amd64. Then it probably does warrant a relnotes entry if the effect going from 11 to 12 is that pmtimer has become non-optional / standard, so the kernel config option is obsolete. -- John Baldwin From owner-svn-src-head@freebsd.org Wed Jan 10 18:15:01 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A2E2E6C978; Wed, 10 Jan 2018 18:15:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5FDAC83054; Wed, 10 Jan 2018 18:15:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 706821208; Wed, 10 Jan 2018 18:15:00 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AIF0mr042198; Wed, 10 Jan 2018 18:15:00 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AIF0SX042197; Wed, 10 Jan 2018 18:15:00 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801101815.w0AIF0SX042197@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 10 Jan 2018 18:15:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327778 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 327778 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 18:15:01 -0000 Author: emaste Date: Wed Jan 10 18:15:00 2018 New Revision: 327778 URL: https://svnweb.freebsd.org/changeset/base/327778 Log: src.conf.5: regen after r325692 and r326888 Sponsored by: The FreeBSD Foundation Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Wed Jan 10 17:51:02 2018 (r327777) +++ head/share/man/man5/src.conf.5 Wed Jan 10 18:15:00 2018 (r327778) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd November 2, 2017 +.Dd January 10, 2018 .Dt SRC.CONF 5 .Os .Sh NAME @@ -996,6 +996,11 @@ Set to use LLVM's libunwind stack unwinder (instead of .Pp This is a default setting on amd64/amd64, arm64/aarch64, i386/i386, riscv/riscv64 and riscv/riscv64sf. +.It Va WITH_LOADER_FIREWIRE +Enable firewire support in /boot/loader and /boot/zfsloader on x86. +This option is a nop on all other platforms. +.It Va WITHOUT_LOADER_GELI +Disable inclusion of GELI crypto support in the boot chain binaries. .It Va WITHOUT_LOCALES Set to not build localization files; see .Xr locale 1 . From owner-svn-src-head@freebsd.org Wed Jan 10 18:39:30 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67749E6E22A; Wed, 10 Jan 2018 18:39:30 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp003.me.com (mr11p00im-asmtp003.me.com [17.110.69.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AA8F38D; Wed, 10 Jan 2018 18:39:30 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.mr11p00im-asmtp003.me.com by mr11p00im-asmtp003.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0P2C00G00QVKBL00@mr11p00im-asmtp003.me.com>; Wed, 10 Jan 2018 18:39:01 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=04042017; t=1515609541; bh=3tLPCJRupHM6ks8p1T2ZVR5d++6JU5a/P9MxrP7Y+gI=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=xaUmMNwch76I3xTWPzyrepfxjm0ENzSgO8UBoatsc/IscwhvyCqb+eFSUi37MmbO3 958hcefSXKz6GsxIAv75YfryiG2OrHmI5i8GLHPNuR0xluyfbbJ/n/FPfW8IiXhNO1 QxmEaSegr+tXOOTJRWZpixGAITvzhIysBmHqHoYhFeaDKIN1x4Bi/0BKuyQaDldVje v5oCYmnxDRnt6/2FjTNT1jQwNJVrNC9rux/4SLDPVBstdhzJxJhTyMpIivLm87K1ce 11VPFBjjnv2Rz32gAAJbn9IlwVlA4qCUfgeeZxTBO7BinF2BhrfNTGgHz9e5nc9QoL PakW5NlONa6IQ== Received: from icloud.com ([127.0.0.1]) by mr11p00im-asmtp003.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0P2C009E7RSYRY30@mr11p00im-asmtp003.me.com>; Wed, 10 Jan 2018 18:39:00 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-10_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1801100260 User-Agent: Microsoft-MacOutlook/f.29.0.171205 Date: Wed, 10 Jan 2018 10:38:58 -0800 Subject: Re: svn commit: r327763 - in head/sys: conf contrib/zstd/lib/freebsd From: Ravi Pokala To: Conrad Meyer , John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-id: <042A7C15-5EEA-497C-AF81-4F9960FE988A@mac.com> Thread-topic: svn commit: r327763 - in head/sys: conf contrib/zstd/lib/freebsd References: <201801100630.w0A6UxLT041383@repo.freebsd.org> In-reply-to: MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 18:39:30 -0000 Ah, it looks like r327776 fixed this. Thanks John! -Ravi (rpokala@) -----Original Message----- From: on behalf of Ravi Pokala Date: 2018-01-10, Wednesday at 08:51 To: Conrad Meyer , , , Subject: Re: svn commit: r327763 - in head/sys: conf contrib/zstd/lib/freebsd Hi Conrad, Alas, this still doesn't look right on RISC-V: zstd_kfreebsd.o: In function `__ctzdi2': /usr/home/rpokala/freebsd/clean/base/head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c:58: undefined reference to `ffsll' I got substantively the same error both before and after `pkg upgrade' brought in updated RISC-V stuff: riscv64-binutils (2.29.51.20170726 -> 2.29_20180105,1) riscv64-gcc (7.1.1 -> 7.2.0) Thanks, Ravi (rpokala@) -----Original Message----- From: on behalf of Conrad Meyer Date: 2018-01-09, Tuesday at 22:30 To: , , Subject: svn commit: r327763 - in head/sys: conf contrib/zstd/lib/freebsd Author: cem Date: Wed Jan 10 06:30:59 2018 New Revision: 327763 URL: https://svnweb.freebsd.org/changeset/base/327763 Log: Finally, fix Zstd kernel build on MIPS and RISC-V Add an implementation of the intrinsics invoked by __builtin_ctz{,ll} and __builtin_clz{,ll}, and include this compilation unit on platforms that lack assembly intrinsics for those builtins (MIPS and RISC-V). Future cleanup work might involve bringing these into a mini libcompiler-rt for the standalone kernel environment. Or cleaning up the approach upstream takes for builtins in standalone environments (or just FreeBSD). For now, at least this builds, and doesn't require modifying the vendor code. Reported by: jeff, markj, mizhka Reviewed by: jhb (earlier version), rpokala (comment text earlier version) Sponsored by: Dell EMC Isilon Added: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c (contents, props changed) Modified: head/sys/conf/files.mips head/sys/conf/files.riscv Modified: head/sys/conf/files.mips ============================================================================== --- head/sys/conf/files.mips Wed Jan 10 05:52:24 2018 (r327762) +++ head/sys/conf/files.mips Wed Jan 10 06:30:59 2018 (r327763) @@ -112,3 +112,6 @@ cddl/compat/opensolaris/kern/opensolaris_atomic.c opti cddl/dev/dtrace/mips/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}" cddl/dev/dtrace/mips/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" cddl/dev/fbt/mips/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}" + +# Zstd +contrib/zstd/lib/freebsd/zstd_kfreebsd.c standard compile-with ${ZSTD_C} Modified: head/sys/conf/files.riscv ============================================================================== --- head/sys/conf/files.riscv Wed Jan 10 05:52:24 2018 (r327762) +++ head/sys/conf/files.riscv Wed Jan 10 06:30:59 2018 (r327763) @@ -56,3 +56,6 @@ riscv/riscv/uio_machdep.c standard riscv/riscv/uma_machdep.c standard riscv/riscv/unwind.c optional ddb | kdtrace_hooks | stack riscv/riscv/vm_machdep.c standard + +# Zstd +contrib/zstd/lib/freebsd/zstd_kfreebsd.c standard compile-with ${ZSTD_C} Added: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c Wed Jan 10 06:30:59 2018 (r327763) @@ -0,0 +1,75 @@ +/*- + * Copyright (c) 2018 Conrad Meyer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include "zstd_kfreebsd.h" + +/* + * The kernel as a standalone target does not link against libgcc or + * libcompiler-rt. On platforms (e.g., MIPS and RISCV) that do not have a + * direct assembly implementation of the relevant builtin functions that zstd + * references, the compiler converts them into calls to the runtime library + * intrinsics. Since the kernel does not link against the runtime libraries, + * this results in a failure to link the kernel. + * + * The goal of the following definitions is to use supported kernel constructs + * to implement the same functionality, without adding diff to the Zstd contrib + * code. + * + * A subsequent enhancement might create a mini compiler-rt library for kernel + * use and move these over there instead. + */ + +/* Count trailing zeros */ +int +__ctzsi2(int x) +{ + if (x == 0) + return (sizeof(x) * NBBY); + return (ffs(x) - 1); +} + +long long +__ctzdi2(long long x) +{ + if (x == 0) + return (sizeof(x) * NBBY); + return (ffsll(x) - 1); +} + +/* Count leading zeros */ +int +__clzsi2(int x) +{ + return (sizeof(x) * NBBY - fls(x)); +} + +long long +__clzdi2(long long x) +{ + return (sizeof(x) * NBBY - flsll(x)); +} From owner-svn-src-head@freebsd.org Wed Jan 10 18:41:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 16D4DE6E474; Wed, 10 Jan 2018 18:41:29 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from pv33p00im-asmtp001.mac.com (pv33p00im-asmtp001.me.com [17.142.194.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EBE90AE1; Wed, 10 Jan 2018 18:41:28 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.pv33p00im-asmtp001.me.com by pv33p00im-asmtp001.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0P2C00800QL9SF00@pv33p00im-asmtp001.me.com>; Wed, 10 Jan 2018 18:41:15 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=04042017; t=1515609675; bh=4YGJ57iffFWaMuC64ooTwH6U+m8hEPM1TozmrrZKF7o=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=cmO/fZr+LEHPKhf+h2razFA6HapvnSBv4Cse1F66qRX7sUKGfFjaRfbCJg5QBy9C8 LwxwtjHnQSx+VH5XUPYCYHd9bBKPGuXSb+Wjr0PVIiLg/buCjlDOUNeuQt2bvcR0g8 jvZrXdLIBzB/Y6rD9yqZANUCSHKV4F3G5C0YGgi8VvZBRZpa59FD5CpyQ9hesgMiX4 2+JndwzKg6NO0b/N0rD/9qjqcb6T6p7/YBK6F5J/zfiE1XrGXloqq8G9+UU1DFqBmX Y562uDwAmpF3YWR9eeZB1an9t3LUFXvg2bY19Zl5RHqAVI1Ag/35JtuYXcjNrplgMO 6FtUolLEXayMg== Received: from icloud.com ([127.0.0.1]) by pv33p00im-asmtp001.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0P2C00EORRWN9U10@pv33p00im-asmtp001.me.com>; Wed, 10 Jan 2018 18:41:12 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-10_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1801100260 User-Agent: Microsoft-MacOutlook/f.29.0.171205 Date: Wed, 10 Jan 2018 10:41:10 -0800 Subject: Re: svn commit: r327763 - in head/sys: conf contrib/zstd/lib/freebsd From: Ravi Pokala To: John Baldwin Cc: Conrad Meyer , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-id: <02206EC7-EEA0-4461-ACD2-BA9B06B201D7@mac.com> Thread-topic: svn commit: r327763 - in head/sys: conf contrib/zstd/lib/freebsd References: <201801100630.w0A6UxLT041383@repo.freebsd.org> <9917534.mS5UWR88gL@ralph.baldwin.cx> In-reply-to: <9917534.mS5UWR88gL@ralph.baldwin.cx> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 18:41:29 -0000 Yup, that did the trick. Thank you sir! -Ravi (rpokala@) -----Original Message----- From: on behalf of John Baldwin Date: 2018-01-10, Wednesday at 09:37 To: Ravi Pokala Cc: Conrad Meyer , , , Subject: Re: svn commit: r327763 - in head/sys: conf contrib/zstd/lib/freebsd On Wednesday, January 10, 2018 08:51:27 AM Ravi Pokala wrote: > Hi Conrad, > > Alas, this still doesn't look right on RISC-V: > > zstd_kfreebsd.o: In function `__ctzdi2': > /usr/home/rpokala/freebsd/clean/base/head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c:58: undefined reference to `ffsll' > > I got substantively the same error both before and after `pkg upgrade' brought in updated RISC-V stuff: > > riscv64-binutils (2.29.51.20170726 -> 2.29_20180105,1) > riscv64-gcc (7.1.1 -> 7.2.0) > > Thanks, Try r327776. -- John Baldwin From owner-svn-src-head@freebsd.org Wed Jan 10 19:35:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3890E71CC9; Wed, 10 Jan 2018 19:35:41 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f46.google.com (mail-it0-f46.google.com [209.85.214.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B244B6348F; Wed, 10 Jan 2018 19:35:41 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f46.google.com with SMTP id b5so725782itc.3; Wed, 10 Jan 2018 11:35:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=Pmr18K8QdlmxvmhYRJ97NTvhEjW0wyMR06plzCbCJgY=; b=W8MAzgtmLzhclysapWrvCHVAgT4NW5PjniIbw/EuOd2mfbOW/nPzIIbMRikcRjVYXB CXod+xINhBVDE1+pqaq3v74S34cSSRBqp4GsnD8WTOeyQ60HfxU78ZWDXI2URHu5d+Rm KsqmD5lI81Z2hVdICP8oYUrIvkBvV1faUh6DweYgH7/pofuD5QsKhbuSf6fdn5a10Xdj 4fxcmA9qj64428IoadTyJPECjpwe/AQZ2bta0JCfNsHap3+D215YCmQAAnoMxtH/wko+ tgIxrn5MVBc1A3pSrcmjBlYfyszJeRjVcMjd/NcN9swl0x/FjGMpJmBpDn029/xOGeNB OzYg== X-Gm-Message-State: AKGB3mL2v+KR8a0icc8nq8rtQXZZkNN1fJE4As+ghwcH4NiH7jfCEfhb FEbzDsXv+IN7unTkFtrO6GYI7hyv X-Google-Smtp-Source: ACJfBotRBX2h5Dx9BRY3UqJ1BHa3H9WZwrRhJc3VxbLUYACWqNe66LMym3cJZ3ezZPGLkmcDi+41qg== X-Received: by 10.36.25.140 with SMTP id b134mr17942837itb.21.1515612940257; Wed, 10 Jan 2018 11:35:40 -0800 (PST) Received: from mail-io0-f179.google.com (mail-io0-f179.google.com. [209.85.223.179]) by smtp.gmail.com with ESMTPSA id p124sm3998668ite.11.2018.01.10.11.35.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jan 2018 11:35:40 -0800 (PST) Received: by mail-io0-f179.google.com with SMTP id 14so665083iou.2; Wed, 10 Jan 2018 11:35:39 -0800 (PST) X-Received: by 10.107.25.207 with SMTP id 198mr18062634ioz.226.1515612939786; Wed, 10 Jan 2018 11:35:39 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.15.193 with HTTP; Wed, 10 Jan 2018 11:35:39 -0800 (PST) In-Reply-To: <9917534.mS5UWR88gL@ralph.baldwin.cx> References: <201801100630.w0A6UxLT041383@repo.freebsd.org> <9917534.mS5UWR88gL@ralph.baldwin.cx> From: Conrad Meyer Date: Wed, 10 Jan 2018 11:35:39 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r327763 - in head/sys: conf contrib/zstd/lib/freebsd To: John Baldwin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 19:35:42 -0000 Thank you. On Wed, Jan 10, 2018 at 9:37 AM, John Baldwin wrote: > On Wednesday, January 10, 2018 08:51:27 AM Ravi Pokala wrote: >> Hi Conrad, >> >> Alas, this still doesn't look right on RISC-V: >> >> zstd_kfreebsd.o: In function `__ctzdi2': >> /usr/home/rpokala/freebsd/clean/base/head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c:58: undefined reference to `ffsll' >> >> I got substantively the same error both before and after `pkg upgrade' brought in updated RISC-V stuff: >> >> riscv64-binutils (2.29.51.20170726 -> 2.29_20180105,1) >> riscv64-gcc (7.1.1 -> 7.2.0) >> >> Thanks, > > Try r327776. > > -- > John Baldwin From owner-svn-src-head@freebsd.org Wed Jan 10 19:37:22 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ADC1CE71E87; Wed, 10 Jan 2018 19:37:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 848DA6366D; Wed, 10 Jan 2018 19:37:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95D991F98; Wed, 10 Jan 2018 19:37:21 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AJbLp0077586; Wed, 10 Jan 2018 19:37:21 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AJbLJa077585; Wed, 10 Jan 2018 19:37:21 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201801101937.w0AJbLJa077585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 10 Jan 2018 19:37:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327779 - head/sys/geom/mirror X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/geom/mirror X-SVN-Commit-Revision: 327779 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 19:37:22 -0000 Author: markj Date: Wed Jan 10 19:37:21 2018 New Revision: 327779 URL: https://svnweb.freebsd.org/changeset/base/327779 Log: Fix handling of read errors during mirror synchronization. We would previously just free the request BIO, which would either cause the disk to stay stuck in the SYNCHRONIZING state, or result in synchronization completing without having copied the block which returned an error. With this change, if the disk which returned an error is the only active disk in the mirror, the synchronizing disk is kicked out. Otherwise, the read is retried. Reported and tested by: pho (previous version) MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/sys/geom/mirror/g_mirror.c Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Wed Jan 10 18:15:00 2018 (r327778) +++ head/sys/geom/mirror/g_mirror.c Wed Jan 10 19:37:21 2018 (r327779) @@ -110,6 +110,8 @@ static int g_mirror_update_disk(struct g_mirror_disk * static void g_mirror_update_device(struct g_mirror_softc *sc, bool force); static void g_mirror_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g_consumer *cp, struct g_provider *pp); +static void g_mirror_sync_reinit(const struct g_mirror_disk *disk, + struct bio *bp, off_t offset); static void g_mirror_sync_stop(struct g_mirror_disk *disk, int type); static void g_mirror_register_request(struct g_mirror_softc *sc, struct bio *bp); @@ -1298,10 +1300,11 @@ g_mirror_sync_request_free(struct g_mirror_disk *disk, /* * Handle synchronization requests. - * Every synchronization request is two-steps process: first, READ request is - * send to active provider and then WRITE request (with read data) to the provider - * being synchronized. When WRITE is finished, new synchronization request is - * send. + * Every synchronization request is a two-step process: first, a read request is + * sent to the mirror provider via the sync consumer. If that request completes + * successfully, it is converted to a write and sent to the disk being + * synchronized. If the write also completes successfully, the synchronization + * offset is advanced and a new read request is submitted. */ static void g_mirror_sync_request(struct g_mirror_softc *sc, struct bio *bp) @@ -1326,13 +1329,16 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc return; } + sync = &disk->d_sync; + /* * Synchronization request. */ switch (bp->bio_cmd) { - case BIO_READ: - { + case BIO_READ: { + struct g_mirror_disk *d; struct g_consumer *cp; + int readable; KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_sync_request_read, bp->bio_error); @@ -1341,7 +1347,33 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc G_MIRROR_LOGREQ(0, bp, "Synchronization request failed (error=%d).", bp->bio_error); - g_mirror_sync_request_free(disk, bp); + + /* + * If there's at least one other disk from which we can + * read the block, retry the request. + */ + readable = 0; + LIST_FOREACH(d, &sc->sc_disks, d_next) + if (d->d_state == G_MIRROR_DISK_STATE_ACTIVE && + !(d->d_flags & G_MIRROR_DISK_FLAG_BROKEN)) + readable++; + + /* + * The read error will trigger a syncid bump, so there's + * no need to do that here. + * + * If we can retry the read from another disk, do so. + * Otherwise, all we can do is kick out the new disk. + */ + if (readable == 0) { + g_mirror_sync_request_free(disk, bp); + g_mirror_event_send(disk, + G_MIRROR_DISK_STATE_DISCONNECTED, + G_MIRROR_EVENT_DONTWAIT); + } else { + g_mirror_sync_reinit(disk, bp, bp->bio_offset); + goto retry_read; + } return; } G_MIRROR_LOGREQ(3, bp, @@ -1355,12 +1387,10 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc cp->index++; g_io_request(bp, cp); return; - } - case BIO_WRITE: - { + } + case BIO_WRITE: { off_t offset; - void *data; - int i, idx; + int i; KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_sync_request_write, bp->bio_error); @@ -1377,7 +1407,6 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc return; } G_MIRROR_LOGREQ(3, bp, "Synchronization request finished."); - sync = &disk->d_sync; if (sync->ds_offset >= sc->sc_mediasize || sync->ds_consumer == NULL || (sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROY) != 0) { @@ -1397,20 +1426,13 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc } /* Send next synchronization request. */ - data = bp->bio_data; - idx = (int)(uintptr_t)bp->bio_caller1; - g_reset_bio(bp); - bp->bio_cmd = BIO_READ; - bp->bio_offset = sync->ds_offset; - bp->bio_length = MIN(MAXPHYS, sc->sc_mediasize - bp->bio_offset); + g_mirror_sync_reinit(disk, bp, sync->ds_offset); sync->ds_offset += bp->bio_length; - bp->bio_done = g_mirror_sync_done; - bp->bio_data = data; - bp->bio_from = sync->ds_consumer; - bp->bio_to = sc->sc_provider; - bp->bio_caller1 = (void *)(uintptr_t)idx; + +retry_read: G_MIRROR_LOGREQ(3, bp, "Sending synchronization request."); sync->ds_consumer->index++; + /* * Delay the request if it is colliding with a regular request. */ @@ -1436,11 +1458,9 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc sync->ds_update_ts = time_uptime; } return; - } + } default: - KASSERT(1 == 0, ("Invalid command here: %u (device=%s)", - bp->bio_cmd, sc->sc_name)); - break; + panic("Invalid I/O request %p", bp); } } @@ -2031,15 +2051,39 @@ g_mirror_update_idle(struct g_mirror_softc *sc, struct } static void +g_mirror_sync_reinit(const struct g_mirror_disk *disk, struct bio *bp, + off_t offset) +{ + void *data; + int idx; + + data = bp->bio_data; + idx = (int)(uintptr_t)bp->bio_caller1; + g_reset_bio(bp); + + bp->bio_cmd = BIO_READ; + bp->bio_data = data; + bp->bio_done = g_mirror_sync_done; + bp->bio_from = disk->d_sync.ds_consumer; + bp->bio_to = disk->d_softc->sc_provider; + bp->bio_caller1 = (void *)(uintptr_t)idx; + bp->bio_offset = offset; + bp->bio_length = MIN(MAXPHYS, + disk->d_softc->sc_mediasize - bp->bio_offset); +} + +static void g_mirror_sync_start(struct g_mirror_disk *disk) { struct g_mirror_softc *sc; + struct g_mirror_disk_sync *sync; struct g_consumer *cp; struct bio *bp; int error, i; g_topology_assert_not(); sc = disk->d_softc; + sync = &disk->d_sync; sx_assert(&sc->sc_lock, SX_LOCKED); KASSERT(disk->d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING, @@ -2065,54 +2109,48 @@ g_mirror_sync_start(struct g_mirror_disk *disk) g_mirror_get_diskname(disk)); if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_NOFAILSYNC) == 0) disk->d_flags |= G_MIRROR_DISK_FLAG_DIRTY; - KASSERT(disk->d_sync.ds_consumer == NULL, + KASSERT(sync->ds_consumer == NULL, ("Sync consumer already exists (device=%s, disk=%s).", sc->sc_name, g_mirror_get_diskname(disk))); - disk->d_sync.ds_consumer = cp; - disk->d_sync.ds_consumer->private = disk; - disk->d_sync.ds_consumer->index = 0; + sync->ds_consumer = cp; + sync->ds_consumer->private = disk; + sync->ds_consumer->index = 0; /* * Allocate memory for synchronization bios and initialize them. */ - disk->d_sync.ds_bios = malloc(sizeof(struct bio *) * g_mirror_syncreqs, + sync->ds_bios = malloc(sizeof(struct bio *) * g_mirror_syncreqs, M_MIRROR, M_WAITOK); for (i = 0; i < g_mirror_syncreqs; i++) { bp = g_alloc_bio(); - disk->d_sync.ds_bios[i] = bp; - bp->bio_parent = NULL; - bp->bio_cmd = BIO_READ; + sync->ds_bios[i] = bp; + bp->bio_data = malloc(MAXPHYS, M_MIRROR, M_WAITOK); - bp->bio_cflags = 0; - bp->bio_offset = disk->d_sync.ds_offset; - bp->bio_length = MIN(MAXPHYS, sc->sc_mediasize - bp->bio_offset); - disk->d_sync.ds_offset += bp->bio_length; - bp->bio_done = g_mirror_sync_done; - bp->bio_from = disk->d_sync.ds_consumer; - bp->bio_to = sc->sc_provider; bp->bio_caller1 = (void *)(uintptr_t)i; + g_mirror_sync_reinit(disk, bp, sync->ds_offset); + sync->ds_offset += bp->bio_length; } /* Increase the number of disks in SYNCHRONIZING state. */ sc->sc_sync.ds_ndisks++; /* Set the number of in-flight synchronization requests. */ - disk->d_sync.ds_inflight = g_mirror_syncreqs; + sync->ds_inflight = g_mirror_syncreqs; /* * Fire off first synchronization requests. */ for (i = 0; i < g_mirror_syncreqs; i++) { - bp = disk->d_sync.ds_bios[i]; + bp = sync->ds_bios[i]; G_MIRROR_LOGREQ(3, bp, "Sending synchronization request."); - disk->d_sync.ds_consumer->index++; + sync->ds_consumer->index++; /* * Delay the request if it is colliding with a regular request. */ if (g_mirror_regular_collision(sc, bp)) g_mirror_sync_delay(sc, bp); else - g_io_request(bp, disk->d_sync.ds_consumer); + g_io_request(bp, sync->ds_consumer); } } From owner-svn-src-head@freebsd.org Wed Jan 10 19:41:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F441E720ED; Wed, 10 Jan 2018 19:41:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 57F5963917; Wed, 10 Jan 2018 19:41:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9594C1FC4; Wed, 10 Jan 2018 19:41:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AJf5wS079935; Wed, 10 Jan 2018 19:41:05 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AJf5SR079933; Wed, 10 Jan 2018 19:41:05 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201801101941.w0AJf5SR079933@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 10 Jan 2018 19:41:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327780 - head/tests/sys/geom/class/mirror X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/tests/sys/geom/class/mirror X-SVN-Commit-Revision: 327780 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 19:41:06 -0000 Author: markj Date: Wed Jan 10 19:41:05 2018 New Revision: 327780 URL: https://svnweb.freebsd.org/changeset/base/327780 Log: Add regression tests for r327779. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Added: head/tests/sys/geom/class/mirror/sync_error.sh (contents, props changed) Modified: head/tests/sys/geom/class/mirror/Makefile Modified: head/tests/sys/geom/class/mirror/Makefile ============================================================================== --- head/tests/sys/geom/class/mirror/Makefile Wed Jan 10 19:37:21 2018 (r327779) +++ head/tests/sys/geom/class/mirror/Makefile Wed Jan 10 19:41:05 2018 (r327780) @@ -18,6 +18,8 @@ TAP_TESTS_SH+= 11_test TAP_TESTS_SH+= 12_test TAP_TESTS_SH+= 13_test +ATF_TESTS_SH+= sync_error + ${PACKAGE}FILES+= conf.sh .for t in ${TAP_TESTS_SH} Added: head/tests/sys/geom/class/mirror/sync_error.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/geom/class/mirror/sync_error.sh Wed Jan 10 19:41:05 2018 (r327780) @@ -0,0 +1,110 @@ +# $FreeBSD$ + +REG_READ_FP=debug.fail_point.g_mirror_regular_request_read + +atf_test_case sync_read_error_2_disks cleanup +sync_read_error_2_disks_head() +{ + atf_set "descr" \ + "Ensure that we properly handle read errors during synchronization." + atf_set "require.user" "root" +} +sync_read_error_2_disks_body() +{ + . $(atf_get_srcdir)/conf.sh + + f1=$(mktemp ${base}.XXXXXX) + f2=$(mktemp ${base}.XXXXXX) + + atf_check dd if=/dev/zero bs=1M count=32 of=$f1 status=none + atf_check truncate -s 32M $f2 + + md1=$(attach_md -t vnode -f ${f1}) + md2=$(attach_md -t vnode -f ${f2}) + + atf_check gmirror label $name $md1 + devwait + + atf_check -s exit:0 -e empty -o not-empty sysctl ${REG_READ_FP}='1*return(5)' + + # If a read error occurs while synchronizing and the mirror contains + # a single active disk, gmirror has no choice but to fail the + # synchronization and kick the new disk out of the mirror. + atf_check gmirror insert $name $md2 + sleep 0.1 + syncwait + atf_check [ $(gmirror status -s $name | wc -l) -eq 1 ] + atf_check -s exit:0 -o match:"DEGRADED $md1 \(ACTIVE\)" \ + gmirror status -s $name +} +sync_read_error_2_disks_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + + atf_check -s exit:0 -e empty -o not-empty sysctl ${REG_READ_FP}='off' + gmirror_test_cleanup +} + +atf_test_case sync_read_error_3_disks cleanup +sync_read_error_3_disks_head() +{ + atf_set "descr" \ + "Ensure that we properly handle read errors during synchronization." + atf_set "require.user" "root" +} +sync_read_error_3_disks_body() +{ + . $(atf_get_srcdir)/conf.sh + + f1=$(mktemp ${base}.XXXXXX) + f2=$(mktemp ${base}.XXXXXX) + f3=$(mktemp ${base}.XXXXXX) + + atf_check dd if=/dev/random bs=1M count=32 of=$f1 status=none + atf_check truncate -s 32M $f2 + atf_check truncate -s 32M $f3 + + md1=$(attach_md -t vnode -f ${f1}) + md2=$(attach_md -t vnode -f ${f2}) + md3=$(attach_md -t vnode -f ${f3}) + + atf_check gmirror label $name $md1 + devwait + + atf_check gmirror insert $name $md2 + syncwait + + atf_check -s exit:0 -e empty -o not-empty sysctl ${REG_READ_FP}='1*return(5)' + + # If a read error occurs while synchronizing a new disk, and we have + # multiple active disks, we retry the read after an error. The disk + # which returned the read error is kicked out of the mirror. + atf_check gmirror insert $name $md3 + syncwait + atf_check [ $(gmirror status -s $name | wc -l) -eq 2 ] + atf_check -s exit:0 -o match:"DEGRADED $md3 \(ACTIVE\)" \ + gmirror status -s $name + + # Make sure that the two active disks are identical. Destroy the + # mirror first so that the metadata sectors are wiped. + if $(gmirror status -s $name | grep -q $md1); then + active=$md1 + else + active=$md2 + fi + atf_check gmirror destroy $name + atf_check cmp /dev/$active /dev/$md3 +} +sync_read_error_3_disks_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + + atf_check -s exit:0 -e empty -o not-empty sysctl ${REG_READ_FP}='off' + gmirror_test_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case sync_read_error_2_disks + atf_add_test_case sync_read_error_3_disks +} From owner-svn-src-head@freebsd.org Wed Jan 10 19:45:39 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59802E72729; Wed, 10 Jan 2018 19:45:39 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 353B5680AE; Wed, 10 Jan 2018 19:45:39 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72951212B; Wed, 10 Jan 2018 19:45:38 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AJjcdX081889; Wed, 10 Jan 2018 19:45:38 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AJjc7C081888; Wed, 10 Jan 2018 19:45:38 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801101945.w0AJjc7C081888@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 10 Jan 2018 19:45:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327781 - head/sys/ufs/ufs X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/sys/ufs/ufs X-SVN-Commit-Revision: 327781 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 19:45:39 -0000 Author: pfg Date: Wed Jan 10 19:45:38 2018 New Revision: 327781 URL: https://svnweb.freebsd.org/changeset/base/327781 Log: Use mallocarray(9) in dirhash. Basic use of mallocarray to prevent overflows. Here allocation is done with M_NOWAIT so the code is prepared for the possibility of returning NULL values. Since mallocarray expects unsigned parameters, unsign some related variables to minimize sign conversions. Reviewed by: mckusick Modified: head/sys/ufs/ufs/ufs_dirhash.c Modified: head/sys/ufs/ufs/ufs_dirhash.c ============================================================================== --- head/sys/ufs/ufs/ufs_dirhash.c Wed Jan 10 19:41:05 2018 (r327780) +++ head/sys/ufs/ufs/ufs_dirhash.c Wed Jan 10 19:45:38 2018 (r327781) @@ -349,7 +349,8 @@ ufsdirhash_build(struct inode *ip) struct direct *ep; struct vnode *vp; doff_t bmask, pos; - int dirblocks, i, j, memreqd, nblocks, narrays, nslots, slot; + int j, memreqd, slot; + u_int dirblocks, i, nblocks, narrays, nslots; /* Take care of a decreased sysctl value. */ while (ufs_dirhashmem > ufs_dirhashmaxmem) { @@ -415,11 +416,11 @@ ufsdirhash_build(struct inode *ip) * Use non-blocking mallocs so that we will revert to a linear * lookup on failure rather than potentially blocking forever. */ - dh->dh_hash = malloc(narrays * sizeof(dh->dh_hash[0]), + dh->dh_hash = mallocarray(narrays, sizeof(dh->dh_hash[0]), M_DIRHASH, M_NOWAIT | M_ZERO); if (dh->dh_hash == NULL) goto fail; - dh->dh_blkfree = malloc(nblocks * sizeof(dh->dh_blkfree[0]), + dh->dh_blkfree = mallocarray(nblocks, sizeof(dh->dh_blkfree[0]), M_DIRHASH, M_NOWAIT); if (dh->dh_blkfree == NULL) goto fail; From owner-svn-src-head@freebsd.org Wed Jan 10 20:05:21 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1766EE73A4F; Wed, 10 Jan 2018 20:05:21 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E789869298; Wed, 10 Jan 2018 20:05:20 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BDC5246C; Wed, 10 Jan 2018 20:05:20 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AK5Kcm091358; Wed, 10 Jan 2018 20:05:20 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AK5JRv091356; Wed, 10 Jan 2018 20:05:19 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801102005.w0AK5JRv091356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 10 Jan 2018 20:05:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327782 - head/sys/dev/bxe X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/sys/dev/bxe X-SVN-Commit-Revision: 327782 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 20:05:21 -0000 Author: pfg Date: Wed Jan 10 20:05:19 2018 New Revision: 327782 URL: https://svnweb.freebsd.org/changeset/base/327782 Log: dev/bxe: make use of mallocarray(9). Use mallocarray in a couple of cases where a calloc-like operation is taking place. Modified: head/sys/dev/bxe/bxe.c head/sys/dev/bxe/ecore_sp.h Modified: head/sys/dev/bxe/bxe.c ============================================================================== --- head/sys/dev/bxe/bxe.c Wed Jan 10 19:45:38 2018 (r327781) +++ head/sys/dev/bxe/bxe.c Wed Jan 10 20:05:19 2018 (r327782) @@ -12018,7 +12018,8 @@ bxe_set_mc_list(struct bxe_softc *sc) } bzero(mta, (sizeof(unsigned char) * ETHER_ADDR_LEN * mc_count)); - mc_mac = malloc(sizeof(*mc_mac) * mc_count, M_DEVBUF, (M_NOWAIT | M_ZERO)); + mc_mac = mallocarray(mc_count, sizeof(*mc_mac), M_DEVBUF, + (M_NOWAIT | M_ZERO)); mc_mac_start = mc_mac; if (!mc_mac) { Modified: head/sys/dev/bxe/ecore_sp.h ============================================================================== --- head/sys/dev/bxe/ecore_sp.h Wed Jan 10 19:45:38 2018 (r327781) +++ head/sys/dev/bxe/ecore_sp.h Wed Jan 10 20:05:19 2018 (r327782) @@ -159,7 +159,7 @@ typedef struct mtx ECORE_MUTEX_SPIN; malloc(_size, M_TEMP, (M_NOWAIT | M_ZERO)) #define ECORE_CALLOC(_len, _size, _flags, _sc) \ - malloc(_len * _size, M_TEMP, (M_NOWAIT | M_ZERO)) + mallocarray(_len, _size, M_TEMP, (M_NOWAIT | M_ZERO)) #define ECORE_FREE(_s, _buf, _size) free(_buf, M_TEMP) From owner-svn-src-head@freebsd.org Wed Jan 10 20:24:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A2FEE748D5; Wed, 10 Jan 2018 20:24:47 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk0-x22e.google.com (mail-qk0-x22e.google.com [IPv6:2607:f8b0:400d:c09::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 128A16A362; Wed, 10 Jan 2018 20:24:47 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk0-x22e.google.com with SMTP id b76so731634qkc.1; Wed, 10 Jan 2018 12:24:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=VGvx1XGNiffxY602nqDUfObLUT3uUo9jL6Kfos3bBks=; b=EdkIivCh9xqp072ELJWTmfhWOgzbsb87Jv915yjzaGuWU8AQAlxJi3+eC84pjWZ1Ys URCATvIdPMbvHyFCXk8x88RGNRaTQiJk3D4uEO/4N/Vv8ek3KUUX+ECWCcwLn9Zrj1g7 GILv07+KUvxlZzmPWK7/DNLx9mLCRfWpR8GaNDxfIek/6072j5Teh8oGPkSpLIzd+Whe DKKJGSz+8dSMtt4Ay87YlM3/B5Gi2/hy1cu1ufNaP43QQRzYE4y1zGJzLJF4tl0n45vP c9m0gWpTHzDu3MuNDTNP8AiEJ7TMX/twqRQtjzQMvE8gwFchSRfm7vw55dFjBcsUFrca pR9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=VGvx1XGNiffxY602nqDUfObLUT3uUo9jL6Kfos3bBks=; b=cvEiAW0L8JzqO1TlfO6inNn/lLGYhUepXVyJNtcfGw3DE+UFP6NpFjDkT/AD3KUCwJ t4mmgJtEsL66AEylEbMFKw2/5tg2UmgVuIpmov5JNRAscH4suYzTLj6pxJRjke2h3T+u ItBAzBmSEoju6jY8tXSdv/J0rPtnK+6ytXFR1IzkD+5fS40D38MbkpNJVIu1tmfk1JO1 nATm2A7xLjv3AS2HiSjAFyfMNPovEqpSJojn7PI8kW+qfw3M0+8qpACGFCxTUuJ9EWvC 4bAo/ztgE9hDjF4vPfNrWZnazd3PIGOZ+6dQg8eOMsqlIj9NeTyEhAR3ClUlsDL1z2VN t+kg== X-Gm-Message-State: AKwxytfMnzLXH/M6SX/f6HtgglgtyXS4xkGifU4zw/UyrsYwGPE/iVff 9EXIACDpTVXb3O2IRXNZt4E7sw== X-Google-Smtp-Source: ACJfBotP+tj+YC3GE2Vaw7P+KiT+Lm7fApKFWXTJI2xATmPOHYTw8rAVQrtbjHjbkTKXQ0yFZX2qVQ== X-Received: by 10.237.62.205 with SMTP id o13mr4264308qtf.316.1515615885681; Wed, 10 Jan 2018 12:24:45 -0800 (PST) Received: from raichu (toroon0560w-lp140-02-70-49-169-112.dsl.bell.ca. [70.49.169.112]) by smtp.gmail.com with ESMTPSA id h55sm11376753qta.75.2018.01.10.12.24.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jan 2018 12:24:44 -0800 (PST) Sender: Mark Johnston Date: Wed, 10 Jan 2018 15:24:42 -0500 From: Mark Johnston To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r326964 - head/sys/cam Message-ID: <20180110202442.GC78524@raichu> References: <201712190413.vBJ4DMY9090982@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201712190413.vBJ4DMY9090982@repo.freebsd.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 20:24:47 -0000 On Tue, Dec 19, 2017 at 04:13:22AM +0000, Warner Losh wrote: > Author: imp > Date: Tue Dec 19 04:13:22 2017 > New Revision: 326964 > URL: https://svnweb.freebsd.org/changeset/base/326964 > > Log: > When doing a dump, the scheduler is normally not running, so this > changed worked to capture dumps for me. However, the test for > SCHEDULER_STOPPED() isn't right. We can also call the dump routine > from ddb, in which case the scheduler is still running. This leads to > an assertion panic that we're sleeping when we shouldn't. Instead, use > the proper test for dumping or not. This brings us in line with other > places that do special things while we're doing polled I/O like this. > > Noticed by: pho@ > Differential Revision: https://reviews.freebsd.org/D13531 > > Modified: > head/sys/cam/cam_periph.c > > Modified: head/sys/cam/cam_periph.c > ============================================================================== > --- head/sys/cam/cam_periph.c Tue Dec 19 04:06:07 2017 (r326963) > +++ head/sys/cam/cam_periph.c Tue Dec 19 04:13:22 2017 (r326964) > @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > #include > @@ -1158,7 +1159,7 @@ cam_periph_runccb(union ccb *ccb, > struct bintime *starttime; > struct bintime ltime; > int error; > - bool sched_stopped; > + bool must_poll; > struct mtx *periph_mtx; > struct cam_periph *periph; > uint32_t timeout = 1; > @@ -1182,7 +1183,13 @@ cam_periph_runccb(union ccb *ccb, > devstat_start_transaction(ds, starttime); > } > > - sched_stopped = SCHEDULER_STOPPED(); > + /* > + * We must poll the I/O while we're dumping. The scheduler is normally > + * stopped for dumping, except when we call doadump from ddb. While the > + * scheduler is running in this case, we still need to poll the I/O to > + * avoid sleeping waiting for the ccb to complete. > + */ > + must_poll = dumping; Hmm, unfortunately this introduces a new problem: after a panic we call adashutdown() as part of the shutdown_post_sync event. This occurs before we call doadump(), so dumping == 0 and we don't poll for the spindown command's completion. But since we've panicked, the scheduler is stopped, and so we just hang. From owner-svn-src-head@freebsd.org Wed Jan 10 20:28:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B65DCE74B29; Wed, 10 Jan 2018 20:28:02 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 90BC26A560; Wed, 10 Jan 2018 20:28:02 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CDB0627C8; Wed, 10 Jan 2018 20:28:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AKS17w000455; Wed, 10 Jan 2018 20:28:01 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AKS1UA000454; Wed, 10 Jan 2018 20:28:01 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801102028.w0AKS1UA000454@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 10 Jan 2018 20:28:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327783 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 327783 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 20:28:02 -0000 Author: emaste Date: Wed Jan 10 20:28:01 2018 New Revision: 327783 URL: https://svnweb.freebsd.org/changeset/base/327783 Log: Enable ld.lld as bootstrap linker by default on amd64 For some time we have been planning to migrate to LLVM's lld linker. Having a man page was the last blocking issue for using ld.lld to link the base system kernel + userland, now addressed by r327770. Link the kernel and userland libraries and binaries with ld.lld by default, for additional test coverage. This has been a long time in the making. On 2013-04-13 I submitted an upstream tracking issue in LLVM PR 23214: [META] Using LLD as FreeBSD's system linker. Since then 85 individual issues were identified, and submitted as dependencies. These have been addressed along with two and a half years of other lld development and improvement. I'd like to express deep gratitude to upstream lld developers Rui Ueyama, Rafael Espindola, George Rimar and Davide Italiano. They put in substantial effort in addressing the issues we found affecting FreeBSD/amd64. To revert to using ld.bfd as the bootstrap linker, in /etc/src.conf set WITHOUT_LLD_BOOTSTRAP=yes If you need to set this, please follow up with a PR or post to the freebsd-toolchain mailing list explaining how default WITH_LLD_BOOTSTRAP failed for your use case. Note that GNU ld.bfd is still installed as /usr/bin/ld, and will still be used for linking ports. ld.lld can be installed as /usr/bin/ld by setting in /etc/src.conf WITH_LLD_IS_LLD=yes A followup commit will set WITH_LLD_IS_LD by default, possibly after Clang/LLVM/lld 6.0 is merged to FreeBSD. Release notes: Yes Sponsored by: The FreeBSD Foundation Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Wed Jan 10 20:05:19 2018 (r327782) +++ head/share/mk/src.opts.mk Wed Jan 10 20:28:01 2018 (r327783) @@ -253,6 +253,9 @@ __DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND .endif .if ${__T} == "aarch64" __DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD +.elif ${__T} == "amd64" +__DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP +__DEFAULT_NO_OPTIONS+=LLD_IS_LD .else __DEFAULT_NO_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD .endif From owner-svn-src-head@freebsd.org Wed Jan 10 20:32:31 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0345DE7508F for ; Wed, 10 Jan 2018 20:32:31 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22f.google.com (mail-it0-x22f.google.com [IPv6:2607:f8b0:4001:c0b::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BBCF76ABF2 for ; Wed, 10 Jan 2018 20:32:30 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22f.google.com with SMTP id u62so919152ita.2 for ; Wed, 10 Jan 2018 12:32:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=QLeTXcaKlmlKRqZoTO2AiryDYTCXIynLq4E2RfEHrV0=; b=UHNqCHgFHegghKqKZgh8rdK5yELtIbNMRUvoGv3vff46hPfjPyIcEaLoe3k9vcOx1M z99k05i+45P9bt04N4z64UxX4gi0L76cipzOqMWKdkgnWyxdJGFIyizw5wUNpxn+Rir7 XqLR3CK36e375p2dyd+DhyC5Fi7rlXxeeSBFx1+E4Iezrnboxj0O61+A0m5deJiVHTJv UtdyNXEFTLUSWjaJVYKZdeCyNHsNfDLIQJGPQvjnmoxAaYokBut3NfdoJchhhFT5hpvs TM4X1yRyOyS1Ci1h6cVQNEZDyWWAia3SzKTXvjHjhh/o/5rqzXa8JAdZHf7UGgcYPkq1 K/Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=QLeTXcaKlmlKRqZoTO2AiryDYTCXIynLq4E2RfEHrV0=; b=RrB3jZgID3yJiwjWf3z9B9o7Q1YJufRd6PIiYOO3FGZL3ifcNqqkZQhGOIot0QxA5G mAhWMLE+MC2oR43w+gm/A19lmdV/rr05kTzsZ7qG6SIQJwWm+QxEFS1onSNEtpWtaNFM pXD8h6ug4n2r2aYIyh0cUxJ9AMI0DC6QF2Ze//3UItKLVuMpj1DcICZD3LLIFaK7c4YL uTvzIBJJsgcYP9gFyVknBl+FEaItq9TkUdpyuNhYb4js3Y/Q3eiD/0k5ynO/kcXco3KJ EbmuLhLKWESbvKCadWpglYfgJ7yfpOWhWZ3PqKuLLK8lZErjboUfdZK6o38Gadyj7wcy mDww== X-Gm-Message-State: AKwxytfmL3m6/3W+ZgmPqYWi75HWzmvPGTPkCMTBCq4mYAuYF9IxqCsp cd4QrzqLdIM7+kh1HK1+W3WipSyQxlW8Djp3aARYEw== X-Google-Smtp-Source: ACJfBosnAQpAdj8hJzTtXpodJH5lE6X9mKm59SnDlXPmLY8l86bxOFbgn6auDeUPNARkKaHt35PNxjOJENVk5hBe6Zc= X-Received: by 10.36.1.16 with SMTP id 16mr7357577itk.115.1515616350047; Wed, 10 Jan 2018 12:32:30 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.160.217 with HTTP; Wed, 10 Jan 2018 12:32:29 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20180110202442.GC78524@raichu> References: <201712190413.vBJ4DMY9090982@repo.freebsd.org> <20180110202442.GC78524@raichu> From: Warner Losh Date: Wed, 10 Jan 2018 13:32:29 -0700 X-Google-Sender-Auth: agO5VnT3ukwNwwvE3W1CcyLzM5w Message-ID: Subject: Re: svn commit: r326964 - head/sys/cam To: Mark Johnston Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 20:32:31 -0000 On Wed, Jan 10, 2018 at 1:24 PM, Mark Johnston wrote: > On Tue, Dec 19, 2017 at 04:13:22AM +0000, Warner Losh wrote: > > Author: imp > > Date: Tue Dec 19 04:13:22 2017 > > New Revision: 326964 > > URL: https://svnweb.freebsd.org/changeset/base/326964 > > > > Log: > > When doing a dump, the scheduler is normally not running, so this > > changed worked to capture dumps for me. However, the test for > > SCHEDULER_STOPPED() isn't right. We can also call the dump routine > > from ddb, in which case the scheduler is still running. This leads to > > an assertion panic that we're sleeping when we shouldn't. Instead, use > > the proper test for dumping or not. This brings us in line with other > > places that do special things while we're doing polled I/O like this. > > > > Noticed by: pho@ > > Differential Revision: https://reviews.freebsd.org/D13531 > > > > Modified: > > head/sys/cam/cam_periph.c > > > > Modified: head/sys/cam/cam_periph.c > > ============================================================ > ================== > > --- head/sys/cam/cam_periph.c Tue Dec 19 04:06:07 2017 (r326963) > > +++ head/sys/cam/cam_periph.c Tue Dec 19 04:13:22 2017 (r326964) > > @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -1158,7 +1159,7 @@ cam_periph_runccb(union ccb *ccb, > > struct bintime *starttime; > > struct bintime ltime; > > int error; > > - bool sched_stopped; > > + bool must_poll; > > struct mtx *periph_mtx; > > struct cam_periph *periph; > > uint32_t timeout = 1; > > @@ -1182,7 +1183,13 @@ cam_periph_runccb(union ccb *ccb, > > devstat_start_transaction(ds, starttime); > > } > > > > - sched_stopped = SCHEDULER_STOPPED(); > > + /* > > + * We must poll the I/O while we're dumping. The scheduler is > normally > > + * stopped for dumping, except when we call doadump from ddb. > While the > > + * scheduler is running in this case, we still need to poll the > I/O to > > + * avoid sleeping waiting for the ccb to complete. > > + */ > > + must_poll = dumping; > > Hmm, unfortunately this introduces a new problem: after a panic we call > adashutdown() as part of the shutdown_post_sync event. This occurs > before we call doadump(), so dumping == 0 and we don't poll for the > spindown command's completion. But since we've panicked, the scheduler > is stopped, and so we just hang. > So "dumping || SCHEDULER_STOPPED()" then is needed? Warner From owner-svn-src-head@freebsd.org Wed Jan 10 20:35:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF2F7E75605; Wed, 10 Jan 2018 20:35:19 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk0-x22b.google.com (mail-qk0-x22b.google.com [IPv6:2607:f8b0:400d:c09::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 869546AF1D; Wed, 10 Jan 2018 20:35:19 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk0-x22b.google.com with SMTP id w1so789229qka.2; Wed, 10 Jan 2018 12:35:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=6HOrR4qmfAakZ/7uWsrl1Qukt1zxw5O/8qjsnvuz+Bs=; b=g+HK7bjrrGWrc8iuQwpgspEKKboVIut7FsT2Ch8VJRaPWYjqntmjED6ylJJU3Cj8/Z sGfc+rz8UXD2tv92BVRmqgo32SmDwxTW8sVu2qpxPj2g1u0708MzHKM1bahbDNaLxiR1 8VxPfKgJk6BpkIyhlfmxidFXZDAT9A+8u+U7jI4m5tq1uWwhPKgRuD4A4yEHL7mlUv7/ tRDiDEUrv3jBSZs/IALjObVR6G9LC8yBB18qBE5/7tB40P2QEf6EExA0vz6xWW1WKPBr Mwaa2qtL1szjVFdOvWTzNltViljQ7wlhmogs8Waih1dV/8B2x2uAfHb4sj/JAHM5Gwzn 2SlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=6HOrR4qmfAakZ/7uWsrl1Qukt1zxw5O/8qjsnvuz+Bs=; b=PPF16l6bIM1ezVgJm3UCW4NbPX1Y94c/CAPbPgs3lIxdDPV089hkY2IKUBt0vQRFRo FHwE38AQ4f6XwnfBB0mbIS34nc1N4YMHpFDBoXYcF3a1D8BiOlOuX9BsreoIQNZHNo/z nLACoNK05rSwdB+u12wcdqe39SPjbkkelB6TkiEgCguDVQfz0AdHUIabmDyuZBDFjRi/ /JDC8BKlt3VduamgF0QpFM3Lh5S0LDwYLMaUNXB71+tBqXnpPiJr7i8y2iNSjP1fagff hjCdmMuPRw73Q7QqoQ+de3ug3KJNd6YEzdRoZ/I93quzX9cXYwzg+Hyd7PFF7sJh73eg GELQ== X-Gm-Message-State: AKGB3mKdsuEKmq0oc6smz92kdPR+Gkq953qDVfL/zw0/z2PuL5RdyKjO D4poysrrgqJd0OBK79nUEfFQcw== X-Google-Smtp-Source: ACJfBovwPVcokub9JpMkPWfKZiyCfCQfI+hSdDtOJsR6iSZy+FL/o5Misguf0IT3pXOxv4n2wHkq+g== X-Received: by 10.55.77.65 with SMTP id a62mr28256181qkb.249.1515616518335; Wed, 10 Jan 2018 12:35:18 -0800 (PST) Received: from raichu (toroon0560w-lp140-02-70-49-169-112.dsl.bell.ca. [70.49.169.112]) by smtp.gmail.com with ESMTPSA id w41sm11122582qtc.19.2018.01.10.12.35.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jan 2018 12:35:17 -0800 (PST) Sender: Mark Johnston Date: Wed, 10 Jan 2018 15:35:15 -0500 From: Mark Johnston To: Warner Losh Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r326964 - head/sys/cam Message-ID: <20180110203515.GD78524@raichu> References: <201712190413.vBJ4DMY9090982@repo.freebsd.org> <20180110202442.GC78524@raichu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 20:35:19 -0000 On Wed, Jan 10, 2018 at 01:32:29PM -0700, Warner Losh wrote: > On Wed, Jan 10, 2018 at 1:24 PM, Mark Johnston wrote: > > > On Tue, Dec 19, 2017 at 04:13:22AM +0000, Warner Losh wrote: > > > Author: imp > > > Date: Tue Dec 19 04:13:22 2017 > > > New Revision: 326964 > > > URL: https://svnweb.freebsd.org/changeset/base/326964 > > > > > > Log: > > > When doing a dump, the scheduler is normally not running, so this > > > changed worked to capture dumps for me. However, the test for > > > SCHEDULER_STOPPED() isn't right. We can also call the dump routine > > > from ddb, in which case the scheduler is still running. This leads to > > > an assertion panic that we're sleeping when we shouldn't. Instead, use > > > the proper test for dumping or not. This brings us in line with other > > > places that do special things while we're doing polled I/O like this. > > > > > > Noticed by: pho@ > > > Differential Revision: https://reviews.freebsd.org/D13531 > > > > > > Modified: > > > head/sys/cam/cam_periph.c > > > > > > Modified: head/sys/cam/cam_periph.c > > > ============================================================ > > ================== > > > --- head/sys/cam/cam_periph.c Tue Dec 19 04:06:07 2017 (r326963) > > > +++ head/sys/cam/cam_periph.c Tue Dec 19 04:13:22 2017 (r326964) > > > @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); > > > #include > > > #include > > > #include > > > +#include > > > #include > > > #include > > > #include > > > @@ -1158,7 +1159,7 @@ cam_periph_runccb(union ccb *ccb, > > > struct bintime *starttime; > > > struct bintime ltime; > > > int error; > > > - bool sched_stopped; > > > + bool must_poll; > > > struct mtx *periph_mtx; > > > struct cam_periph *periph; > > > uint32_t timeout = 1; > > > @@ -1182,7 +1183,13 @@ cam_periph_runccb(union ccb *ccb, > > > devstat_start_transaction(ds, starttime); > > > } > > > > > > - sched_stopped = SCHEDULER_STOPPED(); > > > + /* > > > + * We must poll the I/O while we're dumping. The scheduler is > > normally > > > + * stopped for dumping, except when we call doadump from ddb. > > While the > > > + * scheduler is running in this case, we still need to poll the > > I/O to > > > + * avoid sleeping waiting for the ccb to complete. > > > + */ > > > + must_poll = dumping; > > > > Hmm, unfortunately this introduces a new problem: after a panic we call > > adashutdown() as part of the shutdown_post_sync event. This occurs > > before we call doadump(), so dumping == 0 and we don't poll for the > > spindown command's completion. But since we've panicked, the scheduler > > is stopped, and so we just hang. > > > > So "dumping || SCHEDULER_STOPPED()" then is needed? It seems so, unfortunately. From owner-svn-src-head@freebsd.org Wed Jan 10 20:36:18 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A890E75704; Wed, 10 Jan 2018 20:36:18 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2FA9A6B098; Wed, 10 Jan 2018 20:36:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF0DA298E; Wed, 10 Jan 2018 20:36:16 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AKaGBg004643; Wed, 10 Jan 2018 20:36:16 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AKaG0m004642; Wed, 10 Jan 2018 20:36:16 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801102036.w0AKaG0m004642@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 10 Jan 2018 20:36:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327784 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 327784 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 20:36:18 -0000 Author: emaste Date: Wed Jan 10 20:36:16 2018 New Revision: 327784 URL: https://svnweb.freebsd.org/changeset/base/327784 Log: regen src.conf.5 after r327783, WITH_LLD_BOOTSTRAP default (I missed the Reviewed by and review link from r327783.) Reviewed by: brooks, dim, bapt Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D13827 Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Wed Jan 10 20:28:01 2018 (r327783) +++ head/share/man/man5/src.conf.5 Wed Jan 10 20:36:16 2018 (r327784) @@ -970,12 +970,12 @@ To be able to build the system, either Binutils or LLD enabled unless an alternate linker is provided via XLD. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. +arm/arm, arm/armeb, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. .It Va WITH_LLD_BOOTSTRAP Set to build the LLD linker during the bootstrap phase of the build. .Pp This is a default setting on -arm64/aarch64. +amd64/amd64 and arm64/aarch64. .It Va WITHOUT_LLD_IS_LD Set to use GNU binutils ld as the system linker, instead of LLVM's LLD. .Pp From owner-svn-src-head@freebsd.org Wed Jan 10 20:38:43 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91283E758CE for ; Wed, 10 Jan 2018 20:38:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x235.google.com (mail-io0-x235.google.com [IPv6:2607:f8b0:4001:c06::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 554A16B276 for ; Wed, 10 Jan 2018 20:38:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x235.google.com with SMTP id z130so821836ioe.13 for ; Wed, 10 Jan 2018 12:38:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=o+GxQjTiTgITleNCtYMx1lifaM3dDR5D7DFusdwSoMk=; b=EGFP+AmcC/ED63DZlgVspheANBjUNaEZxNvakr9uYA3F7KqKfFpK4YeYJPtFB+8Et1 p1n0NDM2fOoXZUNVSFEyhtluWq5uLJloEbb8ze8mULl1Z7+4irt+SoquEW9+MXxyqqwY wBukZ3n+A82kraCrjlAuAxMCxs0hcyPPaP/oJfkRf7VGLKnv0JM/SL77pPFdnuRYkNmT O64Vj37a8fEu+5/jYPhnPAndF+frGGhkePW0bxJ2HQVKBbnbQao832qOkc6o+gjVLD0s Z9wa9O0cx2JoEbhdPpJKmX/VWKIvlLraOs0lazcJBKscdyV8Pkz6h0IytKOdGAbgNUJu tYxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=o+GxQjTiTgITleNCtYMx1lifaM3dDR5D7DFusdwSoMk=; b=SQsNHsOpeXYjLrbXrwd6xh10W+cz3zkv3sg104Zy9CnFXV98O8Ze+IEPGB0f6RU/K7 l3ZjydcRLSQesPnegBlqRc71pSpMTvfpMwR7ti9HaW0qPDQJtl/ZGV3qYveE5fogczRj FFC4cn3FdOqGeoZWZTpPovymZFeopfevgtLrNQwOlTsBDS+5pwDH1UoKp1X1J2xySyc/ 8XkxVGKsX5xcZNc8mS3z9LnoFfqfyrYIxd+4NSxi5AC9z5tUaovZbJMztkGEOxybD0v0 /UiM5l3Ssdl1yV49qsTN6iwnaHjc/CO6Y30uEJ0kE5JCGkvi3jf0+bHsi3Ta3KZLOZ7y N3zA== X-Gm-Message-State: AKwxytfl0lP/Ym0HOTTqjZz7fyuwcONuDFYGf2bbh3QFy9pGyvWqYd9F /+8C1GW3sMiwaL8KFdPNiJ7ud/fhtX4sYy84Z0Hyyw== X-Google-Smtp-Source: ACJfBouoUN+nCz1vFsGuF16k6JneidFy5TaVvKa7bHPCFBnlWkyuGcwJnh8eGjS/RHj4DjHsSbuy04ClhbYpQ383e4Y= X-Received: by 10.107.78.12 with SMTP id c12mr18638544iob.63.1515616722417; Wed, 10 Jan 2018 12:38:42 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.160.217 with HTTP; Wed, 10 Jan 2018 12:38:41 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20180110203515.GD78524@raichu> References: <201712190413.vBJ4DMY9090982@repo.freebsd.org> <20180110202442.GC78524@raichu> <20180110203515.GD78524@raichu> From: Warner Losh Date: Wed, 10 Jan 2018 13:38:41 -0700 X-Google-Sender-Auth: OBqgHLB2JPLS9WkHQP1QHPnuj5M Message-ID: Subject: Re: svn commit: r326964 - head/sys/cam To: Mark Johnston Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 20:38:43 -0000 On Wed, Jan 10, 2018 at 1:35 PM, Mark Johnston wrote: > On Wed, Jan 10, 2018 at 01:32:29PM -0700, Warner Losh wrote: > > On Wed, Jan 10, 2018 at 1:24 PM, Mark Johnston > wrote: > > > > > On Tue, Dec 19, 2017 at 04:13:22AM +0000, Warner Losh wrote: > > > > Author: imp > > > > Date: Tue Dec 19 04:13:22 2017 > > > > New Revision: 326964 > > > > URL: https://svnweb.freebsd.org/changeset/base/326964 > > > > > > > > Log: > > > > When doing a dump, the scheduler is normally not running, so this > > > > changed worked to capture dumps for me. However, the test for > > > > SCHEDULER_STOPPED() isn't right. We can also call the dump routine > > > > from ddb, in which case the scheduler is still running. This leads > to > > > > an assertion panic that we're sleeping when we shouldn't. Instead, > use > > > > the proper test for dumping or not. This brings us in line with > other > > > > places that do special things while we're doing polled I/O like > this. > > > > > > > > Noticed by: pho@ > > > > Differential Revision: https://reviews.freebsd.org/D13531 > > > > > > > > Modified: > > > > head/sys/cam/cam_periph.c > > > > > > > > Modified: head/sys/cam/cam_periph.c > > > > ============================================================ > > > ================== > > > > --- head/sys/cam/cam_periph.c Tue Dec 19 04:06:07 2017 > (r326963) > > > > +++ head/sys/cam/cam_periph.c Tue Dec 19 04:13:22 2017 > (r326964) > > > > @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); > > > > #include > > > > #include > > > > #include > > > > +#include > > > > #include > > > > #include > > > > #include > > > > @@ -1158,7 +1159,7 @@ cam_periph_runccb(union ccb *ccb, > > > > struct bintime *starttime; > > > > struct bintime ltime; > > > > int error; > > > > - bool sched_stopped; > > > > + bool must_poll; > > > > struct mtx *periph_mtx; > > > > struct cam_periph *periph; > > > > uint32_t timeout = 1; > > > > @@ -1182,7 +1183,13 @@ cam_periph_runccb(union ccb *ccb, > > > > devstat_start_transaction(ds, starttime); > > > > } > > > > > > > > - sched_stopped = SCHEDULER_STOPPED(); > > > > + /* > > > > + * We must poll the I/O while we're dumping. The scheduler is > > > normally > > > > + * stopped for dumping, except when we call doadump from ddb. > > > While the > > > > + * scheduler is running in this case, we still need to poll the > > > I/O to > > > > + * avoid sleeping waiting for the ccb to complete. > > > > + */ > > > > + must_poll = dumping; > > > > > > Hmm, unfortunately this introduces a new problem: after a panic we call > > > adashutdown() as part of the shutdown_post_sync event. This occurs > > > before we call doadump(), so dumping == 0 and we don't poll for the > > > spindown command's completion. But since we've panicked, the scheduler > > > is stopped, and so we just hang. > > > > > > > So "dumping || SCHEDULER_STOPPED()" then is needed? > > It seems so, unfortunately. > OK. Sounds good. I'll make the change today. From owner-svn-src-head@freebsd.org Wed Jan 10 20:49:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B44CE76158; Wed, 10 Jan 2018 20:49:02 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6788D6BB90; Wed, 10 Jan 2018 20:49:02 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A780F2B4D; Wed, 10 Jan 2018 20:49:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AKn1TV009057; Wed, 10 Jan 2018 20:49:01 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AKn1ce009056; Wed, 10 Jan 2018 20:49:01 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801102049.w0AKn1ce009056@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 10 Jan 2018 20:49:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327787 - head X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 327787 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 20:49:02 -0000 Author: emaste Date: Wed Jan 10 20:49:01 2018 New Revision: 327787 URL: https://svnweb.freebsd.org/changeset/base/327787 Log: Mention switch to ld.lld for amd64 in UPDATING Sponsored by: The FreeBSD Foundation Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Jan 10 20:48:21 2018 (r327786) +++ head/UPDATING Wed Jan 10 20:49:01 2018 (r327787) @@ -52,6 +52,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** 20180110: + LLVM's lld linker is now used as the FreeBSD/amd64 bootstrap linker. + This means it is used to link the kernel and userland libraries and + executables, but is not yet installed as /usr/bin/ld by default. + + To revert to ld.bfd as the bootstrap linker, in /etc/src.conf set + WITHOUT_LLD_BOOTSTRAP=yes + +20180110: On i386, pmtimer has been removed. It's functionality has been folded into apm. It was a nop on ACPI in current for a while now (but was still needed on i386 in FreeBSD 11 and earlier). Users may need to remove it From owner-svn-src-head@freebsd.org Wed Jan 10 20:50:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59E5EE7622A; Wed, 10 Jan 2018 20:50:07 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 34D566BD0C; Wed, 10 Jan 2018 20:50:07 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 761062B51; Wed, 10 Jan 2018 20:50:06 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AKo6ia009156; Wed, 10 Jan 2018 20:50:06 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AKo65b009155; Wed, 10 Jan 2018 20:50:06 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801102050.w0AKo65b009155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 10 Jan 2018 20:50:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327788 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 327788 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 20:50:07 -0000 Author: pfg Date: Wed Jan 10 20:50:06 2018 New Revision: 327788 URL: https://svnweb.freebsd.org/changeset/base/327788 Log: linuxkpi: Simplify kmalloc_array. kmalloc_array seems what we call mallocarray(9). Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/slab.h Wed Jan 10 20:49:01 2018 (r327787) +++ head/sys/compat/linuxkpi/common/include/linux/slab.h Wed Jan 10 20:50:06 2018 (r327788) @@ -121,9 +121,7 @@ vmalloc_32(size_t size) static inline void * kmalloc_array(size_t n, size_t size, gfp_t flags) { - if (size != 0 && n > (SIZE_MAX / size)) - return (NULL); - return (malloc(n * size, M_KMALLOC, linux_check_m_flags(flags))); + return (mallocarray(n, size, M_KMALLOC, linux_check_m_flags(flags))); } static inline void * From owner-svn-src-head@freebsd.org Wed Jan 10 21:08:45 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D183E770BF; Wed, 10 Jan 2018 21:08:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D4F076CA99; Wed, 10 Jan 2018 21:08:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3291A2EA8; Wed, 10 Jan 2018 21:08:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AL8huN017248; Wed, 10 Jan 2018 21:08:43 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AL8hm8017244; Wed, 10 Jan 2018 21:08:43 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801102108.w0AL8hm8017244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 10 Jan 2018 21:08:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327790 - head/sys/mips/mips X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/mips/mips X-SVN-Commit-Revision: 327790 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 21:08:45 -0000 Author: jhb Date: Wed Jan 10 21:08:43 2018 New Revision: 327790 URL: https://svnweb.freebsd.org/changeset/base/327790 Log: Set the 'FR' bit in the status register for N32 kernels. This permits N32 hard-float binaries to use 64-bit floating point registers (which is what N32 binaries expect) matching the N64 ABI. Reviewed by: imp, jmallett Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D13830 Modified: head/sys/mips/mips/exception.S head/sys/mips/mips/locore.S head/sys/mips/mips/swtch.S head/sys/mips/mips/trap.c Modified: head/sys/mips/mips/exception.S ============================================================================== --- head/sys/mips/mips/exception.S Wed Jan 10 21:05:46 2018 (r327789) +++ head/sys/mips/mips/exception.S Wed Jan 10 21:08:43 2018 (r327790) @@ -1110,7 +1110,7 @@ NESTED(MipsFPTrap, CALLFRAME_SIZ, ra) REG_S ra, CALLFRAME_RA(sp) .mask 0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ) -#if defined(__mips_n64) +#if defined(__mips_n32) || defined(__mips_n64) or t1, t0, MIPS_SR_COP_1_BIT | MIPS_SR_FR #else or t1, t0, MIPS_SR_COP_1_BIT Modified: head/sys/mips/mips/locore.S ============================================================================== --- head/sys/mips/mips/locore.S Wed Jan 10 21:05:46 2018 (r327789) +++ head/sys/mips/mips/locore.S Wed Jan 10 21:08:43 2018 (r327790) @@ -117,8 +117,11 @@ VECTOR(_locore, unknown) * Enable FPU */ li t1, MIPS_SR_COP_1_BIT +#if defined(__mips_n32) || defined(__mips_n64) + or t1, MIPS_SR_FR +#endif #ifdef __mips_n64 - or t1, MIPS_SR_KX | MIPS_SR_SX | MIPS_SR_UX | MIPS_SR_FR + or t1, MIPS_SR_KX | MIPS_SR_SX | MIPS_SR_UX #endif #endif /* Modified: head/sys/mips/mips/swtch.S ============================================================================== --- head/sys/mips/mips/swtch.S Wed Jan 10 21:05:46 2018 (r327789) +++ head/sys/mips/mips/swtch.S Wed Jan 10 21:08:43 2018 (r327790) @@ -416,7 +416,7 @@ LEAF(MipsSwitchFPState) .set hardfloat mfc0 t1, MIPS_COP_0_STATUS # Save old SR HAZARD_DELAY -#if defined(__mips_n64) +#if defined(__mips_n32) || defined(__mips_n64) or t0, t1, MIPS_SR_COP_1_BIT | MIPS_SR_FR # enable the coprocessor #else or t0, t1, MIPS_SR_COP_1_BIT # enable the coprocessor @@ -546,7 +546,7 @@ LEAF(MipsFPID) .set hardfloat mfc0 t1, MIPS_COP_0_STATUS # Save the status register. HAZARD_DELAY -#if defined(__mips_n64) +#if defined(__mips_n32) || defined(__mips_n64) or t0, t1, MIPS_SR_COP_1_BIT | MIPS_SR_FR #else or t0, t1, MIPS_SR_COP_1_BIT @@ -585,7 +585,7 @@ LEAF(MipsSaveCurFPState) PTR_L a0, TD_PCB(a0) # get pointer to pcb for thread mfc0 t1, MIPS_COP_0_STATUS # Disable interrupts and HAZARD_DELAY -#if defined(__mips_n64) +#if defined(__mips_n32) || defined(__mips_n64) or t0, t1, MIPS_SR_COP_1_BIT | MIPS_SR_FR # enable the coprocessor #else or t0, t1, MIPS_SR_COP_1_BIT # enable the coprocessor Modified: head/sys/mips/mips/trap.c ============================================================================== --- head/sys/mips/mips/trap.c Wed Jan 10 21:05:46 2018 (r327789) +++ head/sys/mips/mips/trap.c Wed Jan 10 21:08:43 2018 (r327790) @@ -983,7 +983,7 @@ dofault: addr = trapframe->pc; MipsSwitchFPState(PCPU_GET(fpcurthread), td->td_frame); PCPU_SET(fpcurthread, td); -#if defined(__mips_n64) +#if defined(__mips_n32) || defined(__mips_n64) td->td_frame->sr |= MIPS_SR_COP_1_BIT | MIPS_SR_FR; #else td->td_frame->sr |= MIPS_SR_COP_1_BIT; From owner-svn-src-head@freebsd.org Wed Jan 10 21:18:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC24DE7785C; Wed, 10 Jan 2018 21:18:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 873B96D262; Wed, 10 Jan 2018 21:18:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEF173045; Wed, 10 Jan 2018 21:18:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0ALIkUU021661; Wed, 10 Jan 2018 21:18:46 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0ALIkMi021660; Wed, 10 Jan 2018 21:18:46 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801102118.w0ALIkMi021660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 10 Jan 2018 21:18:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327792 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 327792 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 21:18:47 -0000 Author: jhb Date: Wed Jan 10 21:18:46 2018 New Revision: 327792 URL: https://svnweb.freebsd.org/changeset/base/327792 Log: Don't store shadow copies of per-process AIO limits. Previously the AIO subsystem would save a snapshot of the currently configured per-process limits the first time a process used AIO. The process would continue to use the snapshotted limits ignoring any changes to the global limits during the rest of its lifetime. This change removes the snapshotted values and changes the AIO code to always check the global values which can be toggled at runtime. This means an administrator can now change the effective limits of existing processes. This is more consistent with how other limits configured via sysctl work in FreeBSD. Reviewed by: asomers, kib MFC after: 2 weeks Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D13819 Modified: head/sys/kern/vfs_aio.c Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Wed Jan 10 21:17:33 2018 (r327791) +++ head/sys/kern/vfs_aio.c Wed Jan 10 21:18:46 2018 (r327792) @@ -166,16 +166,16 @@ SYSCTL_INT(_vfs_aio, OID_AUTO, aiod_lifetime, CTLFLAG_ static int max_aio_per_proc = MAX_AIO_PER_PROC; SYSCTL_INT(_vfs_aio, OID_AUTO, max_aio_per_proc, CTLFLAG_RW, &max_aio_per_proc, 0, - "Maximum active aio requests per process (stored in the process)"); + "Maximum active aio requests per process"); static int max_aio_queue_per_proc = MAX_AIO_QUEUE_PER_PROC; SYSCTL_INT(_vfs_aio, OID_AUTO, max_aio_queue_per_proc, CTLFLAG_RW, &max_aio_queue_per_proc, 0, - "Maximum queued aio requests per process (stored in the process)"); + "Maximum queued aio requests per process"); static int max_buf_aio = MAX_BUF_AIO; SYSCTL_INT(_vfs_aio, OID_AUTO, max_buf_aio, CTLFLAG_RW, &max_buf_aio, 0, - "Maximum buf aio requests per process (stored in the process)"); + "Maximum buf aio requests per process"); /* * Though redundant with vfs.aio.max_aio_queue_per_proc, POSIX requires @@ -268,11 +268,8 @@ struct aioliojob { struct kaioinfo { struct mtx kaio_mtx; /* the lock to protect this struct */ int kaio_flags; /* (a) per process kaio flags */ - int kaio_maxactive_count; /* (*) maximum number of AIOs */ int kaio_active_count; /* (c) number of currently used AIOs */ - int kaio_qallowed_count; /* (*) maxiumu size of AIO queue */ int kaio_count; /* (a) size of AIO queue */ - int kaio_ballowed_count; /* (*) maximum number of buffers */ int kaio_buffer_count; /* (a) number of physio buffers */ TAILQ_HEAD(,kaiocb) kaio_all; /* (a) all AIOs in a process */ TAILQ_HEAD(,kaiocb) kaio_done; /* (a) done queue for process */ @@ -445,11 +442,8 @@ aio_init_aioinfo(struct proc *p) ki = uma_zalloc(kaio_zone, M_WAITOK); mtx_init(&ki->kaio_mtx, "aiomtx", NULL, MTX_DEF | MTX_NEW); ki->kaio_flags = 0; - ki->kaio_maxactive_count = max_aio_per_proc; ki->kaio_active_count = 0; - ki->kaio_qallowed_count = max_aio_queue_per_proc; ki->kaio_count = 0; - ki->kaio_ballowed_count = max_buf_aio; ki->kaio_buffer_count = 0; TAILQ_INIT(&ki->kaio_all); TAILQ_INIT(&ki->kaio_done); @@ -708,7 +702,7 @@ restart: userp = job->userproc; ki = userp->p_aioinfo; - if (ki->kaio_active_count < ki->kaio_maxactive_count) { + if (ki->kaio_active_count < max_aio_per_proc) { TAILQ_REMOVE(&aio_jobs, job, list); if (!aio_clear_cancel_function(job)) goto restart; @@ -1270,7 +1264,7 @@ aio_qphysio(struct proc *p, struct kaiocb *job) error = -1; goto unref; } - if (ki->kaio_buffer_count >= ki->kaio_ballowed_count) { + if (ki->kaio_buffer_count >= max_buf_aio) { error = EAGAIN; goto unref; } @@ -1479,7 +1473,7 @@ aio_aqueue(struct thread *td, struct aiocb *ujob, stru ops->store_kernelinfo(ujob, -1); if (num_queue_count >= max_queue_count || - ki->kaio_count >= ki->kaio_qallowed_count) { + ki->kaio_count >= max_aio_queue_per_proc) { ops->store_error(ujob, EAGAIN); return (EAGAIN); } @@ -1774,8 +1768,7 @@ aio_kick_nowait(struct proc *userp) aiop->aioprocflags &= ~AIOP_FREE; wakeup(aiop->aioproc); } else if (num_aio_resv_start + num_aio_procs < max_aio_procs && - ki->kaio_active_count + num_aio_resv_start < - ki->kaio_maxactive_count) { + ki->kaio_active_count + num_aio_resv_start < max_aio_per_proc) { taskqueue_enqueue(taskqueue_aiod_kick, &ki->kaio_task); } } @@ -1794,8 +1787,7 @@ retryproc: aiop->aioprocflags &= ~AIOP_FREE; wakeup(aiop->aioproc); } else if (num_aio_resv_start + num_aio_procs < max_aio_procs && - ki->kaio_active_count + num_aio_resv_start < - ki->kaio_maxactive_count) { + ki->kaio_active_count + num_aio_resv_start < max_aio_per_proc) { num_aio_resv_start++; mtx_unlock(&aio_job_mtx); error = aio_newproc(&num_aio_resv_start); From owner-svn-src-head@freebsd.org Wed Jan 10 21:37:12 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 949E2E786FF; Wed, 10 Jan 2018 21:37:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6F5016E03A; Wed, 10 Jan 2018 21:37:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A650933BD; Wed, 10 Jan 2018 21:37:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0ALbBHr029985; Wed, 10 Jan 2018 21:37:11 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0ALbBUs029984; Wed, 10 Jan 2018 21:37:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201801102137.w0ALbBUs029984@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 10 Jan 2018 21:37:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327794 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Commit-Revision: 327794 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 21:37:12 -0000 Author: markj Date: Wed Jan 10 21:37:11 2018 New Revision: 327794 URL: https://svnweb.freebsd.org/changeset/base/327794 Log: Fix an off-by-one in dt_opt_setenv(). The bug would cause incorrect behaviour when attempting to override an already set environment variable with -x setenv, as long as the variable is not the last one in the array. Reported by: Samuel Lepetit MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c Wed Jan 10 21:24:03 2018 (r327793) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c Wed Jan 10 21:37:11 2018 (r327794) @@ -415,7 +415,7 @@ dt_opt_setenv(dtrace_hdl_t *dtp, const char *arg, uint { char **p; char *var; - int i; + int nvars; /* * We can't effectively set environment variables from #pragma lines @@ -430,7 +430,7 @@ dt_opt_setenv(dtrace_hdl_t *dtp, const char *arg, uint if (!option && strchr(arg, '=') != NULL) return (dt_set_errno(dtp, EDT_BADOPTVAL)); - for (i = 1, p = dtp->dt_proc_env; *p != NULL; i++, p++) + for (nvars = 0, p = dtp->dt_proc_env; *p != NULL; nvars++, p++) continue; for (p = dtp->dt_proc_env; *p != NULL; p++) { @@ -439,9 +439,9 @@ dt_opt_setenv(dtrace_hdl_t *dtp, const char *arg, uint var = *p + strlen(*p); if (strncmp(*p, arg, var - *p) == 0) { dt_free(dtp, *p); - *p = dtp->dt_proc_env[i - 1]; - dtp->dt_proc_env[i - 1] = NULL; - i--; + *p = dtp->dt_proc_env[nvars - 1]; + dtp->dt_proc_env[nvars - 1] = NULL; + nvars--; } } @@ -449,17 +449,18 @@ dt_opt_setenv(dtrace_hdl_t *dtp, const char *arg, uint if ((var = strdup(arg)) == NULL) return (dt_set_errno(dtp, EDT_NOMEM)); - if ((p = dt_alloc(dtp, sizeof (char *) * (i + 1))) == NULL) { + nvars++; + if ((p = dt_alloc(dtp, sizeof(char *) * (nvars + 1))) == NULL) { dt_free(dtp, var); return (dt_set_errno(dtp, EDT_NOMEM)); } - bcopy(dtp->dt_proc_env, p, sizeof (char *) * i); + bcopy(dtp->dt_proc_env, p, sizeof(char *) * nvars); dt_free(dtp, dtp->dt_proc_env); dtp->dt_proc_env = p; - dtp->dt_proc_env[i - 1] = var; - dtp->dt_proc_env[i] = NULL; + dtp->dt_proc_env[nvars - 1] = var; + dtp->dt_proc_env[nvars] = NULL; } return (0); From owner-svn-src-head@freebsd.org Wed Jan 10 21:40:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D702E78936; Wed, 10 Jan 2018 21:40:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C0AA66E23F; Wed, 10 Jan 2018 21:40:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BDDDB33C6; Wed, 10 Jan 2018 21:40:36 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0ALeaoR030150; Wed, 10 Jan 2018 21:40:36 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0ALeag8030147; Wed, 10 Jan 2018 21:40:36 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201801102140.w0ALeag8030147@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 10 Jan 2018 21:40:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327795 - in head/cddl: contrib/opensolaris/cmd/dtrace/test/tst/common/env usr.sbin/dtrace/tests/common/env X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/cddl: contrib/opensolaris/cmd/dtrace/test/tst/common/env usr.sbin/dtrace/tests/common/env X-SVN-Commit-Revision: 327795 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 21:40:38 -0000 Author: markj Date: Wed Jan 10 21:40:36 2018 New Revision: 327795 URL: https://svnweb.freebsd.org/changeset/base/327795 Log: Add a regression test for r327794. MFC after: 2 weeks Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/tst.setenv3.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/tst.setenv3.ksh.out Modified: head/cddl/usr.sbin/dtrace/tests/common/env/Makefile Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/tst.setenv3.ksh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/tst.setenv3.ksh Wed Jan 10 21:40:36 2018 (r327795) @@ -0,0 +1,34 @@ +# +# CDDL HEADER START +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# +# CDDL HEADER END +# + +# +# Copyright (c) 2012 by Delphix. All rights reserved. +# + +# +# Reset an environment variable we already know to be set. +# Regression test for FreeBSD r327794. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 + +$dtrace -q -Z -n doogle -xsetenv=PATH=/foo -c '/usr/bin/printenv PATH' + +exit $? Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/tst.setenv3.ksh.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/env/tst.setenv3.ksh.out Wed Jan 10 21:40:36 2018 (r327795) @@ -0,0 +1,2 @@ +/foo + Modified: head/cddl/usr.sbin/dtrace/tests/common/env/Makefile ============================================================================== --- head/cddl/usr.sbin/dtrace/tests/common/env/Makefile Wed Jan 10 21:37:11 2018 (r327794) +++ head/cddl/usr.sbin/dtrace/tests/common/env/Makefile Wed Jan 10 21:40:36 2018 (r327795) @@ -15,6 +15,8 @@ ${PACKAGE}FILES= \ tst.setenv1.ksh.out \ tst.setenv2.ksh \ tst.setenv2.ksh.out \ + tst.setenv3.ksh \ + tst.setenv3.ksh.out \ tst.unsetenv1.ksh \ tst.unsetenv1.ksh.out \ tst.unsetenv2.ksh \ From owner-svn-src-head@freebsd.org Wed Jan 10 21:49:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61693E7914A; Wed, 10 Jan 2018 21:49:47 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 21B4B6E940; Wed, 10 Jan 2018 21:49:47 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5EE7F38D4; Wed, 10 Jan 2018 21:49:46 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0ALnkTF034412; Wed, 10 Jan 2018 21:49:46 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0ALnjwa034409; Wed, 10 Jan 2018 21:49:45 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201801102149.w0ALnjwa034409@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 10 Jan 2018 21:49:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327796 - in head: share/man/man9 sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: share/man/man9 sys/kern sys/sys X-SVN-Commit-Revision: 327796 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 21:49:47 -0000 Author: cem Date: Wed Jan 10 21:49:45 2018 New Revision: 327796 URL: https://svnweb.freebsd.org/changeset/base/327796 Log: mallocarray(9): panic if the requested allocation would overflow Additionally, move the overflow check logic out to WOULD_OVERFLOW() for consumers to have a common means of testing for overflowing allocations. WOULD_OVERFLOW() should be a secondary check -- on 64-bit platforms, just because an allocation won't overflow size_t does not mean it is a sane size to request. Callers should be imposing reasonable allocation limits far, far, below overflow. Discussed with: emaste, jhb, kp Sponsored by: Dell EMC Isilon Modified: head/share/man/man9/malloc.9 head/sys/kern/kern_malloc.c head/sys/sys/malloc.h Modified: head/share/man/man9/malloc.9 ============================================================================== --- head/share/man/man9/malloc.9 Wed Jan 10 21:40:36 2018 (r327795) +++ head/share/man/man9/malloc.9 Wed Jan 10 21:49:45 2018 (r327796) @@ -29,7 +29,7 @@ .\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $ .\" $FreeBSD$ .\" -.Dd November 19, 2015 +.Dd January 10, 2018 .Dt MALLOC 9 .Os .Sh NAME @@ -154,6 +154,7 @@ If the request cannot be immediately fulfilled, the cu to sleep to wait for resources to be released by other processes. The .Fn malloc , +.Fn mallocarray , .Fn realloc , and .Fn reallocf @@ -162,15 +163,13 @@ functions cannot return if .Dv M_WAITOK is specified. -The -.Fn mallocarray -function can return -.Dv NULL if the multiplication of .Fa nmemb and .Fa size -would cause an integer overflow. +would cause an integer overflow, the +.Fn mallocarray +function induces a panic. .It Dv M_USE_RESERVE Indicates that the system can use its reserve of memory to satisfy the request. Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Wed Jan 10 21:40:36 2018 (r327795) +++ head/sys/kern/kern_malloc.c Wed Jan 10 21:49:45 2018 (r327796) @@ -535,18 +535,12 @@ malloc(unsigned long size, struct malloc_type *mtp, in return ((void *) va); } -/* - * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX - * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW - */ -#define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 8 / 2)) void * mallocarray(size_t nmemb, size_t size, struct malloc_type *type, int flags) { - if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && - nmemb > 0 && SIZE_MAX / nmemb < size) - return (NULL); + if (WOULD_OVERFLOW(nmemb, size)) + panic("mallocarray: %zu * %zu overflowed", nmemb, size); return (malloc(size * nmemb, type, flags)); } Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Wed Jan 10 21:40:36 2018 (r327795) +++ head/sys/sys/malloc.h Wed Jan 10 21:49:45 2018 (r327796) @@ -41,6 +41,7 @@ #include #include #include +#include #define MINALLOCSIZE UMA_SMALLEST_UNIT @@ -192,6 +193,20 @@ void *reallocf(void *addr, unsigned long size, struct int flags) __result_use_check __alloc_size(2); struct malloc_type *malloc_desc2type(const char *desc); + +/* + * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX + * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW + */ +#define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 8 / 2)) +static inline bool +WOULD_OVERFLOW(size_t nmemb, size_t size) +{ + + return ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && + nmemb > 0 && __SIZE_T_MAX / nmemb < size); +} +#undef MUL_NO_OVERFLOW #endif /* _KERNEL */ #endif /* !_SYS_MALLOC_H_ */ From owner-svn-src-head@freebsd.org Wed Jan 10 22:19:13 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69C0CE7A52F; Wed, 10 Jan 2018 22:19:13 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 441A26FC78; Wed, 10 Jan 2018 22:19:13 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C85C3EF6; Wed, 10 Jan 2018 22:19:12 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AMJCb9046924; Wed, 10 Jan 2018 22:19:12 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AMJC8L046922; Wed, 10 Jan 2018 22:19:12 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201801102219.w0AMJC8L046922@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Wed, 10 Jan 2018 22:19:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327798 - head/sys/powerpc/powermac X-SVN-Group: head X-SVN-Commit-Author: landonf X-SVN-Commit-Paths: head/sys/powerpc/powermac X-SVN-Commit-Revision: 327798 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 22:19:13 -0000 Author: landonf Date: Wed Jan 10 22:19:11 2018 New Revision: 327798 URL: https://svnweb.freebsd.org/changeset/base/327798 Log: Fix minor locking issues in the Power Mac Uninorth PCI bridge driver. - Call resource_int_value() once during attach, rather than within the pci_(read|write)_config() code path; this avoids taking a blocking mutex to read kenv variables. - Use a spin lock to protect non-atomic config space accesses; this matches the behavior of Darwin's AppleMacRiscPCI driver. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D13839 Modified: head/sys/powerpc/powermac/uninorthpci.c head/sys/powerpc/powermac/uninorthvar.h Modified: head/sys/powerpc/powermac/uninorthpci.c ============================================================================== --- head/sys/powerpc/powermac/uninorthpci.c Wed Jan 10 21:59:21 2018 (r327797) +++ head/sys/powerpc/powermac/uninorthpci.c Wed Jan 10 22:19:11 2018 (r327798) @@ -34,6 +34,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -134,13 +136,17 @@ uninorth_attach(device_t dev) { struct uninorth_softc *sc; const char *compatible; + const char *name; phandle_t node; uint32_t reg[3]; uint64_t regbase; cell_t acells; + int unit; node = ofw_bus_get_node(dev); sc = device_get_softc(dev); + name = device_get_name(dev); + unit = device_get_unit(dev); if (OF_getprop(node, "reg", reg, sizeof(reg)) < 8) return (ENXIO); @@ -164,6 +170,11 @@ uninorth_attach(device_t dev) sc->sc_addr = (vm_offset_t)pmap_mapdev(regbase + 0x800000, PAGE_SIZE); sc->sc_data = (vm_offset_t)pmap_mapdev(regbase + 0xc00000, PAGE_SIZE); + if (resource_int_value(name, unit, "skipslot", &sc->sc_skipslot) != 0) + sc->sc_skipslot = -1; + + mtx_init(&sc->sc_cfg_mtx, "uninorth pcicfg", NULL, MTX_SPIN); + return (ofw_pci_attach(dev)); } @@ -173,25 +184,29 @@ uninorth_read_config(device_t dev, u_int bus, u_int sl { struct uninorth_softc *sc; vm_offset_t caoff; + u_int32_t val; sc = device_get_softc(dev); caoff = sc->sc_data + (reg & 0x07); + val = 0xffffffff; + mtx_lock_spin(&sc->sc_cfg_mtx); if (uninorth_enable_config(sc, bus, slot, func, reg) != 0) { switch (width) { case 1: - return (in8rb(caoff)); + val = in8rb(caoff); break; case 2: - return (in16rb(caoff)); + val = in16rb(caoff); break; case 4: - return (in32rb(caoff)); + val = in32rb(caoff); break; } } + mtx_unlock_spin(&sc->sc_cfg_mtx); - return (0xffffffff); + return (val); } static void @@ -204,6 +219,7 @@ uninorth_write_config(device_t dev, u_int bus, u_int s sc = device_get_softc(dev); caoff = sc->sc_data + (reg & 0x07); + mtx_lock_spin(&sc->sc_cfg_mtx); if (uninorth_enable_config(sc, bus, slot, func, reg)) { switch (width) { case 1: @@ -217,6 +233,7 @@ uninorth_write_config(device_t dev, u_int bus, u_int s break; } } + mtx_unlock_spin(&sc->sc_cfg_mtx); } static int @@ -224,13 +241,11 @@ uninorth_enable_config(struct uninorth_softc *sc, u_in u_int func, u_int reg) { uint32_t cfgval; - uint32_t pass; - if (resource_int_value(device_get_name(sc->pci_sc.sc_dev), - device_get_unit(sc->pci_sc.sc_dev), "skipslot", &pass) == 0) { - if (pass == slot) - return (0); - } + mtx_assert(&sc->sc_cfg_mtx, MA_OWNED); + + if (sc->sc_skipslot == slot) + return (0); /* * Issue type 0 configuration space accesses for the root bus. Modified: head/sys/powerpc/powermac/uninorthvar.h ============================================================================== --- head/sys/powerpc/powermac/uninorthvar.h Wed Jan 10 21:59:21 2018 (r327797) +++ head/sys/powerpc/powermac/uninorthvar.h Wed Jan 10 22:19:11 2018 (r327798) @@ -39,6 +39,8 @@ struct uninorth_softc { vm_offset_t sc_addr; vm_offset_t sc_data; int sc_ver; + int sc_skipslot; + struct mtx sc_cfg_mtx; }; struct unin_chip_softc { From owner-svn-src-head@freebsd.org Wed Jan 10 22:20:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17C1CE7A6B5; Wed, 10 Jan 2018 22:20:51 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E80416FF77; Wed, 10 Jan 2018 22:20:50 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C1943F17; Wed, 10 Jan 2018 22:20:50 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AMKoEs047821; Wed, 10 Jan 2018 22:20:50 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AMKoLC047797; Wed, 10 Jan 2018 22:20:50 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201801102220.w0AMKoLC047797@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 10 Jan 2018 22:20:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327800 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 327800 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 22:20:51 -0000 Author: cem Date: Wed Jan 10 22:20:49 2018 New Revision: 327800 URL: https://svnweb.freebsd.org/changeset/base/327800 Log: malloc.9: Fix minor typo from rewording in r327796 Sponsored by: Dell EMC Isilon Modified: head/share/man/man9/malloc.9 Modified: head/share/man/man9/malloc.9 ============================================================================== --- head/share/man/man9/malloc.9 Wed Jan 10 22:19:23 2018 (r327799) +++ head/share/man/man9/malloc.9 Wed Jan 10 22:20:49 2018 (r327800) @@ -163,7 +163,7 @@ functions cannot return if .Dv M_WAITOK is specified. -if the multiplication of +If the multiplication of .Fa nmemb and .Fa size From owner-svn-src-head@freebsd.org Wed Jan 10 22:41:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B650E7B365; Wed, 10 Jan 2018 22:41:02 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DA67A70C8A; Wed, 10 Jan 2018 22:41:01 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 273FD42D2; Wed, 10 Jan 2018 22:41:01 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0AMf0U3055831; Wed, 10 Jan 2018 22:41:00 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0AMf0Xc055829; Wed, 10 Jan 2018 22:41:00 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201801102241.w0AMf0Xc055829@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 10 Jan 2018 22:41:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327801 - in head/sys: amd64/amd64 i386/i386 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 327801 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 22:41:02 -0000 Author: cem Date: Wed Jan 10 22:41:00 2018 New Revision: 327801 URL: https://svnweb.freebsd.org/changeset/base/327801 Log: x86: Document purpose of _safe variants of {rd,wr}msr() Sponsored by: Dell EMC Isilon Modified: head/sys/amd64/amd64/support.S head/sys/i386/i386/support.s Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Wed Jan 10 22:20:49 2018 (r327800) +++ head/sys/amd64/amd64/support.S Wed Jan 10 22:41:00 2018 (r327801) @@ -763,7 +763,8 @@ ENTRY(longjmp) END(longjmp) /* - * Support for reading MSRs in the safe manner. + * Support for reading MSRs in the safe manner. (Instead of panic on #gp, + * return an error.) */ ENTRY(rdmsr_safe) /* int rdmsr_safe(u_int msr, uint64_t *data) */ @@ -783,7 +784,8 @@ ENTRY(rdmsr_safe) ret /* - * Support for writing MSRs in the safe manner. + * Support for writing MSRs in the safe manner. (Instead of panic on #gp, + * return an error.) */ ENTRY(wrmsr_safe) /* int wrmsr_safe(u_int msr, uint64_t data) */ Modified: head/sys/i386/i386/support.s ============================================================================== --- head/sys/i386/i386/support.s Wed Jan 10 22:20:49 2018 (r327800) +++ head/sys/i386/i386/support.s Wed Jan 10 22:41:00 2018 (r327801) @@ -790,7 +790,8 @@ ENTRY(longjmp) END(longjmp) /* - * Support for reading MSRs in the safe manner. + * Support for reading MSRs in the safe manner. (Instead of panic on #gp, + * return an error.) */ ENTRY(rdmsr_safe) /* int rdmsr_safe(u_int msr, uint64_t *data) */ @@ -810,7 +811,8 @@ ENTRY(rdmsr_safe) ret /* - * Support for writing MSRs in the safe manner. + * Support for writing MSRs in the safe manner. (Instead of panic on #gp, + * return an error.) */ ENTRY(wrmsr_safe) /* int wrmsr_safe(u_int msr, uint64_t data) */ From owner-svn-src-head@freebsd.org Wed Jan 10 23:15:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F681E7D009 for ; Wed, 10 Jan 2018 23:15:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E11147244F for ; Wed, 10 Jan 2018 23:15:55 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-wm0-x22d.google.com with SMTP id 141so1995395wme.3 for ; Wed, 10 Jan 2018 15:15:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=FIAMWdC0wvtcQyMSQ61FebtVcC32SrYSLEVK7fbhgIc=; b=T+ivfSG3ICxVilXqT/KdWSObmKD+UgZFGK8rDilZ7qV5FPFpOKQqwp9M29HxG7Ja63 bi7q51ty9U9F2rKT3lUMy6epYvrszjFjoz/N5Uj3AUY1AyD79ehf3UkjaNmpsCjg77EM XAzCgFT7Yh6sByg3lDBEAhKetcGRNd20zdz4y5z6ZCSm3Qw57L0+QE8+ATBJEIqfNrrW BVd1fhMDIR4judznXuLSiLmkxlq6h//nMSb8oVS1zDuPnqavFs0OdkX5msCAiju2+dMS yZ3S420jFEbz6+s+XDRAAwkW3qZ2b6khzyysSRJcYfcCAZss4eoezJ5iRzhhUh5oiBnZ J4UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=FIAMWdC0wvtcQyMSQ61FebtVcC32SrYSLEVK7fbhgIc=; b=aYOqEhD9tShd2jZY6IPLxuaPTbwkEKddhazMJjitFFWpaGy0nn/KnhGmYox6/Ulgc2 Opb+H7HSfU08zK23c7RvXgvErh55j+uqx5T3Dt8fvbypvQ9zlhT45iGPOfOA9JPwWqqG arua50ZvB1I39Mx9FR5XGgBIALsvll53tN96EjiWtZ7YezOyfUJD8qs223q0FkCbaPzP HMGV9LyEOMUpfs3YKnnpX0kUaZL0K42x02l3MW8Nhe5YqkZNUNA2MT9CK0kb5WvAWrGv fAiCv6Vv1zobeuZWFatBe3RdOjlB+Ao8Z0p/iARmSC/nfxyZP+pYIO+amKak410aruux eR1g== X-Gm-Message-State: AKGB3mISOYDpM+pNvs+sQxeuZOwuKroPhB9Ck8/545Y0pKpR0lq9f+wZ 9hLD4tjWzcBJDKhKy2R1/+0K6YePcWrDt4OG8ZyF7w== X-Google-Smtp-Source: ACJfBosyhcgLYqHxhhbVvUXLe7+sYC+R4drfecDC+s6lbDEmgLSo8/IA8Qo3soTGH4FMliLAV4jEYF9lw0zT+1sFuTk= X-Received: by 10.80.171.225 with SMTP id u88mr27582522edc.167.1515626153915; Wed, 10 Jan 2018 15:15:53 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.80.195.88 with HTTP; Wed, 10 Jan 2018 15:15:53 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: References: <201712190413.vBJ4DMY9090982@repo.freebsd.org> <20180110202442.GC78524@raichu> <20180110203515.GD78524@raichu> From: Warner Losh Date: Wed, 10 Jan 2018 16:15:53 -0700 X-Google-Sender-Auth: IBU_qxRbBjGJD-dLuEq6ASY_XL8 Message-ID: Subject: Re: svn commit: r326964 - head/sys/cam To: Mark Johnston Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 23:15:56 -0000 On Wed, Jan 10, 2018 at 1:38 PM, Warner Losh wrote: > > > On Wed, Jan 10, 2018 at 1:35 PM, Mark Johnston wrote: > >> On Wed, Jan 10, 2018 at 01:32:29PM -0700, Warner Losh wrote: >> > On Wed, Jan 10, 2018 at 1:24 PM, Mark Johnston >> wrote: >> > >> > > On Tue, Dec 19, 2017 at 04:13:22AM +0000, Warner Losh wrote: >> > > > Author: imp >> > > > Date: Tue Dec 19 04:13:22 2017 >> > > > New Revision: 326964 >> > > > URL: https://svnweb.freebsd.org/changeset/base/326964 >> > > > >> > > > Log: >> > > > When doing a dump, the scheduler is normally not running, so this >> > > > changed worked to capture dumps for me. However, the test for >> > > > SCHEDULER_STOPPED() isn't right. We can also call the dump routine >> > > > from ddb, in which case the scheduler is still running. This >> leads to >> > > > an assertion panic that we're sleeping when we shouldn't. >> Instead, use >> > > > the proper test for dumping or not. This brings us in line with >> other >> > > > places that do special things while we're doing polled I/O like >> this. >> > > > >> > > > Noticed by: pho@ >> > > > Differential Revision: https://reviews.freebsd.org/D13531 >> > > > >> > > > Modified: >> > > > head/sys/cam/cam_periph.c >> > > > >> > > > Modified: head/sys/cam/cam_periph.c >> > > > ============================================================ >> > > ================== >> > > > --- head/sys/cam/cam_periph.c Tue Dec 19 04:06:07 2017 >> (r326963) >> > > > +++ head/sys/cam/cam_periph.c Tue Dec 19 04:13:22 2017 >> (r326964) >> > > > @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); >> > > > #include >> > > > #include >> > > > #include >> > > > +#include >> > > > #include >> > > > #include >> > > > #include >> > > > @@ -1158,7 +1159,7 @@ cam_periph_runccb(union ccb *ccb, >> > > > struct bintime *starttime; >> > > > struct bintime ltime; >> > > > int error; >> > > > - bool sched_stopped; >> > > > + bool must_poll; >> > > > struct mtx *periph_mtx; >> > > > struct cam_periph *periph; >> > > > uint32_t timeout = 1; >> > > > @@ -1182,7 +1183,13 @@ cam_periph_runccb(union ccb *ccb, >> > > > devstat_start_transaction(ds, starttime); >> > > > } >> > > > >> > > > - sched_stopped = SCHEDULER_STOPPED(); >> > > > + /* >> > > > + * We must poll the I/O while we're dumping. The scheduler is >> > > normally >> > > > + * stopped for dumping, except when we call doadump from ddb. >> > > While the >> > > > + * scheduler is running in this case, we still need to poll >> the >> > > I/O to >> > > > + * avoid sleeping waiting for the ccb to complete. >> > > > + */ >> > > > + must_poll = dumping; >> > > >> > > Hmm, unfortunately this introduces a new problem: after a panic we >> call >> > > adashutdown() as part of the shutdown_post_sync event. This occurs >> > > before we call doadump(), so dumping == 0 and we don't poll for the >> > > spindown command's completion. But since we've panicked, the scheduler >> > > is stopped, and so we just hang. >> > > >> > >> > So "dumping || SCHEDULER_STOPPED()" then is needed? >> >> It seems so, unfortunately. >> > > OK. Sounds good. I'll make the change today. > https://reviews.freebsd.org/D13845 is up, if anybody wants to take a look. Warner From owner-svn-src-head@freebsd.org Wed Jan 10 23:19:33 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3106E7D2FB; Wed, 10 Jan 2018 23:19:33 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A6E2E72712; Wed, 10 Jan 2018 23:19:33 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 04DE44992; Wed, 10 Jan 2018 23:19:33 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0ANJWTS072438; Wed, 10 Jan 2018 23:19:32 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0ANJWYU072437; Wed, 10 Jan 2018 23:19:32 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201801102319.w0ANJWYU072437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 10 Jan 2018 23:19:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327802 - head/tools/tools/crypto X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/tools/tools/crypto X-SVN-Commit-Revision: 327802 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 23:19:34 -0000 Author: cem Date: Wed Jan 10 23:19:32 2018 New Revision: 327802 URL: https://svnweb.freebsd.org/changeset/base/327802 Log: Add encrypt+authenticate modes to cryptotest tool Like jhb's cryptocheck (uncommitted so far), express encrypt+authenticate modes as "-a +". Example use with aesni(4) on AMD Zen family: $ ./cryptotest -d aesni0 -a aes256 10000 $((128*1024)) 2.331 sec, 20000 aes256 crypts, 131072 bytes, 1124707930 byte/sec, 8580.8 Mb/sec $ ./cryptotest -d aesni0 -a sha256 10000 $((128*1024)) 1.109 sec, 10000 sha256 crypts, 131072 bytes, 1181577161 byte/sec, 9014.7 Mb/sec $ ./cryptotest -d aesni0 -a aes256+sha256 10000 $((128*1024)) 3.805 sec, 10000 sha256+aes256 crypts, 131072 bytes, 344460116 byte/sec, 2628.0 Mb/sec Reported by: jhb Sponsored by: Dell EMC Isilon Modified: head/tools/tools/crypto/cryptotest.c Modified: head/tools/tools/crypto/cryptotest.c ============================================================================== --- head/tools/tools/crypto/cryptotest.c Wed Jan 10 22:41:00 2018 (r327801) +++ head/tools/tools/crypto/cryptotest.c Wed Jan 10 23:19:32 2018 (r327802) @@ -147,6 +147,8 @@ usage(const char* cmd) printf("where algorithm is one of:\n"); printf(" null des 3des (default) blowfish cast skipjack rij\n"); printf(" aes aes192 aes256 md5 sha1 sha256 sha384 sha512\n"); + printf(" or an encryption algorithm concatented with authentication\n"); + printf(" algorithm with '+' in the middle, e.g., aes+sha1.\n"); printf("count is the number of encrypt/decrypt ops to do\n"); printf("size is the number of bytes of text to encrypt+decrypt\n"); printf("\n"); @@ -248,7 +250,7 @@ rdigit(void) } void -runtest(struct alg *alg, int count, int size, u_long cmd, struct timeval *tv) +runtest(struct alg *ealg, struct alg *alg, int count, int size, u_long cmd, struct timeval *tv) { int i, fd = crget(); struct timeval start, stop, dt; @@ -256,18 +258,26 @@ runtest(struct alg *alg, int count, int size, u_long c struct session2_op sop; struct crypt_op cop; char iv[EALG_MAX_BLOCK_LEN]; + char digest[512/8]; + /* Canonicalize 'ealg' to crypt alg and 'alg' to authentication alg. */ + if (ealg == NULL && !alg->ishash) { + ealg = alg; + alg = NULL; + } + bzero(&sop, sizeof(sop)); - if (!alg->ishash) { - sop.keylen = (alg->minkeylen + alg->maxkeylen)/2; + if (ealg != NULL) { + sop.keylen = (ealg->minkeylen + ealg->maxkeylen)/2; key = (char *) malloc(sop.keylen); if (key == NULL) err(1, "malloc (key)"); for (i = 0; i < sop.keylen; i++) key[i] = rdigit(); sop.key = key; - sop.cipher = alg->code; - } else { + sop.cipher = ealg->code; + } + if (alg != NULL) { sop.mackeylen = (alg->minkeylen + alg->maxkeylen)/2; key = (char *) malloc(sop.mackeylen); if (key == NULL) @@ -277,12 +287,16 @@ runtest(struct alg *alg, int count, int size, u_long c sop.mackey = key; sop.mac = alg->code; } + sop.crid = crid; if (ioctl(fd, cmd, &sop) < 0) { if (cmd == CIOCGSESSION || cmd == CIOCGSESSION2) { close(fd); if (verbose) { - printf("cipher %s", alg->name); + printf("cipher %s%s%s", ealg? ealg->name : "", + (ealg && alg) ? "+" : "", + alg? alg->name : ""); + if (alg->ishash) printf(" mackeylen %u\n", sop.mackeylen); else @@ -292,8 +306,9 @@ runtest(struct alg *alg, int count, int size, u_long c /* hardware doesn't support algorithm; skip it */ return; } - printf("cipher %s keylen %u mackeylen %u\n", - alg->name, sop.keylen, sop.mackeylen); + printf("cipher %s%s%s keylen %u mackeylen %u\n", + ealg? ealg->name : "", (ealg && alg) ? "+" : "", + alg? alg->name : "", sop.keylen, sop.mackeylen); err(1, "CIOCGSESSION"); } @@ -312,7 +327,7 @@ runtest(struct alg *alg, int count, int size, u_long c printf("session = 0x%x\n", sop.ses); printf("device = %s\n", crfind(sop.crid)); printf("count = %d, size = %d\n", count, size); - if (!alg->ishash) { + if (ealg) { printf("iv:"); hexdump(iv, sizeof iv); } @@ -321,15 +336,18 @@ runtest(struct alg *alg, int count, int size, u_long c } gettimeofday(&start, NULL); - if (!alg->ishash) { + if (ealg) { for (i = 0; i < count; i++) { cop.ses = sop.ses; cop.op = COP_ENCRYPT; - cop.flags = opflags; + cop.flags = opflags | COP_F_CIPHER_FIRST; cop.len = size; cop.src = cleartext; cop.dst = ciphertext; - cop.mac = 0; + if (alg) + cop.mac = digest; + else + cop.mac = 0; cop.iv = iv; if (ioctl(fd, CIOCCRYPT, &cop) < 0) @@ -347,7 +365,10 @@ runtest(struct alg *alg, int count, int size, u_long c cop.len = size; cop.src = ciphertext; cop.dst = cleartext; - cop.mac = 0; + if (alg) + cop.mac = digest; + else + cop.mac = 0; cop.iv = iv; if (ioctl(fd, CIOCCRYPT, &cop) < 0) @@ -432,7 +453,7 @@ printt(const char* tag, struct cryptotstat *ts) #endif void -runtests(struct alg *alg, int count, int size, u_long cmd, int threads, int profile) +runtests(struct alg *ealg, struct alg *alg, int count, int size, u_long cmd, int threads, int profile) { int i, status; double t; @@ -441,11 +462,13 @@ runtests(struct alg *alg, int count, int size, u_long struct timeval total; int otiming; - if (size % alg->blocksize) { + if (size % alg->blocksize || (ealg && size % ealg->blocksize)) { if (verbose) printf("skipping blocksize %u 'cuz not a multiple of " - "%s blocksize %u\n", - size, alg->name, alg->blocksize); + "%s blocksize %u (or %s blocksize %u)\n", + size, alg->name, alg->blocksize, + ealg ? ealg->name : "n/a", + ealg ? ealg->blocksize : 0); return; } @@ -476,13 +499,13 @@ runtests(struct alg *alg, int count, int size, u_long CPU_SET(i, &mask); cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(mask), &mask); - runtest(alg, count, size, cmd, &tvp[i]); + runtest(ealg, alg, count, size, cmd, &tvp[i]); exit(0); } while (waitpid(WAIT_MYPGRP, &status, 0) != -1) ; } else - runtest(alg, count, size, cmd, tvp); + runtest(ealg, alg, count, size, cmd, tvp); t = 0; for (i = 0; i < threads; i++) @@ -491,8 +514,9 @@ runtests(struct alg *alg, int count, int size, u_long int nops = alg->ishash ? count : 2*count; nops *= threads; - printf("%8.3lf sec, %7d %6s crypts, %7d bytes, %8.0lf byte/sec, %7.1lf Mb/sec\n", - t, nops, alg->name, size, (double)nops*size / t, + printf("%8.3lf sec, %7d %6s%s%6s crypts, %7d bytes, %8.0lf byte/sec, %7.1lf Mb/sec\n", + t, nops, alg->name, ealg? "+" : "", ealg? ealg->name : "", + size, (double)nops*size / t, (double)nops*size / t * 8 / 1024 / 1024); } #ifdef __FreeBSD__ @@ -519,7 +543,8 @@ runtests(struct alg *alg, int count, int size, u_long int main(int argc, char **argv) { - struct alg *alg = NULL; + struct alg *alg = NULL, *ealg = NULL; + char *tmp; int count = 1; int sizes[128], nsizes = 0; u_long cmd = CIOCGSESSION2; @@ -539,13 +564,23 @@ main(int argc, char **argv) verbose++; break; case 'a': + tmp = strchr(optarg, '+'); + if (tmp != NULL) { + *tmp = '\0'; + ealg = getalgbyname(optarg); + if (ealg == NULL || ealg->ishash) + usage(argv[0]); + optarg = tmp + 1; + } + alg = getalgbyname(optarg); if (alg == NULL) { if (streq(optarg, "rijndael")) alg = getalgbyname("aes"); else usage(argv[0]); - } + } else if (ealg != NULL && !alg->ishash) + usage(argv[0]); break; case 'd': crid = crlookup(optarg); @@ -602,13 +637,13 @@ main(int argc, char **argv) int j; alg = &algorithms[i]; for (j = 0; j < nsizes; j++) - runtests(alg, count, sizes[j], cmd, maxthreads, profile); + runtests(ealg, alg, count, sizes[j], cmd, maxthreads, profile); } } else { if (alg == NULL) alg = getalgbycode(CRYPTO_3DES_CBC); for (i = 0; i < nsizes; i++) - runtests(alg, count, sizes[i], cmd, maxthreads, profile); + runtests(ealg, alg, count, sizes[i], cmd, maxthreads, profile); } return (0); From owner-svn-src-head@freebsd.org Wed Jan 10 23:36:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E731EE7DCB4; Wed, 10 Jan 2018 23:36:41 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x231.google.com (mail-it0-x231.google.com [IPv6:2607:f8b0:4001:c0b::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AFEAA73055; Wed, 10 Jan 2018 23:36:41 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x231.google.com with SMTP id p139so1429959itb.1; Wed, 10 Jan 2018 15:36:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to; bh=UMNHRSae2AxaCu8nvCMD5d4KKTfGO7R4Fcg3oGIJhNI=; b=J3xJGlcHIl/tYgkpGBM7xDO5gpggzUBuIqPmmLopvP8kHrLRJbn0mD1L5hlnR6xyAi 5wzPAVYOwWwCKsy1S8rIgjuoIUVTGt7b/+NLYkk0QzTr+2ie6IUO8tDE7rXWeDPcebN7 ceLK6DlxcCr2NHRouYOBw/VGHXdwDp+nCpVnjo/r5yR9aFZwoeA3DJQ2YUjW0tTQLGxT fhtJM+VPWE87AbO9B3RXM76rm4QBkIJZcjc1G6aIcibMjPpCVlf3EGfWT6qbfHEq/G9a XPGttrJUVW/v83o1yK9T0EArUhXqyGMzibrMruo5WBdrRgChcgn2XUCABvMjEg5q4LS+ FU+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to; bh=UMNHRSae2AxaCu8nvCMD5d4KKTfGO7R4Fcg3oGIJhNI=; b=gIk38UlbUbyxsLFTzsrVjfzroyST5MJunJNgeqDdQdLoBHtsuCM3ZOv2C4bBuxAsnd B+y2vQeJrDymi+lbuzI9YRCpgUsNaLugNxLs4UEmbn9qaPda/4rpMBmyD+LJUa14beJo OOpG/5GSAm6YB+wxJaxiyzuIm8+wbq0BW57qDoZqJnGjljtZuUMYOgSPs8gf8/9/pETN dnusQF18LX60KAlG3Eb57sNMMS7fPU9AtFGoLUxWhqjWx4HBMz4o3k2XWSGHfsGlqmYT BEwr0L3lorKmt0OsFRAn7IOUkeMiE5zlRLJvpCyBBNkB6mXC6KV8cs52hjiFI5xpDTJh 6ZgA== X-Gm-Message-State: AKGB3mLUMpbo49EHj8PrQIZqbwZWQDuqLl5VqWYuj9NTuAL70ebOkjZ4 zZiEQ9sp/YFE0nIcsBPNL84XcCo+Ib9QAU6UEy7Aqg== X-Google-Smtp-Source: ACJfBotMf0gFMlYLWfFB1MyyGmuWXoaHb1MAQjhxAB/qsbB06apnv/VOsSdNS4722yuBNB8Sdfbk+f4GiTQEQvq0pFk= X-Received: by 10.36.145.208 with SMTP id i199mr19611102ite.81.1515627400705; Wed, 10 Jan 2018 15:36:40 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.131.163 with HTTP; Wed, 10 Jan 2018 15:36:19 -0800 (PST) In-Reply-To: <201801102028.w0AKS1UA000454@repo.freebsd.org> References: <201801102028.w0AKS1UA000454@repo.freebsd.org> From: Ed Maste Date: Wed, 10 Jan 2018 18:36:19 -0500 X-Google-Sender-Auth: g2PTWS7t26jyO92Qv7nQUnKrfoQ Message-ID: Subject: Re: svn commit: r327783 - head/share/mk To: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 23:36:42 -0000 On 10 January 2018 at 15:28, Ed Maste wrote: > Author: emaste > Date: Wed Jan 10 20:28:01 2018 > New Revision: 327783 > URL: https://svnweb.freebsd.org/changeset/base/327783 > > Log: > Enable ld.lld as bootstrap linker by default on amd64 > ... > This has been a long time in the making. On 2013-04-13 I submitted an > upstream tracking issue in LLVM PR 23214: [META] Using LLD as FreeBSD's > system linker. This has been in the works for a long time, but not quite as long as my typo suggests; the tracking bug was submitted on 2015-04-13, a bit over two and a half years ago. I started looking at lld as a possible system linker in 2014. Many folks have been running with this change (and also WITH_LLD_IS_LD, so that lld is installed as /usr/bin/ld) for some time and I expect this change will be transparent for regular use (other than lld taking much less time to link, compared to ld.bfd). However, if you do encounter any trouble please set WITHOUT_LLD_BOOTSTRAP=yes in /etc/src.conf and let me know what the problem was. From owner-svn-src-head@freebsd.org Thu Jan 11 00:22:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3EDCE9A18D; Thu, 11 Jan 2018 00:22:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 657A074983; Thu, 11 Jan 2018 00:22:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A6DB95568; Thu, 11 Jan 2018 00:22:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0B0MOlY001244; Thu, 11 Jan 2018 00:22:24 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0B0MONG001243; Thu, 11 Jan 2018 00:22:24 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801110022.w0B0MONG001243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 11 Jan 2018 00:22:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327803 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 327803 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 00:22:25 -0000 Author: jhb Date: Thu Jan 11 00:22:24 2018 New Revision: 327803 URL: https://svnweb.freebsd.org/changeset/base/327803 Log: Flesh out static dtrace probes for /dev/crypto ioctl errors. In particular, no probes were present for AEAD requests, but also for some other error cases in other ioctl requests. MFC after: 2 weeks Sponsored by: Chelsio Communications Modified: head/sys/opencrypto/cryptodev.c Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Wed Jan 10 23:19:32 2018 (r327802) +++ head/sys/opencrypto/cryptodev.c Thu Jan 11 00:22:24 2018 (r327803) @@ -443,6 +443,7 @@ cryptof_ioctl( default: CRYPTDEB("invalid cipher"); + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); } @@ -490,6 +491,7 @@ cryptof_ioctl( break; default: CRYPTDEB("invalid mac"); + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); } @@ -503,6 +505,8 @@ cryptof_ioctl( sop->keylen < txform->minkey) { CRYPTDEB("invalid cipher parameters"); error = EINVAL; + SDT_PROBE1(opencrypto, dev, ioctl, error, + __LINE__); goto bail; } @@ -511,6 +515,8 @@ cryptof_ioctl( if ((error = copyin(sop->key, crie.cri_key, crie.cri_klen / 8))) { CRYPTDEB("invalid key"); + SDT_PROBE1(opencrypto, dev, ioctl, error, + __LINE__); goto bail; } if (thash) @@ -524,6 +530,8 @@ cryptof_ioctl( sop->mackeylen > thash->keysize) { CRYPTDEB("invalid mac key length"); error = EINVAL; + SDT_PROBE1(opencrypto, dev, ioctl, error, + __LINE__); goto bail; } @@ -533,6 +541,8 @@ cryptof_ioctl( if ((error = copyin(sop->mackey, cria.cri_key, cria.cri_klen / 8))) { CRYPTDEB("invalid mac key"); + SDT_PROBE1(opencrypto, dev, ioctl, + error, __LINE__); goto bail; } } @@ -548,6 +558,8 @@ cryptof_ioctl( error = checkforsoftware(&crid); if (error) { CRYPTDEB("checkforsoftware"); + SDT_PROBE1(opencrypto, dev, ioctl, error, + __LINE__); goto bail; } } else @@ -555,6 +567,7 @@ cryptof_ioctl( error = crypto_newsession(&sid, (txform ? &crie : &cria), crid); if (error) { CRYPTDEB("crypto_newsession"); + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } @@ -565,6 +578,7 @@ cryptof_ioctl( if (cse == NULL) { crypto_freesession(sid); error = EINVAL; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); CRYPTDEB("csecreate"); goto bail; } @@ -597,8 +611,10 @@ bail: case CIOCFSESSION: ses = *(u_int32_t *)data; cse = csefind(fcr, ses); - if (cse == NULL) + if (cse == NULL) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); + } csedelete(fcr, cse); error = csefree(cse); break; @@ -628,8 +644,10 @@ bail: case CIOCKEY32: case CIOCKEY232: #endif - if (!crypto_userasymcrypto) + if (!crypto_userasymcrypto) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EPERM); /* XXX compat? */ + } #ifdef COMPAT_FREEBSD32 if (cmd == CIOCKEY32 || cmd == CIOCKEY232) { kop = &kopc; @@ -663,8 +681,12 @@ bail: * fallback to doing them in software. */ *(int *)data = 0; - } else + } else { error = crypto_getfeat((int *)data); + if (error) + SDT_PROBE1(opencrypto, dev, ioctl, error, + __LINE__); + } break; case CIOCFINDDEV: error = cryptodev_find((struct crypt_find_op *)data); @@ -672,12 +694,15 @@ bail: case CIOCCRYPTAEAD: caead = (struct crypt_aead *)data; cse = csefind(fcr, caead->ses); - if (cse == NULL) + if (cse == NULL) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); + } error = cryptodev_aead(cse, caead, active_cred, td); break; default: error = EINVAL; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); break; } return (error); @@ -892,12 +917,16 @@ cryptodev_aead( struct cryptodesc *crde = NULL, *crda = NULL; int error; - if (caead->len > 256*1024-4 || caead->aadlen > 256*1024-4) + if (caead->len > 256*1024-4 || caead->aadlen > 256*1024-4) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (E2BIG); + } if (cse->txform == NULL || cse->thash == NULL || caead->tag == NULL || - (caead->len % cse->txform->blocksize) != 0) + (caead->len % cse->txform->blocksize) != 0) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); + } uio = &cse->uio; uio->uio_iov = &cse->iovec; @@ -915,6 +944,7 @@ cryptodev_aead( crp = crypto_getreq(2); if (crp == NULL) { error = ENOMEM; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } @@ -927,12 +957,16 @@ cryptodev_aead( } if ((error = copyin(caead->aad, cse->uio.uio_iov[0].iov_base, - caead->aadlen))) + caead->aadlen))) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; + } if ((error = copyin(caead->src, (char *)cse->uio.uio_iov[0].iov_base + - caead->aadlen, caead->len))) + caead->aadlen, caead->len))) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; + } /* * For GCM, crd_len covers only the AAD. For other ciphers @@ -973,11 +1007,14 @@ cryptodev_aead( if (caead->iv) { if (caead->ivlen > sizeof cse->tmp_iv) { error = EINVAL; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } - if ((error = copyin(caead->iv, cse->tmp_iv, caead->ivlen))) + if ((error = copyin(caead->iv, cse->tmp_iv, caead->ivlen))) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; + } bcopy(cse->tmp_iv, crde->crd_iv, caead->ivlen); crde->crd_flags |= CRD_F_IV_EXPLICIT | CRD_F_IV_PRESENT; } else { @@ -987,8 +1024,10 @@ cryptodev_aead( } if ((error = copyin(caead->tag, (caddr_t)cse->uio.uio_iov[0].iov_base + - caead->len + caead->aadlen, cse->thash->hashsize))) + caead->len + caead->aadlen, cse->thash->hashsize))) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; + } again: /* * Let the dispatch run unlocked, then, interlock against the @@ -1003,8 +1042,10 @@ again: error = msleep(crp, &cse->lock, PWAIT, "crydev", 0); mtx_unlock(&cse->lock); - if (error != 0) + if (error != 0) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; + } if (crp->crp_etype == EAGAIN) { crp->crp_etype = 0; @@ -1014,22 +1055,28 @@ again: if (crp->crp_etype != 0) { error = crp->crp_etype; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } if (cse->error) { error = cse->error; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } if (caead->dst && (error = copyout( (caddr_t)cse->uio.uio_iov[0].iov_base + caead->aadlen, caead->dst, - caead->len))) + caead->len))) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; + } if ((error = copyout((caddr_t)cse->uio.uio_iov[0].iov_base + - caead->aadlen + caead->len, caead->tag, cse->thash->hashsize))) + caead->aadlen + caead->len, caead->tag, cse->thash->hashsize))) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; + } bail: crypto_freereq(crp); @@ -1068,6 +1115,7 @@ cryptodev_key(struct crypt_kop *kop) int in, out, size, i; if (kop->crk_iparams + kop->crk_oparams > CRK_MAXPARAM) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EFBIG); } @@ -1077,30 +1125,38 @@ cryptodev_key(struct crypt_kop *kop) case CRK_MOD_EXP: if (in == 3 && out == 1) break; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); case CRK_MOD_EXP_CRT: if (in == 6 && out == 1) break; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); case CRK_DSA_SIGN: if (in == 5 && out == 2) break; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); case CRK_DSA_VERIFY: if (in == 7 && out == 0) break; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); case CRK_DH_COMPUTE_KEY: if (in == 3 && out == 1) break; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); default: + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); } krp = (struct cryptkop *)malloc(sizeof *krp, M_XDATA, M_WAITOK|M_ZERO); - if (!krp) + if (!krp) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (ENOMEM); + } krp->krp_op = kop->crk_op; krp->krp_status = kop->crk_status; krp->krp_iparams = kop->crk_iparams; @@ -1110,9 +1166,11 @@ cryptodev_key(struct crypt_kop *kop) krp->krp_callback = (int (*) (struct cryptkop *)) cryptodevkey_cb; for (i = 0; i < CRK_MAXPARAM; i++) { - if (kop->crk_param[i].crp_nbits > 65536) + if (kop->crk_param[i].crp_nbits > 65536) { /* Limit is the same as in OpenBSD */ + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto fail; + } krp->krp_param[i].crp_nbits = kop->crk_param[i].crp_nbits; } for (i = 0; i < krp->krp_iparams + krp->krp_oparams; i++) { @@ -1123,22 +1181,28 @@ cryptodev_key(struct crypt_kop *kop) if (i >= krp->krp_iparams) continue; error = copyin(kop->crk_param[i].crp_p, krp->krp_param[i].crp_p, size); - if (error) + if (error) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto fail; + } } error = crypto_kdispatch(krp); - if (error) + if (error) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto fail; + } error = tsleep(krp, PSOCK, "crydev", 0); if (error) { /* XXX can this happen? if so, how do we recover? */ + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto fail; } kop->crk_crid = krp->krp_crid; /* device that did the work */ if (krp->krp_status != 0) { error = krp->krp_status; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto fail; } @@ -1147,8 +1211,10 @@ cryptodev_key(struct crypt_kop *kop) if (size == 0) continue; error = copyout(krp->krp_param[i].crp_p, kop->crk_param[i].crp_p, size); - if (error) + if (error) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto fail; + } } fail: From owner-svn-src-head@freebsd.org Thu Jan 11 03:11:42 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC5EDE66A38; Thu, 11 Jan 2018 03:11:42 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B7DEE7B673; Thu, 11 Jan 2018 03:11:42 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0125171CC; Thu, 11 Jan 2018 03:11:42 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0B3BfVe073745; Thu, 11 Jan 2018 03:11:41 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0B3BfB7073744; Thu, 11 Jan 2018 03:11:41 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801110311.w0B3BfB7073744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 11 Jan 2018 03:11:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327805 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 327805 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 03:11:43 -0000 Author: imp Date: Thu Jan 11 03:11:41 2018 New Revision: 327805 URL: https://svnweb.freebsd.org/changeset/base/327805 Log: When we crash, we'll stop the scheduler before we call the shutdown_post_sync event. For adashutdown, this causes problems because we need to poll for completion of the commands, but we're not yet officially dumping yet, so the code from r326964 assumed we could use the interrupt-driven commands rather than the polled ones. This lead to a hang. Prevent this by also checking to see if the scheduler is stopped to do the polling. Reported by: markj@ Sponsored by: Netflix Differential Review: https://reviews.freebsd.org/D13845 Modified: head/sys/cam/cam_periph.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Thu Jan 11 00:54:54 2018 (r327804) +++ head/sys/cam/cam_periph.c Thu Jan 11 03:11:41 2018 (r327805) @@ -1187,10 +1187,16 @@ cam_periph_runccb(union ccb *ccb, * scheduler is running in this case, we still need to poll the I/O to * avoid sleeping waiting for the ccb to complete. * - * XXX To avoid locking problems, dumping/polling callers must call + * A panic triggered dump stops the scheduler, any callback from the + * shutdown_post_sync event will run with the scheduler stopped, but + * before we're officially dumping. To avoid hanging in adashutdown + * initiated commands (or other similar situations), we have to test for + * either SCHEDULER_STOPPED() here as well. + * + * To avoid locking problems, dumping/polling callers must call * without a periph lock held. */ - must_poll = dumping; + must_poll = dumping || SCHEDULER_STOPPED(); ccb->ccb_h.cbfcnp = cam_periph_done; /* From owner-svn-src-head@freebsd.org Thu Jan 11 05:36:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1739CE6EB2D; Thu, 11 Jan 2018 05:36:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CD44F7FA93; Thu, 11 Jan 2018 05:36:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2588810A2B; Thu, 11 Jan 2018 05:36:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0B5aEIl032454; Thu, 11 Jan 2018 05:36:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0B5aDJZ032451; Thu, 11 Jan 2018 05:36:13 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801110536.w0B5aDJZ032451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 11 Jan 2018 05:36:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327806 - in head: etc/mtree usr.bin/awk usr.bin/awk/tests X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: etc/mtree usr.bin/awk usr.bin/awk/tests X-SVN-Commit-Revision: 327806 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 05:36:15 -0000 Author: kevans Date: Thu Jan 11 05:36:13 2018 New Revision: 327806 URL: https://svnweb.freebsd.org/changeset/base/327806 Log: awk(1): Add necessary bits for connecting tests, but leave disconnected The NetBSD test suite has 24 tests for awk, and we pass exactly 4 of them. Add the necessary pieces for interested parties to easily connect the tests and run them, but leave them disconnected for the time being. Some of these tests outright segfault in our awk, others just exhibit the wrong behavior. Added: head/usr.bin/awk/tests/ head/usr.bin/awk/tests/Makefile (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/usr.bin/awk/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Thu Jan 11 03:11:41 2018 (r327805) +++ head/etc/mtree/BSD.tests.dist Thu Jan 11 05:36:13 2018 (r327806) @@ -536,6 +536,8 @@ usr.bin apply .. + awk + .. basename .. bmake Modified: head/usr.bin/awk/Makefile ============================================================================== --- head/usr.bin/awk/Makefile Thu Jan 11 03:11:41 2018 (r327805) +++ head/usr.bin/awk/Makefile Thu Jan 11 05:36:13 2018 (r327806) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + AWKSRC= ${SRCTOP}/contrib/one-true-awk .PATH: ${AWKSRC} @@ -27,5 +29,9 @@ proctab.c: maketab build-tools: maketab maketab: ytab.h maketab.c ${BUILD_TOOLS_META} + +# awk needs some work before we can connect these tests to the build +#HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Added: head/usr.bin/awk/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/awk/tests/Makefile Thu Jan 11 05:36:13 2018 (r327806) @@ -0,0 +1,33 @@ +# $FreeBSD$ + +PACKAGE= tests + +NETBSD_ATF_TESTS_SH= awk_test + +${PACKAGE}FILES+= d_assign_NF.awk +${PACKAGE}FILES+= d_assign_NF.in +${PACKAGE}FILES+= d_assign_NF.out +${PACKAGE}FILES+= d_big_regexp.awk +${PACKAGE}FILES+= d_big_regexp.in +${PACKAGE}FILES+= d_big_regexp.out +${PACKAGE}FILES+= d_end1.awk +${PACKAGE}FILES+= d_end1.in +${PACKAGE}FILES+= d_end1.out +${PACKAGE}FILES+= d_end2.awk +${PACKAGE}FILES+= d_end2.in +${PACKAGE}FILES+= d_end2.out +${PACKAGE}FILES+= d_period.awk +${PACKAGE}FILES+= d_period.in +${PACKAGE}FILES+= d_period.out +${PACKAGE}FILES+= d_string1.awk +${PACKAGE}FILES+= d_string1.out +${PACKAGE}FILES+= d_tolower.awk +${PACKAGE}FILES+= d_tolower.in +${PACKAGE}FILES+= d_tolower.out +${PACKAGE}FILES+= d_toupper.awk +${PACKAGE}FILES+= d_toupper.in +${PACKAGE}FILES+= d_toupper.out + +.include + +.include From owner-svn-src-head@freebsd.org Thu Jan 11 05:53:09 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2EFDE6F944 for ; Thu, 11 Jan 2018 05:53:09 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 505FC80369 for ; Thu, 11 Jan 2018 05:53:09 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-wm0-x234.google.com with SMTP id t8so3043504wmc.3 for ; Wed, 10 Jan 2018 21:53:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=oHKmsq07jISm9Kl6v9i9y4x6agf4QbT4JwXZNhMEyYo=; b=aecqhenHEtht0PEeai1amGQcISrfPW5d8/mfcnhwUGWnaANSiMATQLdXMtd8ZvDxC8 z3dYhztigvtbYY/wDVH5QWbotOGFT7a5qsIo9xGLu6X4iTc3hh1irLXmL52AAwNO/vLO sEBfC9VrmFaYHlbEU/p9hyp3TQsPloI9PY81oZF447mPQXLVXidZVkZhlF08KOACEnX2 eZZzOxe2Fp9JpeE0Ktm3cKtMl5rN39EosfxY699cMqWMJKaFzQdAMmNESSpN/65S0jzi aarFbEvIdkFPWT6/oR2lbcjdlRfSeRSIy7H/X7gU1hgtuXR89w7ywovnAX01ySxqZMgj Xvvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=oHKmsq07jISm9Kl6v9i9y4x6agf4QbT4JwXZNhMEyYo=; b=s8oiEIB569ENrTf6VZn6I5VRgMmMSSixlcGqnrOB5A0f91NshvcaB63dchrMwk1jMp HiwWZQXelZzz4cbg8DfTQA9Dz33rhxvsnmm6ReoMClAHWRw3FIYsdyrSui3vRKPY2ONa RJZiEdIE1y5EfefbCfD+gipekzPoquJjcyHK1SLQJHZMVgwAGvgOMtK56LzSmPw06m0f zj9MIgYP5L7m13U0PS5FVja41/qBOpLhjedJnOzycA3OuuCJiKll/Pu2qipF1OZ9TzOY MuTFehb0S3d8lERu9jFwsffhEzVA8O73DdeZUkf+oFotSLdkqvByar0JLqxZggp2wYuj zHjQ== X-Gm-Message-State: AKGB3mJ/y9RewfaKklATzTffJRTHqELy4Kgop0knq2hfOCNOhiCCWQez W3iMT2EJkky2Xmc4+buMSyrf0pXyeSG/a6e8XkSLZQ== X-Google-Smtp-Source: ACJfBovG5B+pez4Jh+3h7hJ69Q46qvbviPHIISUO3O4Ps6P0eFDEtxJQvilmL8iGcJFfnn/ujl713Rimpt3rnfbeG0A= X-Received: by 10.80.179.76 with SMTP id r12mr28869852edd.118.1515649987761; Wed, 10 Jan 2018 21:53:07 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.80.195.88 with HTTP; Wed, 10 Jan 2018 21:53:07 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:18a2:a4f7:170:8dd9] In-Reply-To: <201801110536.w0B5aDJZ032451@repo.freebsd.org> References: <201801110536.w0B5aDJZ032451@repo.freebsd.org> From: Warner Losh Date: Wed, 10 Jan 2018 22:53:07 -0700 X-Google-Sender-Auth: PE_eQuSb6f_uuo1IvKQaIIygYF0 Message-ID: Subject: Re: svn commit: r327806 - in head: etc/mtree usr.bin/awk usr.bin/awk/tests To: Kyle Evans Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 05:53:09 -0000 On Wed, Jan 10, 2018 at 10:36 PM, Kyle Evans wrote: > Author: kevans > Date: Thu Jan 11 05:36:13 2018 > New Revision: 327806 > URL: https://svnweb.freebsd.org/changeset/base/327806 > > Log: > awk(1): Add necessary bits for connecting tests, but leave disconnected > > The NetBSD test suite has 24 tests for awk, and we pass exactly 4 of > them. > Add the necessary pieces for interested parties to easily connect the > tests and run them, but leave them disconnected for the time being. > > Some of these tests outright segfault in our awk, others just exhibit the > wrong behavior. > How many tests does NetBSD's awk pass? At least one of their patches causes our .m compiler awk script to fail, if I've applied it correctly. Warner > Added: > head/usr.bin/awk/tests/ > head/usr.bin/awk/tests/Makefile (contents, props changed) > Modified: > head/etc/mtree/BSD.tests.dist > head/usr.bin/awk/Makefile > > Modified: head/etc/mtree/BSD.tests.dist > ============================================================ > ================== > --- head/etc/mtree/BSD.tests.dist Thu Jan 11 03:11:41 2018 > (r327805) > +++ head/etc/mtree/BSD.tests.dist Thu Jan 11 05:36:13 2018 > (r327806) > @@ -536,6 +536,8 @@ > usr.bin > apply > .. > + awk > + .. > basename > .. > bmake > > Modified: head/usr.bin/awk/Makefile > ============================================================ > ================== > --- head/usr.bin/awk/Makefile Thu Jan 11 03:11:41 2018 (r327805) > +++ head/usr.bin/awk/Makefile Thu Jan 11 05:36:13 2018 (r327806) > @@ -1,5 +1,7 @@ > # $FreeBSD$ > > +.include > + > AWKSRC= ${SRCTOP}/contrib/one-true-awk > .PATH: ${AWKSRC} > > @@ -27,5 +29,9 @@ proctab.c: maketab > > build-tools: maketab > maketab: ytab.h maketab.c ${BUILD_TOOLS_META} > + > +# awk needs some work before we can connect these tests to the build > +#HAS_TESTS= > +SUBDIR.${MK_TESTS}+= tests > > .include > > Added: head/usr.bin/awk/tests/Makefile > ============================================================ > ================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/usr.bin/awk/tests/Makefile Thu Jan 11 05:36:13 2018 > (r327806) > @@ -0,0 +1,33 @@ > +# $FreeBSD$ > + > +PACKAGE= tests > + > +NETBSD_ATF_TESTS_SH= awk_test > + > +${PACKAGE}FILES+= d_assign_NF.awk > +${PACKAGE}FILES+= d_assign_NF.in > +${PACKAGE}FILES+= d_assign_NF.out > +${PACKAGE}FILES+= d_big_regexp.awk > +${PACKAGE}FILES+= d_big_regexp.in > +${PACKAGE}FILES+= d_big_regexp.out > +${PACKAGE}FILES+= d_end1.awk > +${PACKAGE}FILES+= d_end1.in > +${PACKAGE}FILES+= d_end1.out > +${PACKAGE}FILES+= d_end2.awk > +${PACKAGE}FILES+= d_end2.in > +${PACKAGE}FILES+= d_end2.out > +${PACKAGE}FILES+= d_period.awk > +${PACKAGE}FILES+= d_period.in > +${PACKAGE}FILES+= d_period.out > +${PACKAGE}FILES+= d_string1.awk > +${PACKAGE}FILES+= d_string1.out > +${PACKAGE}FILES+= d_tolower.awk > +${PACKAGE}FILES+= d_tolower.in > +${PACKAGE}FILES+= d_tolower.out > +${PACKAGE}FILES+= d_toupper.awk > +${PACKAGE}FILES+= d_toupper.in > +${PACKAGE}FILES+= d_toupper.out > + > +.include > + > +.include > > From owner-svn-src-head@freebsd.org Thu Jan 11 06:30:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51F14E715B8; Thu, 11 Jan 2018 06:30:51 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2D44A81466; Thu, 11 Jan 2018 06:30:51 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6AAFE1129C; Thu, 11 Jan 2018 06:30:50 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0B6UoZA053315; Thu, 11 Jan 2018 06:30:50 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0B6UoFg053314; Thu, 11 Jan 2018 06:30:50 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201801110630.w0B6UoFg053314@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 11 Jan 2018 06:30:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327807 - head/sys/contrib/zstd/lib/freebsd X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/contrib/zstd/lib/freebsd X-SVN-Commit-Revision: 327807 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 06:30:51 -0000 Author: cem Date: Thu Jan 11 06:30:50 2018 New Revision: 327807 URL: https://svnweb.freebsd.org/changeset/base/327807 Log: Zstd: Add bswap intrinsics for small MIPS systems (e.g., Onion Omega) Reported by: mizhka Sponsored by: Dell EMC Isilon Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c ============================================================================== --- head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c Thu Jan 11 05:36:13 2018 (r327806) +++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.c Thu Jan 11 06:30:50 2018 (r327807) @@ -27,6 +27,7 @@ */ #include "zstd_kfreebsd.h" +#include /* * The kernel as a standalone target does not link against libgcc or @@ -43,6 +44,19 @@ * A subsequent enhancement might create a mini compiler-rt library for kernel * use and move these over there instead. */ + +/* Swap endianness */ +int +__bswapsi2(int x) +{ + return (bswap32(x)); +} + +long long +__bswapdi2(long long x) +{ + return (bswap64(x)); +} /* Count trailing zeros */ int From owner-svn-src-head@freebsd.org Thu Jan 11 07:40:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A56F7E749EF; Thu, 11 Jan 2018 07:40:08 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6D62A836CC; Thu, 11 Jan 2018 07:40:08 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AABBC11DF5; Thu, 11 Jan 2018 07:40:07 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0B7e7Sw082466; Thu, 11 Jan 2018 07:40:07 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0B7e6hN082458; Thu, 11 Jan 2018 07:40:06 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201801110740.w0B7e6hN082458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Thu, 11 Jan 2018 07:40:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327810 - in head/sys: conf powerpc/conf powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: in head/sys: conf powerpc/conf powerpc/powernv X-SVN-Commit-Revision: 327810 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 07:40:08 -0000 Author: wma Date: Thu Jan 11 07:40:06 2018 New Revision: 327810 URL: https://svnweb.freebsd.org/changeset/base/327810 Log: PowerNV: initial support for OPAL OPAL is a dedicated firmware acting as a hypervisor. Add generic functions to provide all access. Created by: Nathan Whitehorn Submitted by: Wojciech Macek Added: head/sys/powerpc/powernv/ head/sys/powerpc/powernv/opal.c (contents, props changed) head/sys/powerpc/powernv/opal.h (contents, props changed) head/sys/powerpc/powernv/opal_console.c (contents, props changed) head/sys/powerpc/powernv/opalcall.S (contents, props changed) head/sys/powerpc/powernv/platform_powernv.c (contents, props changed) Modified: head/sys/conf/files.powerpc head/sys/conf/options.powerpc head/sys/powerpc/conf/GENERIC64 Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Thu Jan 11 07:35:14 2018 (r327809) +++ head/sys/conf/files.powerpc Thu Jan 11 07:40:06 2018 (r327810) @@ -183,6 +183,10 @@ powerpc/powermac/smusat.c optional powermac smu powerpc/powermac/uninorth.c optional powermac powerpc/powermac/uninorthpci.c optional powermac pci powerpc/powermac/vcoregpio.c optional powermac +powerpc/powernv/opal.c optional powernv +powerpc/powernv/opal_console.c optional powernv +powerpc/powernv/opalcall.S optional powernv +powerpc/powernv/platform_powernv.c optional powernv powerpc/powerpc/altivec.c optional powerpc | powerpc64 powerpc/powerpc/autoconf.c standard powerpc/powerpc/bcopy.c standard Modified: head/sys/conf/options.powerpc ============================================================================== --- head/sys/conf/options.powerpc Thu Jan 11 07:35:14 2018 (r327809) +++ head/sys/conf/options.powerpc Thu Jan 11 07:40:06 2018 (r327810) @@ -23,6 +23,7 @@ MPC85XX opt_platform.h POWERMAC opt_platform.h PS3 opt_platform.h MAMBO +POWERNV PSERIES PSIM Modified: head/sys/powerpc/conf/GENERIC64 ============================================================================== --- head/sys/powerpc/conf/GENERIC64 Thu Jan 11 07:35:14 2018 (r327809) +++ head/sys/powerpc/conf/GENERIC64 Thu Jan 11 07:40:06 2018 (r327810) @@ -31,6 +31,7 @@ options POWERMAC #NewWorld Apple PowerMacs options PS3 #Sony Playstation 3 options MAMBO #IBM Mambo Full System Simulator options PSERIES #PAPR-compliant systems (e.g. IBM p) +options POWERNV #Non-virtualized OpenPOWER systems options FDT #Flattened Device Tree options SCHED_ULE #ULE scheduler Added: head/sys/powerpc/powernv/opal.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/powernv/opal.c Thu Jan 11 07:40:06 2018 (r327810) @@ -0,0 +1,66 @@ +/*- + * Copyright (C) 2015 Nathan Whitehorn + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include + +#include "opal.h" + +extern uint64_t opal_entrypoint; +extern uint64_t opal_data; +extern uint64_t opal_msr; + +static int opal_initialized = 0; + +int +opal_check(void) +{ + phandle_t opal; + cell_t val[2]; + + if (opal_initialized) + return (0); + + opal = OF_finddevice("/ibm,opal"); + if (opal == -1) + return (ENOENT); + + if (!OF_hasprop(opal, "opal-base-address") || + !OF_hasprop(opal, "opal-entry-address")) + return (ENOENT); + + OF_getencprop(opal, "opal-base-address", val, sizeof(val)); + opal_data = ((uint64_t)val[0] << 32) | val[1]; + OF_getencprop(opal, "opal-entry-address", val, sizeof(val)); + opal_entrypoint = ((uint64_t)val[0] << 32) | val[1]; + + opal_msr = mfmsr() & ~(PSL_EE | PSL_IR | PSL_DR | PSL_SE); + + opal_initialized = 1; + + return (0); +} + Added: head/sys/powerpc/powernv/opal.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/powernv/opal.h Thu Jan 11 07:40:06 2018 (r327810) @@ -0,0 +1,48 @@ +/*- + * Copyright (c) 2015 Nathan Whitehorn + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _POWERNV_OPAL_H +#define _POWERNV_OPAL_H + +#include +#include + +/* Check if OPAL is correctly instantiated. Will try to instantiate it. */ +int opal_check(void); + +/* Call an OPAL method. Any pointers passed must be real-mode accessible! */ +int opal_call(uint64_t token, ...); + +#define OPAL_CONSOLE_WRITE 1 +#define OPAL_CONSOLE_READ 2 +#define OPAL_START_CPU 41 + +#define OPAL_SUCCESS 0 +#define OPAL_BUSY_EVENT -12 + +#endif Added: head/sys/powerpc/powernv/opal_console.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/powernv/opal_console.c Thu Jan 11 07:40:06 2018 (r327810) @@ -0,0 +1,441 @@ +/*- + * Copyright (C) 2011,2015 by Nathan Whitehorn. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include "opal.h" +#include "uart_if.h" + +struct uart_opal_softc { + device_t dev; + phandle_t node; + int vtermid; + + struct tty *tp; + struct resource *irqres; + int irqrid; + struct callout callout; + void *sc_icookie; + int polltime; + + struct mtx sc_mtx; + int protocol; + + char opal_inbuf[16]; + uint64_t inbuflen; + uint8_t outseqno; +}; + +static struct uart_opal_softc *console_sc = NULL; +#if defined(KDB) +static int alt_break_state; +#endif + +enum { + OPAL_RAW, OPAL_HVSI +}; + +#define VS_DATA_PACKET_HEADER 0xff +#define VS_CONTROL_PACKET_HEADER 0xfe +#define VSV_SET_MODEM_CTL 0x01 +#define VSV_MODEM_CTL_UPDATE 0x02 +#define VSV_RENEGOTIATE_CONNECTION 0x03 +#define VS_QUERY_PACKET_HEADER 0xfd +#define VSV_SEND_VERSION_NUMBER 0x01 +#define VSV_SEND_MODEM_CTL_STATUS 0x02 +#define VS_QUERY_RESPONSE_PACKET_HEADER 0xfc + +static int uart_opal_probe(device_t dev); +static int uart_opal_attach(device_t dev); +static void uart_opal_intr(void *v); + +static device_method_t uart_opal_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, uart_opal_probe), + DEVMETHOD(device_attach, uart_opal_attach), + + DEVMETHOD_END +}; + +static driver_t uart_opal_driver = { + "uart", + uart_opal_methods, + sizeof(struct uart_opal_softc), +}; + +DRIVER_MODULE(uart_opal, opalcons, uart_opal_driver, uart_devclass, 0, 0); + +static cn_probe_t uart_opal_cnprobe; +static cn_init_t uart_opal_cninit; +static cn_term_t uart_opal_cnterm; +static cn_getc_t uart_opal_cngetc; +static cn_putc_t uart_opal_cnputc; +static cn_grab_t uart_opal_cngrab; +static cn_ungrab_t uart_opal_cnungrab; + +CONSOLE_DRIVER(uart_opal); + +static void uart_opal_ttyoutwakeup(struct tty *tp); + +static struct ttydevsw uart_opal_tty_class = { + .tsw_flags = TF_INITLOCK|TF_CALLOUT, + .tsw_outwakeup = uart_opal_ttyoutwakeup, +}; + +static int +uart_opal_probe_node(struct uart_opal_softc *sc) +{ + phandle_t node = sc->node; + uint32_t reg; + char buf[64]; + + sc->inbuflen = 0; + sc->outseqno = 0; + + if (OF_getprop(node, "device_type", buf, sizeof(buf)) <= 0) + return (ENXIO); + if (strcmp(buf, "serial") != 0) + return (ENXIO); + + reg = -1; + OF_getprop(node, "reg", ®, sizeof(reg)); + if (reg == -1) + return (ENXIO); + sc->vtermid = reg; + sc->node = node; + + if (OF_getprop(node, "compatible", buf, sizeof(buf)) <= 0) + return (ENXIO); + if (strcmp(buf, "ibm,opal-console-raw") == 0) { + sc->protocol = OPAL_RAW; + return (0); + } else if (strcmp(buf, "ibm,opal-console-hvsi") == 0) { + sc->protocol = OPAL_HVSI; + return (0); + } + + return (ENXIO); +} + +static int +uart_opal_probe(device_t dev) +{ + struct uart_opal_softc sc; + int err; + + sc.node = ofw_bus_get_node(dev); + err = uart_opal_probe_node(&sc); + if (err != 0) + return (err); + + device_set_desc(dev, "OPAL Serial Port"); + + return (err); +} + +static void +uart_opal_cnprobe(struct consdev *cp) +{ + char buf[64]; + phandle_t input, chosen; + static struct uart_opal_softc sc; + + if (opal_check() != 0) + goto fail; + + if ((chosen = OF_finddevice("/chosen")) == -1) + goto fail; + + /* Check if OF has an active stdin/stdout */ + if (OF_getprop(chosen, "linux,stdout-path", buf, sizeof(buf)) <= 0) + goto fail; + + input = OF_finddevice(buf); + if (input == -1) + goto fail; + + sc.node = input; + if (uart_opal_probe_node(&sc) != 0) + goto fail; + mtx_init(&sc.sc_mtx, "uart_opal", NULL, MTX_SPIN | MTX_QUIET | + MTX_NOWITNESS); + + cp->cn_pri = CN_NORMAL; + console_sc = ≻ + return; + +fail: + cp->cn_pri = CN_DEAD; + return; +} + +static int +uart_opal_attach(device_t dev) +{ + struct uart_opal_softc *sc; + int unit; + + sc = device_get_softc(dev); + sc->dev = dev; + sc->node = ofw_bus_get_node(dev); + uart_opal_probe_node(sc); + + unit = device_get_unit(dev); + sc->tp = tty_alloc(&uart_opal_tty_class, sc); + mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, + MTX_SPIN | MTX_QUIET | MTX_NOWITNESS); + + if (console_sc != NULL && console_sc->vtermid == sc->vtermid) { + sc->outseqno = console_sc->outseqno; + console_sc = sc; + sprintf(uart_opal_consdev.cn_name, "ttyu%r", unit); + tty_init_console(sc->tp, 0); + } + + sc->irqrid = 0; + sc->irqres = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irqrid, + RF_ACTIVE | RF_SHAREABLE); + if (sc->irqres != NULL) { + bus_setup_intr(dev, sc->irqres, INTR_TYPE_TTY | INTR_MPSAFE, + NULL, uart_opal_intr, sc, &sc->sc_icookie); + } else { + callout_init(&sc->callout, CALLOUT_MPSAFE); + sc->polltime = hz / 20; + if (sc->polltime < 1) + sc->polltime = 1; + callout_reset(&sc->callout, sc->polltime, uart_opal_intr, sc); + } + + tty_makedev(sc->tp, NULL, "u%r", unit); + + return (0); +} + +static void +uart_opal_cninit(struct consdev *cp) +{ + + strcpy(cp->cn_name, "opalcons"); +} + +static void +uart_opal_cnterm(struct consdev *cp) +{ +} + +static int +uart_opal_get(struct uart_opal_softc *sc, void *buffer, size_t bufsize) +{ + int err; + int hdr = 0; + + if (sc->protocol == OPAL_RAW) { + uint64_t len = bufsize; + uint64_t olen = (uint64_t)&len; + uint64_t obuf = (uint64_t)buffer; + + if (pmap_bootstrapped) { + olen = vtophys(&len); + obuf = vtophys(buffer); + } + + err = opal_call(OPAL_CONSOLE_READ, sc->vtermid, olen, obuf); + if (err != OPAL_SUCCESS) + return (-1); + + bufsize = len; + } else { + uart_lock(&sc->sc_mtx); + if (sc->inbuflen == 0) { + err = opal_call(OPAL_CONSOLE_READ, sc->vtermid, + &sc->inbuflen, sc->opal_inbuf); + if (err != OPAL_SUCCESS) { + uart_unlock(&sc->sc_mtx); + return (-1); + } + hdr = 1; + } + + if (sc->inbuflen == 0) { + uart_unlock(&sc->sc_mtx); + return (0); + } + + if (bufsize > sc->inbuflen) + bufsize = sc->inbuflen; + + if (hdr == 1) { + sc->inbuflen = sc->inbuflen - 4; + /* The HVSI protocol has a 4 byte header, skip it */ + memmove(&sc->opal_inbuf[0], &sc->opal_inbuf[4], + sc->inbuflen); + } + + memcpy(buffer, sc->opal_inbuf, bufsize); + sc->inbuflen -= bufsize; + if (sc->inbuflen > 0) + memmove(&sc->opal_inbuf[0], &sc->opal_inbuf[bufsize], + sc->inbuflen); + + uart_unlock(&sc->sc_mtx); + } + + return (bufsize); +} + +static int +uart_opal_put(struct uart_opal_softc *sc, void *buffer, size_t bufsize) +{ + uint16_t seqno; + uint64_t len = bufsize; + char cbuf[16]; + int err; + uint64_t olen = (uint64_t)&len; + uint64_t obuf = (uint64_t)cbuf; + + if (pmap_bootstrapped) + olen = vtophys(&len); + + if (sc->protocol == OPAL_RAW) { + if (pmap_bootstrapped) + obuf = vtophys(buffer); + else + obuf = (uint64_t)(buffer); + + err = opal_call(OPAL_CONSOLE_WRITE, sc->vtermid, olen, obuf); + } else { + if (pmap_bootstrapped) + obuf = vtophys(cbuf); + uart_lock(&sc->sc_mtx); + if (bufsize > 12) + bufsize = 12; + seqno = sc->outseqno++; + cbuf[0] = VS_DATA_PACKET_HEADER; + cbuf[1] = 4 + bufsize; /* total length */ + cbuf[2] = (seqno >> 8) & 0xff; + cbuf[3] = seqno & 0xff; + memcpy(&cbuf[4], buffer, bufsize); + len = 4 + bufsize; + err = opal_call(OPAL_CONSOLE_WRITE, sc->vtermid, olen, obuf); + uart_unlock(&sc->sc_mtx); + + len -= 4; + } + +#if 0 + if (err != OPAL_SUCCESS) + len = 0; +#endif + + return (len); +} + +static int +uart_opal_cngetc(struct consdev *cp) +{ + unsigned char c; + int retval; + + retval = uart_opal_get(console_sc, &c, 1); + if (retval != 1) + return (-1); +#if defined(KDB) + kdb_alt_break(c, &alt_break_state); +#endif + + return (c); +} + +static void +uart_opal_cnputc(struct consdev *cp, int c) +{ + unsigned char ch = c; + uart_opal_put(console_sc, &ch, 1); +} + +static void +uart_opal_cngrab(struct consdev *cp) +{ +} + +static void +uart_opal_cnungrab(struct consdev *cp) +{ +} + +static void +uart_opal_ttyoutwakeup(struct tty *tp) +{ + struct uart_opal_softc *sc; + char buffer[8]; + int len; + + sc = tty_softc(tp); + + while ((len = ttydisc_getc(tp, buffer, sizeof(buffer))) != 0) + uart_opal_put(sc, buffer, len); +} + +static void +uart_opal_intr(void *v) +{ + struct uart_opal_softc *sc = v; + struct tty *tp = sc->tp; + unsigned char c; + int len; + + tty_lock(tp); + while ((len = uart_opal_get(sc, &c, 1)) > 0) + ttydisc_rint(tp, c, 0); + ttydisc_rint_done(tp); + tty_unlock(tp); + + if (sc->irqres == NULL) + callout_reset(&sc->callout, sc->polltime, uart_opal_intr, sc); +} + Added: head/sys/powerpc/powernv/opalcall.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/powernv/opalcall.S Thu Jan 11 07:40:06 2018 (r327810) @@ -0,0 +1,99 @@ +/*- + * Copyright (C) 2015 Nathan Whitehorn + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include + +GLOBAL(opal_entrypoint) + .llong 0 +GLOBAL(opal_data) + .llong 0 +GLOBAL(opal_msr) + .llong 0 + +TOC_ENTRY(opal_entrypoint) +TOC_ENTRY(opal_data) +TOC_ENTRY(opal_msr) + +ASENTRY(opal_call) + /* Args: + * r3: opal token + * r4-r10 opal arguments + */ + + /* Save call stuff on stack */ + mflr %r0 + std %r0,16(%r1) + std %r2,-16(%r1) + mfcr %r0 + std %r0,8(%r1) + + /* Load OPAL entry information */ + mr %r0,%r3 + ld %r3,TOC_REF(opal_entrypoint)(%r2) + ld %r3,0(%r3) + mtctr %r3 + + /* Save MSR in non-volatile scratch register and turn off translation */ + std %r31,-8(%r1) + mfmsr %r31 + + /* Load last bits from the TOC */ + ld %r3,TOC_REF(opal_msr)(%r2) + ld %r3,0(%r3) + ld %r2,TOC_REF(opal_data)(%r2) + ld %r2,0(%r2) + + mtmsrd %r3 + isync + + /* Shift registers over */ + mr %r3,%r4 + mr %r4,%r5 + mr %r5,%r6 + mr %r6,%r7 + mr %r7,%r8 + mr %r8,%r9 + mr %r9,%r10 + + /* Call OPAL */ + bctrl + + /* Restore MSR */ + mtmsrd %r31 + isync + ld %r31,-8(%r1) + + /* Restore call stuff from stack */ + ld %r0,16(%r1) + mtlr %r0 + ld %r2,-16(%r1) + ld %r0,8(%r1) + mtcr %r0 + + /* And return */ + blr + Added: head/sys/powerpc/powernv/platform_powernv.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/powernv/platform_powernv.c Thu Jan 11 07:40:06 2018 (r327810) @@ -0,0 +1,333 @@ +/*- + * Copyright (c) 2015 Nathan Whitehorn + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "platform_if.h" +#include "opal.h" + +#ifdef SMP +extern void *ap_pcpu; +#endif + +static int powernv_probe(platform_t); +static int powernv_attach(platform_t); +void powernv_mem_regions(platform_t, struct mem_region *phys, int *physsz, + struct mem_region *avail, int *availsz); +static u_long powernv_timebase_freq(platform_t, struct cpuref *cpuref); +static int powernv_smp_first_cpu(platform_t, struct cpuref *cpuref); +static int powernv_smp_next_cpu(platform_t, struct cpuref *cpuref); +static int powernv_smp_get_bsp(platform_t, struct cpuref *cpuref); +static void powernv_smp_ap_init(platform_t); +#ifdef SMP +static int powernv_smp_start_cpu(platform_t, struct pcpu *cpu); +static struct cpu_group *powernv_smp_topo(platform_t plat); +#endif +static void powernv_reset(platform_t); + +static platform_method_t powernv_methods[] = { + PLATFORMMETHOD(platform_probe, powernv_probe), + PLATFORMMETHOD(platform_attach, powernv_attach), + PLATFORMMETHOD(platform_mem_regions, powernv_mem_regions), + PLATFORMMETHOD(platform_timebase_freq, powernv_timebase_freq), + + PLATFORMMETHOD(platform_smp_ap_init, powernv_smp_ap_init), + PLATFORMMETHOD(platform_smp_first_cpu, powernv_smp_first_cpu), + PLATFORMMETHOD(platform_smp_next_cpu, powernv_smp_next_cpu), + PLATFORMMETHOD(platform_smp_get_bsp, powernv_smp_get_bsp), +#ifdef SMP + PLATFORMMETHOD(platform_smp_start_cpu, powernv_smp_start_cpu), + PLATFORMMETHOD(platform_smp_topo, powernv_smp_topo), +#endif + + PLATFORMMETHOD(platform_reset, powernv_reset), + + { 0, 0 } +}; + +static platform_def_t powernv_platform = { + "powernv", + powernv_methods, + 0 +}; + +PLATFORM_DEF(powernv_platform); + +static int +powernv_probe(platform_t plat) +{ + if (opal_check() == 0) + return (BUS_PROBE_SPECIFIC); + + return (ENXIO); +} + +static int +powernv_attach(platform_t plat) +{ + /* Ping OPAL again just to make sure */ + opal_check(); + + return (0); +} + +void +powernv_mem_regions(platform_t plat, struct mem_region *phys, int *physsz, + struct mem_region *avail, int *availsz) +{ + + ofw_mem_regions(phys, physsz, avail, availsz); +} + +static u_long +powernv_timebase_freq(platform_t plat, struct cpuref *cpuref) +{ + phandle_t phandle; + int32_t ticks = -1; + + phandle = cpuref->cr_hwref; + + OF_getprop(phandle, "timebase-frequency", &ticks, sizeof(ticks)); + + if (ticks <= 0) + panic("Unable to determine timebase frequency!"); + + return (ticks); +} + +static int +powernv_smp_first_cpu(platform_t plat, struct cpuref *cpuref) +{ + char buf[8]; + phandle_t cpu, dev, root; + int res, cpuid; + + root = OF_peer(0); + + dev = OF_child(root); + while (dev != 0) { + res = OF_getprop(dev, "name", buf, sizeof(buf)); + if (res > 0 && strcmp(buf, "cpus") == 0) + break; + dev = OF_peer(dev); + } + if (dev == 0) { + /* + * psim doesn't have a name property on the /cpus node, + * but it can be found directly + */ + dev = OF_finddevice("/cpus"); + if (dev == 0) + return (ENOENT); + } + + cpu = OF_child(dev); + + while (cpu != 0) { + res = OF_getprop(cpu, "device_type", buf, sizeof(buf)); + if (res > 0 && strcmp(buf, "cpu") == 0) + break; + cpu = OF_peer(cpu); + } + if (cpu == 0) + return (ENOENT); + + cpuref->cr_hwref = cpu; + res = OF_getprop(cpu, "ibm,ppc-interrupt-server#s", &cpuid, + sizeof(cpuid)); + if (res <= 0) + res = OF_getprop(cpu, "reg", &cpuid, sizeof(cpuid)); + if (res <= 0) + cpuid = 0; + cpuref->cr_cpuid = cpuid; + + return (0); +} + +static int +powernv_smp_next_cpu(platform_t plat, struct cpuref *cpuref) +{ + char buf[8]; + phandle_t cpu; + int i, res, cpuid; + + /* Check for whether it should be the next thread */ + res = OF_getproplen(cpuref->cr_hwref, "ibm,ppc-interrupt-server#s"); + if (res > 0) { + cell_t interrupt_servers[res/sizeof(cell_t)]; + OF_getprop(cpuref->cr_hwref, "ibm,ppc-interrupt-server#s", + interrupt_servers, res); + for (i = 0; i < res/sizeof(cell_t) - 1; i++) { + if (interrupt_servers[i] == cpuref->cr_cpuid) { + cpuref->cr_cpuid = interrupt_servers[i+1]; + return (0); + } + } + } + + /* Next CPU core/package */ + cpu = OF_peer(cpuref->cr_hwref); + while (cpu != 0) { + res = OF_getprop(cpu, "device_type", buf, sizeof(buf)); + if (res > 0 && strcmp(buf, "cpu") == 0) + break; + cpu = OF_peer(cpu); + } + if (cpu == 0) + return (ENOENT); + + cpuref->cr_hwref = cpu; + res = OF_getprop(cpu, "ibm,ppc-interrupt-server#s", &cpuid, + sizeof(cpuid)); + if (res <= 0) + res = OF_getprop(cpu, "reg", &cpuid, sizeof(cpuid)); + if (res <= 0) + cpuid = 0; + cpuref->cr_cpuid = cpuid; + + return (0); +} + +static int +powernv_smp_get_bsp(platform_t plat, struct cpuref *cpuref) +{ + phandle_t chosen; + int cpuid, res; + struct cpuref i; + + chosen = OF_finddevice("/chosen"); + if (chosen == 0) + return (ENOENT); + + res = OF_getencprop(chosen, "fdtbootcpu", &cpuid, sizeof(cpuid)); + if (res < 0) + return (ENOENT); + + cpuref->cr_cpuid = cpuid; + + if (powernv_smp_first_cpu(plat, &i) != 0) + return (ENOENT); + cpuref->cr_hwref = i.cr_hwref; + + do { + if (i.cr_cpuid == cpuid) { + cpuref->cr_hwref = i.cr_hwref; + break; + } + } while (powernv_smp_next_cpu(plat, &i) == 0); + + return (0); +} + +#ifdef SMP +static int +powernv_smp_start_cpu(platform_t plat, struct pcpu *pc) +{ + int result, err, timeout; + + ap_pcpu = pc; + powerpc_sync(); + + result = opal_call(OPAL_START_CPU, pc->pc_cpuid, EXC_RST); + if (result < 0 || err != 0) { + printf("OPAL error (%d/%d): unable to start AP %d\n", + result, err, pc->pc_cpuid); + return (ENXIO); + } + + timeout = 10000; + while (!pc->pc_awake && timeout--) + DELAY(100); + + return ((pc->pc_awake) ? 0 : EBUSY); +} + +static struct cpu_group * +powernv_smp_topo(platform_t plat) +{ + struct pcpu *pc, *last_pc; + int i, ncores, ncpus; + + ncores = ncpus = 0; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Jan 11 09:17:03 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1749E7983A; Thu, 11 Jan 2018 09:17:03 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 99A8B335E; Thu, 11 Jan 2018 09:17:03 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D733B12E09; Thu, 11 Jan 2018 09:17:02 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0B9H2pC024046; Thu, 11 Jan 2018 09:17:02 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0B9H2if024045; Thu, 11 Jan 2018 09:17:02 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201801110917.w0B9H2if024045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Thu, 11 Jan 2018 09:17:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327811 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 327811 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 09:17:03 -0000 Author: wma Date: Thu Jan 11 09:17:02 2018 New Revision: 327811 URL: https://svnweb.freebsd.org/changeset/base/327811 Log: CXGBE: fix get_filt to be endianness-aware Unconditional 32-bit shift is not endianness-safe. Modify the logic to work both on LE and BE. Submitted by: Wojciech Macek Reviewed by: np Obtained from: Semihalf Sponsored by: IBM, QCM Technologies Differential revision: https://reviews.freebsd.org/D13102 Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Thu Jan 11 07:40:06 2018 (r327810) +++ head/sys/dev/cxgbe/t4_sge.c Thu Jan 11 09:17:02 2018 (r327811) @@ -4754,13 +4754,13 @@ get_flit(struct sglist_seg *segs, int nsegs, int idx) switch (idx % 3) { case 0: { - __be64 rc; + uint64_t rc; - rc = htobe32(segs[i].ss_len); + rc = (uint64_t)segs[i].ss_len << 32; if (i + 1 < nsegs) - rc |= (uint64_t)htobe32(segs[i + 1].ss_len) << 32; + rc |= (uint64_t)(segs[i + 1].ss_len); - return (rc); + return (htobe64(rc)); } case 1: return (htobe64(segs[i].ss_paddr)); From owner-svn-src-head@freebsd.org Thu Jan 11 09:26:30 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05CE6E7A008; Thu, 11 Jan 2018 09:26:30 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D20273B85; Thu, 11 Jan 2018 09:26:29 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 138BB12FE9; Thu, 11 Jan 2018 09:26:29 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0B9QSvr028029; Thu, 11 Jan 2018 09:26:28 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0B9QSW3028025; Thu, 11 Jan 2018 09:26:28 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201801110926.w0B9QSW3028025@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Thu, 11 Jan 2018 09:26:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327812 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 327812 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 09:26:30 -0000 Author: wma Date: Thu Jan 11 09:26:28 2018 New Revision: 327812 URL: https://svnweb.freebsd.org/changeset/base/327812 Log: PowerNV: add reset, poweroff, OPAL console Add basic power control (reset, power off) and bind ttyuX to opal console so that init will start login there. Created by: Nathan Whitehorn Submitted by: Wojciech Macek Sponsored by: FreeBSD Foundation Added: head/sys/powerpc/powernv/opal_dev.c (contents, props changed) Modified: head/sys/powerpc/powernv/opal.h head/sys/powerpc/powernv/opal_console.c head/sys/powerpc/powernv/platform_powernv.c Modified: head/sys/powerpc/powernv/opal.h ============================================================================== --- head/sys/powerpc/powernv/opal.h Thu Jan 11 09:17:02 2018 (r327811) +++ head/sys/powerpc/powernv/opal.h Thu Jan 11 09:26:28 2018 (r327812) @@ -40,6 +40,8 @@ int opal_call(uint64_t token, ...); #define OPAL_CONSOLE_WRITE 1 #define OPAL_CONSOLE_READ 2 +#define OPAL_CEC_POWER_DOWN 5 +#define OPAL_CEC_REBOOT 6 #define OPAL_START_CPU 41 #define OPAL_SUCCESS 0 Modified: head/sys/powerpc/powernv/opal_console.c ============================================================================== --- head/sys/powerpc/powernv/opal_console.c Thu Jan 11 09:17:02 2018 (r327811) +++ head/sys/powerpc/powernv/opal_console.c Thu Jan 11 09:26:28 2018 (r327812) @@ -439,3 +439,76 @@ uart_opal_intr(void *v) callout_reset(&sc->callout, sc->polltime, uart_opal_intr, sc); } +static int +opalcons_probe(device_t dev) +{ + const char *name; + + name = ofw_bus_get_name(dev); + if (name == NULL || strcmp(name, "consoles") != 0) + return (ENXIO); + + device_set_desc(dev, "OPAL Consoles"); + return (BUS_PROBE_SPECIFIC); +} + +static int +opalcons_attach(device_t dev) +{ + phandle_t child; + device_t cdev; + struct ofw_bus_devinfo *dinfo; + + for (child = OF_child(ofw_bus_get_node(dev)); child != 0; + child = OF_peer(child)) { + dinfo = malloc(sizeof(*dinfo), M_DEVBUF, M_WAITOK | M_ZERO); + if (ofw_bus_gen_setup_devinfo(dinfo, child) != 0) { + free(dinfo, M_DEVBUF); + continue; + } + cdev = device_add_child(dev, NULL, -1); + if (cdev == NULL) { + device_printf(dev, "<%s>: device_add_child failed\n", + dinfo->obd_name); + ofw_bus_gen_destroy_devinfo(dinfo); + free(dinfo, M_DEVBUF); + continue; + } + device_set_ivars(cdev, dinfo); + } + + return (bus_generic_attach(dev)); +} + +static const struct ofw_bus_devinfo * +opalcons_get_devinfo(device_t dev, device_t child) +{ + return (device_get_ivars(child)); +} + +static device_method_t opalcons_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, opalcons_probe), + DEVMETHOD(device_attach, opalcons_attach), + + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_devinfo, opalcons_get_devinfo), + DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), + DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), + DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), + DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), + DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), + + DEVMETHOD_END +}; + +static driver_t opalcons_driver = { + "opalcons", + opalcons_methods, + 0 +}; + +static devclass_t opalcons_devclass; + +DRIVER_MODULE(opalcons, opal, opalcons_driver, opalcons_devclass, 0, 0); + Added: head/sys/powerpc/powernv/opal_dev.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/powernv/opal_dev.c Thu Jan 11 09:26:28 2018 (r327812) @@ -0,0 +1,162 @@ +/*- + * Copyright (c) 2015 Nathan Whitehorn + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "clock_if.h" +#include "opal.h" + +static int opaldev_probe(device_t); +static int opaldev_attach(device_t); +/* clock interface */ +static int opal_gettime(device_t dev, struct timespec *ts); +static int opal_settime(device_t dev, struct timespec *ts); +/* ofw bus interface */ +static const struct ofw_bus_devinfo *opaldev_get_devinfo(device_t dev, + device_t child); + +static void opal_shutdown(void *arg, int howto); + +static device_method_t opaldev_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, opaldev_probe), + DEVMETHOD(device_attach, opaldev_attach), + + /* clock interface */ + DEVMETHOD(clock_gettime, opal_gettime), + DEVMETHOD(clock_settime, opal_settime), + + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_devinfo, opaldev_get_devinfo), + DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), + DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), + DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), + DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), + DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), + + DEVMETHOD_END +}; + +static driver_t opaldev_driver = { + "opal", + opaldev_methods, + 0 +}; + +static devclass_t opaldev_devclass; + +DRIVER_MODULE(opaldev, ofwbus, opaldev_driver, opaldev_devclass, 0, 0); + +static int +opaldev_probe(device_t dev) +{ + + if (!ofw_bus_is_compatible(dev, "ibm,opal-v3")) + return (ENXIO); + if (opal_check() != 0) + return (ENXIO); + + device_set_desc(dev, "OPAL Abstraction Firmware"); + return (BUS_PROBE_SPECIFIC); +} + +static int +opaldev_attach(device_t dev) +{ + phandle_t child; + device_t cdev; + struct ofw_bus_devinfo *dinfo; + + if (0 /* XXX NOT YET TEST FOR RTC */) + clock_register(dev, 2000); + + EVENTHANDLER_REGISTER(shutdown_final, opal_shutdown, NULL, + SHUTDOWN_PRI_LAST); + + for (child = OF_child(ofw_bus_get_node(dev)); child != 0; + child = OF_peer(child)) { + dinfo = malloc(sizeof(*dinfo), M_DEVBUF, M_WAITOK | M_ZERO); + if (ofw_bus_gen_setup_devinfo(dinfo, child) != 0) { + free(dinfo, M_DEVBUF); + continue; + } + cdev = device_add_child(dev, NULL, -1); + if (cdev == NULL) { + device_printf(dev, "<%s>: device_add_child failed\n", + dinfo->obd_name); + ofw_bus_gen_destroy_devinfo(dinfo); + free(dinfo, M_DEVBUF); + continue; + } + device_set_ivars(cdev, dinfo); + } + + return (bus_generic_attach(dev)); +} + +static int +opal_gettime(device_t dev, struct timespec *ts) { + return (ENXIO); +} + +static int +opal_settime(device_t dev, struct timespec *ts) +{ + return (0); +} + +static const struct ofw_bus_devinfo * +opaldev_get_devinfo(device_t dev, device_t child) +{ + return (device_get_ivars(child)); +} + +static void +opal_shutdown(void *arg, int howto) +{ + + if (howto & RB_HALT) + opal_call(OPAL_CEC_POWER_DOWN, 0 /* Normal power off */); + else + opal_call(OPAL_CEC_REBOOT); +} + Modified: head/sys/powerpc/powernv/platform_powernv.c ============================================================================== --- head/sys/powerpc/powernv/platform_powernv.c Thu Jan 11 09:17:02 2018 (r327811) +++ head/sys/powerpc/powernv/platform_powernv.c Thu Jan 11 09:26:28 2018 (r327812) @@ -324,6 +324,8 @@ powernv_smp_topo(platform_t plat) static void powernv_reset(platform_t platform) { + + opal_call(OPAL_CEC_REBOOT); } static void From owner-svn-src-head@freebsd.org Thu Jan 11 09:34:35 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1227AE7A5EA; Thu, 11 Jan 2018 09:34:35 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E15C7633DC; Thu, 11 Jan 2018 09:34:34 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 137061317C; Thu, 11 Jan 2018 09:34:34 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0B9YX3R032078; Thu, 11 Jan 2018 09:34:33 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0B9YXuk032077; Thu, 11 Jan 2018 09:34:33 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201801110934.w0B9YXuk032077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Thu, 11 Jan 2018 09:34:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327813 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 327813 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 09:34:35 -0000 Author: wma Date: Thu Jan 11 09:34:33 2018 New Revision: 327813 URL: https://svnweb.freebsd.org/changeset/base/327813 Log: PowerNV: correctly start secondary CPUs Fix AP startup, which was broken. Created by: Nathan Whitehorn Submitted by: Wojciech Macek Sponsored by: FreeBSD Foundation Modified: head/sys/powerpc/powernv/platform_powernv.c Modified: head/sys/powerpc/powernv/platform_powernv.c ============================================================================== --- head/sys/powerpc/powernv/platform_powernv.c Thu Jan 11 09:26:28 2018 (r327812) +++ head/sys/powerpc/powernv/platform_powernv.c Thu Jan 11 09:34:33 2018 (r327813) @@ -71,6 +71,7 @@ static int powernv_smp_start_cpu(platform_t, struct pc static struct cpu_group *powernv_smp_topo(platform_t plat); #endif static void powernv_reset(platform_t); +static void powernv_cpu_idle(sbintime_t sbt); static platform_method_t powernv_methods[] = { PLATFORMMETHOD(platform_probe, powernv_probe), @@ -115,6 +116,8 @@ powernv_attach(platform_t plat) /* Ping OPAL again just to make sure */ opal_check(); + cpu_idle_hook = powernv_cpu_idle; + return (0); } @@ -270,23 +273,19 @@ powernv_smp_get_bsp(platform_t plat, struct cpuref *cp static int powernv_smp_start_cpu(platform_t plat, struct pcpu *pc) { - int result, err, timeout; + int result; ap_pcpu = pc; powerpc_sync(); result = opal_call(OPAL_START_CPU, pc->pc_cpuid, EXC_RST); - if (result < 0 || err != 0) { - printf("OPAL error (%d/%d): unable to start AP %d\n", - result, err, pc->pc_cpuid); + if (result != OPAL_SUCCESS) { + printf("OPAL error (%d): unable to start AP %d\n", + result, pc->pc_cpuid); return (ENXIO); } - timeout = 10000; - while (!pc->pc_awake && timeout--) - DELAY(100); - - return ((pc->pc_awake) ? 0 : EBUSY); + return (0); } static struct cpu_group * @@ -333,3 +332,7 @@ powernv_smp_ap_init(platform_t platform) { } +static void +powernv_cpu_idle(sbintime_t sbt) +{ +} From owner-svn-src-head@freebsd.org Thu Jan 11 09:39:39 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E976DE7A991; Thu, 11 Jan 2018 09:39:39 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C3DC563635; Thu, 11 Jan 2018 09:39:39 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F6CE13182; Thu, 11 Jan 2018 09:39:39 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0B9dcmV032282; Thu, 11 Jan 2018 09:39:38 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0B9dcMW032280; Thu, 11 Jan 2018 09:39:38 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201801110939.w0B9dcMW032280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Thu, 11 Jan 2018 09:39:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327814 - in head/sys/powerpc: include powernv X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: in head/sys/powerpc: include powernv X-SVN-Commit-Revision: 327814 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 09:39:40 -0000 Author: wma Date: Thu Jan 11 09:39:38 2018 New Revision: 327814 URL: https://svnweb.freebsd.org/changeset/base/327814 Log: PowerNV: set LPCR[LPES] correctly Make sure to set LPCR[LPES] so that external interrupts set SRR0 and SRR1 instead of HSRR0 and HSRR1. Without this, external interrupt handlers would get the wrong MSR value when executing, causing eventual madness. Created by: Nathan Whitehorn Submitted by: Wojciech Macek Sponsored by: FreeBSD Foundation Modified: head/sys/powerpc/include/spr.h head/sys/powerpc/powernv/platform_powernv.c Modified: head/sys/powerpc/include/spr.h ============================================================================== --- head/sys/powerpc/include/spr.h Thu Jan 11 09:34:33 2018 (r327813) +++ head/sys/powerpc/include/spr.h Thu Jan 11 09:39:38 2018 (r327814) @@ -199,6 +199,9 @@ #define FSL_E300C3 0x8085 #define FSL_E300C4 0x8086 +#define SPR_LPCR 0x13e /* Logical Partitioning Control */ +#define LPCR_LPES 0x008 /* Bit 60 */ + #define SPR_EPCR 0x133 #define EPCR_EXTGS 0x80000000 #define EPCR_DTLBGS 0x40000000 Modified: head/sys/powerpc/powernv/platform_powernv.c ============================================================================== --- head/sys/powerpc/powernv/platform_powernv.c Thu Jan 11 09:34:33 2018 (r327813) +++ head/sys/powerpc/powernv/platform_powernv.c Thu Jan 11 09:39:38 2018 (r327814) @@ -118,6 +118,9 @@ powernv_attach(platform_t plat) cpu_idle_hook = powernv_cpu_idle; + /* Direct interrupts to SRR instead of HSRR */ + mtspr(SPR_LPCR, mfspr(SPR_LPCR) | LPCR_LPES); + return (0); } From owner-svn-src-head@freebsd.org Thu Jan 11 09:42:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2756FE7AC44; Thu, 11 Jan 2018 09:42:26 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD32063A3B; Thu, 11 Jan 2018 09:42:25 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CFA213305; Thu, 11 Jan 2018 09:42:25 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0B9gOUP036448; Thu, 11 Jan 2018 09:42:24 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0B9gOMd036447; Thu, 11 Jan 2018 09:42:24 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201801110942.w0B9gOMd036447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Thu, 11 Jan 2018 09:42:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327815 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 327815 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 09:42:26 -0000 Author: wma Date: Thu Jan 11 09:42:24 2018 New Revision: 327815 URL: https://svnweb.freebsd.org/changeset/base/327815 Log: PowerNV: add buffer for OPAL console Avoid the lock in vtophys() by providing a static direct-mapped spinlock- protected output buffer to use when the console driver cannot acquire locks for some reason. This allows the idle thread to use printf() (e.g. the SMP startup messages) without crashing the kernel. Created by: Nathan Whitehorn Submitted by: Wojciech Macek Sponsored by: FreeBSD Foundation Modified: head/sys/powerpc/powernv/opal_console.c Modified: head/sys/powerpc/powernv/opal_console.c ============================================================================== --- head/sys/powerpc/powernv/opal_console.c Thu Jan 11 09:39:38 2018 (r327814) +++ head/sys/powerpc/powernv/opal_console.c Thu Jan 11 09:42:24 2018 (r327815) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -72,6 +73,7 @@ struct uart_opal_softc { }; static struct uart_opal_softc *console_sc = NULL; + #if defined(KDB) static int alt_break_state; #endif @@ -127,6 +129,48 @@ static struct ttydevsw uart_opal_tty_class = { .tsw_outwakeup = uart_opal_ttyoutwakeup, }; +static struct { + char tmpbuf[16]; + uint64_t size; + struct mtx mtx; +} escapehatch; + +static void +uart_opal_real_map_outbuffer(uint64_t *bufferp, uint64_t *lenp) +{ + + if (!mtx_initialized(&escapehatch.mtx)) + mtx_init(&escapehatch.mtx, "uart_opal", NULL, MTX_SPIN | MTX_QUIET | + MTX_NOWITNESS); + + if (!pmap_bootstrapped) + return; + + if (TD_IS_IDLETHREAD(curthread)) { + escapehatch.size = *(uint64_t *)(*lenp) = + min(sizeof(escapehatch.tmpbuf), *(uint64_t *)(*lenp)); + mtx_lock_spin(&escapehatch.mtx); + memcpy(escapehatch.tmpbuf, (void *)(*bufferp), *(uint64_t *)(*lenp)); + *bufferp = (uint64_t)escapehatch.tmpbuf; + *lenp = (uint64_t)&escapehatch.size; + } + + *bufferp = vtophys(*bufferp); + *lenp = vtophys(*lenp); +} + +static void +uart_opal_real_unmap_outbuffer(uint64_t lenp, uint64_t *origlen) +{ + + if (!pmap_bootstrapped || !TD_IS_IDLETHREAD(curthread)) + return; + + mtx_assert(&escapehatch.mtx, MA_OWNED); + *origlen = escapehatch.size; + mtx_unlock_spin(&escapehatch.mtx); +} + static int uart_opal_probe_node(struct uart_opal_softc *sc) { @@ -231,6 +275,7 @@ uart_opal_attach(device_t dev) MTX_SPIN | MTX_QUIET | MTX_NOWITNESS); if (console_sc != NULL && console_sc->vtermid == sc->vtermid) { + device_printf(dev, "console\n"); sc->outseqno = console_sc->outseqno; console_sc = sc; sprintf(uart_opal_consdev.cn_name, "ttyu%r", unit); @@ -332,25 +377,20 @@ static int uart_opal_put(struct uart_opal_softc *sc, void *buffer, size_t bufsize) { uint16_t seqno; - uint64_t len = bufsize; + uint64_t len; char cbuf[16]; int err; uint64_t olen = (uint64_t)&len; uint64_t obuf = (uint64_t)cbuf; - if (pmap_bootstrapped) - olen = vtophys(&len); - if (sc->protocol == OPAL_RAW) { - if (pmap_bootstrapped) - obuf = vtophys(buffer); - else - obuf = (uint64_t)(buffer); + obuf = (uint64_t)buffer; + len = bufsize; + uart_opal_real_map_outbuffer(&obuf, &olen); err = opal_call(OPAL_CONSOLE_WRITE, sc->vtermid, olen, obuf); + uart_opal_real_unmap_outbuffer(olen, &len); } else { - if (pmap_bootstrapped) - obuf = vtophys(cbuf); uart_lock(&sc->sc_mtx); if (bufsize > 12) bufsize = 12; @@ -361,7 +401,11 @@ uart_opal_put(struct uart_opal_softc *sc, void *buffer cbuf[3] = seqno & 0xff; memcpy(&cbuf[4], buffer, bufsize); len = 4 + bufsize; + + uart_opal_real_map_outbuffer(&obuf, &olen); err = opal_call(OPAL_CONSOLE_WRITE, sc->vtermid, olen, obuf); + uart_opal_real_unmap_outbuffer(olen, &len); + uart_unlock(&sc->sc_mtx); len -= 4; From owner-svn-src-head@freebsd.org Thu Jan 11 12:07:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01A24EA53C9; Thu, 11 Jan 2018 12:07:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CF5D56C8E7; Thu, 11 Jan 2018 12:07:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CE7F149CC; Thu, 11 Jan 2018 12:07:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BC7O2v094921; Thu, 11 Jan 2018 12:07:24 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BC7O9p094919; Thu, 11 Jan 2018 12:07:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801111207.w0BC7O9p094919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 11 Jan 2018 12:07:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327816 - in head/sys: amd64/amd64 i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 327816 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 12:07:26 -0000 Author: kib Date: Thu Jan 11 12:07:24 2018 New Revision: 327816 URL: https://svnweb.freebsd.org/changeset/base/327816 Log: Update comment explaining the check, to reality. Discussed with: jhb Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/amd64/amd64/support.S head/sys/i386/i386/support.s Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Thu Jan 11 09:42:24 2018 (r327815) +++ head/sys/amd64/amd64/support.S Thu Jan 11 12:07:24 2018 (r327816) @@ -249,12 +249,10 @@ ENTRY(copyout) jz done_copyout /* - * Check explicitly for non-user addresses. If 486 write protection - * is being used, this check is essential because we are in kernel - * mode so the h/w does not provide any protection against writing - * kernel addresses. + * Check explicitly for non-user addresses. This check is essential + * because it prevents usermode from writing into kernel. We do not + * verify that user did not specified a rogue address anywhere else. */ - /* * First, prevent address wrapping. */ Modified: head/sys/i386/i386/support.s ============================================================================== --- head/sys/i386/i386/support.s Thu Jan 11 09:42:24 2018 (r327815) +++ head/sys/i386/i386/support.s Thu Jan 11 12:07:24 2018 (r327816) @@ -291,12 +291,10 @@ ENTRY(copyout) jz done_copyout /* - * Check explicitly for non-user addresses. If 486 write protection - * is being used, this check is essential because we are in kernel - * mode so the h/w does not provide any protection against writing - * kernel addresses. + * Check explicitly for non-user addresses. This check is essential + * because it prevents usermode from writing into kernel. We do not + * verify that user did not specified a rogue address anywhere else. */ - /* * First, prevent address wrapping. */ From owner-svn-src-head@freebsd.org Thu Jan 11 12:28:10 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2AFEDE5BC89; Thu, 11 Jan 2018 12:28:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 051EE6D7FF; Thu, 11 Jan 2018 12:28:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BEC914D54; Thu, 11 Jan 2018 12:28:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BCS9P8003379; Thu, 11 Jan 2018 12:28:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BCS9Mu003377; Thu, 11 Jan 2018 12:28:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801111228.w0BCS9Mu003377@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 11 Jan 2018 12:28:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327817 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 327817 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 12:28:10 -0000 Author: kib Date: Thu Jan 11 12:28:08 2018 New Revision: 327817 URL: https://svnweb.freebsd.org/changeset/base/327817 Log: Rename COMMON_TSS_RSP0 to TSS_RSP0. The symbol is just an offset in the hardware TSS structure, it is not limited to the common_tss instance. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/amd64/amd64/cpu_switch.S head/sys/amd64/amd64/genassym.c Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Thu Jan 11 12:07:24 2018 (r327816) +++ head/sys/amd64/amd64/cpu_switch.S Thu Jan 11 12:28:08 2018 (r327817) @@ -215,7 +215,7 @@ done_tss: movq %r8,PCPU(RSP0) movq %r8,PCPU(CURPCB) /* Update the TSS_RSP0 pointer for the next interrupt */ - movq %r8,COMMON_TSS_RSP0(%rdx) + movq %r8,TSS_RSP0(%rdx) movq %r12,PCPU(CURTHREAD) /* into next thread */ /* Test if debug registers should be restored. */ Modified: head/sys/amd64/amd64/genassym.c ============================================================================== --- head/sys/amd64/amd64/genassym.c Thu Jan 11 12:07:24 2018 (r327816) +++ head/sys/amd64/amd64/genassym.c Thu Jan 11 12:28:08 2018 (r327817) @@ -153,7 +153,7 @@ ASSYM(PCB_FULL_IRET, PCB_FULL_IRET); ASSYM(PCB_DBREGS, PCB_DBREGS); ASSYM(PCB_32BIT, PCB_32BIT); -ASSYM(COMMON_TSS_RSP0, offsetof(struct amd64tss, tss_rsp0)); +ASSYM(TSS_RSP0, offsetof(struct amd64tss, tss_rsp0)); ASSYM(TF_R15, offsetof(struct trapframe, tf_r15)); ASSYM(TF_R14, offsetof(struct trapframe, tf_r14)); From owner-svn-src-head@freebsd.org Thu Jan 11 12:40:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C811CE5C5E1; Thu, 11 Jan 2018 12:40:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A24006E0B2; Thu, 11 Jan 2018 12:40:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BDC4314F32; Thu, 11 Jan 2018 12:40:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BCehwK008192; Thu, 11 Jan 2018 12:40:43 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BCehuj008189; Thu, 11 Jan 2018 12:40:43 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801111240.w0BCehuj008189@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 11 Jan 2018 12:40:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327818 - in head/sys/amd64: amd64 include X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys/amd64: amd64 include X-SVN-Commit-Revision: 327818 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 12:40:44 -0000 Author: kib Date: Thu Jan 11 12:40:43 2018 New Revision: 327818 URL: https://svnweb.freebsd.org/changeset/base/327818 Log: Move the hardware setup for fast syscalls into a common function. Discussed with: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/include/md_var.h Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Thu Jan 11 12:28:08 2018 (r327817) +++ head/sys/amd64/amd64/machdep.c Thu Jan 11 12:40:43 2018 (r327818) @@ -1512,6 +1512,22 @@ amd64_kdb_init(void) #endif } +/* Set up the fast syscall stuff */ +void +amd64_conf_fast_syscall(void) +{ + uint64_t msr; + + msr = rdmsr(MSR_EFER) | EFER_SCE; + wrmsr(MSR_EFER, msr); + wrmsr(MSR_LSTAR, (u_int64_t)IDTVEC(fast_syscall)); + wrmsr(MSR_CSTAR, (u_int64_t)IDTVEC(fast_syscall32)); + msr = ((u_int64_t)GSEL(GCODE_SEL, SEL_KPL) << 32) | + ((u_int64_t)GSEL(GUCODE32_SEL, SEL_UPL) << 48); + wrmsr(MSR_STAR, msr); + wrmsr(MSR_SF_MASK, PSL_NT | PSL_T | PSL_I | PSL_C | PSL_D); +} + u_int64_t hammer_time(u_int64_t modulep, u_int64_t physfree) { @@ -1520,7 +1536,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) struct pcpu *pc; struct nmi_pcpu *np; struct xstate_hdr *xhdr; - u_int64_t msr; char *env; size_t kstack0_sz; int late_console; @@ -1663,15 +1678,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) gsel_tss = GSEL(GPROC0_SEL, SEL_KPL); ltr(gsel_tss); - /* Set up the fast syscall stuff */ - msr = rdmsr(MSR_EFER) | EFER_SCE; - wrmsr(MSR_EFER, msr); - wrmsr(MSR_LSTAR, (u_int64_t)IDTVEC(fast_syscall)); - wrmsr(MSR_CSTAR, (u_int64_t)IDTVEC(fast_syscall32)); - msr = ((u_int64_t)GSEL(GCODE_SEL, SEL_KPL) << 32) | - ((u_int64_t)GSEL(GUCODE32_SEL, SEL_UPL) << 48); - wrmsr(MSR_STAR, msr); - wrmsr(MSR_SF_MASK, PSL_NT|PSL_T|PSL_I|PSL_C|PSL_D); + amd64_conf_fast_syscall(); /* * Temporary forge some valid pointer to PCB, for exception Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Thu Jan 11 12:28:08 2018 (r327817) +++ head/sys/amd64/amd64/mp_machdep.c Thu Jan 11 12:40:43 2018 (r327818) @@ -89,8 +89,6 @@ extern struct pcpu __pcpu[]; char *doublefault_stack; char *nmi_stack; -extern inthand_t IDTVEC(fast_syscall), IDTVEC(fast_syscall32); - /* * Local data and functions. */ @@ -190,7 +188,7 @@ init_secondary(void) { struct pcpu *pc; struct nmi_pcpu *np; - u_int64_t msr, cr0; + u_int64_t cr0; int cpu, gsel_tss, x; struct region_descriptor ap_gdt; @@ -265,15 +263,7 @@ init_secondary(void) cr0 &= ~(CR0_CD | CR0_NW | CR0_EM); load_cr0(cr0); - /* Set up the fast syscall stuff */ - msr = rdmsr(MSR_EFER) | EFER_SCE; - wrmsr(MSR_EFER, msr); - wrmsr(MSR_LSTAR, (u_int64_t)IDTVEC(fast_syscall)); - wrmsr(MSR_CSTAR, (u_int64_t)IDTVEC(fast_syscall32)); - msr = ((u_int64_t)GSEL(GCODE_SEL, SEL_KPL) << 32) | - ((u_int64_t)GSEL(GUCODE32_SEL, SEL_UPL) << 48); - wrmsr(MSR_STAR, msr); - wrmsr(MSR_SF_MASK, PSL_NT|PSL_T|PSL_I|PSL_C|PSL_D); + amd64_conf_fast_syscall(); /* signal our startup to the BSP. */ mp_naps++; Modified: head/sys/amd64/include/md_var.h ============================================================================== --- head/sys/amd64/include/md_var.h Thu Jan 11 12:28:08 2018 (r327817) +++ head/sys/amd64/include/md_var.h Thu Jan 11 12:40:43 2018 (r327818) @@ -42,6 +42,7 @@ extern int hw_lower_amd64_sharedpage; struct savefpu; struct sysentvec; +void amd64_conf_fast_syscall(void); void amd64_db_resume_dbreg(void); void amd64_lower_shared_page(struct sysentvec *); void amd64_syscall(struct thread *td, int traced); From owner-svn-src-head@freebsd.org Thu Jan 11 12:54:35 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 16B8DE5D3F6; Thu, 11 Jan 2018 12:54:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E5EB26EA5A; Thu, 11 Jan 2018 12:54:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A97A15247; Thu, 11 Jan 2018 12:54:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BCsYub016213; Thu, 11 Jan 2018 12:54:34 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BCsYvQ016212; Thu, 11 Jan 2018 12:54:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801111254.w0BCsYvQ016212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 11 Jan 2018 12:54:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327819 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 327819 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 12:54:35 -0000 Author: kib Date: Thu Jan 11 12:54:33 2018 New Revision: 327819 URL: https://svnweb.freebsd.org/changeset/base/327819 Log: Do not clear %RFLAGS.DF on fast syscall entry. Hardware already did it for us due to the mask loaded into the MSR_SF_MASK msr register. Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D13838 Modified: head/sys/amd64/amd64/exception.S Modified: head/sys/amd64/amd64/exception.S ============================================================================== --- head/sys/amd64/amd64/exception.S Thu Jan 11 12:40:43 2018 (r327818) +++ head/sys/amd64/amd64/exception.S Thu Jan 11 12:54:33 2018 (r327819) @@ -410,7 +410,6 @@ IDTVEC(fast_syscall) movq %r14,TF_R14(%rsp) /* C preserved */ movq %r15,TF_R15(%rsp) /* C preserved */ movl $TF_HASSEGS,TF_FLAGS(%rsp) - cld FAKE_MCOUNT(TF_RIP(%rsp)) movq PCPU(CURTHREAD),%rdi movq %rsp,TD_FRAME(%rdi) From owner-svn-src-head@freebsd.org Thu Jan 11 13:22:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0C28E60FBB; Thu, 11 Jan 2018 13:22:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C81826FCB2; Thu, 11 Jan 2018 13:22:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 05B9815706; Thu, 11 Jan 2018 13:22:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BDMDAs028232; Thu, 11 Jan 2018 13:22:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BDMDvk028230; Thu, 11 Jan 2018 13:22:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801111322.w0BDMDvk028230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 11 Jan 2018 13:22:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327820 - in head/sys: amd64/amd64 i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 327820 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 13:22:15 -0000 Author: kib Date: Thu Jan 11 13:22:13 2018 New Revision: 327820 URL: https://svnweb.freebsd.org/changeset/base/327820 Log: Remove redundand CLD instructions. We already clear %RFLAGS.DF on the kernel entry due to the compiler's ABI requirements. Suggested by: jhb Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/amd64/amd64/support.S head/sys/i386/i386/support.s Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Thu Jan 11 12:54:33 2018 (r327819) +++ head/sys/amd64/amd64/support.S Thu Jan 11 13:22:13 2018 (r327820) @@ -50,7 +50,6 @@ ENTRY(bzero) movq %rsi,%rcx xorl %eax,%eax shrq $3,%rcx - cld rep stosq movq %rsi,%rcx @@ -100,7 +99,6 @@ ENTRY(bcmp) PUSH_FRAME_POINTER movq %rdx,%rcx shrq $3,%rcx - cld /* compare forwards */ repe cmpsq jne 1f @@ -132,7 +130,6 @@ ENTRY(bcopy) jb 1f shrq $3,%rcx /* copy by 64-bit words */ - cld /* nope, copy forwards */ rep movsq movq %rdx,%rcx @@ -171,7 +168,6 @@ ENTRY(memcpy) movq %rdi,%rax movq %rdx,%rcx shrq $3,%rcx /* copy by 64-bit words */ - cld /* copy forwards */ rep movsq movq %rdx,%rcx @@ -218,7 +214,6 @@ ENTRY(fillw) movq %rdi,%rax movq %rsi,%rdi movq %rdx,%rcx - cld rep stosw POP_FRAME_POINTER @@ -274,7 +269,6 @@ ENTRY(copyout) movq %rdx,%rcx shrq $3,%rcx - cld rep movsq movb %dl,%cl @@ -323,7 +317,6 @@ ENTRY(copyin) movq %rdx,%rcx movb %cl,%al shrq $3,%rcx /* copy longword-wise */ - cld rep movsq movb %al,%cl @@ -620,7 +613,6 @@ ENTRY(copyinstr) movq %rax,%r8 1: incq %rdx - cld 2: decq %rdx @@ -671,7 +663,6 @@ ENTRY(copystr) xchgq %rdi,%rsi incq %rdx - cld 1: decq %rdx jz 4f Modified: head/sys/i386/i386/support.s ============================================================================== --- head/sys/i386/i386/support.s Thu Jan 11 12:54:33 2018 (r327819) +++ head/sys/i386/i386/support.s Thu Jan 11 13:22:13 2018 (r327820) @@ -50,7 +50,6 @@ ENTRY(bzero) movl 12(%esp),%ecx xorl %eax,%eax shrl $2,%ecx - cld rep stosl movl 12(%esp),%ecx @@ -90,7 +89,6 @@ ENTRY(i686_pagezero) movl 12(%esp),%edi movl $1024,%ecx - cld ALIGN_TEXT 1: @@ -141,7 +139,6 @@ ENTRY(fillw) movl 8(%esp),%eax movl 12(%esp),%edi movl 16(%esp),%ecx - cld rep stosw popl %edi @@ -158,7 +155,6 @@ ENTRY(bcopyb) subl %esi,%eax cmpl %ecx,%eax /* overlapping && src < dst? */ jb 1f - cld /* nope, copy forwards */ rep movsb popl %edi @@ -199,7 +195,6 @@ ENTRY(bcopy) jb 1f shrl $2,%ecx /* copy by 32-bit words */ - cld /* nope, copy forwards */ rep movsl movl 16(%ebp),%ecx @@ -245,7 +240,6 @@ ENTRY(memcpy) movl 20(%esp),%ecx movl %edi,%eax shrl $2,%ecx /* copy by 32-bit words */ - cld /* nope, copy forwards */ rep movsl movl 20(%esp),%ecx @@ -314,7 +308,6 @@ ENTRY(copyout) movl %ebx,%ecx shrl $2,%ecx - cld rep movsl movb %bl,%cl @@ -365,7 +358,6 @@ ENTRY(copyin) movb %cl,%al shrl $2,%ecx /* copy longword-wise */ - cld rep movsl movb %al,%cl @@ -582,7 +574,6 @@ ENTRY(copyinstr) movl %eax,20(%esp) 1: incl %edx - cld 2: decl %edx @@ -635,7 +626,6 @@ ENTRY(copystr) movl 16(%esp),%edi /* %edi = to */ movl 20(%esp),%edx /* %edx = maxlen */ incl %edx - cld 1: decl %edx jz 4f @@ -675,7 +665,6 @@ ENTRY(bcmp) movl %edx,%ecx shrl $2,%ecx - cld /* compare forwards */ repe cmpsl jne 1f From owner-svn-src-head@freebsd.org Thu Jan 11 13:37:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B965E620CB; Thu, 11 Jan 2018 13:37:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 77F0D708B3; Thu, 11 Jan 2018 13:37:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD9061591F; Thu, 11 Jan 2018 13:37:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BDbjpm033832; Thu, 11 Jan 2018 13:37:45 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BDbjDj033831; Thu, 11 Jan 2018 13:37:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801111337.w0BDbjDj033831@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 11 Jan 2018 13:37:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327821 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 327821 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 13:37:49 -0000 Author: kib Date: Thu Jan 11 13:37:45 2018 New Revision: 327821 URL: https://svnweb.freebsd.org/changeset/base/327821 Log: Softlink inodes can own buffers with dependencies. At least, softlinks longer than 120 bytes have data fragments. Submitted by: mckusick MFC after: 5 days Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Thu Jan 11 13:22:13 2018 (r327820) +++ head/sys/ufs/ffs/ffs_softdep.c Thu Jan 11 13:37:45 2018 (r327821) @@ -13922,7 +13922,8 @@ retry: VI_UNLOCK(vp); if (mp == NULL) goto retry; - } else if (vp->v_type == VREG || vp->v_type == VDIR) { + } else if (vp->v_type == VREG || vp->v_type == VDIR || + vp->v_type == VLNK) { mp = vp->v_mount; } else { return (NULL); From owner-svn-src-head@freebsd.org Thu Jan 11 13:57:31 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2B43E63F78; Thu, 11 Jan 2018 13:57:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ACDAD71FA4; Thu, 11 Jan 2018 13:57:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E8DA615CA1; Thu, 11 Jan 2018 13:57:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BDvUgf042934; Thu, 11 Jan 2018 13:57:30 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BDvUdW042933; Thu, 11 Jan 2018 13:57:30 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801111357.w0BDvUdW042933@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 11 Jan 2018 13:57:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327822 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 327822 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 13:57:31 -0000 Author: kib Date: Thu Jan 11 13:57:30 2018 New Revision: 327822 URL: https://svnweb.freebsd.org/changeset/base/327822 Log: Skip IRELATIVE relocations when loader processes ELF files. ifuncs can be only called in the (early boot) kernel environment, so postpone resolving until early stage of the kernel boot. This commit is performed in advance to make loaders on most machines updated before ifuncs appear in the kernels. Reviewed by: emaste, jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D13838 Modified: head/stand/common/reloc_elf.c Modified: head/stand/common/reloc_elf.c ============================================================================== --- head/stand/common/reloc_elf.c Thu Jan 11 13:37:45 2018 (r327821) +++ head/stand/common/reloc_elf.c Thu Jan 11 13:57:30 2018 (r327822) @@ -115,6 +115,7 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr /* XXX, definitions not available on i386. */ #define R_X86_64_64 1 #define R_X86_64_RELATIVE 8 +#define R_X86_64_IRELATIVE 37 switch (rtype) { case R_X86_64_64: /* S + A */ @@ -129,6 +130,9 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr val = addr; *where = val; break; + case R_X86_64_IRELATIVE: + /* leave it to kernel */ + break; default: printf("\nunhandled relocation type %u\n", (u_int)rtype); return (EFTYPE); @@ -173,6 +177,7 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr #define R_386_32 1 /* Add symbol value. */ #define R_386_GLOB_DAT 6 /* Set GOT entry to data address. */ #define R_386_RELATIVE 8 /* Add load address of shared object. */ +#define R_386_IRELATIVE 42 switch (rtype) { case R_386_RELATIVE: @@ -185,6 +190,9 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr return (ESRCH); val = addr + addend; *where = val; + break; + case R_386_IRELATIVE: + /* leave it to kernel */ break; default: printf("\nunhandled relocation type %u\n", (u_int)rtype); From owner-svn-src-head@freebsd.org Thu Jan 11 14:03:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84C91E6470D; Thu, 11 Jan 2018 14:03:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6057C725B8; Thu, 11 Jan 2018 14:03:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 87F1915E61; Thu, 11 Jan 2018 14:03:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BE35Of047104; Thu, 11 Jan 2018 14:03:05 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BE353l047103; Thu, 11 Jan 2018 14:03:05 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801111403.w0BE353l047103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 11 Jan 2018 14:03:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327823 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 327823 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 14:03:06 -0000 Author: emaste Date: Thu Jan 11 14:03:05 2018 New Revision: 327823 URL: https://svnweb.freebsd.org/changeset/base/327823 Log: Enable ld.lld as bootstrap linker by default on i386 Akin to r327783 for amd64. lld has been usable for amd64 for quite some time, but a couple of issues remained that affected i386. These were recently addressed upstream in lld and merged into FreeBSD (r326831, r326879, r326897, r326957), so we can now use ld.lld on i386 as well. Similarly to amd64 this change enables lld only as the bootstrap linker (used to link the kernel and userland libraries and executables), while GNU ld.bfd is still installed as /usr/bin/ld and used for ports builds. The ports collection is essentially ready to use lld as the system linker for amd64, but many ports still have trouble with lld on i386, because lld defaults to -ztext, disallowing relocations against readonly segments. Thus switching the system linker (WITH_LLD_IS_LD) will happen later on a per-arch basis. Relnotes: Yes Sponsored by: The FreeBSD Foundation Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Thu Jan 11 13:57:30 2018 (r327822) +++ head/share/mk/src.opts.mk Thu Jan 11 14:03:05 2018 (r327823) @@ -253,7 +253,7 @@ __DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND .endif .if ${__T} == "aarch64" __DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD -.elif ${__T} == "amd64" +.elif ${__T} == "amd64" || ${__T} == "i386" __DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP __DEFAULT_NO_OPTIONS+=LLD_IS_LD .else From owner-svn-src-head@freebsd.org Thu Jan 11 14:21:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E12B1E65829; Thu, 11 Jan 2018 14:21:08 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BC39C73241; Thu, 11 Jan 2018 14:21:08 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E038916034; Thu, 11 Jan 2018 14:21:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BEL7RM056753; Thu, 11 Jan 2018 14:21:07 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BEL7pP056752; Thu, 11 Jan 2018 14:21:07 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801111421.w0BEL7pP056752@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 11 Jan 2018 14:21:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327824 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 327824 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 14:21:09 -0000 Author: emaste Date: Thu Jan 11 14:21:07 2018 New Revision: 327824 URL: https://svnweb.freebsd.org/changeset/base/327824 Log: regen src.conf.5 after r327823, WITH_LLD_BOOTSTRAP for i386 Sponsored by: The FreeBSD Foundation Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Thu Jan 11 14:03:05 2018 (r327823) +++ head/share/man/man5/src.conf.5 Thu Jan 11 14:21:07 2018 (r327824) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd January 10, 2018 +.Dd January 11, 2018 .Dt SRC.CONF 5 .Os .Sh NAME @@ -970,12 +970,12 @@ To be able to build the system, either Binutils or LLD enabled unless an alternate linker is provided via XLD. .Pp This is a default setting on -arm/arm, arm/armeb, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. +arm/arm, arm/armeb, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. .It Va WITH_LLD_BOOTSTRAP Set to build the LLD linker during the bootstrap phase of the build. .Pp This is a default setting on -amd64/amd64 and arm64/aarch64. +amd64/amd64, arm64/aarch64 and i386/i386. .It Va WITHOUT_LLD_IS_LD Set to use GNU binutils ld as the system linker, instead of LLVM's LLD. .Pp From owner-svn-src-head@freebsd.org Thu Jan 11 14:21:10 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A08FCE65839; Thu, 11 Jan 2018 14:21:10 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-it0-f45.google.com (mail-it0-f45.google.com [209.85.214.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7168E73246; Thu, 11 Jan 2018 14:21:10 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-it0-f45.google.com with SMTP id f190so4629401ita.5; Thu, 11 Jan 2018 06:21:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=1fwq4FNBtqU7kZ4qgJMWLiriBa0a7z93je3y1uXXNdE=; b=KxQLn8CQWcNtRkUOnhZKPGAt8NnqMtWWumwe5rnuGUtLDKndkS577L2lloC9e2daP9 UY+OU6tIO7GYMyI1+11FIbZncMUCtoKBPKDxpI7twqr7lwsugWgf9QJV3ZbUtVZGWtA9 Zq+9r1UzusnHbYJZIvWOx4rlG/197we3FRFCRhehDiPovIpL+WrIXDDYMVAA0b//vt9Z dvVzXo4bPF6ZYPWoDh+iRUInQ9ye3cjPFRteNECs6rqLqi8P3D9bp5rDsLdncyeOrfAc 3hIPa2VADNBU2V1o869IcX9qI8gZJAlCU8l2AGHHsBUFSJe0dhyxve9z/PA9nATqn0AD pGWQ== X-Gm-Message-State: AKwxytcePW6njj/8QrCVbBqpwoNwM2OWmQupQuSr6ygln96k+Yrpeipk 9/4s9E+pooJFxzplzsQvT9cslc1J X-Google-Smtp-Source: ACJfBotaw8A50/SqpAZuoGThM+3nP9jxCTi74WhF4t3TLY4mxmPEJ0Tyuk2J/nm6WR+NebBr6w46qQ== X-Received: by 10.36.219.195 with SMTP id c186mr1222073itg.61.1515680468610; Thu, 11 Jan 2018 06:21:08 -0800 (PST) Received: from mail-it0-f42.google.com (mail-it0-f42.google.com. [209.85.214.42]) by smtp.gmail.com with ESMTPSA id w133sm707360itc.44.2018.01.11.06.21.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jan 2018 06:21:08 -0800 (PST) Received: by mail-it0-f42.google.com with SMTP id f143so4654688itb.0; Thu, 11 Jan 2018 06:21:08 -0800 (PST) X-Received: by 10.107.5.142 with SMTP id 136mr22312069iof.239.1515680467890; Thu, 11 Jan 2018 06:21:07 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.149.147 with HTTP; Thu, 11 Jan 2018 06:20:47 -0800 (PST) In-Reply-To: References: <201801110536.w0B5aDJZ032451@repo.freebsd.org> From: Kyle Evans Date: Thu, 11 Jan 2018 08:20:47 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r327806 - in head: etc/mtree usr.bin/awk usr.bin/awk/tests To: Warner Losh Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 14:21:10 -0000 On Wed, Jan 10, 2018 at 11:53 PM, Warner Losh wrote: > On Wed, Jan 10, 2018 at 10:36 PM, Kyle Evans wrote: > >> Author: kevans >> Date: Thu Jan 11 05:36:13 2018 >> New Revision: 327806 >> URL: https://svnweb.freebsd.org/changeset/base/327806 >> >> Log: >> awk(1): Add necessary bits for connecting tests, but leave disconnected >> >> The NetBSD test suite has 24 tests for awk, and we pass exactly 4 of >> them. >> Add the necessary pieces for interested parties to easily connect the >> tests and run them, but leave them disconnected for the time being. >> >> Some of these tests outright segfault in our awk, others just exhibit the >> wrong behavior. >> > > How many tests does NetBSD's awk pass? At least one of their patches causes > our .m compiler awk script to fail, if I've applied it correctly. Presumably all of them, but I've not had a chance to check. Some of them were motivated by bugs they had previously, others just look like non-trivial awk usage that I wouldn't think would break, such as setting two-character RS. > > Warner > From owner-svn-src-head@freebsd.org Thu Jan 11 14:29:30 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9090DE660BC; Thu, 11 Jan 2018 14:29:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A84A73A51; Thu, 11 Jan 2018 14:29:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9D6C161CC; Thu, 11 Jan 2018 14:29:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BETTp6058770; Thu, 11 Jan 2018 14:29:29 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BETTUl058769; Thu, 11 Jan 2018 14:29:29 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801111429.w0BETTUl058769@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 11 Jan 2018 14:29:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327825 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 327825 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 14:29:30 -0000 Author: kevans Date: Thu Jan 11 14:29:29 2018 New Revision: 327825 URL: https://svnweb.freebsd.org/changeset/base/327825 Log: if_awg: Support new emac bindings Highlights of the new bindings: - ahb clock is specified as 'stmmaceth' - The PHY to be used is now specified as phy-handle - We must now check the parent of the node phy-handle points to in order to discover if we're using internal PHY. - The ephy clk/reset will be specified on the PHY node, not the emac node. Care has been taken to ensure that we remain compatible with the older bindings that we were previously using. Tested on: Pine64 (A64, old bindings) Tested on: Pine64-LTS (A64, new bindings) [manu] Tested on: OrangePi-One (H3, internal PHY) [manu] Tested on: NanoPi M1 Plus (H3, external PHY) [manu] Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D13777 Modified: head/sys/arm/allwinner/if_awg.c Modified: head/sys/arm/allwinner/if_awg.c ============================================================================== --- head/sys/arm/allwinner/if_awg.c Thu Jan 11 14:21:07 2018 (r327824) +++ head/sys/arm/allwinner/if_awg.c Thu Jan 11 14:29:29 2018 (r327825) @@ -223,6 +223,8 @@ static void awg_txeof(struct awg_softc *sc); static uint32_t syscon_read_emac_clk_reg(device_t dev); static void syscon_write_emac_clk_reg(device_t dev, uint32_t val); +static phandle_t awg_get_phy_node(device_t dev); +static bool awg_has_internal_phy(device_t dev); static int awg_miibus_readreg(device_t dev, int phy, int reg) @@ -1186,6 +1188,35 @@ syscon_write_emac_clk_reg(device_t dev, uint32_t val) bus_write_4(sc->res[_RES_SYSCON], 0, val); } +static phandle_t +awg_get_phy_node(device_t dev) +{ + phandle_t node; + pcell_t phy_handle; + + node = ofw_bus_get_node(dev); + if (OF_getencprop(node, "phy-handle", (void *)&phy_handle, + sizeof(phy_handle)) <= 0) + return (0); + + return (OF_node_from_xref(phy_handle)); +} + +static bool +awg_has_internal_phy(device_t dev) +{ + phandle_t node, phy_node; + + node = ofw_bus_get_node(dev); + /* Legacy binding */ + if (OF_hasprop(node, "allwinner,use-internal-phy")) + return (true); + + phy_node = awg_get_phy_node(dev); + return (phy_node != 0 && ofw_bus_node_is_compatible(OF_parent(phy_node), + "allwinner,sun8i-h3-mdio-internal") != 0); +} + static int awg_setup_phy(device_t dev) { @@ -1241,7 +1272,7 @@ awg_setup_phy(device_t dev) } if (sc->type == EMAC_H3) { - if (OF_hasprop(node, "allwinner,use-internal-phy")) { + if (awg_has_internal_phy(dev)) { reg |= EMAC_CLK_EPHY_SELECT; reg &= ~EMAC_CLK_EPHY_SHUTDOWN; if (OF_hasprop(node, @@ -1308,7 +1339,7 @@ static int awg_setup_extres(device_t dev) { struct awg_softc *sc; - phandle_t node; + phandle_t node, phy_node; hwreset_t rst_ahb, rst_ephy; clk_t clk_ahb, clk_ephy; regulator_t reg; @@ -1320,22 +1351,37 @@ awg_setup_extres(device_t dev) clk_ahb = clk_ephy = NULL; reg = NULL; node = ofw_bus_get_node(dev); + phy_node = awg_get_phy_node(dev); + if (phy_node == 0 && OF_hasprop(node, "phy-handle")) { + error = ENXIO; + device_printf(dev, "cannot get phy handle\n"); + goto fail; + } + /* Get AHB clock and reset resources */ - error = hwreset_get_by_ofw_name(dev, 0, "ahb", &rst_ahb); + error = hwreset_get_by_ofw_name(dev, 0, "stmmaceth", &rst_ahb); + if (error != 0) + error = hwreset_get_by_ofw_name(dev, 0, "ahb", &rst_ahb); if (error != 0) { device_printf(dev, "cannot get ahb reset\n"); goto fail; } if (hwreset_get_by_ofw_name(dev, 0, "ephy", &rst_ephy) != 0) - rst_ephy = NULL; - error = clk_get_by_ofw_name(dev, 0, "ahb", &clk_ahb); + if (phy_node == 0 || hwreset_get_by_ofw_idx(dev, phy_node, 0, + &rst_ephy) != 0) + rst_ephy = NULL; + error = clk_get_by_ofw_name(dev, 0, "stmmaceth", &clk_ahb); + if (error != 0) + error = clk_get_by_ofw_name(dev, 0, "ahb", &clk_ahb); if (error != 0) { device_printf(dev, "cannot get ahb clock\n"); goto fail; } if (clk_get_by_ofw_name(dev, 0, "ephy", &clk_ephy) != 0) - clk_ephy = NULL; + if (phy_node == 0 || clk_get_by_ofw_index(dev, phy_node, 0, + &clk_ephy) != 0) + clk_ephy = NULL; if (OF_hasprop(node, "syscon") && syscon_get_by_ofw_property(dev, node, "syscon", &sc->syscon) != 0) { From owner-svn-src-head@freebsd.org Thu Jan 11 15:01:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5C53E67E8B; Thu, 11 Jan 2018 15:01:49 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 90F9D74FCA; Thu, 11 Jan 2018 15:01:49 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D292E1682C; Thu, 11 Jan 2018 15:01:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BF1mhs075326; Thu, 11 Jan 2018 15:01:48 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BF1mKB075325; Thu, 11 Jan 2018 15:01:48 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801111501.w0BF1mKB075325@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 11 Jan 2018 15:01:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327826 - head/usr.bin/patch X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.bin/patch X-SVN-Commit-Revision: 327826 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 15:01:49 -0000 Author: kevans Date: Thu Jan 11 15:01:48 2018 New Revision: 327826 URL: https://svnweb.freebsd.org/changeset/base/327826 Log: patch(1): Don't check for NUL bytes in Plan A Plan A mmap()'s the entire input file and operates on it in memory. The map(2) call succeeded, so we shouldn't need to bother checking for the NUL byte as long as we're within our buffer space. This was clearly intentional to match "the behavior of the original code", but it creates a discrepancy between Plan A and Plan B that doesn't seem sensible and it's not inherently wrong to allow a NUL byte. This change was motivated by the gemspec in net/rubygem-grpc failing to patch, despite the patch being generated with diff, because a NUL byte was used as a delimiter in the header briefly in an otherwise text file. An alternative was considered: to fallback to plan B if plan A won't process the entire file due to a NUL byte, but I deemed this to be the better option since plan A isn't failing due to memory limitations and will fail later on if it's really dealing with a file it shouldn't be. PR: 224842 (exp-run) Reported by: swills Reviewed by: emaste, pfg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D13738 Modified: head/usr.bin/patch/inp.c Modified: head/usr.bin/patch/inp.c ============================================================================== --- head/usr.bin/patch/inp.c Thu Jan 11 14:29:29 2018 (r327825) +++ head/usr.bin/patch/inp.c Thu Jan 11 15:01:48 2018 (r327826) @@ -213,8 +213,11 @@ plan_a(const char *filename) /* now scan the buffer and build pointer array */ iline = 1; i_ptr[iline] = i_womp; - /* test for NUL too, to maintain the behavior of the original code */ - for (s = i_womp, i = 0; i < i_size && *s != '\0'; s++, i++) { + /* + * Testing for NUL here actively breaks files that innocently use NUL + * for other reasons. mmap(2) succeeded, just scan the whole buffer. + */ + for (s = i_womp, i = 0; i < i_size; s++, i++) { if (*s == '\n') { if (iline == lines_allocated) { if (!reallocate_lines(&lines_allocated)) From owner-svn-src-head@freebsd.org Thu Jan 11 15:03:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C1B8E681DC; Thu, 11 Jan 2018 15:03:02 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 57547752F3; Thu, 11 Jan 2018 15:03:02 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9498016882; Thu, 11 Jan 2018 15:03:01 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BF31Kk075432; Thu, 11 Jan 2018 15:03:01 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BF31fw075431; Thu, 11 Jan 2018 15:03:01 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201801111503.w0BF31fw075431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Thu, 11 Jan 2018 15:03:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327827 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 327827 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 15:03:02 -0000 Author: mmel Date: Thu Jan 11 15:03:01 2018 New Revision: 327827 URL: https://svnweb.freebsd.org/changeset/base/327827 Log: Initialize CONTEXTIDR register on secondary cores by zero, not with undefined value from X1 register. MFC after: 1 month Modified: head/sys/arm64/arm64/locore.S Modified: head/sys/arm64/arm64/locore.S ============================================================================== --- head/sys/arm64/arm64/locore.S Thu Jan 11 15:01:48 2018 (r327826) +++ head/sys/arm64/arm64/locore.S Thu Jan 11 15:03:01 2018 (r327827) @@ -167,7 +167,7 @@ ENTRY(mpentry) bl drop_to_el1 /* Set the context id */ - msr contextidr_el1, x1 + msr contextidr_el1, xzr /* Load the kernel page table */ adr x24, pagetable_l0_ttbr1 From owner-svn-src-head@freebsd.org Thu Jan 11 15:25:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 148CEE6974B; Thu, 11 Jan 2018 15:25:28 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E01E57618B; Thu, 11 Jan 2018 15:25:27 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0523516BC4; Thu, 11 Jan 2018 15:25:27 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BFPQYd084194; Thu, 11 Jan 2018 15:25:26 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BFPQDn084190; Thu, 11 Jan 2018 15:25:26 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801111525.w0BFPQDn084190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 11 Jan 2018 15:25:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327828 - in head/sys/dev: e1000 ixl X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in head/sys/dev: e1000 ixl X-SVN-Commit-Revision: 327828 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 15:25:28 -0000 Author: pfg Date: Thu Jan 11 15:25:26 2018 New Revision: 327828 URL: https://svnweb.freebsd.org/changeset/base/327828 Log: dev/(e1000,ixl): Make some use of mallocarray(9). Reviewed by: erj Differential Revision: https://reviews.freebsd.org/D13833 Modified: head/sys/dev/e1000/if_em.c head/sys/dev/ixl/if_ixlv.c head/sys/dev/ixl/ixl_pf_iov.c head/sys/dev/ixl/ixl_pf_main.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Thu Jan 11 15:03:01 2018 (r327827) +++ head/sys/dev/e1000/if_em.c Thu Jan 11 15:25:26 2018 (r327828) @@ -2835,9 +2835,9 @@ em_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, u /* First allocate the top level queue structs */ if (!(adapter->tx_queues = - (struct em_tx_queue *) malloc(sizeof(struct em_tx_queue) * - adapter->tx_num_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) { - device_printf(iflib_get_dev(ctx), "Unable to allocate queue memory\n"); + (struct em_tx_queue *) mallocarray(adapter->tx_num_queues, + sizeof(struct em_tx_queue), M_DEVBUF, M_NOWAIT | M_ZERO))) { + device_printf(iflib_get_dev(ctx), "Unable to allocate queue memory\n"); return(ENOMEM); } @@ -2849,7 +2849,8 @@ em_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, u que->me = txr->me = i; /* Allocate report status array */ - if (!(txr->tx_rsq = (qidx_t *) malloc(sizeof(qidx_t) * scctx->isc_ntxd[0], M_DEVBUF, M_NOWAIT | M_ZERO))) { + if (!(txr->tx_rsq = (qidx_t *) mallocarray(scctx->isc_ntxd[0], + sizeof(qidx_t), M_DEVBUF, M_NOWAIT | M_ZERO))) { device_printf(iflib_get_dev(ctx), "failed to allocate rs_idxs memory\n"); error = ENOMEM; goto fail; @@ -2881,8 +2882,8 @@ em_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, u /* First allocate the top level queue structs */ if (!(adapter->rx_queues = - (struct em_rx_queue *) malloc(sizeof(struct em_rx_queue) * - adapter->rx_num_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) { + (struct em_rx_queue *) mallocarray(adapter->rx_num_queues, + sizeof(struct em_rx_queue), M_DEVBUF, M_NOWAIT | M_ZERO))) { device_printf(iflib_get_dev(ctx), "Unable to allocate queue memory\n"); error = ENOMEM; goto fail; Modified: head/sys/dev/ixl/if_ixlv.c ============================================================================== --- head/sys/dev/ixl/if_ixlv.c Thu Jan 11 15:03:01 2018 (r327827) +++ head/sys/dev/ixl/if_ixlv.c Thu Jan 11 15:25:26 2018 (r327828) @@ -1637,8 +1637,8 @@ ixlv_setup_queues(struct ixlv_sc *sc) /* Get memory for the station queues */ if (!(vsi->queues = - (struct ixl_queue *) malloc(sizeof(struct ixl_queue) * - vsi->num_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) { + (struct ixl_queue *) mallocarray(vsi->num_queues, + sizeof(struct ixl_queue), M_DEVBUF, M_NOWAIT | M_ZERO))) { device_printf(dev, "Unable to allocate queue memory\n"); error = ENOMEM; goto early; Modified: head/sys/dev/ixl/ixl_pf_iov.c ============================================================================== --- head/sys/dev/ixl/ixl_pf_iov.c Thu Jan 11 15:03:01 2018 (r327827) +++ head/sys/dev/ixl/ixl_pf_iov.c Thu Jan 11 15:25:26 2018 (r327828) @@ -1695,8 +1695,8 @@ ixl_iov_init(device_t dev, uint16_t num_vfs, const nvl pf_vsi = &pf->vsi; IXL_PF_LOCK(pf); - pf->vfs = malloc(sizeof(struct ixl_vf) * num_vfs, M_IXL, M_NOWAIT | - M_ZERO); + pf->vfs = mallocarray(num_vfs, sizeof(struct ixl_vf), M_IXL, + M_NOWAIT | M_ZERO); if (pf->vfs == NULL) { error = ENOMEM; Modified: head/sys/dev/ixl/ixl_pf_main.c ============================================================================== --- head/sys/dev/ixl/ixl_pf_main.c Thu Jan 11 15:03:01 2018 (r327827) +++ head/sys/dev/ixl/ixl_pf_main.c Thu Jan 11 15:25:26 2018 (r327828) @@ -2431,8 +2431,8 @@ ixl_setup_stations(struct ixl_pf *pf) /* Get memory for the station queues */ if (!(vsi->queues = - (struct ixl_queue *) malloc(sizeof(struct ixl_queue) * - vsi->num_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) { + (struct ixl_queue *) mallocarray(vsi->num_queues, + sizeof(struct ixl_queue), M_DEVBUF, M_NOWAIT | M_ZERO))) { device_printf(dev, "Unable to allocate queue memory\n"); error = ENOMEM; return (error); @@ -3317,7 +3317,7 @@ ixl_add_hw_filters(struct ixl_vsi *vsi, int flags, int hw = &pf->hw; IXL_PF_LOCK_ASSERT(pf); - a = malloc(sizeof(struct i40e_aqc_add_macvlan_element_data) * cnt, + a = mallocarray(cnt, sizeof(struct i40e_aqc_add_macvlan_element_data), M_DEVBUF, M_NOWAIT | M_ZERO); if (a == NULL) { device_printf(dev, "add_hw_filters failed to get memory\n"); @@ -3380,7 +3380,8 @@ ixl_del_hw_filters(struct ixl_vsi *vsi, int cnt) hw = &pf->hw; dev = pf->dev; - d = malloc(sizeof(struct i40e_aqc_remove_macvlan_element_data) * cnt, + d = mallocarray(cnt, + sizeof(struct i40e_aqc_remove_macvlan_element_data), M_DEVBUF, M_NOWAIT | M_ZERO); if (d == NULL) { printf("del hw filter failed to get memory\n"); From owner-svn-src-head@freebsd.org Thu Jan 11 15:29:30 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D234E69B4E; Thu, 11 Jan 2018 15:29:30 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 68B85763C5; Thu, 11 Jan 2018 15:29:30 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C35016BD7; Thu, 11 Jan 2018 15:29:29 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BFTTXk084409; Thu, 11 Jan 2018 15:29:29 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BFTTuN084406; Thu, 11 Jan 2018 15:29:29 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801111529.w0BFTTuN084406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 11 Jan 2018 15:29:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327829 - head/sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/sys/netpfil/ipfw X-SVN-Commit-Revision: 327829 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 15:29:30 -0000 Author: pfg Date: Thu Jan 11 15:29:29 2018 New Revision: 327829 URL: https://svnweb.freebsd.org/changeset/base/327829 Log: netpfil/ipfw: Make some use of mallocarray(9). Reviewed by: kp, ae Differential Revision: https://reviews.freebsd.org/D13834 Modified: head/sys/netpfil/ipfw/dn_heap.c head/sys/netpfil/ipfw/dn_sched_fq_codel.c head/sys/netpfil/ipfw/dn_sched_fq_pie.c Modified: head/sys/netpfil/ipfw/dn_heap.c ============================================================================== --- head/sys/netpfil/ipfw/dn_heap.c Thu Jan 11 15:25:26 2018 (r327828) +++ head/sys/netpfil/ipfw/dn_heap.c Thu Jan 11 15:29:29 2018 (r327829) @@ -94,7 +94,7 @@ heap_resize(struct dn_heap *h, unsigned int new_size) #else new_size = (new_size + HEAP_INCREMENT ) & ~HEAP_INCREMENT; #endif - p = malloc(new_size * sizeof(*p), M_DN_HEAP, M_NOWAIT); + p = mallocarray(new_size, sizeof(*p), M_DN_HEAP, M_NOWAIT); if (p == NULL) { printf("--- %s, resize %d failed\n", __func__, new_size ); return 1; /* error */ Modified: head/sys/netpfil/ipfw/dn_sched_fq_codel.c ============================================================================== --- head/sys/netpfil/ipfw/dn_sched_fq_codel.c Thu Jan 11 15:25:26 2018 (r327828) +++ head/sys/netpfil/ipfw/dn_sched_fq_codel.c Thu Jan 11 15:29:29 2018 (r327829) @@ -453,8 +453,8 @@ fq_codel_new_sched(struct dn_sch_inst *_si) q->fs = _si->sched->fs; /* allocate memory for flows array */ - si->flows = malloc(schk->cfg.flows_cnt * sizeof(struct fq_codel_flow), - M_DUMMYNET, M_NOWAIT | M_ZERO); + si->flows = mallocarray(schk->cfg.flows_cnt, + sizeof(struct fq_codel_flow), M_DUMMYNET, M_NOWAIT | M_ZERO); if (si->flows == NULL) { D("cannot allocate memory for fq_codel configuration parameters"); return ENOMEM ; Modified: head/sys/netpfil/ipfw/dn_sched_fq_pie.c ============================================================================== --- head/sys/netpfil/ipfw/dn_sched_fq_pie.c Thu Jan 11 15:25:26 2018 (r327828) +++ head/sys/netpfil/ipfw/dn_sched_fq_pie.c Thu Jan 11 15:29:29 2018 (r327829) @@ -1034,8 +1034,8 @@ fq_pie_new_sched(struct dn_sch_inst *_si) return ENOMEM ; } /* allocate memory for flows array */ - si->si_extra->flows = malloc(schk->cfg.flows_cnt * sizeof(struct fq_pie_flow), - M_DUMMYNET, M_NOWAIT | M_ZERO); + si->si_extra->flows = mallocarray(schk->cfg.flows_cnt, + sizeof(struct fq_pie_flow), M_DUMMYNET, M_NOWAIT | M_ZERO); flows = si->si_extra->flows; if (flows == NULL) { free(si->si_extra, M_DUMMYNET); From owner-svn-src-head@freebsd.org Thu Jan 11 15:44:04 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 703DAE6A82B; Thu, 11 Jan 2018 15:44:04 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CB2376EA9; Thu, 11 Jan 2018 15:44:04 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A66B616F1F; Thu, 11 Jan 2018 15:44:03 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BFi3Ic092405; Thu, 11 Jan 2018 15:44:03 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BFi3cs092402; Thu, 11 Jan 2018 15:44:03 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801111544.w0BFi3cs092402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 11 Jan 2018 15:44:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327831 - in head/sys/dev/bhnd: bcma nvram siba X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in head/sys/dev/bhnd: bcma nvram siba X-SVN-Commit-Revision: 327831 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 15:44:04 -0000 Author: pfg Date: Thu Jan 11 15:44:03 2018 New Revision: 327831 URL: https://svnweb.freebsd.org/changeset/base/327831 Log: dev/bhnd: Make use of mallocarray(9). This makes a calloc-like definition check for overflows as is common practice. Modified: head/sys/dev/bhnd/bcma/bcma_erom.c head/sys/dev/bhnd/nvram/bhnd_nvram_private.h head/sys/dev/bhnd/siba/siba_erom.c Modified: head/sys/dev/bhnd/bcma/bcma_erom.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma_erom.c Thu Jan 11 15:32:12 2018 (r327830) +++ head/sys/dev/bhnd/bcma/bcma_erom.c Thu Jan 11 15:44:03 2018 (r327831) @@ -400,7 +400,7 @@ bcma_erom_get_core_table(bhnd_erom_t *erom, struct bhn } /* Allocate our output buffer */ - buffer = malloc(sizeof(struct bhnd_core_info) * count, M_BHND, + buffer = mallocarray(count, sizeof(struct bhnd_core_info), M_BHND, M_NOWAIT); if (buffer == NULL) { error = ENOMEM; Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_private.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_private.h Thu Jan 11 15:32:12 2018 (r327830) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_private.h Thu Jan 11 15:44:03 2018 (r327831) @@ -74,7 +74,7 @@ MALLOC_DECLARE(M_BHND_NVRAM); #define bhnd_nv_toupper(c) toupper(c) #define bhnd_nv_malloc(size) malloc((size), M_BHND_NVRAM, M_NOWAIT) -#define bhnd_nv_calloc(n, size) malloc((n) * (size), M_BHND_NVRAM, \ +#define bhnd_nv_calloc(n, size) mallocarray((n), (size), M_BHND_NVRAM, \ M_NOWAIT | M_ZERO) #define bhnd_nv_reallocf(buf, size) reallocf((buf), (size), M_BHND_NVRAM, \ M_NOWAIT) Modified: head/sys/dev/bhnd/siba/siba_erom.c ============================================================================== --- head/sys/dev/bhnd/siba/siba_erom.c Thu Jan 11 15:32:12 2018 (r327830) +++ head/sys/dev/bhnd/siba/siba_erom.c Thu Jan 11 15:44:03 2018 (r327831) @@ -445,7 +445,7 @@ siba_erom_get_core_table(bhnd_erom_t *erom, struct bhn sc = (struct siba_erom *)erom; /* Allocate our core array */ - out = malloc(sizeof(*out) * sc->io.ncores, M_BHND, M_NOWAIT); + out = mallocarray(sc->io.ncores, sizeof(*out), M_BHND, M_NOWAIT); if (out == NULL) return (ENOMEM); From owner-svn-src-head@freebsd.org Thu Jan 11 16:04:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F6ABE6BE1A; Thu, 11 Jan 2018 16:04:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 19AC077E3F; Thu, 11 Jan 2018 16:04:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56ED317285; Thu, 11 Jan 2018 16:04:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BG45H5000990; Thu, 11 Jan 2018 16:04:05 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BG45sS000987; Thu, 11 Jan 2018 16:04:05 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801111604.w0BG45sS000987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 11 Jan 2018 16:04:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327832 - in head: etc/mtree usr.bin/vmstat usr.bin/vmstat/tests X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: etc/mtree usr.bin/vmstat usr.bin/vmstat/tests X-SVN-Commit-Revision: 327832 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 16:04:06 -0000 Author: kevans Date: Thu Jan 11 16:04:04 2018 New Revision: 327832 URL: https://svnweb.freebsd.org/changeset/base/327832 Log: vmstat(8): Hook up NetBSD tests The NetBSD tests for vmstat are basically just a smoke test, ensuring that executing `vmstat` and `vmstat -s` exit successfully. This is more than we test now, so go with it. Added: head/usr.bin/vmstat/tests/ head/usr.bin/vmstat/tests/Makefile (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/usr.bin/vmstat/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Thu Jan 11 15:44:03 2018 (r327831) +++ head/etc/mtree/BSD.tests.dist Thu Jan 11 16:04:04 2018 (r327832) @@ -736,6 +736,8 @@ .. uniq .. + vmstat + .. xargs .. xinstall Modified: head/usr.bin/vmstat/Makefile ============================================================================== --- head/usr.bin/vmstat/Makefile Thu Jan 11 15:44:03 2018 (r327831) +++ head/usr.bin/vmstat/Makefile Thu Jan 11 16:04:04 2018 (r327832) @@ -1,10 +1,15 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + PROG= vmstat MAN= vmstat.8 LIBADD= devstat kvm memstat xo util WARNS?= 6 + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Added: head/usr.bin/vmstat/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/vmstat/tests/Makefile Thu Jan 11 16:04:04 2018 (r327832) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +PACKAGE= tests + +NETBSD_ATF_TESTS_SH= vmstat_test + +.include + +.include From owner-svn-src-head@freebsd.org Thu Jan 11 16:41:04 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BBE63E6DF69; Thu, 11 Jan 2018 16:41:04 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 95B407971E; Thu, 11 Jan 2018 16:41:04 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C789D177A3; Thu, 11 Jan 2018 16:41:03 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BGf3eX017589; Thu, 11 Jan 2018 16:41:03 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BGf3rT017588; Thu, 11 Jan 2018 16:41:03 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201801111641.w0BGf3rT017588@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 11 Jan 2018 16:41:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327833 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 327833 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 16:41:04 -0000 Author: markj Date: Thu Jan 11 16:41:03 2018 New Revision: 327833 URL: https://svnweb.freebsd.org/changeset/base/327833 Log: Add mallocarray.9 to malloc.9's MLINKS. X-MFC with: r327674 Modified: head/share/man/man9/Makefile Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Thu Jan 11 16:04:04 2018 (r327832) +++ head/share/man/man9/Makefile Thu Jan 11 16:41:03 2018 (r327833) @@ -1262,6 +1262,7 @@ MLINKS+=make_dev.9 destroy_dev.9 \ make_dev.9 make_dev_p.9 \ make_dev.9 make_dev_s.9 MLINKS+=malloc.9 free.9 \ + malloc.9 mallocarray.9 \ malloc.9 MALLOC_DECLARE.9 \ malloc.9 MALLOC_DEFINE.9 \ malloc.9 realloc.9 \ From owner-svn-src-head@freebsd.org Thu Jan 11 16:50:04 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D917AE6E705; Thu, 11 Jan 2018 16:50:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B51B979C6C; Thu, 11 Jan 2018 16:50:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 092E717933; Thu, 11 Jan 2018 16:50:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BGo3rP018641; Thu, 11 Jan 2018 16:50:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BGo37W018639; Thu, 11 Jan 2018 16:50:03 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801111650.w0BGo37W018639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 11 Jan 2018 16:50:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327834 - in head/sys: amd64/amd64 i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 327834 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 16:50:05 -0000 Author: kib Date: Thu Jan 11 16:50:03 2018 New Revision: 327834 URL: https://svnweb.freebsd.org/changeset/base/327834 Log: Fix grammar. Submitted by: alc MFC after: 3 days Modified: head/sys/amd64/amd64/support.S head/sys/i386/i386/support.s Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Thu Jan 11 16:41:03 2018 (r327833) +++ head/sys/amd64/amd64/support.S Thu Jan 11 16:50:03 2018 (r327834) @@ -245,8 +245,9 @@ ENTRY(copyout) /* * Check explicitly for non-user addresses. This check is essential - * because it prevents usermode from writing into kernel. We do not - * verify that user did not specified a rogue address anywhere else. + * because it prevents usermode from writing into the kernel. We do + * not verify anywhere else that the user did not specify a rogue + * address. */ /* * First, prevent address wrapping. Modified: head/sys/i386/i386/support.s ============================================================================== --- head/sys/i386/i386/support.s Thu Jan 11 16:41:03 2018 (r327833) +++ head/sys/i386/i386/support.s Thu Jan 11 16:50:03 2018 (r327834) @@ -286,8 +286,9 @@ ENTRY(copyout) /* * Check explicitly for non-user addresses. This check is essential - * because it prevents usermode from writing into kernel. We do not - * verify that user did not specified a rogue address anywhere else. + * because it prevents usermode from writing into the kernel. We do + * not verify anywhere else that the user did not specify a rogue + * address. */ /* * First, prevent address wrapping. From owner-svn-src-head@freebsd.org Thu Jan 11 17:09:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F127E6F9B8; Thu, 11 Jan 2018 17:09:14 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 695187A8D6; Thu, 11 Jan 2018 17:09:14 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A64B717C53; Thu, 11 Jan 2018 17:09:13 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BH9Djj027517; Thu, 11 Jan 2018 17:09:13 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BH9CrD027510; Thu, 11 Jan 2018 17:09:12 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201801111709.w0BH9CrD027510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 11 Jan 2018 17:09:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327835 - in head/sys: arm/arm arm64/arm64 conf dev/acpica X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys: arm/arm arm64/arm64 conf dev/acpica X-SVN-Commit-Revision: 327835 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 17:09:14 -0000 Author: andrew Date: Thu Jan 11 17:09:12 2018 New Revision: 327835 URL: https://svnweb.freebsd.org/changeset/base/327835 Log: Add the start of INTRNG support for ACPI. This adds a new acpi_bus interface with a map_intr method. This is similar to the Open Firmware map_intr method and allows us to create the needed mapping from ACPI space to INTRNG space. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8617 Added: head/sys/dev/acpica/acpi_bus_if.m (contents, props changed) Modified: head/sys/arm/arm/generic_timer.c head/sys/arm64/arm64/nexus.c head/sys/conf/files.arm64 head/sys/dev/acpica/acpi.c head/sys/dev/acpica/acpi_resource.c head/sys/dev/acpica/acpivar.h Modified: head/sys/arm/arm/generic_timer.c ============================================================================== --- head/sys/arm/arm/generic_timer.c Thu Jan 11 16:50:03 2018 (r327834) +++ head/sys/arm/arm/generic_timer.c Thu Jan 11 17:09:12 2018 (r327835) @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); #ifdef DEV_ACPI #include #include +#include "acpi_bus_if.h" #endif #define GT_CTRL_ENABLE (1 << 0) @@ -313,6 +314,15 @@ arm_tmr_fdt_probe(device_t dev) #ifdef DEV_ACPI static void +arm_tmr_acpi_add_irq(device_t parent, device_t dev, int rid, u_int irq) +{ + + irq = ACPI_BUS_MAP_INTR(parent, dev, irq, + INTR_TRIGGER_LEVEL, INTR_POLARITY_HIGH); + BUS_SET_RESOURCE(parent, dev, SYS_RES_IRQ, rid, irq, 1); +} + +static void arm_tmr_acpi_identify(driver_t *driver, device_t parent) { ACPI_TABLE_GTDT *gtdt; @@ -336,12 +346,9 @@ arm_tmr_acpi_identify(driver_t *driver, device_t paren goto out; } - BUS_SET_RESOURCE(parent, dev, SYS_RES_IRQ, 0, - gtdt->SecureEl1Interrupt, 1); - BUS_SET_RESOURCE(parent, dev, SYS_RES_IRQ, 1, - gtdt->NonSecureEl1Interrupt, 1); - BUS_SET_RESOURCE(parent, dev, SYS_RES_IRQ, 2, - gtdt->VirtualTimerInterrupt, 1); + arm_tmr_acpi_add_irq(parent, dev, 0, gtdt->SecureEl1Interrupt); + arm_tmr_acpi_add_irq(parent, dev, 1, gtdt->NonSecureEl1Interrupt); + arm_tmr_acpi_add_irq(parent, dev, 2, gtdt->VirtualTimerInterrupt); out: acpi_unmap_table(gtdt); Modified: head/sys/arm64/arm64/nexus.c ============================================================================== --- head/sys/arm64/arm64/nexus.c Thu Jan 11 16:50:03 2018 (r327834) +++ head/sys/arm64/arm64/nexus.c Thu Jan 11 17:09:12 2018 (r327835) @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); #ifdef DEV_ACPI #include #include +#include "acpi_bus_if.h" #endif extern struct bus_space memmap_bus; @@ -460,11 +461,16 @@ nexus_ofw_map_intr(device_t dev, device_t child, phand #endif #ifdef DEV_ACPI +static int nexus_acpi_map_intr(device_t dev, device_t child, u_int irq, int trig, int pol); + static device_method_t nexus_acpi_methods[] = { /* Device interface */ DEVMETHOD(device_probe, nexus_acpi_probe), DEVMETHOD(device_attach, nexus_acpi_attach), + /* ACPI interface */ + DEVMETHOD(acpi_bus_map_intr, nexus_acpi_map_intr), + DEVMETHOD_END, }; @@ -494,5 +500,31 @@ nexus_acpi_attach(device_t dev) nexus_add_child(dev, 10, "acpi", 0); return (nexus_attach(dev)); +} + +static int +nexus_acpi_map_intr(device_t dev, device_t child, u_int irq, int trig, int pol) +{ + struct intr_map_data_acpi *acpi_data; + size_t len; + + len = sizeof(*acpi_data); + acpi_data = (struct intr_map_data_acpi *)intr_alloc_map_data( + INTR_MAP_DATA_ACPI, len, M_WAITOK | M_ZERO); + acpi_data->irq = irq; + acpi_data->pol = pol; + acpi_data->trig = trig; + + /* + * TODO: This will only handle a single interrupt controller. + * ACPI will map multiple controllers into a single virtual IRQ + * space. Each controller has a System Vector Base to hold the + * first irq it handles in this space. As such the correct way + * to handle interrupts with ACPI is to search through the + * controllers for the largest base value that is no larger than + * the IRQ value. + */ + irq = intr_map_irq(NULL, 0, (struct intr_map_data *)acpi_data); + return (irq); } #endif Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Thu Jan 11 16:50:03 2018 (r327834) +++ head/sys/conf/files.arm64 Thu Jan 11 17:09:12 2018 (r327835) @@ -167,6 +167,7 @@ armv8_crypto_wrap.o optional armv8crypto \ clean "armv8_crypto_wrap.o" crypto/blowfish/bf_enc.c optional crypto | ipsec | ipsec_support crypto/des/des_enc.c optional crypto | ipsec | ipsec_support | netsmb +dev/acpica/acpi_bus_if.m optional acpi dev/acpica/acpi_if.m optional acpi dev/ahci/ahci_generic.c optional ahci dev/axgbe/if_axgbe.c optional axgbe Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Thu Jan 11 16:50:03 2018 (r327834) +++ head/sys/dev/acpica/acpi.c Thu Jan 11 17:09:12 2018 (r327835) @@ -1358,7 +1358,9 @@ static struct resource * acpi_alloc_resource(device_t bus, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { +#ifndef INTRNG ACPI_RESOURCE ares; +#endif struct acpi_device *ad; struct resource_list_entry *rle; struct resource_list *rl; @@ -1385,6 +1387,7 @@ acpi_alloc_resource(device_t bus, device_t child, int resource_list_add(rl, type, *rid, start, end, count); res = resource_list_alloc(rl, bus, child, type, rid, start, end, count, flags); +#ifndef INTRNG if (res != NULL && type == SYS_RES_IRQ) { /* * Since bus_config_intr() takes immediate effect, we cannot @@ -1397,6 +1400,7 @@ acpi_alloc_resource(device_t bus, device_t child, int if (ACPI_SUCCESS(acpi_lookup_irq_resource(child, *rid, res, &ares))) acpi_config_intr(child, &ares); } +#endif /* * If this is an allocation of the "default" range for a given Added: head/sys/dev/acpica/acpi_bus_if.m ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/acpica/acpi_bus_if.m Thu Jan 11 17:09:12 2018 (r327835) @@ -0,0 +1,67 @@ +#- +# Copyright (c) 2016 The FreeBSD Foundation +# All rights reserved. +# +# This software was developed by Andrew Turner under +# sponsorship from the FreeBSD Foundation. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +#include +#include +#include + +INTERFACE acpi_bus; + +CODE { + static acpi_bus_map_intr_t acpi_bus_default_map_intr; + + int + acpi_bus_default_map_intr(device_t bus, device_t dev, u_int irq, + int trig, int pol) + { + device_t parent; + + /* Pass up the hierarchy */ + parent = device_get_parent(bus); + if (parent != NULL) + return (ACPI_BUS_MAP_INTR(parent, dev, irq, trig, pol)); + + panic("Unable to map interrupt %u", irq); + } +}; + +# Map an interrupt from ACPI space to the FreeBSD IRQ space. Note that +# both of these may be different than the pysical interrupt space as this +# may be local to each interrupt controller. +# +# This method also associates interrupt metadata with the interrupt, +# removing the need for a post hoc configure step. +METHOD int map_intr { + device_t bus; + device_t dev; + u_int irq; + int trig; + int pol; +} DEFAULT acpi_bus_default_map_intr; Modified: head/sys/dev/acpica/acpi_resource.c ============================================================================== --- head/sys/dev/acpica/acpi_resource.c Thu Jan 11 16:50:03 2018 (r327834) +++ head/sys/dev/acpica/acpi_resource.c Thu Jan 11 17:09:12 2018 (r327835) @@ -45,6 +45,10 @@ __FBSDID("$FreeBSD$"); #include +#ifdef INTRNG +#include "acpi_bus_if.h" +#endif + /* Hooks for the ACPI CA debugging infrastructure */ #define _COMPONENT ACPI_BUS ACPI_MODULE_NAME("RESOURCE") @@ -556,6 +560,7 @@ acpi_res_set_irq(device_t dev, void *context, uint8_t int trig, int pol) { struct acpi_res_context *cp = (struct acpi_res_context *)context; + rman_res_t intr; if (cp == NULL || irq == NULL) return; @@ -564,7 +569,14 @@ acpi_res_set_irq(device_t dev, void *context, uint8_t if (count != 1) return; - bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, *irq, 1); +#ifdef INTRNG + intr = ACPI_BUS_MAP_INTR(device_get_parent(dev), dev, *irq, + (trig == ACPI_EDGE_SENSITIVE) ? INTR_TRIGGER_EDGE : INTR_TRIGGER_LEVEL, + (pol == ACPI_ACTIVE_HIGH) ? INTR_POLARITY_HIGH : INTR_POLARITY_LOW); +#else + intr = *irq; +#endif + bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, intr, 1); } static void @@ -572,6 +584,7 @@ acpi_res_set_ext_irq(device_t dev, void *context, uint int trig, int pol) { struct acpi_res_context *cp = (struct acpi_res_context *)context; + rman_res_t intr; if (cp == NULL || irq == NULL) return; @@ -580,7 +593,14 @@ acpi_res_set_ext_irq(device_t dev, void *context, uint if (count != 1) return; - bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, *irq, 1); +#ifdef INTRNG + intr = ACPI_BUS_MAP_INTR(device_get_parent(dev), dev, *irq, + (trig == ACPI_EDGE_SENSITIVE) ? INTR_TRIGGER_EDGE : INTR_TRIGGER_LEVEL, + (pol == ACPI_ACTIVE_HIGH) ? INTR_POLARITY_HIGH : INTR_POLARITY_LOW); +#else + intr = *irq; +#endif + bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, intr, 1); } static void Modified: head/sys/dev/acpica/acpivar.h ============================================================================== --- head/sys/dev/acpica/acpivar.h Thu Jan 11 16:50:03 2018 (r327834) +++ head/sys/dev/acpica/acpivar.h Thu Jan 11 17:09:12 2018 (r327835) @@ -36,6 +36,9 @@ #include "acpi_if.h" #include "bus_if.h" #include +#ifdef INTRNG +#include +#endif #include #include #include @@ -90,6 +93,16 @@ struct acpi_device { /* Resources */ struct resource_list ad_rl; }; + +#ifdef INTRNG +struct intr_map_data_acpi { + struct intr_map_data hdr; + u_int irq; + u_int pol; + u_int trig; +}; + +#endif /* Track device (/dev/{apm,apmctl} and /dev/acpi) notification status. */ struct apm_clone_data { From owner-svn-src-head@freebsd.org Thu Jan 11 17:23:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 540C4E70670; Thu, 11 Jan 2018 17:23:26 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E7A6F7B34E; Thu, 11 Jan 2018 17:23:25 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45BBA17FA3; Thu, 11 Jan 2018 17:23:25 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BHNPwq035847; Thu, 11 Jan 2018 17:23:25 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BHNO1X035839; Thu, 11 Jan 2018 17:23:24 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201801111723.w0BHNO1X035839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 11 Jan 2018 17:23:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327836 - in head/sys: arm/arm arm64/arm64 conf X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys: arm/arm arm64/arm64 conf X-SVN-Commit-Revision: 327836 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 17:23:26 -0000 Author: andrew Date: Thu Jan 11 17:23:24 2018 New Revision: 327836 URL: https://svnweb.freebsd.org/changeset/base/327836 Log: iAdd ACPI attachments the the GIC and GICv3 interrupt controller drivers. For each we need to walk the MADT to find which we have, then add the driver as needed. As each may have a child they will each walk the same table to find these details. Reviewed by: mmel Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8720 Added: head/sys/arm/arm/gic_acpi.c (contents, props changed) head/sys/arm64/arm64/gic_v3_acpi.c (contents, props changed) Modified: head/sys/arm/arm/gic.c head/sys/arm64/arm64/gic_v3.c head/sys/arm64/arm64/gic_v3_var.h head/sys/arm64/arm64/gicv3_its.c head/sys/conf/files.arm64 Modified: head/sys/arm/arm/gic.c ============================================================================== --- head/sys/arm/arm/gic.c Thu Jan 11 17:09:12 2018 (r327835) +++ head/sys/arm/arm/gic.c Thu Jan 11 17:23:24 2018 (r327836) @@ -36,6 +36,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_acpi.h" #include "opt_platform.h" #include @@ -68,6 +69,11 @@ __FBSDID("$FreeBSD$"); #include #endif +#ifdef DEV_ACPI +#include +#include +#endif + #include #include @@ -888,6 +894,9 @@ gic_map_intr(device_t dev, struct intr_map_data *data, #ifdef FDT struct intr_map_data_fdt *daf; #endif +#ifdef DEV_ACPI + struct intr_map_data_acpi *daa; +#endif sc = device_get_softc(dev); switch (data->type) { @@ -901,6 +910,14 @@ gic_map_intr(device_t dev, struct intr_map_data *data, (sc->gic_irqs[irq].gi_flags & GI_FLAG_MSI) == 0, ("%s: Attempting to map a MSI interrupt from FDT", __func__)); + break; +#endif +#ifdef DEV_ACPI + case INTR_MAP_DATA_ACPI: + daa = (struct intr_map_data_acpi *)data; + irq = daa->irq; + pol = daa->pol; + trig = daa->trig; break; #endif case INTR_MAP_DATA_MSI: Added: head/sys/arm/arm/gic_acpi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/arm/gic_acpi.c Thu Jan 11 17:23:24 2018 (r327836) @@ -0,0 +1,346 @@ +/*- + * Copyright (c) 2011,2016 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Andrew Turner under + * sponsorship from the FreeBSD Foundation. + * + * Developed by Damjan Marion + * + * Based on OMAP4 GIC code by Ben Gray + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the company nor the name of the author may be used to + * endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "opt_platform.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include + +struct gic_acpi_devinfo { + struct resource_list rl; +}; + +static device_identify_t gic_acpi_identify; +static device_probe_t gic_acpi_probe; +static device_attach_t gic_acpi_attach; +static bus_get_resource_list_t gic_acpi_get_resource_list; +static bool arm_gic_add_children(device_t); + +static device_method_t gic_acpi_methods[] = { + /* Device interface */ + DEVMETHOD(device_identify, gic_acpi_identify), + DEVMETHOD(device_probe, gic_acpi_probe), + DEVMETHOD(device_attach, gic_acpi_attach), + + /* Bus interface */ + DEVMETHOD(bus_get_resource_list, gic_acpi_get_resource_list), + + DEVMETHOD_END, +}; + +DEFINE_CLASS_1(gic, gic_acpi_driver, gic_acpi_methods, + sizeof(struct arm_gic_softc), arm_gic_driver); + +static devclass_t gic_acpi_devclass; + +EARLY_DRIVER_MODULE(gic, acpi, gic_acpi_driver, gic_acpi_devclass, 0, 0, + BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); + +struct madt_table_data { + device_t parent; + ACPI_MADT_GENERIC_DISTRIBUTOR *dist; + ACPI_MADT_GENERIC_INTERRUPT *intr[MAXCPU]; +}; + +static void +madt_handler(ACPI_SUBTABLE_HEADER *entry, void *arg) +{ + struct madt_table_data *madt_data; + ACPI_MADT_GENERIC_INTERRUPT *intr; + + madt_data = (struct madt_table_data *)arg; + + switch(entry->Type) { + case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR: + if (madt_data->dist != NULL) { + if (bootverbose) + device_printf(madt_data->parent, + "gic: Already have a distributor table"); + } else + madt_data->dist = + (ACPI_MADT_GENERIC_DISTRIBUTOR *)entry; + break; + case ACPI_MADT_TYPE_GENERIC_INTERRUPT: + intr = (ACPI_MADT_GENERIC_INTERRUPT *)entry; + if (intr->CpuInterfaceNumber < MAXCPU) + madt_data->intr[intr->CpuInterfaceNumber] = intr; + break; + } +} + +static void +gic_acpi_identify(driver_t *driver, device_t parent) +{ + struct madt_table_data madt_data; + ACPI_MADT_GENERIC_INTERRUPT *intr; + ACPI_TABLE_MADT *madt; + vm_paddr_t physaddr; + device_t dev; + int i; + + physaddr = acpi_find_table(ACPI_SIG_MADT); + if (physaddr == 0) + return; + + madt = acpi_map_table(physaddr, ACPI_SIG_MADT); + if (madt == NULL) { + device_printf(parent, "gic: Unable to map the MADT\n"); + return; + } + + bzero(&madt_data, sizeof(madt_data)); + madt_data.parent = parent; + madt_data.dist = NULL; + + acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length, + madt_handler, &madt_data); + + /* Check the version of the GIC we have */ + switch (madt_data.dist->Version) { + case ACPI_MADT_GIC_VERSION_NONE: + case ACPI_MADT_GIC_VERSION_V1: + case ACPI_MADT_GIC_VERSION_V2: + break; + default: + goto out; + } + + intr = NULL; + for (i = 0; i < MAXCPU; i++) { + if (madt_data.intr[i] != NULL) { + if (intr == NULL) { + intr = madt_data.intr[i]; + } else if (intr->BaseAddress != + madt_data.intr[i]->BaseAddress) { + device_printf(parent, +"gic: Not all CPU interfaces at the same address, this may fail\n"); + } + } + } + if (intr == NULL) { + device_printf(parent, "gic: No CPU interfaces found\n"); + goto out; + } + + dev = BUS_ADD_CHILD(parent, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE, + "gic", -1); + if (dev == NULL) { + device_printf(parent, "add gic child failed\n"); + goto out; + } + + BUS_SET_RESOURCE(parent, dev, SYS_RES_MEMORY, 0, + madt_data.dist->BaseAddress, 4 * 1024); + BUS_SET_RESOURCE(parent, dev, SYS_RES_MEMORY, 1, + intr->BaseAddress, 4 * 1024); + + acpi_set_private(dev, (void *)(uintptr_t)madt_data.dist->Version); +out: + acpi_unmap_table(madt); +} + +static int +gic_acpi_probe(device_t dev) +{ + + switch((uintptr_t)acpi_get_private(dev)) { + case ACPI_MADT_GIC_VERSION_NONE: + case ACPI_MADT_GIC_VERSION_V1: + case ACPI_MADT_GIC_VERSION_V2: + break; + default: + return (ENXIO); + } + + device_set_desc(dev, "ARM Generic Interrupt Controller"); + return (BUS_PROBE_NOWILDCARD); +} + +static int +gic_acpi_attach(device_t dev) +{ + struct arm_gic_softc *sc = device_get_softc(dev); + intptr_t xref; + int err; + + sc->gic_bus = GIC_BUS_ACPI; + + err = arm_gic_attach(dev); + if (err != 0) + return (err); + + xref = 0; + + /* + * Now, when everything is initialized, it's right time to + * register interrupt controller to interrupt framefork. + */ + if (intr_pic_register(dev, xref) == NULL) { + device_printf(dev, "could not register PIC\n"); + goto cleanup; + } + + /* + * Controller is root: + */ + if (intr_pic_claim_root(dev, xref, arm_gic_intr, sc, + GIC_LAST_SGI - GIC_FIRST_SGI + 1) != 0) { + device_printf(dev, "could not set PIC as a root\n"); + intr_pic_deregister(dev, xref); + goto cleanup; + } + /* If we have children probe and attach them */ + if (arm_gic_add_children(dev)) { + bus_generic_probe(dev); + return (bus_generic_attach(dev)); + } + + return (0); + +cleanup: + arm_gic_detach(dev); + return(ENXIO); +} + +static struct resource_list * +gic_acpi_get_resource_list(device_t bus, device_t child) +{ + struct gic_acpi_devinfo *di; + + di = device_get_ivars(child); + KASSERT(di != NULL, ("gic_acpi_get_resource_list: No devinfo")); + + return (&di->rl); +} + +static void +madt_gicv2m_handler(ACPI_SUBTABLE_HEADER *entry, void *arg) +{ + struct arm_gic_softc *sc; + ACPI_MADT_GENERIC_MSI_FRAME *msi; + struct gic_acpi_devinfo *dinfo; + device_t dev, cdev; + + if (entry->Type == ACPI_MADT_TYPE_GENERIC_MSI_FRAME) { + sc = arg; + dev = sc->gic_dev; + msi = (ACPI_MADT_GENERIC_MSI_FRAME *)entry; + + device_printf(dev, "frame: %x %lx %x %u %u\n", msi->MsiFrameId, + msi->BaseAddress, msi->Flags, msi->SpiCount, msi->SpiBase); + + cdev = device_add_child(dev, NULL, -1); + if (cdev == NULL) + return; + + dinfo = malloc(sizeof(*dinfo), M_DEVBUF, M_WAITOK | M_ZERO); + resource_list_init(&dinfo->rl); + resource_list_add(&dinfo->rl, SYS_RES_MEMORY, 0, + msi->BaseAddress, msi->BaseAddress + PAGE_SIZE - 1, + PAGE_SIZE); + device_set_ivars(cdev, dinfo); + } +} + +static bool +arm_gic_add_children(device_t dev) +{ + struct arm_gic_softc *sc = device_get_softc(dev); + ACPI_TABLE_MADT *madt; + vm_paddr_t physaddr; + + /* This should return a valid address as it did in gic_acpi_identify */ + physaddr = acpi_find_table(ACPI_SIG_MADT); + if (physaddr == 0) + return (false); + + madt = acpi_map_table(physaddr, ACPI_SIG_MADT); + if (madt == NULL) { + device_printf(dev, "gic: Unable to map the MADT\n"); + return (false); + } + + acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length, + madt_gicv2m_handler, sc); + + acpi_unmap_table(madt); + + return (true); +} + +static int +arm_gicv2m_acpi_probe(device_t dev) +{ + + if (gic_get_bus(dev) != GIC_BUS_ACPI) + return (EINVAL); + + if (gic_get_hw_rev(dev) > 2) + return (EINVAL); + + device_set_desc(dev, "ARM Generic Interrupt Controller MSI/MSIX"); + return (BUS_PROBE_DEFAULT); +} + +static device_method_t arm_gicv2m_acpi_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, arm_gicv2m_acpi_probe), + + /* End */ + DEVMETHOD_END +}; + +DEFINE_CLASS_1(gicv2m, arm_gicv2m_acpi_driver, arm_gicv2m_acpi_methods, + sizeof(struct arm_gicv2m_softc), arm_gicv2m_driver); + +static devclass_t arm_gicv2m_acpi_devclass; + +EARLY_DRIVER_MODULE(gicv2m, gic, arm_gicv2m_acpi_driver, + arm_gicv2m_acpi_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); Modified: head/sys/arm64/arm64/gic_v3.c ============================================================================== --- head/sys/arm64/arm64/gic_v3.c Thu Jan 11 17:09:12 2018 (r327835) +++ head/sys/arm64/arm64/gic_v3.c Thu Jan 11 17:23:24 2018 (r327836) @@ -30,6 +30,7 @@ * SUCH DAMAGE. */ +#include "opt_acpi.h" #include "opt_platform.h" #include @@ -63,6 +64,11 @@ __FBSDID("$FreeBSD$"); #include #endif +#ifdef DEV_ACPI +#include +#include +#endif + #include "pic_if.h" #include @@ -570,6 +576,9 @@ do_gic_v3_map_intr(device_t dev, struct intr_map_data #ifdef FDT struct intr_map_data_fdt *daf; #endif +#ifdef DEV_ACPI + struct intr_map_data_acpi *daa; +#endif u_int irq; sc = device_get_softc(dev); @@ -581,6 +590,14 @@ do_gic_v3_map_intr(device_t dev, struct intr_map_data if (gic_map_fdt(dev, daf->ncells, daf->cells, &irq, &pol, &trig) != 0) return (EINVAL); + break; +#endif +#ifdef DEV_ACPI + case INTR_MAP_DATA_ACPI: + daa = (struct intr_map_data_acpi *)data; + irq = daa->irq; + pol = daa->pol; + trig = daa->trig; break; #endif case INTR_MAP_DATA_MSI: Added: head/sys/arm64/arm64/gic_v3_acpi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/arm64/gic_v3_acpi.c Thu Jan 11 17:23:24 2018 (r327836) @@ -0,0 +1,335 @@ +/*- + * Copyright (c) 2016 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Andrew Turner under + * the sponsorship of the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include "gic_v3_reg.h" +#include "gic_v3_var.h" + +struct gic_v3_acpi_devinfo { + struct resource_list di_rl; +}; + +static device_identify_t gic_v3_acpi_identify; +static device_probe_t gic_v3_acpi_probe; +static device_attach_t gic_v3_acpi_attach; +static bus_alloc_resource_t gic_v3_acpi_bus_alloc_res; + +static void gic_v3_acpi_bus_attach(device_t); + +static device_method_t gic_v3_acpi_methods[] = { + /* Device interface */ + DEVMETHOD(device_identify, gic_v3_acpi_identify), + DEVMETHOD(device_probe, gic_v3_acpi_probe), + DEVMETHOD(device_attach, gic_v3_acpi_attach), + + /* Bus interface */ + DEVMETHOD(bus_alloc_resource, gic_v3_acpi_bus_alloc_res), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + + /* End */ + DEVMETHOD_END +}; + +DEFINE_CLASS_1(gic, gic_v3_acpi_driver, gic_v3_acpi_methods, + sizeof(struct gic_v3_softc), gic_v3_driver); + +static devclass_t gic_v3_acpi_devclass; + +EARLY_DRIVER_MODULE(gic_v3, acpi, gic_v3_acpi_driver, gic_v3_acpi_devclass, + 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); + + +struct madt_table_data { + device_t parent; + device_t dev; + ACPI_MADT_GENERIC_DISTRIBUTOR *dist; + int count; +}; + +static void +madt_handler(ACPI_SUBTABLE_HEADER *entry, void *arg) +{ + struct madt_table_data *madt_data; + + madt_data = (struct madt_table_data *)arg; + + switch(entry->Type) { + case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR: + if (madt_data->dist != NULL) { + if (bootverbose) + device_printf(madt_data->parent, + "gic: Already have a distributor table"); + break; + } + madt_data->dist = (ACPI_MADT_GENERIC_DISTRIBUTOR *)entry; + break; + + case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR: + break; + + default: + break; + } +} + +static void +rdist_map(ACPI_SUBTABLE_HEADER *entry, void *arg) +{ + ACPI_MADT_GENERIC_REDISTRIBUTOR *redist; + struct madt_table_data *madt_data; + + madt_data = (struct madt_table_data *)arg; + + switch(entry->Type) { + case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR: + redist = (ACPI_MADT_GENERIC_REDISTRIBUTOR *)entry; + + madt_data->count++; + BUS_SET_RESOURCE(madt_data->parent, madt_data->dev, + SYS_RES_MEMORY, madt_data->count, redist->BaseAddress, + redist->Length); + break; + + default: + break; + } +} + +static void +gic_v3_acpi_identify(driver_t *driver, device_t parent) +{ + struct madt_table_data madt_data; + ACPI_TABLE_MADT *madt; + vm_paddr_t physaddr; + device_t dev; + + physaddr = acpi_find_table(ACPI_SIG_MADT); + if (physaddr == 0) + return; + + madt = acpi_map_table(physaddr, ACPI_SIG_MADT); + if (madt == NULL) { + device_printf(parent, "gic: Unable to map the MADT\n"); + return; + } + + madt_data.parent = parent; + madt_data.dist = NULL; + madt_data.count = 0; + + acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length, + madt_handler, &madt_data); + if (madt_data.dist == NULL) { + device_printf(parent, + "No gic interrupt or distributor table\n"); + goto out; + } + /* This is for the wrong GIC version */ + if (madt_data.dist->Version != ACPI_MADT_GIC_VERSION_V3) + goto out; + + dev = BUS_ADD_CHILD(parent, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE, + "gic", -1); + if (dev == NULL) { + device_printf(parent, "add gic child failed\n"); + goto out; + } + + /* Add the MADT data */ + BUS_SET_RESOURCE(parent, dev, SYS_RES_MEMORY, 0, + madt_data.dist->BaseAddress, 128 * 1024); + + madt_data.dev = dev; + acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length, + rdist_map, &madt_data); + + acpi_set_private(dev, (void *)(uintptr_t)madt_data.dist->Version); + +out: + acpi_unmap_table(madt); +} + +static int +gic_v3_acpi_probe(device_t dev) +{ + + switch((uintptr_t)acpi_get_private(dev)) { + case ACPI_MADT_GIC_VERSION_V3: + break; + default: + return (ENXIO); + } + + device_set_desc(dev, GIC_V3_DEVSTR); + return (BUS_PROBE_NOWILDCARD); +} + +static int +gic_v3_acpi_attach(device_t dev) +{ + struct gic_v3_softc *sc; + int err; + + sc = device_get_softc(dev); + sc->dev = dev; + sc->gic_bus = GIC_BUS_ACPI; + + /* TODO: Count these correctly */ + sc->gic_redists.nregions = 1; + + err = gic_v3_attach(dev); + if (err != 0) + goto error; + + sc->gic_pic = intr_pic_register(dev, 0); + if (sc->gic_pic == NULL) { + device_printf(dev, "could not register PIC\n"); + err = ENXIO; + goto error; + } + + if (intr_pic_claim_root(dev, 0, arm_gic_v3_intr, sc, + GIC_LAST_SGI - GIC_FIRST_SGI + 1) != 0) { + err = ENXIO; + goto error; + } + + /* + * Try to register the ITS driver to this GIC. The GIC will act as + * a bus in that case. Failure here will not affect the main GIC + * functionality. + */ + gic_v3_acpi_bus_attach(dev); + + return (0); + +error: + if (bootverbose) { + device_printf(dev, + "Failed to attach. Error %d\n", err); + } + /* Failure so free resources */ + gic_v3_detach(dev); + + return (err); +} + +static void +gic_v3_add_children(ACPI_SUBTABLE_HEADER *entry, void *arg) +{ + ACPI_MADT_GENERIC_TRANSLATOR *gict; + struct gic_v3_acpi_devinfo *di; + device_t child, dev; + + if (entry->Type == ACPI_MADT_TYPE_GENERIC_TRANSLATOR) { + /* We have an ITS, add it as a child */ + gict = (ACPI_MADT_GENERIC_TRANSLATOR *)entry; + dev = arg; + + child = device_add_child(dev, "its", -1); + if (child == NULL) + return; + + di = malloc(sizeof(*di), M_GIC_V3, M_WAITOK | M_ZERO); + resource_list_init(&di->di_rl); + resource_list_add(&di->di_rl, SYS_RES_MEMORY, 0, + gict->BaseAddress, gict->BaseAddress + 128 * 1024 - 1, + 128 * 1024); + device_set_ivars(child, di); + } +} + +static void +gic_v3_acpi_bus_attach(device_t dev) +{ + ACPI_TABLE_MADT *madt; + vm_paddr_t physaddr; + + physaddr = acpi_find_table(ACPI_SIG_MADT); + if (physaddr == 0) + return; + + madt = acpi_map_table(physaddr, ACPI_SIG_MADT); + if (madt == NULL) { + device_printf(dev, "Unable to map the MADT to add children\n"); + return; + } + + acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length, + gic_v3_add_children, dev); + + acpi_unmap_table(madt); + + bus_generic_attach(dev); +} + +static struct resource * +gic_v3_acpi_bus_alloc_res(device_t bus, device_t child, int type, int *rid, + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) +{ + struct gic_v3_acpi_devinfo *di; + struct resource_list_entry *rle; + + /* We only allocate memory */ + if (type != SYS_RES_MEMORY) + return (NULL); + + if (RMAN_IS_DEFAULT_RANGE(start, end)) { + if ((di = device_get_ivars(child)) == NULL) + return (NULL); + + /* Find defaults for this rid */ + rle = resource_list_find(&di->di_rl, type, *rid); + if (rle == NULL) + return (NULL); + + start = rle->start; + end = rle->end; + count = rle->count; + } + + return (bus_generic_alloc_resource(bus, child, type, rid, start, end, + count, flags)); +} Modified: head/sys/arm64/arm64/gic_v3_var.h ============================================================================== --- head/sys/arm64/arm64/gic_v3_var.h Thu Jan 11 17:09:12 2018 (r327835) +++ head/sys/arm64/arm64/gic_v3_var.h Thu Jan 11 17:23:24 2018 (r327836) @@ -32,6 +32,8 @@ #ifndef _GIC_V3_VAR_H_ #define _GIC_V3_VAR_H_ +#include + #define GIC_V3_DEVSTR "ARM Generic Interrupt Controller v3.0" DECLARE_CLASS(gic_v3_driver); @@ -92,10 +94,8 @@ struct gic_v3_devinfo { MALLOC_DECLARE(M_GIC_V3); /* ivars */ -enum { - GICV3_IVAR_NIRQS, - GICV3_IVAR_REDIST_VADDR, -}; +#define GICV3_IVAR_NIRQS 1000 +#define GICV3_IVAR_REDIST_VADDR 1001 __BUS_ACCESSOR(gicv3, nirqs, GICV3, NIRQS, u_int); __BUS_ACCESSOR(gicv3, redist_vaddr, GICV3, REDIST_VADDR, void *); Modified: head/sys/arm64/arm64/gicv3_its.c ============================================================================== --- head/sys/arm64/arm64/gicv3_its.c Thu Jan 11 17:09:12 2018 (r327835) +++ head/sys/arm64/arm64/gicv3_its.c Thu Jan 11 17:23:24 2018 (r327836) @@ -30,6 +30,7 @@ * SUCH DAMAGE. */ +#include "opt_acpi.h" #include "opt_platform.h" #include @@ -1640,7 +1641,7 @@ DEFINE_CLASS_1(its, gicv3_its_fdt_driver, gicv3_its_fd #undef its_baseclasses static devclass_t gicv3_its_fdt_devclass; -EARLY_DRIVER_MODULE(its, gic, gicv3_its_fdt_driver, +EARLY_DRIVER_MODULE(its_fdt, gic, gicv3_its_fdt_driver, gicv3_its_fdt_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); static int @@ -1682,6 +1683,65 @@ gicv3_its_fdt_attach(device_t dev) /* Register this device to handle MSI interrupts */ intr_msi_register(dev, xref); + + return (0); +} +#endif + +#ifdef DEV_ACPI +static device_probe_t gicv3_its_acpi_probe; +static device_attach_t gicv3_its_acpi_attach; + +static device_method_t gicv3_its_acpi_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, gicv3_its_acpi_probe), + DEVMETHOD(device_attach, gicv3_its_acpi_attach), + + /* End */ + DEVMETHOD_END +}; + +#define its_baseclasses its_acpi_baseclasses +DEFINE_CLASS_1(its, gicv3_its_acpi_driver, gicv3_its_acpi_methods, + sizeof(struct gicv3_its_softc), gicv3_its_driver); +#undef its_baseclasses +static devclass_t gicv3_its_acpi_devclass; + +EARLY_DRIVER_MODULE(its_acpi, gic, gicv3_its_acpi_driver, + gicv3_its_acpi_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); + +static int +gicv3_its_acpi_probe(device_t dev) +{ + + if (gic_get_bus(dev) != GIC_BUS_ACPI) + return (EINVAL); + + if (gic_get_hw_rev(dev) < 3) + return (EINVAL); + + device_set_desc(dev, "ARM GIC Interrupt Translation Service"); + return (BUS_PROBE_DEFAULT); +} + +static int +gicv3_its_acpi_attach(device_t dev) +{ + struct gicv3_its_softc *sc; + int err; + + err = gicv3_its_attach(dev); + if (err != 0) + return (err); + + sc = device_get_softc(dev); + + sc->sc_pic = intr_pic_register(dev, 1); + intr_pic_add_handler(device_get_parent(dev), sc->sc_pic, + gicv3_its_intr, sc, GIC_FIRST_LPI, LPI_NIRQS); + + /* Register this device to handle MSI interrupts */ + intr_msi_register(dev, 1); return (0); } Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Thu Jan 11 17:09:12 2018 (r327835) +++ head/sys/conf/files.arm64 Thu Jan 11 17:23:24 2018 (r327836) @@ -63,6 +63,7 @@ arm/annapurna/alpine/alpine_serdes.c optional al_serd compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal -I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}" arm/arm/generic_timer.c standard arm/arm/gic.c standard +arm/arm/gic_acpi.c optional acpi arm/arm/gic_fdt.c optional fdt arm/arm/pmu.c standard arm/broadcom/bcm2835/bcm2835_audio.c optional sound vchiq fdt \ @@ -111,6 +112,7 @@ arm64/arm64/exception.S standard arm64/arm64/freebsd32_machdep.c optional compat_freebsd32 arm64/arm64/gicv3_its.c optional intrng fdt arm64/arm64/gic_v3.c standard +arm64/arm64/gic_v3_acpi.c optional acpi arm64/arm64/gic_v3_fdt.c optional fdt arm64/arm64/identcpu.c standard arm64/arm64/in_cksum.c optional inet | inet6 From owner-svn-src-head@freebsd.org Thu Jan 11 18:07:22 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDDDBE72CB2; Thu, 11 Jan 2018 18:07:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A8D917D31D; Thu, 11 Jan 2018 18:07:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D060C186B6; Thu, 11 Jan 2018 18:07:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BI7LtQ053222; Thu, 11 Jan 2018 18:07:21 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BI7L8q053221; Thu, 11 Jan 2018 18:07:21 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801111807.w0BI7L8q053221@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 11 Jan 2018 18:07:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327838 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 327838 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 18:07:22 -0000 Author: jhb Date: Thu Jan 11 18:07:21 2018 New Revision: 327838 URL: https://svnweb.freebsd.org/changeset/base/327838 Log: Axe tmp_iv from the cryptodev session structure. Just copyin the IV into the crypto descriptor directly. This avoids copying the IV twice for each operation. Reviewed by: kib MFC after: 2 weeks Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D13847 Modified: head/sys/opencrypto/cryptodev.c Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Thu Jan 11 17:51:22 2018 (r327837) +++ head/sys/opencrypto/cryptodev.c Thu Jan 11 18:07:21 2018 (r327838) @@ -278,7 +278,6 @@ struct csession { caddr_t key; int keylen; - u_char tmp_iv[EALG_MAX_BLOCK_LEN]; caddr_t mackey; int mackeylen; @@ -823,12 +822,11 @@ cryptodev_op( error = EINVAL; goto bail; } - if ((error = copyin(cop->iv, cse->tmp_iv, + if ((error = copyin(cop->iv, crde->crd_iv, cse->txform->blocksize))) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } - bcopy(cse->tmp_iv, crde->crd_iv, cse->txform->blocksize); crde->crd_flags |= CRD_F_IV_EXPLICIT | CRD_F_IV_PRESENT; crde->crd_skip = 0; } else if (cse->cipher == CRYPTO_ARC4) { /* XXX use flag? */ @@ -1005,17 +1003,16 @@ cryptodev_aead( crp->crp_opaque = (void *)cse; if (caead->iv) { - if (caead->ivlen > sizeof cse->tmp_iv) { + if (caead->ivlen > sizeof(crde->crd_iv)) { error = EINVAL; SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } - if ((error = copyin(caead->iv, cse->tmp_iv, caead->ivlen))) { + if ((error = copyin(caead->iv, crde->crd_iv, caead->ivlen))) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } - bcopy(cse->tmp_iv, crde->crd_iv, caead->ivlen); crde->crd_flags |= CRD_F_IV_EXPLICIT | CRD_F_IV_PRESENT; } else { crde->crd_flags |= CRD_F_IV_PRESENT; From owner-svn-src-head@freebsd.org Thu Jan 11 18:09:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67037E72E7B; Thu, 11 Jan 2018 18:09:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 401057D5A3; Thu, 11 Jan 2018 18:09:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 717C6186BF; Thu, 11 Jan 2018 18:09:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BI9OeR053851; Thu, 11 Jan 2018 18:09:24 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BI9OI0053850; Thu, 11 Jan 2018 18:09:24 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801111809.w0BI9OI0053850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 11 Jan 2018 18:09:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327839 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 327839 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 18:09:25 -0000 Author: jhb Date: Thu Jan 11 18:09:24 2018 New Revision: 327839 URL: https://svnweb.freebsd.org/changeset/base/327839 Log: Change the type of 'crp_opaque' from caddr_t to void *. Opaque pointers should be void *. Note that this does not go through the tree removing all of the now-unnecessary casts. Reviewed by: kib Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D13848 Modified: head/sys/opencrypto/cryptodev.h Modified: head/sys/opencrypto/cryptodev.h ============================================================================== --- head/sys/opencrypto/cryptodev.h Thu Jan 11 18:07:21 2018 (r327838) +++ head/sys/opencrypto/cryptodev.h Thu Jan 11 18:09:24 2018 (r327839) @@ -426,7 +426,7 @@ struct cryptop { */ caddr_t crp_buf; /* Data to be processed */ - caddr_t crp_opaque; /* Opaque pointer, passed along */ + void * crp_opaque; /* Opaque pointer, passed along */ struct cryptodesc *crp_desc; /* Linked list of processing descriptors */ int (*crp_callback)(struct cryptop *); /* Callback function */ From owner-svn-src-head@freebsd.org Thu Jan 11 19:08:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4427E7654F; Thu, 11 Jan 2018 19:08:44 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A0DF280D64; Thu, 11 Jan 2018 19:08:44 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E8F7B1911D; Thu, 11 Jan 2018 19:08:43 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BJ8hgG080871; Thu, 11 Jan 2018 19:08:43 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BJ8hjx080870; Thu, 11 Jan 2018 19:08:43 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801111908.w0BJ8hjx080870@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 11 Jan 2018 19:08:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327840 - head/sys/i386/conf X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/i386/conf X-SVN-Commit-Revision: 327840 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 19:08:44 -0000 Author: emaste Date: Thu Jan 11 19:08:43 2018 New Revision: 327840 URL: https://svnweb.freebsd.org/changeset/base/327840 Log: Temporarily disable VIMAGE on i386 An lld-linked i386 kernel hangs on boot, after em(4) starts. This seems similar to the issue that prompted us to disable VIMAGE on arm64 in r326179. Disable VIMAGE on i386 for now while we investigate. PR: 225077 Sponsored by: The FreeBSD Foundation Modified: head/sys/i386/conf/GENERIC Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Thu Jan 11 18:09:24 2018 (r327839) +++ head/sys/i386/conf/GENERIC Thu Jan 11 19:08:43 2018 (r327840) @@ -28,7 +28,7 @@ makeoptions WITH_CTF=1 # Run ctfconvert(1) for DTrace options SCHED_ULE # ULE scheduler options PREEMPTION # Enable kernel thread preemption -options VIMAGE # Subsystem virtualization, e.g. VNET +#options VIMAGE # Subsystem virtualization, e.g. VNET options INET # InterNETworking options INET6 # IPv6 communications protocols options IPSEC # IP (v4/v6) security From owner-svn-src-head@freebsd.org Thu Jan 11 19:24:45 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BD64E773C4; Thu, 11 Jan 2018 19:24:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7424181A4D; Thu, 11 Jan 2018 19:24:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5A071947C; Thu, 11 Jan 2018 19:24:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BJOilU089231; Thu, 11 Jan 2018 19:24:44 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BJOicg089230; Thu, 11 Jan 2018 19:24:44 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801111924.w0BJOicg089230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 11 Jan 2018 19:24:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327841 - head X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 327841 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 19:24:45 -0000 Author: jhb Date: Thu Jan 11 19:24:44 2018 New Revision: 327841 URL: https://svnweb.freebsd.org/changeset/base/327841 Log: Allow MIPS lib32 to build with clang. Don't try to set -march as clang doesn't permit use of the O32 ABI with newer CPU microarchitectures like 'mips3'. In addition, clang doesn't permit the O32 ABI with the default N64 target, so use an explicit O32 -target for clang. Sponsored by: DARPA / AFRL Modified: head/Makefile.libcompat Modified: head/Makefile.libcompat ============================================================================== --- head/Makefile.libcompat Thu Jan 11 19:08:43 2018 (r327840) +++ head/Makefile.libcompat Thu Jan 11 19:24:44 2018 (r327841) @@ -35,10 +35,19 @@ LIB32WMAKEFLAGS= \ OBJCOPY="${XOBJCOPY}" .elif ${TARGET_ARCH:Mmips64*} != "" +.if ${WANT_COMPILER_TYPE} == clang || \ + (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == clang) +.if ${TARGET_ARCH:Mmips64el*} != "" +LIB32CPUFLAGS= -target mipsel-unknown-freebsd12.0 +.else +LIB32CPUFLAGS= -target mips-unknown-freebsd12.0 +.endif +.else .if empty(TARGET_CPUTYPE) LIB32CPUFLAGS= -march=mips3 .else LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} +.endif .endif LIB32CPUFLAGS+= -mabi=32 LIB32WMAKEENV= MACHINE=mips MACHINE_ARCH=mips From owner-svn-src-head@freebsd.org Thu Jan 11 19:24:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C19CE773F1; Thu, 11 Jan 2018 19:24:53 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1143781A6B; Thu, 11 Jan 2018 19:24:53 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 12AB21947D; Thu, 11 Jan 2018 19:24:52 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BJOp0j089283; Thu, 11 Jan 2018 19:24:51 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BJOp3e089282; Thu, 11 Jan 2018 19:24:51 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201801111924.w0BJOp3e089282@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Thu, 11 Jan 2018 19:24:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327842 - head/sys/dev/e1000 X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/dev/e1000 X-SVN-Commit-Revision: 327842 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 19:24:53 -0000 Author: erj Date: Thu Jan 11 19:24:51 2018 New Revision: 327842 URL: https://svnweb.freebsd.org/changeset/base/327842 Log: e1000: Fix typos in value written to register and a comment The value written to E1000_TARC(0) wasn't intended to have every bit but E1000_TARC0_CB_MULTIQ_3_REQ cleared; a ~ was missing. Also change the referenced spec update section in the comment to the correct section. Sponsored by: Intel Corporation Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Thu Jan 11 19:24:44 2018 (r327841) +++ head/sys/dev/e1000/if_em.c Thu Jan 11 19:24:51 2018 (r327842) @@ -3072,9 +3072,9 @@ em_initialize_transmit_unit(if_ctx_t ctx) reg = E1000_READ_REG(hw, E1000_IOSFPC); reg |= E1000_RCTL_RDMTS_HEX; E1000_WRITE_REG(hw, E1000_IOSFPC, reg); - /* i218-i219 Specification Update 1.5.4.4 */ + /* i218-i219 Specification Update 1.5.4.5 */ reg = E1000_READ_REG(hw, E1000_TARC(0)); - reg &= E1000_TARC0_CB_MULTIQ_3_REQ; + reg &= ~E1000_TARC0_CB_MULTIQ_3_REQ; reg |= E1000_TARC0_CB_MULTIQ_2_REQ; E1000_WRITE_REG(hw, E1000_TARC(0), reg); } From owner-svn-src-head@freebsd.org Thu Jan 11 20:26:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AB70E7A3D4; Thu, 11 Jan 2018 20:26:19 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 165A430C; Thu, 11 Jan 2018 20:26:19 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4155819E57; Thu, 11 Jan 2018 20:26:18 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BKQIx6014669; Thu, 11 Jan 2018 20:26:18 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BKQIT0014668; Thu, 11 Jan 2018 20:26:18 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201801112026.w0BKQIT0014668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 11 Jan 2018 20:26:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327844 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 327844 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 20:26:19 -0000 Author: tuexen Date: Thu Jan 11 20:26:17 2018 New Revision: 327844 URL: https://svnweb.freebsd.org/changeset/base/327844 Log: Ensure that the vnet is set when calling pru_sockaddr() and pru_peeraddr(). This is already true when called via kern_getsockname() and kern_getpeername(). This patch sets it also, when they arecalled via soo_fill_kinfo(). This is necessary, since the corresponding functions for SCTP require the vnet to be set. Without this, if a process having an wildcard bound SCTP socket is terminated and a core is written, the kernel panics. Reviewed by: bz Differential Revision: https://reviews.freebsd.org/D13652 Modified: head/sys/kern/sys_socket.c Modified: head/sys/kern/sys_socket.c ============================================================================== --- head/sys/kern/sys_socket.c Thu Jan 11 19:41:00 2018 (r327843) +++ head/sys/kern/sys_socket.c Thu Jan 11 20:26:17 2018 (r327844) @@ -355,6 +355,7 @@ soo_fill_kinfo(struct file *fp, struct kinfo_file *kif kif->kf_type = KF_TYPE_SOCKET; so = fp->f_data; + CURVNET_SET(so->so_vnet); kif->kf_un.kf_sock.kf_sock_domain0 = so->so_proto->pr_domain->dom_family; kif->kf_un.kf_sock.kf_sock_type0 = so->so_type; @@ -407,6 +408,7 @@ soo_fill_kinfo(struct file *fp, struct kinfo_file *kif } strncpy(kif->kf_path, so->so_proto->pr_domain->dom_name, sizeof(kif->kf_path)); + CURVNET_RESTORE(); return (0); } From owner-svn-src-head@freebsd.org Thu Jan 11 21:12:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15209E7CD17; Thu, 11 Jan 2018 21:12:25 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E58142F91; Thu, 11 Jan 2018 21:12:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B5871A65E; Thu, 11 Jan 2018 21:12:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BLCO54035868; Thu, 11 Jan 2018 21:12:24 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BLCO0T035867; Thu, 11 Jan 2018 21:12:24 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201801112112.w0BLCO0T035867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 11 Jan 2018 21:12:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327845 - head/contrib/llvm/lib/Support/Unix X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/lib/Support/Unix X-SVN-Commit-Revision: 327845 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 21:12:25 -0000 Author: dim Date: Thu Jan 11 21:12:23 2018 New Revision: 327845 URL: https://svnweb.freebsd.org/changeset/base/327845 Log: Pull in r316581 from upstream llvm trunk (by John Baldwin): Don't try to use a non-existent header on FreeBSD/mips. Reviewers: dim Differential Revision: https://reviews.llvm.org/D38807 Requested by: jhb MFC after: 3 days Modified: head/contrib/llvm/lib/Support/Unix/Memory.inc Modified: head/contrib/llvm/lib/Support/Unix/Memory.inc ============================================================================== --- head/contrib/llvm/lib/Support/Unix/Memory.inc Thu Jan 11 20:26:17 2018 (r327844) +++ head/contrib/llvm/lib/Support/Unix/Memory.inc Thu Jan 11 21:12:23 2018 (r327845) @@ -27,7 +27,7 @@ #if defined(__mips__) # if defined(__OpenBSD__) # include -# else +# elif !defined(__FreeBSD__) # include # endif #endif From owner-svn-src-head@freebsd.org Thu Jan 11 21:17:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6E40E7D048; Thu, 11 Jan 2018 21:17:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 806B0321B; Thu, 11 Jan 2018 21:17:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B51C01A670; Thu, 11 Jan 2018 21:17:05 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0BLH5nE036751; Thu, 11 Jan 2018 21:17:05 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0BLH5M3036750; Thu, 11 Jan 2018 21:17:05 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201801112117.w0BLH5M3036750@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 11 Jan 2018 21:17:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327846 - head/sys/modules/dtrace X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/modules/dtrace X-SVN-Commit-Revision: 327846 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 21:17:06 -0000 Author: tuexen Date: Thu Jan 11 21:17:05 2018 New Revision: 327846 URL: https://svnweb.freebsd.org/changeset/base/327846 Log: Build systrace_freebsd32 on arm64. Since r326501 which added COMPAT_FREEBSD32 to the GENERIC config for arm64, we need to build systrace_freebsd32, since dtraceall depends on it. Reviewed by: ed, gnn Differential Revision: https://reviews.freebsd.org/D13670 Modified: head/sys/modules/dtrace/Makefile Modified: head/sys/modules/dtrace/Makefile ============================================================================== --- head/sys/modules/dtrace/Makefile Thu Jan 11 21:12:23 2018 (r327845) +++ head/sys/modules/dtrace/Makefile Thu Jan 11 21:17:05 2018 (r327846) @@ -23,6 +23,7 @@ SUBDIR+= systrace_linux32 SUBDIR+= fbt fasttrap .endif .if ${MACHINE_CPUARCH} == "amd64" || \ + ${MACHINE_CPUARCH} == "aarch64" || \ ${MACHINE_ARCH} == "mips64" || \ ${MACHINE_ARCH} == "powerpc64" SUBDIR+= systrace_freebsd32 From owner-svn-src-head@freebsd.org Fri Jan 12 01:09:31 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 708C7E6469A; Fri, 12 Jan 2018 01:09:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B2696EBF8; Fri, 12 Jan 2018 01:09:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 85ACF1CBFD; Fri, 12 Jan 2018 01:09:30 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0C19UUt032877; Fri, 12 Jan 2018 01:09:30 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0C19UYZ032876; Fri, 12 Jan 2018 01:09:30 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201801120109.w0C19UYZ032876@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 12 Jan 2018 01:09:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327857 - head X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 327857 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 01:09:31 -0000 Author: bdrewery Date: Fri Jan 12 01:09:30 2018 New Revision: 327857 URL: https://svnweb.freebsd.org/changeset/base/327857 Log: Cache LINKER_FEATURES to fix the wrong ones being used. Submitted by: Dan McGregor Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Jan 12 00:31:07 2018 (r327856) +++ head/Makefile.inc1 Fri Jan 12 01:09:30 2018 (r327857) @@ -144,7 +144,7 @@ TEST_SYSTEM_COMPILER_VARS= \ WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_FREEBSD_VERSION_FILE \ CC COMPILER_TYPE COMPILER_FEATURES COMPILER_VERSION \ COMPILER_FREEBSD_VERSION \ - LINKER_TYPE LINKER_VERSION + LINKER_TYPE LINKER_FEATURES LINKER_VERSION test-system-compiler: .PHONY .for v in ${TEST_SYSTEM_COMPILER_VARS} ${_+_}@printf "%-35s= %s\n" "${v}" "${${v}}" @@ -178,6 +178,7 @@ _COMPILER_METADATA_VARS= COMPILER_VERSION \ COMPILER_FEATURES \ COMPILER_FREEBSD_VERSION \ LINKER_VERSION \ + LINKER_FEATURES \ LINKER_TYPE compiler-metadata.mk: .PHONY .META @: > ${.TARGET} From owner-svn-src-head@freebsd.org Fri Jan 12 01:09:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B493E646E3; Fri, 12 Jan 2018 01:09:44 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0CBA56ED0C; Fri, 12 Jan 2018 01:09:43 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 940EE1CBFE; Fri, 12 Jan 2018 01:09:41 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0C19fbT032928; Fri, 12 Jan 2018 01:09:41 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0C19feH032927; Fri, 12 Jan 2018 01:09:41 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201801120109.w0C19feH032927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 12 Jan 2018 01:09:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327858 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 327858 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 01:09:44 -0000 Author: bdrewery Date: Fri Jan 12 01:09:41 2018 New Revision: 327858 URL: https://svnweb.freebsd.org/changeset/base/327858 Log: Add a hack to disable AUTO_OBJ for 'old style' kernel builds. Another solution would be to extend the Makefile.sys.inc idea, or a .no_obj file, to more places but I would rather keep that limited to the top-level build for now to not impact performance (statting a file in every make call) or to bring unintended side-effects. Reported by: jhb, imp Sponsored by: Dell EMC Isilon Modified: head/share/mk/src.sys.obj.mk Modified: head/share/mk/src.sys.obj.mk ============================================================================== --- head/share/mk/src.sys.obj.mk Fri Jan 12 01:09:30 2018 (r327857) +++ head/share/mk/src.sys.obj.mk Fri Jan 12 01:09:41 2018 (r327858) @@ -132,7 +132,8 @@ __objdir:= ${MAKEOBJDIR} .if ${.MAKE.LEVEL} == 0 && \ ${MK_AUTO_OBJ} == "no" && empty(.MAKEOVERRIDES:MMK_AUTO_OBJ) && \ !defined(WITHOUT_AUTO_OBJ) && !make(showconfig) && !make(print-dir) && \ - !defined(NO_OBJ) + !defined(NO_OBJ) && \ + empty(RELDIR:Msys/*/compile/*) # Find the last existing directory component and check if we can write to it. # If the last component is a symlink then recurse on the new path. CheckAutoObj= \ From owner-svn-src-head@freebsd.org Fri Jan 12 03:50:45 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E798CE6DA9D; Fri, 12 Jan 2018 03:50:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C22D374758; Fri, 12 Jan 2018 03:50:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BF741E634; Fri, 12 Jan 2018 03:50:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0C3oi7G099753; Fri, 12 Jan 2018 03:50:44 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0C3oi0Z099751; Fri, 12 Jan 2018 03:50:44 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801120350.w0C3oi0Z099751@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 12 Jan 2018 03:50:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327860 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 327860 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 03:50:46 -0000 Author: emaste Date: Fri Jan 12 03:50:44 2018 New Revision: 327860 URL: https://svnweb.freebsd.org/changeset/base/327860 Log: ANSIfy function definitions in sys/vm/ Modified: head/sys/vm/vm_glue.c head/sys/vm/vm_unix.c Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Fri Jan 12 02:49:18 2018 (r327859) +++ head/sys/vm/vm_glue.c Fri Jan 12 03:50:44 2018 (r327860) @@ -113,9 +113,7 @@ __FBSDID("$FreeBSD$"); * space. */ int -kernacc(addr, len, rw) - void *addr; - int len, rw; +kernacc(void *addr, int len, int rw) { boolean_t rv; vm_offset_t saddr, eaddr; @@ -147,9 +145,7 @@ kernacc(addr, len, rw) * used in conjunction with this call. */ int -useracc(addr, len, rw) - void *addr; - int len, rw; +useracc(void *addr, int len, int rw) { boolean_t rv; vm_prot_t prot; @@ -527,12 +523,8 @@ intr_prof_stack_use(struct thread *td, struct trapfram * to user mode to avoid stack copying and relocation problems. */ int -vm_forkproc(td, p2, td2, vm2, flags) - struct thread *td; - struct proc *p2; - struct thread *td2; - struct vmspace *vm2; - int flags; +vm_forkproc(struct thread *td, struct proc *p2, struct thread *td2, + struct vmspace *vm2, int flags) { struct proc *p1 = td->td_proc; int error; Modified: head/sys/vm/vm_unix.c ============================================================================== --- head/sys/vm/vm_unix.c Fri Jan 12 02:49:18 2018 (r327859) +++ head/sys/vm/vm_unix.c Fri Jan 12 03:50:44 2018 (r327860) @@ -73,9 +73,7 @@ struct obreak_args { */ /* ARGSUSED */ int -sys_obreak(td, uap) - struct thread *td; - struct obreak_args *uap; +sys_obreak(struct thread *td, struct obreak_args *uap) { struct vmspace *vm = td->td_proc->p_vmspace; vm_map_t map = &vm->vm_map; @@ -247,9 +245,7 @@ struct ovadvise_args { */ /* ARGSUSED */ int -sys_ovadvise(td, uap) - struct thread *td; - struct ovadvise_args *uap; +sys_ovadvise(struct thread *td, struct ovadvise_args *uap) { /* START_GIANT_OPTIONAL */ /* END_GIANT_OPTIONAL */ From owner-svn-src-head@freebsd.org Fri Jan 12 04:26:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55F84E6FD89; Fri, 12 Jan 2018 04:26:41 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 312A475C99; Fri, 12 Jan 2018 04:26:41 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 834521EC9D; Fri, 12 Jan 2018 04:26:40 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0C4QeqS016310; Fri, 12 Jan 2018 04:26:40 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0C4Qevs016309; Fri, 12 Jan 2018 04:26:40 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201801120426.w0C4Qevs016309@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 12 Jan 2018 04:26:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327862 - head/sbin/dhclient X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sbin/dhclient X-SVN-Commit-Revision: 327862 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 04:26:41 -0000 Author: asomers Date: Fri Jan 12 04:26:40 2018 New Revision: 327862 URL: https://svnweb.freebsd.org/changeset/base/327862 Log: dhclient(8): add missing include stdbool is technically needed, though we can get away without it due to header pollution. MFC after: 3 days Modified: head/sbin/dhclient/parse.c Modified: head/sbin/dhclient/parse.c ============================================================================== --- head/sbin/dhclient/parse.c Fri Jan 12 04:25:16 2018 (r327861) +++ head/sbin/dhclient/parse.c Fri Jan 12 04:26:40 2018 (r327862) @@ -45,6 +45,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "dhcpd.h" #include "dhctoken.h" From owner-svn-src-head@freebsd.org Fri Jan 12 06:36:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99CECE7609E; Fri, 12 Jan 2018 06:36:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6B62979FB8; Fri, 12 Jan 2018 06:36:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83D8920135; Fri, 12 Jan 2018 06:36:45 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0C6ajUE069807; Fri, 12 Jan 2018 06:36:45 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0C6aidV069798; Fri, 12 Jan 2018 06:36:44 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801120636.w0C6aidV069798@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Fri, 12 Jan 2018 06:36:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327864 - in head/sys/dev: mlx4 mlx4/mlx4_core mlx4/mlx4_en mlx4/mlx4_ib mlx5 X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: in head/sys/dev: mlx4 mlx4/mlx4_core mlx4/mlx4_en mlx4/mlx4_ib mlx5 X-SVN-Commit-Revision: 327864 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 06:36:46 -0000 Author: eadler Date: Fri Jan 12 06:36:44 2018 New Revision: 327864 URL: https://svnweb.freebsd.org/changeset/base/327864 Log: sys/dev/mlx[45]: fix uses of 1 << 31 Reviewed by: kib (D13858) Modified: head/sys/dev/mlx4/cq.h head/sys/dev/mlx4/mlx4_core/mlx4_fw.c head/sys/dev/mlx4/mlx4_core/mlx4_mcg.c head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c head/sys/dev/mlx4/mlx4_ib/mlx4_ib.h head/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c head/sys/dev/mlx4/qp.h head/sys/dev/mlx5/device.h head/sys/dev/mlx5/qp.h Modified: head/sys/dev/mlx4/cq.h ============================================================================== --- head/sys/dev/mlx4/cq.h Fri Jan 12 04:31:52 2018 (r327863) +++ head/sys/dev/mlx4/cq.h Fri Jan 12 06:36:44 2018 (r327864) @@ -86,7 +86,7 @@ struct mlx4_ts_cqe { } __packed; enum { - MLX4_CQE_L2_TUNNEL_IPOK = 1 << 31, + MLX4_CQE_L2_TUNNEL_IPOK = 1U << 31, MLX4_CQE_CVLAN_PRESENT_MASK = 1 << 29, MLX4_CQE_SVLAN_PRESENT_MASK = 1 << 30, MLX4_CQE_L2_TUNNEL = 1 << 27, Modified: head/sys/dev/mlx4/mlx4_core/mlx4_fw.c ============================================================================== --- head/sys/dev/mlx4/mlx4_core/mlx4_fw.c Fri Jan 12 04:31:52 2018 (r327863) +++ head/sys/dev/mlx4/mlx4_core/mlx4_fw.c Fri Jan 12 06:36:44 2018 (r327864) @@ -1944,7 +1944,7 @@ int mlx4_INIT_HCA(struct mlx4_dev *dev, struct mlx4_in #endif if (dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RECOVERABLE_ERROR_EVENT) - *(inbox + INIT_HCA_RECOVERABLE_ERROR_EVENT_OFFSET / 4) |= cpu_to_be32(1 << 31); + *(inbox + INIT_HCA_RECOVERABLE_ERROR_EVENT_OFFSET / 4) |= cpu_to_be32(1U << 31); /* QPC/EEC/CQC/EQC/RDMARC attributes */ Modified: head/sys/dev/mlx4/mlx4_core/mlx4_mcg.c ============================================================================== --- head/sys/dev/mlx4/mlx4_core/mlx4_mcg.c Fri Jan 12 04:31:52 2018 (r327863) +++ head/sys/dev/mlx4/mlx4_core/mlx4_mcg.c Fri Jan 12 06:36:44 2018 (r327864) @@ -1352,7 +1352,7 @@ static int mlx4_QP_ATTACH(struct mlx4_dev *dev, struct qpn = qp->qpn; qpn |= (prot << 28); if (attach && block_loopback) - qpn |= (1 << 31); + qpn |= (1U << 31); err = mlx4_cmd(dev, mailbox->dma, qpn, attach, MLX4_CMD_QP_ATTACH, MLX4_CMD_TIME_CLASS_A, Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Fri Jan 12 04:31:52 2018 (r327863) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Fri Jan 12 06:36:44 2018 (r327864) @@ -600,16 +600,16 @@ mlx4_en_store_inline_header(volatile struct mlx4_wqe_d if (unlikely(len < MIN_PKT_LEN)) { *(volatile uint32_t *)inl = - SET_BYTE_COUNT((1 << 31) | MIN_PKT_LEN); + SET_BYTE_COUNT((1U << 31) | MIN_PKT_LEN); } else if (len <= spc) { *(volatile uint32_t *)inl = - SET_BYTE_COUNT((1 << 31) | len); + SET_BYTE_COUNT((1U << 31) | len); } else { *(volatile uint32_t *)(inl + 4 + spc) = - SET_BYTE_COUNT((1 << 31) | (len - spc)); + SET_BYTE_COUNT((1U << 31) | (len - spc)); wmb(); *(volatile uint32_t *)inl = - SET_BYTE_COUNT((1 << 31) | spc); + SET_BYTE_COUNT((1U << 31) | spc); } } @@ -885,7 +885,7 @@ static int mlx4_en_xmit(struct mlx4_en_priv *priv, int dseg->addr = 0; dseg->lkey = 0; wmb(); - dseg->byte_count = SET_BYTE_COUNT((1 << 31)|0); + dseg->byte_count = SET_BYTE_COUNT((1U << 31)|0); } /* fill segment list */ @@ -895,7 +895,7 @@ static int mlx4_en_xmit(struct mlx4_en_priv *priv, int dseg->addr = 0; dseg->lkey = 0; wmb(); - dseg->byte_count = SET_BYTE_COUNT((1 << 31)|0); + dseg->byte_count = SET_BYTE_COUNT((1U << 31)|0); } else { dseg--; dseg->addr = cpu_to_be64((uint64_t)segs[nr_segs].ds_addr); Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib.h ============================================================================== --- head/sys/dev/mlx4/mlx4_ib/mlx4_ib.h Fri Jan 12 04:31:52 2018 (r327863) +++ head/sys/dev/mlx4/mlx4_ib/mlx4_ib.h Fri Jan 12 06:36:44 2018 (r327864) @@ -195,7 +195,7 @@ enum mlx4_ib_qp_flags { /* Mellanox specific flags start from IB_QP_CREATE_RESERVED_START */ MLX4_IB_ROCE_V2_GSI_QP = MLX4_IB_QP_CREATE_ROCE_V2_GSI, MLX4_IB_SRIOV_TUNNEL_QP = 1 << 30, - MLX4_IB_SRIOV_SQP = 1 << 31, + MLX4_IB_SRIOV_SQP = 1U << 31, }; struct mlx4_ib_gid_entry { Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c ============================================================================== --- head/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c Fri Jan 12 04:31:52 2018 (r327863) +++ head/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c Fri Jan 12 06:36:44 2018 (r327864) @@ -263,7 +263,7 @@ static void post_nop_wqe(struct mlx4_ib_qp *qp, int n, /* Pad the remainder of the WQE with an inline data segment. */ if (size > s) { inl = wqe + s; - inl->byte_count = cpu_to_be32(1 << 31 | (size - s - sizeof *inl)); + inl->byte_count = cpu_to_be32(1U << 31 | (size - s - sizeof *inl)); } ctrl->srcrb_flags = 0; ctrl->fence_size = size / 16; @@ -274,7 +274,7 @@ static void post_nop_wqe(struct mlx4_ib_qp *qp, int n, wmb(); ctrl->owner_opcode = cpu_to_be32(MLX4_OPCODE_NOP | MLX4_WQE_CTRL_NEC) | - (n & qp->sq.wqe_cnt ? cpu_to_be32(1 << 31) : 0); + (n & qp->sq.wqe_cnt ? cpu_to_be32(1U << 31) : 0); stamp_send_wqe(qp, n + qp->sq_spare_wqes, size); } @@ -1992,7 +1992,7 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp, for (i = 0; i < qp->sq.wqe_cnt; ++i) { ctrl = get_send_wqe(qp, i); - ctrl->owner_opcode = cpu_to_be32(1 << 31); + ctrl->owner_opcode = cpu_to_be32(1U << 31); if (qp->sq_max_wqes_per_wr == 1) ctrl->fence_size = 1 << (qp->sq.wqe_shift - 4); @@ -2653,11 +2653,11 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, s spc = MLX4_INLINE_ALIGN - ((unsigned long) (inl + 1) & (MLX4_INLINE_ALIGN - 1)); if (header_size <= spc) { - inl->byte_count = cpu_to_be32(1 << 31 | header_size); + inl->byte_count = cpu_to_be32(1U << 31 | header_size); memcpy(inl + 1, sqp->header_buf, header_size); i = 1; } else { - inl->byte_count = cpu_to_be32(1 << 31 | spc); + inl->byte_count = cpu_to_be32(1U << 31 | spc); memcpy(inl + 1, sqp->header_buf, spc); inl = (void *) (inl + 1) + spc; @@ -2676,7 +2676,7 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, s * of 16 mod 64. */ wmb(); - inl->byte_count = cpu_to_be32(1 << 31 | (header_size - spc)); + inl->byte_count = cpu_to_be32(1U << 31 | (header_size - spc)); i = 2; } @@ -3213,7 +3213,7 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_se } ctrl->owner_opcode = mlx4_ib_opcode[wr->opcode] | - (ind & qp->sq.wqe_cnt ? cpu_to_be32(1 << 31) : 0) | blh; + (ind & qp->sq.wqe_cnt ? cpu_to_be32(1U << 31) : 0) | blh; stamp = ind + qp->sq_spare_wqes; ind += DIV_ROUND_UP(size * 16, 1U << qp->sq.wqe_shift); Modified: head/sys/dev/mlx4/qp.h ============================================================================== --- head/sys/dev/mlx4/qp.h Fri Jan 12 04:31:52 2018 (r327863) +++ head/sys/dev/mlx4/qp.h Fri Jan 12 06:36:44 2018 (r327864) @@ -283,7 +283,7 @@ enum { /* param3 */ #define MLX4_FW_VER_WQE_CTRL_NEC mlx4_fw_ver(2, 2, 232) enum { - MLX4_WQE_CTRL_OWN = 1 << 31, + MLX4_WQE_CTRL_OWN = 1U << 31, MLX4_WQE_CTRL_NEC = 1 << 29, MLX4_WQE_CTRL_RR = 1 << 6, MLX4_WQE_CTRL_IIP = 1 << 28, @@ -371,7 +371,7 @@ struct mlx4_wqe_lso_seg { enum mlx4_wqe_bind_seg_flags2 { MLX4_WQE_BIND_ZERO_BASED = (1 << 30), - MLX4_WQE_BIND_TYPE_2 = (1 << 31), + MLX4_WQE_BIND_TYPE_2 = (1U << 31), }; struct mlx4_wqe_bind_seg { @@ -388,7 +388,7 @@ enum { MLX4_WQE_FMR_PERM_LOCAL_WRITE = 1 << 28, MLX4_WQE_FMR_AND_BIND_PERM_REMOTE_READ = 1 << 29, MLX4_WQE_FMR_AND_BIND_PERM_REMOTE_WRITE = 1 << 30, - MLX4_WQE_FMR_AND_BIND_PERM_ATOMIC = 1 << 31 + MLX4_WQE_FMR_AND_BIND_PERM_ATOMIC = 1U << 31 }; struct mlx4_wqe_fmr_seg { @@ -445,7 +445,7 @@ struct mlx4_wqe_data_seg { enum { MLX4_INLINE_ALIGN = 64, - MLX4_INLINE_SEG = 1 << 31, + MLX4_INLINE_SEG = 1U << 31, }; struct mlx4_wqe_inline_seg { Modified: head/sys/dev/mlx5/device.h ============================================================================== --- head/sys/dev/mlx5/device.h Fri Jan 12 04:31:52 2018 (r327863) +++ head/sys/dev/mlx5/device.h Fri Jan 12 06:36:44 2018 (r327864) @@ -164,7 +164,7 @@ enum { }; enum { - MLX5_MKEY_INBOX_PG_ACCESS = 1 << 31 + MLX5_MKEY_INBOX_PG_ACCESS = 1U << 31 }; enum { @@ -188,7 +188,7 @@ enum { MLX5_MKEY_REMOTE_INVAL = 1 << 24, MLX5_MKEY_FLAG_SYNC_UMR = 1 << 29, MLX5_MKEY_BSF_EN = 1 << 30, - MLX5_MKEY_LEN64 = 1 << 31, + MLX5_MKEY_LEN64 = 1U << 31, }; enum { Modified: head/sys/dev/mlx5/qp.h ============================================================================== --- head/sys/dev/mlx5/qp.h Fri Jan 12 04:31:52 2018 (r327863) +++ head/sys/dev/mlx5/qp.h Fri Jan 12 06:36:44 2018 (r327864) @@ -159,7 +159,7 @@ enum { MLX5_WQE_FMR_PERM_LOCAL_WRITE = 1 << 28, MLX5_WQE_FMR_PERM_REMOTE_READ = 1 << 29, MLX5_WQE_FMR_PERM_REMOTE_WRITE = 1 << 30, - MLX5_WQE_FMR_PERM_ATOMIC = 1 << 31 + MLX5_WQE_FMR_PERM_ATOMIC = 1U << 31 }; enum { @@ -174,7 +174,7 @@ enum { MLX5_QP_DRAIN_SIGERR = 1 << 26, MLX5_QP_LAT_SENSITIVE = 1 << 28, MLX5_QP_BLOCK_MCAST = 1 << 30, - MLX5_QP_ENABLE_SIG = 1 << 31, + MLX5_QP_ENABLE_SIG = 1U << 31, }; enum { From owner-svn-src-head@freebsd.org Fri Jan 12 06:37:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C2DEE76158; Fri, 12 Jan 2018 06:37:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 562AC7A1AC; Fri, 12 Jan 2018 06:37:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B90120137; Fri, 12 Jan 2018 06:37:53 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0C6brVK069887; Fri, 12 Jan 2018 06:37:53 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0C6brSX069884; Fri, 12 Jan 2018 06:37:53 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801120637.w0C6brSX069884@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Fri, 12 Jan 2018 06:37:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327865 - head/sys/dev/e1000 X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/sys/dev/e1000 X-SVN-Commit-Revision: 327865 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 06:37:54 -0000 Author: eadler Date: Fri Jan 12 06:37:53 2018 New Revision: 327865 URL: https://svnweb.freebsd.org/changeset/base/327865 Log: sys/dev/e1000: fix uses of 1 << 31 Reviewed by: erj (D13858) Modified: head/sys/dev/e1000/e1000_82575.h head/sys/dev/e1000/e1000_ich8lan.c head/sys/dev/e1000/e1000_regs.h Modified: head/sys/dev/e1000/e1000_82575.h ============================================================================== --- head/sys/dev/e1000/e1000_82575.h Fri Jan 12 06:36:44 2018 (r327864) +++ head/sys/dev/e1000/e1000_82575.h Fri Jan 12 06:37:53 2018 (r327865) @@ -385,7 +385,7 @@ struct e1000_adv_tx_context_desc { #define E1000_ETQF_FILTER_ENABLE (1 << 26) #define E1000_ETQF_IMM_INT (1 << 29) #define E1000_ETQF_1588 (1 << 30) -#define E1000_ETQF_QUEUE_ENABLE (1 << 31) +#define E1000_ETQF_QUEUE_ENABLE (1U << 31) /* * ETQF filter list: one static filter per filter consumer. This is * to avoid filter collisions later. Add new filters @@ -412,7 +412,7 @@ struct e1000_adv_tx_context_desc { #define E1000_DTXSWC_LLE_MASK 0x00FF0000 /* Per VF Local LB enables */ #define E1000_DTXSWC_VLAN_SPOOF_SHIFT 8 #define E1000_DTXSWC_LLE_SHIFT 16 -#define E1000_DTXSWC_VMDQ_LOOPBACK_EN (1 << 31) /* global VF LB enable */ +#define E1000_DTXSWC_VMDQ_LOOPBACK_EN (1U << 31) /* global VF LB enable */ /* Easy defines for setting default pool, would normally be left a zero */ #define E1000_VT_CTL_DEFAULT_POOL_SHIFT 7 Modified: head/sys/dev/e1000/e1000_ich8lan.c ============================================================================== --- head/sys/dev/e1000/e1000_ich8lan.c Fri Jan 12 06:36:44 2018 (r327864) +++ head/sys/dev/e1000/e1000_ich8lan.c Fri Jan 12 06:37:53 2018 (r327865) @@ -5202,7 +5202,7 @@ static void e1000_initialize_hw_bits_ich8lan(struct e1 /* Device Status */ if (hw->mac.type == e1000_ich8lan) { reg = E1000_READ_REG(hw, E1000_STATUS); - reg &= ~(1 << 31); + reg &= ~(1U << 31); E1000_WRITE_REG(hw, E1000_STATUS, reg); } Modified: head/sys/dev/e1000/e1000_regs.h ============================================================================== --- head/sys/dev/e1000/e1000_regs.h Fri Jan 12 06:36:44 2018 (r327864) +++ head/sys/dev/e1000/e1000_regs.h Fri Jan 12 06:37:53 2018 (r327865) @@ -215,7 +215,7 @@ /* QAV Tx mode control register bitfields masks */ #define E1000_TQAVCC_IDLE_SLOPE 0xFFFF /* Idle slope */ #define E1000_TQAVCC_KEEP_CREDITS (1 << 30) /* Keep credits opt enable */ -#define E1000_TQAVCC_QUEUE_MODE (1 << 31) /* SP vs. SR Tx mode */ +#define E1000_TQAVCC_QUEUE_MODE (1U << 31) /* SP vs. SR Tx mode */ /* Good transmitted packets counter registers */ #define E1000_PQGPTC(_n) (0x010014 + (0x100 * (_n))) From owner-svn-src-head@freebsd.org Fri Jan 12 06:40:59 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9B0EE7642C; Fri, 12 Jan 2018 06:40:59 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9524E7A41B; Fri, 12 Jan 2018 06:40:59 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4B3820193; Fri, 12 Jan 2018 06:40:58 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0C6ew4Z070037; Fri, 12 Jan 2018 06:40:58 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0C6ewTd070036; Fri, 12 Jan 2018 06:40:58 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201801120640.w0C6ewTd070036@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 12 Jan 2018 06:40:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327866 - head/sys/crypto/aesni X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/crypto/aesni X-SVN-Commit-Revision: 327866 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 06:40:59 -0000 Author: cem Date: Fri Jan 12 06:40:58 2018 New Revision: 327866 URL: https://svnweb.freebsd.org/changeset/base/327866 Log: aesni(4): Quiesce spurious GCC 6.3.0 -Wmaybe-uninitialized warnings Always initialize some variables GCC warns about. They are initialized in every path where they are used, but GCC doesn't know that. Sponsored by: Dell EMC Isilon Modified: head/sys/crypto/aesni/aesni.c Modified: head/sys/crypto/aesni/aesni.c ============================================================================== --- head/sys/crypto/aesni/aesni.c Fri Jan 12 06:37:53 2018 (r327865) +++ head/sys/crypto/aesni/aesni.c Fri Jan 12 06:40:58 2018 (r327866) @@ -724,6 +724,8 @@ aesni_cipher_process(struct aesni_session *ses, struct return (EINVAL); } + ctx = NULL; + ctxidx = 0; error = 0; kt = is_fpu_kern_thread(0); if (!kt) { @@ -775,6 +777,9 @@ aesni_cipher_crypt(struct aesni_session *ses, struct c KASSERT(ses->algo != CRYPTO_AES_NIST_GCM_16 || authcrd != NULL, ("AES_NIST_GCM_16 must include MAC descriptor")); + + ivlen = 0; + authbuf = NULL; buf = aesni_cipher_alloc(enccrd, crp, &allocated); if (buf == NULL) From owner-svn-src-head@freebsd.org Fri Jan 12 07:55:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24CD0E794E2; Fri, 12 Jan 2018 07:55:51 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C4B107CB20; Fri, 12 Jan 2018 07:55:50 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0DA0720E69; Fri, 12 Jan 2018 07:55:50 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0C7tod9003217; Fri, 12 Jan 2018 07:55:50 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0C7tntv003214; Fri, 12 Jan 2018 07:55:49 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201801120755.w0C7tntv003214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Fri, 12 Jan 2018 07:55:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327867 - in head/sys: conf powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: in head/sys: conf powerpc/powernv X-SVN-Commit-Revision: 327867 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 07:55:51 -0000 Author: wma Date: Fri Jan 12 07:55:49 2018 New Revision: 327867 URL: https://svnweb.freebsd.org/changeset/base/327867 Log: PowerNV: initial support for PCIe host controller Provide initial support for PCIe host controller as well as for IOMMU mapping. This commit allows proper bus enumeration, but does not guarantee DMA operations are working. Created by: Nathan Whitehorn Submitted by: Wojciech Macek Sponsored by: FreeBSD Foundation Added: head/sys/powerpc/powernv/opal_pci.c (contents, props changed) Modified: head/sys/conf/files.powerpc head/sys/powerpc/powernv/opal.h Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Fri Jan 12 06:40:58 2018 (r327866) +++ head/sys/conf/files.powerpc Fri Jan 12 07:55:49 2018 (r327867) @@ -185,6 +185,8 @@ powerpc/powermac/uninorthpci.c optional powermac pci powerpc/powermac/vcoregpio.c optional powermac powerpc/powernv/opal.c optional powernv powerpc/powernv/opal_console.c optional powernv +powerpc/powernv/opal_dev.c optional powernv +powerpc/powernv/opal_pci.c optional powernv pci powerpc/powernv/opalcall.S optional powernv powerpc/powernv/platform_powernv.c optional powernv powerpc/powerpc/altivec.c optional powerpc | powerpc64 Modified: head/sys/powerpc/powernv/opal.h ============================================================================== --- head/sys/powerpc/powernv/opal.h Fri Jan 12 06:40:58 2018 (r327866) +++ head/sys/powerpc/powernv/opal.h Fri Jan 12 07:55:49 2018 (r327867) @@ -38,13 +38,40 @@ int opal_check(void); /* Call an OPAL method. Any pointers passed must be real-mode accessible! */ int opal_call(uint64_t token, ...); -#define OPAL_CONSOLE_WRITE 1 -#define OPAL_CONSOLE_READ 2 -#define OPAL_CEC_POWER_DOWN 5 -#define OPAL_CEC_REBOOT 6 -#define OPAL_START_CPU 41 +#define OPAL_CONSOLE_WRITE 1 +#define OPAL_CONSOLE_READ 2 +#define OPAL_CEC_POWER_DOWN 5 +#define OPAL_CEC_REBOOT 6 +#define OPAL_HANDLE_INTERRUPT 9 +#define OPAL_PCI_CONFIG_READ_BYTE 13 +#define OPAL_PCI_CONFIG_READ_HALF_WORD 14 +#define OPAL_PCI_CONFIG_READ_WORD 15 +#define OPAL_PCI_CONFIG_WRITE_BYTE 16 +#define OPAL_PCI_CONFIG_WRITE_HALF_WORD 17 +#define OPAL_PCI_CONFIG_WRITE_WORD 18 +#define OPAL_PCI_EEH_FREEZE_CLEAR 26 +#define OPAL_PCI_PHB_MMIO_ENABLE 27 +#define OPAL_PCI_SET_PHB_MEM_WINDOW 28 +#define OPAL_PCI_MAP_PE_MMIO_WINDOW 29 +#define OPAL_PCI_SET_XIVE_PE 37 +#define OPAL_PCI_RESET 49 +#define OPAL_PCI_POLL 62 +#define OPAL_PCI_SET_PE 31 +#define OPAL_START_CPU 41 +#define OPAL_GET_MSI_32 39 +#define OPAL_GET_MSI_64 40 +#define OPAL_PCI_MSI_EOI 63 +#define OPAL_PCI_MAP_PE_DMA_WINDOW_REAL 45 +#define OPAL_RETURN_CPU 69 +#define OPAL_REINIT_CPUS 70 -#define OPAL_SUCCESS 0 -#define OPAL_BUSY_EVENT -12 +/* For OPAL_PCI_SET_PE */ +#define OPAL_UNMAP_PE 0 +#define OPAL_MAP_PE 1 + +#define OPAL_SUCCESS 0 +#define OPAL_PARAMETER -1 +#define OPAL_CLOSED -5 +#define OPAL_BUSY_EVENT -12 #endif Added: head/sys/powerpc/powernv/opal_pci.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/powernv/opal_pci.c Fri Jan 12 07:55:49 2018 (r327867) @@ -0,0 +1,576 @@ +/*- + * Copyright (c) 2015-2016 Nathan Whitehorn + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include + +#include "pcib_if.h" +#include "pic_if.h" +#include "iommu_if.h" +#include "opal.h" + +/* + * Device interface. + */ +static int opalpci_probe(device_t); +static int opalpci_attach(device_t); + +/* + * pcib interface. + */ +static uint32_t opalpci_read_config(device_t, u_int, u_int, u_int, + u_int, int); +static void opalpci_write_config(device_t, u_int, u_int, u_int, + u_int, u_int32_t, int); +static int opalpci_alloc_msi(device_t dev, device_t child, + int count, int maxcount, int *irqs); +static int opalpci_release_msi(device_t dev, device_t child, + int count, int *irqs); +static int opalpci_alloc_msix(device_t dev, device_t child, + int *irq); +static int opalpci_release_msix(device_t dev, device_t child, + int irq); +static int opalpci_map_msi(device_t dev, device_t child, + int irq, uint64_t *addr, uint32_t *data); +static int opalpci_route_interrupt(device_t bus, device_t dev, int pin); + +/* + * MSI PIC interface. + */ +static void opalpic_pic_enable(device_t dev, u_int irq, u_int vector); +static void opalpic_pic_eoi(device_t dev, u_int irq); +static void opalpic_pic_mask(device_t dev, u_int irq); +static void opalpic_pic_unmask(device_t dev, u_int irq); + +/* + * Commands + */ +#define OPAL_M32_WINDOW_TYPE 1 +#define OPAL_M64_WINDOW_TYPE 2 +#define OPAL_IO_WINDOW_TYPE 3 + +#define OPAL_RESET_PHB_COMPLETE 1 +#define OPAL_RESET_PCI_IODA_TABLE 6 + +#define OPAL_DISABLE_M64 0 +#define OPAL_ENABLE_M64_SPLIT 1 +#define OPAL_ENABLE_M64_NON_SPLIT 2 + +#define OPAL_EEH_ACTION_CLEAR_FREEZE_MMIO 1 +#define OPAL_EEH_ACTION_CLEAR_FREEZE_DMA 2 +#define OPAL_EEH_ACTION_CLEAR_FREEZE_ALL 3 + +/* + * Constants + */ +#define OPAL_PCI_DEFAULT_PE 1 + +/* + * Driver methods. + */ +static device_method_t opalpci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, opalpci_probe), + DEVMETHOD(device_attach, opalpci_attach), + + /* pcib interface */ + DEVMETHOD(pcib_read_config, opalpci_read_config), + DEVMETHOD(pcib_write_config, opalpci_write_config), + + DEVMETHOD(pcib_alloc_msi, opalpci_alloc_msi), + DEVMETHOD(pcib_release_msi, opalpci_release_msi), + DEVMETHOD(pcib_alloc_msix, opalpci_alloc_msix), + DEVMETHOD(pcib_release_msix, opalpci_release_msix), + DEVMETHOD(pcib_map_msi, opalpci_map_msi), + DEVMETHOD(pcib_route_interrupt, opalpci_route_interrupt), + + /* PIC interface for MSIs */ + DEVMETHOD(pic_enable, opalpic_pic_enable), + DEVMETHOD(pic_eoi, opalpic_pic_eoi), + DEVMETHOD(pic_mask, opalpic_pic_mask), + DEVMETHOD(pic_unmask, opalpic_pic_unmask), + + DEVMETHOD_END +}; + +struct opalpci_softc { + struct ofw_pci_softc ofw_sc; + uint64_t phb_id; + vmem_t *msi_vmem; + int msi_base; /* Base XIVE number */ + int base_msi_irq; /* Base IRQ assigned by FreeBSD to this PIC */ +}; + +static devclass_t opalpci_devclass; +DEFINE_CLASS_1(pcib, opalpci_driver, opalpci_methods, + sizeof(struct opalpci_softc), ofw_pci_driver); +EARLY_DRIVER_MODULE(opalpci, ofwbus, opalpci_driver, opalpci_devclass, 0, 0, + BUS_PASS_BUS); + +static int +opalpci_probe(device_t dev) +{ + const char *type; + + if (opal_check() != 0) + return (ENXIO); + + type = ofw_bus_get_type(dev); + + if (type == NULL || (strcmp(type, "pci") != 0 && + strcmp(type, "pciex") != 0)) + return (ENXIO); + + if (!OF_hasprop(ofw_bus_get_node(dev), "ibm,opal-phbid")) + return (ENXIO); + + device_set_desc(dev, "OPAL Host-PCI bridge"); + return (BUS_PROBE_GENERIC); +} + +static int +opalpci_attach(device_t dev) +{ + struct opalpci_softc *sc; + cell_t id[2], m64window[6], npe; + int i, err; + + sc = device_get_softc(dev); + + switch (OF_getproplen(ofw_bus_get_node(dev), "ibm,opal-phbid")) { + case 8: + OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-phbid", id, 8); + sc->phb_id = ((uint64_t)id[0] << 32) | id[1]; + break; + case 4: + OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-phbid", id, 4); + sc->phb_id = id[0]; + break; + default: + device_printf(dev, "PHB ID property had wrong length (%zd)\n", + OF_getproplen(ofw_bus_get_node(dev), "ibm,opal-phbid")); + return (ENXIO); + } + + if (bootverbose) + device_printf(dev, "OPAL ID %#lx\n", sc->phb_id); + + /* + * Reset PCI IODA table + */ + err = opal_call(OPAL_PCI_RESET, sc->phb_id, OPAL_RESET_PCI_IODA_TABLE, + 1); + if (err != 0) { + device_printf(dev, "IODA table reset failed: %d\n", err); + return (ENXIO); + } + while ((err = opal_call(OPAL_PCI_POLL, sc->phb_id)) > 0) + DELAY(1000*err); /* Returns expected delay in ms */ + if (err < 0) { + device_printf(dev, "PHB IODA reset poll failed: %d\n", err); + return (ENXIO); + } + + /* + * Reset everything. Especially important if we have inherited the + * system from Linux by kexec() + */ +#ifdef NOTYET + if (bootverbose) + device_printf(dev, "Resetting PCI bus\n"); + err = opal_call(OPAL_PCI_RESET, sc->phb_id, OPAL_RESET_PHB_COMPLETE, 1); + if (err < 0) { + device_printf(dev, "PHB reset failed: %d\n", err); + return (ENXIO); + } + while ((err = opal_call(OPAL_PCI_POLL, sc->phb_id)) > 0) + DELAY(1000*err); /* Returns expected delay in ms */ + if (err < 0) { + device_printf(dev, "PHB reset poll failed: %d\n", err); + return (ENXIO); + } + DELAY(10000); + err = opal_call(OPAL_PCI_RESET, sc->phb_id, OPAL_RESET_PHB_COMPLETE, 0); + if (err < 0) { + device_printf(dev, "PHB reset completion failed: %d\n", err); + return (ENXIO); + } + while ((err = opal_call(OPAL_PCI_POLL, sc->phb_id)) > 0) + DELAY(1000*err); /* Returns expected delay in ms */ + if (err < 0) { + device_printf(dev, "PHB reset completion poll failed: %d\n", + err); + return (ENXIO); + } + DELAY(10000); +#endif + + /* + * Map all devices on the bus to partitionable endpoint one until + * such time as we start wanting to do things like bhyve. + */ + err = opal_call(OPAL_PCI_SET_PE, sc->phb_id, OPAL_PCI_DEFAULT_PE, + 0, 0, 0, 0, /* All devices */ + OPAL_MAP_PE); + if (err != 0) { + device_printf(dev, "PE mapping failed: %d\n", err); + return (ENXIO); + } + + /* + * Turn on MMIO, mapped to PE 1 + */ + if (OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-num-pes", &npe, 4) + != 4) + npe = 1; + for (i = 0; i < npe; i++) { + err = opal_call(OPAL_PCI_MAP_PE_MMIO_WINDOW, sc->phb_id, + OPAL_PCI_DEFAULT_PE, OPAL_M32_WINDOW_TYPE, 0, i); + if (err != 0) + device_printf(dev, "MMIO %d map failed: %d\n", i, err); + } + + /* XXX: multiple M64 windows? */ + if (OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-m64-window", + m64window, sizeof(m64window)) == sizeof(m64window)) { + opal_call(OPAL_PCI_SET_PHB_MEM_WINDOW, sc->phb_id, + OPAL_M64_WINDOW_TYPE, 0 /* index */, + ((uint64_t)m64window[2] << 32) | m64window[3], 0, + ((uint64_t)m64window[4] << 32) | m64window[5]); + opal_call(OPAL_PCI_MAP_PE_MMIO_WINDOW, sc->phb_id, + OPAL_PCI_DEFAULT_PE, OPAL_M64_WINDOW_TYPE, + 0 /* index */, 0); + opal_call(OPAL_PCI_PHB_MMIO_ENABLE, sc->phb_id, + OPAL_M64_WINDOW_TYPE, 0, OPAL_ENABLE_M64_NON_SPLIT); + } + + /* + * Also disable the IOMMU for the time being for PE 1 (everything) + */ + if (bootverbose) + device_printf(dev, "Mapping 0-%#lx for DMA\n", + roundup2(powerpc_ptob(Maxmem), 16*1024*1024)); + err = opal_call(OPAL_PCI_MAP_PE_DMA_WINDOW_REAL, sc->phb_id, + OPAL_PCI_DEFAULT_PE, OPAL_PCI_DEFAULT_PE << 1, + 0 /* start address */, roundup2(powerpc_ptob(Maxmem), + 16*1024*1024)/* all RAM */); + if (err != 0) { + device_printf(dev, "DMA mapping failed: %d\n", err); + return (ENXIO); + } + + /* + * Get MSI properties + */ + sc->msi_vmem = NULL; + if (OF_getproplen(ofw_bus_get_node(dev), "ibm,opal-msi-ranges") > 0) { + cell_t msi_ranges[2]; + OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-msi-ranges", + msi_ranges, sizeof(msi_ranges)); + sc->msi_base = msi_ranges[0]; + + sc->msi_vmem = vmem_create("OPAL MSI", msi_ranges[0], + msi_ranges[1], 1, 16, M_BESTFIT | M_WAITOK); + + sc->base_msi_irq = powerpc_register_pic(dev, + OF_xref_from_node(ofw_bus_get_node(dev)), + msi_ranges[0] + msi_ranges[1], 0, FALSE); + + if (bootverbose) + device_printf(dev, "Supports %d MSIs starting at %d\n", + msi_ranges[1], msi_ranges[0]); + } + + /* + * General OFW PCI attach + */ + err = ofw_pci_init(dev); + if (err != 0) + return (err); + + /* + * Unfreeze non-config-space PCI operations. Let this fail silently + * if e.g. there is no current freeze. + */ + opal_call(OPAL_PCI_EEH_FREEZE_CLEAR, sc->phb_id, OPAL_PCI_DEFAULT_PE, + OPAL_EEH_ACTION_CLEAR_FREEZE_ALL); + + /* + * OPAL stores 64-bit BARs in a special property rather than "ranges" + */ + if (OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-m64-window", + m64window, sizeof(m64window)) == sizeof(m64window)) { + struct ofw_pci_range *rp; + + sc->ofw_sc.sc_nrange++; + sc->ofw_sc.sc_range = realloc(sc->ofw_sc.sc_range, + sc->ofw_sc.sc_nrange * sizeof(sc->ofw_sc.sc_range[0]), + M_DEVBUF, M_WAITOK); + rp = &sc->ofw_sc.sc_range[sc->ofw_sc.sc_nrange-1]; + rp->pci_hi = OFW_PCI_PHYS_HI_SPACE_MEM64 | + OFW_PCI_PHYS_HI_PREFETCHABLE; + rp->pci = ((uint64_t)m64window[0] << 32) | m64window[1]; + rp->host = ((uint64_t)m64window[2] << 32) | m64window[3]; + rp->size = ((uint64_t)m64window[4] << 32) | m64window[5]; + rman_manage_region(&sc->ofw_sc.sc_mem_rman, rp->pci, + rp->pci + rp->size - 1); + } + + return (ofw_pci_attach(dev)); +} + +static uint32_t +opalpci_read_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg, + int width) +{ + struct opalpci_softc *sc; + uint64_t config_addr; + uint8_t byte; + uint16_t half; + uint32_t word; + int error; + + sc = device_get_softc(dev); + + config_addr = (bus << 8) | ((slot & 0x1f) << 3) | (func & 0x7); + + switch (width) { + case 1: + error = opal_call(OPAL_PCI_CONFIG_READ_BYTE, sc->phb_id, + config_addr, reg, vtophys(&byte)); + word = byte; + break; + case 2: + error = opal_call(OPAL_PCI_CONFIG_READ_HALF_WORD, sc->phb_id, + config_addr, reg, vtophys(&half)); + word = half; + break; + case 4: + error = opal_call(OPAL_PCI_CONFIG_READ_WORD, sc->phb_id, + config_addr, reg, vtophys(&word)); + break; + default: + word = 0xffffffff; + } + + /* + * Poking config state for non-existant devices can make + * the host bridge hang up. Clear any errors. + * + * XXX: Make this conditional on the existence of a freeze + */ + opal_call(OPAL_PCI_EEH_FREEZE_CLEAR, sc->phb_id, OPAL_PCI_DEFAULT_PE, + OPAL_EEH_ACTION_CLEAR_FREEZE_ALL); + + if (error != OPAL_SUCCESS) + word = 0xffffffff; + + return (word); +} + +static void +opalpci_write_config(device_t dev, u_int bus, u_int slot, u_int func, + u_int reg, uint32_t val, int width) +{ + struct opalpci_softc *sc; + uint64_t config_addr; + int error = OPAL_SUCCESS; + + sc = device_get_softc(dev); + + config_addr = (bus << 8) | ((slot & 0x1f) << 3) | (func & 0x7); + + switch (width) { + case 1: + error = opal_call(OPAL_PCI_CONFIG_WRITE_BYTE, sc->phb_id, + config_addr, reg, val); + break; + case 2: + error = opal_call(OPAL_PCI_CONFIG_WRITE_HALF_WORD, sc->phb_id, + config_addr, reg, val); + break; + case 4: + error = opal_call(OPAL_PCI_CONFIG_WRITE_WORD, sc->phb_id, + config_addr, reg, val); + break; + } + + if (error != OPAL_SUCCESS) { + /* + * Poking config state for non-existant devices can make + * the host bridge hang up. Clear any errors. + */ + opal_call(OPAL_PCI_EEH_FREEZE_CLEAR, sc->phb_id, + OPAL_PCI_DEFAULT_PE, OPAL_EEH_ACTION_CLEAR_FREEZE_ALL); + } +} + +static int +opalpci_route_interrupt(device_t bus, device_t dev, int pin) +{ + return (pin); +} + +static int +opalpci_alloc_msi(device_t dev, device_t child, int count, int maxcount, + int *irqs) +{ + struct opalpci_softc *sc; + vmem_addr_t start; + phandle_t xref; + int err, i; + + sc = device_get_softc(dev); + if (sc->msi_vmem == NULL) + return (ENODEV); + + err = vmem_xalloc(sc->msi_vmem, count, powerof2(count), 0, 0, + VMEM_ADDR_MIN, VMEM_ADDR_MAX, M_BESTFIT | M_WAITOK, &start); + + if (err) + return (err); + + xref = OF_xref_from_node(ofw_bus_get_node(dev)); + for (i = 0; i < count; i++) + irqs[i] = MAP_IRQ(xref, start + i); + + return (0); +} + +static int +opalpci_release_msi(device_t dev, device_t child, int count, int *irqs) +{ + struct opalpci_softc *sc; + + sc = device_get_softc(dev); + if (sc->msi_vmem == NULL) + return (ENODEV); + + vmem_xfree(sc->msi_vmem, irqs[0] - sc->base_msi_irq, count); + return (0); +} + +static int +opalpci_alloc_msix(device_t dev, device_t child, int *irq) +{ + return (opalpci_alloc_msi(dev, child, 1, 1, irq)); +} + +static int +opalpci_release_msix(device_t dev, device_t child, int irq) +{ + return (opalpci_release_msi(dev, child, 1, &irq)); +} + +static int +opalpci_map_msi(device_t dev, device_t child, int irq, uint64_t *addr, + uint32_t *data) +{ + struct opalpci_softc *sc; + struct pci_devinfo *dinfo; + int err, xive; + + sc = device_get_softc(dev); + if (sc->msi_vmem == NULL) + return (ENODEV); + + xive = irq - sc->base_msi_irq - sc->msi_base; + opal_call(OPAL_PCI_SET_XIVE_PE, sc->phb_id, OPAL_PCI_DEFAULT_PE, xive); + + dinfo = device_get_ivars(child); + if (dinfo->cfg.msi.msi_alloc > 0 && + (dinfo->cfg.msi.msi_ctrl & PCIM_MSICTRL_64BIT) == 0) { + uint32_t msi32; + err = opal_call(OPAL_GET_MSI_32, sc->phb_id, + OPAL_PCI_DEFAULT_PE, xive, 1, vtophys(&msi32), + vtophys(data)); + *addr = be32toh(msi32); + } else { + err = opal_call(OPAL_GET_MSI_64, sc->phb_id, + OPAL_PCI_DEFAULT_PE, xive, 1, vtophys(addr), vtophys(data)); + *addr = be64toh(*addr); + } + *data = be32toh(*data); + + if (bootverbose && err != 0) + device_printf(child, "OPAL MSI mapping error: %d\n", err); + + return ((err == 0) ? 0 : ENXIO); +} + +static void +opalpic_pic_enable(device_t dev, u_int irq, u_int vector) +{ + PIC_ENABLE(root_pic, irq, vector); +} + +static void opalpic_pic_eoi(device_t dev, u_int irq) +{ + struct opalpci_softc *sc; + + sc = device_get_softc(dev); + opal_call(OPAL_PCI_MSI_EOI, sc->phb_id, irq); + + PIC_EOI(root_pic, irq); +} + +static void opalpic_pic_mask(device_t dev, u_int irq) +{ + PIC_MASK(root_pic, irq); +} + +static void opalpic_pic_unmask(device_t dev, u_int irq) +{ + PIC_UNMASK(root_pic, irq); +} + + From owner-svn-src-head@freebsd.org Fri Jan 12 12:14:16 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F629E60D4A; Fri, 12 Jan 2018 12:14:16 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3811B3801; Fri, 12 Jan 2018 12:14:16 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 62146237DC; Fri, 12 Jan 2018 12:14:15 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CCEFZc012630; Fri, 12 Jan 2018 12:14:15 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CCEESM012626; Fri, 12 Jan 2018 12:14:14 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201801121214.w0CCEESM012626@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Fri, 12 Jan 2018 12:14:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327872 - in head/sys/modules: bhnd sdhci_acpi sdhci_pci sgx X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: in head/sys/modules: bhnd sdhci_acpi sdhci_pci sgx X-SVN-Commit-Revision: 327872 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 12:14:16 -0000 Author: lwhsu (ports committer) Date: Fri Jan 12 12:14:14 2018 New Revision: 327872 URL: https://svnweb.freebsd.org/changeset/base/327872 Log: - Fix `make` in sys/modules Reviewed by: gonzo, landonf, br Differential Revision: https://reviews.freebsd.org/D13856 Modified: head/sys/modules/bhnd/Makefile head/sys/modules/sdhci_acpi/Makefile head/sys/modules/sdhci_pci/Makefile head/sys/modules/sgx/Makefile Modified: head/sys/modules/bhnd/Makefile ============================================================================== --- head/sys/modules/bhnd/Makefile Fri Jan 12 10:54:00 2018 (r327871) +++ head/sys/modules/bhnd/Makefile Fri Jan 12 12:14:14 2018 (r327872) @@ -18,6 +18,7 @@ SRCS+= chipc.c chipc_subr.c SRCS+= chipc_gpio.c SRCS+= gpio_if.h ofw_bus_if.h +SRCS+= opt_platform.h SRCS+= bhnd_sprom_chipc.c \ bhnd_pmu_chipc.c Modified: head/sys/modules/sdhci_acpi/Makefile ============================================================================== --- head/sys/modules/sdhci_acpi/Makefile Fri Jan 12 10:54:00 2018 (r327871) +++ head/sys/modules/sdhci_acpi/Makefile Fri Jan 12 12:14:14 2018 (r327872) @@ -4,6 +4,7 @@ KMOD= sdhci_acpi SRCS= sdhci_acpi.c sdhci.h sdhci_if.h -SRCS+= acpi_if.h device_if.h bus_if.h opt_acpi.h pci_if.h mmcbr_if.h +SRCS+= acpi_if.h device_if.h bus_if.h pci_if.h mmcbr_if.h +SRCS+= opt_acpi.h opt_mmccam.h .include Modified: head/sys/modules/sdhci_pci/Makefile ============================================================================== --- head/sys/modules/sdhci_pci/Makefile Fri Jan 12 10:54:00 2018 (r327871) +++ head/sys/modules/sdhci_pci/Makefile Fri Jan 12 12:14:14 2018 (r327872) @@ -4,5 +4,6 @@ KMOD= sdhci_pci SRCS= sdhci_pci.c sdhci.h sdhci_if.h device_if.h bus_if.h pci_if.h mmcbr_if.h +SRCS+= opt_mmccam.h .include Modified: head/sys/modules/sgx/Makefile ============================================================================== --- head/sys/modules/sgx/Makefile Fri Jan 12 10:54:00 2018 (r327871) +++ head/sys/modules/sgx/Makefile Fri Jan 12 12:14:14 2018 (r327872) @@ -4,6 +4,7 @@ KMOD= sgx SRCS= sgx.c sgxvar.h assym.s sgx_support.S +SRCS+= opt_compat.h opt_hwpmc_hooks.h opt_kstack_pages.h sgx_support.o: assym.s ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ From owner-svn-src-head@freebsd.org Fri Jan 12 12:14:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5EABEE60E9F; Fri, 12 Jan 2018 12:14:54 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 228933993; Fri, 12 Jan 2018 12:14:54 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43B15237E2; Fri, 12 Jan 2018 12:14:53 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CCErP7012696; Fri, 12 Jan 2018 12:14:53 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CCEqfj012692; Fri, 12 Jan 2018 12:14:52 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201801121214.w0CCEqfj012692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Fri, 12 Jan 2018 12:14:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327873 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 327873 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 12:14:54 -0000 Author: wma Date: Fri Jan 12 12:14:52 2018 New Revision: 327873 URL: https://svnweb.freebsd.org/changeset/base/327873 Log: PowerNV: update OPAL driver Update OPAL driver with: - better console support - proper AP configuration - enhanced IRQ/OFW mapping - RTC support Created by: Nathan Whitehorn Submitted by: Wojciech Macek Sponsored by: FreeBSD Foundation Modified: head/sys/powerpc/powernv/opal.h head/sys/powerpc/powernv/opal_console.c head/sys/powerpc/powernv/opal_dev.c head/sys/powerpc/powernv/platform_powernv.c Modified: head/sys/powerpc/powernv/opal.h ============================================================================== --- head/sys/powerpc/powernv/opal.h Fri Jan 12 12:14:14 2018 (r327872) +++ head/sys/powerpc/powernv/opal.h Fri Jan 12 12:14:52 2018 (r327873) @@ -40,9 +40,12 @@ int opal_call(uint64_t token, ...); #define OPAL_CONSOLE_WRITE 1 #define OPAL_CONSOLE_READ 2 +#define OPAL_RTC_READ 3 +#define OPAL_RTC_WRITE 4 #define OPAL_CEC_POWER_DOWN 5 #define OPAL_CEC_REBOOT 6 #define OPAL_HANDLE_INTERRUPT 9 +#define OPAL_POLL_EVENTS 10 #define OPAL_PCI_CONFIG_READ_BYTE 13 #define OPAL_PCI_CONFIG_READ_HALF_WORD 14 #define OPAL_PCI_CONFIG_READ_WORD 15 @@ -57,10 +60,10 @@ int opal_call(uint64_t token, ...); #define OPAL_PCI_RESET 49 #define OPAL_PCI_POLL 62 #define OPAL_PCI_SET_PE 31 -#define OPAL_START_CPU 41 #define OPAL_GET_MSI_32 39 #define OPAL_GET_MSI_64 40 #define OPAL_PCI_MSI_EOI 63 +#define OPAL_START_CPU 41 #define OPAL_PCI_MAP_PE_DMA_WINDOW_REAL 45 #define OPAL_RETURN_CPU 69 #define OPAL_REINIT_CPUS 70 Modified: head/sys/powerpc/powernv/opal_console.c ============================================================================== --- head/sys/powerpc/powernv/opal_console.c Fri Jan 12 12:14:14 2018 (r327872) +++ head/sys/powerpc/powernv/opal_console.c Fri Jan 12 12:14:52 2018 (r327873) @@ -133,42 +133,39 @@ static struct { char tmpbuf[16]; uint64_t size; struct mtx mtx; -} escapehatch; +} opalcons_buffer; static void uart_opal_real_map_outbuffer(uint64_t *bufferp, uint64_t *lenp) { - if (!mtx_initialized(&escapehatch.mtx)) - mtx_init(&escapehatch.mtx, "uart_opal", NULL, MTX_SPIN | MTX_QUIET | - MTX_NOWITNESS); + if (!mtx_initialized(&opalcons_buffer.mtx)) + mtx_init(&opalcons_buffer.mtx, "uart_opal", NULL, + MTX_SPIN | MTX_QUIET | MTX_NOWITNESS); if (!pmap_bootstrapped) return; - if (TD_IS_IDLETHREAD(curthread)) { - escapehatch.size = *(uint64_t *)(*lenp) = - min(sizeof(escapehatch.tmpbuf), *(uint64_t *)(*lenp)); - mtx_lock_spin(&escapehatch.mtx); - memcpy(escapehatch.tmpbuf, (void *)(*bufferp), *(uint64_t *)(*lenp)); - *bufferp = (uint64_t)escapehatch.tmpbuf; - *lenp = (uint64_t)&escapehatch.size; - } + mtx_lock_spin(&opalcons_buffer.mtx); - *bufferp = vtophys(*bufferp); - *lenp = vtophys(*lenp); + opalcons_buffer.size = *(uint64_t *)(*lenp) = + min(sizeof(opalcons_buffer.tmpbuf), *(uint64_t *)(*lenp)); + memcpy(opalcons_buffer.tmpbuf, (void *)(*bufferp), + *(uint64_t *)(*lenp)); + *bufferp = (uint64_t)opalcons_buffer.tmpbuf; + *lenp = (uint64_t)&opalcons_buffer.size; } static void -uart_opal_real_unmap_outbuffer(uint64_t lenp, uint64_t *origlen) +uart_opal_real_unmap_outbuffer(uint64_t *len) { - if (!pmap_bootstrapped || !TD_IS_IDLETHREAD(curthread)) + if (!pmap_bootstrapped) return; - mtx_assert(&escapehatch.mtx, MA_OWNED); - *origlen = escapehatch.size; - mtx_unlock_spin(&escapehatch.mtx); + mtx_assert(&opalcons_buffer.mtx, MA_OWNED); + *len = opalcons_buffer.size; + mtx_unlock_spin(&opalcons_buffer.mtx); } static int @@ -187,7 +184,7 @@ uart_opal_probe_node(struct uart_opal_softc *sc) return (ENXIO); reg = -1; - OF_getprop(node, "reg", ®, sizeof(reg)); + OF_getencprop(node, "reg", ®, sizeof(reg)); if (reg == -1) return (ENXIO); sc->vtermid = reg; @@ -389,7 +386,7 @@ uart_opal_put(struct uart_opal_softc *sc, void *buffer uart_opal_real_map_outbuffer(&obuf, &olen); err = opal_call(OPAL_CONSOLE_WRITE, sc->vtermid, olen, obuf); - uart_opal_real_unmap_outbuffer(olen, &len); + uart_opal_real_unmap_outbuffer(&len); } else { uart_lock(&sc->sc_mtx); if (bufsize > 12) @@ -404,7 +401,7 @@ uart_opal_put(struct uart_opal_softc *sc, void *buffer uart_opal_real_map_outbuffer(&obuf, &olen); err = opal_call(OPAL_CONSOLE_WRITE, sc->vtermid, olen, obuf); - uart_opal_real_unmap_outbuffer(olen, &len); + uart_opal_real_unmap_outbuffer(&len); uart_unlock(&sc->sc_mtx); @@ -438,7 +435,11 @@ uart_opal_cngetc(struct consdev *cp) static void uart_opal_cnputc(struct consdev *cp, int c) { + static uint64_t events; unsigned char ch = c; + + if (cold) + opal_call(OPAL_POLL_EVENTS, &events); /* Clear FIFO if needed */ uart_opal_put(console_sc, &ch, 1); } Modified: head/sys/powerpc/powernv/opal_dev.c ============================================================================== --- head/sys/powerpc/powernv/opal_dev.c Fri Jan 12 12:14:14 2018 (r327872) +++ head/sys/powerpc/powernv/opal_dev.c Fri Jan 12 12:14:52 2018 (r327873) @@ -37,7 +37,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include +#include + #include #include #include @@ -55,6 +59,7 @@ static const struct ofw_bus_devinfo *opaldev_get_devin device_t child); static void opal_shutdown(void *arg, int howto); +static void opal_intr(void *); static device_method_t opaldev_methods[] = { /* Device interface */ @@ -89,6 +94,9 @@ DRIVER_MODULE(opaldev, ofwbus, opaldev_driver, opaldev static int opaldev_probe(device_t dev) { + phandle_t iparent; + pcell_t *irqs; + int i, n_irqs; if (!ofw_bus_is_compatible(dev, "ibm,opal-v3")) return (ENXIO); @@ -96,6 +104,24 @@ opaldev_probe(device_t dev) return (ENXIO); device_set_desc(dev, "OPAL Abstraction Firmware"); + + /* Manually add IRQs before attaching */ + if (OF_hasprop(ofw_bus_get_node(dev), "opal-interrupts")) { + iparent = OF_finddevice("/interrupt-controller@0"); + iparent = OF_xref_from_node(iparent); + + n_irqs = OF_getproplen(ofw_bus_get_node(dev), + "opal-interrupts") / sizeof(*irqs); + irqs = malloc(n_irqs * sizeof(*irqs), M_DEVBUF, M_WAITOK); + OF_getencprop(ofw_bus_get_node(dev), "opal-interrupts", irqs, + n_irqs * sizeof(*irqs)); + for (i = 0; i < n_irqs; i++) + bus_set_resource(dev, SYS_RES_IRQ, i, + ofw_bus_map_intr(dev, iparent, 1, &irqs[i]), 1); + free(irqs, M_DEVBUF); + } + + return (BUS_PROBE_SPECIFIC); } @@ -104,14 +130,32 @@ opaldev_attach(device_t dev) { phandle_t child; device_t cdev; + uint64_t junk; + int i, rv; struct ofw_bus_devinfo *dinfo; + struct resource *irq; - if (0 /* XXX NOT YET TEST FOR RTC */) + /* Test for RTC support and register clock if it works */ + rv = opal_call(OPAL_RTC_READ, vtophys(&junk), vtophys(&junk)); + do { + rv = opal_call(OPAL_RTC_READ, vtophys(&junk), vtophys(&junk)); + if (rv == OPAL_BUSY_EVENT) + rv = opal_call(OPAL_POLL_EVENTS, 0); + } while (rv == OPAL_BUSY_EVENT); + + if (rv == OPAL_SUCCESS) clock_register(dev, 2000); EVENTHANDLER_REGISTER(shutdown_final, opal_shutdown, NULL, SHUTDOWN_PRI_LAST); + /* Bind to interrupts */ + for (i = 0; (irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &i, + RF_ACTIVE)) != NULL; i++) + bus_setup_intr(dev, irq, INTR_TYPE_TTY | INTR_MPSAFE | + INTR_ENTROPY, NULL, opal_intr, (void *)rman_get_start(irq), + NULL); + for (child = OF_child(ofw_bus_get_node(dev)); child != 0; child = OF_peer(child)) { dinfo = malloc(sizeof(*dinfo), M_DEVBUF, M_WAITOK | M_ZERO); @@ -134,13 +178,56 @@ opaldev_attach(device_t dev) } static int -opal_gettime(device_t dev, struct timespec *ts) { - return (ENXIO); +bcd2bin32(int bcd) +{ + int out = 0; + + out += bcd2bin(bcd & 0xff); + out += 100*bcd2bin((bcd & 0x0000ff00) >> 8); + out += 10000*bcd2bin((bcd & 0x00ff0000) >> 16); + out += 1000000*bcd2bin((bcd & 0xffff0000) >> 24); + + return (out); } static int +opal_gettime(device_t dev, struct timespec *ts) +{ + int rv; + struct clocktime ct; + uint32_t ymd; + uint64_t hmsm; + + do { + rv = opal_call(OPAL_RTC_READ, vtophys(&ymd), vtophys(&hmsm)); + if (rv == OPAL_BUSY_EVENT) { + rv = opal_call(OPAL_POLL_EVENTS, 0); + pause("opalrtc", 1); + } + } while (rv == OPAL_BUSY_EVENT); + + if (rv != OPAL_SUCCESS) + return (ENXIO); + + hmsm = be64toh(hmsm); + ymd = be32toh(ymd); + + ct.nsec = bcd2bin32((hmsm & 0x000000ffffff0000) >> 16) * 1000; + ct.sec = bcd2bin((hmsm & 0x0000ff0000000000) >> 40); + ct.min = bcd2bin((hmsm & 0x00ff000000000000) >> 48); + ct.hour = bcd2bin((hmsm & 0xff00000000000000) >> 56); + + ct.day = bcd2bin((ymd & 0x000000ff) >> 0); + ct.mon = bcd2bin((ymd & 0x0000ff00) >> 8); + ct.year = bcd2bin32((ymd & 0xffff0000) >> 16); + + return (clock_ct_to_ts(&ct, ts)); +} + +static int opal_settime(device_t dev, struct timespec *ts) { + return (0); } @@ -158,5 +245,18 @@ opal_shutdown(void *arg, int howto) opal_call(OPAL_CEC_POWER_DOWN, 0 /* Normal power off */); else opal_call(OPAL_CEC_REBOOT); + + opal_call(OPAL_RETURN_CPU); +} + +static void +opal_intr(void *xintr) +{ + uint64_t events = 0; + + opal_call(OPAL_HANDLE_INTERRUPT, (uint32_t)(uint64_t)xintr, + vtophys(&events)); + /* XXX: do something useful with this information */ + } Modified: head/sys/powerpc/powernv/platform_powernv.c ============================================================================== --- head/sys/powerpc/powernv/platform_powernv.c Fri Jan 12 12:14:14 2018 (r327872) +++ head/sys/powerpc/powernv/platform_powernv.c Fri Jan 12 12:14:52 2018 (r327873) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "platform_if.h" #include "opal.h" @@ -101,6 +102,8 @@ static platform_def_t powernv_platform = { PLATFORM_DEF(powernv_platform); +static int powernv_boot_pir; + static int powernv_probe(platform_t plat) { @@ -113,17 +116,98 @@ powernv_probe(platform_t plat) static int powernv_attach(platform_t plat) { + uint32_t nptlp, shift = 0, slb_encoding = 0; + int32_t lp_size, lp_encoding; + char buf[255]; + pcell_t prop; + phandle_t cpu; + int res, len, node, idx; + /* Ping OPAL again just to make sure */ opal_check(); cpu_idle_hook = powernv_cpu_idle; + powernv_boot_pir = mfspr(SPR_PIR); - /* Direct interrupts to SRR instead of HSRR */ - mtspr(SPR_LPCR, mfspr(SPR_LPCR) | LPCR_LPES); + /* Init CPU bits */ + powernv_smp_ap_init(plat); + /* Set SLB count from device tree */ + cpu = OF_peer(0); + cpu = OF_child(cpu); + while (cpu != 0) { + res = OF_getprop(cpu, "name", buf, sizeof(buf)); + if (res > 0 && strcmp(buf, "cpus") == 0) + break; + cpu = OF_peer(cpu); + } + if (cpu == 0) + goto out; + + cpu = OF_child(cpu); + while (cpu != 0) { + res = OF_getprop(cpu, "device_type", buf, sizeof(buf)); + if (res > 0 && strcmp(buf, "cpu") == 0) + break; + cpu = OF_peer(cpu); + } + if (cpu == 0) + goto out; + + res = OF_getencprop(cpu, "ibm,slb-size", &prop, sizeof(prop)); + if (res > 0) + n_slbs = prop; + + /* + * Scan the large page size property for PAPR compatible machines. + * See PAPR D.5 Changes to Section 5.1.4, 'CPU Node Properties' + * for the encoding of the property. + */ + + len = OF_getproplen(node, "ibm,segment-page-sizes"); + if (len > 0) { + /* + * We have to use a variable length array on the stack + * since we have very limited stack space. + */ + pcell_t arr[len/sizeof(cell_t)]; + res = OF_getencprop(cpu, "ibm,segment-page-sizes", arr, + sizeof(arr)); + len /= 4; + idx = 0; + while (len > 0) { + shift = arr[idx]; + slb_encoding = arr[idx + 1]; + nptlp = arr[idx + 2]; + idx += 3; + len -= 3; + while (len > 0 && nptlp) { + lp_size = arr[idx]; + lp_encoding = arr[idx+1]; + if (slb_encoding == SLBV_L && lp_encoding == 0) + break; + + idx += 2; + len -= 2; + nptlp--; + } + if (nptlp && slb_encoding == SLBV_L && lp_encoding == 0) + break; + } + + if (len == 0) + panic("Standard large pages (SLB[L] = 1, PTE[LP] = 0) " + "not supported by this system."); + + moea64_large_page_shift = shift; + moea64_large_page_size = 1ULL << lp_size; + } + +out: return (0); } + void powernv_mem_regions(platform_t plat, struct mem_region *phys, int *physsz, struct mem_region *avail, int *availsz) @@ -140,7 +224,7 @@ powernv_timebase_freq(platform_t plat, struct cpuref * phandle = cpuref->cr_hwref; - OF_getprop(phandle, "timebase-frequency", &ticks, sizeof(ticks)); + OF_getencprop(phandle, "timebase-frequency", &ticks, sizeof(ticks)); if (ticks <= 0) panic("Unable to determine timebase frequency!"); @@ -186,10 +270,10 @@ powernv_smp_first_cpu(platform_t plat, struct cpuref * return (ENOENT); cpuref->cr_hwref = cpu; - res = OF_getprop(cpu, "ibm,ppc-interrupt-server#s", &cpuid, + res = OF_getencprop(cpu, "ibm,ppc-interrupt-server#s", &cpuid, sizeof(cpuid)); if (res <= 0) - res = OF_getprop(cpu, "reg", &cpuid, sizeof(cpuid)); + res = OF_getencprop(cpu, "reg", &cpuid, sizeof(cpuid)); if (res <= 0) cpuid = 0; cpuref->cr_cpuid = cpuid; @@ -208,7 +292,7 @@ powernv_smp_next_cpu(platform_t plat, struct cpuref *c res = OF_getproplen(cpuref->cr_hwref, "ibm,ppc-interrupt-server#s"); if (res > 0) { cell_t interrupt_servers[res/sizeof(cell_t)]; - OF_getprop(cpuref->cr_hwref, "ibm,ppc-interrupt-server#s", + OF_getencprop(cpuref->cr_hwref, "ibm,ppc-interrupt-server#s", interrupt_servers, res); for (i = 0; i < res/sizeof(cell_t) - 1; i++) { if (interrupt_servers[i] == cpuref->cr_cpuid) { @@ -230,10 +314,10 @@ powernv_smp_next_cpu(platform_t plat, struct cpuref *c return (ENOENT); cpuref->cr_hwref = cpu; - res = OF_getprop(cpu, "ibm,ppc-interrupt-server#s", &cpuid, + res = OF_getencprop(cpu, "ibm,ppc-interrupt-server#s", &cpuid, sizeof(cpuid)); if (res <= 0) - res = OF_getprop(cpu, "reg", &cpuid, sizeof(cpuid)); + res = OF_getencprop(cpu, "reg", &cpuid, sizeof(cpuid)); if (res <= 0) cpuid = 0; cpuref->cr_cpuid = cpuid; @@ -256,6 +340,10 @@ powernv_smp_get_bsp(platform_t plat, struct cpuref *cp if (res < 0) return (ENOENT); + /* XXX: FDT from kexec lies sometimes. PIR seems not to. */ + if (cpuid == 0) + cpuid = powernv_boot_pir; + cpuref->cr_cpuid = cpuid; if (powernv_smp_first_cpu(plat, &i) != 0) @@ -299,7 +387,7 @@ powernv_smp_topo(platform_t plat) ncores = ncpus = 0; last_pc = NULL; - for (i = 0; i <= mp_maxid; i++) { + CPU_FOREACH(i) { pc = pcpu_find(i); if (pc == NULL) continue; @@ -319,7 +407,11 @@ powernv_smp_topo(platform_t plat) if (ncpus == ncores) return (smp_topo_none()); +#ifdef NOTYET /* smp_topo_1level() fails with non-consecutive CPU IDs */ return (smp_topo_1level(CG_SHARE_L1, ncpus / ncores, CG_FLAG_SMT)); +#else + return (smp_topo_none()); +#endif } #endif @@ -333,6 +425,9 @@ powernv_reset(platform_t platform) static void powernv_smp_ap_init(platform_t platform) { + + /* Direct interrupts to SRR instead of HSRR and reset LPCR otherwise */ + mtspr(SPR_LPCR, LPCR_LPES); } static void From owner-svn-src-head@freebsd.org Fri Jan 12 13:39:03 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8CC4CE6508A; Fri, 12 Jan 2018 13:39:03 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6582469D16; Fri, 12 Jan 2018 13:39:03 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E4C124502; Fri, 12 Jan 2018 13:39:02 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CDd22Q046529; Fri, 12 Jan 2018 13:39:02 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CDd2ml046528; Fri, 12 Jan 2018 13:39:02 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201801121339.w0CDd2ml046528@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 12 Jan 2018 13:39:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327874 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 327874 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 13:39:03 -0000 Author: mjg Date: Fri Jan 12 13:39:02 2018 New Revision: 327874 URL: https://svnweb.freebsd.org/changeset/base/327874 Log: vfs: tidy up vdrop Skip vfs_refcount_release_if_not_last if the interlock is held and just go straight to refcount_release. While here do cosmetic rearrangement of _vhold to better show it contains equivalent behaviour. Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Fri Jan 12 12:14:52 2018 (r327873) +++ head/sys/kern/vfs_subr.c Fri Jan 12 13:39:02 2018 (r327874) @@ -2840,14 +2840,14 @@ _vhold(struct vnode *vp, bool locked) else ASSERT_VI_UNLOCKED(vp, __func__); CTR2(KTR_VFS, "%s: vp %p", __func__, vp); - if (!locked && vfs_refcount_acquire_if_not_zero(&vp->v_holdcnt)) { - VNASSERT((vp->v_iflag & VI_FREE) == 0, vp, - ("_vhold: vnode with holdcnt is free")); - return; - } - - if (!locked) + if (!locked) { + if (vfs_refcount_acquire_if_not_zero(&vp->v_holdcnt)) { + VNASSERT((vp->v_iflag & VI_FREE) == 0, vp, + ("_vhold: vnode with holdcnt is free")); + return; + } VI_LOCK(vp); + } if ((vp->v_iflag & VI_FREE) == 0) { refcount_acquire(&vp->v_holdcnt); if (!locked) @@ -2911,14 +2911,11 @@ _vdrop(struct vnode *vp, bool locked) CTR2(KTR_VFS, "%s: vp %p", __func__, vp); if ((int)vp->v_holdcnt <= 0) panic("vdrop: holdcnt %d", vp->v_holdcnt); - if (vfs_refcount_release_if_not_last(&vp->v_holdcnt)) { - if (locked) - VI_UNLOCK(vp); - return; - } - - if (!locked) + if (!locked) { + if (vfs_refcount_release_if_not_last(&vp->v_holdcnt)) + return; VI_LOCK(vp); + } if (refcount_release(&vp->v_holdcnt) == 0) { VI_UNLOCK(vp); return; From owner-svn-src-head@freebsd.org Fri Jan 12 13:40:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91666E6526F; Fri, 12 Jan 2018 13:40:51 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6DDD669F80; Fri, 12 Jan 2018 13:40:51 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6DFD2451F; Fri, 12 Jan 2018 13:40:50 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CDeoMF046645; Fri, 12 Jan 2018 13:40:50 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CDeoI9046644; Fri, 12 Jan 2018 13:40:50 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201801121340.w0CDeoI9046644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 12 Jan 2018 13:40:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327875 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 327875 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 13:40:51 -0000 Author: mjg Date: Fri Jan 12 13:40:50 2018 New Revision: 327875 URL: https://svnweb.freebsd.org/changeset/base/327875 Log: mtx: use fcmpset to cover setting MTX_CONTESTED Modified: head/sys/kern/kern_mutex.c Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Fri Jan 12 13:39:02 2018 (r327874) +++ head/sys/kern/kern_mutex.c Fri Jan 12 13:40:50 2018 (r327875) @@ -578,6 +578,7 @@ __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v) ts = turnstile_trywait(&m->lock_object); v = MTX_READ_VALUE(m); +retry_turnstile: /* * Check if the lock has been released while spinning for @@ -609,10 +610,8 @@ __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v) * or the state of the MTX_RECURSED bit changed. */ if ((v & MTX_CONTESTED) == 0 && - !atomic_cmpset_ptr(&m->mtx_lock, v, v | MTX_CONTESTED)) { - turnstile_cancel(ts); - v = MTX_READ_VALUE(m); - continue; + !atomic_fcmpset_ptr(&m->mtx_lock, &v, v | MTX_CONTESTED)) { + goto retry_turnstile; } /* From owner-svn-src-head@freebsd.org Fri Jan 12 14:01:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29ABBE663B7; Fri, 12 Jan 2018 14:01:40 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 05A796ADB3; Fri, 12 Jan 2018 14:01:40 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44332248AE; Fri, 12 Jan 2018 14:01:39 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CE1d0Z058243; Fri, 12 Jan 2018 14:01:39 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CE1cW4058239; Fri, 12 Jan 2018 14:01:38 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201801121401.w0CE1cW4058239@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 12 Jan 2018 14:01:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327876 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 327876 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 14:01:40 -0000 Author: andrew Date: Fri Jan 12 14:01:38 2018 New Revision: 327876 URL: https://svnweb.freebsd.org/changeset/base/327876 Log: Workaround Spectre Variant 2 on arm64. We need to handle two cases: 1. One process attacking another process. 2. A process attacking the kernel. For the first case we clear the branch predictor state on context switch between different processes. For the second we do this when taking an instruction abort on a non-userspace address. To clear the branch predictor state a per-CPU function pointer has been added. This is set by the new cpu errata code based on if the CPU is known to be affected. On Cortex-A57, A72, A73, and A75 we call into the PSCI firmware as newer versions of this will clear the branch predictor state for us. It has been reported the ThunderX is unaffected, however the ThunderX2 is vulnerable. The Qualcomm Falkor core is also affected. As FreeBSD doesn't yet run on the ThunderX2 or Falkor no workaround is included for these CPUs. MFC after: 3 days Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D13812 Modified: head/sys/arm64/arm64/cpu_errata.c head/sys/arm64/arm64/pmap.c head/sys/arm64/arm64/trap.c head/sys/arm64/include/pcpu.h Modified: head/sys/arm64/arm64/cpu_errata.c ============================================================================== --- head/sys/arm64/arm64/cpu_errata.c Fri Jan 12 13:40:50 2018 (r327875) +++ head/sys/arm64/arm64/cpu_errata.c Fri Jan 12 14:01:38 2018 (r327876) @@ -30,6 +30,8 @@ * SUCH DAMAGE. */ +#include "opt_platform.h" + #include __FBSDID("$FreeBSD$"); @@ -39,6 +41,10 @@ __FBSDID("$FreeBSD$"); #include +#ifdef DEV_PSCI +#include +#endif + typedef void (cpu_quirk_install)(void); struct cpu_quirks { cpu_quirk_install *quirk_install; @@ -49,7 +55,36 @@ struct cpu_quirks { static cpu_quirk_install install_psci_bp_hardening; static struct cpu_quirks cpu_quirks[] = { + { + .midr_mask = CPU_IMPL_MASK | CPU_PART_MASK, + .midr_value = CPU_ID_RAW(CPU_IMPL_ARM, CPU_PART_CORTEX_A57,0,0), + .quirk_install = install_psci_bp_hardening, + }, + { + .midr_mask = CPU_IMPL_MASK | CPU_PART_MASK, + .midr_value = CPU_ID_RAW(CPU_IMPL_ARM, CPU_PART_CORTEX_A72,0,0), + .quirk_install = install_psci_bp_hardening, + }, + { + .midr_mask = CPU_IMPL_MASK | CPU_PART_MASK, + .midr_value = CPU_ID_RAW(CPU_IMPL_ARM, CPU_PART_CORTEX_A73,0,0), + .quirk_install = install_psci_bp_hardening, + }, + { + .midr_mask = CPU_IMPL_MASK | CPU_PART_MASK, + .midr_value = CPU_ID_RAW(CPU_IMPL_ARM, CPU_PART_CORTEX_A75,0,0), + .quirk_install = install_psci_bp_hardening, + }, }; + +static void +install_psci_bp_hardening(void) +{ + +#ifdef DEV_PSCI + PCPU_SET(bp_harden, psci_get_version); +#endif +} void install_cpu_errata(void) Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Fri Jan 12 13:40:50 2018 (r327875) +++ head/sys/arm64/arm64/pmap.c Fri Jan 12 14:01:38 2018 (r327876) @@ -4663,6 +4663,7 @@ pmap_activate(struct thread *td) struct pcb * pmap_switch(struct thread *old, struct thread *new) { + pcpu_bp_harden bp_harden; struct pcb *pcb; /* Store the new curthread */ @@ -4690,6 +4691,15 @@ pmap_switch(struct thread *old, struct thread *new) "dsb ish \n" "isb \n" : : "r"(new->td_proc->p_md.md_l0addr)); + + /* + * Stop userspace from training the branch predictor against + * other processes. This will call into a CPU specific + * function that clears the branch predictor state. + */ + bp_harden = PCPU_GET(bp_harden); + if (bp_harden != NULL) + bp_harden(); } return (pcb); Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Fri Jan 12 13:40:50 2018 (r327875) +++ head/sys/arm64/arm64/trap.c Fri Jan 12 14:01:38 2018 (r327876) @@ -352,6 +352,7 @@ do_el1h_sync(struct thread *td, struct trapframe *fram void do_el0_sync(struct thread *td, struct trapframe *frame) { + pcpu_bp_harden bp_harden; uint32_t exception; uint64_t esr, far; @@ -363,11 +364,25 @@ do_el0_sync(struct thread *td, struct trapframe *frame esr = frame->tf_esr; exception = ESR_ELx_EXCEPTION(esr); switch (exception) { - case EXCP_UNKNOWN: case EXCP_INSN_ABORT_L: + far = READ_SPECIALREG(far_el1); + + /* + * Userspace may be trying to train the branch predictor to + * attack the kernel. If we are on a CPU affected by this + * call the handler to clear the branch predictor state. + */ + if (far > VM_MAXUSER_ADDRESS) { + bp_harden = PCPU_GET(bp_harden); + if (bp_harden != NULL) + bp_harden(); + } + break; + case EXCP_UNKNOWN: case EXCP_DATA_ABORT_L: case EXCP_DATA_ABORT: far = READ_SPECIALREG(far_el1); + break; } intr_enable(); Modified: head/sys/arm64/include/pcpu.h ============================================================================== --- head/sys/arm64/include/pcpu.h Fri Jan 12 13:40:50 2018 (r327875) +++ head/sys/arm64/include/pcpu.h Fri Jan 12 14:01:38 2018 (r327876) @@ -35,11 +35,14 @@ #define ALT_STACK_SIZE 128 +typedef int (*pcpu_bp_harden)(void); + #define PCPU_MD_FIELDS \ u_int pc_acpi_id; /* ACPI CPU id */ \ u_int pc_midr; /* stored MIDR value */ \ uint64_t pc_clock; \ - char __pad[241] + pcpu_bp_harden pc_bp_harden; \ + char __pad[233] #ifdef _KERNEL From owner-svn-src-head@freebsd.org Fri Jan 12 14:10:59 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9684DE66D94 for ; Fri, 12 Jan 2018 14:10:59 +0000 (UTC) (envelope-from mw@semihalf.com) Received: from mail-it0-x22d.google.com (mail-it0-x22d.google.com [IPv6:2607:f8b0:4001:c0b::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 60EEF6B4F5 for ; Fri, 12 Jan 2018 14:10:59 +0000 (UTC) (envelope-from mw@semihalf.com) Received: by mail-it0-x22d.google.com with SMTP id c102so1841131itd.0 for ; Fri, 12 Jan 2018 06:10:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=55DDVw8HpcnpggjM2UJJnqdGH+FBVP6pNAW7mmwPj4g=; b=YfiKhCUVDXjK0hMw+yQUvST/5NvtxE2wjGFW+lXAp+OJ55nLBMIQOLwWrHeFml4cmR FTVQ1kX7obUvWBiXB9mY6FddFUdOf3kppoq00LqaXsrGUSUeJDi26o49FDOWgH6uqWoJ GZ9nRO0+JxomONl/hhPSqRpv61dsGa3HBrCaXFpKzmHUNIYjolvh4pnax/ABTEH9CYIs Gjx/DCXVt6jbqZUjTUETOkUvUpBVkRZ52KCvKE1VFstuW3Ra7oX/wrIgNUzKUJsIxYwH KiUGUShWhlrmpwschbvQXW07BVm0VmV8ksC8j5QNpgCuQSOZNZGI6GqF0sW5fdKF8CIN yRFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=55DDVw8HpcnpggjM2UJJnqdGH+FBVP6pNAW7mmwPj4g=; b=Ex55CdbDoA+NNJWhQbtCxytSGmfDWllwzFaw3HgImBO2eDNAMsXbzu52tHlaTQy0Ob eZacbDERtv+Uq2sFqHtjPztybBlT1Gcn7VETcygSvc40oHN9R3J/dRxoekAqelyFEY/x IZCI5F+A6mOO3StTqVtjKRmzBbez9djcL/obxHjFz4xbB2BUWajq+wSQh0gUcLHaK21D zyhm4PTYT0lLXQ5MDF5qEgnHx85gIB4q2XMsYnHqZ2TmDxFO0XFNNYfYOpdaMpU6zKXc K7VWXt2PtZxKuu1jsb8GEx/QkxIpXjt9O72PgRYZtx5OS+ULxCEav6rpelIlOPaAc8tI cWTw== X-Gm-Message-State: AKwxytetQ4LklEUk3G5wPSxxqnPR8DtJIyqGXbLUOvBANP6O1oVbOjnO a/KNWKJ800/xrVyUZ0BEGxQBt6m6Mz9fXcEYthh/MvKG X-Google-Smtp-Source: ACJfBosJboz518wxY8XSXvK6kJDnbXYpNI4puBxDU47NComeqsBZkghmGH8eIbJ9VLgc1uSc8s9bM5+HqOhjDCo3wUs= X-Received: by 10.36.148.139 with SMTP id j133mr5108303ite.148.1515766258598; Fri, 12 Jan 2018 06:10:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.37.13 with HTTP; Fri, 12 Jan 2018 06:10:58 -0800 (PST) In-Reply-To: <201801121401.w0CE1cW4058239@repo.freebsd.org> References: <201801121401.w0CE1cW4058239@repo.freebsd.org> From: Marcin Wojtas Date: Fri, 12 Jan 2018 15:10:58 +0100 Message-ID: Subject: Re: svn commit: r327876 - in head/sys/arm64: arm64 include To: Andrew Turner Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 14:10:59 -0000 Hi Andrew, 2018-01-12 15:01 GMT+01:00 Andrew Turner : > Author: andrew > Date: Fri Jan 12 14:01:38 2018 > New Revision: 327876 > URL: https://svnweb.freebsd.org/changeset/base/327876 > > Log: > Workaround Spectre Variant 2 on arm64. > > We need to handle two cases: > > 1. One process attacking another process. > 2. A process attacking the kernel. > > For the first case we clear the branch predictor state on context switch > between different processes. For the second we do this when taking an > instruction abort on a non-userspace address. > > To clear the branch predictor state a per-CPU function pointer has been > added. This is set by the new cpu errata code based on if the CPU is > known to be affected. > > On Cortex-A57, A72, A73, and A75 we call into the PSCI firmware as newer > versions of this will clear the branch predictor state for us. > > It has been reported the ThunderX is unaffected, however the ThunderX2 is > vulnerable. The Qualcomm Falkor core is also affected. As FreeBSD doesn't > yet run on the ThunderX2 or Falkor no workaround is included for these CPUs. Regardless ThunderX2 / Falkor work-arounds, do I understand correctly that pure CA72 machines, such as Marvell Armada 7k/8k are immune to Variant 2 now? Thanks, Marcin > > MFC after: 3 days > Sponsored by: DARPA, AFRL > Differential Revision: https://reviews.freebsd.org/D13812 > > Modified: > head/sys/arm64/arm64/cpu_errata.c > head/sys/arm64/arm64/pmap.c > head/sys/arm64/arm64/trap.c > head/sys/arm64/include/pcpu.h > > Modified: head/sys/arm64/arm64/cpu_errata.c > ============================================================================== > --- head/sys/arm64/arm64/cpu_errata.c Fri Jan 12 13:40:50 2018 (r327875) > +++ head/sys/arm64/arm64/cpu_errata.c Fri Jan 12 14:01:38 2018 (r327876) > @@ -30,6 +30,8 @@ > * SUCH DAMAGE. > */ > > +#include "opt_platform.h" > + > #include > __FBSDID("$FreeBSD$"); > > @@ -39,6 +41,10 @@ __FBSDID("$FreeBSD$"); > > #include > > +#ifdef DEV_PSCI > +#include > +#endif > + > typedef void (cpu_quirk_install)(void); > struct cpu_quirks { > cpu_quirk_install *quirk_install; > @@ -49,7 +55,36 @@ struct cpu_quirks { > static cpu_quirk_install install_psci_bp_hardening; > > static struct cpu_quirks cpu_quirks[] = { > + { > + .midr_mask = CPU_IMPL_MASK | CPU_PART_MASK, > + .midr_value = CPU_ID_RAW(CPU_IMPL_ARM, CPU_PART_CORTEX_A57,0,0), > + .quirk_install = install_psci_bp_hardening, > + }, > + { > + .midr_mask = CPU_IMPL_MASK | CPU_PART_MASK, > + .midr_value = CPU_ID_RAW(CPU_IMPL_ARM, CPU_PART_CORTEX_A72,0,0), > + .quirk_install = install_psci_bp_hardening, > + }, > + { > + .midr_mask = CPU_IMPL_MASK | CPU_PART_MASK, > + .midr_value = CPU_ID_RAW(CPU_IMPL_ARM, CPU_PART_CORTEX_A73,0,0), > + .quirk_install = install_psci_bp_hardening, > + }, > + { > + .midr_mask = CPU_IMPL_MASK | CPU_PART_MASK, > + .midr_value = CPU_ID_RAW(CPU_IMPL_ARM, CPU_PART_CORTEX_A75,0,0), > + .quirk_install = install_psci_bp_hardening, > + }, > }; > + > +static void > +install_psci_bp_hardening(void) > +{ > + > +#ifdef DEV_PSCI > + PCPU_SET(bp_harden, psci_get_version); > +#endif > +} > > void > install_cpu_errata(void) > > Modified: head/sys/arm64/arm64/pmap.c > ============================================================================== > --- head/sys/arm64/arm64/pmap.c Fri Jan 12 13:40:50 2018 (r327875) > +++ head/sys/arm64/arm64/pmap.c Fri Jan 12 14:01:38 2018 (r327876) > @@ -4663,6 +4663,7 @@ pmap_activate(struct thread *td) > struct pcb * > pmap_switch(struct thread *old, struct thread *new) > { > + pcpu_bp_harden bp_harden; > struct pcb *pcb; > > /* Store the new curthread */ > @@ -4690,6 +4691,15 @@ pmap_switch(struct thread *old, struct thread *new) > "dsb ish \n" > "isb \n" > : : "r"(new->td_proc->p_md.md_l0addr)); > + > + /* > + * Stop userspace from training the branch predictor against > + * other processes. This will call into a CPU specific > + * function that clears the branch predictor state. > + */ > + bp_harden = PCPU_GET(bp_harden); > + if (bp_harden != NULL) > + bp_harden(); > } > > return (pcb); > > Modified: head/sys/arm64/arm64/trap.c > ============================================================================== > --- head/sys/arm64/arm64/trap.c Fri Jan 12 13:40:50 2018 (r327875) > +++ head/sys/arm64/arm64/trap.c Fri Jan 12 14:01:38 2018 (r327876) > @@ -352,6 +352,7 @@ do_el1h_sync(struct thread *td, struct trapframe *fram > void > do_el0_sync(struct thread *td, struct trapframe *frame) > { > + pcpu_bp_harden bp_harden; > uint32_t exception; > uint64_t esr, far; > > @@ -363,11 +364,25 @@ do_el0_sync(struct thread *td, struct trapframe *frame > esr = frame->tf_esr; > exception = ESR_ELx_EXCEPTION(esr); > switch (exception) { > - case EXCP_UNKNOWN: > case EXCP_INSN_ABORT_L: > + far = READ_SPECIALREG(far_el1); > + > + /* > + * Userspace may be trying to train the branch predictor to > + * attack the kernel. If we are on a CPU affected by this > + * call the handler to clear the branch predictor state. > + */ > + if (far > VM_MAXUSER_ADDRESS) { > + bp_harden = PCPU_GET(bp_harden); > + if (bp_harden != NULL) > + bp_harden(); > + } > + break; > + case EXCP_UNKNOWN: > case EXCP_DATA_ABORT_L: > case EXCP_DATA_ABORT: > far = READ_SPECIALREG(far_el1); > + break; > } > intr_enable(); > > > Modified: head/sys/arm64/include/pcpu.h > ============================================================================== > --- head/sys/arm64/include/pcpu.h Fri Jan 12 13:40:50 2018 (r327875) > +++ head/sys/arm64/include/pcpu.h Fri Jan 12 14:01:38 2018 (r327876) > @@ -35,11 +35,14 @@ > > #define ALT_STACK_SIZE 128 > > +typedef int (*pcpu_bp_harden)(void); > + > #define PCPU_MD_FIELDS \ > u_int pc_acpi_id; /* ACPI CPU id */ \ > u_int pc_midr; /* stored MIDR value */ \ > uint64_t pc_clock; \ > - char __pad[241] > + pcpu_bp_harden pc_bp_harden; \ > + char __pad[233] > > #ifdef _KERNEL > > From owner-svn-src-head@freebsd.org Fri Jan 12 14:16:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7606DE671F6; Fri, 12 Jan 2018 14:16:08 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id 4334D6BAF6; Fri, 12 Jan 2018 14:16:07 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from [IPv6:2001:630:212:2a8:ad58:428a:6221:67a0] (unknown [IPv6:2001:630:212:2a8:ad58:428a:6221:67a0]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id 99BE04E78C; Fri, 12 Jan 2018 14:15:35 +0000 (UTC) From: Andrew Turner Message-Id: Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: svn commit: r327876 - in head/sys/arm64: arm64 include Date: Fri, 12 Jan 2018 14:15:34 +0000 In-Reply-To: Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Marcin Wojtas References: <201801121401.w0CE1cW4058239@repo.freebsd.org> X-Mailer: Apple Mail (2.3445.5.20) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 14:16:08 -0000 > On 12 Jan 2018, at 14:10, Marcin Wojtas wrote: >=20 > Hi Andrew, >=20 >=20 >=20 > 2018-01-12 15:01 GMT+01:00 Andrew Turner >: >> Author: andrew >> Date: Fri Jan 12 14:01:38 2018 >> New Revision: 327876 >> URL: https://svnweb.freebsd.org/changeset/base/327876 >>=20 >> Log: >> Workaround Spectre Variant 2 on arm64. >>=20 >> We need to handle two cases: >>=20 >> 1. One process attacking another process. >> 2. A process attacking the kernel. >>=20 >> For the first case we clear the branch predictor state on context = switch >> between different processes. For the second we do this when taking = an >> instruction abort on a non-userspace address. >>=20 >> To clear the branch predictor state a per-CPU function pointer has = been >> added. This is set by the new cpu errata code based on if the CPU is >> known to be affected. >>=20 >> On Cortex-A57, A72, A73, and A75 we call into the PSCI firmware as = newer >> versions of this will clear the branch predictor state for us. >>=20 >> It has been reported the ThunderX is unaffected, however the = ThunderX2 is >> vulnerable. The Qualcomm Falkor core is also affected. As FreeBSD = doesn't >> yet run on the ThunderX2 or Falkor no workaround is included for = these CPUs. >=20 > Regardless ThunderX2 / Falkor work-arounds, do I understand correctly > that pure CA72 machines, such as Marvell Armada 7k/8k are immune to > Variant 2 now? It is my understanding that the A72 will be immune with this patch and = an updated Arm Trusted Firmware as documented in [1]. Andrew [1] = https://github.com/ARM-software/arm-trusted-firmware/wiki/ARM-Trusted-Firm= ware-Security-Advisory-TFV-6 = From owner-svn-src-head@freebsd.org Fri Jan 12 14:37:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62B89E6863B for ; Fri, 12 Jan 2018 14:37:55 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x233.google.com (mail-it0-x233.google.com [IPv6:2607:f8b0:4001:c0b::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 255746D691 for ; Fri, 12 Jan 2018 14:37:55 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x233.google.com with SMTP id u62so9322433ita.2 for ; Fri, 12 Jan 2018 06:37:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=wgSF2+VfuwU8M83moU1SY/WYdvAZyjtzABKKJDb8OuA=; b=SM+J2DfitOLPlGSo3FwO/lo6DzJImsVVf7u+Dwy/zgXfEh4GGb4hNuX2e+6uAAA3Xu iBYFKfbtKHWyE0+hcsxU5II0XY/83KUJk6iOlIBuorPp/XvTGV7x1C6cOR8sPXxNaPDs fhxz+B51EgMhVtFzJJtzAjdiviQsSNuPc4ED5Qe+zRt8V9rkHy4Ym+WkVJkSyf2IIQeh AoSho4YXsTeFtJRSf+iLu2K9YhwCJJyE2e6Od28oGNHrFNGpBCM7+cQiDvO+QOV3vBJp ImGgCz2GKZWGCBAVvbo3l7YsrMNcsbrknnnUdxC67ivbbMILtlEmwgiCLPN7Y8uqYf+K EGog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=wgSF2+VfuwU8M83moU1SY/WYdvAZyjtzABKKJDb8OuA=; b=tdt3iC/vYGPLQRhS2X4cNeZIwVycbqdmXRoNEiAZiKivBrG2Hicdj2+KmdptmNdukW r9adGaPREP+wWWe4olXKxWvIGZaswJnrgU/uP+lteY05DzkCZj2qji1ZP+GpzUqi88jE nNpPWeau1lHLo2VtdejzSeeFvaby7ULtQlfoAWARICPhR9WcQODk+BoSfE+W/Tt9zPqe VnmLO33KZwYNkXNspLfe0n2pQ4QQDM6fLLbdDB6Ko6noDbJ769iM6nrcvjCpGGe8YYrL aHFgrUKi/t7nzlkmZFpSP7vtuPTVlTBk9ipQWMYtPbrmNy2ADf0hum3WShtVxf+lV2qD 7rkQ== X-Gm-Message-State: AKwxytcLUF8uJQH7OxePfQPqZzjNfByi/UoElAQ0AHHiGgh4PiAd4uTD 9+ptONaVhStgWyKDGA6fKFiVNjuS9fy9WMcr5wZuyw== X-Google-Smtp-Source: ACJfBotPn1yGWNbdfa/CoiJdfNLhg2UbxHlgrQQwTKTjgkDLuYt8EQHE95pMXfJ3FSTrqumjcLKdcOoXzhnqPBzsVZ8= X-Received: by 10.36.3.144 with SMTP id e138mr5183691ite.97.1515767874286; Fri, 12 Jan 2018 06:37:54 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.199.131 with HTTP; Fri, 12 Jan 2018 06:37:53 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:18a2:a4f7:170:8dd9] In-Reply-To: References: <201801121401.w0CE1cW4058239@repo.freebsd.org> From: Warner Losh Date: Fri, 12 Jan 2018 07:37:53 -0700 X-Google-Sender-Auth: p_Xw6E5vKhNyee-Zw749MfTYgtw Message-ID: Subject: Re: svn commit: r327876 - in head/sys/arm64: arm64 include To: Andrew Turner Cc: Marcin Wojtas , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 14:37:55 -0000 On Fri, Jan 12, 2018 at 7:15 AM, Andrew Turner wrote: > > > On 12 Jan 2018, at 14:10, Marcin Wojtas wrote: > > Hi Andrew, > > > > 2018-01-12 15:01 GMT+01:00 Andrew Turner : > > Author: andrew > Date: Fri Jan 12 14:01:38 2018 > New Revision: 327876 > URL: https://svnweb.freebsd.org/changeset/base/327876 > > Log: > Workaround Spectre Variant 2 on arm64. > > We need to handle two cases: > > 1. One process attacking another process. > 2. A process attacking the kernel. > > For the first case we clear the branch predictor state on context switch > between different processes. For the second we do this when taking an > instruction abort on a non-userspace address. > > To clear the branch predictor state a per-CPU function pointer has been > added. This is set by the new cpu errata code based on if the CPU is > known to be affected. > > On Cortex-A57, A72, A73, and A75 we call into the PSCI firmware as newer > versions of this will clear the branch predictor state for us. > > It has been reported the ThunderX is unaffected, however the ThunderX2 is > vulnerable. The Qualcomm Falkor core is also affected. As FreeBSD doesn't > yet run on the ThunderX2 or Falkor no workaround is included for these > CPUs. > > > Regardless ThunderX2 / Falkor work-arounds, do I understand correctly > that pure CA72 machines, such as Marvell Armada 7k/8k are immune to > Variant 2 now? > > > It is my understanding that the A72 will be immune with this patch and an > updated Arm Trusted Firmware as documented in [1]. > > Andrew > > [1] https://github.com/ARM-software/arm-trusted-firmware/ > wiki/ARM-Trusted-Firmware-Security-Advisory-TFV-6 > Are you also working on aarch32 mitigation? Warner From owner-svn-src-head@freebsd.org Fri Jan 12 14:52:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DAF3E69213; Fri, 12 Jan 2018 14:52:05 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id CE4FE6E1F0; Fri, 12 Jan 2018 14:52:04 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from [IPv6:2001:630:212:2a8:ad58:428a:6221:67a0] (unknown [IPv6:2001:630:212:2a8:ad58:428a:6221:67a0]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id 9C19C4E78C; Fri, 12 Jan 2018 14:52:03 +0000 (UTC) From: Andrew Turner Message-Id: Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: svn commit: r327876 - in head/sys/arm64: arm64 include Date: Fri, 12 Jan 2018 14:52:02 +0000 In-Reply-To: Cc: Marcin Wojtas , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Warner Losh References: <201801121401.w0CE1cW4058239@repo.freebsd.org> X-Mailer: Apple Mail (2.3445.5.20) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 14:52:05 -0000 > On 12 Jan 2018, at 14:37, Warner Losh wrote: >=20 >=20 >=20 > On Fri, Jan 12, 2018 at 7:15 AM, Andrew Turner > wrote: >=20 >=20 >> On 12 Jan 2018, at 14:10, Marcin Wojtas > wrote: >>=20 >> Hi Andrew, >>=20 >>=20 >>=20 >> 2018-01-12 15:01 GMT+01:00 Andrew Turner >: >>> Author: andrew >>> Date: Fri Jan 12 14:01:38 2018 >>> New Revision: 327876 >>> URL: https://svnweb.freebsd.org/changeset/base/327876 = >>>=20 >>> Log: >>> Workaround Spectre Variant 2 on arm64. >>>=20 >>> We need to handle two cases: >>>=20 >>> 1. One process attacking another process. >>> 2. A process attacking the kernel. >>>=20 >>> For the first case we clear the branch predictor state on context = switch >>> between different processes. For the second we do this when taking = an >>> instruction abort on a non-userspace address. >>>=20 >>> To clear the branch predictor state a per-CPU function pointer has = been >>> added. This is set by the new cpu errata code based on if the CPU = is >>> known to be affected. >>>=20 >>> On Cortex-A57, A72, A73, and A75 we call into the PSCI firmware as = newer >>> versions of this will clear the branch predictor state for us. >>>=20 >>> It has been reported the ThunderX is unaffected, however the = ThunderX2 is >>> vulnerable. The Qualcomm Falkor core is also affected. As FreeBSD = doesn't >>> yet run on the ThunderX2 or Falkor no workaround is included for = these CPUs. >>=20 >> Regardless ThunderX2 / Falkor work-arounds, do I understand correctly >> that pure CA72 machines, such as Marvell Armada 7k/8k are immune to >> Variant 2 now? >=20 > It is my understanding that the A72 will be immune with this patch and = an updated Arm Trusted Firmware as documented in [1]. >=20 > Andrew >=20 > [1] = https://github.com/ARM-software/arm-trusted-firmware/wiki/ARM-Trusted-Firm= ware-Security-Advisory-TFV-6 = >=20 > Are you also working on aarch32 mitigation? No. I think a similar technique could be used, however as aarch32 has = instructions to invalidate the branch predictor these can be used = directly. Andrew= From owner-svn-src-head@freebsd.org Fri Jan 12 14:54:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F01C4E69454 for ; Fri, 12 Jan 2018 14:54:14 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22d.google.com (mail-it0-x22d.google.com [IPv6:2607:f8b0:4001:c0b::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B26216E677 for ; Fri, 12 Jan 2018 14:54:14 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22d.google.com with SMTP id b5so9351242itc.3 for ; Fri, 12 Jan 2018 06:54:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Go4lAj5ElGPELLGX4kIGa4LVnPjIn6Fsn267DIqUfyk=; b=rpG9IP5WD5KDJDM1l3ludSYp0oQbHGfeG+wJTbvDzi0uicZ0UakNOvKV3unuzzwbja JjlL2cq2TDzpYG4cgK49sNVOUiC028CkaQ9fe674KX2aODXO7R2jf0Y1CX65JE2cbX4i zsoT0zzucUddfqheyS4KPl4Uovy6KRfXZaIkNKo1w0/VKSAZuioV/ag62Lflrf1O4iEk eeQtrBZwNTagigUeKWqQ+z9rZjROheQuzrsbsY1daj2zCsMSzNSAgOlfHeBcxUjOyL4K vNJoUlYR4XSpAYWZwBczHUT/cc+9wlN2gDiuYUhAtZXiPdw37y5bCvXmWtE696ypy8TA mdGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Go4lAj5ElGPELLGX4kIGa4LVnPjIn6Fsn267DIqUfyk=; b=dRDEIbW4sJ6QvhRoDW4j7vFukwf59umqKIRkyqZzVYFJo7KsV7hknB04PNIiGL6ah6 RVQARHJ8Bf6GR//JLcaneBxKymwNUIGMmggY/hofVNuTjrxt1YYmEERzm1HgfVE4NbXD zt/1LXhxX+uqzHASj/yBgSS4vlMlntUIz5deMKLTiXZvc+HmKu6IZ8c6Yws2mSRqlrLS /svgfO3uRfvHAAZN/o1V02GEPqJcGOy+57BGhAS8PPoYfdG5z+/DKG+FoSodHZ2Ju8YY eDHe6DQsnwdQb+u2tovyVPtqOtMi2mEQGsLF8Uv9iyWONot5ez6G0yKWJTN5jjKQTLx5 weew== X-Gm-Message-State: AKwxytcHtR1qCUnm7xXF/EWvnoUZn1b+dVABSgD3OpjyRpopgdlMfXnO yTpl/2cRu5vTZBb3V88KVPJIoIJbIK0SvlL4u5CEvw== X-Google-Smtp-Source: ACJfBovSN5WTvV+TkdaaydXOA/T6OVABP4/3XPKmgUQZe+kXJqfUBAOsG9XH71xnzzw5o/M/hIVy3OuVpzR74EeL9mg= X-Received: by 10.36.74.200 with SMTP id k191mr5591757itb.69.1515768853896; Fri, 12 Jan 2018 06:54:13 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.199.131 with HTTP; Fri, 12 Jan 2018 06:54:13 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:18a2:a4f7:170:8dd9] In-Reply-To: References: <201801121401.w0CE1cW4058239@repo.freebsd.org> From: Warner Losh Date: Fri, 12 Jan 2018 07:54:13 -0700 X-Google-Sender-Auth: g-YYfWiOWKOJyn_T8lpRWwR4YUQ Message-ID: Subject: Re: svn commit: r327876 - in head/sys/arm64: arm64 include To: Andrew Turner Cc: Marcin Wojtas , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 14:54:15 -0000 On Fri, Jan 12, 2018 at 7:52 AM, Andrew Turner wrote: > > > On 12 Jan 2018, at 14:37, Warner Losh wrote: > > > > On Fri, Jan 12, 2018 at 7:15 AM, Andrew Turner wrote: > >> >> >> On 12 Jan 2018, at 14:10, Marcin Wojtas wrote: >> >> Hi Andrew, >> >> >> >> 2018-01-12 15:01 GMT+01:00 Andrew Turner : >> >> Author: andrew >> Date: Fri Jan 12 14:01:38 2018 >> New Revision: 327876 >> URL: https://svnweb.freebsd.org/changeset/base/327876 >> >> Log: >> Workaround Spectre Variant 2 on arm64. >> >> We need to handle two cases: >> >> 1. One process attacking another process. >> 2. A process attacking the kernel. >> >> For the first case we clear the branch predictor state on context switch >> between different processes. For the second we do this when taking an >> instruction abort on a non-userspace address. >> >> To clear the branch predictor state a per-CPU function pointer has been >> added. This is set by the new cpu errata code based on if the CPU is >> known to be affected. >> >> On Cortex-A57, A72, A73, and A75 we call into the PSCI firmware as newer >> versions of this will clear the branch predictor state for us. >> >> It has been reported the ThunderX is unaffected, however the ThunderX2 is >> vulnerable. The Qualcomm Falkor core is also affected. As FreeBSD doesn't >> yet run on the ThunderX2 or Falkor no workaround is included for these >> CPUs. >> >> >> Regardless ThunderX2 / Falkor work-arounds, do I understand correctly >> that pure CA72 machines, such as Marvell Armada 7k/8k are immune to >> Variant 2 now? >> >> >> It is my understanding that the A72 will be immune with this patch and an >> updated Arm Trusted Firmware as documented in [1]. >> >> Andrew >> >> [1] https://github.com/ARM-software/arm-trusted-firmware/wik >> i/ARM-Trusted-Firmware-Security-Advisory-TFV-6 >> > > Are you also working on aarch32 mitigation? > > > No. I think a similar technique could be used, however as aarch32 has > instructions to invalidate the branch predictor these can be used directly. > That's my reading as well. It looks fairly easy to do it always, but I've not researched it sufficiently. Warner From owner-svn-src-head@freebsd.org Fri Jan 12 15:30:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A786BE6B221; Fri, 12 Jan 2018 15:30:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 80A5D6FDA6; Fri, 12 Jan 2018 15:30:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C1EEA25730; Fri, 12 Jan 2018 15:30:48 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CFUm1F095684; Fri, 12 Jan 2018 15:30:48 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CFUmE6095683; Fri, 12 Jan 2018 15:30:48 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801121530.w0CFUmE6095683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 12 Jan 2018 15:30:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327877 - head/usr.sbin/efibootmgr X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/usr.sbin/efibootmgr X-SVN-Commit-Revision: 327877 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 15:30:49 -0000 Author: imp Date: Fri Jan 12 15:30:48 2018 New Revision: 327877 URL: https://svnweb.freebsd.org/changeset/base/327877 Log: Fix error in determining the next available boot slot. Sponsored by: Netflix Modified: head/usr.sbin/efibootmgr/efibootmgr.c Modified: head/usr.sbin/efibootmgr/efibootmgr.c ============================================================================== --- head/usr.sbin/efibootmgr/efibootmgr.c Fri Jan 12 14:01:38 2018 (r327876) +++ head/usr.sbin/efibootmgr/efibootmgr.c Fri Jan 12 15:30:48 2018 (r327877) @@ -563,7 +563,7 @@ make_next_boot_var_name(void) } else { /* now just run the list looking for the first hole */ for (i = 0; i < cnt - 1 && next_free == 0; i++) - if (vals[i] != vals[i + 1] + 1) + if (vals[i] + 1 != vals[i + 1]) next_free = vals[i] + 1; if (next_free == 0) next_free = vals[cnt - 1] + 1; From owner-svn-src-head@freebsd.org Fri Jan 12 15:30:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2FD6E6B22E; Fri, 12 Jan 2018 15:30:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9E1A36FDB7; Fri, 12 Jan 2018 15:30:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE6F025736; Fri, 12 Jan 2018 15:30:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CFUqEP095738; Fri, 12 Jan 2018 15:30:52 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CFUq7M095737; Fri, 12 Jan 2018 15:30:52 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801121530.w0CFUq7M095737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 12 Jan 2018 15:30:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327878 - head/stand/efi/include X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/efi/include X-SVN-Commit-Revision: 327878 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 15:30:53 -0000 Author: imp Date: Fri Jan 12 15:30:52 2018 New Revision: 327878 URL: https://svnweb.freebsd.org/changeset/base/327878 Log: Add GUID for UEFI boot manager variables. Sponsoered by: Netflix Modified: head/stand/efi/include/efi.h Modified: head/stand/efi/include/efi.h ============================================================================== --- head/stand/efi/include/efi.h Fri Jan 12 15:30:48 2018 (r327877) +++ head/stand/efi/include/efi.h Fri Jan 12 15:30:52 2018 (r327878) @@ -59,5 +59,7 @@ Revision History */ #define FREEBSD_BOOT_VAR_GUID \ { 0xCFEE69AD, 0xA0DE, 0x47A9, {0x93, 0xA8, 0xF6, 0x31, 0x06, 0xF8, 0xAE, 0x99} } +#define UEFI_BOOT_VAR_GUID \ + { 0x8be4df61, 0x93ca, 0x11d2, {0xaa, 0x0d, 0x00, 0xe0, 0x98, 0x03, 0x2b, 0x8c} } #endif From owner-svn-src-head@freebsd.org Fri Jan 12 15:30:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D761E6B259; Fri, 12 Jan 2018 15:30:58 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1380F6FF08; Fri, 12 Jan 2018 15:30:58 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3356D2573C; Fri, 12 Jan 2018 15:30:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CFUvEO095789; Fri, 12 Jan 2018 15:30:57 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CFUv4n095788; Fri, 12 Jan 2018 15:30:57 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801121530.w0CFUv4n095788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 12 Jan 2018 15:30:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327879 - head/stand/efi/boot1 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/efi/boot1 X-SVN-Commit-Revision: 327879 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 15:30:58 -0000 Author: imp Date: Fri Jan 12 15:30:56 2018 New Revision: 327879 URL: https://svnweb.freebsd.org/changeset/base/327879 Log: Report the boot order and where we are in that boot order. Add ability to create a boot1.efi that always fails for testing purposes and failover scenarios. Sponsored by: Netflix Modified: head/stand/efi/boot1/boot1.c Modified: head/stand/efi/boot1/boot1.c ============================================================================== --- head/stand/efi/boot1/boot1.c Fri Jan 12 15:30:52 2018 (r327878) +++ head/stand/efi/boot1/boot1.c Fri Jan 12 15:30:56 2018 (r327879) @@ -55,6 +55,7 @@ static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL; static EFI_GUID LoadedImageGUID = LOADED_IMAGE_PROTOCOL; static EFI_GUID ConsoleControlGUID = EFI_CONSOLE_CONTROL_PROTOCOL_GUID; static EFI_GUID FreeBSDBootVarGUID = FREEBSD_BOOT_VAR_GUID; +static EFI_GUID GlobalBootVarGUID = UEFI_BOOT_VAR_GUID; /* * Provide Malloc / Free backed by EFIs AllocatePool / FreePool which ensures @@ -80,6 +81,25 @@ Free(void *buf, const char *file __unused, int line __ } static EFI_STATUS +efi_getenv(EFI_GUID *g, const char *v, void *data, size_t *len) +{ + size_t ul; + CHAR16 *uv; + UINT32 attr; + UINTN dl; + EFI_STATUS rv; + + utf8_to_ucs2(v, &uv, &ul); + if (uv == NULL) + return (EFI_OUT_OF_RESOURCES); + dl = *len; + rv = RS->GetVariable(uv, g, &attr, &dl, data); + if (rv == EFI_SUCCESS) + *len = dl; + return (rv); +} + +static EFI_STATUS efi_setenv_freebsd_wcs(const char *varname, CHAR16 *valstr) { CHAR16 *var = NULL; @@ -411,6 +431,9 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) SIMPLE_TEXT_OUTPUT_INTERFACE *conout = NULL; UINTN i, max_dim, best_mode, cols, rows, hsize, nhandles; CHAR16 *text; + UINT16 boot_current; + size_t sz; + UINT16 boot_order[100]; /* Basic initialization*/ ST = Xsystab; @@ -480,12 +503,32 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) } } + boot_current = 0; + sz = sizeof(boot_current); + efi_getenv(&GlobalBootVarGUID, "BootCurrent", &boot_current, &sz); + printf(" BootCurrent: %04x\n", boot_current); + + sz = sizeof(boot_order); + efi_getenv(&GlobalBootVarGUID, "BootOrder", &boot_order, &sz); + printf(" BootOrder:"); + for (i = 0; i < sz / sizeof(boot_order[0]); i++) + printf(" %04x", boot_order[i]); + printf("\n"); + +#ifdef TEST_FAILURE + /* + * For testing failover scenarios, it's nice to be able to fail fast. + * Define TEST_FAILURE to create a boot1.efi that always fails after + * reporting the boot manager protocol details. + */ + BS->Exit(IH, EFI_OUT_OF_RESOURCES, 0, NULL); +#endif + /* Get all the device handles */ hsize = (UINTN)NUM_HANDLES_INIT * sizeof(EFI_HANDLE); handles = malloc(hsize); - if (handles == NULL) { + if (handles == NULL) printf("Failed to allocate %d handles\n", NUM_HANDLES_INIT); - } status = BS->LocateHandle(ByProtocol, &BlockIoProtocolGUID, NULL, &hsize, handles); From owner-svn-src-head@freebsd.org Fri Jan 12 16:28:52 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CEA81E6E5F4; Fri, 12 Jan 2018 16:28:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A8BEA72432; Fri, 12 Jan 2018 16:28:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D0F25260CA; Fri, 12 Jan 2018 16:28:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CGSp0K021358; Fri, 12 Jan 2018 16:28:51 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CGSpS6021356; Fri, 12 Jan 2018 16:28:51 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801121628.w0CGSpS6021356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 12 Jan 2018 16:28:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327880 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 327880 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 16:28:52 -0000 Author: imp Date: Fri Jan 12 16:28:51 2018 New Revision: 327880 URL: https://svnweb.freebsd.org/changeset/base/327880 Log: Move getsecs() prototype to stand.h from net.h so it can be used everywhere. Sponsored by: Netflix Modified: head/stand/libsa/net.h head/stand/libsa/stand.h Modified: head/stand/libsa/net.h ============================================================================== --- head/stand/libsa/net.h Fri Jan 12 15:30:56 2018 (r327879) +++ head/stand/libsa/net.h Fri Jan 12 16:28:51 2018 (r327880) @@ -128,6 +128,4 @@ char *inet_ntoa(struct in_addr); char *intoa(n_long); /* similar to inet_ntoa */ n_long inet_addr(char *); -/* Machine-dependent functions: */ -time_t getsecs(void); #endif /* ! _STAND_NET_H */ Modified: head/stand/libsa/stand.h ============================================================================== --- head/stand/libsa/stand.h Fri Jan 12 15:30:56 2018 (r327879) +++ head/stand/libsa/stand.h Fri Jan 12 16:28:51 2018 (r327880) @@ -394,6 +394,7 @@ extern void putchar(int); extern int devopen(struct open_file *, const char *, const char **); extern int devclose(struct open_file *f); extern void panic(const char *, ...) __dead2 __printflike(1, 2); +extern time_t getsecs(void); extern struct fs_ops *file_system[]; extern struct fs_ops *exclusive_file_system; extern struct devsw *devsw[]; From owner-svn-src-head@freebsd.org Fri Jan 12 17:15:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D19A0E70DF4; Fri, 12 Jan 2018 17:15:19 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 70A2E74A20; Fri, 12 Jan 2018 17:15:19 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: by mail-wm0-x22d.google.com with SMTP id i11so13160842wmf.4; Fri, 12 Jan 2018 09:15:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:reply-to:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=DFIqFFsB+WCLtaB4gYDxwooQr3DS1Lwg3AwN4OW9MJo=; b=AqhwHsII2W1E8LSp15NIyeO+iJDPbeYDtHpnQYNrdow5tJSTN0zXTAnCfc/wyG6TUm oo5hitq0w8JurB7HBrHynIhsbx6TP4FHH396dsnVwJYtsZcl0iECP1iJq60icMrDOYAD rGgCeXmpxg/6+t6IE2znUBNzJLKr7RLQa9PqBikVji5bHSNnUszRZQicWrtqyL1KplC5 k3fAE3A3uM6A+CaUaqbCJqbAYMkPcmieu3l1rNsKkx3Cu9+onUSWdWk3jS+J0J12HznH 4rzsk/1y0S5GWRdQtCM1X3C2wCScsmpSTcJx8hz6iOZw4uplr9wLGSjijI8+xRrKp6YR lfag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:reply-to:subject:to:cc:references :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=DFIqFFsB+WCLtaB4gYDxwooQr3DS1Lwg3AwN4OW9MJo=; b=Dj7O6bpJIOy5JAwBLlGqEqgBjvtIWyS9isnOdjaZOCGBZiWT3Ymjc9p68H2GqSEtk3 cXTjQC2o7aR0ekLc6IKuNDK8/+QPGVsJp84Tb9sV2VVm2sLfIFVC4eHMPcGeKPslyGoc RTJrvVb01ydMXvUKGuA9UemXTmoZ3UaT1PcDXHkPTMCKb4KhcMmDYteyc01fz35AegAp wEuqL6CLgnwBPZLFZScg6LkKU+a1TJ+It1Ac41AiJrHyZyUf8c3NscELxvnifq5m1uQ9 CgmLuAEdpbckoX9WgdF0JtexLICnVyz5za/z2wasWW+cVZD5AtUsxQhGZqeZvSgyo7ud cdNA== X-Gm-Message-State: AKwxytdHVKAKof29ciRiev6XYbPfrGdpjfUnDXwRroxJE38ndyIZfRju EvoHIoZzsTmu3mM2c2BvFJ86qJmz X-Google-Smtp-Source: ACJfBouXcczM3yImdHg4B2Khb1ROfQhqMl7xI2wH93D4/PfIoVzJBARsvRdciIp3n5sxvHJU3cfafQ== X-Received: by 10.28.168.8 with SMTP id r8mr2620802wme.157.1515777317501; Fri, 12 Jan 2018 09:15:17 -0800 (PST) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id 187sm5979333wmu.19.2018.01.12.09.15.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jan 2018 09:15:16 -0800 (PST) From: Michal Meloun X-Google-Original-From: Michal Meloun Reply-To: mmel@freebsd.org Subject: Re: svn commit: r327876 - in head/sys/arm64: arm64 include To: Warner Losh , Andrew Turner Cc: Marcin Wojtas , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801121401.w0CE1cW4058239@repo.freebsd.org> Message-ID: <187e75c7-343f-aea6-cb59-61c77fd64023@freebsd.org> Date: Fri, 12 Jan 2018 18:15:15 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 17:15:19 -0000 On 12.01.2018 15:54, Warner Losh wrote: > > > On Fri, Jan 12, 2018 at 7:52 AM, Andrew Turner > wrote: > > > >> On 12 Jan 2018, at 14:37, Warner Losh > > wrote: >> >> >> >> On Fri, Jan 12, 2018 at 7:15 AM, Andrew Turner > > wrote: >> >> >> >>> On 12 Jan 2018, at 14:10, Marcin Wojtas >> > wrote: >>> >>> Hi Andrew, >>> >>> >>> >>> 2018-01-12 15:01 GMT+01:00 Andrew Turner >> >: >>>> Author: andrew >>>> Date: Fri Jan 12 14:01:38 2018 >>>> New Revision: 327876 >>>> URL: https://svnweb.freebsd.org/changeset/base/327876 >>>> >>>> >>>> Log: >>>>  Workaround Spectre Variant 2 on arm64. >>>> >>>>  We need to handle two cases: >>>> >>>>  1. One process attacking another process. >>>>  2. A process attacking the kernel. >>>> >>>>  For the first case we clear the branch predictor state on >>>> context switch >>>>  between different processes. For the second we do this when >>>> taking an >>>>  instruction abort on a non-userspace address. >>>> >>>>  To clear the branch predictor state a per-CPU function >>>> pointer has been >>>>  added. This is set by the new cpu errata code based on if >>>> the CPU is >>>>  known to be affected. >>>> >>>>  On Cortex-A57, A72, A73, and A75 we call into the PSCI >>>> firmware as newer >>>>  versions of this will clear the branch predictor state for us. >>>> >>>>  It has been reported the ThunderX is unaffected, however >>>> the ThunderX2 is >>>>  vulnerable. The Qualcomm Falkor core is also affected. As >>>> FreeBSD doesn't >>>>  yet run on the ThunderX2 or Falkor no workaround is >>>> included for these CPUs. >>> >>> Regardless ThunderX2 / Falkor work-arounds, do I understand >>> correctly >>> that pure CA72 machines, such as Marvell Armada 7k/8k are >>> immune to >>> Variant 2 now? >> >> It is my understanding that the A72 will be immune with this >> patch and an updated Arm Trusted Firmware as documented in [1]. >> >> Andrew >> >> [1] >> https://github.com/ARM-software/arm-trusted-firmware/wiki/ARM-Trusted-Firmware-Security-Advisory-TFV-6 >> >> >> >> Are you also working on aarch32 mitigation? > > No. I think a similar technique could be used, however as aarch32 > has instructions to invalidate the branch predictor these can be > used directly. > > > That's my reading as well. It looks fairly easy to do it always, but > I've not researched it sufficiently. > I work on patches for armv6/7. But for aarch32, there is, unfortunately, much less information available about affective mitigation of variant 2. BPIALL while switching pmap is clear and we have it in code for years (well, BPIALL is effectively NOP for A15/A17, it must be explicitly enabled). But is not clear for me for which trap is branch predictor flush necessary. Michal From owner-svn-src-head@freebsd.org Fri Jan 12 17:21:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9DF70E713CB; Fri, 12 Jan 2018 17:21:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 77D6F75646; Fri, 12 Jan 2018 17:21:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A9ABE26A3A; Fri, 12 Jan 2018 17:21:48 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CHLmDr046189; Fri, 12 Jan 2018 17:21:48 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CHLmC2046188; Fri, 12 Jan 2018 17:21:48 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801121721.w0CHLmC2046188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 12 Jan 2018 17:21:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327881 - head/stand/efi/boot1 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/efi/boot1 X-SVN-Commit-Revision: 327881 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 17:21:49 -0000 Author: imp Date: Fri Jan 12 17:21:48 2018 New Revision: 327881 URL: https://svnweb.freebsd.org/changeset/base/327881 Log: Allow this file to be included Use simple "foo" rather than "${.CURDIR}/foo" to include Makefile.fat since the former works when including this Makefile from else where. Also, use full path from ${BOOTSRC} to the FAT templates for similar reasons. It doesn't change anything in base FreeBSD, but allows us to have a custom boot1.efi more easily (though that will be short-lived for us, it may also be helpful for others). Sponsored by: Netflix Modified: head/stand/efi/boot1/Makefile Modified: head/stand/efi/boot1/Makefile ============================================================================== --- head/stand/efi/boot1/Makefile Fri Jan 12 16:28:51 2018 (r327880) +++ head/stand/efi/boot1/Makefile Fri Jan 12 17:21:48 2018 (r327881) @@ -110,7 +110,7 @@ boot1.efi: ${PROG} # The following inserts our objects into a template FAT file system # created by generate-fat.sh -.include "${.CURDIR}/Makefile.fat" +.include "Makefile.fat" boot1.efifat: boot1.efi @set -- `ls -l ${.ALLSRC}`; \ @@ -120,7 +120,7 @@ boot1.efifat: boot1.efi exit 1; \ fi echo ${.OBJDIR} - xz -d -c ${.CURDIR}/fat-${MACHINE}.tmpl.xz > ${.TARGET} + xz -d -c ${BOOTSRC}/efi/boot1/fat-${MACHINE}.tmpl.xz > ${.TARGET} ${DD} if=${.ALLSRC} of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc CLEANFILES+= boot1.efi boot1.efifat From owner-svn-src-head@freebsd.org Fri Jan 12 17:33:21 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58D14E71BD7; Fri, 12 Jan 2018 17:33:21 +0000 (UTC) (envelope-from schweikh@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3460176095; Fri, 12 Jan 2018 17:33:21 +0000 (UTC) (envelope-from schweikh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A5B826C27; Fri, 12 Jan 2018 17:33:20 +0000 (UTC) (envelope-from schweikh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CHXKr2050593; Fri, 12 Jan 2018 17:33:20 GMT (envelope-from schweikh@FreeBSD.org) Received: (from schweikh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CHXKNl050592; Fri, 12 Jan 2018 17:33:20 GMT (envelope-from schweikh@FreeBSD.org) Message-Id: <201801121733.w0CHXKNl050592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: schweikh set sender to schweikh@FreeBSD.org using -f From: Jens Schweikhardt Date: Fri, 12 Jan 2018 17:33:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327882 - head X-SVN-Group: head X-SVN-Commit-Author: schweikh X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 327882 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 17:33:21 -0000 Author: schweikh Date: Fri Jan 12 17:33:20 2018 New Revision: 327882 URL: https://svnweb.freebsd.org/changeset/base/327882 Log: Correct a couple of typos. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Fri Jan 12 17:21:48 2018 (r327881) +++ head/UPDATING Fri Jan 12 17:33:20 2018 (r327882) @@ -60,8 +60,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: WITHOUT_LLD_BOOTSTRAP=yes 20180110: - On i386, pmtimer has been removed. It's functionality has been folded - into apm. It was a nop on ACPI in current for a while now (but was still + On i386, pmtimer has been removed. Its functionality has been folded + into apm. It was a no-op on ACPI in current for a while now (but was still needed on i386 in FreeBSD 11 and earlier). Users may need to remove it from kernel config files. @@ -209,7 +209,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: will create the recovery information. If you have a filesystem created prior to this change and wish to have a recovery block created for your filesystem, you can do so by running fsck in - forground mode (i.e., do not use the -p or -y options). As it + foreground mode (i.e., do not use the -p or -y options). As it starts, fsck will ask ``SAVE DATA TO FIND ALTERNATE SUPERBLOCKS'' to which you should answer yes. @@ -1869,7 +1869,7 @@ COMMON ITEMS: do an upgrade to the new branch. This is the best-tested upgrade path, and has the highest probability of being successful. Please try this approach if you encounter problems with a major version upgrade. Since - the stable 4.x branch point, one has generally been able to upgade from + the stable 4.x branch point, one has generally been able to upgrade from anywhere in the most recent stable branch to head / current (or even the last couple of stable branches). See the top of this file when there's an exception. @@ -2007,7 +2007,7 @@ COMMON ITEMS: for potential gotchas. The -U option is also useful to consider. See mergemaster(8) for more information. - [5] Usually this step is a noop. However, from time to time + [5] Usually this step is a no-op. However, from time to time you may need to do this if you get unknown user in the following step. It never hurts to do it all the time. You may need to install a new mergemaster (cd src/usr.sbin/mergemaster && make From owner-svn-src-head@freebsd.org Fri Jan 12 19:59:48 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0F4CE78DE0; Fri, 12 Jan 2018 19:59:48 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 990527CA25; Fri, 12 Jan 2018 19:59:48 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D3A643B2; Fri, 12 Jan 2018 19:59:47 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CJxlpS010081; Fri, 12 Jan 2018 19:59:47 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CJxlaw010074; Fri, 12 Jan 2018 19:59:47 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201801121959.w0CJxlaw010074@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 12 Jan 2018 19:59:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327888 - in head: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety cddl/contrib/opensolaris/lib/libdtrace/common cddl/usr.sbin/dtrace/tests/common/safety sys/cddl/contrib/ope... X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety cddl/contrib/opensolaris/lib/libdtrace/common cddl/usr.sbin/dtrace/tests/common/safety sys/cddl/contrib/opensolaris/uts/common/dtrac... X-SVN-Commit-Revision: 327888 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 19:59:48 -0000 Author: markj Date: Fri Jan 12 19:59:46 2018 New Revision: 327888 URL: https://svnweb.freebsd.org/changeset/base/327888 Log: Add "jid" and "jailname" variables to DTrace. These return the jail ID and jail name for the traced process, respectively, and are analogous to "zonename" on Solaris/illumos. "zonename" is now aliased to "jailname". Also add some stress tests for the new variables. Submitted by: Domagoj Stolfa Reviewed by: dteske (previous version) MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D13877 Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c head/cddl/usr.sbin/dtrace/tests/common/safety/Makefile head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d Fri Jan 12 19:59:46 2018 (r327888) @@ -0,0 +1,44 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2018 Domagoj Stolfa . + * + * This software was developed by BAE Systems, the University of Cambridge + * Computer Laboratory, and Memorial University under DARPA/AFRL contract + * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing + * (TC) research program. + * + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * ASSERTION: + * collect jailname at every fbt probe and at every firing of a + * high-frequency profile probe + */ + +fbt::: +{ + @a[jailname] = count(); +} + +profile-4999hz +{ + @a[jailname] = count(); +} + +tick-1sec +/n++ == 10/ +{ + exit(0); +} Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d Fri Jan 12 19:59:46 2018 (r327888) @@ -0,0 +1,44 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2018 Domagoj Stolfa . + * + * This software was developed by BAE Systems, the University of Cambridge + * Computer Laboratory, and Memorial University under DARPA/AFRL contract + * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing + * (TC) research program. + * + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * ASSERTION: + * collect jid at every fbt probe and at every firing of a + * high-frequency profile probe + */ + +fbt::: +{ + @a[jid] = count(); +} + +profile-4999hz +{ + @a[jid] = count(); +} + +tick-1sec +/n++ == 10/ +{ + exit(0); +} Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Fri Jan 12 18:44:28 2018 (r327887) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Fri Jan 12 19:59:46 2018 (r327888) @@ -313,6 +313,12 @@ static const dt_ident_t _dtrace_globals[] = { DT_VERS_1_5, &dt_idops_func, "string(int, void *)" }, { "ipl", DT_IDENT_SCALAR, 0, DIF_VAR_IPL, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "uint_t" }, +#ifdef __FreeBSD__ +{ "jailname", DT_IDENT_SCALAR, 0, DIF_VAR_JAILNAME, + DT_ATTR_STABCMN, DT_VERS_1_13, &dt_idops_type, "string" }, +{ "jid", DT_IDENT_SCALAR, 0, DIF_VAR_JID, DT_ATTR_STABCMN, DT_VERS_1_13, + &dt_idops_type, "int" }, +#endif { "json", DT_IDENT_FUNC, 0, DIF_SUBR_JSON, DT_ATTR_STABCMN, DT_VERS_1_11, &dt_idops_func, "string(const char *, const char *)" }, { "jstack", DT_IDENT_ACTFUNC, 0, DT_ACT_JSTACK, DT_ATTR_STABCMN, DT_VERS_1_0, @@ -528,10 +534,8 @@ static const dt_ident_t _dtrace_globals[] = { { "walltimestamp", DT_IDENT_SCALAR, 0, DIF_VAR_WALLTIMESTAMP, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "int64_t" }, -#ifdef illumos { "zonename", DT_IDENT_SCALAR, 0, DIF_VAR_ZONENAME, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" }, -#endif #ifndef illumos { "cpu", DT_IDENT_SCALAR, 0, DIF_VAR_CPU, Modified: head/cddl/usr.sbin/dtrace/tests/common/safety/Makefile ============================================================================== --- head/cddl/usr.sbin/dtrace/tests/common/safety/Makefile Fri Jan 12 18:44:28 2018 (r327887) +++ head/cddl/usr.sbin/dtrace/tests/common/safety/Makefile Fri Jan 12 19:59:46 2018 (r327888) @@ -19,6 +19,8 @@ ${PACKAGE}FILES= \ tst.gid.d \ tst.hton.d \ tst.index.d \ + tst.jailname.d \ + tst.jid.d \ tst.msgdsize.d \ tst.msgsize.d \ tst.null.d \ Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Fri Jan 12 18:44:28 2018 (r327887) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Fri Jan 12 19:59:46 2018 (r327888) @@ -3654,6 +3654,24 @@ dtrace_dif_variable(dtrace_mstate_t *mstate, dtrace_st return (dtrace_dif_varstr( (uintptr_t)curthread->t_procp->p_zone->zone_name, state, mstate)); +#elif defined(__FreeBSD__) + /* + * On FreeBSD, we introduce compatibility to zonename by falling through + * into jailname. + */ + case DIF_VAR_JAILNAME: + if (!dtrace_priv_kernel(state)) + return (0); + + return (dtrace_dif_varstr( + (uintptr_t)curthread->t_procp->p_ucred->cr_prison->pr_name, + state, mstate)); + + case DIF_VAR_JID: + if (!dtrace_priv_kernel(state)) + return (0); + + return ((uint64_t)curthread->t_procp->p_ucred->cr_prison->pr_id); #else return (0); #endif Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Fri Jan 12 18:44:28 2018 (r327887) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Fri Jan 12 19:59:46 2018 (r327888) @@ -254,6 +254,8 @@ typedef enum dtrace_probespec { #define DIF_VAR_GID 0x011f /* process group ID */ #define DIF_VAR_ERRNO 0x0120 /* thread errno */ #define DIF_VAR_EXECARGS 0x0121 /* process arguments */ +#define DIF_VAR_JID 0x0122 /* process jail id */ +#define DIF_VAR_JAILNAME 0x0123 /* process jail name */ #ifndef illumos #define DIF_VAR_CPU 0x0200 From owner-svn-src-head@freebsd.org Fri Jan 12 20:03:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1123E79107; Fri, 12 Jan 2018 20:03:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8BDFE7CEF0; Fri, 12 Jan 2018 20:03:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA09956C; Fri, 12 Jan 2018 20:03:24 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CK3OVb014079; Fri, 12 Jan 2018 20:03:24 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CK3OoG014078; Fri, 12 Jan 2018 20:03:24 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801122003.w0CK3OoG014078@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 12 Jan 2018 20:03:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327889 - head/contrib/gcc X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/gcc X-SVN-Commit-Revision: 327889 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 20:03:25 -0000 Author: emaste Date: Fri Jan 12 20:03:24 2018 New Revision: 327889 URL: https://svnweb.freebsd.org/changeset/base/327889 Log: Revert r280909 "unwind-d2 build workaround for arm64" We no longer try to build unwind-dw2.c on arm64 so no need for this workaround. Sponsored by: The FreeBSD Foundation Modified: head/contrib/gcc/unwind-dw2.c Modified: head/contrib/gcc/unwind-dw2.c ============================================================================== --- head/contrib/gcc/unwind-dw2.c Fri Jan 12 19:59:46 2018 (r327888) +++ head/contrib/gcc/unwind-dw2.c Fri Jan 12 20:03:24 2018 (r327889) @@ -1393,16 +1393,7 @@ uw_advance_context (struct _Unwind_Context *context, _ static inline void init_dwarf_reg_size_table (void) { -/* - * ARM64TODO: http://llvm.org/pr22997 - * llvm 3.6 doesn't support __builtin_init_dwarf_reg_size_table on AArch64. - */ -#ifdef __aarch64__ - printf("Unimplemented: init_dwarf_reg_size_table\n"); - abort(); -#else __builtin_init_dwarf_reg_size_table (dwarf_reg_size_table); -#endif } static void From owner-svn-src-head@freebsd.org Fri Jan 12 20:25:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 890C4E7A355; Fri, 12 Jan 2018 20:25:58 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 60CE07E0F4; Fri, 12 Jan 2018 20:25:58 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A52AE8D5; Fri, 12 Jan 2018 20:25:57 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CKPv8S022671; Fri, 12 Jan 2018 20:25:57 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CKPvVk022670; Fri, 12 Jan 2018 20:25:57 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801122025.w0CKPvVk022670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 12 Jan 2018 20:25:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327890 - head/usr.sbin/bsdinstall/partedit X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.sbin/bsdinstall/partedit X-SVN-Commit-Revision: 327890 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 20:25:58 -0000 Author: emaste Date: Fri Jan 12 20:25:57 2018 New Revision: 327890 URL: https://svnweb.freebsd.org/changeset/base/327890 Log: bsdinstall: disable SUJ by default SUJ + cg checksums produce spurious warnings after an unclean shutdown (e.g. a crash). For now disable SUJ for UFS installs so installing from a FreeBSD 12 snapshot results in a usable filesystem, until this can be fixed. PR: 225110 Submitted by: Arshan Khanifar Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D13890 Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c ============================================================================== --- head/usr.sbin/bsdinstall/partedit/gpart_ops.c Fri Jan 12 20:03:24 2018 (r327889) +++ head/usr.sbin/bsdinstall/partedit/gpart_ops.c Fri Jan 12 20:25:57 2018 (r327890) @@ -91,8 +91,7 @@ newfs_command(const char *fstype, char *command, int u {"SU", "Softupdates", "Enable softupdates (default)", 1 }, {"SUJ", "Softupdates journaling", - "Enable file system journaling (default - " - "turn off for SSDs)", 1 }, + "Enable file system journaling", 0 }, {"TRIM", "Enable SSD TRIM support", "Enable TRIM support, useful on solid-state drives", 0 }, From owner-svn-src-head@freebsd.org Fri Jan 12 20:35:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E190AE7AA54; Fri, 12 Jan 2018 20:35:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BE03A7E721; Fri, 12 Jan 2018 20:35:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 12469A72; Fri, 12 Jan 2018 20:35:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CKZR1m026912; Fri, 12 Jan 2018 20:35:27 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CKZRHR026911; Fri, 12 Jan 2018 20:35:27 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801122035.w0CKZRHR026911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 12 Jan 2018 20:35:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327891 - head/sys/arm/allwinner/a83t X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/allwinner/a83t X-SVN-Commit-Revision: 327891 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 20:35:29 -0000 Author: kevans Date: Fri Jan 12 20:35:27 2018 New Revision: 327891 URL: https://svnweb.freebsd.org/changeset/base/327891 Log: allwinner/a83t_padconf: Rename "emac" function to "gmac" as per upstream DTS Although these should have been 'emac', upstream DTS is going with using 'gmac' as the function name for the emac RGMII pins. Rename here to accommodate. emac support for the a83t should come in with the 4.16 DTS update, in another couple of months. Modified: head/sys/arm/allwinner/a83t/a83t_padconf.c Modified: head/sys/arm/allwinner/a83t/a83t_padconf.c ============================================================================== --- head/sys/arm/allwinner/a83t/a83t_padconf.c Fri Jan 12 20:25:57 2018 (r327890) +++ head/sys/arm/allwinner/a83t/a83t_padconf.c Fri Jan 12 20:35:27 2018 (r327891) @@ -71,24 +71,24 @@ static const struct allwinner_pins a83t_pins[] = { { "PC17", 2, 17, { "gpio_in", "gpio_out", "nand" } }, { "PC18", 2, 18, { "gpio_in", "gpio_out", "nand" } }, - { "PD2", 3, 2, { "gpio_in", "gpio_out", "lcd", NULL, "emac" } }, - { "PD3", 3, 3, { "gpio_in", "gpio_out", "lcd", NULL, "emac" } }, - { "PD4", 3, 4, { "gpio_in", "gpio_out", "lcd", NULL, "emac" } }, - { "PD5", 3, 5, { "gpio_in", "gpio_out", "lcd", NULL, "emac" } }, - { "PD6", 3, 6, { "gpio_in", "gpio_out", "lcd", NULL, "emac" } }, - { "PD7", 3, 7, { "gpio_in", "gpio_out", "lcd", NULL, "emac" } }, - { "PD10", 3, 10, { "gpio_in", "gpio_out", "lcd", NULL, "emac" } }, - { "PD11", 3, 11, { "gpio_in", "gpio_out", "lcd", NULL, "emac" } }, - { "PD12", 3, 12, { "gpio_in", "gpio_out", "lcd", NULL, "emac" } }, - { "PD13", 3, 13, { "gpio_in", "gpio_out", "lcd", NULL, "emac" } }, - { "PD14", 3, 14, { "gpio_in", "gpio_out", "lcd", NULL, "emac" } }, - { "PD15", 3, 15, { "gpio_in", "gpio_out", "lcd", NULL, "emac" } }, - { "PD18", 3, 18, { "gpio_in", "gpio_out", "lcd", "lvds", "emac" } }, - { "PD19", 3, 19, { "gpio_in", "gpio_out", "lcd", "lvds", "emac" } }, - { "PD20", 3, 20, { "gpio_in", "gpio_out", "lcd", "lvds", "emac" } }, - { "PD21", 3, 21, { "gpio_in", "gpio_out", "lcd", "lvds", "emac" } }, - { "PD22", 3, 22, { "gpio_in", "gpio_out", "lcd", "lvds", "emac" } }, - { "PD23", 3, 23, { "gpio_in", "gpio_out", "lcd", "lvds", "emac" } }, + { "PD2", 3, 2, { "gpio_in", "gpio_out", "lcd", NULL, "gmac" } }, + { "PD3", 3, 3, { "gpio_in", "gpio_out", "lcd", NULL, "gmac" } }, + { "PD4", 3, 4, { "gpio_in", "gpio_out", "lcd", NULL, "gmac" } }, + { "PD5", 3, 5, { "gpio_in", "gpio_out", "lcd", NULL, "gmac" } }, + { "PD6", 3, 6, { "gpio_in", "gpio_out", "lcd", NULL, "gmac" } }, + { "PD7", 3, 7, { "gpio_in", "gpio_out", "lcd", NULL, "gmac" } }, + { "PD10", 3, 10, { "gpio_in", "gpio_out", "lcd", NULL, "gmac" } }, + { "PD11", 3, 11, { "gpio_in", "gpio_out", "lcd", NULL, "gmac" } }, + { "PD12", 3, 12, { "gpio_in", "gpio_out", "lcd", NULL, "gmac" } }, + { "PD13", 3, 13, { "gpio_in", "gpio_out", "lcd", NULL, "gmac" } }, + { "PD14", 3, 14, { "gpio_in", "gpio_out", "lcd", NULL, "gmac" } }, + { "PD15", 3, 15, { "gpio_in", "gpio_out", "lcd", NULL, "gmac" } }, + { "PD18", 3, 18, { "gpio_in", "gpio_out", "lcd", "lvds", "gmac" } }, + { "PD19", 3, 19, { "gpio_in", "gpio_out", "lcd", "lvds", "gmac" } }, + { "PD20", 3, 20, { "gpio_in", "gpio_out", "lcd", "lvds", "gmac" } }, + { "PD21", 3, 21, { "gpio_in", "gpio_out", "lcd", "lvds", "gmac" } }, + { "PD22", 3, 22, { "gpio_in", "gpio_out", "lcd", "lvds", "gmac" } }, + { "PD23", 3, 23, { "gpio_in", "gpio_out", "lcd", "lvds", "gmac" } }, { "PD24", 3, 24, { "gpio_in", "gpio_out", "lcd", "lvds" } }, { "PD25", 3, 25, { "gpio_in", "gpio_out", "lcd", "lvds" } }, { "PD26", 3, 26, { "gpio_in", "gpio_out", "lcd", "lvds" } }, From owner-svn-src-head@freebsd.org Fri Jan 12 20:40:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1E39E7AD25; Fri, 12 Jan 2018 20:40:28 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7EC317E969; Fri, 12 Jan 2018 20:40:28 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C79A8A7A; Fri, 12 Jan 2018 20:40:27 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CKeRdw027119; Fri, 12 Jan 2018 20:40:27 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CKeRbq027118; Fri, 12 Jan 2018 20:40:27 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201801122040.w0CKeRbq027118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 12 Jan 2018 20:40:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327892 - head X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 327892 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 20:40:28 -0000 Author: bdrewery Date: Fri Jan 12 20:40:27 2018 New Revision: 327892 URL: https://svnweb.freebsd.org/changeset/base/327892 Log: Ensure MK_LDD for bootstrap-tools matches MK_LLD_BOOTSTRAP. This fixes building libllvmminimal with MK_LLD support when WITHOUT_LLD or WITHOUT_TOOLCHAIN are set, which are install flags not build tools flags. Reported by: sbruno Tested by: sbruno Sponsored by: Dell EMC Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Jan 12 20:35:27 2018 (r327891) +++ head/Makefile.inc1 Fri Jan 12 20:40:27 2018 (r327892) @@ -537,6 +537,7 @@ BSARGS= DESTDIR= \ -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \ MK_LLDB=no MK_TESTS=no \ + MK_LLD=${MK_LLD_BOOTSTRAP} \ MK_INCLUDES=yes BMAKE= \ From owner-svn-src-head@freebsd.org Fri Jan 12 22:37:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04EA2EA574B; Fri, 12 Jan 2018 22:37:53 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qt0-x242.google.com (mail-qt0-x242.google.com [IPv6:2607:f8b0:400d:c0d::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A46F869; Fri, 12 Jan 2018 22:37:52 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qt0-x242.google.com with SMTP id 33so7891937qtv.1; Fri, 12 Jan 2018 14:37:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=DjA8GBp4njcy1z8P7u2bG1ED9lGHxlwcQu6ruT6nfOM=; b=hIMzHogeoSNM9ao014JGQekFYNTvKu1P/ILP8Qvvwt0JHLbjvK/iMYIXeAxp7BAry5 1qi8r45TshrvnthnCg4EHh8/Qa1DZaSR9D35K0W2SYdqKZmTEmYx7aerp3jUYNhSxPmf FUI1SWzLoqZMsr6zAOf3aDoMAMZVfsFaJniKCD5ykGL7y8bmPnLqyFNuYVlq+rao+rsK zFwW/3rRQAYFKMNOuXL/0iXvJCcvkYGLZfNKB7muAQmq7SR33mRMc5mMeaxXwSREcOoz XKJfICXVvIWPCjaKr5hrTqhikRfLhbsCCT9khTXAMB2zfbFlSOSXYZRhgCtvaWKshF6T VLWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=DjA8GBp4njcy1z8P7u2bG1ED9lGHxlwcQu6ruT6nfOM=; b=LeQgix/CInddFdjQ5jFb50fGJwJrIxZGzi6D4cppTMDodrj3mVutKKHlD95Clgkm6y aVHqDRuIC0R6shGghZgPnNL5z8PxkJE2dZSwEYitkjc/oFJH0G1cM2oZt9B5FuRHsPFg MaVAqponafPU41KQDP16KbCVOdwuyMuXknkG9u2Gcbb6zxBS1RibnXK1kfBPSAf5LOKv sBHzlRpfrluVaqJqGmZbNXgvF5tFwxeaKwaI4KSxBSoVCRsv26fe0oIOpeGdGBNQGikT l2RnKPWvNNVObHl7tw+z0OYMfD2xdYGfxevsUnCXRgzybVBaCeOjkMPxw2BKnHnQeHCZ h8XQ== X-Gm-Message-State: AKwxytdpgONupC/acNAJHYpHq74zUUbo0uXWHA3SNZhgNCf/PU96F1dB mL5ZaomCSdlS3bfeUosOvde/As4LTqDtUDs+v7o= X-Google-Smtp-Source: ACJfBovGIjmMLBiO/FGLObNxf1cOrOBnnzYxMVii9iKgwY0j0dkHrrfQmsJbE8Q4qU0ylivy9cgumUOJulO1EDLHvz8= X-Received: by 10.200.43.13 with SMTP id 13mr39890438qtu.341.1515796671628; Fri, 12 Jan 2018 14:37:51 -0800 (PST) MIME-Version: 1.0 Received: by 10.200.44.214 with HTTP; Fri, 12 Jan 2018 14:37:51 -0800 (PST) In-Reply-To: <201801121959.w0CJxlaw010074@repo.freebsd.org> References: <201801121959.w0CJxlaw010074@repo.freebsd.org> From: Mateusz Guzik Date: Fri, 12 Jan 2018 23:37:51 +0100 Message-ID: Subject: Re: svn commit: r327888 - in head: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety cddl/contrib/opensolaris/lib/libdtrace/common cddl/usr.sbin/dtrace/tests/common/safety sys/cddl/contrib/ope... To: Mark Johnston Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 22:37:53 -0000 On Fri, Jan 12, 2018 at 8:59 PM, Mark Johnston wrote: > Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c > ============================================================ > ================== > --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c > Fri Jan 12 18:44:28 2018 (r327887) > +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c > Fri Jan 12 19:59:46 2018 (r327888) > @@ -3654,6 +3654,24 @@ dtrace_dif_variable(dtrace_mstate_t *mstate, > dtrace_st > return (dtrace_dif_varstr( > (uintptr_t)curthread->t_procp->p_zone->zone_name, > state, mstate)); > +#elif defined(__FreeBSD__) > + /* > + * On FreeBSD, we introduce compatibility to zonename by falling > through > + * into jailname. > + */ > + case DIF_VAR_JAILNAME: > + if (!dtrace_priv_kernel(state)) > + return (0); > + > + return (dtrace_dif_varstr( > + (uintptr_t)curthread->t_procp- > >p_ucred->cr_prison->pr_name, > + state, mstate)); > + > Why t_procp? curthread->td_proc creds are what is used for permission checking and it rarely temporarily goes out of sync with proc's creds. However, if someone changes creds while this tracing is enabled this extra dereference risks accessing a freed object. On the other hand curthread creads are always safe to read. > + case DIF_VAR_JID: > + if (!dtrace_priv_kernel(state)) > + return (0); > + > + return ((uint64_t)curthread->t_procp- > >p_ucred->cr_prison->pr_id); > #else > return (0); > #endif > From owner-svn-src-head@freebsd.org Fri Jan 12 22:48:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8552EA60A2; Fri, 12 Jan 2018 22:48:25 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8F9F099B; Fri, 12 Jan 2018 22:48:25 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C93FA200B; Fri, 12 Jan 2018 22:48:24 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CMmOi2082710; Fri, 12 Jan 2018 22:48:24 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CMmNdF082700; Fri, 12 Jan 2018 22:48:23 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201801122248.w0CMmNdF082700@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Fri, 12 Jan 2018 22:48:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327895 - in head: lib/libc/sys sys/arm/arm sys/compat/freebsd32 sys/conf sys/ddb sys/kern sys/netpfil/ipfw sys/sys sys/vm sys/x86/acpica usr.bin/cpuset usr.bin/numactl X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head: lib/libc/sys sys/arm/arm sys/compat/freebsd32 sys/conf sys/ddb sys/kern sys/netpfil/ipfw sys/sys sys/vm sys/x86/acpica usr.bin/cpuset usr.bin/numactl X-SVN-Commit-Revision: 327895 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 22:48:25 -0000 Author: jeff Date: Fri Jan 12 22:48:23 2018 New Revision: 327895 URL: https://svnweb.freebsd.org/changeset/base/327895 Log: Implement 'domainset', a cpuset based NUMA policy mechanism. This allows userspace to control NUMA policy administratively and programmatically. Implement domainset based iterators in the page layer. Remove the now legacy numa_* syscalls. Cleanup some header polution created by having seq.h in proc.h. Reviewed by: markj, kib Discussed with: alc Tested by: pho Sponsored by: Netflix, Dell/EMC Isilon Differential Revision: https://reviews.freebsd.org/D13403 Deleted: head/sys/kern/kern_numa.c head/sys/sys/_vm_domain.h head/sys/vm/vm_domain.c head/sys/vm/vm_domain.h Modified: head/lib/libc/sys/Symbol.map head/sys/arm/arm/machdep_ptrace.c head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/freebsd32/syscalls.master head/sys/conf/files head/sys/ddb/db_run.c head/sys/kern/init_main.c head/sys/kern/init_sysent.c head/sys/kern/kern_cpuset.c head/sys/kern/kern_exit.c head/sys/kern/kern_fork.c head/sys/kern/kern_thr.c head/sys/kern/kern_thread.c head/sys/kern/makesyscalls.sh head/sys/kern/sched_4bsd.c head/sys/kern/sched_ule.c head/sys/kern/subr_kdb.c head/sys/kern/syscalls.master head/sys/netpfil/ipfw/dn_sched_fq_codel.c head/sys/sys/cpuset.h head/sys/sys/proc.h head/sys/sys/syscallsubr.h head/sys/vm/vm_fault.c head/sys/vm/vm_object.c head/sys/vm/vm_object.h head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_phys.c head/sys/vm/vm_phys.h head/sys/x86/acpica/srat.c head/usr.bin/cpuset/cpuset.c head/usr.bin/numactl/numactl.c Modified: head/lib/libc/sys/Symbol.map ============================================================================== --- head/lib/libc/sys/Symbol.map Fri Jan 12 21:50:18 2018 (r327894) +++ head/lib/libc/sys/Symbol.map Fri Jan 12 22:48:23 2018 (r327895) @@ -398,6 +398,8 @@ FBSD_1.5 { mknodat; stat; statfs; + cpuset_getdomain; + cpuset_setdomain; }; FBSDprivate_1.0 { @@ -1022,4 +1024,8 @@ FBSDprivate_1.0 { gssd_syscall; __libc_interposing_slot; __libc_sigwait; + _cpuset_getdomain; + __sys_cpuset_getdomain; + _cpuset_setdomain; + __sys_cpuset_setdomain; }; Modified: head/sys/arm/arm/machdep_ptrace.c ============================================================================== --- head/sys/arm/arm/machdep_ptrace.c Fri Jan 12 21:50:18 2018 (r327894) +++ head/sys/arm/arm/machdep_ptrace.c Fri Jan 12 22:48:23 2018 (r327895) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Fri Jan 12 21:50:18 2018 (r327894) +++ head/sys/compat/freebsd32/freebsd32_misc.c Fri Jan 12 22:48:23 2018 (r327895) @@ -3017,6 +3017,24 @@ freebsd32_cpuset_setaffinity(struct thread *td, } int +freebsd32_cpuset_getdomain(struct thread *td, + struct freebsd32_cpuset_getdomain_args *uap) +{ + + return (kern_cpuset_getdomain(td, uap->level, uap->which, + PAIR32TO64(id_t,uap->id), uap->domainsetsize, uap->mask, uap->policy)); +} + +int +freebsd32_cpuset_setdomain(struct thread *td, + struct freebsd32_cpuset_setdomain_args *uap) +{ + + return (kern_cpuset_setdomain(td, uap->level, uap->which, + PAIR32TO64(id_t,uap->id), uap->domainsetsize, uap->mask, uap->policy)); +} + +int freebsd32_nmount(struct thread *td, struct freebsd32_nmount_args /* { struct iovec *iovp; Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Fri Jan 12 21:50:18 2018 (r327894) +++ head/sys/compat/freebsd32/syscalls.master Fri Jan 12 22:48:23 2018 (r327895) @@ -1086,12 +1086,8 @@ 547 AUE_FUTIMESAT STD { int freebsd32_utimensat(int fd, \ char *path, \ struct timespec *times, int flag); } -548 AUE_NULL NOPROTO { int numa_getaffinity(cpuwhich_t which, \ - id_t id, \ - struct vm_domain_policy *policy); } -549 AUE_NULL NOPROTO { int numa_setaffinity(cpuwhich_t which, \ - id_t id, \ - const struct vm_domain_policy *policy); } +548 AUE_NULL UNIMPL numa_getaffinity +549 AUE_NULL UNIMPL numa_setaffinity 550 AUE_FSYNC NOPROTO { int fdatasync(int fd); } 551 AUE_FSTAT STD { int freebsd32_fstat(int fd, \ struct stat32 *ub); } @@ -1119,4 +1115,13 @@ struct kevent32 *eventlist, \ int nevents, \ const struct timespec32 *timeout); } +561 AUE_NULL STD { int freebsd32_cpuset_getdomain(cpulevel_t level, \ + cpuwhich_t which, uint32_t id1, uint32_t id2, \ + size_t domainsetsize, domainset_t *mask, \ + int *policy); } +562 AUE_NULL STD { int freebsd32_cpuset_setdomain(cpulevel_t level, \ + cpuwhich_t which, uint32_t id1, uint32_t id2, \ + size_t domainsetsize, domainset_t *mask, \ + int policy); } + ; vim: syntax=off Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Jan 12 21:50:18 2018 (r327894) +++ head/sys/conf/files Fri Jan 12 22:48:23 2018 (r327895) @@ -3787,7 +3787,6 @@ kern/kern_module.c standard kern/kern_mtxpool.c standard kern/kern_mutex.c standard kern/kern_ntptime.c standard -kern/kern_numa.c standard kern/kern_osd.c standard kern/kern_physio.c standard kern/kern_pmc.c standard @@ -4837,7 +4836,7 @@ vm/swap_pager.c standard vm/uma_core.c standard vm/uma_dbg.c standard vm/memguard.c optional DEBUG_MEMGUARD -vm/vm_domain.c standard +vm/vm_domainset.c standard vm/vm_fault.c standard vm/vm_glue.c standard vm/vm_init.c standard Modified: head/sys/ddb/db_run.c ============================================================================== --- head/sys/ddb/db_run.c Fri Jan 12 21:50:18 2018 (r327894) +++ head/sys/ddb/db_run.c Fri Jan 12 22:48:23 2018 (r327895) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Fri Jan 12 21:50:18 2018 (r327894) +++ head/sys/kern/init_main.c Fri Jan 12 22:48:23 2018 (r327895) @@ -89,7 +89,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -497,10 +496,7 @@ proc0_init(void *dummy __unused) td->td_flags = TDF_INMEM; td->td_pflags = TDP_KTHREAD; td->td_cpuset = cpuset_thread0(); - vm_domain_policy_init(&td->td_vm_dom_policy); - vm_domain_policy_set(&td->td_vm_dom_policy, VM_POLICY_NONE, -1); - vm_domain_policy_init(&p->p_vm_dom_policy); - vm_domain_policy_set(&p->p_vm_dom_policy, VM_POLICY_NONE, -1); + td->td_domain.dr_policy = td->td_cpuset->cs_domain; prison0_init(); p->p_peers = 0; p->p_leader = p; Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Fri Jan 12 21:50:18 2018 (r327894) +++ head/sys/kern/init_sysent.c Fri Jan 12 22:48:23 2018 (r327895) @@ -599,8 +599,8 @@ struct sysent sysent[] = { { AS(ppoll_args), (sy_call_t *)sys_ppoll, AUE_POLL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 545 = ppoll */ { AS(futimens_args), (sy_call_t *)sys_futimens, AUE_FUTIMES, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 546 = futimens */ { AS(utimensat_args), (sy_call_t *)sys_utimensat, AUE_FUTIMESAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 547 = utimensat */ - { AS(numa_getaffinity_args), (sy_call_t *)sys_numa_getaffinity, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 548 = numa_getaffinity */ - { AS(numa_setaffinity_args), (sy_call_t *)sys_numa_setaffinity, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 549 = numa_setaffinity */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 548 = numa_getaffinity */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 549 = numa_setaffinity */ { AS(fdatasync_args), (sy_call_t *)sys_fdatasync, AUE_FSYNC, NULL, 0, 0, 0, SY_THR_STATIC }, /* 550 = fdatasync */ { AS(fstat_args), (sy_call_t *)sys_fstat, AUE_FSTAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 551 = fstat */ { AS(fstatat_args), (sy_call_t *)sys_fstatat, AUE_FSTATAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 552 = fstatat */ @@ -612,4 +612,6 @@ struct sysent sysent[] = { { AS(fhstatfs_args), (sy_call_t *)sys_fhstatfs, AUE_FHSTATFS, NULL, 0, 0, 0, SY_THR_STATIC }, /* 558 = fhstatfs */ { AS(mknodat_args), (sy_call_t *)sys_mknodat, AUE_MKNODAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 559 = mknodat */ { AS(kevent_args), (sy_call_t *)sys_kevent, AUE_KEVENT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 560 = kevent */ + { AS(cpuset_getdomain_args), (sy_call_t *)sys_cpuset_getdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 561 = cpuset_getdomain */ + { AS(cpuset_setdomain_args), (sy_call_t *)sys_cpuset_setdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 562 = cpuset_setdomain */ }; Modified: head/sys/kern/kern_cpuset.c ============================================================================== --- head/sys/kern/kern_cpuset.c Fri Jan 12 21:50:18 2018 (r327894) +++ head/sys/kern/kern_cpuset.c Fri Jan 12 22:48:23 2018 (r327895) @@ -51,17 +51,21 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include #include #include +#include #include #include +#include #include #include +#include #ifdef DDB #include @@ -109,8 +113,10 @@ __FBSDID("$FreeBSD$"); * getaffinity call using (CPU_LEVEL_CPUSET, CPU_WHICH_PID, -1, ...). */ static uma_zone_t cpuset_zone; +static uma_zone_t domainset_zone; static struct mtx cpuset_lock; static struct setlist cpuset_ids; +static struct domainlist cpuset_domains; static struct unrhdr *cpuset_unr; static struct cpuset *cpuset_zero, *cpuset_default; @@ -121,7 +127,33 @@ SYSCTL_INT(_kern_sched, OID_AUTO, cpusetsize, CTLFLAG_ cpuset_t *cpuset_root; cpuset_t cpuset_domain[MAXMEMDOM]; +static int domainset_valid(const struct domainset *, const struct domainset *); + /* + * Find the first non-anonymous set starting from 'set'. + */ +static struct cpuset * +cpuset_getbase(struct cpuset *set) +{ + + if (set->cs_id == CPUSET_INVALID) + set = set->cs_parent; + return (set); +} + +/* + * Walks up the tree from 'set' to find the root. + */ +static struct cpuset * +cpuset_getroot(struct cpuset *set) +{ + + while ((set->cs_flags & CPU_SET_ROOT) == 0 && set->cs_parent != NULL) + set = set->cs_parent; + return (set); +} + +/* * Acquire a reference to a cpuset, all pointers must be tracked with refs. */ struct cpuset * @@ -140,12 +172,7 @@ static struct cpuset * cpuset_refroot(struct cpuset *set) { - for (; set->cs_parent != NULL; set = set->cs_parent) - if (set->cs_flags & CPU_SET_ROOT) - break; - cpuset_ref(set); - - return (set); + return (cpuset_ref(cpuset_getroot(set))); } /* @@ -157,11 +184,7 @@ static struct cpuset * cpuset_refbase(struct cpuset *set) { - if (set->cs_id == CPUSET_INVALID) - set = set->cs_parent; - cpuset_ref(set); - - return (set); + return (cpuset_ref(cpuset_getbase(set))); } /* @@ -257,17 +280,25 @@ cpuset_lookup(cpusetid_t setid, struct thread *td) * will have no valid cpu based on restrictions from the parent. */ static int -_cpuset_create(struct cpuset *set, struct cpuset *parent, const cpuset_t *mask, - cpusetid_t id) +_cpuset_create(struct cpuset *set, struct cpuset *parent, + const cpuset_t *mask, struct domainset *domain, cpusetid_t id) { + if (domain == NULL) + domain = parent->cs_domain; + if (mask == NULL) + mask = &parent->cs_mask; if (!CPU_OVERLAP(&parent->cs_mask, mask)) return (EDEADLK); + /* The domain must be prepared ahead of time. */ + if (!domainset_valid(parent->cs_domain, domain)) + return (EDEADLK); CPU_COPY(mask, &set->cs_mask); LIST_INIT(&set->cs_children); refcount_init(&set->cs_ref, 1); set->cs_flags = 0; mtx_lock_spin(&cpuset_lock); + set->cs_domain = domain; CPU_AND(&set->cs_mask, &parent->cs_mask); set->cs_id = id; set->cs_parent = cpuset_ref(parent); @@ -294,8 +325,8 @@ cpuset_create(struct cpuset **setp, struct cpuset *par id = alloc_unr(cpuset_unr); if (id == -1) return (ENFILE); - *setp = set = uma_zalloc(cpuset_zone, M_WAITOK); - error = _cpuset_create(set, parent, mask, id); + *setp = set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); + error = _cpuset_create(set, parent, mask, NULL, id); if (error == 0) return (0); free_unr(cpuset_unr, id); @@ -304,7 +335,207 @@ cpuset_create(struct cpuset **setp, struct cpuset *par return (error); } +static void +cpuset_freelist_add(struct setlist *list, int count) +{ + struct cpuset *set; + int i; + + for (i = 0; i < count; i++) { + set = uma_zalloc(cpuset_zone, M_ZERO | M_WAITOK); + LIST_INSERT_HEAD(list, set, cs_link); + } +} + +static void +cpuset_freelist_init(struct setlist *list, int count) +{ + + LIST_INIT(list); + cpuset_freelist_add(list, count); +} + +static void +cpuset_freelist_free(struct setlist *list) +{ + struct cpuset *set; + + while ((set = LIST_FIRST(list)) != NULL) { + LIST_REMOVE(set, cs_link); + uma_zfree(cpuset_zone, set); + } +} + +static void +domainset_freelist_add(struct domainlist *list, int count) +{ + struct domainset *set; + int i; + + for (i = 0; i < count; i++) { + set = uma_zalloc(domainset_zone, M_ZERO | M_WAITOK); + LIST_INSERT_HEAD(list, set, ds_link); + } +} + +static void +domainset_freelist_init(struct domainlist *list, int count) +{ + + LIST_INIT(list); + domainset_freelist_add(list, count); +} + +static void +domainset_freelist_free(struct domainlist *list) +{ + struct domainset *set; + + while ((set = LIST_FIRST(list)) != NULL) { + LIST_REMOVE(set, ds_link); + uma_zfree(domainset_zone, set); + } +} + +/* Copy a domainset preserving mask and policy. */ +static void +domainset_copy(const struct domainset *from, struct domainset *to) +{ + + DOMAINSET_COPY(&from->ds_mask, &to->ds_mask); + to->ds_policy = from->ds_policy; + to->ds_prefer = from->ds_prefer; +} + +/* Return 1 if mask and policy are equal, otherwise 0. */ +static int +domainset_equal(const struct domainset *one, const struct domainset *two) +{ + + return (DOMAINSET_CMP(&one->ds_mask, &two->ds_mask) == 0 && + one->ds_policy == two->ds_policy && + one->ds_prefer == two->ds_prefer); +} + +/* Return 1 if child is a valid subset of parent. */ +static int +domainset_valid(const struct domainset *parent, const struct domainset *child) +{ + if (child->ds_policy != DOMAINSET_POLICY_PREFER) + return (DOMAINSET_SUBSET(&parent->ds_mask, &child->ds_mask)); + return (DOMAINSET_ISSET(child->ds_prefer, &parent->ds_mask)); +} + +static int +domainset_restrict(const struct domainset *parent, + const struct domainset *child) +{ + if (child->ds_policy != DOMAINSET_POLICY_PREFER) + return (DOMAINSET_OVERLAP(&parent->ds_mask, &child->ds_mask)); + return (DOMAINSET_ISSET(child->ds_prefer, &parent->ds_mask)); +} + /* + * Lookup or create a domainset. The key is provided in ds_mask and + * ds_policy. If the domainset does not yet exist the storage in + * 'domain' is used to insert. Otherwise this storage is freed to the + * domainset_zone and the existing domainset is returned. + */ +static struct domainset * +_domainset_create(struct domainset *domain, struct domainlist *freelist) +{ + struct domainset *ndomain; + + mtx_lock_spin(&cpuset_lock); + LIST_FOREACH(ndomain, &cpuset_domains, ds_link) + if (domainset_equal(ndomain, domain)) + break; + /* + * If the domain does not yet exist we insert it and initialize + * various iteration helpers which are not part of the key. + */ + if (ndomain == NULL) { + LIST_INSERT_HEAD(&cpuset_domains, domain, ds_link); + domain->ds_cnt = DOMAINSET_COUNT(&domain->ds_mask); + domain->ds_max = DOMAINSET_FLS(&domain->ds_mask) + 1; + } + mtx_unlock_spin(&cpuset_lock); + if (ndomain == NULL) + return (domain); + if (freelist != NULL) + LIST_INSERT_HEAD(freelist, domain, ds_link); + else + uma_zfree(domainset_zone, domain); + return (ndomain); + +} + +/* + * Create or lookup a domainset based on the key held in 'domain'. + */ +static struct domainset * +domainset_create(const struct domainset *domain) +{ + struct domainset *ndomain; + + ndomain = uma_zalloc(domainset_zone, M_WAITOK | M_ZERO); + domainset_copy(domain, ndomain); + return _domainset_create(ndomain, NULL); +} + +/* + * Update thread domainset pointers. + */ +static void +domainset_notify(void) +{ + struct thread *td; + struct proc *p; + + sx_slock(&allproc_lock); + FOREACH_PROC_IN_SYSTEM(p) { + PROC_LOCK(p); + if (p->p_state == PRS_NEW) { + PROC_UNLOCK(p); + continue; + } + FOREACH_THREAD_IN_PROC(p, td) { + thread_lock(td); + td->td_domain.dr_policy = td->td_cpuset->cs_domain; + thread_unlock(td); + } + PROC_UNLOCK(p); + } + sx_sunlock(&allproc_lock); + kernel_object->domain.dr_policy = cpuset_default->cs_domain; +} + +/* + * Create a new set that is a subset of a parent. + */ +static struct domainset * +domainset_shadow(const struct domainset *pdomain, + const struct domainset *domain, struct domainlist *freelist) +{ + struct domainset *ndomain; + + ndomain = LIST_FIRST(freelist); + LIST_REMOVE(ndomain, ds_link); + + /* + * Initialize the key from the request. + */ + domainset_copy(domain, ndomain); + + /* + * Restrict the key by the parent. + */ + DOMAINSET_AND(&ndomain->ds_mask, &pdomain->ds_mask); + + return _domainset_create(ndomain, freelist); +} + +/* * Recursively check for errors that would occur from applying mask to * the tree of sets starting at 'set'. Checks for sets that would become * empty as well as RDONLY flags. @@ -376,10 +607,12 @@ cpuset_modify(struct cpuset *set, cpuset_t *mask) * Verify that we have access to this set of * cpus. */ - root = set->cs_parent; - if (root && !CPU_SUBSET(&root->cs_mask, mask)) - return (EINVAL); + root = cpuset_getroot(set); mtx_lock_spin(&cpuset_lock); + if (root && !CPU_SUBSET(&root->cs_mask, mask)) { + error = EINVAL; + goto out; + } error = cpuset_testupdate(set, mask, 0); if (error) goto out; @@ -392,6 +625,141 @@ out: } /* + * Recursively check for errors that would occur from applying mask to + * the tree of sets starting at 'set'. Checks for sets that would become + * empty as well as RDONLY flags. + */ +static int +cpuset_testupdate_domain(struct cpuset *set, struct domainset *dset, + struct domainset *orig, int *count, int check_mask) +{ + struct cpuset *nset; + struct domainset *domain; + struct domainset newset; + int error; + + mtx_assert(&cpuset_lock, MA_OWNED); + if (set->cs_flags & CPU_SET_RDONLY) + return (EPERM); + domain = set->cs_domain; + domainset_copy(domain, &newset); + if (!domainset_equal(domain, orig)) { + if (!domainset_restrict(domain, dset)) + return (EDEADLK); + DOMAINSET_AND(&newset.ds_mask, &dset->ds_mask); + /* Count the number of domains that are changing. */ + (*count)++; + } + error = 0; + LIST_FOREACH(nset, &set->cs_children, cs_siblings) + if ((error = cpuset_testupdate_domain(nset, &newset, domain, + count, 1)) != 0) + break; + return (error); +} + +/* + * Applies the mask 'mask' without checking for empty sets or permissions. + */ +static void +cpuset_update_domain(struct cpuset *set, struct domainset *domain, + struct domainset *orig, struct domainlist *domains) +{ + struct cpuset *nset; + + mtx_assert(&cpuset_lock, MA_OWNED); + /* + * If this domainset has changed from the parent we must calculate + * a new set. Otherwise it simply inherits from the parent. When + * we inherit from the parent we get a new mask and policy. If the + * set is modified from the parent we keep the policy and only + * update the mask. + */ + if (set->cs_domain != orig) { + orig = set->cs_domain; + set->cs_domain = domainset_shadow(domain, orig, domains); + } else + set->cs_domain = domain; + LIST_FOREACH(nset, &set->cs_children, cs_siblings) + cpuset_update_domain(nset, set->cs_domain, orig, domains); + + return; +} + +/* + * Modify the set 'set' to use a copy the domainset provided. Apply this new + * mask to restrict all children in the tree. Checks for validity before + * applying the changes. + */ +static int +cpuset_modify_domain(struct cpuset *set, struct domainset *domain) +{ + struct domainlist domains; + struct domainset temp; + struct domainset *dset; + struct cpuset *root; + int ndomains, needed; + int error; + + error = priv_check(curthread, PRIV_SCHED_CPUSET); + if (error) + return (error); + /* + * In case we are called from within the jail + * we do not allow modifying the dedicated root + * cpuset of the jail but may still allow to + * change child sets. + */ + if (jailed(curthread->td_ucred) && + set->cs_flags & CPU_SET_ROOT) + return (EPERM); + domainset_freelist_init(&domains, 0); + domain = domainset_create(domain); + ndomains = needed = 0; + do { + if (ndomains < needed) { + domainset_freelist_add(&domains, needed - ndomains); + ndomains = needed; + } + root = cpuset_getroot(set); + mtx_lock_spin(&cpuset_lock); + dset = root->cs_domain; + /* + * Verify that we have access to this set of domains. + */ + if (root && !domainset_valid(dset, domain)) { + error = EINVAL; + goto out; + } + /* + * If applying prefer we keep the current set as the fallback. + */ + if (domain->ds_policy == DOMAINSET_POLICY_PREFER) + DOMAINSET_COPY(&set->cs_domain->ds_mask, + &domain->ds_mask); + /* + * Determine whether we can apply this set of domains and + * how many new domain structures it will require. + */ + domainset_copy(domain, &temp); + needed = 0; + error = cpuset_testupdate_domain(set, &temp, set->cs_domain, + &needed, 0); + if (error) + goto out; + } while (ndomains < needed); + dset = set->cs_domain; + cpuset_update_domain(set, domain, dset, &domains); +out: + mtx_unlock_spin(&cpuset_lock); + domainset_freelist_free(&domains); + if (error == 0) + domainset_notify(); + + return (error); +} + +/* * Resolve the 'which' parameter of several cpuset apis. * * For WHICH_PID and WHICH_TID return a locked proc and valid proc/tid. Also @@ -481,44 +849,203 @@ cpuset_which(cpuwhich_t which, id_t id, struct proc ** return (0); } +static int +cpuset_testshadow(struct cpuset *set, const cpuset_t *mask, + const struct domainset *domain) +{ + struct cpuset *parent; + struct domainset *dset; + + parent = cpuset_getbase(set); + /* + * If we are restricting a cpu mask it must be a subset of the + * parent or invalid CPUs have been specified. + */ + if (mask != NULL && !CPU_SUBSET(&parent->cs_mask, mask)) + return (EINVAL); + + /* + * If we are restricting a domain mask it must be a subset of the + * parent or invalid domains have been specified. + */ + dset = parent->cs_domain; + if (domain != NULL && !domainset_valid(dset, domain)) + return (EINVAL); + + return (0); +} + /* * Create an anonymous set with the provided mask in the space provided by - * 'fset'. If the passed in set is anonymous we use its parent otherwise + * 'nset'. If the passed in set is anonymous we use its parent otherwise * the new set is a child of 'set'. */ static int -cpuset_shadow(struct cpuset *set, struct cpuset *fset, const cpuset_t *mask) +cpuset_shadow(struct cpuset *set, struct cpuset **nsetp, + const cpuset_t *mask, const struct domainset *domain, + struct setlist *cpusets, struct domainlist *domains) { struct cpuset *parent; + struct cpuset *nset; + struct domainset *dset; + struct domainset *d; + int error; - if (set->cs_id == CPUSET_INVALID) - parent = set->cs_parent; + error = cpuset_testshadow(set, mask, domain); + if (error) + return (error); + + parent = cpuset_getbase(set); + dset = parent->cs_domain; + if (mask == NULL) + mask = &set->cs_mask; + if (domain != NULL) + d = domainset_shadow(dset, domain, domains); else - parent = set; - if (!CPU_SUBSET(&parent->cs_mask, mask)) + d = set->cs_domain; + nset = LIST_FIRST(cpusets); + error = _cpuset_create(nset, parent, mask, d, CPUSET_INVALID); + if (error == 0) { + LIST_REMOVE(nset, cs_link); + *nsetp = nset; + } + return (error); +} + +static struct cpuset * +cpuset_update_thread(struct thread *td, struct cpuset *nset) +{ + struct cpuset *tdset; + + tdset = td->td_cpuset; + td->td_cpuset = nset; + td->td_domain.dr_policy = nset->cs_domain; + sched_affinity(td); + + return (tdset); +} + +static int +cpuset_setproc_test_maskthread(struct cpuset *tdset, cpuset_t *mask, + struct domainset *domain) +{ + struct cpuset *parent; + + parent = cpuset_getbase(tdset); + if (mask == NULL) + mask = &tdset->cs_mask; + if (domain == NULL) + domain = tdset->cs_domain; + return cpuset_testshadow(parent, mask, domain); +} + +static int +cpuset_setproc_maskthread(struct cpuset *tdset, cpuset_t *mask, + struct domainset *domain, struct cpuset **nsetp, + struct setlist *freelist, struct domainlist *domainlist) +{ + struct cpuset *parent; + + parent = cpuset_getbase(tdset); + if (mask == NULL) + mask = &tdset->cs_mask; + if (domain == NULL) + domain = tdset->cs_domain; + return cpuset_shadow(parent, nsetp, mask, domain, freelist, + domainlist); +} + +static int +cpuset_setproc_setthread_mask(struct cpuset *tdset, struct cpuset *set, + cpuset_t *mask, struct domainset *domain) +{ + struct cpuset *parent; + + parent = cpuset_getbase(tdset); + + /* + * If the thread restricted its mask then apply that same + * restriction to the new set, otherwise take it wholesale. + */ + if (CPU_CMP(&tdset->cs_mask, &parent->cs_mask) != 0) { + CPU_COPY(&tdset->cs_mask, mask); + CPU_AND(mask, &set->cs_mask); + } else + CPU_COPY(&set->cs_mask, mask); + + /* + * If the thread restricted the domain then we apply the + * restriction to the new set but retain the policy. + */ + if (tdset->cs_domain != parent->cs_domain) { + domainset_copy(tdset->cs_domain, domain); + DOMAINSET_AND(&domain->ds_mask, &set->cs_domain->ds_mask); + } else + domainset_copy(set->cs_domain, domain); + + if (CPU_EMPTY(mask) || DOMAINSET_EMPTY(&domain->ds_mask)) return (EDEADLK); - return (_cpuset_create(fset, parent, mask, CPUSET_INVALID)); + + return (0); } +static int +cpuset_setproc_test_setthread(struct cpuset *tdset, struct cpuset *set) +{ + struct domainset domain; + cpuset_t mask; + + if (tdset->cs_id != CPUSET_INVALID) + return (0); + return cpuset_setproc_setthread_mask(tdset, set, &mask, &domain); +} + +static int +cpuset_setproc_setthread(struct cpuset *tdset, struct cpuset *set, + struct cpuset **nsetp, struct setlist *freelist, + struct domainlist *domainlist) +{ + struct domainset domain; + cpuset_t mask; + int error; + + /* + * If we're replacing on a thread that has not constrained the + * original set we can simply accept the new set. + */ + if (tdset->cs_id != CPUSET_INVALID) { + *nsetp = cpuset_ref(set); + return (0); + } + error = cpuset_setproc_setthread_mask(tdset, set, &mask, &domain); + if (error) + return (error); + + return cpuset_shadow(tdset, nsetp, &mask, &domain, freelist, + domainlist); +} + /* - * Handle two cases for replacing the base set or mask of an entire process. + * Handle three cases for updating an entire process. * - * 1) Set is non-null and mask is null. This reparents all anonymous sets - * to the provided set and replaces all non-anonymous td_cpusets with the - * provided set. - * 2) Mask is non-null and set is null. This replaces or creates anonymous - * sets for every thread with the existing base as a parent. + * 1) Set is non-null. This reparents all anonymous sets to the provided + * set and replaces all non-anonymous td_cpusets with the provided set. + * 2) Mask is non-null. This replaces or creates anonymous sets for every + * thread with the existing base as a parent. + * 3) domain is non-null. This creates anonymous sets for every thread + * and replaces the domain set. * * This is overly complicated because we can't allocate while holding a * spinlock and spinlocks must be held while changing and examining thread * state. */ static int -cpuset_setproc(pid_t pid, struct cpuset *set, cpuset_t *mask) +cpuset_setproc(pid_t pid, struct cpuset *set, cpuset_t *mask, + struct domainset *domain) { struct setlist freelist; struct setlist droplist; - struct cpuset *tdset; + struct domainlist domainlist; struct cpuset *nset; struct thread *td; struct proc *p; @@ -533,7 +1060,9 @@ cpuset_setproc(pid_t pid, struct cpuset *set, cpuset_t * 2) If enough cpusets have not been allocated release the locks and * allocate them. Loop. */ - LIST_INIT(&freelist); + cpuset_freelist_init(&freelist, 1); + domainset_freelist_init(&domainlist, 1); + nfree = 1; LIST_INIT(&droplist); nfree = 0; for (;;) { @@ -544,39 +1073,27 @@ cpuset_setproc(pid_t pid, struct cpuset *set, cpuset_t break; threads = p->p_numthreads; PROC_UNLOCK(p); - for (; nfree < threads; nfree++) { - nset = uma_zalloc(cpuset_zone, M_WAITOK); - LIST_INSERT_HEAD(&freelist, nset, cs_link); + if (nfree < threads) { + cpuset_freelist_add(&freelist, threads - nfree); + domainset_freelist_add(&domainlist, threads - nfree); + nfree = threads; } } PROC_LOCK_ASSERT(p, MA_OWNED); /* * Now that the appropriate locks are held and we have enough cpusets, - * make sure the operation will succeed before applying changes. The + * make sure the operation will succeed before applying changes. The * proc lock prevents td_cpuset from changing between calls. */ error = 0; FOREACH_THREAD_IN_PROC(p, td) { thread_lock(td); - tdset = td->td_cpuset; - /* - * Verify that a new mask doesn't specify cpus outside of - * the set the thread is a member of. - */ - if (mask) { - if (tdset->cs_id == CPUSET_INVALID) - tdset = tdset->cs_parent; - if (!CPU_SUBSET(&tdset->cs_mask, mask)) - error = EDEADLK; - /* - * Verify that a new set won't leave an existing thread - * mask without a cpu to run on. It can, however, restrict - * the set. - */ - } else if (tdset->cs_id == CPUSET_INVALID) { - if (!CPU_OVERLAP(&set->cs_mask, &tdset->cs_mask)) - error = EDEADLK; - } + if (set != NULL) + error = cpuset_setproc_test_setthread(td->td_cpuset, + set); + else + error = cpuset_setproc_test_maskthread(td->td_cpuset, + mask, domain); thread_unlock(td); if (error) goto unlock_out; @@ -588,33 +1105,17 @@ cpuset_setproc(pid_t pid, struct cpuset *set, cpuset_t */ FOREACH_THREAD_IN_PROC(p, td) { thread_lock(td); - /* - * If we presently have an anonymous set or are applying a - * mask we must create an anonymous shadow set. That is - * either parented to our existing base or the supplied set. - * - * If we have a base set with no anonymous shadow we simply - * replace it outright. - */ - tdset = td->td_cpuset; - if (tdset->cs_id == CPUSET_INVALID || mask) { - nset = LIST_FIRST(&freelist); - LIST_REMOVE(nset, cs_link); - if (mask) - error = cpuset_shadow(tdset, nset, mask); - else - error = _cpuset_create(nset, set, - &tdset->cs_mask, CPUSET_INVALID); - if (error) { - LIST_INSERT_HEAD(&freelist, nset, cs_link); - thread_unlock(td); - break; - } - } else - nset = cpuset_ref(set); - cpuset_rel_defer(&droplist, tdset); - td->td_cpuset = nset; - sched_affinity(td); + if (set != NULL) + error = cpuset_setproc_setthread(td->td_cpuset, set, + &nset, &freelist, &domainlist); + else + error = cpuset_setproc_maskthread(td->td_cpuset, mask, + domain, &nset, &freelist, &domainlist); + if (error) { + thread_unlock(td); + break; + } + cpuset_rel_defer(&droplist, cpuset_update_thread(td, nset)); thread_unlock(td); } unlock_out: @@ -622,10 +1123,8 @@ unlock_out: out: while ((nset = LIST_FIRST(&droplist)) != NULL) cpuset_rel_complete(nset); - while ((nset = LIST_FIRST(&freelist)) != NULL) { - LIST_REMOVE(nset, cs_link); - uma_zfree(cpuset_zone, nset); - } + cpuset_freelist_free(&freelist); + domainset_freelist_free(&domainlist); return (error); } @@ -690,46 +1189,57 @@ cpusetobj_strscan(cpuset_t *set, const char *buf) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Jan 12 22:49:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BD20EA61BD; Fri, 12 Jan 2018 22:49:37 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-io0-x242.google.com (mail-io0-x242.google.com [IPv6:2607:f8b0:4001:c06::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0297DB15; Fri, 12 Jan 2018 22:49:37 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-io0-x242.google.com with SMTP id f34so2223666ioi.13; Fri, 12 Jan 2018 14:49:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=1wdhWkkgHqbvDTBKL8auYNsDDpgv8cUiQ3L6pV44E3c=; b=ThDUT60k6krFvc6TgPZT8sx/nlfAlwub8ToPJ0eYExC0RuWssdGjQe99+4eUmn5Rvt zwJO/vp2UdWbbId3h0QWC1Am8TZPrwLmh8UhEecp6ypiwfSay3rigWqeBJIkePZYRs30 /gPkqJqLguIT6Zpanhgsk/hIccDMKjO8WU7eDTfB9gK0jHLQFdXFTb5r0grMiv3u50U0 MJYyP3Q3rz67LIlx6XrmorPSdtdCBc6W4ga2OkSfQERjunmsCigyVIJ3L8VGLpZnGpWi wbfpmU7o5qDhTyL2Pvc8t+sVkMt82o3sOcbHKsnQVMzT3/ckuaPOd1BXfIA2RQfgIOGs lPJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=1wdhWkkgHqbvDTBKL8auYNsDDpgv8cUiQ3L6pV44E3c=; b=OVnKcK9bVhhF+xoufddz15/BWgv9UDVzVDETmm8ExX+IB5axTT6MWPTvUOUrc9JxXE ekt4lpyRAblN//I2Glv3+RNp+hqaZgarKZP1icR1INklsxaD79bY8GTTBB8mx2emNmje /DaBMltGJlLsNOZC4Quf4OkXBYJxA4avcLaYueg35DjIl07Zs2+xF1n3nRIYyoj2eaIt aWW3zr7x/4coXSIesGo6UpvoWoEHm/iGddRn/zMDrq1nZWxwVaf2oGIW6fWQAE84V5UB E4CfVOdhREoWTiicwFfOSqo9lRbMzMYNbFy3qB6LHo37O074TNNy5ml8lViaDg4EZaue XhlQ== X-Gm-Message-State: AKwxytcXUeHanBUTlEir56jZRfzGeMbft6g+prXQxdCOGgPqfn20NxVj y/PeKz0+LZOCIGXZDkbJWA0K/P78O7ziIaU2jc4= X-Google-Smtp-Source: ACJfBotzMxbXWMVR3pkkMsJVZlHOoEQfAm6ZbiOrplMunzH1SA5K9l2SRKkwn9EG7XonBj71vTXVKkafv8rpS0c/gnY= X-Received: by 10.107.35.85 with SMTP id j82mr25834609ioj.253.1515797376113; Fri, 12 Jan 2018 14:49:36 -0800 (PST) MIME-Version: 1.0 Sender: antoine.brodin.freebsd@gmail.com Received: by 10.107.190.1 with HTTP; Fri, 12 Jan 2018 14:49:35 -0800 (PST) In-Reply-To: <201801111403.w0BE353l047103@repo.freebsd.org> References: <201801111403.w0BE353l047103@repo.freebsd.org> From: Antoine Brodin Date: Fri, 12 Jan 2018 23:49:35 +0100 X-Google-Sender-Auth: kAOVCC_EqZZ2KlCwaIVmLoCG65E Message-ID: Subject: Re: svn commit: r327823 - head/share/mk To: Ed Maste Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 22:49:37 -0000 On Thu, Jan 11, 2018 at 3:03 PM, Ed Maste wrote: > Author: emaste > Date: Thu Jan 11 14:03:05 2018 > New Revision: 327823 > URL: https://svnweb.freebsd.org/changeset/base/327823 > > Log: > Enable ld.lld as bootstrap linker by default on i386 > > Akin to r327783 for amd64. lld has been usable for amd64 for quite some > time, but a couple of issues remained that affected i386. These were > recently addressed upstream in lld and merged into FreeBSD (r326831, > r326879, r326897, r326957), so we can now use ld.lld on i386 as well. > > Similarly to amd64 this change enables lld only as the bootstrap linker > (used to link the kernel and userland libraries and executables), while > GNU ld.bfd is still installed as /usr/bin/ld and used for ports builds. > > The ports collection is essentially ready to use lld as the system > linker for amd64, but many ports still have trouble with lld on i386, > because lld defaults to -ztext, disallowing relocations against readonly > segments. Thus switching the system linker (WITH_LLD_IS_LD) will happen > later on a per-arch basis. > > Relnotes: Yes > Sponsored by: The FreeBSD Foundation Hi, There are some regressions in ports after this change, could you revert it and request a proper exp-run? Thanks. Antoine From owner-svn-src-head@freebsd.org Fri Jan 12 22:57:59 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CFC1EA6A61; Fri, 12 Jan 2018 22:57:59 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1040D13B4; Fri, 12 Jan 2018 22:57:59 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 354C721B8; Fri, 12 Jan 2018 22:57:58 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CMvwcX087237; Fri, 12 Jan 2018 22:57:58 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CMvvio087233; Fri, 12 Jan 2018 22:57:57 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201801122257.w0CMvvio087233@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Fri, 12 Jan 2018 22:57:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327896 - in head/sys: sys vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: sys vm X-SVN-Commit-Revision: 327896 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 22:57:59 -0000 Author: jeff Date: Fri Jan 12 22:57:57 2018 New Revision: 327896 URL: https://svnweb.freebsd.org/changeset/base/327896 Log: Add files for r327895 Implement 'domainset', a cpuset based NUMA policy mechanism. This allows userspace to control NUMA policy administratively and programmatically. Implement domainset based iterators in the page layer. Remove the now legacy numa_* syscalls. Cleanup some header polution created by having seq.h in proc.h. Reviewed by: markj, kib Discussed with: alc Tested by: pho Sponsored by: Netflix, Dell/EMC Isilon Differential Revision: https://reviews.freebsd.org/D13403 Added: head/sys/sys/_domainset.h (contents, props changed) head/sys/sys/domainset.h (contents, props changed) head/sys/vm/vm_domainset.c (contents, props changed) head/sys/vm/vm_domainset.h (contents, props changed) Added: head/sys/sys/_domainset.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/_domainset.h Fri Jan 12 22:57:57 2018 (r327896) @@ -0,0 +1,60 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2017, Jeffrey Roberson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SYS__DOMAINSET_H_ +#define _SYS__DOMAINSET_H_ + +#include + +#ifdef _KERNEL +#define DOMAINSET_SETSIZE MAXMEMDOM +#endif + +#define DOMAINSET_MAXSIZE 256 + +#ifndef DOMAINSET_SETSIZE +#define DOMAINSET_SETSIZE DOMAINSET_MAXSIZE +#endif + +BITSET_DEFINE(_domainset, DOMAINSET_SETSIZE); +typedef struct _domainset domainset_t; + +/* + * This structure is intended to be embedded in objects which have policy + * attributes. Each object keeps its own iterator so round-robin is + * synchronized and accurate. + */ +struct domainset; +struct domainset_ref { + struct domainset * volatile dr_policy; + int dr_iterator; +}; + +#endif /* !_SYS__DOMAINSET_H_ */ Added: head/sys/sys/domainset.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/domainset.h Fri Jan 12 22:57:57 2018 (r327896) @@ -0,0 +1,102 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2017, Jeffrey Roberson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SYS_DOMAINSETSET_H_ +#define _SYS_DOMAINSETSET_H_ + +#include + +#include + +#define _NDOMAINSETBITS _BITSET_BITS +#define _NDOMAINSETWORDS __bitset_words(DOMAINSET_SETSIZE) + +#define DOMAINSETSETBUFSIZ ((2 + sizeof(long) * 2) * _NDOMAINSETWORDS) + +#define DOMAINSET_CLR(n, p) BIT_CLR(DOMAINSET_SETSIZE, n, p) +#define DOMAINSET_COPY(f, t) BIT_COPY(DOMAINSET_SETSIZE, f, t) +#define DOMAINSET_ISSET(n, p) BIT_ISSET(DOMAINSET_SETSIZE, n, p) +#define DOMAINSET_SET(n, p) BIT_SET(DOMAINSET_SETSIZE, n, p) +#define DOMAINSET_ZERO(p) BIT_ZERO(DOMAINSET_SETSIZE, p) +#define DOMAINSET_FILL(p) BIT_FILL(DOMAINSET_SETSIZE, p) +#define DOMAINSET_SETOF(n, p) BIT_SETOF(DOMAINSET_SETSIZE, n, p) +#define DOMAINSET_EMPTY(p) BIT_EMPTY(DOMAINSET_SETSIZE, p) +#define DOMAINSET_ISFULLSET(p) BIT_ISFULLSET(DOMAINSET_SETSIZE, p) +#define DOMAINSET_SUBSET(p, c) BIT_SUBSET(DOMAINSET_SETSIZE, p, c) +#define DOMAINSET_OVERLAP(p, c) BIT_OVERLAP(DOMAINSET_SETSIZE, p, c) +#define DOMAINSET_CMP(p, c) BIT_CMP(DOMAINSET_SETSIZE, p, c) +#define DOMAINSET_OR(d, s) BIT_OR(DOMAINSET_SETSIZE, d, s) +#define DOMAINSET_AND(d, s) BIT_AND(DOMAINSET_SETSIZE, d, s) +#define DOMAINSET_NAND(d, s) BIT_NAND(DOMAINSET_SETSIZE, d, s) +#define DOMAINSET_CLR_ATOMIC(n, p) BIT_CLR_ATOMIC(DOMAINSET_SETSIZE, n, p) +#define DOMAINSET_SET_ATOMIC(n, p) BIT_SET_ATOMIC(DOMAINSET_SETSIZE, n, p) +#define DOMAINSET_SET_ATOMIC_ACQ(n, p) \ + BIT_SET_ATOMIC_ACQ(DOMAINSET_SETSIZE, n, p) +#define DOMAINSET_AND_ATOMIC(n, p) BIT_AND_ATOMIC(DOMAINSET_SETSIZE, n, p) +#define DOMAINSET_OR_ATOMIC(d, s) BIT_OR_ATOMIC(DOMAINSET_SETSIZE, d, s) +#define DOMAINSET_COPY_STORE_REL(f, t) \ + BIT_COPY_STORE_REL(DOMAINSET_SETSIZE, f, t) +#define DOMAINSET_FFS(p) BIT_FFS(DOMAINSET_SETSIZE, p) +#define DOMAINSET_FLS(p) BIT_FLS(DOMAINSET_SETSIZE, p) +#define DOMAINSET_COUNT(p) BIT_COUNT(DOMAINSET_SETSIZE, p) +#define DOMAINSET_FSET BITSET_FSET(_NDOMAINSETWORDS) +#define DOMAINSET_T_INITIALIZER BITSET_T_INITIALIZER + +#define DOMAINSET_POLICY_INVALID 0 +#define DOMAINSET_POLICY_ROUNDROBIN 1 +#define DOMAINSET_POLICY_FIRSTTOUCH 2 +#define DOMAINSET_POLICY_PREFER 3 +#define DOMAINSET_POLICY_MAX DOMAINSET_POLICY_PREFER + +#ifdef _KERNEL +#include +LIST_HEAD(domainlist, domainset); + +struct domainset { + LIST_ENTRY(domainset) ds_link; + domainset_t ds_mask; /* allowed domains. */ + uint16_t ds_policy; /* Policy type. */ + int16_t ds_prefer; /* Preferred domain or -1. */ + uint16_t ds_cnt; /* popcnt from above. */ + uint16_t ds_max; /* Maximum domain in set. */ +}; + +void domainset_zero(void); + +#else +__BEGIN_DECLS +int cpuset_getdomain(cpulevel_t, cpuwhich_t, id_t, size_t, domainset_t *, + int *); +int cpuset_setdomain(cpulevel_t, cpuwhich_t, id_t, size_t, + const domainset_t *, int); + +__END_DECLS +#endif +#endif /* !_SYS_DOMAINSETSET_H_ */ Added: head/sys/vm/vm_domainset.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/vm/vm_domainset.c Fri Jan 12 22:57:57 2018 (r327896) @@ -0,0 +1,243 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2017, Jeffrey Roberson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_vm.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * Iterators are written such that the first nowait pass has as short a + * codepath as possible to eliminate bloat from the allocator. It is + * assumed that most allocations are successful. + */ + +/* + * Determine which policy is to be used for this allocation. + */ +static void +vm_domainset_iter_domain(struct vm_domainset_iter *di, struct vm_object *obj) +{ + struct domainset *domain; + + /* + * object policy takes precedence over thread policy. The policies + * are immutable and unsynchronized. Updates can race but pointer + * loads are assumed to be atomic. + */ + if (obj != NULL && (domain = obj->domain.dr_policy) != NULL) { + di->di_domain = domain; + di->di_iter = &obj->domain.dr_iterator; + } else { + di->di_domain = curthread->td_domain.dr_policy; + di->di_iter = &curthread->td_domain.dr_iterator; + } +} + +static void +vm_domainset_iter_rr(struct vm_domainset_iter *di, int *domain) +{ + int d; + + d = *di->di_iter; + do { + d = (d + 1) % di->di_domain->ds_max; + } while (!DOMAINSET_ISSET(d, &di->di_domain->ds_mask)); + *di->di_iter = *domain = d; +} + +static void +vm_domainset_iter_prefer(struct vm_domainset_iter *di, int *domain) +{ + int d; + + d = *di->di_iter; + do { + d = (d + 1) % di->di_domain->ds_max; + } while (!DOMAINSET_ISSET(d, &di->di_domain->ds_mask) || + d == di->di_domain->ds_prefer); + *di->di_iter = *domain = d; +} + +static void +vm_domainset_iter_next(struct vm_domainset_iter *di, int *domain) +{ + + KASSERT(di->di_n > 0, + ("vm_domainset_iter_first: Invalid n %d", di->di_n)); + switch (di->di_domain->ds_policy) { + case DOMAINSET_POLICY_FIRSTTOUCH: + /* + * To prevent impossible allocations we convert an invalid + * first-touch to round-robin. + */ + /* FALLTHROUGH */ + case DOMAINSET_POLICY_ROUNDROBIN: + vm_domainset_iter_rr(di, domain); + break; + case DOMAINSET_POLICY_PREFER: + vm_domainset_iter_prefer(di, domain); + break; + default: + panic("vm_domainset_iter_first: Unknown policy %d", + di->di_domain->ds_policy); + } + KASSERT(*domain < vm_ndomains, + ("vm_domainset_iter_next: Invalid domain %d", *domain)); +} + +static void +vm_domainset_iter_first(struct vm_domainset_iter *di, int *domain) +{ + + switch (di->di_domain->ds_policy) { + case DOMAINSET_POLICY_FIRSTTOUCH: + *domain = PCPU_GET(domain); + if (DOMAINSET_ISSET(*domain, &di->di_domain->ds_mask)) { + di->di_n = 1; + break; + } + /* + * To prevent impossible allocations we convert an invalid + * first-touch to round-robin. + */ + /* FALLTHROUGH */ + case DOMAINSET_POLICY_ROUNDROBIN: + di->di_n = di->di_domain->ds_cnt; + vm_domainset_iter_rr(di, domain); + break; + case DOMAINSET_POLICY_PREFER: + *domain = di->di_domain->ds_prefer; + di->di_n = di->di_domain->ds_cnt; + break; + default: + panic("vm_domainset_iter_first: Unknown policy %d", + di->di_domain->ds_policy); + } + KASSERT(di->di_n > 0, + ("vm_domainset_iter_first: Invalid n %d", di->di_n)); + KASSERT(*domain < vm_ndomains, + ("vm_domainset_iter_first: Invalid domain %d", *domain)); +} + +void +vm_domainset_iter_page_init(struct vm_domainset_iter *di, struct vm_object *obj, + int *domain, int *req) +{ + + vm_domainset_iter_domain(di, obj); + di->di_flags = *req; + *req = (di->di_flags & ~(VM_ALLOC_WAITOK | VM_ALLOC_WAITFAIL)) | + VM_ALLOC_NOWAIT; + vm_domainset_iter_first(di, domain); +} + +int +vm_domainset_iter_page(struct vm_domainset_iter *di, int *domain, int *req) +{ + + /* + * If we exhausted all options with NOWAIT and did a WAITFAIL it + * is time to return an error to the caller. + */ + if ((*req & VM_ALLOC_WAITFAIL) != 0) + return (ENOMEM); + + /* If there are more domains to visit we run the iterator. */ + if (--di->di_n != 0) { + vm_domainset_iter_next(di, domain); + return (0); + } + + /* If we visited all domains and this was a NOWAIT we return error. */ + if ((di->di_flags & (VM_ALLOC_WAITOK | VM_ALLOC_WAITFAIL)) == 0) + return (ENOMEM); + + /* + * We have visited all domains with non-blocking allocations, try + * from the beginning with a blocking allocation. + */ + vm_domainset_iter_first(di, domain); + *req = di->di_flags; + + return (0); +} + + +void +vm_domainset_iter_malloc_init(struct vm_domainset_iter *di, + struct vm_object *obj, int *domain, int *flags) +{ + + vm_domainset_iter_domain(di, obj); + di->di_flags = *flags; + *flags = (di->di_flags & ~M_WAITOK) | M_NOWAIT; + vm_domainset_iter_first(di, domain); +} + +int +vm_domainset_iter_malloc(struct vm_domainset_iter *di, int *domain, int *flags) +{ + + /* If there are more domains to visit we run the iterator. */ + if (--di->di_n != 0) { + vm_domainset_iter_next(di, domain); + return (0); + } + + /* If we visited all domains and this was a NOWAIT we return error. */ + if ((di->di_flags & M_WAITOK) == 0) + return (ENOMEM); + + /* + * We have visited all domains with non-blocking allocations, try + * from the beginning with a blocking allocation. + */ + vm_domainset_iter_first(di, domain); + *flags = di->di_flags; + + return (0); +} Added: head/sys/vm/vm_domainset.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/vm/vm_domainset.h Fri Jan 12 22:57:57 2018 (r327896) @@ -0,0 +1,47 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2017, Jeffrey Roberson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ +#ifndef __VM_DOMAINSET_H__ +#define __VM_DOMAINSET_H__ + +struct vm_domainset_iter { + struct domainset *di_domain; + int *di_iter; + int di_flags; + int di_n; +}; + +int vm_domainset_iter_page(struct vm_domainset_iter *, int *, int *); +void vm_domainset_iter_page_init(struct vm_domainset_iter *, + struct vm_object *, int *, int *); +int vm_domainset_iter_malloc(struct vm_domainset_iter *, int *, int *); +void vm_domainset_iter_malloc_init(struct vm_domainset_iter *, + struct vm_object *, int *, int *); + +#endif /* __VM_DOMAINSET_H__ */ From owner-svn-src-head@freebsd.org Fri Jan 12 23:06:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7BA12EA71AF; Fri, 12 Jan 2018 23:06:38 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2A1341B2D; Fri, 12 Jan 2018 23:06:38 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44F9F2352; Fri, 12 Jan 2018 23:06:37 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CN6b0k091215; Fri, 12 Jan 2018 23:06:37 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CN6ZnU091203; Fri, 12 Jan 2018 23:06:35 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201801122306.w0CN6ZnU091203@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Fri, 12 Jan 2018 23:06:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327897 - in head/sys: compat/freebsd32 kern sys X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: compat/freebsd32 kern sys X-SVN-Commit-Revision: 327897 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 23:06:38 -0000 Author: jeff Date: Fri Jan 12 23:06:35 2018 New Revision: 327897 URL: https://svnweb.freebsd.org/changeset/base/327897 Log: Regenerate auto-generated files Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c head/sys/kern/syscalls.c head/sys/kern/systrace_args.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Fri Jan 12 22:57:57 2018 (r327896) +++ head/sys/compat/freebsd32/freebsd32_proto.h Fri Jan 12 23:06:35 2018 (r327897) @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -693,6 +694,24 @@ struct freebsd32_kevent_args { char nevents_l_[PADL_(int)]; int nevents; char nevents_r_[PADR_(int)]; char timeout_l_[PADL_(const struct timespec32 *)]; const struct timespec32 * timeout; char timeout_r_[PADR_(const struct timespec32 *)]; }; +struct freebsd32_cpuset_getdomain_args { + char level_l_[PADL_(cpulevel_t)]; cpulevel_t level; char level_r_[PADR_(cpulevel_t)]; + char which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)]; + char id1_l_[PADL_(uint32_t)]; uint32_t id1; char id1_r_[PADR_(uint32_t)]; + char id2_l_[PADL_(uint32_t)]; uint32_t id2; char id2_r_[PADR_(uint32_t)]; + char domainsetsize_l_[PADL_(size_t)]; size_t domainsetsize; char domainsetsize_r_[PADR_(size_t)]; + char mask_l_[PADL_(domainset_t *)]; domainset_t * mask; char mask_r_[PADR_(domainset_t *)]; + char policy_l_[PADL_(int *)]; int * policy; char policy_r_[PADR_(int *)]; +}; +struct freebsd32_cpuset_setdomain_args { + char level_l_[PADL_(cpulevel_t)]; cpulevel_t level; char level_r_[PADR_(cpulevel_t)]; + char which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)]; + char id1_l_[PADL_(uint32_t)]; uint32_t id1; char id1_r_[PADR_(uint32_t)]; + char id2_l_[PADL_(uint32_t)]; uint32_t id2; char id2_r_[PADR_(uint32_t)]; + char domainsetsize_l_[PADL_(size_t)]; size_t domainsetsize; char domainsetsize_r_[PADR_(size_t)]; + char mask_l_[PADL_(domainset_t *)]; domainset_t * mask; char mask_r_[PADR_(domainset_t *)]; + char policy_l_[PADL_(int)]; int policy; char policy_r_[PADR_(int)]; +}; #if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__)) #define PAD64_REQUIRED #endif @@ -823,6 +842,8 @@ int freebsd32_fstatat(struct thread *, struct freebsd3 int freebsd32_fhstat(struct thread *, struct freebsd32_fhstat_args *); int freebsd32_getdirentries(struct thread *, struct freebsd32_getdirentries_args *); int freebsd32_kevent(struct thread *, struct freebsd32_kevent_args *); +int freebsd32_cpuset_getdomain(struct thread *, struct freebsd32_cpuset_getdomain_args *); +int freebsd32_cpuset_setdomain(struct thread *, struct freebsd32_cpuset_setdomain_args *); #ifdef COMPAT_43 @@ -1370,6 +1391,8 @@ int freebsd11_freebsd32_mknodat(struct thread *, struc #define FREEBSD32_SYS_AUE_freebsd32_fhstat AUE_FHSTAT #define FREEBSD32_SYS_AUE_freebsd32_getdirentries AUE_GETDIRENTRIES #define FREEBSD32_SYS_AUE_freebsd32_kevent AUE_KEVENT +#define FREEBSD32_SYS_AUE_freebsd32_cpuset_getdomain AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_cpuset_setdomain AUE_NULL #undef PAD_ #undef PADL_ Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Fri Jan 12 22:57:57 2018 (r327896) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Fri Jan 12 23:06:35 2018 (r327897) @@ -455,8 +455,6 @@ #define FREEBSD32_SYS_freebsd32_ppoll 545 #define FREEBSD32_SYS_freebsd32_futimens 546 #define FREEBSD32_SYS_freebsd32_utimensat 547 -#define FREEBSD32_SYS_numa_getaffinity 548 -#define FREEBSD32_SYS_numa_setaffinity 549 #define FREEBSD32_SYS_fdatasync 550 #define FREEBSD32_SYS_freebsd32_fstat 551 #define FREEBSD32_SYS_freebsd32_fstatat 552 @@ -468,4 +466,6 @@ #define FREEBSD32_SYS_fhstatfs 558 #define FREEBSD32_SYS_mknodat 559 #define FREEBSD32_SYS_freebsd32_kevent 560 -#define FREEBSD32_SYS_MAXSYSCALL 561 +#define FREEBSD32_SYS_freebsd32_cpuset_getdomain 561 +#define FREEBSD32_SYS_freebsd32_cpuset_setdomain 562 +#define FREEBSD32_SYS_MAXSYSCALL 563 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Fri Jan 12 22:57:57 2018 (r327896) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Fri Jan 12 23:06:35 2018 (r327897) @@ -580,8 +580,8 @@ const char *freebsd32_syscallnames[] = { "freebsd32_ppoll", /* 545 = freebsd32_ppoll */ "freebsd32_futimens", /* 546 = freebsd32_futimens */ "freebsd32_utimensat", /* 547 = freebsd32_utimensat */ - "numa_getaffinity", /* 548 = numa_getaffinity */ - "numa_setaffinity", /* 549 = numa_setaffinity */ + "#548", /* 548 = numa_getaffinity */ + "#549", /* 549 = numa_setaffinity */ "fdatasync", /* 550 = fdatasync */ "freebsd32_fstat", /* 551 = freebsd32_fstat */ "freebsd32_fstatat", /* 552 = freebsd32_fstatat */ @@ -593,4 +593,6 @@ const char *freebsd32_syscallnames[] = { "fhstatfs", /* 558 = fhstatfs */ "mknodat", /* 559 = mknodat */ "freebsd32_kevent", /* 560 = freebsd32_kevent */ + "freebsd32_cpuset_getdomain", /* 561 = freebsd32_cpuset_getdomain */ + "freebsd32_cpuset_setdomain", /* 562 = freebsd32_cpuset_setdomain */ }; Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Fri Jan 12 22:57:57 2018 (r327896) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Fri Jan 12 23:06:35 2018 (r327897) @@ -629,8 +629,8 @@ struct sysent freebsd32_sysent[] = { { AS(freebsd32_ppoll_args), (sy_call_t *)freebsd32_ppoll, AUE_POLL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 545 = freebsd32_ppoll */ { AS(freebsd32_futimens_args), (sy_call_t *)freebsd32_futimens, AUE_FUTIMES, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 546 = freebsd32_futimens */ { AS(freebsd32_utimensat_args), (sy_call_t *)freebsd32_utimensat, AUE_FUTIMESAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 547 = freebsd32_utimensat */ - { AS(numa_getaffinity_args), (sy_call_t *)sys_numa_getaffinity, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 548 = numa_getaffinity */ - { AS(numa_setaffinity_args), (sy_call_t *)sys_numa_setaffinity, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 549 = numa_setaffinity */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 548 = numa_getaffinity */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 549 = numa_setaffinity */ { AS(fdatasync_args), (sy_call_t *)sys_fdatasync, AUE_FSYNC, NULL, 0, 0, 0, SY_THR_STATIC }, /* 550 = fdatasync */ { AS(freebsd32_fstat_args), (sy_call_t *)freebsd32_fstat, AUE_FSTAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 551 = freebsd32_fstat */ { AS(freebsd32_fstatat_args), (sy_call_t *)freebsd32_fstatat, AUE_FSTATAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 552 = freebsd32_fstatat */ @@ -642,4 +642,6 @@ struct sysent freebsd32_sysent[] = { { AS(fhstatfs_args), (sy_call_t *)sys_fhstatfs, AUE_FHSTATFS, NULL, 0, 0, 0, SY_THR_STATIC }, /* 558 = fhstatfs */ { AS(mknodat_args), (sy_call_t *)sys_mknodat, AUE_MKNODAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 559 = mknodat */ { AS(freebsd32_kevent_args), (sy_call_t *)freebsd32_kevent, AUE_KEVENT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 560 = freebsd32_kevent */ + { AS(freebsd32_cpuset_getdomain_args), (sy_call_t *)freebsd32_cpuset_getdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 561 = freebsd32_cpuset_getdomain */ + { AS(freebsd32_cpuset_setdomain_args), (sy_call_t *)freebsd32_cpuset_setdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 562 = freebsd32_cpuset_setdomain */ }; Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Fri Jan 12 22:57:57 2018 (r327896) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Fri Jan 12 23:06:35 2018 (r327897) @@ -3150,24 +3150,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 4; break; } - /* numa_getaffinity */ - case 548: { - struct numa_getaffinity_args *p = params; - iarg[0] = p->which; /* cpuwhich_t */ - iarg[1] = p->id; /* id_t */ - uarg[2] = (intptr_t) p->policy; /* struct vm_domain_policy * */ - *n_args = 3; - break; - } - /* numa_setaffinity */ - case 549: { - struct numa_setaffinity_args *p = params; - iarg[0] = p->which; /* cpuwhich_t */ - iarg[1] = p->id; /* id_t */ - uarg[2] = (intptr_t) p->policy; /* const struct vm_domain_policy * */ - *n_args = 3; - break; - } /* fdatasync */ case 550: { struct fdatasync_args *p = params; @@ -3266,6 +3248,32 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 6; break; } + /* freebsd32_cpuset_getdomain */ + case 561: { + struct freebsd32_cpuset_getdomain_args *p = params; + iarg[0] = p->level; /* cpulevel_t */ + iarg[1] = p->which; /* cpuwhich_t */ + uarg[2] = p->id1; /* uint32_t */ + uarg[3] = p->id2; /* uint32_t */ + uarg[4] = p->domainsetsize; /* size_t */ + uarg[5] = (intptr_t) p->mask; /* domainset_t * */ + uarg[6] = (intptr_t) p->policy; /* int * */ + *n_args = 7; + break; + } + /* freebsd32_cpuset_setdomain */ + case 562: { + struct freebsd32_cpuset_setdomain_args *p = params; + iarg[0] = p->level; /* cpulevel_t */ + iarg[1] = p->which; /* cpuwhich_t */ + uarg[2] = p->id1; /* uint32_t */ + uarg[3] = p->id2; /* uint32_t */ + uarg[4] = p->domainsetsize; /* size_t */ + uarg[5] = (intptr_t) p->mask; /* domainset_t * */ + iarg[6] = p->policy; /* int */ + *n_args = 7; + break; + } default: *n_args = 0; break; @@ -8563,38 +8571,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; - /* numa_getaffinity */ - case 548: - switch(ndx) { - case 0: - p = "cpuwhich_t"; - break; - case 1: - p = "id_t"; - break; - case 2: - p = "userland struct vm_domain_policy *"; - break; - default: - break; - }; - break; - /* numa_setaffinity */ - case 549: - switch(ndx) { - case 0: - p = "cpuwhich_t"; - break; - case 1: - p = "id_t"; - break; - case 2: - p = "userland const struct vm_domain_policy *"; - break; - default: - break; - }; - break; /* fdatasync */ case 550: switch(ndx) { @@ -8768,6 +8744,62 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; + /* freebsd32_cpuset_getdomain */ + case 561: + switch(ndx) { + case 0: + p = "cpulevel_t"; + break; + case 1: + p = "cpuwhich_t"; + break; + case 2: + p = "uint32_t"; + break; + case 3: + p = "uint32_t"; + break; + case 4: + p = "size_t"; + break; + case 5: + p = "userland domainset_t *"; + break; + case 6: + p = "userland int *"; + break; + default: + break; + }; + break; + /* freebsd32_cpuset_setdomain */ + case 562: + switch(ndx) { + case 0: + p = "cpulevel_t"; + break; + case 1: + p = "cpuwhich_t"; + break; + case 2: + p = "uint32_t"; + break; + case 3: + p = "uint32_t"; + break; + case 4: + p = "size_t"; + break; + case 5: + p = "userland domainset_t *"; + break; + case 6: + p = "int"; + break; + default: + break; + }; + break; default: break; }; @@ -10554,16 +10586,6 @@ systrace_return_setargdesc(int sysnum, int ndx, char * if (ndx == 0 || ndx == 1) p = "int"; break; - /* numa_getaffinity */ - case 548: - if (ndx == 0 || ndx == 1) - p = "int"; - break; - /* numa_setaffinity */ - case 549: - if (ndx == 0 || ndx == 1) - p = "int"; - break; /* fdatasync */ case 550: if (ndx == 0 || ndx == 1) @@ -10616,6 +10638,16 @@ systrace_return_setargdesc(int sysnum, int ndx, char * break; /* freebsd32_kevent */ case 560: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* freebsd32_cpuset_getdomain */ + case 561: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* freebsd32_cpuset_setdomain */ + case 562: if (ndx == 0 || ndx == 1) p = "int"; break; Modified: head/sys/kern/syscalls.c ============================================================================== --- head/sys/kern/syscalls.c Fri Jan 12 22:57:57 2018 (r327896) +++ head/sys/kern/syscalls.c Fri Jan 12 23:06:35 2018 (r327897) @@ -554,8 +554,8 @@ const char *syscallnames[] = { "ppoll", /* 545 = ppoll */ "futimens", /* 546 = futimens */ "utimensat", /* 547 = utimensat */ - "numa_getaffinity", /* 548 = numa_getaffinity */ - "numa_setaffinity", /* 549 = numa_setaffinity */ + "#548", /* 548 = numa_getaffinity */ + "#549", /* 549 = numa_setaffinity */ "fdatasync", /* 550 = fdatasync */ "fstat", /* 551 = fstat */ "fstatat", /* 552 = fstatat */ @@ -567,4 +567,6 @@ const char *syscallnames[] = { "fhstatfs", /* 558 = fhstatfs */ "mknodat", /* 559 = mknodat */ "kevent", /* 560 = kevent */ + "cpuset_getdomain", /* 561 = cpuset_getdomain */ + "cpuset_setdomain", /* 562 = cpuset_setdomain */ }; Modified: head/sys/kern/systrace_args.c ============================================================================== --- head/sys/kern/systrace_args.c Fri Jan 12 22:57:57 2018 (r327896) +++ head/sys/kern/systrace_args.c Fri Jan 12 23:06:35 2018 (r327897) @@ -3160,24 +3160,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 4; break; } - /* numa_getaffinity */ - case 548: { - struct numa_getaffinity_args *p = params; - iarg[0] = p->which; /* cpuwhich_t */ - iarg[1] = p->id; /* id_t */ - uarg[2] = (intptr_t) p->policy; /* struct vm_domain_policy_entry * */ - *n_args = 3; - break; - } - /* numa_setaffinity */ - case 549: { - struct numa_setaffinity_args *p = params; - iarg[0] = p->which; /* cpuwhich_t */ - iarg[1] = p->id; /* id_t */ - uarg[2] = (intptr_t) p->policy; /* const struct vm_domain_policy_entry * */ - *n_args = 3; - break; - } /* fdatasync */ case 550: { struct fdatasync_args *p = params; @@ -3276,6 +3258,30 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 6; break; } + /* cpuset_getdomain */ + case 561: { + struct cpuset_getdomain_args *p = params; + iarg[0] = p->level; /* cpulevel_t */ + iarg[1] = p->which; /* cpuwhich_t */ + iarg[2] = p->id; /* id_t */ + uarg[3] = p->domainsetsize; /* size_t */ + uarg[4] = (intptr_t) p->mask; /* domainset_t * */ + uarg[5] = (intptr_t) p->policy; /* int * */ + *n_args = 6; + break; + } + /* cpuset_setdomain */ + case 562: { + struct cpuset_setdomain_args *p = params; + iarg[0] = p->level; /* cpulevel_t */ + iarg[1] = p->which; /* cpuwhich_t */ + iarg[2] = p->id; /* id_t */ + uarg[3] = p->domainsetsize; /* size_t */ + uarg[4] = (intptr_t) p->mask; /* domainset_t * */ + iarg[5] = p->policy; /* int */ + *n_args = 6; + break; + } default: *n_args = 0; break; @@ -8523,38 +8529,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; - /* numa_getaffinity */ - case 548: - switch(ndx) { - case 0: - p = "cpuwhich_t"; - break; - case 1: - p = "id_t"; - break; - case 2: - p = "userland struct vm_domain_policy_entry *"; - break; - default: - break; - }; - break; - /* numa_setaffinity */ - case 549: - switch(ndx) { - case 0: - p = "cpuwhich_t"; - break; - case 1: - p = "id_t"; - break; - case 2: - p = "userland const struct vm_domain_policy_entry *"; - break; - default: - break; - }; - break; /* fdatasync */ case 550: switch(ndx) { @@ -8728,6 +8702,56 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; + /* cpuset_getdomain */ + case 561: + switch(ndx) { + case 0: + p = "cpulevel_t"; + break; + case 1: + p = "cpuwhich_t"; + break; + case 2: + p = "id_t"; + break; + case 3: + p = "size_t"; + break; + case 4: + p = "userland domainset_t *"; + break; + case 5: + p = "userland int *"; + break; + default: + break; + }; + break; + /* cpuset_setdomain */ + case 562: + switch(ndx) { + case 0: + p = "cpulevel_t"; + break; + case 1: + p = "cpuwhich_t"; + break; + case 2: + p = "id_t"; + break; + case 3: + p = "size_t"; + break; + case 4: + p = "userland domainset_t *"; + break; + case 5: + p = "int"; + break; + default: + break; + }; + break; default: break; }; @@ -10549,16 +10573,6 @@ systrace_return_setargdesc(int sysnum, int ndx, char * if (ndx == 0 || ndx == 1) p = "int"; break; - /* numa_getaffinity */ - case 548: - if (ndx == 0 || ndx == 1) - p = "int"; - break; - /* numa_setaffinity */ - case 549: - if (ndx == 0 || ndx == 1) - p = "int"; - break; /* fdatasync */ case 550: if (ndx == 0 || ndx == 1) @@ -10611,6 +10625,16 @@ systrace_return_setargdesc(int sysnum, int ndx, char * break; /* kevent */ case 560: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* cpuset_getdomain */ + case 561: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* cpuset_setdomain */ + case 562: if (ndx == 0 || ndx == 1) p = "int"; break; Modified: head/sys/sys/syscall.h ============================================================================== --- head/sys/sys/syscall.h Fri Jan 12 22:57:57 2018 (r327896) +++ head/sys/sys/syscall.h Fri Jan 12 23:06:35 2018 (r327897) @@ -465,8 +465,6 @@ #define SYS_ppoll 545 #define SYS_futimens 546 #define SYS_utimensat 547 -#define SYS_numa_getaffinity 548 -#define SYS_numa_setaffinity 549 #define SYS_fdatasync 550 #define SYS_fstat 551 #define SYS_fstatat 552 @@ -478,4 +476,6 @@ #define SYS_fhstatfs 558 #define SYS_mknodat 559 #define SYS_kevent 560 -#define SYS_MAXSYSCALL 561 +#define SYS_cpuset_getdomain 561 +#define SYS_cpuset_setdomain 562 +#define SYS_MAXSYSCALL 563 Modified: head/sys/sys/syscall.mk ============================================================================== --- head/sys/sys/syscall.mk Fri Jan 12 22:57:57 2018 (r327896) +++ head/sys/sys/syscall.mk Fri Jan 12 23:06:35 2018 (r327897) @@ -393,8 +393,6 @@ MIASM = \ ppoll.o \ futimens.o \ utimensat.o \ - numa_getaffinity.o \ - numa_setaffinity.o \ fdatasync.o \ fstat.o \ fstatat.o \ @@ -405,4 +403,6 @@ MIASM = \ getfsstat.o \ fhstatfs.o \ mknodat.o \ - kevent.o + kevent.o \ + cpuset_getdomain.o \ + cpuset_setdomain.o Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Fri Jan 12 22:57:57 2018 (r327896) +++ head/sys/sys/sysproto.h Fri Jan 12 23:06:35 2018 (r327897) @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -1697,16 +1698,6 @@ struct utimensat_args { char times_l_[PADL_(struct timespec *)]; struct timespec * times; char times_r_[PADR_(struct timespec *)]; char flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)]; }; -struct numa_getaffinity_args { - char which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)]; - char id_l_[PADL_(id_t)]; id_t id; char id_r_[PADR_(id_t)]; - char policy_l_[PADL_(struct vm_domain_policy_entry *)]; struct vm_domain_policy_entry * policy; char policy_r_[PADR_(struct vm_domain_policy_entry *)]; -}; -struct numa_setaffinity_args { - char which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)]; - char id_l_[PADL_(id_t)]; id_t id; char id_r_[PADR_(id_t)]; - char policy_l_[PADL_(const struct vm_domain_policy_entry *)]; const struct vm_domain_policy_entry * policy; char policy_r_[PADR_(const struct vm_domain_policy_entry *)]; -}; struct fdatasync_args { char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; }; @@ -1761,6 +1752,22 @@ struct kevent_args { char nevents_l_[PADL_(int)]; int nevents; char nevents_r_[PADR_(int)]; char timeout_l_[PADL_(const struct timespec *)]; const struct timespec * timeout; char timeout_r_[PADR_(const struct timespec *)]; }; +struct cpuset_getdomain_args { + char level_l_[PADL_(cpulevel_t)]; cpulevel_t level; char level_r_[PADR_(cpulevel_t)]; + char which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)]; + char id_l_[PADL_(id_t)]; id_t id; char id_r_[PADR_(id_t)]; + char domainsetsize_l_[PADL_(size_t)]; size_t domainsetsize; char domainsetsize_r_[PADR_(size_t)]; + char mask_l_[PADL_(domainset_t *)]; domainset_t * mask; char mask_r_[PADR_(domainset_t *)]; + char policy_l_[PADL_(int *)]; int * policy; char policy_r_[PADR_(int *)]; +}; +struct cpuset_setdomain_args { + char level_l_[PADL_(cpulevel_t)]; cpulevel_t level; char level_r_[PADR_(cpulevel_t)]; + char which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)]; + char id_l_[PADL_(id_t)]; id_t id; char id_r_[PADR_(id_t)]; + char domainsetsize_l_[PADL_(size_t)]; size_t domainsetsize; char domainsetsize_r_[PADR_(size_t)]; + char mask_l_[PADL_(domainset_t *)]; domainset_t * mask; char mask_r_[PADR_(domainset_t *)]; + char policy_l_[PADL_(int)]; int policy; char policy_r_[PADR_(int)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_sys_exit(struct thread *, struct sys_exit_args *); int sys_fork(struct thread *, struct fork_args *); @@ -2128,8 +2135,6 @@ int sys_procctl(struct thread *, struct procctl_args * int sys_ppoll(struct thread *, struct ppoll_args *); int sys_futimens(struct thread *, struct futimens_args *); int sys_utimensat(struct thread *, struct utimensat_args *); -int sys_numa_getaffinity(struct thread *, struct numa_getaffinity_args *); -int sys_numa_setaffinity(struct thread *, struct numa_setaffinity_args *); int sys_fdatasync(struct thread *, struct fdatasync_args *); int sys_fstat(struct thread *, struct fstat_args *); int sys_fstatat(struct thread *, struct fstatat_args *); @@ -2141,6 +2146,8 @@ int sys_getfsstat(struct thread *, struct getfsstat_ar int sys_fhstatfs(struct thread *, struct fhstatfs_args *); int sys_mknodat(struct thread *, struct mknodat_args *); int sys_kevent(struct thread *, struct kevent_args *); +int sys_cpuset_getdomain(struct thread *, struct cpuset_getdomain_args *); +int sys_cpuset_setdomain(struct thread *, struct cpuset_setdomain_args *); #ifdef COMPAT_43 @@ -3020,8 +3027,6 @@ int freebsd11_mknodat(struct thread *, struct freebsd1 #define SYS_AUE_ppoll AUE_POLL #define SYS_AUE_futimens AUE_FUTIMES #define SYS_AUE_utimensat AUE_FUTIMESAT -#define SYS_AUE_numa_getaffinity AUE_NULL -#define SYS_AUE_numa_setaffinity AUE_NULL #define SYS_AUE_fdatasync AUE_FSYNC #define SYS_AUE_fstat AUE_FSTAT #define SYS_AUE_fstatat AUE_FSTATAT @@ -3033,6 +3038,8 @@ int freebsd11_mknodat(struct thread *, struct freebsd1 #define SYS_AUE_fhstatfs AUE_FHSTATFS #define SYS_AUE_mknodat AUE_MKNODAT #define SYS_AUE_kevent AUE_KEVENT +#define SYS_AUE_cpuset_getdomain AUE_NULL +#define SYS_AUE_cpuset_setdomain AUE_NULL #undef PAD_ #undef PADL_ From owner-svn-src-head@freebsd.org Fri Jan 12 23:12:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13F57EA76B5; Fri, 12 Jan 2018 23:12:32 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E44B520D3; Fri, 12 Jan 2018 23:12:31 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49F7D24E2; Fri, 12 Jan 2018 23:12:31 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CNCV4S095200; Fri, 12 Jan 2018 23:12:31 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CNCVhA095198; Fri, 12 Jan 2018 23:12:31 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801122312.w0CNCVhA095198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 12 Jan 2018 23:12:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327898 - head/sys/netinet/libalias X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/sys/netinet/libalias X-SVN-Commit-Revision: 327898 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 23:12:32 -0000 Author: pfg Date: Fri Jan 12 23:12:30 2018 New Revision: 327898 URL: https://svnweb.freebsd.org/changeset/base/327898 Log: libalias: small memory allocation cleanups. Make the calloc wrappers behave as expected by using mallocarray. It is rather weird that the malloc wrappers also zeroes the memory: update a comment to reflect at least two cases where it is expected. Reviewed by: tuexen Modified: head/sys/netinet/libalias/alias_mod.h head/sys/netinet/libalias/alias_sctp.c Modified: head/sys/netinet/libalias/alias_mod.h ============================================================================== --- head/sys/netinet/libalias/alias_mod.h Fri Jan 12 23:06:35 2018 (r327897) +++ head/sys/netinet/libalias/alias_mod.h Fri Jan 12 23:12:30 2018 (r327898) @@ -42,7 +42,7 @@ MALLOC_DECLARE(M_ALIAS); /* Use kernel allocator. */ #if defined(_SYS_MALLOC_H_) #define malloc(x) malloc(x, M_ALIAS, M_NOWAIT|M_ZERO) -#define calloc(x, n) malloc(x*n) +#define calloc(n, x) mallocarray((n), (x), M_ALIAS, M_NOWAIT|M_ZERO) #define free(x) free(x, M_ALIAS) #endif #endif Modified: head/sys/netinet/libalias/alias_sctp.c ============================================================================== --- head/sys/netinet/libalias/alias_sctp.c Fri Jan 12 23:06:35 2018 (r327897) +++ head/sys/netinet/libalias/alias_sctp.c Fri Jan 12 23:12:30 2018 (r327898) @@ -187,7 +187,7 @@ static MALLOC_DEFINE(M_SCTPNAT, "sctpnat", "sctp nat d /* Use kernel allocator. */ #ifdef _SYS_MALLOC_H_ #define sn_malloc(x) malloc(x, M_SCTPNAT, M_NOWAIT|M_ZERO) -#define sn_calloc(n,x) sn_malloc((x) * (n)) +#define sn_calloc(n,x) mallocarray((n), (x), M_SCTPNAT, M_NOWAIT|M_ZERO) #define sn_free(x) free(x, M_SCTPNAT) #endif// #ifdef _SYS_MALLOC_H_ @@ -1104,7 +1104,7 @@ sctp_PktParser(struct libalias *la, int direction, str if (*passoc == NULL) {/* out of resources */ return (SN_PARSE_ERROR_AS_MALLOC); } - /* Initialise association - malloc initialises memory to zeros */ + /* Initialize association - sn_malloc initializes memory to zeros */ (*passoc)->state = SN_ID; LIST_INIT(&((*passoc)->Gaddr)); /* always initialise to avoid memory problems */ (*passoc)->TableRegister = SN_NULL_TBL; @@ -1168,7 +1168,7 @@ sctp_PktParser(struct libalias *la, int direction, str if (*passoc == NULL) {/* out of resources */ return (SN_PARSE_ERROR_AS_MALLOC); } - /* Initialise association - malloc initialises memory to zeros */ + /* Initialize association - sn_malloc initializes memory to zeros */ (*passoc)->state = SN_ID; LIST_INIT(&((*passoc)->Gaddr)); /* always initialise to avoid memory problems */ (*passoc)->TableRegister = SN_NULL_TBL; From owner-svn-src-head@freebsd.org Fri Jan 12 23:13:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0682EA7810; Fri, 12 Jan 2018 23:13:56 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A2EF92261; Fri, 12 Jan 2018 23:13:56 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BAB5224E6; Fri, 12 Jan 2018 23:13:55 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CNDtRQ095293; Fri, 12 Jan 2018 23:13:55 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CNDtNS095287; Fri, 12 Jan 2018 23:13:55 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201801122313.w0CNDtNS095287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Fri, 12 Jan 2018 23:13:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327899 - in head/sys: kern vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: kern vm X-SVN-Commit-Revision: 327899 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 23:13:57 -0000 Author: jeff Date: Fri Jan 12 23:13:55 2018 New Revision: 327899 URL: https://svnweb.freebsd.org/changeset/base/327899 Log: Implement NUMA policy for kmem_*(9). This maintains compatibility with reservations by giving each memory domain its own KVA space in vmem that is naturally aligned on superpage boundaries. Reviewed by: alc, markj, kib (some objections) Sponsored by: Netflix, Dell/EMC Isilon Tested by; pho Differential Revision: https://reviews.freebsd.org/D13289 Modified: head/sys/kern/subr_vmem.c head/sys/vm/vm_extern.h head/sys/vm/vm_init.c head/sys/vm/vm_kern.c head/sys/vm/vm_phys.h head/sys/vm/vm_reserv.c Modified: head/sys/kern/subr_vmem.c ============================================================================== --- head/sys/kern/subr_vmem.c Fri Jan 12 23:12:30 2018 (r327898) +++ head/sys/kern/subr_vmem.c Fri Jan 12 23:13:55 2018 (r327899) @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #define VMEM_OPTORDER 5 @@ -186,6 +187,7 @@ static struct task vmem_periodic_wk; static struct mtx_padalign __exclusive_cache_line vmem_list_lock; static LIST_HEAD(, vmem) vmem_list = LIST_HEAD_INITIALIZER(vmem_list); +static uma_zone_t vmem_zone; /* ---- misc */ #define VMEM_CONDVAR_INIT(vm, wchan) cv_init(&vm->vm_cv, wchan) @@ -255,11 +257,11 @@ bt_fill(vmem_t *vm, int flags) VMEM_ASSERT_LOCKED(vm); /* - * Only allow the kernel arena to dip into reserve tags. It is the - * vmem where new tags come from. + * Only allow the kernel arena and arenas derived from kernel arena to + * dip into reserve tags. They are where new tags come from. */ flags &= BT_FLAGS; - if (vm != kernel_arena) + if (vm != kernel_arena && vm->vm_arg != kernel_arena) flags &= ~M_USE_RESERVE; /* @@ -615,23 +617,25 @@ static void * vmem_bt_alloc(uma_zone_t zone, vm_size_t bytes, uint8_t *pflag, int wait) { vmem_addr_t addr; + int domain; *pflag = UMA_SLAB_KERNEL; + domain = 0; /* XXX Temporary. */ /* * Single thread boundary tag allocation so that the address space * and memory are added in one atomic operation. */ mtx_lock(&vmem_bt_lock); - if (vmem_xalloc(kernel_arena, bytes, 0, 0, 0, VMEM_ADDR_MIN, - VMEM_ADDR_MAX, M_NOWAIT | M_NOVM | M_USE_RESERVE | M_BESTFIT, - &addr) == 0) { - if (kmem_back(kernel_object, addr, bytes, + if (vmem_xalloc(vm_dom[domain].vmd_kernel_arena, bytes, 0, 0, 0, + VMEM_ADDR_MIN, VMEM_ADDR_MAX, + M_NOWAIT | M_NOVM | M_USE_RESERVE | M_BESTFIT, &addr) == 0) { + if (kmem_back_domain(domain, kernel_object, addr, bytes, M_NOWAIT | M_USE_RESERVE) == 0) { mtx_unlock(&vmem_bt_lock); return ((void *)addr); } - vmem_xfree(kernel_arena, addr, bytes); + vmem_xfree(vm_dom[domain].vmd_kernel_arena, addr, bytes); mtx_unlock(&vmem_bt_lock); /* * Out of memory, not address space. This may not even be @@ -657,9 +661,12 @@ vmem_startup(void) { mtx_init(&vmem_list_lock, "vmem list lock", NULL, MTX_DEF); + vmem_zone = uma_zcreate("vmem", + sizeof(struct vmem), NULL, NULL, NULL, NULL, + UMA_ALIGN_PTR, UMA_ZONE_VM); vmem_bt_zone = uma_zcreate("vmem btag", sizeof(struct vmem_btag), NULL, NULL, NULL, NULL, - UMA_ALIGN_PTR, UMA_ZONE_VM); + UMA_ALIGN_PTR, UMA_ZONE_VM | UMA_ZONE_NOFREE); #ifndef UMA_MD_SMALL_ALLOC mtx_init(&vmem_bt_lock, "btag lock", NULL, MTX_DEF); uma_prealloc(vmem_bt_zone, BT_MAXALLOC); @@ -826,7 +833,7 @@ vmem_destroy1(vmem_t *vm) VMEM_CONDVAR_DESTROY(vm); VMEM_LOCK_DESTROY(vm); - free(vm, M_VMEM); + uma_zfree(vmem_zone, vm); } static int @@ -1058,7 +1065,7 @@ vmem_create(const char *name, vmem_addr_t base, vmem_s vmem_t *vm; - vm = malloc(sizeof(*vm), M_VMEM, flags & (M_WAITOK|M_NOWAIT)); + vm = uma_zalloc(vmem_zone, flags & (M_WAITOK|M_NOWAIT)); if (vm == NULL) return (NULL); if (vmem_init(vm, name, base, size, quantum, qcache_max, Modified: head/sys/vm/vm_extern.h ============================================================================== --- head/sys/vm/vm_extern.h Fri Jan 12 23:12:30 2018 (r327898) +++ head/sys/vm/vm_extern.h Fri Jan 12 23:13:55 2018 (r327899) @@ -56,14 +56,21 @@ void kmap_free_wakeup(vm_map_t, vm_offset_t, vm_size_t /* These operate on virtual addresses backed by memory. */ vm_offset_t kmem_alloc_attr(struct vmem *, vm_size_t size, int flags, vm_paddr_t low, vm_paddr_t high, vm_memattr_t memattr); +vm_offset_t kmem_alloc_attr_domain(int domain, vm_size_t size, int flags, + vm_paddr_t low, vm_paddr_t high, vm_memattr_t memattr); vm_offset_t kmem_alloc_contig(struct vmem *, vm_size_t size, int flags, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, vm_memattr_t memattr); +vm_offset_t kmem_alloc_contig_domain(int domain, vm_size_t size, int flags, + vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, + vm_memattr_t memattr); vm_offset_t kmem_malloc(struct vmem *, vm_size_t size, int flags); +vm_offset_t kmem_malloc_domain(int domain, vm_size_t size, int flags); void kmem_free(struct vmem *, vm_offset_t, vm_size_t); /* This provides memory for previously allocated address space. */ int kmem_back(vm_object_t, vm_offset_t, vm_size_t, int); +int kmem_back_domain(int, vm_object_t, vm_offset_t, vm_size_t, int); void kmem_unback(vm_object_t, vm_offset_t, vm_size_t); /* Bootstrapping. */ Modified: head/sys/vm/vm_init.c ============================================================================== --- head/sys/vm/vm_init.c Fri Jan 12 23:12:30 2018 (r327898) +++ head/sys/vm/vm_init.c Fri Jan 12 23:13:55 2018 (r327899) @@ -81,16 +81,25 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include #include +#include #include #include #include + +#if VM_NRESERVLEVEL > 0 +#define KVA_QUANTUM (1 << (VM_LEVEL_0_ORDER + PAGE_SHIFT)) +#else + /* On non-superpage architectures want large import sizes. */ +#define KVA_QUANTUM (PAGE_SIZE * 1024) +#endif long physmem; /* @@ -107,7 +116,10 @@ kva_import(void *unused, vmem_size_t size, int flags, { vm_offset_t addr; int result; - + + KASSERT((size % KVA_QUANTUM) == 0, + ("kva_import: Size %jd is not a multiple of %d", + (intmax_t)size, (int)KVA_QUANTUM)); addr = vm_map_min(kernel_map); result = vm_map_find(kernel_map, NULL, 0, &addr, size, 0, VMFS_SUPER_SPACE, VM_PROT_ALL, VM_PROT_ALL, MAP_NOFAULT); @@ -130,6 +142,7 @@ static void vm_mem_init(dummy) void *dummy; { + int domain; /* * Initializes resident memory structures. From here on, all physical @@ -150,13 +163,15 @@ vm_mem_init(dummy) * Initialize the kernel_arena. This can grow on demand. */ vmem_init(kernel_arena, "kernel arena", 0, 0, PAGE_SIZE, 0, 0); - vmem_set_import(kernel_arena, kva_import, NULL, NULL, -#if VM_NRESERVLEVEL > 0 - 1 << (VM_LEVEL_0_ORDER + PAGE_SHIFT)); -#else - /* On non-superpage architectures want large import sizes. */ - PAGE_SIZE * 1024); -#endif + vmem_set_import(kernel_arena, kva_import, NULL, NULL, KVA_QUANTUM); + + for (domain = 0; domain < vm_ndomains; domain++) { + vm_dom[domain].vmd_kernel_arena = vmem_create( + "kernel arena domain", 0, 0, PAGE_SIZE, 0, M_WAITOK); + vmem_set_import(vm_dom[domain].vmd_kernel_arena, + (vmem_import_t *)vmem_alloc, NULL, kernel_arena, + KVA_QUANTUM); + } kmem_init_zero_region(); pmap_init(); Modified: head/sys/vm/vm_kern.c ============================================================================== --- head/sys/vm/vm_kern.c Fri Jan 12 23:12:30 2018 (r327898) +++ head/sys/vm/vm_kern.c Fri Jan 12 23:13:55 2018 (r327899) @@ -67,9 +67,12 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_vm.h" + #include #include #include /* for ticks and hz */ +#include #include #include #include @@ -77,15 +80,18 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #include #include #include #include +#include #include #include #include @@ -161,17 +167,17 @@ kva_free(vm_offset_t addr, vm_size_t size) * given flags, then the pages are zeroed before they are mapped. */ vm_offset_t -kmem_alloc_attr(vmem_t *vmem, vm_size_t size, int flags, vm_paddr_t low, +kmem_alloc_attr_domain(int domain, vm_size_t size, int flags, vm_paddr_t low, vm_paddr_t high, vm_memattr_t memattr) { + vmem_t *vmem; vm_object_t object = kernel_object; vm_offset_t addr, i, offset; vm_page_t m; int pflags, tries; - KASSERT(vmem == kernel_arena, - ("kmem_alloc_attr: Only kernel_arena is supported.")); size = round_page(size); + vmem = vm_dom[domain].vmd_kernel_arena; if (vmem_alloc(vmem, size, M_BESTFIT | flags, &addr)) return (0); offset = addr - VM_MIN_KERNEL_ADDRESS; @@ -182,13 +188,13 @@ kmem_alloc_attr(vmem_t *vmem, vm_size_t size, int flag for (i = 0; i < size; i += PAGE_SIZE) { tries = 0; retry: - m = vm_page_alloc_contig(object, atop(offset + i), - pflags, 1, low, high, PAGE_SIZE, 0, memattr); + m = vm_page_alloc_contig_domain(object, atop(offset + i), + domain, pflags, 1, low, high, PAGE_SIZE, 0, memattr); if (m == NULL) { VM_OBJECT_WUNLOCK(object); if (tries < ((flags & M_NOWAIT) != 0 ? 1 : 3)) { - if (!vm_page_reclaim_contig(pflags, 1, - low, high, PAGE_SIZE, 0) && + if (!vm_page_reclaim_contig_domain(domain, + pflags, 1, low, high, PAGE_SIZE, 0) && (flags & M_WAITOK) != 0) VM_WAIT; VM_OBJECT_WLOCK(object); @@ -199,6 +205,9 @@ retry: vmem_free(vmem, addr, size); return (0); } + KASSERT(vm_phys_domidx(m) == domain, + ("kmem_alloc_attr_domain: Domain mismatch %d != %d", + vm_phys_domidx(m), domain)); if ((flags & M_ZERO) && (m->flags & PG_ZERO) == 0) pmap_zero_page(m); m->valid = VM_PAGE_BITS_ALL; @@ -209,6 +218,28 @@ retry: return (addr); } +vm_offset_t +kmem_alloc_attr(vmem_t *vmem, vm_size_t size, int flags, vm_paddr_t low, + vm_paddr_t high, vm_memattr_t memattr) +{ + struct vm_domainset_iter di; + vm_offset_t addr; + int domain; + + KASSERT(vmem == kernel_arena, + ("kmem_alloc_attr: Only kernel_arena is supported.")); + + vm_domainset_iter_malloc_init(&di, kernel_object, &domain, &flags); + do { + addr = kmem_alloc_attr_domain(domain, size, flags, low, high, + memattr); + if (addr != 0) + break; + } while (vm_domainset_iter_malloc(&di, &domain, &flags) == 0); + + return (addr); +} + /* * Allocates a region from the kernel address map and physically * contiguous pages within the specified address range to the kernel @@ -218,19 +249,19 @@ retry: * mapped. */ vm_offset_t -kmem_alloc_contig(struct vmem *vmem, vm_size_t size, int flags, vm_paddr_t low, +kmem_alloc_contig_domain(int domain, vm_size_t size, int flags, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, vm_memattr_t memattr) { + vmem_t *vmem; vm_object_t object = kernel_object; vm_offset_t addr, offset, tmp; vm_page_t end_m, m; u_long npages; int pflags, tries; - KASSERT(vmem == kernel_arena, - ("kmem_alloc_contig: Only kernel_arena is supported.")); size = round_page(size); + vmem = vm_dom[domain].vmd_kernel_arena; if (vmem_alloc(vmem, size, flags | M_BESTFIT, &addr)) return (0); offset = addr - VM_MIN_KERNEL_ADDRESS; @@ -241,13 +272,14 @@ kmem_alloc_contig(struct vmem *vmem, vm_size_t size, i VM_OBJECT_WLOCK(object); tries = 0; retry: - m = vm_page_alloc_contig(object, atop(offset), pflags, + m = vm_page_alloc_contig_domain(object, atop(offset), domain, pflags, npages, low, high, alignment, boundary, memattr); if (m == NULL) { VM_OBJECT_WUNLOCK(object); if (tries < ((flags & M_NOWAIT) != 0 ? 1 : 3)) { - if (!vm_page_reclaim_contig(pflags, npages, low, high, - alignment, boundary) && (flags & M_WAITOK) != 0) + if (!vm_page_reclaim_contig_domain(domain, pflags, + npages, low, high, alignment, boundary) && + (flags & M_WAITOK) != 0) VM_WAIT; VM_OBJECT_WLOCK(object); tries++; @@ -256,6 +288,9 @@ retry: vmem_free(vmem, addr, size); return (0); } + KASSERT(vm_phys_domidx(m) == domain, + ("kmem_alloc_contig_domain: Domain mismatch %d != %d", + vm_phys_domidx(m), domain)); end_m = m + npages; tmp = addr; for (; m < end_m; m++) { @@ -270,6 +305,29 @@ retry: return (addr); } +vm_offset_t +kmem_alloc_contig(struct vmem *vmem, vm_size_t size, int flags, vm_paddr_t low, + vm_paddr_t high, u_long alignment, vm_paddr_t boundary, + vm_memattr_t memattr) +{ + struct vm_domainset_iter di; + vm_offset_t addr; + int domain; + + KASSERT(vmem == kernel_arena, + ("kmem_alloc_contig: Only kernel_arena is supported.")); + + vm_domainset_iter_malloc_init(&di, kernel_object, &domain, &flags); + do { + addr = kmem_alloc_contig_domain(domain, size, flags, low, high, + alignment, boundary, memattr); + if (addr != 0) + break; + } while (vm_domainset_iter_malloc(&di, &domain, &flags) == 0); + + return (addr); +} + /* * kmem_suballoc: * @@ -313,18 +371,18 @@ kmem_suballoc(vm_map_t parent, vm_offset_t *min, vm_of * Allocate wired-down pages in the kernel's address space. */ vm_offset_t -kmem_malloc(struct vmem *vmem, vm_size_t size, int flags) +kmem_malloc_domain(int domain, vm_size_t size, int flags) { + vmem_t *vmem; vm_offset_t addr; int rv; - KASSERT(vmem == kernel_arena, - ("kmem_malloc: Only kernel_arena is supported.")); + vmem = vm_dom[domain].vmd_kernel_arena; size = round_page(size); if (vmem_alloc(vmem, size, flags | M_BESTFIT, &addr)) return (0); - rv = kmem_back(kernel_object, addr, size, flags); + rv = kmem_back_domain(domain, kernel_object, addr, size, flags); if (rv != KERN_SUCCESS) { vmem_free(vmem, addr, size); return (0); @@ -332,20 +390,41 @@ kmem_malloc(struct vmem *vmem, vm_size_t size, int fla return (addr); } +vm_offset_t +kmem_malloc(struct vmem *vmem, vm_size_t size, int flags) +{ + struct vm_domainset_iter di; + vm_offset_t addr; + int domain; + + KASSERT(vmem == kernel_arena, + ("kmem_malloc: Only kernel_arena is supported.")); + + vm_domainset_iter_malloc_init(&di, kernel_object, &domain, &flags); + do { + addr = kmem_malloc_domain(domain, size, flags); + if (addr != 0) + break; + } while (vm_domainset_iter_malloc(&di, &domain, &flags) == 0); + + return (addr); +} + /* * kmem_back: * * Allocate physical pages for the specified virtual address range. */ int -kmem_back(vm_object_t object, vm_offset_t addr, vm_size_t size, int flags) +kmem_back_domain(int domain, vm_object_t object, vm_offset_t addr, + vm_size_t size, int flags) { vm_offset_t offset, i; vm_page_t m, mpred; int pflags; KASSERT(object == kernel_object, - ("kmem_back: only supports kernel object.")); + ("kmem_back_domain: only supports kernel object.")); offset = addr - VM_MIN_KERNEL_ADDRESS; pflags = malloc2vm_flags(flags) | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED; @@ -358,8 +437,8 @@ kmem_back(vm_object_t object, vm_offset_t addr, vm_siz retry: mpred = vm_radix_lookup_le(&object->rtree, atop(offset + i)); for (; i < size; i += PAGE_SIZE, mpred = m) { - m = vm_page_alloc_after(object, atop(offset + i), pflags, - mpred); + m = vm_page_alloc_domain_after(object, atop(offset + i), + domain, pflags, mpred); /* * Ran out of space, free everything up and return. Don't need @@ -373,6 +452,9 @@ retry: kmem_unback(object, addr, i); return (KERN_NO_SPACE); } + KASSERT(vm_phys_domidx(m) == domain, + ("kmem_back_domain: Domain mismatch %d != %d", + vm_phys_domidx(m), domain)); if (flags & M_ZERO && (m->flags & PG_ZERO) == 0) pmap_zero_page(m); KASSERT((m->oflags & VPO_UNMANAGED) != 0, @@ -386,6 +468,26 @@ retry: return (KERN_SUCCESS); } +int +kmem_back(vm_object_t object, vm_offset_t addr, vm_size_t size, int flags) +{ + struct vm_domainset_iter di; + int domain; + int ret; + + KASSERT(object == kernel_object, + ("kmem_back: only supports kernel object.")); + + vm_domainset_iter_malloc_init(&di, kernel_object, &domain, &flags); + do { + ret = kmem_back_domain(domain, object, addr, size, flags); + if (ret == KERN_SUCCESS) + break; + } while (vm_domainset_iter_malloc(&di, &domain, &flags) == 0); + + return (ret); +} + /* * kmem_unback: * @@ -395,28 +497,41 @@ retry: * A physical page must exist within the specified object at each index * that is being unmapped. */ -void -kmem_unback(vm_object_t object, vm_offset_t addr, vm_size_t size) +static int +_kmem_unback(vm_object_t object, vm_offset_t addr, vm_size_t size) { vm_page_t m, next; vm_offset_t end, offset; + int domain; KASSERT(object == kernel_object, ("kmem_unback: only supports kernel object.")); + if (size == 0) + return (0); pmap_remove(kernel_pmap, addr, addr + size); offset = addr - VM_MIN_KERNEL_ADDRESS; end = offset + size; VM_OBJECT_WLOCK(object); - for (m = vm_page_lookup(object, atop(offset)); offset < end; - offset += PAGE_SIZE, m = next) { + m = vm_page_lookup(object, atop(offset)); + domain = vm_phys_domidx(m); + for (; offset < end; offset += PAGE_SIZE, m = next) { next = vm_page_next(m); vm_page_unwire(m, PQ_NONE); vm_page_free(m); } VM_OBJECT_WUNLOCK(object); + + return (domain); } +void +kmem_unback(vm_object_t object, vm_offset_t addr, vm_size_t size) +{ + + _kmem_unback(object, addr, size); +} + /* * kmem_free: * @@ -426,12 +541,13 @@ kmem_unback(vm_object_t object, vm_offset_t addr, vm_s void kmem_free(struct vmem *vmem, vm_offset_t addr, vm_size_t size) { + int domain; KASSERT(vmem == kernel_arena, ("kmem_free: Only kernel_arena is supported.")); size = round_page(size); - kmem_unback(kernel_object, addr, size); - vmem_free(vmem, addr, size); + domain = _kmem_unback(kernel_object, addr, size); + vmem_free(vm_dom[domain].vmd_kernel_arena, addr, size); } /* Modified: head/sys/vm/vm_phys.h ============================================================================== --- head/sys/vm/vm_phys.h Fri Jan 12 23:12:30 2018 (r327898) +++ head/sys/vm/vm_phys.h Fri Jan 12 23:13:55 2018 (r327899) @@ -101,7 +101,6 @@ int vm_phys_mem_affinity(int f, int t); static inline int vm_phys_domidx(vm_page_t m) { -#ifdef VM_NUMA_ALLOC int domn, segind; /* XXXKIB try to assert that the page is managed */ @@ -110,9 +109,6 @@ vm_phys_domidx(vm_page_t m) domn = vm_phys_segs[segind].domain; KASSERT(domn < vm_ndomains, ("domain %d m %p", domn, m)); return (domn); -#else - return (0); -#endif } /* Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Fri Jan 12 23:12:30 2018 (r327898) +++ head/sys/vm/vm_reserv.c Fri Jan 12 23:13:55 2018 (r327899) @@ -549,6 +549,8 @@ vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t VM_LEVEL_0_SIZE), boundary > VM_LEVEL_0_SIZE ? boundary : 0); if (m == NULL) return (NULL); + KASSERT(vm_phys_domidx(m) == domain, + ("vm_reserv_alloc_contig: Page domain does not match requested.")); /* * The allocated physical pages always begin at a reservation @@ -568,7 +570,7 @@ vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t LIST_INSERT_HEAD(&object->rvq, rv, objq); rv->object = object; rv->pindex = first; - rv->domain = vm_phys_domidx(m); + rv->domain = domain; KASSERT(rv->popcnt == 0, ("vm_reserv_alloc_contig: reserv %p's popcnt is corrupted", rv)); @@ -715,7 +717,7 @@ vm_reserv_alloc_page(vm_object_t object, vm_pindex_t p LIST_INSERT_HEAD(&object->rvq, rv, objq); rv->object = object; rv->pindex = first; - rv->domain = vm_phys_domidx(m); + rv->domain = domain; KASSERT(rv->popcnt == 0, ("vm_reserv_alloc_page: reserv %p's popcnt is corrupted", rv)); KASSERT(!rv->inpartpopq, @@ -734,6 +736,8 @@ vm_reserv_alloc_page(vm_object_t object, vm_pindex_t p found: index = VM_RESERV_INDEX(object, pindex); m = &rv->pages[index]; + KASSERT(object != kernel_object || vm_phys_domidx(m) == domain, + ("vm_reserv_alloc_page: Domain mismatch from reservation.")); /* Handle vm_page_rename(m, new_object, ...). */ if (popmap_is_set(rv->popmap, index)) return (NULL); From owner-svn-src-head@freebsd.org Fri Jan 12 23:25:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 947E6EB211C; Fri, 12 Jan 2018 23:25:08 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5C49429A2; Fri, 12 Jan 2018 23:25:08 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 991802691; Fri, 12 Jan 2018 23:25:07 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CNP7Zx099580; Fri, 12 Jan 2018 23:25:07 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CNP5QY099559; Fri, 12 Jan 2018 23:25:05 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201801122325.w0CNP5QY099559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Fri, 12 Jan 2018 23:25:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327900 - in head: lib/libmemstat sys/amd64/amd64 sys/arm64/arm64 sys/i386/i386 sys/kern sys/mips/mips sys/powerpc/aim sys/powerpc/powerpc sys/riscv/riscv sys/sparc64/sparc64 sys/sys sy... X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head: lib/libmemstat sys/amd64/amd64 sys/arm64/arm64 sys/i386/i386 sys/kern sys/mips/mips sys/powerpc/aim sys/powerpc/powerpc sys/riscv/riscv sys/sparc64/sparc64 sys/sys sys/vm X-SVN-Commit-Revision: 327900 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 23:25:08 -0000 Author: jeff Date: Fri Jan 12 23:25:05 2018 New Revision: 327900 URL: https://svnweb.freebsd.org/changeset/base/327900 Log: Implement NUMA support in uma(9) and malloc(9). Allocations from specific domains can be done by the _domain() API variants. UMA also supports a first-touch policy via the NUMA zone flag. The slab layer is now segregated by VM domains and is precise. It handles iteration for round-robin directly. The per-cpu cache layer remains a mix of domains according to where memory is allocated and freed. Well behaved clients can achieve perfect locality with no performance penalty. The direct domain allocation functions have to visit the slab layer and so require per-zone locks which come at some expense. Reviewed by: Attilio (a slightly older version) Tested by: pho Sponsored by: Netflix, Dell/EMC Isilon Modified: head/lib/libmemstat/memstat_uma.c head/sys/amd64/amd64/uma_machdep.c head/sys/arm64/arm64/uma_machdep.c head/sys/i386/i386/pmap.c head/sys/kern/kern_malloc.c head/sys/kern/kern_mbuf.c head/sys/kern/subr_busdma_bufalloc.c head/sys/kern/subr_vmem.c head/sys/kern/vfs_bio.c head/sys/mips/mips/uma_machdep.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/aim/slb.c head/sys/powerpc/powerpc/uma_machdep.c head/sys/riscv/riscv/uma_machdep.c head/sys/sparc64/sparc64/vm_machdep.c head/sys/sys/malloc.h head/sys/vm/uma.h head/sys/vm/uma_core.c head/sys/vm/uma_int.h Modified: head/lib/libmemstat/memstat_uma.c ============================================================================== --- head/lib/libmemstat/memstat_uma.c Fri Jan 12 23:13:55 2018 (r327899) +++ head/lib/libmemstat/memstat_uma.c Fri Jan 12 23:25:05 2018 (r327900) @@ -55,6 +55,8 @@ static struct nlist namelist[] = { { .n_name = "_mp_maxid" }, #define X_ALL_CPUS 2 { .n_name = "_all_cpus" }, +#define X_VM_NDOMAINS 3 + { .n_name = "_vm_ndomains" }, { .n_name = "" }, }; @@ -297,11 +299,12 @@ memstat_kvm_uma(struct memory_type_list *list, void *k { LIST_HEAD(, uma_keg) uma_kegs; struct memory_type *mtp; + struct uma_zone_domain uzd; struct uma_bucket *ubp, ub; struct uma_cache *ucp, *ucp_array; struct uma_zone *uzp, uz; struct uma_keg *kzp, kz; - int hint_dontsearch, i, mp_maxid, ret; + int hint_dontsearch, i, mp_maxid, ndomains, ret; char name[MEMTYPE_MAXNAME]; cpuset_t all_cpus; long cpusetsize; @@ -323,6 +326,12 @@ memstat_kvm_uma(struct memory_type_list *list, void *k list->mtl_error = ret; return (-1); } + ret = kread_symbol(kvm, X_VM_NDOMAINS, &ndomains, + sizeof(ndomains), 0); + if (ret != 0) { + list->mtl_error = ret; + return (-1); + } ret = kread_symbol(kvm, X_UMA_KEGS, &uma_kegs, sizeof(uma_kegs), 0); if (ret != 0) { list->mtl_error = ret; @@ -447,10 +456,17 @@ skip_percpu: kz.uk_ipers; mtp->mt_byteslimit = mtp->mt_countlimit * mtp->mt_size; mtp->mt_count = mtp->mt_numallocs - mtp->mt_numfrees; - for (ubp = LIST_FIRST(&uz.uz_buckets); ubp != - NULL; ubp = LIST_NEXT(&ub, ub_link)) { - ret = kread(kvm, ubp, &ub, sizeof(ub), 0); - mtp->mt_zonefree += ub.ub_cnt; + for (i = 0; i < ndomains; i++) { + ret = kread(kvm, &uz.uz_domain[i], &uzd, + sizeof(uzd), 0); + for (ubp = + LIST_FIRST(&uzd.uzd_buckets); + ubp != NULL; + ubp = LIST_NEXT(&ub, ub_link)) { + ret = kread(kvm, ubp, &ub, + sizeof(ub), 0); + mtp->mt_zonefree += ub.ub_cnt; + } } if (!((kz.uk_flags & UMA_ZONE_SECONDARY) && LIST_FIRST(&kz.uk_zones) != uzp)) { Modified: head/sys/amd64/amd64/uma_machdep.c ============================================================================== --- head/sys/amd64/amd64/uma_machdep.c Fri Jan 12 23:13:55 2018 (r327899) +++ head/sys/amd64/amd64/uma_machdep.c Fri Jan 12 23:25:05 2018 (r327900) @@ -44,14 +44,15 @@ __FBSDID("$FreeBSD$"); #include void * -uma_small_alloc(uma_zone_t zone, vm_size_t bytes, u_int8_t *flags, int wait) +uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags, + int wait) { vm_page_t m; vm_paddr_t pa; void *va; *flags = UMA_SLAB_PRIV; - m = vm_page_alloc(NULL, 0, + m = vm_page_alloc_domain(NULL, 0, domain, malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); if (m == NULL) return (NULL); Modified: head/sys/arm64/arm64/uma_machdep.c ============================================================================== --- head/sys/arm64/arm64/uma_machdep.c Fri Jan 12 23:13:55 2018 (r327899) +++ head/sys/arm64/arm64/uma_machdep.c Fri Jan 12 23:25:05 2018 (r327900) @@ -42,14 +42,15 @@ __FBSDID("$FreeBSD$"); #include void * -uma_small_alloc(uma_zone_t zone, vm_size_t bytes, u_int8_t *flags, int wait) +uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags, + int wait) { vm_page_t m; vm_paddr_t pa; void *va; *flags = UMA_SLAB_PRIV; - m = vm_page_alloc(NULL, 0, + m = vm_page_alloc_domain(NULL, 0, domain, malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); if (m == NULL) return (NULL); Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Fri Jan 12 23:13:55 2018 (r327899) +++ head/sys/i386/i386/pmap.c Fri Jan 12 23:25:05 2018 (r327900) @@ -338,8 +338,8 @@ static pt_entry_t *pmap_pte_quick(pmap_t pmap, vm_offs static void pmap_pte_release(pt_entry_t *pte); static int pmap_unuse_pt(pmap_t, vm_offset_t, struct spglist *); #if defined(PAE) || defined(PAE_TABLES) -static void *pmap_pdpt_allocf(uma_zone_t zone, vm_size_t bytes, uint8_t *flags, - int wait); +static void *pmap_pdpt_allocf(uma_zone_t zone, vm_size_t bytes, int domain, + uint8_t *flags, int wait); #endif static void pmap_set_pg(void); @@ -697,12 +697,13 @@ pmap_page_init(vm_page_t m) #if defined(PAE) || defined(PAE_TABLES) static void * -pmap_pdpt_allocf(uma_zone_t zone, vm_size_t bytes, uint8_t *flags, int wait) +pmap_pdpt_allocf(uma_zone_t zone, vm_size_t bytes, int domain, uint8_t *flags, + int wait) { /* Inform UMA that this allocator uses kernel_map/object. */ *flags = UMA_SLAB_KERNEL; - return ((void *)kmem_alloc_contig(kernel_arena, bytes, wait, 0x0ULL, + return ((void *)kmem_alloc_contig_domain(domain, bytes, wait, 0x0ULL, 0xffffffffULL, 1, 0, VM_MEMATTR_DEFAULT)); } #endif Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Fri Jan 12 23:13:55 2018 (r327899) +++ head/sys/kern/kern_malloc.c Fri Jan 12 23:25:05 2018 (r327900) @@ -96,6 +96,11 @@ __FBSDID("$FreeBSD$"); dtrace_malloc_probe_func_t dtrace_malloc_probe; #endif +#if defined(INVARIANTS) || defined(MALLOC_MAKE_FAILURES) || \ + defined(DEBUG_MEMGUARD) || defined(DEBUG_REDZONE) +#define MALLOC_DEBUG 1 +#endif + /* * When realloc() is called, if the new size is sufficiently smaller than * the old size, realloc() will allocate a new, smaller block to avoid @@ -417,6 +422,20 @@ contigmalloc(unsigned long size, struct malloc_type *t return (ret); } +void * +contigmalloc_domain(unsigned long size, struct malloc_type *type, + int domain, int flags, vm_paddr_t low, vm_paddr_t high, + unsigned long alignment, vm_paddr_t boundary) +{ + void *ret; + + ret = (void *)kmem_alloc_contig_domain(domain, size, flags, low, high, + alignment, boundary, VM_MEMATTR_DEFAULT); + if (ret != NULL) + malloc_type_allocated(type, round_page(size)); + return (ret); +} + /* * contigfree: * @@ -432,26 +451,14 @@ contigfree(void *addr, unsigned long size, struct mall malloc_type_freed(type, round_page(size)); } -/* - * malloc: - * - * Allocate a block of memory. - * - * If M_NOWAIT is set, this routine will not block and return NULL if - * the allocation fails. - */ -void * -malloc(unsigned long size, struct malloc_type *mtp, int flags) +#ifdef MALLOC_DEBUG +static int +malloc_dbg(caddr_t *vap, unsigned long *sizep, struct malloc_type *mtp, + int flags) { +#ifdef INVARIANTS int indx; - struct malloc_type_internal *mtip; - caddr_t va; - uma_zone_t zone; -#if defined(DIAGNOSTIC) || defined(DEBUG_REDZONE) - unsigned long osize = size; -#endif -#ifdef INVARIANTS KASSERT(mtp->ks_magic == M_MAGIC, ("malloc: bad malloc type magic")); /* * Check that exactly one of M_WAITOK or M_NOWAIT is specified. @@ -474,7 +481,8 @@ malloc(unsigned long size, struct malloc_type *mtp, in if ((malloc_nowait_count % malloc_failure_rate) == 0) { atomic_add_int(&malloc_failure_count, 1); t_malloc_fail = time_uptime; - return (NULL); + *vap = NULL; + return (EJUSTRETURN); } } #endif @@ -485,18 +493,46 @@ malloc(unsigned long size, struct malloc_type *mtp, in ("malloc: called with spinlock or critical section held")); #ifdef DEBUG_MEMGUARD - if (memguard_cmp_mtp(mtp, size)) { - va = memguard_alloc(size, flags); - if (va != NULL) - return (va); + if (memguard_cmp_mtp(mtp, *sizep)) { + *vap = memguard_alloc(*sizep, flags); + if (*vap != NULL) + return (EJUSTRETURN); /* This is unfortunate but should not be fatal. */ } #endif #ifdef DEBUG_REDZONE - size = redzone_size_ntor(size); + *sizep = redzone_size_ntor(*sizep); #endif + return (0); +} +#endif + +/* + * malloc: + * + * Allocate a block of memory. + * + * If M_NOWAIT is set, this routine will not block and return NULL if + * the allocation fails. + */ +void * +malloc(unsigned long size, struct malloc_type *mtp, int flags) +{ + int indx; + struct malloc_type_internal *mtip; + caddr_t va; + uma_zone_t zone; +#if defined(DEBUG_REDZONE) + unsigned long osize = size; +#endif + +#ifdef MALLOC_DEBUG + if (malloc_dbg(&va, &size, mtp, flags) != 0) + return (va); +#endif + if (size <= kmem_zmax) { mtip = mtp->ks_handle; if (size & KMEM_ZMASK) @@ -523,11 +559,55 @@ malloc(unsigned long size, struct malloc_type *mtp, in KASSERT(va != NULL, ("malloc(M_WAITOK) returned NULL")); else if (va == NULL) t_malloc_fail = time_uptime; -#ifdef DIAGNOSTIC - if (va != NULL && !(flags & M_ZERO)) { - memset(va, 0x70, osize); - } +#ifdef DEBUG_REDZONE + if (va != NULL) + va = redzone_setup(va, osize); #endif + return ((void *) va); +} + +void * +malloc_domain(unsigned long size, struct malloc_type *mtp, int domain, + int flags) +{ + int indx; + struct malloc_type_internal *mtip; + caddr_t va; + uma_zone_t zone; +#if defined(DEBUG_REDZONE) + unsigned long osize = size; +#endif + +#ifdef MALLOC_DEBUG + if (malloc_dbg(&va, &size, mtp, flags) != 0) + return (va); +#endif + if (size <= kmem_zmax) { + mtip = mtp->ks_handle; + if (size & KMEM_ZMASK) + size = (size & ~KMEM_ZMASK) + KMEM_ZBASE; + indx = kmemsize[size >> KMEM_ZSHIFT]; + KASSERT(mtip->mti_zone < numzones, + ("mti_zone %u out of range %d", + mtip->mti_zone, numzones)); + zone = kmemzones[indx].kz_zone[mtip->mti_zone]; +#ifdef MALLOC_PROFILE + krequests[size >> KMEM_ZSHIFT]++; +#endif + va = uma_zalloc_domain(zone, NULL, domain, flags); + if (va != NULL) + size = zone->uz_size; + malloc_type_zone_allocated(mtp, va == NULL ? 0 : size, indx); + } else { + size = roundup(size, PAGE_SIZE); + zone = NULL; + va = uma_large_malloc_domain(size, domain, flags); + malloc_type_allocated(mtp, va == NULL ? 0 : size); + } + if (flags & M_WAITOK) + KASSERT(va != NULL, ("malloc(M_WAITOK) returned NULL")); + else if (va == NULL) + t_malloc_fail = time_uptime; #ifdef DEBUG_REDZONE if (va != NULL) va = redzone_setup(va, osize); @@ -545,66 +625,124 @@ mallocarray(size_t nmemb, size_t size, struct malloc_t return (malloc(size * nmemb, type, flags)); } -/* - * free: - * - * Free a block of memory allocated by malloc. - * - * This routine may not block. - */ -void -free(void *addr, struct malloc_type *mtp) +#ifdef INVARIANTS +static void +free_save_type(void *addr, struct malloc_type *mtp, u_long size) { - uma_slab_t slab; - u_long size; + struct malloc_type **mtpp = addr; + /* + * Cache a pointer to the malloc_type that most recently freed + * this memory here. This way we know who is most likely to + * have stepped on it later. + * + * This code assumes that size is a multiple of 8 bytes for + * 64 bit machines + */ + mtpp = (struct malloc_type **) ((unsigned long)mtpp & ~UMA_ALIGN_PTR); + mtpp += (size - sizeof(struct malloc_type *)) / + sizeof(struct malloc_type *); + *mtpp = mtp; +} +#endif + +#ifdef MALLOC_DEBUG +static int +free_dbg(void **addrp, struct malloc_type *mtp) +{ + void *addr; + + addr = *addrp; KASSERT(mtp->ks_magic == M_MAGIC, ("free: bad malloc type magic")); KASSERT(curthread->td_critnest == 0 || SCHEDULER_STOPPED(), ("free: called with spinlock or critical section held")); /* free(NULL, ...) does nothing */ if (addr == NULL) - return; + return (EJUSTRETURN); #ifdef DEBUG_MEMGUARD if (is_memguard_addr(addr)) { memguard_free(addr); - return; + return (EJUSTRETURN); } #endif #ifdef DEBUG_REDZONE redzone_check(addr); - addr = redzone_addr_ntor(addr); + *addrp = redzone_addr_ntor(addr); #endif - slab = vtoslab((vm_offset_t)addr & (~UMA_SLAB_MASK)); + return (0); +} +#endif +/* + * free: + * + * Free a block of memory allocated by malloc. + * + * This routine may not block. + */ +void +free(void *addr, struct malloc_type *mtp) +{ + uma_slab_t slab; + u_long size; + +#ifdef MALLOC_DEBUG + if (free_dbg(&addr, mtp) != 0) + return; +#endif + /* free(NULL, ...) does nothing */ + if (addr == NULL) + return; + + slab = vtoslab((vm_offset_t)addr & (~UMA_SLAB_MASK)); if (slab == NULL) panic("free: address %p(%p) has not been allocated.\n", addr, (void *)((u_long)addr & (~UMA_SLAB_MASK))); if (!(slab->us_flags & UMA_SLAB_MALLOC)) { + size = slab->us_keg->uk_size; #ifdef INVARIANTS - struct malloc_type **mtpp = addr; + free_save_type(addr, mtp, size); #endif + uma_zfree_arg(LIST_FIRST(&slab->us_keg->uk_zones), addr, slab); + } else { + size = slab->us_size; + uma_large_free(slab); + } + malloc_type_freed(mtp, size); +} + +void +free_domain(void *addr, struct malloc_type *mtp) +{ + uma_slab_t slab; + u_long size; + +#ifdef MALLOC_DEBUG + if (free_dbg(&addr, mtp) != 0) + return; +#endif + + /* free(NULL, ...) does nothing */ + if (addr == NULL) + return; + + slab = vtoslab((vm_offset_t)addr & (~UMA_SLAB_MASK)); + if (slab == NULL) + panic("free_domain: address %p(%p) has not been allocated.\n", + addr, (void *)((u_long)addr & (~UMA_SLAB_MASK))); + + if (!(slab->us_flags & UMA_SLAB_MALLOC)) { size = slab->us_keg->uk_size; #ifdef INVARIANTS - /* - * Cache a pointer to the malloc_type that most recently freed - * this memory here. This way we know who is most likely to - * have stepped on it later. - * - * This code assumes that size is a multiple of 8 bytes for - * 64 bit machines - */ - mtpp = (struct malloc_type **) - ((unsigned long)mtpp & ~UMA_ALIGN_PTR); - mtpp += (size - sizeof(struct malloc_type *)) / - sizeof(struct malloc_type *); - *mtpp = mtp; + free_save_type(addr, mtp, size); #endif - uma_zfree_arg(LIST_FIRST(&slab->us_keg->uk_zones), addr, slab); + uma_zfree_domain(LIST_FIRST(&slab->us_keg->uk_zones), + addr, slab); } else { size = slab->us_size; uma_large_free(slab); Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Fri Jan 12 23:13:55 2018 (r327899) +++ head/sys/kern/kern_mbuf.c Fri Jan 12 23:25:05 2018 (r327900) @@ -283,7 +283,7 @@ static void mb_dtor_pack(void *, int, void *); static int mb_zinit_pack(void *, int, int); static void mb_zfini_pack(void *, int); static void mb_reclaim(uma_zone_t, int); -static void *mbuf_jumbo_alloc(uma_zone_t, vm_size_t, uint8_t *, int); +static void *mbuf_jumbo_alloc(uma_zone_t, vm_size_t, int, uint8_t *, int); /* Ensure that MSIZE is a power of 2. */ CTASSERT((((MSIZE - 1) ^ MSIZE) + 1) >> 1 == MSIZE); @@ -386,12 +386,13 @@ SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbuf_init, * pages. */ static void * -mbuf_jumbo_alloc(uma_zone_t zone, vm_size_t bytes, uint8_t *flags, int wait) +mbuf_jumbo_alloc(uma_zone_t zone, vm_size_t bytes, int domain, uint8_t *flags, + int wait) { /* Inform UMA that this allocator uses kernel_map/object. */ *flags = UMA_SLAB_KERNEL; - return ((void *)kmem_alloc_contig(kernel_arena, bytes, wait, + return ((void *)kmem_alloc_contig_domain(domain, bytes, wait, (vm_paddr_t)0, ~(vm_paddr_t)0, 1, 0, VM_MEMATTR_DEFAULT)); } Modified: head/sys/kern/subr_busdma_bufalloc.c ============================================================================== --- head/sys/kern/subr_busdma_bufalloc.c Fri Jan 12 23:13:55 2018 (r327899) +++ head/sys/kern/subr_busdma_bufalloc.c Fri Jan 12 23:25:05 2018 (r327900) @@ -149,7 +149,7 @@ busdma_bufalloc_findzone(busdma_bufalloc_t ba, bus_siz } void * -busdma_bufalloc_alloc_uncacheable(uma_zone_t zone, vm_size_t size, +busdma_bufalloc_alloc_uncacheable(uma_zone_t zone, vm_size_t size, int domain, uint8_t *pflag, int wait) { #ifdef VM_MEMATTR_UNCACHEABLE @@ -157,7 +157,7 @@ busdma_bufalloc_alloc_uncacheable(uma_zone_t zone, vm_ /* Inform UMA that this allocator uses kernel_arena/object. */ *pflag = UMA_SLAB_KERNEL; - return ((void *)kmem_alloc_attr(kernel_arena, size, wait, 0, + return ((void *)kmem_alloc_attr_domain(domain, size, wait, 0, BUS_SPACE_MAXADDR, VM_MEMATTR_UNCACHEABLE)); #else Modified: head/sys/kern/subr_vmem.c ============================================================================== --- head/sys/kern/subr_vmem.c Fri Jan 12 23:13:55 2018 (r327899) +++ head/sys/kern/subr_vmem.c Fri Jan 12 23:25:05 2018 (r327900) @@ -500,7 +500,7 @@ bt_insfree(vmem_t *vm, bt_t *bt) * Import from the arena into the quantum cache in UMA. */ static int -qc_import(void *arg, void **store, int cnt, int flags) +qc_import(void *arg, void **store, int cnt, int domain, int flags) { qcache_t *qc; vmem_addr_t addr; @@ -614,13 +614,12 @@ static struct mtx_padalign __exclusive_cache_line vmem * we are really out of KVA. */ static void * -vmem_bt_alloc(uma_zone_t zone, vm_size_t bytes, uint8_t *pflag, int wait) +vmem_bt_alloc(uma_zone_t zone, vm_size_t bytes, int domain, uint8_t *pflag, + int wait) { vmem_addr_t addr; - int domain; *pflag = UMA_SLAB_KERNEL; - domain = 0; /* XXX Temporary. */ /* * Single thread boundary tag allocation so that the address space Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Fri Jan 12 23:13:55 2018 (r327899) +++ head/sys/kern/vfs_bio.c Fri Jan 12 23:25:05 2018 (r327900) @@ -133,7 +133,7 @@ static __inline void bd_wakeup(void); static int sysctl_runningspace(SYSCTL_HANDLER_ARGS); static void bufkva_reclaim(vmem_t *, int); static void bufkva_free(struct buf *); -static int buf_import(void *, void **, int, int); +static int buf_import(void *, void **, int, int, int); static void buf_release(void *, void **, int); static void maxbcachebuf_adjust(void); @@ -1419,7 +1419,7 @@ buf_free(struct buf *bp) * only as a per-cpu cache of bufs still maintained on a global list. */ static int -buf_import(void *arg, void **store, int cnt, int flags) +buf_import(void *arg, void **store, int cnt, int domain, int flags) { struct buf *bp; int i; Modified: head/sys/mips/mips/uma_machdep.c ============================================================================== --- head/sys/mips/mips/uma_machdep.c Fri Jan 12 23:13:55 2018 (r327899) +++ head/sys/mips/mips/uma_machdep.c Fri Jan 12 23:25:05 2018 (r327900) @@ -44,7 +44,8 @@ __FBSDID("$FreeBSD$"); #include void * -uma_small_alloc(uma_zone_t zone, vm_size_t bytes, u_int8_t *flags, int wait) +uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags, + int wait) { vm_paddr_t pa; vm_page_t m; @@ -59,7 +60,8 @@ uma_small_alloc(uma_zone_t zone, vm_size_t bytes, u_in #endif for (;;) { - m = vm_page_alloc_freelist(VM_FREELIST_DIRECT, pflags); + m = vm_page_alloc_freelist_domain(domain, VM_FREELIST_DIRECT, + pflags); #ifndef __mips_n64 if (m == NULL && vm_page_reclaim_contig(pflags, 1, 0, MIPS_KSEG0_LARGEST_PHYS, PAGE_SIZE, 0)) Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Fri Jan 12 23:13:55 2018 (r327899) +++ head/sys/powerpc/aim/mmu_oea64.c Fri Jan 12 23:25:05 2018 (r327900) @@ -1504,8 +1504,8 @@ retry: static mmu_t installed_mmu; static void * -moea64_uma_page_alloc(uma_zone_t zone, vm_size_t bytes, uint8_t *flags, - int wait) +moea64_uma_page_alloc(uma_zone_t zone, vm_size_t bytes, int domain, + uint8_t *flags, int wait) { struct pvo_entry *pvo; vm_offset_t va; @@ -1522,7 +1522,7 @@ moea64_uma_page_alloc(uma_zone_t zone, vm_size_t bytes *flags = UMA_SLAB_PRIV; needed_lock = !PMAP_LOCKED(kernel_pmap); - m = vm_page_alloc(NULL, 0, + m = vm_page_alloc_domain(NULL, 0, domain, malloc2vm_flags(wait) | VM_ALLOC_WIRED | VM_ALLOC_NOOBJ); if (m == NULL) return (NULL); Modified: head/sys/powerpc/aim/slb.c ============================================================================== --- head/sys/powerpc/aim/slb.c Fri Jan 12 23:13:55 2018 (r327899) +++ head/sys/powerpc/aim/slb.c Fri Jan 12 23:25:05 2018 (r327900) @@ -480,7 +480,8 @@ slb_insert_user(pmap_t pm, struct slb *slb) } static void * -slb_uma_real_alloc(uma_zone_t zone, vm_size_t bytes, u_int8_t *flags, int wait) +slb_uma_real_alloc(uma_zone_t zone, vm_size_t bytes, int domain, + u_int8_t *flags, int wait) { static vm_offset_t realmax = 0; void *va; @@ -490,7 +491,7 @@ slb_uma_real_alloc(uma_zone_t zone, vm_size_t bytes, u realmax = platform_real_maxaddr(); *flags = UMA_SLAB_PRIV; - m = vm_page_alloc_contig(NULL, 0, + m = vm_page_alloc_contig_domain(NULL, 0, domain, malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED, 1, 0, realmax, PAGE_SIZE, PAGE_SIZE, VM_MEMATTR_DEFAULT); if (m == NULL) Modified: head/sys/powerpc/powerpc/uma_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/uma_machdep.c Fri Jan 12 23:13:55 2018 (r327899) +++ head/sys/powerpc/powerpc/uma_machdep.c Fri Jan 12 23:25:05 2018 (r327900) @@ -51,7 +51,8 @@ SYSCTL_INT(_hw, OID_AUTO, uma_mdpages, CTLFLAG_RD, &hw "UMA MD pages in use"); void * -uma_small_alloc(uma_zone_t zone, vm_size_t bytes, u_int8_t *flags, int wait) +uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags, + int wait) { void *va; vm_paddr_t pa; @@ -59,7 +60,7 @@ uma_small_alloc(uma_zone_t zone, vm_size_t bytes, u_in *flags = UMA_SLAB_PRIV; - m = vm_page_alloc(NULL, 0, + m = vm_page_alloc_domain(NULL, 0, domain, malloc2vm_flags(wait) | VM_ALLOC_WIRED | VM_ALLOC_NOOBJ); if (m == NULL) return (NULL); Modified: head/sys/riscv/riscv/uma_machdep.c ============================================================================== --- head/sys/riscv/riscv/uma_machdep.c Fri Jan 12 23:13:55 2018 (r327899) +++ head/sys/riscv/riscv/uma_machdep.c Fri Jan 12 23:25:05 2018 (r327900) @@ -41,7 +41,8 @@ __FBSDID("$FreeBSD$"); #include void * -uma_small_alloc(uma_zone_t zone, vm_size_t bytes, u_int8_t *flags, int wait) +uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags, + int wait) { panic("uma_small_alloc"); Modified: head/sys/sparc64/sparc64/vm_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/vm_machdep.c Fri Jan 12 23:13:55 2018 (r327899) +++ head/sys/sparc64/sparc64/vm_machdep.c Fri Jan 12 23:25:05 2018 (r327900) @@ -392,7 +392,8 @@ swi_vm(void *v) } void * -uma_small_alloc(uma_zone_t zone, vm_size_t bytes, u_int8_t *flags, int wait) +uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags, + int wait) { vm_paddr_t pa; vm_page_t m; @@ -402,7 +403,7 @@ uma_small_alloc(uma_zone_t zone, vm_size_t bytes, u_in *flags = UMA_SLAB_PRIV; - m = vm_page_alloc(NULL, 0, + m = vm_page_alloc_domain(NULL, 0, domain, malloc2vm_flags(wait) | VM_ALLOC_WIRED | VM_ALLOC_NOOBJ); if (m == NULL) return (NULL); Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Fri Jan 12 23:13:55 2018 (r327899) +++ head/sys/sys/malloc.h Fri Jan 12 23:25:05 2018 (r327900) @@ -175,8 +175,16 @@ void *contigmalloc(unsigned long size, struct malloc_t vm_paddr_t low, vm_paddr_t high, unsigned long alignment, vm_paddr_t boundary) __malloc_like __result_use_check __alloc_size(1) __alloc_align(6); +void *contigmalloc_domain(unsigned long size, struct malloc_type *type, + int domain, int flags, vm_paddr_t low, vm_paddr_t high, + unsigned long alignment, vm_paddr_t boundary) + __malloc_like __result_use_check __alloc_size(1) __alloc_align(6); void free(void *addr, struct malloc_type *type); +void free_domain(void *addr, struct malloc_type *type); void *malloc(unsigned long size, struct malloc_type *type, int flags) + __malloc_like __result_use_check __alloc_size(1); +void *malloc_domain(unsigned long size, struct malloc_type *type, + int domain, int flags) __malloc_like __result_use_check __alloc_size(1); void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, int flags) __malloc_like __result_use_check Modified: head/sys/vm/uma.h ============================================================================== --- head/sys/vm/uma.h Fri Jan 12 23:13:55 2018 (r327899) +++ head/sys/vm/uma.h Fri Jan 12 23:25:05 2018 (r327900) @@ -128,7 +128,8 @@ typedef void (*uma_fini)(void *mem, int size); /* * Import new memory into a cache zone. */ -typedef int (*uma_import)(void *arg, void **store, int count, int flags); +typedef int (*uma_import)(void *arg, void **store, int count, int domain, + int flags); /* * Free memory from a cache zone. @@ -281,6 +282,10 @@ uma_zone_t uma_zcache_create(char *name, int size, uma * Allocates mp_maxid + 1 slabs sized to * sizeof(struct pcpu). */ +#define UMA_ZONE_NUMA 0x10000 /* + * NUMA aware Zone. Implements a best + * effort first-touch policy. + */ /* * These flags are shared between the keg and zone. In zones wishing to add @@ -326,6 +331,19 @@ void uma_zdestroy(uma_zone_t zone); void *uma_zalloc_arg(uma_zone_t zone, void *arg, int flags); /* + * Allocate an item from a specific NUMA domain. This uses a slow path in + * the allocator but is guaranteed to allocate memory from the requested + * domain if M_WAITOK is set. + * + * Arguments: + * zone The zone we are allocating from + * arg This data is passed to the ctor function + * domain The domain to allocate from. + * flags See sys/malloc.h for available flags. + */ +void *uma_zalloc_domain(uma_zone_t zone, void *arg, int domain, int flags); + +/* * Allocates an item out of a zone without supplying an argument * * This is just a wrapper for uma_zalloc_arg for convenience. @@ -354,6 +372,16 @@ uma_zalloc(uma_zone_t zone, int flags) void uma_zfree_arg(uma_zone_t zone, void *item, void *arg); /* + * Frees an item back to the specified zone's domain specific pool. + * + * Arguments: + * zone The zone the item was originally allocated out of. + * item The memory to be freed. + * arg Argument passed to the destructor + */ +void uma_zfree_domain(uma_zone_t zone, void *item, void *arg); + +/* * Frees an item back to a zone without supplying an argument * * This is just a wrapper for uma_zfree_arg for convenience. @@ -373,25 +401,21 @@ uma_zfree(uma_zone_t zone, void *item) void uma_zwait(uma_zone_t zone); /* - * XXX The rest of the prototypes in this header are h0h0 magic for the VM. - * If you think you need to use it for a normal zone you're probably incorrect. - */ - -/* * Backend page supplier routines * * Arguments: * zone The zone that is requesting pages. * size The number of bytes being requested. * pflag Flags for these memory pages, see below. + * domain The NUMA domain that we prefer for this allocation. * wait Indicates our willingness to block. * * Returns: * A pointer to the allocated memory or NULL on failure. */ -typedef void *(*uma_alloc)(uma_zone_t zone, vm_size_t size, uint8_t *pflag, - int wait); +typedef void *(*uma_alloc)(uma_zone_t zone, vm_size_t size, int domain, + uint8_t *pflag, int wait); /* * Backend page free routines @@ -405,8 +429,6 @@ typedef void *(*uma_alloc)(uma_zone_t zone, vm_size_t * None */ typedef void (*uma_free)(void *item, vm_size_t size, uint8_t pflag); - - /* * Sets up the uma allocator. (Called by vm_mem_init) Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Fri Jan 12 23:13:55 2018 (r327899) +++ head/sys/vm/uma_core.c Fri Jan 12 23:25:05 2018 (r327900) @@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -97,17 +98,12 @@ __FBSDID("$FreeBSD$"); #endif /* - * This is the zone and keg from which all zones are spawned. The idea is that - * even the zone & keg heads are allocated from the allocator, so we use the - * bss section to bootstrap us. + * This is the zone and keg from which all zones are spawned. */ -static struct uma_keg masterkeg; -static struct uma_zone masterzone_k; -static struct uma_zone masterzone_z; -static uma_zone_t kegs = &masterzone_k; -static uma_zone_t zones = &masterzone_z; +static uma_zone_t kegs; +static uma_zone_t zones; -/* This is the zone from which all of uma_slab_t's are allocated. */ +/* This is the zone from which all offpage uma_slab_ts are allocated. */ static uma_zone_t slabzone; /* @@ -226,13 +222,15 @@ struct uma_bucket_zone bucket_zones[] = { */ enum zfreeskip { SKIP_NONE = 0, SKIP_DTOR, SKIP_FINI }; +#define UMA_ANYDOMAIN -1 /* Special value for domain search. */ + /* Prototypes.. */ -static void *noobj_alloc(uma_zone_t, vm_size_t, uint8_t *, int); -static void *page_alloc(uma_zone_t, vm_size_t, uint8_t *, int); -static void *startup_alloc(uma_zone_t, vm_size_t, uint8_t *, int); +static void *noobj_alloc(uma_zone_t, vm_size_t, int, uint8_t *, int); +static void *page_alloc(uma_zone_t, vm_size_t, int, uint8_t *, int); +static void *startup_alloc(uma_zone_t, vm_size_t, int, uint8_t *, int); static void page_free(void *, vm_size_t, uint8_t); -static uma_slab_t keg_alloc_slab(uma_keg_t, uma_zone_t, int); +static uma_slab_t keg_alloc_slab(uma_keg_t, uma_zone_t, int, int); static void cache_drain(uma_zone_t); static void bucket_drain(uma_zone_t, uma_bucket_t); static void bucket_cache_drain(uma_zone_t zone); @@ -250,23 +248,23 @@ static int hash_expand(struct uma_hash *, struct uma_h static void hash_free(struct uma_hash *hash); static void uma_timeout(void *); static void uma_startup3(void); -static void *zone_alloc_item(uma_zone_t, void *, int); +static void *zone_alloc_item(uma_zone_t, void *, int, int); static void zone_free_item(uma_zone_t, void *, void *, enum zfreeskip); static void bucket_enable(void); static void bucket_init(void); static uma_bucket_t bucket_alloc(uma_zone_t zone, void *, int); static void bucket_free(uma_zone_t zone, uma_bucket_t, void *); static void bucket_zone_drain(void); -static uma_bucket_t zone_alloc_bucket(uma_zone_t zone, void *, int flags); -static uma_slab_t zone_fetch_slab(uma_zone_t zone, uma_keg_t last, int flags); -static uma_slab_t zone_fetch_slab_multi(uma_zone_t zone, uma_keg_t last, int flags); +static uma_bucket_t zone_alloc_bucket(uma_zone_t, void *, int, int); +static uma_slab_t zone_fetch_slab(uma_zone_t, uma_keg_t, int, int); +static uma_slab_t zone_fetch_slab_multi(uma_zone_t, uma_keg_t, int, int); static void *slab_alloc_item(uma_keg_t keg, uma_slab_t slab); static void slab_free_item(uma_keg_t keg, uma_slab_t slab, void *item); static uma_keg_t uma_kcreate(uma_zone_t zone, size_t size, uma_init uminit, uma_fini fini, int align, uint32_t flags); -static int zone_import(uma_zone_t zone, void **bucket, int max, int flags); -static void zone_release(uma_zone_t zone, void **bucket, int cnt); -static void uma_zero_item(void *item, uma_zone_t zone); +static int zone_import(uma_zone_t, void **, int, int, int); +static void zone_release(uma_zone_t, void **, int); +static void uma_zero_item(void *, uma_zone_t); void uma_print_zone(uma_zone_t); void uma_print_stats(void); @@ -332,7 +330,7 @@ bucket_init(void) size += sizeof(void *) * ubz->ubz_entries; ubz->ubz_zone = uma_zcreate(ubz->ubz_name, size, NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, - UMA_ZONE_MTXCLASS | UMA_ZFLAG_BUCKET); + UMA_ZONE_MTXCLASS | UMA_ZFLAG_BUCKET | UMA_ZONE_NUMA); } } @@ -570,7 +568,7 @@ hash_alloc(struct uma_hash *hash) } else { alloc = sizeof(hash->uh_slab_hash[0]) * UMA_HASH_SIZE_INIT; hash->uh_slab_hash = zone_alloc_item(hashzone, NULL, - M_WAITOK); + UMA_ANYDOMAIN, M_WAITOK); hash->uh_hashsize = UMA_HASH_SIZE_INIT; } if (hash->uh_slab_hash) { @@ -736,6 +734,7 @@ cache_drain_safe_cpu(uma_zone_t zone) { uma_cache_t cache; uma_bucket_t b1, b2; + int domain; if (zone->uz_flags & UMA_ZFLAG_INTERNAL) return; @@ -743,10 +742,14 @@ cache_drain_safe_cpu(uma_zone_t zone) b1 = b2 = NULL; ZONE_LOCK(zone); critical_enter(); + if (zone->uz_flags & UMA_ZONE_NUMA) + domain = PCPU_GET(domain); + else + domain = 0; cache = &zone->uz_cpu[curcpu]; if (cache->uc_allocbucket) { if (cache->uc_allocbucket->ub_cnt != 0) - LIST_INSERT_HEAD(&zone->uz_buckets, + LIST_INSERT_HEAD(&zone->uz_domain[domain].uzd_buckets, cache->uc_allocbucket, ub_link); else b1 = cache->uc_allocbucket; @@ -754,7 +757,7 @@ cache_drain_safe_cpu(uma_zone_t zone) } if (cache->uc_freebucket) { if (cache->uc_freebucket->ub_cnt != 0) - LIST_INSERT_HEAD(&zone->uz_buckets, + LIST_INSERT_HEAD(&zone->uz_domain[domain].uzd_buckets, cache->uc_freebucket, ub_link); else b2 = cache->uc_freebucket; @@ -809,18 +812,22 @@ cache_drain_safe(uma_zone_t zone) static void bucket_cache_drain(uma_zone_t zone) { + uma_zone_domain_t zdom; uma_bucket_t bucket; + int i; /* - * Drain the bucket queues and free the buckets, we just keep two per - * cpu (alloc/free). + * Drain the bucket queues and free the buckets. */ - while ((bucket = LIST_FIRST(&zone->uz_buckets)) != NULL) { - LIST_REMOVE(bucket, ub_link); - ZONE_UNLOCK(zone); - bucket_drain(zone, bucket); - bucket_free(zone, bucket, NULL); - ZONE_LOCK(zone); + for (i = 0; i < vm_ndomains; i++) { + zdom = &zone->uz_domain[i]; + while ((bucket = LIST_FIRST(&zdom->uzd_buckets)) != NULL) { + LIST_REMOVE(bucket, ub_link); + ZONE_UNLOCK(zone); + bucket_drain(zone, bucket); + bucket_free(zone, bucket, NULL); + ZONE_LOCK(zone); + } } /* @@ -865,7 +872,9 @@ static void keg_drain(uma_keg_t keg) { struct slabhead freeslabs = { 0 }; + uma_domain_t dom; uma_slab_t slab, tmp; + int i; /* * We don't want to take pages from statically allocated kegs at this @@ -880,20 +889,25 @@ keg_drain(uma_keg_t keg) if (keg->uk_free == 0) goto finished; - LIST_FOREACH_SAFE(slab, &keg->uk_free_slab, us_link, tmp) { - /* We have nowhere to free these to. */ - if (slab->us_flags & UMA_SLAB_BOOT) - continue; + for (i = 0; i < vm_ndomains; i++) { + dom = &keg->uk_domain[i]; + LIST_FOREACH_SAFE(slab, &dom->ud_free_slab, us_link, tmp) { + /* We have nowhere to free these to. */ + if (slab->us_flags & UMA_SLAB_BOOT) + continue; - LIST_REMOVE(slab, us_link); - keg->uk_pages -= keg->uk_ppera; - keg->uk_free -= keg->uk_ipers; + LIST_REMOVE(slab, us_link); + keg->uk_pages -= keg->uk_ppera; + keg->uk_free -= keg->uk_ipers; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Jan 12 23:34:18 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96B76EB279A; Fri, 12 Jan 2018 23:34:18 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5F5DB2F68; Fri, 12 Jan 2018 23:34:18 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 989AA283E; Fri, 12 Jan 2018 23:34:17 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CNYHkT003902; Fri, 12 Jan 2018 23:34:17 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CNYGBD003889; Fri, 12 Jan 2018 23:34:16 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201801122334.w0CNYGBD003889@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Fri, 12 Jan 2018 23:34:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327901 - in head/sys: arm/arm arm64/arm64 dev/acpica mips/mips powerpc/powerpc sys vm x86/include x86/iommu x86/x86 X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: arm/arm arm64/arm64 dev/acpica mips/mips powerpc/powerpc sys vm x86/include x86/iommu x86/x86 X-SVN-Commit-Revision: 327901 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 23:34:18 -0000 Author: jeff Date: Fri Jan 12 23:34:16 2018 New Revision: 327901 URL: https://svnweb.freebsd.org/changeset/base/327901 Log: Add support for NUMA domains to bus dma tags. This causes all memory allocated with a tag to come from the specified domain if it meets the other constraints provided by the tag. Automatically create a tag at the root of each bus specifying the domain local to that bus if available. Reviewed by: jhb, kib Tested by: pho Sponsored by: Netflix, Dell/EMC Isilon Differential Revision: https://reviews.freebsd.org/D13545 Modified: head/sys/arm/arm/busdma_machdep-v4.c head/sys/arm/arm/busdma_machdep-v6.c head/sys/arm64/arm64/busdma_machdep.c head/sys/dev/acpica/acpi_pcib_acpi.c head/sys/mips/mips/busdma_machdep.c head/sys/powerpc/powerpc/busdma_machdep.c head/sys/sys/bus_dma.h head/sys/vm/vm_phys.c head/sys/vm/vm_phys.h head/sys/x86/include/busdma_impl.h head/sys/x86/iommu/busdma_dmar.c head/sys/x86/x86/busdma_bounce.c head/sys/x86/x86/busdma_machdep.c Modified: head/sys/arm/arm/busdma_machdep-v4.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v4.c Fri Jan 12 23:25:05 2018 (r327900) +++ head/sys/arm/arm/busdma_machdep-v4.c Fri Jan 12 23:34:16 2018 (r327901) @@ -500,6 +500,13 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al } int +bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain) +{ + + return (0); +} + +int bus_dma_tag_destroy(bus_dma_tag_t dmat) { bus_dma_tag_t dmat_copy; Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Fri Jan 12 23:25:05 2018 (r327900) +++ head/sys/arm/arm/busdma_machdep-v6.c Fri Jan 12 23:34:16 2018 (r327901) @@ -563,6 +563,13 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al } int +bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain) +{ + + return (0); +} + +int bus_dma_tag_destroy(bus_dma_tag_t dmat) { bus_dma_tag_t dmat_copy; Modified: head/sys/arm64/arm64/busdma_machdep.c ============================================================================== --- head/sys/arm64/arm64/busdma_machdep.c Fri Jan 12 23:25:05 2018 (r327900) +++ head/sys/arm64/arm64/busdma_machdep.c Fri Jan 12 23:34:16 2018 (r327901) @@ -223,3 +223,9 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) return (tc->impl->tag_destroy(dmat)); } +int +bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain) +{ + + return (0); +} Modified: head/sys/dev/acpica/acpi_pcib_acpi.c ============================================================================== --- head/sys/dev/acpica/acpi_pcib_acpi.c Fri Jan 12 23:25:05 2018 (r327900) +++ head/sys/dev/acpica/acpi_pcib_acpi.c Fri Jan 12 23:34:16 2018 (r327901) @@ -60,6 +60,7 @@ ACPI_MODULE_NAME("PCI_ACPI") struct acpi_hpcib_softc { device_t ap_dev; ACPI_HANDLE ap_handle; + bus_dma_tag_t ap_dma_tag; int ap_flags; uint32_t ap_osc_ctl; @@ -108,6 +109,7 @@ static int acpi_pcib_acpi_release_resource(device_t d #endif static int acpi_pcib_request_feature(device_t pcib, device_t dev, enum pci_feature feature); +static bus_dma_tag_t acpi_pcib_get_dma_tag(device_t bus, device_t child); static device_method_t acpi_pcib_acpi_methods[] = { /* Device interface */ @@ -136,6 +138,7 @@ static device_method_t acpi_pcib_acpi_methods[] = { DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_get_cpus, acpi_pcib_get_cpus), + DEVMETHOD(bus_get_dma_tag, acpi_pcib_get_dma_tag), /* pcib interface */ DEVMETHOD(pcib_maxslots, pcib_maxslots), @@ -366,6 +369,7 @@ acpi_pcib_acpi_attach(device_t dev) rman_res_t start; int rid; #endif + int error, domain; uint8_t busno; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -537,15 +541,33 @@ acpi_pcib_acpi_attach(device_t dev) acpi_pcib_fetch_prt(dev, &sc->ap_prt); + error = bus_dma_tag_create(bus_get_dma_tag(dev), 1, + 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, + NULL, NULL, BUS_SPACE_MAXSIZE, BUS_SPACE_UNRESTRICTED, + BUS_SPACE_MAXSIZE, 0, NULL, NULL, &sc->ap_dma_tag); + if (error != 0) + goto errout; + error = bus_get_domain(dev, &domain); + if (error == 0) + error = bus_dma_tag_set_domain(sc->ap_dma_tag, domain); + /* Don't fail to attach if the domain can't be queried or set. */ + error = 0; + bus_generic_probe(dev); if (device_add_child(dev, "pci", -1) == NULL) { - device_printf(device_get_parent(dev), "couldn't attach pci bus\n"); -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) - pcib_host_res_free(dev, &sc->ap_host_res); -#endif - return (ENXIO); + bus_dma_tag_destroy(sc->ap_dma_tag); + sc->ap_dma_tag = NULL; + error = ENXIO; + goto errout; } return (bus_generic_attach(dev)); + +errout: + device_printf(device_get_parent(dev), "couldn't attach pci bus\n"); +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) + pcib_host_res_free(dev, &sc->ap_host_res); +#endif + return (error); } /* @@ -752,4 +774,14 @@ acpi_pcib_request_feature(device_t pcib, device_t dev, } return (acpi_pcib_osc(sc, osc_ctl)); +} + +static bus_dma_tag_t +acpi_pcib_get_dma_tag(device_t bus, device_t child) +{ + struct acpi_hpcib_softc *sc; + + sc = device_get_softc(bus); + + return (sc->ap_dma_tag); } Modified: head/sys/mips/mips/busdma_machdep.c ============================================================================== --- head/sys/mips/mips/busdma_machdep.c Fri Jan 12 23:25:05 2018 (r327900) +++ head/sys/mips/mips/busdma_machdep.c Fri Jan 12 23:34:16 2018 (r327901) @@ -481,6 +481,13 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al } int +bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain) +{ + + return (0); +} + +int bus_dma_tag_destroy(bus_dma_tag_t dmat) { #ifdef KTR Modified: head/sys/powerpc/powerpc/busdma_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/busdma_machdep.c Fri Jan 12 23:25:05 2018 (r327900) +++ head/sys/powerpc/powerpc/busdma_machdep.c Fri Jan 12 23:34:16 2018 (r327901) @@ -341,6 +341,13 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al } int +bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain) +{ + + return (0); +} + +int bus_dma_tag_destroy(bus_dma_tag_t dmat) { bus_dma_tag_t dmat_copy; Modified: head/sys/sys/bus_dma.h ============================================================================== --- head/sys/sys/bus_dma.h Fri Jan 12 23:25:05 2018 (r327900) +++ head/sys/sys/bus_dma.h Fri Jan 12 23:34:16 2018 (r327901) @@ -176,6 +176,14 @@ int bus_dma_tag_create(bus_dma_tag_t parent, bus_size_ bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, void *lockfuncarg, bus_dma_tag_t *dmat); +/* + * Set the memory domain to be used for allocations. + * + * Automatic for PCI devices. Must be set prior to creating maps or + * allocating memory. + */ +int bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain); + int bus_dma_tag_destroy(bus_dma_tag_t dmat); /* Modified: head/sys/vm/vm_phys.c ============================================================================== --- head/sys/vm/vm_phys.c Fri Jan 12 23:25:05 2018 (r327900) +++ head/sys/vm/vm_phys.c Fri Jan 12 23:34:16 2018 (r327901) @@ -198,20 +198,32 @@ vm_phys_fictitious_cmp(struct vm_phys_fictitious_seg * (uintmax_t)p1->end, (uintmax_t)p2->start, (uintmax_t)p2->end); } -boolean_t -vm_phys_domain_intersects(long mask, vm_paddr_t low, vm_paddr_t high) +int +vm_phys_domain_match(int prefer, vm_paddr_t low, vm_paddr_t high) { - struct vm_phys_seg *s; - int idx; +#ifdef VM_NUMA_ALLOC + domainset_t mask; + int i; - while ((idx = ffsl(mask)) != 0) { - idx--; /* ffsl counts from 1 */ - mask &= ~(1UL << idx); - s = &vm_phys_segs[idx]; - if (low < s->end && high > s->start) - return (TRUE); - } - return (FALSE); + if (vm_ndomains == 1 || mem_affinity == NULL) + return (0); + + DOMAINSET_ZERO(&mask); + /* + * Check for any memory that overlaps low, high. + */ + for (i = 0; mem_affinity[i].end != 0; i++) + if (mem_affinity[i].start <= high && + mem_affinity[i].end >= low) + DOMAINSET_SET(mem_affinity[i].domain, &mask); + if (prefer != -1 && DOMAINSET_ISSET(prefer, &mask)) + return (prefer); + if (DOMAINSET_EMPTY(&mask)) + panic("vm_phys_domain_match: Impossible constraint"); + return (DOMAINSET_FFS(&mask) - 1); +#else + return (0); +#endif } /* Modified: head/sys/vm/vm_phys.h ============================================================================== --- head/sys/vm/vm_phys.h Fri Jan 12 23:25:05 2018 (r327900) +++ head/sys/vm/vm_phys.h Fri Jan 12 23:34:16 2018 (r327901) @@ -77,7 +77,7 @@ vm_page_t vm_phys_alloc_contig(int domain, u_long npag vm_page_t vm_phys_alloc_freelist_pages(int domain, int freelist, int pool, int order); vm_page_t vm_phys_alloc_pages(int domain, int pool, int order); -boolean_t vm_phys_domain_intersects(long mask, vm_paddr_t low, vm_paddr_t high); +int vm_phys_domain_match(int prefer, vm_paddr_t low, vm_paddr_t high); int vm_phys_fictitious_reg_range(vm_paddr_t start, vm_paddr_t end, vm_memattr_t memattr); void vm_phys_fictitious_unreg_range(vm_paddr_t start, vm_paddr_t end); Modified: head/sys/x86/include/busdma_impl.h ============================================================================== --- head/sys/x86/include/busdma_impl.h Fri Jan 12 23:25:05 2018 (r327900) +++ head/sys/x86/include/busdma_impl.h Fri Jan 12 23:34:16 2018 (r327901) @@ -50,6 +50,7 @@ struct bus_dma_tag_common { bus_dma_lock_t *lockfunc; void *lockfuncarg; int ref_count; + int domain; }; struct bus_dma_impl { @@ -60,6 +61,7 @@ struct bus_dma_impl { bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, void *lockfuncarg, bus_dma_tag_t *dmat); int (*tag_destroy)(bus_dma_tag_t dmat); + int (*tag_set_domain)(bus_dma_tag_t); int (*map_create)(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp); int (*map_destroy)(bus_dma_tag_t dmat, bus_dmamap_t map); int (*mem_alloc)(bus_dma_tag_t dmat, void** vaddr, int flags, Modified: head/sys/x86/iommu/busdma_dmar.c ============================================================================== --- head/sys/x86/iommu/busdma_dmar.c Fri Jan 12 23:25:05 2018 (r327900) +++ head/sys/x86/iommu/busdma_dmar.c Fri Jan 12 23:34:16 2018 (r327901) @@ -326,6 +326,13 @@ out: } static int +dmar_bus_dma_tag_set_domain(bus_dma_tag_t dmat) +{ + + return (0); +} + +static int dmar_bus_dma_tag_destroy(bus_dma_tag_t dmat1) { struct bus_dma_tag_dmar *dmat, *dmat_copy, *parent; @@ -345,7 +352,7 @@ dmar_bus_dma_tag_destroy(bus_dma_tag_t dmat1) 1) { if (dmat == &dmat->ctx->ctx_tag) dmar_free_ctx(dmat->ctx); - free(dmat->segments, M_DMAR_DMAMAP); + free_domain(dmat->segments, M_DMAR_DMAMAP); free(dmat, M_DEVBUF); dmat = parent; } else @@ -366,16 +373,18 @@ dmar_bus_dmamap_create(bus_dma_tag_t dmat, int flags, WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s", __func__); tag = (struct bus_dma_tag_dmar *)dmat; - map = malloc(sizeof(*map), M_DMAR_DMAMAP, M_NOWAIT | M_ZERO); + map = malloc_domain(sizeof(*map), M_DMAR_DMAMAP, + tag->common.domain, M_NOWAIT | M_ZERO); if (map == NULL) { *mapp = NULL; return (ENOMEM); } if (tag->segments == NULL) { - tag->segments = malloc(sizeof(bus_dma_segment_t) * - tag->common.nsegments, M_DMAR_DMAMAP, M_NOWAIT); + tag->segments = malloc_domain(sizeof(bus_dma_segment_t) * + tag->common.nsegments, M_DMAR_DMAMAP, + tag->common.domain, M_NOWAIT); if (tag->segments == NULL) { - free(map, M_DMAR_DMAMAP); + free_domain(map, M_DMAR_DMAMAP); *mapp = NULL; return (ENOMEM); } @@ -407,7 +416,7 @@ dmar_bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap return (EBUSY); } DMAR_DOMAIN_UNLOCK(domain); - free(map, M_DMAR_DMAMAP); + free_domain(map, M_DMAR_DMAMAP); } tag->map_count--; return (0); @@ -438,10 +447,11 @@ dmar_bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr if (tag->common.maxsize < PAGE_SIZE && tag->common.alignment <= tag->common.maxsize && attr == VM_MEMATTR_DEFAULT) { - *vaddr = malloc(tag->common.maxsize, M_DEVBUF, mflags); + *vaddr = malloc_domain(tag->common.maxsize, M_DEVBUF, + tag->common.domain, mflags); map->flags |= BUS_DMAMAP_DMAR_MALLOC; } else { - *vaddr = (void *)kmem_alloc_attr(kernel_arena, + *vaddr = (void *)kmem_alloc_attr_domain(tag->common.domain, tag->common.maxsize, mflags, 0ul, BUS_SPACE_MAXADDR, attr); map->flags |= BUS_DMAMAP_DMAR_KMEM_ALLOC; @@ -464,7 +474,7 @@ dmar_bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, map = (struct bus_dmamap_dmar *)map1; if ((map->flags & BUS_DMAMAP_DMAR_MALLOC) != 0) { - free(vaddr, M_DEVBUF); + free_domain(vaddr, M_DEVBUF); map->flags &= ~BUS_DMAMAP_DMAR_MALLOC; } else { KASSERT((map->flags & BUS_DMAMAP_DMAR_KMEM_ALLOC) != 0, @@ -832,6 +842,7 @@ dmar_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t struct bus_dma_impl bus_dma_dmar_impl = { .tag_create = dmar_bus_dma_tag_create, .tag_destroy = dmar_bus_dma_tag_destroy, + .tag_set_domain = dmar_bus_dma_tag_set_domain, .map_create = dmar_bus_dmamap_create, .map_destroy = dmar_bus_dmamap_destroy, .mem_alloc = dmar_bus_dmamem_alloc, @@ -842,7 +853,7 @@ struct bus_dma_impl bus_dma_dmar_impl = { .map_waitok = dmar_bus_dmamap_waitok, .map_complete = dmar_bus_dmamap_complete, .map_unload = dmar_bus_dmamap_unload, - .map_sync = dmar_bus_dmamap_sync + .map_sync = dmar_bus_dmamap_sync, }; static void Modified: head/sys/x86/x86/busdma_bounce.c ============================================================================== --- head/sys/x86/x86/busdma_bounce.c Fri Jan 12 23:25:05 2018 (r327900) +++ head/sys/x86/x86/busdma_bounce.c Fri Jan 12 23:34:16 2018 (r327901) @@ -99,6 +99,7 @@ struct bounce_zone { int total_bounced; int total_deferred; int map_count; + int domain; bus_size_t alignment; bus_addr_t lowaddr; char zoneid[8]; @@ -150,6 +151,32 @@ static void _bus_dmamap_count_phys(bus_dma_tag_t dmat, static int _bus_dmamap_reserve_pages(bus_dma_tag_t dmat, bus_dmamap_t map, int flags); +static int +bounce_bus_dma_zone_setup(bus_dma_tag_t dmat) +{ + struct bounce_zone *bz; + int error; + + /* Must bounce */ + if ((error = alloc_bounce_zone(dmat)) != 0) + return (error); + bz = dmat->bounce_zone; + + if (ptoa(bz->total_bpages) < dmat->common.maxsize) { + int pages; + + pages = atop(dmat->common.maxsize) - bz->total_bpages; + + /* Add pages to our bounce pool */ + if (alloc_bounce_pages(dmat, pages) < pages) + return (ENOMEM); + } + /* Performed initial allocation */ + dmat->bounce_flags |= BUS_DMA_MIN_ALLOC_COMP; + + return (0); +} + /* * Allocate a device specific dma_tag. */ @@ -184,28 +211,9 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_si newtag->bounce_flags |= BUS_DMA_COULD_BOUNCE; if (((newtag->bounce_flags & BUS_DMA_COULD_BOUNCE) != 0) && - (flags & BUS_DMA_ALLOCNOW) != 0) { - struct bounce_zone *bz; - - /* Must bounce */ - if ((error = alloc_bounce_zone(newtag)) != 0) { - free(newtag, M_DEVBUF); - return (error); - } - bz = newtag->bounce_zone; - - if (ptoa(bz->total_bpages) < maxsize) { - int pages; - - pages = atop(maxsize) - bz->total_bpages; - - /* Add pages to our bounce pool */ - if (alloc_bounce_pages(newtag, pages) < pages) - error = ENOMEM; - } - /* Performed initial allocation */ - newtag->bounce_flags |= BUS_DMA_MIN_ALLOC_COMP; - } else + (flags & BUS_DMA_ALLOCNOW) != 0) + error = bounce_bus_dma_zone_setup(newtag); + else error = 0; if (error != 0) @@ -218,7 +226,24 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_si return (error); } +/* + * Update the domain for the tag. We may need to reallocate the zone and + * bounce pages. + */ static int +bounce_bus_dma_tag_set_domain(bus_dma_tag_t dmat) +{ + + KASSERT(dmat->map_count == 0, + ("bounce_bus_dma_tag_set_domain: Domain set after use.\n")); + if ((dmat->bounce_flags & BUS_DMA_COULD_BOUNCE) == 0 || + dmat->bounce_zone == NULL) + return (0); + dmat->bounce_flags &= ~BUS_DMA_MIN_ALLOC_COMP; + return (bounce_bus_dma_zone_setup(dmat)); +} + +static int bounce_bus_dma_tag_destroy(bus_dma_tag_t dmat) { bus_dma_tag_t dmat_copy, parent; @@ -237,7 +262,7 @@ bounce_bus_dma_tag_destroy(bus_dma_tag_t dmat) atomic_subtract_int(&dmat->common.ref_count, 1); if (dmat->common.ref_count == 0) { if (dmat->segments != NULL) - free(dmat->segments, M_DEVBUF); + free_domain(dmat->segments, M_DEVBUF); free(dmat, M_DEVBUF); /* * Last reference count, so @@ -269,9 +294,9 @@ bounce_bus_dmamap_create(bus_dma_tag_t dmat, int flags error = 0; if (dmat->segments == NULL) { - dmat->segments = (bus_dma_segment_t *)malloc( + dmat->segments = (bus_dma_segment_t *)malloc_domain( sizeof(bus_dma_segment_t) * dmat->common.nsegments, - M_DEVBUF, M_NOWAIT); + M_DEVBUF, dmat->common.domain, M_NOWAIT); if (dmat->segments == NULL) { CTR3(KTR_BUSDMA, "%s: tag %p error %d", __func__, dmat, ENOMEM); @@ -292,8 +317,8 @@ bounce_bus_dmamap_create(bus_dma_tag_t dmat, int flags } bz = dmat->bounce_zone; - *mapp = (bus_dmamap_t)malloc(sizeof(**mapp), M_DEVBUF, - M_NOWAIT | M_ZERO); + *mapp = (bus_dmamap_t)malloc_domain(sizeof(**mapp), M_DEVBUF, + dmat->common.domain, M_NOWAIT | M_ZERO); if (*mapp == NULL) { CTR3(KTR_BUSDMA, "%s: tag %p error %d", __func__, dmat, ENOMEM); @@ -355,7 +380,7 @@ bounce_bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmam } if (dmat->bounce_zone) dmat->bounce_zone->map_count--; - free(map, M_DEVBUF); + free_domain(map, M_DEVBUF); } dmat->map_count--; CTR2(KTR_BUSDMA, "%s: tag %p error 0", __func__, dmat); @@ -386,9 +411,9 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void** vad *mapp = NULL; if (dmat->segments == NULL) { - dmat->segments = (bus_dma_segment_t *)malloc( + dmat->segments = (bus_dma_segment_t *)malloc_domain( sizeof(bus_dma_segment_t) * dmat->common.nsegments, - M_DEVBUF, mflags); + M_DEVBUF, dmat->common.domain, mflags); if (dmat->segments == NULL) { CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", __func__, dmat, dmat->common.flags, ENOMEM); @@ -427,18 +452,19 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void** vad (dmat->common.alignment <= dmat->common.maxsize) && dmat->common.lowaddr >= ptoa((vm_paddr_t)Maxmem) && attr == VM_MEMATTR_DEFAULT) { - *vaddr = malloc(dmat->common.maxsize, M_DEVBUF, mflags); + *vaddr = malloc_domain(dmat->common.maxsize, M_DEVBUF, + dmat->common.domain, mflags); } else if (dmat->common.nsegments >= howmany(dmat->common.maxsize, MIN(dmat->common.maxsegsz, PAGE_SIZE)) && dmat->common.alignment <= PAGE_SIZE && (dmat->common.boundary % PAGE_SIZE) == 0) { /* Page-based multi-segment allocations allowed */ - *vaddr = (void *)kmem_alloc_attr(kernel_arena, + *vaddr = (void *)kmem_alloc_attr_domain(dmat->common.domain, dmat->common.maxsize, mflags, 0ul, dmat->common.lowaddr, attr); dmat->bounce_flags |= BUS_DMA_KMEM_ALLOC; } else { - *vaddr = (void *)kmem_alloc_contig(kernel_arena, + *vaddr = (void *)kmem_alloc_contig_domain(dmat->common.domain, dmat->common.maxsize, mflags, 0ul, dmat->common.lowaddr, dmat->common.alignment != 0 ? dmat->common.alignment : 1ul, dmat->common.boundary, attr); @@ -471,7 +497,7 @@ bounce_bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr if (map != NULL) panic("bus_dmamem_free: Invalid map freed\n"); if ((dmat->bounce_flags & BUS_DMA_KMEM_ALLOC) == 0) - free(vaddr, M_DEVBUF); + free_domain(vaddr, M_DEVBUF); else kmem_free(kernel_arena, (vm_offset_t)vaddr, dmat->common.maxsize); @@ -1041,7 +1067,8 @@ alloc_bounce_zone(bus_dma_tag_t dmat) /* Check to see if we already have a suitable zone */ STAILQ_FOREACH(bz, &bounce_zone_list, links) { if ((dmat->common.alignment <= bz->alignment) && - (dmat->common.lowaddr >= bz->lowaddr)) { + (dmat->common.lowaddr >= bz->lowaddr) && + (dmat->common.domain == bz->domain)) { dmat->bounce_zone = bz; return (0); } @@ -1058,6 +1085,7 @@ alloc_bounce_zone(bus_dma_tag_t dmat) bz->lowaddr = dmat->common.lowaddr; bz->alignment = MAX(dmat->common.alignment, PAGE_SIZE); bz->map_count = 0; + bz->domain = dmat->common.domain; snprintf(bz->zoneid, 8, "zone%d", busdma_zonecount); busdma_zonecount++; snprintf(bz->lowaddrid, 18, "%#jx", (uintmax_t)bz->lowaddr); @@ -1103,6 +1131,10 @@ alloc_bounce_zone(bus_dma_tag_t dmat) SYSCTL_ADD_UAUTO(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "alignment", CTLFLAG_RD, &bz->alignment, ""); + SYSCTL_ADD_INT(busdma_sysctl_tree(bz), + SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, + "domain", CTLFLAG_RD, &bz->domain, 0, + "memory domain"); return (0); } @@ -1118,18 +1150,16 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages) while (numpages > 0) { struct bounce_page *bpage; - bpage = (struct bounce_page *)malloc(sizeof(*bpage), M_DEVBUF, - M_NOWAIT | M_ZERO); + bpage = (struct bounce_page *)malloc_domain(sizeof(*bpage), + M_DEVBUF, dmat->common.domain, M_NOWAIT | M_ZERO); if (bpage == NULL) break; - bpage->vaddr = (vm_offset_t)contigmalloc(PAGE_SIZE, M_DEVBUF, - M_NOWAIT, 0ul, - bz->lowaddr, - PAGE_SIZE, - 0); + bpage->vaddr = (vm_offset_t)contigmalloc_domain(PAGE_SIZE, + M_DEVBUF, dmat->common.domain, M_NOWAIT, 0ul, + bz->lowaddr, PAGE_SIZE, 0); if (bpage->vaddr == 0) { - free(bpage, M_DEVBUF); + free_domain(bpage, M_DEVBUF); break; } bpage->busaddr = pmap_kextract(bpage->vaddr); @@ -1271,6 +1301,7 @@ busdma_swi(void) struct bus_dma_impl bus_dma_bounce_impl = { .tag_create = bounce_bus_dma_tag_create, .tag_destroy = bounce_bus_dma_tag_destroy, + .tag_set_domain = bounce_bus_dma_tag_set_domain, .map_create = bounce_bus_dmamap_create, .map_destroy = bounce_bus_dmamap_destroy, .mem_alloc = bounce_bus_dmamem_alloc, @@ -1281,5 +1312,5 @@ struct bus_dma_impl bus_dma_bounce_impl = { .map_waitok = bounce_bus_dmamap_waitok, .map_complete = bounce_bus_dmamap_complete, .map_unload = bounce_bus_dmamap_unload, - .map_sync = bounce_bus_dmamap_sync + .map_sync = bounce_bus_dmamap_sync, }; Modified: head/sys/x86/x86/busdma_machdep.c ============================================================================== --- head/sys/x86/x86/busdma_machdep.c Fri Jan 12 23:25:05 2018 (r327900) +++ head/sys/x86/x86/busdma_machdep.c Fri Jan 12 23:34:16 2018 (r327901) @@ -43,8 +43,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include +#include +#include #include #include #include @@ -180,10 +184,27 @@ common_bus_dma_tag_create(struct bus_dma_tag_common *p common->filterarg = parent->filterarg; common->parent = parent->parent; } + common->domain = parent->domain; atomic_add_int(&parent->ref_count, 1); } + common->domain = vm_phys_domain_match(common->domain, 0ul, + common->lowaddr); *dmat = common; return (0); +} + +int +bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain) +{ + struct bus_dma_tag_common *tc; + + tc = (struct bus_dma_tag_common *)dmat; + domain = vm_phys_domain_match(domain, 0ul, tc->lowaddr); + /* Only call the callback if it changes. */ + if (domain == tc->domain) + return (0); + tc->domain = domain; + return (tc->impl->tag_set_domain(dmat)); } /* From owner-svn-src-head@freebsd.org Fri Jan 12 23:41:13 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CEC9EB2C1A; Fri, 12 Jan 2018 23:41:13 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 570CE337E; Fri, 12 Jan 2018 23:41:13 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 890A3297C; Fri, 12 Jan 2018 23:41:12 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0CNfCd2006442; Fri, 12 Jan 2018 23:41:12 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0CNfChp006441; Fri, 12 Jan 2018 23:41:12 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201801122341.w0CNfChp006441@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Fri, 12 Jan 2018 23:41:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327903 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 327903 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 23:41:13 -0000 Author: jeff Date: Fri Jan 12 23:41:12 2018 New Revision: 327903 URL: https://svnweb.freebsd.org/changeset/base/327903 Log: Fix compile error from r327900 Modified: head/sys/sys/busdma_bufalloc.h Modified: head/sys/sys/busdma_bufalloc.h ============================================================================== --- head/sys/sys/busdma_bufalloc.h Fri Jan 12 23:38:15 2018 (r327902) +++ head/sys/sys/busdma_bufalloc.h Fri Jan 12 23:41:12 2018 (r327903) @@ -113,7 +113,7 @@ struct busdma_bufzone * busdma_bufalloc_findzone(busdm * you can probably use these when you need uncacheable buffers. */ void * busdma_bufalloc_alloc_uncacheable(uma_zone_t zone, vm_size_t size, - uint8_t *pflag, int wait); + int domain, uint8_t *pflag, int wait); void busdma_bufalloc_free_uncacheable(void *item, vm_size_t size, uint8_t pflag); From owner-svn-src-head@freebsd.org Sat Jan 13 00:04:12 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6CAF6E601D4; Sat, 13 Jan 2018 00:04:12 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48498633F7; Sat, 13 Jan 2018 00:04:12 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 701EE2D1F; Sat, 13 Jan 2018 00:04:11 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0D04BLg016477; Sat, 13 Jan 2018 00:04:11 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0D04Bdu016476; Sat, 13 Jan 2018 00:04:11 GMT (envelope-from np@FreeBSD.org) Message-Id: <201801130004.w0D04Bdu016476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sat, 13 Jan 2018 00:04:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327904 - head/sys/dev/cxgbe/iw_cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/iw_cxgbe X-SVN-Commit-Revision: 327904 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 00:04:12 -0000 Author: np Date: Sat Jan 13 00:04:11 2018 New Revision: 327904 URL: https://svnweb.freebsd.org/changeset/base/327904 Log: cxgbe/iw_cxgbe: Remove duplicates to fix compilation with recent gcc. Modified: head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Modified: head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h ============================================================================== --- head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Fri Jan 12 23:41:12 2018 (r327903) +++ head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Sat Jan 13 00:04:11 2018 (r327904) @@ -899,8 +899,6 @@ typedef int (*c4iw_handler_func)(struct c4iw_dev *dev, int c4iw_ep_redirect(void *ctx, struct dst_entry *old, struct dst_entry *new, struct l2t_entry *l2t); -void c4iw_put_qpid(struct c4iw_rdev *rdev, u32 qpid, - struct c4iw_dev_ucontext *uctx); u32 c4iw_get_resource(struct c4iw_id_table *id_table); void c4iw_put_resource(struct c4iw_id_table *id_table, u32 entry); int c4iw_init_resource(struct c4iw_rdev *rdev, u32 nr_tpt, u32 nr_pdid); @@ -986,7 +984,6 @@ void __iomem *c4iw_bar2_addrs(struct c4iw_rdev *rdev, unsigned int *pbar2_qid, u64 *pbar2_pa); extern struct cxgb4_client t4c_client; extern c4iw_handler_func c4iw_handlers[NUM_CPL_CMDS]; -extern int c4iw_max_read_depth; #if defined(__i386__) || defined(__amd64__) #define L1_CACHE_BYTES 128 From owner-svn-src-head@freebsd.org Sat Jan 13 00:05:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67B9DE60315; Sat, 13 Jan 2018 00:05:32 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 438BA635AF; Sat, 13 Jan 2018 00:05:32 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83A742D2F; Sat, 13 Jan 2018 00:05:31 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0D05VQb016569; Sat, 13 Jan 2018 00:05:31 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0D05Vhk016568; Sat, 13 Jan 2018 00:05:31 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201801130005.w0D05Vhk016568@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 13 Jan 2018 00:05:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327905 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 327905 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 00:05:32 -0000 Author: mjg Date: Sat Jan 13 00:05:31 2018 New Revision: 327905 URL: https://svnweb.freebsd.org/changeset/base/327905 Log: rwlock: try regular read unlock even in the hard path Saves on turnstile trips if the lock got more readers. Modified: head/sys/kern/kern_rwlock.c Modified: head/sys/kern/kern_rwlock.c ============================================================================== --- head/sys/kern/kern_rwlock.c Sat Jan 13 00:04:11 2018 (r327904) +++ head/sys/kern/kern_rwlock.c Sat Jan 13 00:05:31 2018 (r327905) @@ -771,9 +771,9 @@ __rw_runlock_hard(struct rwlock *rw, struct thread *td turnstile_chain_lock(&rw->lock_object); v = RW_READ_VALUE(rw); retry_ts: - if (__predict_false(RW_READERS(v) > 1)) { + if (__rw_runlock_try(rw, td, &v)) { turnstile_chain_unlock(&rw->lock_object); - continue; + break; } v &= (RW_LOCK_WAITERS | RW_LOCK_WRITE_SPINNER); From owner-svn-src-head@freebsd.org Sat Jan 13 01:36:39 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06E8EE65DC3; Sat, 13 Jan 2018 01:36:39 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D70D26AE6D; Sat, 13 Jan 2018 01:36:38 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C0E94168; Sat, 13 Jan 2018 01:36:38 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0D1acm4054357; Sat, 13 Jan 2018 01:36:38 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0D1abhS054355; Sat, 13 Jan 2018 01:36:37 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201801130136.w0D1abhS054355@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 13 Jan 2018 01:36:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327906 - in head/sys: conf powerpc/mpc85xx X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys: conf powerpc/mpc85xx X-SVN-Commit-Revision: 327906 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 01:36:39 -0000 Author: jhibbits Date: Sat Jan 13 01:36:37 2018 New Revision: 327906 URL: https://svnweb.freebsd.org/changeset/base/327906 Log: Enable L2 cache on supported PowerQUICC and QorIQ platforms Some PowerQUICC and QorIQ platforms have a L2 cache managed via the memory-mapped configuration registers, and appear as a node in the device tree. This adds basic support to enable the cache. Added: head/sys/powerpc/mpc85xx/mpc85xx_cache.c (contents, props changed) Modified: head/sys/conf/files.powerpc Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Sat Jan 13 00:05:31 2018 (r327905) +++ head/sys/conf/files.powerpc Sat Jan 13 01:36:37 2018 (r327906) @@ -146,6 +146,7 @@ powerpc/mpc85xx/i2c.c optional iicbus fdt powerpc/mpc85xx/isa.c optional mpc85xx isa powerpc/mpc85xx/lbc.c optional mpc85xx powerpc/mpc85xx/mpc85xx.c optional mpc85xx +powerpc/mpc85xx/mpc85xx_cache.c optional mpc85xx powerpc/mpc85xx/mpc85xx_gpio.c optional mpc85xx gpio powerpc/mpc85xx/platform_mpc85xx.c optional mpc85xx powerpc/mpc85xx/pci_mpc85xx.c optional pci mpc85xx Added: head/sys/powerpc/mpc85xx/mpc85xx_cache.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/mpc85xx/mpc85xx_cache.c Sat Jan 13 01:36:37 2018 (r327906) @@ -0,0 +1,129 @@ +/*- + * Copyright (c) 2018 Justin Hibbits + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +/* + * From the P1022 manual, sequence for writing to L2CTL is: + * - mbar + * - isync + * - write + * - read + * - mbar + */ +#define L2_CTL 0x0 +#define L2CTL_L2E 0x80000000 +#define L2CTL_L2I 0x40000000 +struct mpc85xx_cache_softc { + struct resource *sc_mem; +}; + +static int +mpc85xx_cache_probe(device_t dev) +{ + + if (!ofw_bus_is_compatible(dev, "cache")) + return (ENXIO); + + device_set_desc(dev, "MPC85xx L2 cache"); + return (0); +} + +static int +mpc85xx_cache_attach(device_t dev) +{ + struct mpc85xx_cache_softc *sc = device_get_softc(dev); + int rid; + int cache_line_size, cache_size; + + /* Map registers. */ + rid = 0; + sc->sc_mem = bus_alloc_resource_any(dev, + SYS_RES_MEMORY, &rid, RF_ACTIVE); + if (sc->sc_mem == NULL) + return (ENOMEM); + + /* Enable cache and flash invalidate. */ + __asm __volatile ("mbar; isync" ::: "memory"); + bus_write_4(sc->sc_mem, L2_CTL, L2CTL_L2E | L2CTL_L2I); + bus_read_4(sc->sc_mem, L2_CTL); + __asm __volatile ("mbar" ::: "memory"); + + cache_line_size = 0; + cache_size = 0; + OF_getencprop(ofw_bus_get_node(dev), "cache-size", &cache_size, + sizeof(cache_size)); + OF_getencprop(ofw_bus_get_node(dev), "cache-line-size", + &cache_line_size, sizeof(cache_line_size)); + + if (cache_line_size != 0 && cache_size != 0) + device_printf(dev, + "L2 cache size: %dKB, cache line size: %d bytes\n", + cache_size / 1024, cache_line_size); + + return (0); +} + +static device_method_t mpc85xx_cache_methods[] = { + /* device methods */ + DEVMETHOD(device_probe, mpc85xx_cache_probe), + DEVMETHOD(device_attach, mpc85xx_cache_attach), + + DEVMETHOD_END +}; + +static driver_t mpc85xx_cache_driver = { + "cache", + mpc85xx_cache_methods, + sizeof(struct mpc85xx_cache_softc), +}; +static devclass_t mpc85xx_cache_devclass; + +EARLY_DRIVER_MODULE(mpc85xx_cache, simplebus, mpc85xx_cache_driver, + mpc85xx_cache_devclass, NULL, NULL, + BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); From owner-svn-src-head@freebsd.org Sat Jan 13 01:46:33 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2D0DE66901; Sat, 13 Jan 2018 01:46:33 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 90B846B6CE; Sat, 13 Jan 2018 01:46:32 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (astound-66-234-199-215.ca.astound.net [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 41F6310A7DB; Fri, 12 Jan 2018 20:46:31 -0500 (EST) From: John Baldwin To: Ed Maste Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r327783 - head/share/mk Date: Fri, 12 Jan 2018 17:46:22 -0800 Message-ID: <3584752.ozb5ohFTAi@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201801102028.w0AKS1UA000454@repo.freebsd.org> References: <201801102028.w0AKS1UA000454@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 12 Jan 2018 20:46:31 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 01:46:33 -0000 On Wednesday, January 10, 2018 08:28:01 PM Ed Maste wrote: > Author: emaste > Date: Wed Jan 10 20:28:01 2018 > New Revision: 327783 > URL: https://svnweb.freebsd.org/changeset/base/327783 > > Log: > Enable ld.lld as bootstrap linker by default on amd64 > > For some time we have been planning to migrate to LLVM's lld linker. > Having a man page was the last blocking issue for using ld.lld to link > the base system kernel + userland, now addressed by r327770. Link the > kernel and userland libraries and binaries with ld.lld by default, for > additional test coverage. > > This has been a long time in the making. On 2013-04-13 I submitted an > upstream tracking issue in LLVM PR 23214: [META] Using LLD as FreeBSD's > system linker. Since then 85 individual issues were identified, and > submitted as dependencies. These have been addressed along with two > and a half years of other lld development and improvement. > > I'd like to express deep gratitude to upstream lld developers Rui > Ueyama, Rafael Espindola, George Rimar and Davide Italiano. They put in > substantial effort in addressing the issues we found affecting > FreeBSD/amd64. > > To revert to using ld.bfd as the bootstrap linker, in /etc/src.conf set > > WITHOUT_LLD_BOOTSTRAP=yes > > If you need to set this, please follow up with a PR or post to the > freebsd-toolchain mailing list explaining how default WITH_LLD_BOOTSTRAP > failed for your use case. > > Note that GNU ld.bfd is still installed as /usr/bin/ld, and will still > be used for linking ports. ld.lld can be installed as /usr/bin/ld by > setting in /etc/src.conf > > WITH_LLD_IS_LLD=yes > > A followup commit will set WITH_LLD_IS_LD by default, possibly after > Clang/LLVM/lld 6.0 is merged to FreeBSD. > > Release notes: Yes > Sponsored by: The FreeBSD Foundation FYI, due to a quirk of how we load kernel modules on amd64 in such a way that doesn't really honor the ELF spec (but is self-consistent in the kernel and loader) and the fact that LLD doesn't sort sections the way BFD does, this change has confused kgdb such that it can compute different address for symbols. I dont think i386 is affected, only amd64. I've started on a fix, but my first attempt to boot it resulted in no modules loading anymore and it's time to go home for the day. :-P I'll try to resolve this early next week. If you need to use kgdb on amd64 with kernel modules, you will have to build with an external toolchain (the old ld.bfd can't cope with the kernel ifunc stuff). -- John Baldwin From owner-svn-src-head@freebsd.org Sat Jan 13 02:56:10 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5827E6BF25; Sat, 13 Jan 2018 02:56:10 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 97A766E709; Sat, 13 Jan 2018 02:56:10 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E74474F91; Sat, 13 Jan 2018 02:56:09 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0D2u9KY087031; Sat, 13 Jan 2018 02:56:09 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0D2u9fn087029; Sat, 13 Jan 2018 02:56:09 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201801130256.w0D2u9fn087029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 13 Jan 2018 02:56:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327907 - in head/sys: conf dev/fdt dev/ofw X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys: conf dev/fdt dev/ofw X-SVN-Commit-Revision: 327907 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 02:56:10 -0000 Author: jhibbits Date: Sat Jan 13 02:56:09 2018 New Revision: 327907 URL: https://svnweb.freebsd.org/changeset/base/327907 Log: Remove fdt fixups for powerpc, they are no longer needed. If a fixup really is needed, it should be fixed in u-boot, not in FreeBSD. Suggested by: nwhitehorn Deleted: head/sys/dev/fdt/fdt_powerpc.c Modified: head/sys/conf/files.powerpc head/sys/dev/ofw/ofw_fdt.c Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Sat Jan 13 01:36:37 2018 (r327906) +++ head/sys/conf/files.powerpc Sat Jan 13 02:56:09 2018 (r327907) @@ -31,7 +31,6 @@ dev/adb/adb_if.m optional adb dev/adb/adb_buttons.c optional adb dev/agp/agp_apple.c optional agp powermac dev/fb/fb.c optional sc -dev/fdt/fdt_powerpc.c optional fdt # ofwbus depends on simplebus. dev/fdt/simplebus.c optional aim | fdt dev/hwpmc/hwpmc_e500.c optional hwpmc Modified: head/sys/dev/ofw/ofw_fdt.c ============================================================================== --- head/sys/dev/ofw/ofw_fdt.c Sat Jan 13 01:36:37 2018 (r327906) +++ head/sys/dev/ofw/ofw_fdt.c Sat Jan 13 02:56:09 2018 (r327907) @@ -430,7 +430,7 @@ ofw_fdt_package_to_path(ofw_t ofw, phandle_t package, return (-1); } -#if defined(FDT_MARVELL) || defined(__powerpc__) +#if defined(FDT_MARVELL) static int ofw_fdt_fixup(ofw_t ofw) { @@ -477,7 +477,7 @@ ofw_fdt_fixup(ofw_t ofw) static int ofw_fdt_interpret(ofw_t ofw, const char *cmd, int nret, cell_t *retvals) { -#if defined(FDT_MARVELL) || defined(__powerpc__) +#if defined(FDT_MARVELL) int rv; /* From owner-svn-src-head@freebsd.org Sat Jan 13 03:09:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF4DEE6D8B1; Sat, 13 Jan 2018 03:09:06 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7FF146F628; Sat, 13 Jan 2018 03:09:06 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C808451D4; Sat, 13 Jan 2018 03:09:05 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0D395R6092298; Sat, 13 Jan 2018 03:09:05 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0D395nW092297; Sat, 13 Jan 2018 03:09:05 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201801130309.w0D395nW092297@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Sat, 13 Jan 2018 03:09:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327908 - head/sys/powerpc/ofw X-SVN-Group: head X-SVN-Commit-Author: nwhitehorn X-SVN-Commit-Paths: head/sys/powerpc/ofw X-SVN-Commit-Revision: 327908 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 03:09:06 -0000 Author: nwhitehorn Date: Sat Jan 13 03:09:05 2018 New Revision: 327908 URL: https://svnweb.freebsd.org/changeset/base/327908 Log: Chase removal of FDT fixup code on PowerPC in r327907. Modified: head/sys/powerpc/ofw/ofw_machdep.c Modified: head/sys/powerpc/ofw/ofw_machdep.c ============================================================================== --- head/sys/powerpc/ofw/ofw_machdep.c Sat Jan 13 02:56:09 2018 (r327907) +++ head/sys/powerpc/ofw/ofw_machdep.c Sat Jan 13 03:09:05 2018 (r327908) @@ -420,8 +420,6 @@ OF_bootstrap() return status; err = OF_init(fdt); - if (err == 0) - OF_interpret("perform-fixup", 0); } if (err != 0) { From owner-svn-src-head@freebsd.org Sat Jan 13 03:19:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FAD0E6E364; Sat, 13 Jan 2018 03:19:44 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from d.mail.sonic.net (d.mail.sonic.net [64.142.111.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D3E556FED2; Sat, 13 Jan 2018 03:19:43 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from comporellon.tachypleus.net (cpe-75-82-218-62.socal.res.rr.com [75.82.218.62]) (authenticated bits=0) by d.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id w0D39Efo007022 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Fri, 12 Jan 2018 19:09:15 -0800 Subject: Re: svn commit: r327907 - in head/sys: conf dev/fdt dev/ofw To: Justin Hibbits , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801130256.w0D2u9fn087029@repo.freebsd.org> From: Nathan Whitehorn Message-ID: Date: Fri, 12 Jan 2018 19:09:13 -0800 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <201801130256.w0D2u9fn087029@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Sonic-CAuth: UmFuZG9tSVZZAsxCmSbgNHVVbBhZuG7kuiCHjHqsxUgS7Ak2WJlzkROp1E1uECn1+1IgTxdlcV5PO6D6IqioiNpUlqj2ZGi0hZbKGolNF9U= X-Sonic-ID: C;iv9YIg/45xG+juBQ9eIpJw== M;fiXuIg/45xG+juBQ9eIpJw== X-Spam-Flag: No X-Sonic-Spam-Details: 0.0/5.0 by cerberusd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 03:19:44 -0000 Thanks, Justin! Since the fixup stuff is now only defined for FDT_MARVELL, it would be great if it could move to sys/arm/mv now instead of being in MI code. -Nathan On 01/12/18 18:56, Justin Hibbits wrote: > Author: jhibbits > Date: Sat Jan 13 02:56:09 2018 > New Revision: 327907 > URL: https://svnweb.freebsd.org/changeset/base/327907 > > Log: > Remove fdt fixups for powerpc, they are no longer needed. > > If a fixup really is needed, it should be fixed in u-boot, not in FreeBSD. > > Suggested by: nwhitehorn > > Deleted: > head/sys/dev/fdt/fdt_powerpc.c > Modified: > head/sys/conf/files.powerpc > head/sys/dev/ofw/ofw_fdt.c > > Modified: head/sys/conf/files.powerpc > ============================================================================== > --- head/sys/conf/files.powerpc Sat Jan 13 01:36:37 2018 (r327906) > +++ head/sys/conf/files.powerpc Sat Jan 13 02:56:09 2018 (r327907) > @@ -31,7 +31,6 @@ dev/adb/adb_if.m optional adb > dev/adb/adb_buttons.c optional adb > dev/agp/agp_apple.c optional agp powermac > dev/fb/fb.c optional sc > -dev/fdt/fdt_powerpc.c optional fdt > # ofwbus depends on simplebus. > dev/fdt/simplebus.c optional aim | fdt > dev/hwpmc/hwpmc_e500.c optional hwpmc > > Modified: head/sys/dev/ofw/ofw_fdt.c > ============================================================================== > --- head/sys/dev/ofw/ofw_fdt.c Sat Jan 13 01:36:37 2018 (r327906) > +++ head/sys/dev/ofw/ofw_fdt.c Sat Jan 13 02:56:09 2018 (r327907) > @@ -430,7 +430,7 @@ ofw_fdt_package_to_path(ofw_t ofw, phandle_t package, > return (-1); > } > > -#if defined(FDT_MARVELL) || defined(__powerpc__) > +#if defined(FDT_MARVELL) > static int > ofw_fdt_fixup(ofw_t ofw) > { > @@ -477,7 +477,7 @@ ofw_fdt_fixup(ofw_t ofw) > static int > ofw_fdt_interpret(ofw_t ofw, const char *cmd, int nret, cell_t *retvals) > { > -#if defined(FDT_MARVELL) || defined(__powerpc__) > +#if defined(FDT_MARVELL) > int rv; > > /* > From owner-svn-src-head@freebsd.org Sat Jan 13 03:41:50 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A113E6FAB8; Sat, 13 Jan 2018 03:41:50 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wr0-x236.google.com (mail-wr0-x236.google.com [IPv6:2a00:1450:400c:c0c::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C38F470E72; Sat, 13 Jan 2018 03:41:49 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wr0-x236.google.com with SMTP id 36so6949377wrh.1; Fri, 12 Jan 2018 19:41:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=SmRPBui1xfHgOIUwxk3vglukN3vaeEQrl1Z6fjF6n0U=; b=MYKxa7wvIs+Y+YI//eMFKC5g+MUZSf6CPoPpHKB/076vhQO6PKD3XnRl6f4rPne2sr ySXXFib4T19oD589z/FG/EGK8XO36e6cRyYeQEFEJwZslC7BjCx1AC3eTs58zWUNC4SP a+9k/V6WjtCdNaO0QZ2ldv0jP5OaUXkP4ut1pGPj25Z7EfMeCe689JKmp74ATA9/9nTf 7jabVVsbaY5InJL3NGzo/DAmWtxUKz2/lW+lu+anX82fvEZ2nswmapMtgIO8Iowb3Tp7 QJLaJgAmtAS2JAWH4zkQ0+jAj5DC+Tnfm+AAk5jS/9FC0DAug9BZrZCRESa8oFLFtci/ 3q6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=SmRPBui1xfHgOIUwxk3vglukN3vaeEQrl1Z6fjF6n0U=; b=gm94uBlKNF0x3UjnEYZH3VZ64zupjO2wmjdUMmw/wQObP1GHyBYTDm8yIuWXE9BI8O inrJ2rmE7e8n1SRl9aR2tXOf6I+Vybo+HrwC5lWvkg7P69CAzjbi9K5q/01V3ytobZmh lyudBHViyV+vm+HifBSNpc3PKGZ+Qt1NUkKqCqpdgakmKXddvLWWTjx1lxbTvcvBcCJ1 F+G9XbQ8TI7GtV9NPnNH373KkL9v8kK/ct/YC7uTb5zGAd9FE+wv4O/nRnKyqVBqT6So nbY+Mr/Hormx60KYnZBRb05xg/NPxLpAZ38FxbKDmDRSoW3wsdUSP2YEPS0Zw4/hCWMN HaIQ== X-Gm-Message-State: AKGB3mL0FjOHba4X3OS2BKqFpChz9l1OSyQALKeeex0KuX+tYwHHPG8G xHyVI8S8cQWnYhdOklCd8Rshj7/2Ej4G5gMZ7HCixQ== X-Google-Smtp-Source: ACJfBouGIr+CNR+U7zLl9BJOheqhV5/lBNE9q4wn1ihY1IO44fbhMuFaK+a6hU+4dJana6rMygYBwggoaIRsYJxJfO0= X-Received: by 10.223.190.142 with SMTP id i14mr18284854wrh.111.1515814906850; Fri, 12 Jan 2018 19:41:46 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.213.11 with HTTP; Fri, 12 Jan 2018 19:41:45 -0800 (PST) In-Reply-To: <3584752.ozb5ohFTAi@ralph.baldwin.cx> References: <201801102028.w0AKS1UA000454@repo.freebsd.org> <3584752.ozb5ohFTAi@ralph.baldwin.cx> From: Adrian Chadd Date: Fri, 12 Jan 2018 19:41:45 -0800 Message-ID: Subject: Re: svn commit: r327783 - head/share/mk To: John Baldwin Cc: Ed Maste , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 03:41:50 -0000 hi, can we just flip the switch back for now until it's figured out? Some of us have to like, do development on -HEAD for fun. :) -a On 12 January 2018 at 17:46, John Baldwin wrote: > On Wednesday, January 10, 2018 08:28:01 PM Ed Maste wrote: >> Author: emaste >> Date: Wed Jan 10 20:28:01 2018 >> New Revision: 327783 >> URL: https://svnweb.freebsd.org/changeset/base/327783 >> >> Log: >> Enable ld.lld as bootstrap linker by default on amd64 >> >> For some time we have been planning to migrate to LLVM's lld linker. >> Having a man page was the last blocking issue for using ld.lld to link >> the base system kernel + userland, now addressed by r327770. Link the >> kernel and userland libraries and binaries with ld.lld by default, for >> additional test coverage. >> >> This has been a long time in the making. On 2013-04-13 I submitted an >> upstream tracking issue in LLVM PR 23214: [META] Using LLD as FreeBSD's >> system linker. Since then 85 individual issues were identified, and >> submitted as dependencies. These have been addressed along with two >> and a half years of other lld development and improvement. >> >> I'd like to express deep gratitude to upstream lld developers Rui >> Ueyama, Rafael Espindola, George Rimar and Davide Italiano. They put in >> substantial effort in addressing the issues we found affecting >> FreeBSD/amd64. >> >> To revert to using ld.bfd as the bootstrap linker, in /etc/src.conf set >> >> WITHOUT_LLD_BOOTSTRAP=yes >> >> If you need to set this, please follow up with a PR or post to the >> freebsd-toolchain mailing list explaining how default WITH_LLD_BOOTSTRAP >> failed for your use case. >> >> Note that GNU ld.bfd is still installed as /usr/bin/ld, and will still >> be used for linking ports. ld.lld can be installed as /usr/bin/ld by >> setting in /etc/src.conf >> >> WITH_LLD_IS_LLD=yes >> >> A followup commit will set WITH_LLD_IS_LD by default, possibly after >> Clang/LLVM/lld 6.0 is merged to FreeBSD. >> >> Release notes: Yes >> Sponsored by: The FreeBSD Foundation > > FYI, due to a quirk of how we load kernel modules on amd64 in such a way that > doesn't really honor the ELF spec (but is self-consistent in the kernel and > loader) and the fact that LLD doesn't sort sections the way BFD does, this > change has confused kgdb such that it can compute different address for > symbols. I dont think i386 is affected, only amd64. I've started on a fix, > but my first attempt to boot it resulted in no modules loading anymore and > it's time to go home for the day. :-P I'll try to resolve this early next > week. If you need to use kgdb on amd64 with kernel modules, you will have > to build with an external toolchain (the old ld.bfd can't cope with the > kernel ifunc stuff). > > -- > John Baldwin > From owner-svn-src-head@freebsd.org Sat Jan 13 04:00:57 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09844E70A91; Sat, 13 Jan 2018 04:00:57 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D25BF71934; Sat, 13 Jan 2018 04:00:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0532C5A8A; Sat, 13 Jan 2018 04:00:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0D40tbo016317; Sat, 13 Jan 2018 04:00:55 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0D40tgZ016315; Sat, 13 Jan 2018 04:00:55 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801130400.w0D40tgZ016315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 13 Jan 2018 04:00:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327910 - in head/share: man/man5 mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/share: man/man5 mk X-SVN-Commit-Revision: 327910 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 04:00:57 -0000 Author: emaste Date: Sat Jan 13 04:00:55 2018 New Revision: 327910 URL: https://svnweb.freebsd.org/changeset/base/327910 Log: Revert r327823, Enable ld.lld as bootstrap linker by default on i386 There's a report of some regression in ports. Revert for now for an exp run for this change in isolation (previous lld exp run also included switching the linker used for ports to lld). Also revert the src.conf.5 regeneration in r327824. Reported by: antoine Sponsored by: The FreeBSD Foundation Modified: head/share/man/man5/src.conf.5 head/share/mk/src.opts.mk Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Sat Jan 13 03:12:21 2018 (r327909) +++ head/share/man/man5/src.conf.5 Sat Jan 13 04:00:55 2018 (r327910) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd January 11, 2018 +.Dd January 12, 2018 .Dt SRC.CONF 5 .Os .Sh NAME @@ -970,12 +970,12 @@ To be able to build the system, either Binutils or LLD enabled unless an alternate linker is provided via XLD. .Pp This is a default setting on -arm/arm, arm/armeb, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. +arm/arm, arm/armeb, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. .It Va WITH_LLD_BOOTSTRAP Set to build the LLD linker during the bootstrap phase of the build. .Pp This is a default setting on -amd64/amd64, arm64/aarch64 and i386/i386. +amd64/amd64 and arm64/aarch64. .It Va WITHOUT_LLD_IS_LD Set to use GNU binutils ld as the system linker, instead of LLVM's LLD. .Pp Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Sat Jan 13 03:12:21 2018 (r327909) +++ head/share/mk/src.opts.mk Sat Jan 13 04:00:55 2018 (r327910) @@ -253,7 +253,7 @@ __DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND .endif .if ${__T} == "aarch64" __DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD -.elif ${__T} == "amd64" || ${__T} == "i386" +.elif ${__T} == "amd64" __DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP __DEFAULT_NO_OPTIONS+=LLD_IS_LD .else From owner-svn-src-head@freebsd.org Sat Jan 13 04:09:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9BC6E71400; Sat, 13 Jan 2018 04:09:32 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x234.google.com (mail-io0-x234.google.com [IPv6:2607:f8b0:4001:c06::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7A29472009; Sat, 13 Jan 2018 04:09:32 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io0-x234.google.com with SMTP id e20so7952306iof.12; Fri, 12 Jan 2018 20:09:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=PAfcZBbgb8NIGr2akm8B0EMXS+gCpM8inKRMB3KJGmE=; b=EZAqg/+bO2VSWpUnVJGm9EvvNKVz5l2Vc2sT6VfeW9AXCjELRRKvzDkMPC4zultB77 OaZuM4NmvUdLB7yDL2oUotRxPQuxnhfaA5mt57hD5hd3m51BjiLdPkjmNyjfiQvz3dHN HuAeGH2rPnb1107dQSbwbzA+WFMA66pnsxtilAH6YN+NnTqg+acTOVy4l5pwF8rxJowk kiAmMVvmRgk5XI6+YhhqC5K6Zpdk320UahX+5ODYvmUsKLBu8ZK6gFjJseupq3I+MCns Ny5mpiGCqxjW7m2W6L4BTDjV9jfmj8bZrsHBJnAEAw88ehZMizm/1Gbbb+fkBUijVRXp fPgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=PAfcZBbgb8NIGr2akm8B0EMXS+gCpM8inKRMB3KJGmE=; b=lETQrf/8OniFJvMoopV9WunM30JUqSUcRxxBSlABUd1x01oX+04USQdcLjascbMo1N G/ED2YPdaXmqXvolixGXAlh20fGniSlHBQiyGTVxl8ww3MPBrSGsD0rb2xhbOTE9yMjt op4iBRrr/z10j7R9kxpsM14SFhCUa+6OAXjiewSe9GIXnF0turuBuEpHmW4XVr3Sy90J sZl2723Q9H1guVWtEo8Ij7CMuRLyVWYD/XyrAvhpB/aQgty9gpQBfB+RVmuZc7eNisBk JW5Ja/kOPBDtLn82HiQt4M8wQmDDqUIEaU+s4sBmSSHC7/2coPrFEF5u4LVqC39EMuIc rgEg== X-Gm-Message-State: AKwxytd54M5SugsVVP1ClPBy/+7SmNuWjgr/hzpYlMoFqOBBXws5Ha3Z sS6qoxTiaDE7ImyIuDSBILH9GNvZzN4dofFfqgHyRGrF X-Google-Smtp-Source: ACJfBotI43VWRpGQwEhwIMVJE7a+HPtycpZBQZe1cDdJPx52h2tRyE42LnqSzLpQ2fYOIFlx8AblIs3863Yub2TMvYo= X-Received: by 10.107.173.159 with SMTP id m31mr27087421ioo.36.1515816571583; Fri, 12 Jan 2018 20:09:31 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.131.163 with HTTP; Fri, 12 Jan 2018 20:09:11 -0800 (PST) In-Reply-To: References: <201801111403.w0BE353l047103@repo.freebsd.org> From: Ed Maste Date: Fri, 12 Jan 2018 23:09:11 -0500 X-Google-Sender-Auth: pXiHkIZuc0KOkkaeN5TswlrJivA Message-ID: Subject: Re: svn commit: r327823 - head/share/mk To: Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 04:09:32 -0000 On 12 January 2018 at 17:49, Antoine Brodin wrote: > On Thu, Jan 11, 2018 at 3:03 PM, Ed Maste wrote: >> Author: emaste >> Date: Thu Jan 11 14:03:05 2018 >> New Revision: 327823 >> URL: https://svnweb.freebsd.org/changeset/base/327823 >> >> Log: >> Enable ld.lld as bootstrap linker by default on i386 >> > Hi, > > There are some regressions in ports after this change, could you > revert it and request a proper exp-run? Reverted in r327910, exp-run request (for LLD_BOOTSTRAP without LLD_IS_LD) in PR 225128. Do you have a few examples of regressions? From owner-svn-src-head@freebsd.org Sat Jan 13 04:53:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9AA6FE73839; Sat, 13 Jan 2018 04:53:05 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 710BA73D06; Sat, 13 Jan 2018 04:53:05 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A33B664CE; Sat, 13 Jan 2018 04:53:04 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0D4r4dL038020; Sat, 13 Jan 2018 04:53:04 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0D4r4jD038019; Sat, 13 Jan 2018 04:53:04 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201801130453.w0D4r4jD038019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 13 Jan 2018 04:53:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327911 - head/lib/libpmc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/lib/libpmc X-SVN-Commit-Revision: 327911 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 04:53:05 -0000 Author: jhibbits Date: Sat Jan 13 04:53:04 2018 New Revision: 327911 URL: https://svnweb.freebsd.org/changeset/base/327911 Log: Replace the PMC class struct copy with an explicit memcpy() This should be effectively a nop for all archs, but for some reason the codegen difference on the PowerPC 970 is such that the struct assignment doesn't work (unless a printf() using one of the elements in the copied struct follows it), while the memcpy() succeeds. On all archs the memcpy() should be expanded to an inline copy, since the copy is bounded to ~16 bytes. MFC after: 3 weeks Modified: head/lib/libpmc/libpmc.c Modified: head/lib/libpmc/libpmc.c ============================================================================== --- head/lib/libpmc/libpmc.c Sat Jan 13 04:00:55 2018 (r327910) +++ head/lib/libpmc/libpmc.c Sat Jan 13 04:53:04 2018 (r327911) @@ -3270,7 +3270,8 @@ pmc_init(void) cpu_info.pm_npmc = op_cpu_info.pm_npmc; cpu_info.pm_nclass = op_cpu_info.pm_nclass; for (n = 0; n < cpu_info.pm_nclass; n++) - cpu_info.pm_classes[n] = op_cpu_info.pm_classes[n]; + memcpy(&cpu_info.pm_classes[n], &op_cpu_info.pm_classes[n], + sizeof(cpu_info.pm_classes[n])); pmc_class_table = malloc(PMC_CLASS_TABLE_SIZE * sizeof(struct pmc_class_descr *)); From owner-svn-src-head@freebsd.org Sat Jan 13 06:53:48 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD19BE787F5; Sat, 13 Jan 2018 06:53:48 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8EC627733B; Sat, 13 Jan 2018 06:53:48 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id DA2C4FEC7; Sat, 13 Jan 2018 06:53:47 +0000 (UTC) Date: Sat, 13 Jan 2018 06:53:47 +0000 From: Alexey Dokuchaev To: Ed Maste Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r327890 - head/usr.sbin/bsdinstall/partedit Message-ID: <20180113065347.GA26333@FreeBSD.org> References: <201801122025.w0CKPvVk022670@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201801122025.w0CKPvVk022670@repo.freebsd.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 06:53:48 -0000 On Fri, Jan 12, 2018 at 08:25:57PM +0000, Ed Maste wrote: > New Revision: 327890 > URL: https://svnweb.freebsd.org/changeset/base/327890 > > Log: > bsdinstall: disable SUJ by default > > SUJ + cg checksums produce spurious warnings after an unclean shutdown > (e.g. a crash). For now disable SUJ for UFS installs so installing from > a FreeBSD 12 snapshot results in a usable filesystem, until this can be > fixed. Thanks; I keep seeing it quite often. Is it safe to disable SUJ on already populated filesystem? Can (should) it better be done on live, mounted one, of better off the other booted instance of FreeBSD (from another media)? ./danfe From owner-svn-src-head@freebsd.org Sat Jan 13 08:16:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5289E7C832; Sat, 13 Jan 2018 08:16:11 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C11B97AED8; Sat, 13 Jan 2018 08:16:11 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 11C7A104FB; Sat, 13 Jan 2018 08:16:11 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0D8GAMM024088; Sat, 13 Jan 2018 08:16:10 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0D8GAfG024087; Sat, 13 Jan 2018 08:16:10 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201801130816.w0D8GAfG024087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 13 Jan 2018 08:16:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327912 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 327912 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 08:16:12 -0000 Author: cy Date: Sat Jan 13 08:16:10 2018 New Revision: 327912 URL: https://svnweb.freebsd.org/changeset/base/327912 Log: Though this block of code is not used by FreeBSD, correct a call to sprintf() with a macro call to SNPRINTF similar to other calls to SNPRINTF within this same block. MFC after: 1 week Modified: head/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c Modified: head/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c Sat Jan 13 04:53:04 2018 (r327911) +++ head/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c Sat Jan 13 08:16:10 2018 (r327912) @@ -2136,7 +2136,7 @@ ipf_p_ftp_eprt6(softf, fin, ip, nat, ftp, dlen) SNPRINTF(s, left, "%x:%x", a >> 16, a & 0xffff); left -= strlen(s); s += strlen(s); - sprintf(s, "|%d|\r\n", port); + SNPRINTF(s, left, "|%d|\r\n", port); #else (void) sprintf(s, "EPRT %c2%c", delim, delim); s += strlen(s); From owner-svn-src-head@freebsd.org Sat Jan 13 08:19:16 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3CD5EE7CB54; Sat, 13 Jan 2018 08:19:16 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id E0F4C7B152; Sat, 13 Jan 2018 08:19:15 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with ESMTPA id aH1ueuiePS7BpaH1vexi26; Sat, 13 Jan 2018 01:19:09 -0700 X-Authority-Analysis: v=2.2 cv=NKylwwyg c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=RgaUWeydRksA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=VSQ6hZaGqi40Q9fsQmUA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 95E0D3A7; Sat, 13 Jan 2018 00:19:06 -0800 (PST) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w0D8J6f7006350; Sat, 13 Jan 2018 00:19:06 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w0D8J6gn006347; Sat, 13 Jan 2018 00:19:06 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201801130819.w0D8J6gn006347@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Cy Schubert cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r327912 - head/sys/contrib/ipfilter/netinet In-Reply-To: Message from Cy Schubert of "Sat, 13 Jan 2018 08:16:10 +0000." <201801130816.w0D8GAfG024087@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 13 Jan 2018 00:19:06 -0800 X-CMAE-Envelope: MS4wfCXfxTudW2b2Oj2pY5fCGx6L7qRUcU0H8ZqFAVNvi8E4JaJI1LW6qk0p30IK6UM4OYDb2w1w0vXV8vLt2fqBdZwcHTHuJRtkp3LmmG886KxIOTYqQ7cz WPHvFH73o91R6amuzyftACvd8+lAJQx/RnuGldXJv9ppg+wCVGlx2k21o6ZC04MxMNoZlFxbRFAzrRVZBAhViW+AbVdzEYW3dVhsGgyHQ4LIK7ehBCZBE7DV 14Q2sF6iAk3rwApDRHC2uNAgaiOTJn7CvViyJBQ6j6U5jMwdWD5G0qSNBpReorVh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 08:19:16 -0000 In message <201801130816.w0D8GAfG024087@repo.freebsd.org>, Cy Schubert writes: > Author: cy > Date: Sat Jan 13 08:16:10 2018 > New Revision: 327912 > URL: https://svnweb.freebsd.org/changeset/base/327912 > > Log: > Though this block of code is not used by FreeBSD, correct a call to > sprintf() with a macro call to SNPRINTF similar to other calls to > SNPRINTF within this same block. > > MFC after: 1 week > > Modified: > head/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c > > Modified: head/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c > ============================================================================= > = > --- head/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c Sat Jan 13 04:53:04 201 > 8 (r327911) > +++ head/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c Sat Jan 13 08:16:10 201 > 8 (r327912) > @@ -2136,7 +2136,7 @@ ipf_p_ftp_eprt6(softf, fin, ip, nat, ftp, dlen) > SNPRINTF(s, left, "%x:%x", a >> 16, a & 0xffff); > left -= strlen(s); > s += strlen(s); > - sprintf(s, "|%d|\r\n", port); > + SNPRINTF(s, left, "|%d|\r\n", port); > #else > (void) sprintf(s, "EPRT %c2%c", delim, delim); > s += strlen(s); Lest anyone fret, sprintf --> snprintf for ipfilter is being worked on and is currently stashed in one of my working directories. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Sat Jan 13 08:28:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9206E7D417; Sat, 13 Jan 2018 08:28:47 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 844E17BC19; Sat, 13 Jan 2018 08:28:47 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C161F10699; Sat, 13 Jan 2018 08:28:46 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0D8SkH3028823; Sat, 13 Jan 2018 08:28:46 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0D8SkmK028822; Sat, 13 Jan 2018 08:28:46 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201801130828.w0D8SkmK028822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 13 Jan 2018 08:28:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327913 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 327913 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 08:28:47 -0000 Author: cy Date: Sat Jan 13 08:28:46 2018 New Revision: 327913 URL: https://svnweb.freebsd.org/changeset/base/327913 Log: Remove redundant variable. MFC after: 1 week Modified: head/sys/contrib/ipfilter/netinet/radix_ipf.c Modified: head/sys/contrib/ipfilter/netinet/radix_ipf.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/radix_ipf.c Sat Jan 13 08:16:10 2018 (r327912) +++ head/sys/contrib/ipfilter/netinet/radix_ipf.c Sat Jan 13 08:28:46 2018 (r327913) @@ -103,7 +103,6 @@ buildnodes(addr, mask, nodes) ipf_rdx_node_t nodes[2]; { u_32_t maskbits; - u_32_t lastbits; u_32_t lastmask; u_32_t *last; int masklen; @@ -117,7 +116,6 @@ buildnodes(addr, mask, nodes) masklen = last - (u_32_t *)mask; lastmask = *last; } - lastbits = maskbits & 0x1f; bzero(&nodes[0], sizeof(ipf_rdx_node_t) * 2); nodes[0].maskbitcount = maskbits; From owner-svn-src-head@freebsd.org Sat Jan 13 09:26:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1980E7FDBF; Sat, 13 Jan 2018 09:26:25 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC72D7DC77; Sat, 13 Jan 2018 09:26:25 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E3B7B11033; Sat, 13 Jan 2018 09:26:24 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0D9QODo053389; Sat, 13 Jan 2018 09:26:24 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0D9QOn9053388; Sat, 13 Jan 2018 09:26:24 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201801130926.w0D9QOn9053388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 13 Jan 2018 09:26:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327914 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 327914 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 09:26:25 -0000 Author: mjg Date: Sat Jan 13 09:26:24 2018 New Revision: 327914 URL: https://svnweb.freebsd.org/changeset/base/327914 Log: sx: retry hard shared unlock just like in r327905 for rwlocks Modified: head/sys/kern/kern_sx.c Modified: head/sys/kern/kern_sx.c ============================================================================== --- head/sys/kern/kern_sx.c Sat Jan 13 08:28:46 2018 (r327913) +++ head/sys/kern/kern_sx.c Sat Jan 13 09:26:24 2018 (r327914) @@ -1193,7 +1193,7 @@ _sx_sunlock_try(struct sx *sx, uintptr_t *xp) static void __noinline _sx_sunlock_hard(struct sx *sx, uintptr_t x LOCK_FILE_LINE_ARG_DEF) { - int wakeup_swapper; + int wakeup_swapper = 0; uintptr_t setx; if (SCHEDULER_STOPPED()) @@ -1213,6 +1213,9 @@ _sx_sunlock_hard(struct sx *sx, uintptr_t x LOCK_FILE_ for (;;) { MPASS(x & SX_LOCK_EXCLUSIVE_WAITERS); MPASS(!(x & SX_LOCK_SHARED_WAITERS)); + if (_sx_sunlock_try(sx, &x)) + break; + /* * Wake up semantic here is quite simple: * Just wake up all the exclusive waiters. From owner-svn-src-head@freebsd.org Sat Jan 13 11:59:50 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1E3BE5CAFB; Sat, 13 Jan 2018 11:59:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BD9AD82761; Sat, 13 Jan 2018 11:59:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A0BF1286A; Sat, 13 Jan 2018 11:59:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DBxnEW016240; Sat, 13 Jan 2018 11:59:49 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DBxnBd016239; Sat, 13 Jan 2018 11:59:49 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801131159.w0DBxnBd016239@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 13 Jan 2018 11:59:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327917 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 327917 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 11:59:51 -0000 Author: kib Date: Sat Jan 13 11:59:49 2018 New Revision: 327917 URL: https://svnweb.freebsd.org/changeset/base/327917 Log: Add sysctl debug.kdb.stack_overflow to conveniently test kernel handling of the kstack overflow. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/subr_kdb.c Modified: head/sys/kern/subr_kdb.c ============================================================================== --- head/sys/kern/subr_kdb.c Sat Jan 13 09:30:34 2018 (r327916) +++ head/sys/kern/subr_kdb.c Sat Jan 13 11:59:49 2018 (r327917) @@ -85,6 +85,7 @@ static int kdb_sysctl_enter(SYSCTL_HANDLER_ARGS); static int kdb_sysctl_panic(SYSCTL_HANDLER_ARGS); static int kdb_sysctl_trap(SYSCTL_HANDLER_ARGS); static int kdb_sysctl_trap_code(SYSCTL_HANDLER_ARGS); +static int kdb_sysctl_stack_overflow(SYSCTL_HANDLER_ARGS); static SYSCTL_NODE(_debug, OID_AUTO, kdb, CTLFLAG_RW, NULL, "KDB nodes"); @@ -110,6 +111,10 @@ SYSCTL_PROC(_debug_kdb, OID_AUTO, trap_code, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_SECURE, NULL, 0, kdb_sysctl_trap_code, "I", "set to cause a page fault via code access"); +SYSCTL_PROC(_debug_kdb, OID_AUTO, stack_overflow, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_SECURE, NULL, 0, + kdb_sysctl_stack_overflow, "I", "set to cause a stack overflow"); + SYSCTL_INT(_debug_kdb, OID_AUTO, break_to_debugger, CTLFLAG_RWTUN | CTLFLAG_SECURE, &kdb_break_to_debugger, 0, "Enable break to debugger"); @@ -224,6 +229,36 @@ kdb_sysctl_trap_code(SYSCTL_HANDLER_ARGS) (*fp)(0x11111111, 0x22222222, 0x33333333); return (0); } + +static void kdb_stack_overflow(volatile int *x) __noinline; +static void +kdb_stack_overflow(volatile int *x) +{ + + if (*x > 10000000) + return; + kdb_stack_overflow(x); + *x += PCPU_GET(cpuid) / 1000000; +} + +static int +kdb_sysctl_stack_overflow(SYSCTL_HANDLER_ARGS) +{ + int error, i; + volatile int x; + + error = sysctl_wire_old_buffer(req, sizeof(int)); + if (error == 0) { + i = 0; + error = sysctl_handle_int(oidp, &i, 0, req); + } + if (error != 0 || req->newptr == NULL) + return (error); + x = 0; + kdb_stack_overflow(&x); + return (0); +} + void kdb_panic(const char *msg) From owner-svn-src-head@freebsd.org Sat Jan 13 12:28:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45065E61EFE; Sat, 13 Jan 2018 12:28:29 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id C2E67838B3; Sat, 13 Jan 2018 12:28:28 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id DCBF4104B035; Sat, 13 Jan 2018 22:56:29 +1100 (AEDT) Date: Sat, 13 Jan 2018 22:56:29 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r327767 - in head/sys: conf i386/bios i386/conf i386/isa In-Reply-To: <201801101459.w0AExJWM055025@repo.freebsd.org> Message-ID: <20180113203848.L2336@besplex.bde.org> References: <201801101459.w0AExJWM055025@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=YbvN30Zf c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=kWmvSgFVWL--hNsEXKIA:9 a=FGfX17d0zrhrSsFC:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 12:28:29 -0000 On Wed, 10 Jan 2018, Warner Losh wrote: > Log: > Retire pmtimer driver. Move time fixing into apm driver. Move > Iwasaki-san's copyright over. Remove FIXME code that couldn't possibly > work. Call tc_settime() with our estimate of the delta we've been > alseep (the one we print) to adjust the time. Not sure what to do > about callouts, so keep the small #ifdef in place there. The FIXME code might have worked before timecounters, but never worked in any committed version. You seem to have updated it correctly for timecounters in this commit, but then broke it by removing it in a later commit (see another reply). This commit obfuscates the fix by combining moving of the file with changing it. svn is also very broken -- it doesn't show history of the file under its old name. This is more broken than usual -- since the file was merged into a different file, svn doesn't show history of the file under its new name either. The callout fixup code is more broken. It never compiled in any committed version, since it uses data structures and logic that went away before it was committed. The option for it (APM_FIXUP_CALLTODO) is so broken that it is not a supported option or in LINT, so it is not normally noticed that the code under it never compiled. Long callouts are especially broken. E.g., nanosleep(1 hour) at least used to sleep for 2 hours if the system is suspended for 1 hour during the sleep. I haven't noticed any fixes for this. Callouts mostly use relative timeouts, and relative timeouts just don't work across suspensions. Actually, I have noticed some fixes for nanosleep(). Another bug in it was that it is specified to sleep in the time specified by the clock id CLOCK_REALTIME, but used to sleep in the time specified by the clock id CLOCK_MONOTONIC (the latter should be as close as possible to the former except for leap seconds adjustments, but is quite broken -- it doesn't count suspended time, and non-leap seconds settings of CLOCK_REALTIME also make CLOCK_MONOTONIC useless for determining physical time differences. nanosleep() now sleeps on the correct clock id, and clock_nanosleep() is now implemented. This is complicated, and I haven't checked if the fix works. It looks to simple to work. To work, it needs to do things like adjust timers whenever the timecounter jumps (mainly for resume and leap seconds adjustments). APM_FIXUP_CALLTODO only tries to handle the easier case of resume. > Modified: head/sys/conf/files.i386 > ============================================================================== > --- head/sys/conf/files.i386 Wed Jan 10 14:58:58 2018 (r327766) > +++ head/sys/conf/files.i386 Wed Jan 10 14:59:19 2018 (r327767) > @@ -520,7 +520,6 @@ i386/ibcs2/ibcs2_util.c optional ibcs2 > i386/ibcs2/ibcs2_xenix.c optional ibcs2 > i386/ibcs2/ibcs2_xenix_sysent.c optional ibcs2 > i386/ibcs2/imgact_coff.c optional ibcs2 > -i386/isa/pmtimer.c optional pmtimer > i386/isa/prof_machdep.c optional profiling-routine > i386/linux/imgact_linux.c optional compat_linux > i386/linux/linux_dummy.c optional compat_linux pmtimer used to be needed all systems with acpi except amd64, because the acpi fixup of timecounters was bogusly ifdefed for amd64 only (or was not done by acpi in very old versions?). The pmtimer code for this fixup is still better tha the acpi code, except the FIXME made it unused and the next commit dumbs it down to worse than the acpi code (the acpi code is at least simpler). > Modified: head/sys/i386/bios/apm.c > ============================================================================== > --- head/sys/i386/bios/apm.c Wed Jan 10 14:58:58 2018 (r327766) > +++ head/sys/i386/bios/apm.c Wed Jan 10 14:59:19 2018 (r327767) > Modified: head/sys/i386/bios/apm.c > ============================================================================== > --- head/sys/i386/bios/apm.c Wed Jan 10 14:58:58 2018 (r327766) > +++ head/sys/i386/bios/apm.c Wed Jan 10 14:59:19 2018 (r327767) > @@ -205,7 +232,7 @@ static int > apm_driver_version(int version) > { > struct apm_softc *sc = &apm_softc; > - > + > sc->bios.r.eax = (APM_BIOS << 8) | APM_DRVVERSION; > sc->bios.r.ebx = 0x0; > sc->bios.r.ecx = version; Unrelated style fixes make the important changes harder to see. This patch was to remove trailing whitespace, but some mail program broke it by removing the whitespace in the source lines. [... further mangled patches for whitespace not shown] > @@ -331,12 +358,10 @@ apm_battery_low(void) > static struct apmhook * > apm_add_hook(struct apmhook **list, struct apmhook *ah) > { > - int s; > struct apmhook *p, *prev; > > APM_DPRINT("Add hook \"%s\"\n", ah->ah_name); > > - s = splhigh(); > if (ah == NULL) > panic("illegal apm_hook!"); > prev = NULL; > @@ -351,30 +376,25 @@ apm_add_hook(struct apmhook **list, struct apmhook *ah > ah->ah_next = prev->ah_next; > prev->ah_next = ah; > } > - splx(s); > return ah; > } This commit also removes spl*() with no mention of this in the log message. In FreeBSD-4 where spl's were not null, splhigh() was probably wrong, but it was much better than the splsoftclock() used in pmtimer.c. Hard clock interrupts should be disabled, and my fixes for this change softclock to statclock + XXX. It happens that splstatclock() == splclock() == splhigh(), so these splhigh()s were good enough. Now the locking is obscure. I think it is just Giant, and that is not enough. The spl's should not be removed until the locking is done properly. The splsoftclock()'s were removed even earlier in pmtimer.c, without doing any proper locking of course. > static void > apm_del_hook(struct apmhook **list, struct apmhook *ah) > { > - int s; > struct apmhook *p, *prev; > > - s = splhigh(); > prev = NULL; > for (p = *list; p != NULL; prev = p, p = p->ah_next) > if (p == ah) > goto deleteit; > panic("Tried to delete unregistered apm_hook."); > - goto nosuchnode; > + return; > deleteit: > if (prev != NULL) > prev->ah_next = p->ah_next; > else > *list = p->ah_next; > -nosuchnode: > - splx(s); > } Locking for device removal is especially necessary and badly done. New-bus forces lots of Giant locking which is probably not enough. > @@ -1047,6 +1067,53 @@ apm_processevent(void) > } while (apm_event != PMEV_NOEVENT); > } > > +static struct timeval suspend_time; > +static struct timeval diff_time; > + > +static int > +apm_rtc_suspend(void *arg __unused) > +{ > + > + microtime(&diff_time); > + inittodr(0); > + microtime(&suspend_time); > + timevalsub(&diff_time, &suspend_time); > + return (0); > +} This calculates the difference for use later, using a hackish method: - this used to be bogusly locked by - microtime(&diff_time) gives the current time in a good way - start hacking with inittodr(0). inittodr() reads the time from the RTC and adds the nasty global timezone offset to it. Without the latter, the new time set by inittodr() would be off by up to 12 hours. With the latter, it might still be off by 1 hour for a DST adjustment, depending on races between this and settimeofday(2) and adjkerntz(8) and certain racy sysctls, and it it is usually off by many seconds due to different drift of the RTC and the current time. The purpose of this function is to determine the drift at suspend time so as to add it back at resume time. This also handles timezone offsets even if inittodr() doesn't add them, and might reduce races for adjusting the timezone offset for DST. > + > +static int > +apm_rtc_resume(void *arg __unused) > +{ > + u_int second, minute, hour; > + struct timeval resume_time, tmp_time; > + struct timespec ts; > + > + /* modified for adjkerntz */ Cryptic comment from old code. This is related to the timezone offset, but I don't see how adjkerntz benefits in practice from old modifications made here. It only obviously benefits in theory from smaller races. > + timer_restore(); /* restore the all timers */ Old banal comment. timer_restore() function only exists on i386, and only restores 2 isa timers (i8254 and rtc), so moving its code out of isa is a layering violation. > + inittodr(0); /* adjust time to RTC */ Banal comment. Also wrong when the RTC time is local. > + microtime(&resume_time); > + getmicrotime(&tmp_time); The previous line is bad old code. We want to do arithmetic using resume_time and should copy it to tmp_time. Instead, we use the getmicrotime() mistake to fetch a truncated copy of a time slightly later than resume_time. > + timevaladd(&tmp_time, &diff_time); diff_time is the difference at suspend time and this adds it to resume_time (modulo the truncation). This gives correct-as-possible resume_time. > + /* Calculate the delta time suspended */ > + timevalsub(&resume_time, &suspend_time); > + > + second = ts.tv_sec = resume_time.tv_sec; > + ts.tv_nsec = 0; > + tc_setclock(&ts); This used to be better, except tc_setclock() was 'time = tmp_time' under FIXME. The calculation of the time suspended is convolved with fixing up the timecounter, and there is a comment about the relatively simple calculation of the time suspended and none about the convulutions or the more delicate fixup. > + > +#ifdef PMTIMER_FIXUP_CALLTODO > + /* Fixup the calltodo list with the delta time. */ > + adjust_timeout_calltodo(&resume_time); > +#endif /* PMTIMER_FIXUP_CALLTODO */ This has several style bugs together with its option being unusable. It further abuses resume_time. resume_time was initially actually the resume time before the fixup. The fixed up resume time is now in ts. We calculated this using tmp_time to keep the initial resume_time alive for using in another caclulation. Then the other calculation abuses resume_time for the delta time needed by the uncallable fixup. The comment unobfuscates this a but by describing the abused resume_time as the delta time. > + hour = second / 3600; > + second %= 3600; > + minute = second / 60; > + second %= 60; > + log(LOG_NOTICE, "wakeup from sleeping state (slept %02d:%02d:%02d)\n", > + hour, minute, second); > + return (0); With the FIXME version, almost everything was unused except for printing this msssage. This message is useful for debugging, but acpi never bothered doing it. > +} In the version with the FIXME, the careful fixups done by pmtimer reduce to just inittodr(0) plus printing the delta. In this version, the timecounter fixup actually works so the careful setup for this is undone, but things are convoluted with the unreachale callout fixup and printing the delta. acpi just does 2 timecounter warmups followed by inittodr(time_second + scp->acpi_sleep_delay). Here the arg is differently wrong. An arg of 0 says that we have no idea of the time and the raw RTC time should be used. time_second is the time in seconds before the system is fully resumed. This is probably the time in seconds when the system was suspended (since interrupts didn't run during suspension and if clock interrupts occurred before here, they would do nothing good. acpi_sleep_delay is just a forced delay during suspension. If it works at all, then updates of time_second have halted before the delay, and the arg is our best guess of the actual suspension time. IIRC, the arg is only used in the unlikely event that reading the RTC fails. pmtimer doesn't bother passing a nonzero arg. Bugs here are masked by other bugs: - at least x86 RTC-reading code is sloppy and only reads the RTC to the nearest second. So we expect an error of a second or 2 after suspend/ resume. This is too large for ntpd to fix well, so the best that can happen (without a resume script that repeats boot time ntpd initialization) is that ntpd is running and quickly notices that the offset is too large and steps the clock to fix it. Backwards steps are very bad, so the resume code should try to set to an earlier time. - when nptd is running, the current time may have been written to the RTC quite often. This probably keeps the timecounter fixup less than a few seconds although x86 RTC-writing code is sloppy and gives another source of errors. - if an error related to the timezone offset occurs or if the timecounter fixup is not applied, then the enormous error from this might be a feature. Hopefully ntpd is running and recovers faster if the error is enormous. (I think it actually doesn't do this right. It has a limit like 900 seconds and can step more than that to act a but like ntpdate when invoked with certain options, but you normally want it to do only 1 large step. Restarting it with these options after every resume is best.) Bruce From owner-svn-src-head@freebsd.org Sat Jan 13 13:38:17 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BE6CE65997; Sat, 13 Jan 2018 13:38:17 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id 0561821C0; Sat, 13 Jan 2018 13:38:16 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id 073A61A60D9; Sun, 14 Jan 2018 00:17:51 +1100 (AEDT) Date: Sun, 14 Jan 2018 00:17:51 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r327774 - in head: . sys/i386/bios In-Reply-To: <201801101725.w0AHP8Ca020379@repo.freebsd.org> Message-ID: <20180113225638.Q2336@besplex.bde.org> References: <201801101725.w0AHP8Ca020379@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=YbvN30Zf c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=E3LQvFw-N6LwsXHdYfEA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 13:38:17 -0000 On Wed, 10 Jan 2018, Warner Losh wrote: > Log: > inittodr(0) actually sets the time, so there's no need to call > tc_setclock(). It's redundant. Tweak UPDATING based on code review of > past releases. No, tc_setclock() is not redundant (except for bugs). initodr(0) sets a raw RTC time (plus a racy timezone offset). tc_setclock() is supposed to fix this up to a less raw time using calculations done at suspend time. The calculations are still done, so are even more bogus then when the fixup was null under FIXME (then the FIXME a least indicated what needed to be done). > Modified: head/UPDATING > ============================================================================== > --- head/UPDATING Wed Jan 10 16:56:02 2018 (r327773) > +++ head/UPDATING Wed Jan 10 17:25:08 2018 (r327774) > @@ -53,8 +53,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: > > 20180110: > On i386, pmtimer has been removed. It's functionality has been folded > - into apm. It was a nop on ACPI. Users may need to remove it from kernel > - config files. > + into apm. It was a nop on ACPI in current for a while now (but was still > + needed on i386 in FreeBSD 11 and earlier). Users may need to remove it > + from kernel config files. It is indeed still needed in FreeBSD-11. acpci resume is still broken there on all arches except amd64, by bogusly ifdefing acpi_resync_clock() to do nothing except on amd64 (and even on amd64, there is a sysctl to give the same brokenness). pmtimer was made a no-op if acpi is configured in the same commit that fixed acpi resume. > Modified: head/sys/i386/bios/apm.c > ============================================================================== > --- head/sys/i386/bios/apm.c Wed Jan 10 16:56:02 2018 (r327773) > +++ head/sys/i386/bios/apm.c Wed Jan 10 17:25:08 2018 (r327774) > @@ -1086,7 +1086,6 @@ apm_rtc_resume(void *arg __unused) > { > u_int second, minute, hour; > struct timeval resume_time, tmp_time; > - struct timespec ts; > > /* modified for adjkerntz */ > timer_restore(); /* restore the all timers */ > @@ -1097,14 +1096,11 @@ apm_rtc_resume(void *arg __unused) > /* Calculate the delta time suspended */ > timevalsub(&resume_time, &suspend_time); > > - second = ts.tv_sec = resume_time.tv_sec; > - ts.tv_nsec = 0; > - tc_setclock(&ts); > - The carefully calculated tmp_time is no longer used. It wasn't used before either, since ts was initialized to a wrong value. tmp_time was last used under FIXME, but that shouldn't have compiled either since FIXME was undefineable -- tmp_time as a write-only auto variable in all cases. The non-use of some of the other timestamp variables is harder to detect since they are static. tc_setclock() takes a delta-time as an arg. resume_time is already a delta-time, but I think it is complete garbage. resume_time was initially actually the resume time, but is abused to hole the suspension interval (delta-time). inittodr(0) already advanced the timecounter by approximately the suspension interval, and inittodr(&ts) gives a garbage time by advancing by this again. I think the correct second advance is simply diff_time which was calculated earlier. The dead tmp_time is + diff_time. This was only used in the unreachable FIXME code because the "API" for that needed an absolute time. Untested fixes: X Index: apm.c X =================================================================== X --- apm.c (revision 327911) X +++ apm.c (working copy) X @@ -1067,17 +1067,17 @@ X } while (apm_event != PMEV_NOEVENT); X } X X -static struct timeval suspend_time; X -static struct timeval diff_time; X +static struct timespec diff_time; X +static struct timespec suspend_time; X X static int X apm_rtc_suspend(void *arg __unused) X { X X - microtime(&diff_time); X - inittodr(0); X - microtime(&suspend_time); X - timevalsub(&diff_time, &suspend_time); X + nanotime(&diff_time); /* not a difference yet */ X + inittodr(0); /* set tc to raw time seen by RTC */ X + nanotime(&suspend_time); /* record this raw time */ X + timespecsub(&diff_time, &suspend_time); /* diff between tc and RTC */ X return (0); X } X X @@ -1084,23 +1084,22 @@ X static int X apm_rtc_resume(void *arg __unused) X { X + struct timespec resume_time, suspend_interval; X u_int second, minute, hour; This already changes too much, so I didn't fix blind truncation of tv_sec starting in 2038 or other type botches for second/minute/hour. X - struct timeval resume_time, tmp_time; X X - /* modified for adjkerntz */ X - timer_restore(); /* restore the all timers */ X - inittodr(0); /* adjust time to RTC */ X - microtime(&resume_time); X - getmicrotime(&tmp_time); X - timevaladd(&tmp_time, &diff_time); X + timer_restore(); X + inittodr(0); /* set tc to new raw RTC time */ X + nanotime(&resume_time); /* record this raw time */ X + tc_setclock(&diff_time); /* restore old diff to tc */ Fixing tc_setclock() is the easiest part. X + X /* Calculate the delta time suspended */ X - timevalsub(&resume_time, &suspend_time); X + suspend_interval = resume_time; X + timevalsub(&suspend_interval, &suspend_time); There are to many comments. I forgot to remove the one above after unobfuscating resume_time. X X -#ifdef PMTIMER_FIXUP_CALLTODO X - /* Fixup the calltodo list with the delta time. */ X - adjust_timeout_calltodo(&resume_time); X -#endif /* PMTIMER_FIXUP_CALLTODO */ X - second = resume_time.tv_sec; X +#ifdef PMTIMER_FIXUP_CALLTODO /* XXX needed unconditionally, but never worked */ X + adjust_timeout_calltodo(&suspend_interval); X +#endif X + second = suspend_interval.tv_sec; X hour = second / 3600; X second %= 3600; X minute = second / 60; Bruce From owner-svn-src-head@freebsd.org Sat Jan 13 13:59:36 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 861E9E66A8D; Sat, 13 Jan 2018 13:59:36 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 600BA2E61; Sat, 13 Jan 2018 13:59:36 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9729B13BE7; Sat, 13 Jan 2018 13:59:35 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DDxZiD067492; Sat, 13 Jan 2018 13:59:35 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DDxZur067490; Sat, 13 Jan 2018 13:59:35 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201801131359.w0DDxZur067490@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 13 Jan 2018 13:59:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327919 - head/usr.bin/truss X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/usr.bin/truss X-SVN-Commit-Revision: 327919 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 13:59:36 -0000 Author: tuexen Date: Sat Jan 13 13:59:35 2018 New Revision: 327919 URL: https://svnweb.freebsd.org/changeset/base/327919 Log: Add support for readv() and writev() to truss. Sponsored by: Netflix, Inc. Modified: head/usr.bin/truss/syscall.h head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscall.h ============================================================================== --- head/usr.bin/truss/syscall.h Sat Jan 13 13:53:05 2018 (r327918) +++ head/usr.bin/truss/syscall.h Sat Jan 13 13:59:35 2018 (r327919) @@ -82,7 +82,7 @@ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHe Sockoptname, Msgflags, CapRights, PUInt, PQuadHex, Acltype, Extattrnamespace, Minherit, Mlockall, Mountflags, Msync, Priowhich, Ptraceop, Quotactlcmd, Reboothowto, Rtpriofunc, Schedpolicy, Schedparam, - PSig, Siginfo, Kevent11, + PSig, Siginfo, Kevent11, Iovec, CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags, CloudABIFDStat, CloudABIFileStat, CloudABIFileType, Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Sat Jan 13 13:53:05 2018 (r327918) +++ head/usr.bin/truss/syscalls.c Sat Jan 13 13:59:35 2018 (r327919) @@ -386,6 +386,8 @@ static struct syscall decoded_syscalls[] = { .args = { { Name, 0 }, { Quotactlcmd, 1 }, { Int, 2 }, { Ptr, 3 } } }, { .name = "read", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { BinString | OUT, 1 }, { Sizet, 2 } } }, + { .name = "readv", .ret_type = 1, .nargs = 3, + .args = { { Int, 0 }, { Iovec, 1 }, { Int, 2 } } }, { .name = "readlink", .ret_type = 1, .nargs = 3, .args = { { Name, 0 }, { Readlinkres | OUT, 1 }, { Sizet, 2 } } }, { .name = "readlinkat", .ret_type = 1, .nargs = 4, @@ -520,6 +522,8 @@ static struct syscall decoded_syscalls[] = { { Siginfo | OUT, 5 } } }, { .name = "write", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { BinString | IN, 1 }, { Sizet, 2 } } }, + { .name = "writev", .ret_type = 1, .nargs = 3, + .args = { { Int, 0 }, { Iovec, 1 }, { Int, 2 } } }, /* Linux ABI */ { .name = "linux_access", .ret_type = 1, .nargs = 2, @@ -2137,6 +2141,68 @@ print_arg(struct syscall_args *sc, unsigned long *args fprintf(fp, " }"); } else fprintf(fp, "0x%lx", args[sc->offset]); + break; + } +#define IOV_LIMIT 26 + case Iovec: { + /* + * Print argument as an array of struct iovec, where the next + * syscall argument is the number of elements of the array. + */ + struct iovec iov[IOV_LIMIT]; + size_t max_string = trussinfo->strsize; + char tmp2[max_string + 1], *tmp3; + size_t len; + int i, iovcnt; + bool buf_truncated, iov_truncated; + + iovcnt = args[sc->offset + 1]; + if (iovcnt <= 0) { + fprintf(fp, "0x%lx", args[sc->offset]); + break; + } + if (iovcnt > IOV_LIMIT) { + iovcnt = IOV_LIMIT; + iov_truncated = true; + } else { + iov_truncated = false; + } + if (get_struct(pid, (void *)args[sc->offset], + &iov, iovcnt * sizeof(struct iovec)) == -1) { + fprintf(fp, "0x%lx", args[sc->offset]); + break; + } + + fprintf(fp, "%s", "["); + for (i = 0; i < iovcnt; i++) { + len = iov[i].iov_len; + if (len > max_string) { + len = max_string; + buf_truncated = true; + } else { + buf_truncated = false; + } + fprintf(fp, "%s{", (i > 0) ? "," : ""); + if (len && get_struct(pid, iov[i].iov_base, &tmp2, len) + != -1) { + tmp3 = malloc(len * 4 + 1); + while (len) { + if (strvisx(tmp3, tmp2, len, + VIS_CSTYLE|VIS_TAB|VIS_NL) <= + (int)max_string) + break; + len--; + buf_truncated = true; + } + fprintf(fp, "\"%s\"%s", tmp3, + buf_truncated ? "..." : ""); + free(tmp3); + } else { + fprintf(fp, "0x%p", iov[i].iov_base); + } + fprintf(fp, ",%zu}", iov[i].iov_len); + } + fprintf(fp, "%s%s", iov_truncated ? ",..." : "", "]"); break; } From owner-svn-src-head@freebsd.org Sat Jan 13 14:10:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D558E68589; Sat, 13 Jan 2018 14:10:47 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EE4B637C9; Sat, 13 Jan 2018 14:10:46 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A56A13DA0; Sat, 13 Jan 2018 14:10:46 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DEAjdS072417; Sat, 13 Jan 2018 14:10:45 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DEAjn9072416; Sat, 13 Jan 2018 14:10:45 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201801131410.w0DEAjn9072416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 13 Jan 2018 14:10:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327921 - head/usr.bin/truss X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/usr.bin/truss X-SVN-Commit-Revision: 327921 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 14:10:47 -0000 Author: tuexen Date: Sat Jan 13 14:10:45 2018 New Revision: 327921 URL: https://svnweb.freebsd.org/changeset/base/327921 Log: Fix a typo introduced in r327919. Modified: head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Sat Jan 13 14:10:05 2018 (r327920) +++ head/usr.bin/truss/syscalls.c Sat Jan 13 14:10:45 2018 (r327921) @@ -2143,7 +2143,7 @@ print_arg(struct syscall_args *sc, unsigned long *args fprintf(fp, "0x%lx", args[sc->offset]); break; } -#define IOV_LIMIT 26 +#define IOV_LIMIT 16 case Iovec: { /* * Print argument as an array of struct iovec, where the next From owner-svn-src-head@freebsd.org Sat Jan 13 14:10:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46EA9E68592; Sat, 13 Jan 2018 14:10:47 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 20AA237CA; Sat, 13 Jan 2018 14:10:47 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 53E3A13DA1; Sat, 13 Jan 2018 14:10:46 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DEAkUG072429; Sat, 13 Jan 2018 14:10:46 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DEAkLE072428; Sat, 13 Jan 2018 14:10:46 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201801131410.w0DEAkLE072428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 13 Jan 2018 14:10:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327922 - head/sys/dev/mmc/host X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/mmc/host X-SVN-Commit-Revision: 327922 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 14:10:47 -0000 Author: manu Date: Sat Jan 13 14:10:45 2018 New Revision: 327922 URL: https://svnweb.freebsd.org/changeset/base/327922 Log: dwmmc_hisi: Fix build when option MMCCAM is defined Modified: head/sys/dev/mmc/host/dwmmc_hisi.c Modified: head/sys/dev/mmc/host/dwmmc_hisi.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc_hisi.c Sat Jan 13 14:10:45 2018 (r327921) +++ head/sys/dev/mmc/host/dwmmc_hisi.c Sat Jan 13 14:10:45 2018 (r327922) @@ -41,6 +41,8 @@ __FBSDID("$FreeBSD$"); #include +#include "opt_mmccam.h" + static device_probe_t hisi_dwmmc_probe; static device_attach_t hisi_dwmmc_attach; From owner-svn-src-head@freebsd.org Sat Jan 13 15:04:09 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77EC1E6D77A for ; Sat, 13 Jan 2018 15:04:09 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic302-35.consmr.mail.gq1.yahoo.com (sonic302-35.consmr.mail.gq1.yahoo.com [98.137.68.161]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F72268D36 for ; Sat, 13 Jan 2018 15:04:09 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1515855847; bh=Yxmxw+15H3urifUvE8WdrAXawTgyy4sj0j25Zx/QrYo=; h=Subject:To:References:From:Date:In-Reply-To:From:Subject; b=YVe2NYwhO+p8WdSWwrKPlYkBSyqlFBYHSlG1M1wq0aH41rK/bTgH10eJG/CK/UxpbZ45I6QTJPfPLSJIs4VBSl+vSQzA1PlIyRbpRh7vn+mKnj1dpSqdnPGqkU+gdRf9mhd5yZrAz5wqAVzgCGuFYSb8brCtcoWXvg9q/2pHmtS7LbGxrMrG6A3IoSQCmSkzRqxP9+Pu272CIMkmiJygOMjB78oEtkZNf3W4ZNtkiBkL+icRpkh6ngfz6oPvCPK081qZ9gn1kqV5FrxOeHFflU7P+Y12fS/JBOS8HgXMWCAP96NZlH7Fr9NR3pBuWbdOec3gu5wWBI+bMX7EuiTMEQ== X-YMail-OSG: _V4LkeYVM1n4o26SVaiMSiN5tC0YFGPxpZj6SJNgeav5DYc5NPUJfIpkUl7bjvv 5V8FtZUo3rKcRWkDvmMPszPfrjpDyshj4ItbLOIQ839zZQ4wSb.cDsYNa0mzsj2hcJggyaN695jb 4042JwZoO8UnD79dKd2dGxT9qFF16q6fzbE.keI4ETIs6sTH770IMyQn4XSr90UAlr9A5aVSNvJy ZqrxBGf_SOMlndgkkv2.VJLM4amJyDNr9VixMOD7bDlALhl3wI9V7hRA1odn0XSJ_ROKscW9IxL1 MAJfR.P_a9rygLssaQTY4w73A4wAiW86O_kBtw1vyTpA56IL_iEozQP0B8BOUqopV7YjwsU3AQKp 2AjrC_tiwQ440fhphwnh6JsDx3I2wuVGOM1DKCizoDeVmRuz32jBJ35Y_5QpDPyxDCtmyVdpbqjG RNiXM.S5hUT4I4rJrA2VFA5lgkimSzah9ElY98WFEXw0a.zqf7YqpJwA_iffN4N0JSXSQiBCT Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.gq1.yahoo.com with HTTP; Sat, 13 Jan 2018 15:04:07 +0000 Received: from smtpgate104.mail.gq1.yahoo.com (EHLO [192.168.0.8]) ([10.215.136.172]) by smtp415.mail.gq1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID c6059abbb4b6d80597dfb2aa1b7eec8c; Sat, 13 Jan 2018 15:04:05 +0000 (UTC) Subject: Re: svn commit: r327906 - in head/sys: conf powerpc/mpc85xx To: Justin Hibbits , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801130136.w0D1abhS054355@repo.freebsd.org> From: Pedro Giffuni Organization: FreeBSD Project Message-ID: <40f39e41-f051-0758-fe15-55c1dab64c9c@FreeBSD.org> Date: Sat, 13 Jan 2018 10:04:05 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <201801130136.w0D1abhS054355@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 15:04:09 -0000 On 12/01/2018 20:36, Justin Hibbits wrote: > Author: jhibbits > Date: Sat Jan 13 01:36:37 2018 > New Revision: 327906 > URL: https://svnweb.freebsd.org/changeset/base/327906 > ... > > Added: head/sys/powerpc/mpc85xx/mpc85xx_cache.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/powerpc/mpc85xx/mpc85xx_cache.c Sat Jan 13 01:36:37 2018 (r327906) > @@ -0,0 +1,129 @@ > +/*- > + * Copyright (c) 2018 Justin Hibbits > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > + Can we please add SPDX ID tags, specially on new code? I had them added to the guidelines: https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/pref-license.html It is just not fun for me anymore to go hunting for untagged files and they keep appearing ;). Pedro. > +#include > +__FBSDID("$FreeBSD$"); > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > + > +#include > +#include > +#include > + > +/* > + * From the P1022 manual, sequence for writing to L2CTL is: > + * - mbar > + * - isync > + * - write > + * - read > + * - mbar > + */ > +#define L2_CTL 0x0 > +#define L2CTL_L2E 0x80000000 > +#define L2CTL_L2I 0x40000000 > +struct mpc85xx_cache_softc { > + struct resource *sc_mem; > +}; > + > +static int > +mpc85xx_cache_probe(device_t dev) > +{ > + > + if (!ofw_bus_is_compatible(dev, "cache")) > + return (ENXIO); > + > + device_set_desc(dev, "MPC85xx L2 cache"); > + return (0); > +} > + > +static int > +mpc85xx_cache_attach(device_t dev) > +{ > + struct mpc85xx_cache_softc *sc = device_get_softc(dev); > + int rid; > + int cache_line_size, cache_size; > + > + /* Map registers. */ > + rid = 0; > + sc->sc_mem = bus_alloc_resource_any(dev, > + SYS_RES_MEMORY, &rid, RF_ACTIVE); > + if (sc->sc_mem == NULL) > + return (ENOMEM); > + > + /* Enable cache and flash invalidate. */ > + __asm __volatile ("mbar; isync" ::: "memory"); > + bus_write_4(sc->sc_mem, L2_CTL, L2CTL_L2E | L2CTL_L2I); > + bus_read_4(sc->sc_mem, L2_CTL); > + __asm __volatile ("mbar" ::: "memory"); > + > + cache_line_size = 0; > + cache_size = 0; > + OF_getencprop(ofw_bus_get_node(dev), "cache-size", &cache_size, > + sizeof(cache_size)); > + OF_getencprop(ofw_bus_get_node(dev), "cache-line-size", > + &cache_line_size, sizeof(cache_line_size)); > + > + if (cache_line_size != 0 && cache_size != 0) > + device_printf(dev, > + "L2 cache size: %dKB, cache line size: %d bytes\n", > + cache_size / 1024, cache_line_size); > + > + return (0); > +} > + > +static device_method_t mpc85xx_cache_methods[] = { > + /* device methods */ > + DEVMETHOD(device_probe, mpc85xx_cache_probe), > + DEVMETHOD(device_attach, mpc85xx_cache_attach), > + > + DEVMETHOD_END > +}; > + > +static driver_t mpc85xx_cache_driver = { > + "cache", > + mpc85xx_cache_methods, > + sizeof(struct mpc85xx_cache_softc), > +}; > +static devclass_t mpc85xx_cache_devclass; > + > +EARLY_DRIVER_MODULE(mpc85xx_cache, simplebus, mpc85xx_cache_driver, > + mpc85xx_cache_devclass, NULL, NULL, > + BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); > From owner-svn-src-head@freebsd.org Sat Jan 13 15:33:48 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C4F7E6EAE7; Sat, 13 Jan 2018 15:33:48 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-it0-x234.google.com (mail-it0-x234.google.com [IPv6:2607:f8b0:4001:c0b::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 31F0569B30; Sat, 13 Jan 2018 15:33:48 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-it0-x234.google.com with SMTP id f143so12555148itb.0; Sat, 13 Jan 2018 07:33:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=cUlLONn9zroFNuFg2dqmhQsKbVNou5YZd6WBXK+ZdgI=; b=YJJ9kc4d6bFj5ZE1txgGvNyLZXqRs9cl+5BvhZWgw2+HP4/wOM6QvAAA2owOLDPjGl FjiQIqQ/v0Eds6C/CIh6AzdvOqC+tR+e2tLPOrbZaIvcFfDeNfaqxfnqA0uRu8gbRMxI 6U6hsAFizDKSaur3qfsUem7lRGdcqFvgxUV2AdMZDcy60yEXL+t9vqtmvC3YXM0ObKaK 8SNb0AoTBvB9l9poDv92e7iI/X1Lf538tf3D4o+6VTlqm10B58o18wwEPFp/DzssYzgb skm2jGHjN9LObetDXsQ3PbeHNNbAr0V7jXwKl/uibmIFSXzTpATOwZC9dDBQMm/iQthE dmmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=cUlLONn9zroFNuFg2dqmhQsKbVNou5YZd6WBXK+ZdgI=; b=jvO93Gj+4cSLhd+8bWig6kPXDhkQLS40iM4a8xv++Eyzr3NIk1LUzMJX+y+fDNUgyn MyXd+NjX9CaJyq4j3rMxomJGp8zniMdxO8dQF1fqSud+t7Z03lb/ua7wVXzq6AxCwJwJ wg4O3XjOiptDHEtJm0sCGYYhNa96QopeHxzBtMr6cX2Y4ZhzXZzrWIpRQs9m1E6r9mKE wMHstNfTh7T2kggMgl6IUwKsa+JPAMtYO9fmbztbF6iQ/AUYZUhLV6xbeU6mbWKhTle8 yGBh6oP7qqxks8vGRnsZnnwHLkJUlKX9HtudBJELOAOVnFtFFQwxpTVjxH7Tc3Tgv8h9 WbvQ== X-Gm-Message-State: AKwxyteyJkVW4SEjkaarqAP6TMAf3kLf666pPN/aL8aZlcDpMi70qlmO XM0HU13vzcjuHvSksz1Xt4y2NBi1ItUmECXYr44= X-Google-Smtp-Source: ACJfBour5TbWU9mD0iVqookCc2gS33AGlS4fEtVkTpNHFEmbqmhekXOfbhonty1AZmkjW9woJI2Ez+P/Vm7vx9j9HoU= X-Received: by 10.36.10.81 with SMTP id 78mr9315994itw.117.1515857627101; Sat, 13 Jan 2018 07:33:47 -0800 (PST) MIME-Version: 1.0 Sender: chmeeedalf@gmail.com Received: by 10.79.158.10 with HTTP; Sat, 13 Jan 2018 07:33:46 -0800 (PST) Received: by 10.79.158.10 with HTTP; Sat, 13 Jan 2018 07:33:46 -0800 (PST) In-Reply-To: <40f39e41-f051-0758-fe15-55c1dab64c9c@FreeBSD.org> References: <201801130136.w0D1abhS054355@repo.freebsd.org> <40f39e41-f051-0758-fe15-55c1dab64c9c@FreeBSD.org> From: Justin Hibbits Date: Sat, 13 Jan 2018 09:33:46 -0600 X-Google-Sender-Auth: N47aU44x5HzPhEzM02FFsD5clw8 Message-ID: Subject: Re: svn commit: r327906 - in head/sys: conf powerpc/mpc85xx To: Pedro Giffuni Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 15:33:48 -0000 On Jan 13, 2018 09:04, "Pedro Giffuni" wrote: On 12/01/2018 20:36, Justin Hibbits wrote: > Author: jhibbits > Date: Sat Jan 13 01:36:37 2018 > New Revision: 327906 > URL: https://svnweb.freebsd.org/changeset/base/327906 > ... > > > Added: head/sys/powerpc/mpc85xx/mpc85xx_cache.c > ============================================================ > ================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/powerpc/mpc85xx/mpc85xx_cache.c Sat Jan 13 01:36:37 2018 > (r327906) > @@ -0,0 +1,129 @@ > +/*- > + * Copyright (c) 2018 Justin Hibbits > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR > PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, > STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY > WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > + > Can we please add SPDX ID tags, specially on new code? I had them added to the guidelines: https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committ ers-guide/pref-license.html It is just not fun for me anymore to go hunting for untagged files and they keep appearing ;). Pedro. D'oh, sorry. I had used an existing boilerplate template I have lying around that didn't have the SPDX tags. I'll update and fix this. - Justin From owner-svn-src-head@freebsd.org Sat Jan 13 15:38:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1A07E6EE55 for ; Sat, 13 Jan 2018 15:38:46 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic306-17.consmr.mail.bf2.yahoo.com (sonic306-17.consmr.mail.bf2.yahoo.com [74.6.132.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95BAB69E79 for ; Sat, 13 Jan 2018 15:38:46 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1515857924; bh=5F2mMvwl192eA4erdZEoM4zH36Qx6C8dSi762BZg+BA=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=X6fzuB0SVFb8v51lOOEzESxlc3cNY3Ez+Xe55SMkeBztLWDN/1EJ3N2eL5/ZwlPr/WIdlsmnv3+6/FJ+pC8ktuNfQm1xRA3r5q+ptxn6ySugvhQqb8V1SrKoh5PAV3FdCpdS0J5ITlu0/1/FZrgcfGCug0I1ou51sYJNYnvJgnNO4GCRVR9OoUS0AlwucW38z2Og5zSxliLcD2lzA2r5+/eamBIbWaWb+rCTYqVDqKPMRCQz9nh8uyuGkA7m0uAVzvM4AIPg3QzI2BazjDBb2r4v5h3GZLMCTvS8OPfkqoEaNGMh77U2GrGNyykE0SBEK6/EEFU8gENWK9kMPAytEg== X-YMail-OSG: 5J630t4VM1km36IpWibsoOkRKsz5oPlhQuOwxHi2bxeiwNSwpiJVx2nCCggrEF3 EEAL.5o5Mm691W39Vam0VLXOGalwuCUMtz1cvbfo35488D_jAu84J0EgQ1u875C0L_U88W8GpkF4 zr6plkHmxq0Y9498gz8XORVp31ETSmrB_YFQjRGPCxyxb3jY5Gd9yk5HB26N9Oo68xSi3ZUejQi2 d7GY13aok7XageT_bOvUeFKRuO9I3eNKlGJUZoQRbTQ7Ggolw_mLFVQEoamMaul5DG9Hev1DPoiq 1a75kY0bhG7gsyzY1uvUT95U51hJK9F9J4piTbXlQf7gAlVvtH.Zs4Bg3wLSqd_46eEDrBnTS6pw t1thsJWMcAscOmKqce1A3uycfxkT_UNCyyOyghuG0d.EXwb3ACz0Yg_nAlazesk_fcdTW3Aa.VMx mKBUTdZ8Hhc9yUuC6vdbkM48peX6AlE7uSoFC64AZ3QuDPM374aJWKQUsLkM1Zvw1Pyt9Xsf_ Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.bf2.yahoo.com with HTTP; Sat, 13 Jan 2018 15:38:44 +0000 Received: from smtp101.rhel.mail.bf1.yahoo.com (EHLO [192.168.0.8]) ([68.142.231.32]) by smtp414.mail.bf1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID c140936c2d074626e2ad935f93bc2ebc; Sat, 13 Jan 2018 15:38:42 +0000 (UTC) Subject: Re: svn commit: r327906 - in head/sys: conf powerpc/mpc85xx To: Justin Hibbits Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801130136.w0D1abhS054355@repo.freebsd.org> <40f39e41-f051-0758-fe15-55c1dab64c9c@FreeBSD.org> From: Pedro Giffuni Organization: FreeBSD Project Message-ID: <3bd7260a-4bac-2718-9836-15bb25cbc793@FreeBSD.org> Date: Sat, 13 Jan 2018 10:38:43 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 15:38:46 -0000 ... On 13/01/2018 10:33, Justin Hibbits wrote: > > > On Jan 13, 2018 09:04, "Pedro Giffuni" > wrote: > > > > On 12/01/2018 20:36, Justin Hibbits wrote: > > Author: jhibbits > Date: Sat Jan 13 01:36:37 2018 > New Revision: 327906 > URL: https://svnweb.freebsd.org/changeset/base/327906 > > ... > > > Added: head/sys/powerpc/mpc85xx/mpc85xx_cache.c > ============================================================================== > --- /dev/null   00:00:00 1970   (empty, because file is newly > added) > +++ head/sys/powerpc/mpc85xx/mpc85xx_cache.c Sat Jan 13 > 01:36:37 2018        (r327906) > @@ -0,0 +1,129 @@ > +/*- > + * Copyright (c) 2018 Justin Hibbits > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or > without > + * modification, are permitted provided that the following > conditions > + * are met: > + * 1. Redistributions of source code must retain the above > copyright > + *    notice, this list of conditions and the following > disclaimer. > + * 2. Redistributions in binary form must reproduce the above > copyright > + *    notice, this list of conditions and the following > disclaimer in the > + *    documentation and/or other materials provided with the > distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS > ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A > PARTICULAR PURPOSE > + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR > CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, > OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF > SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN > CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) > ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE > POSSIBILITY OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > + > > > Can we please add SPDX ID tags, specially on new code? > I had them added to the guidelines: > > https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/pref-license.html > > > It is just not fun for me anymore to go hunting for untagged files > and they keep appearing ;). > > Pedro. > > > D'oh, sorry. I had used an existing boilerplate template I have lying > around that didn't have the SPDX tags. I'll update and fix this. > It's OK, no hurry. Pedro. From owner-svn-src-head@freebsd.org Sat Jan 13 16:21:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99AC7E7123C; Sat, 13 Jan 2018 16:21:14 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 754E66B849; Sat, 13 Jan 2018 16:21:14 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BEE2415538; Sat, 13 Jan 2018 16:21:13 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DGLDQk026576; Sat, 13 Jan 2018 16:21:13 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DGLDiC026575; Sat, 13 Jan 2018 16:21:13 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201801131621.w0DGLDiC026575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sat, 13 Jan 2018 16:21:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327924 - head/sys/dev/sdhci X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: head/sys/dev/sdhci X-SVN-Commit-Revision: 327924 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 16:21:14 -0000 Author: marius Date: Sat Jan 13 16:21:13 2018 New Revision: 327924 URL: https://svnweb.freebsd.org/changeset/base/327924 Log: Fix a bug introduced in r327339; at the point in time re-tuning is executed, the interrupt aggregation code might have disabled the SDHCI_INT_DMA_END and/or SDHCI_INT_RESPONSE bits in slot->intmask and the SDHCI_SIGNAL_ENABLE register respectively. So when restoring the interrupt masks based on the previous contents of slot->intmask in sdhci_exec_tuning(), ensure that the SDHCI_INT_ENABLE register doesn't lose these two bits. While at it and in the spirit of r327339, let sdhci_tuning_intmask() set the tuning error and re-tuning interrupt bits based on the SDHCI_TUNING_ENABLED rather than the SDHCI_TUNING_SUPPORTED flag being set, i. e. only when (re-)tuning is actually used. Currently, this changes makes no net difference, though. Modified: head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Sat Jan 13 14:14:50 2018 (r327923) +++ head/sys/dev/sdhci/sdhci.c Sat Jan 13 16:21:13 2018 (r327924) @@ -273,7 +273,7 @@ sdhci_tuning_intmask(struct sdhci_slot *slot) uint32_t intmask; intmask = 0; - if (slot->opt & SDHCI_TUNING_SUPPORTED) { + if (slot->opt & SDHCI_TUNING_ENABLED) { intmask |= SDHCI_INT_TUNEERR; if (slot->retune_mode == SDHCI_RETUNE_MODE_2 || slot->retune_mode == SDHCI_RETUNE_MODE_3) @@ -1439,9 +1439,17 @@ sdhci_exec_tuning(struct sdhci_slot *slot, bool reset) DELAY(1000); } + /* + * Restore DMA usage and interrupts. + * Note that the interrupt aggregation code might have cleared + * SDHCI_INT_DMA_END and/or SDHCI_INT_RESPONSE in slot->intmask + * and SDHCI_SIGNAL_ENABLE respectively so ensure SDHCI_INT_ENABLE + * doesn't lose these. + */ slot->opt = opt; slot->intmask = intmask; - WR4(slot, SDHCI_INT_ENABLE, intmask); + WR4(slot, SDHCI_INT_ENABLE, intmask | SDHCI_INT_DMA_END | + SDHCI_INT_RESPONSE); WR4(slot, SDHCI_SIGNAL_ENABLE, intmask); if ((hostctrl2 & (SDHCI_CTRL2_EXEC_TUNING | From owner-svn-src-head@freebsd.org Sat Jan 13 16:31:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A746E71BF2; Sat, 13 Jan 2018 16:31:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 45C4D6BD8E; Sat, 13 Jan 2018 16:31:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 835D1155D6; Sat, 13 Jan 2018 16:31:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DGV7VA032747; Sat, 13 Jan 2018 16:31:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DGV7vO032746; Sat, 13 Jan 2018 16:31:07 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801131631.w0DGV7vO032746@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 13 Jan 2018 16:31:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327925 - head/sys/dev/wbwd X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/wbwd X-SVN-Commit-Revision: 327925 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 16:31:08 -0000 Author: mav Date: Sat Jan 13 16:31:07 2018 New Revision: 327925 URL: https://svnweb.freebsd.org/changeset/base/327925 Log: Add IDs for Nuvoton NCT6793/NCT6795. MFC after: 2 weeks Modified: head/sys/dev/wbwd/wbwd.c Modified: head/sys/dev/wbwd/wbwd.c ============================================================================== --- head/sys/dev/wbwd/wbwd.c Sat Jan 13 16:21:13 2018 (r327924) +++ head/sys/dev/wbwd/wbwd.c Sat Jan 13 16:31:07 2018 (r327925) @@ -97,7 +97,7 @@ __FBSDID("$FreeBSD$"); enum chips { w83627hf, w83627s, w83697hf, w83697ug, w83637hf, w83627thf, w83687thf, w83627ehf, w83627dhg, w83627uhg, w83667hg, w83627dhg_p, w83667hg_b, nct6775, nct6776, nct6779, nct6791, - nct6792, nct6102 }; + nct6792, nct6793, nct6795, nct6102 }; struct wb_softc { device_t dev; @@ -252,6 +252,16 @@ struct winbond_vendor_device_id { .chip = nct6792, .descr = "Nuvoton NCT6792", }, + { + .device_id = 0xd1, + .chip = nct6793, + .descr = "Nuvoton NCT6793", + }, + { + .device_id = 0xd3, + .chip = nct6795, + .descr = "Nuvoton NCT6795", + }, }; static void @@ -810,6 +820,8 @@ wb_attach(device_t dev) case nct6779: case nct6791: case nct6792: + case nct6793: + case nct6795: case nct6102: /* * These chips have a fixed WDTO# output pin (W83627UHG), From owner-svn-src-head@freebsd.org Sat Jan 13 16:32:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FA91E71CF9; Sat, 13 Jan 2018 16:32:11 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD0466C0C0; Sat, 13 Jan 2018 16:32:10 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25C0B1571D; Sat, 13 Jan 2018 16:32:10 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DGW9Rq034279; Sat, 13 Jan 2018 16:32:09 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DGW9xt034278; Sat, 13 Jan 2018 16:32:09 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201801131632.w0DGW9xt034278@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sat, 13 Jan 2018 16:32:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327926 - head/sys/dev/mmc X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: head/sys/dev/mmc X-SVN-Commit-Revision: 327926 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 16:32:11 -0000 Author: marius Date: Sat Jan 13 16:32:09 2018 New Revision: 327926 URL: https://svnweb.freebsd.org/changeset/base/327926 Log: Fix a bug introduced in r327355; in mmcsd_ioctl_cmd() when ensuring that userland doesn't switch partitions on its own, compare against the partition mmcsd_ioctl_cmd() is going to switch to (based on the device node used) rather than the currently selected partition. Modified: head/sys/dev/mmc/mmcsd.c Modified: head/sys/dev/mmc/mmcsd.c ============================================================================== --- head/sys/dev/mmc/mmcsd.c Sat Jan 13 16:31:07 2018 (r327925) +++ head/sys/dev/mmc/mmcsd.c Sat Jan 13 16:32:09 2018 (r327926) @@ -920,7 +920,7 @@ mmcsd_ioctl_cmd(struct mmcsd_part *part, struct mmc_io */ if (cmd.opcode == MMC_SWITCH_FUNC && dp != NULL && (((uint8_t *)dp)[EXT_CSD_PART_CONFIG] & - EXT_CSD_PART_CONFIG_ACC_MASK) != sc->part_curr) { + EXT_CSD_PART_CONFIG_ACC_MASK) != part->type) { err = EINVAL; goto out; } From owner-svn-src-head@freebsd.org Sat Jan 13 17:04:31 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CEDD9E736C2; Sat, 13 Jan 2018 17:04:31 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AE2846D26D; Sat, 13 Jan 2018 17:04:31 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id C3BB218A93; Sat, 13 Jan 2018 17:04:30 +0000 (UTC) Date: Sat, 13 Jan 2018 17:04:30 +0000 From: Alexey Dokuchaev To: Jason Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r319971 - in head: contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src include lib/libc/stdlib/jemalloc Message-ID: <20180113170430.GA52597@FreeBSD.org> References: <201706150715.v5F7F6aT031218@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201706150715.v5F7F6aT031218@repo.freebsd.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 17:04:31 -0000 On Thu, Jun 15, 2017 at 07:15:06AM +0000, Jason Evans wrote: > New Revision: 319971 > URL: https://svnweb.freebsd.org/changeset/base/319971 > > Log: > Update jemalloc to 5.0.0. I've finally bisected the problem of `games/quake2lnx' failing to start (hanging) in GLX mode down to this commit. Reverting it and making "all install" under `/usr/src/lib/libc' restores correct operation. If I run it as ``env LD_PRELOAD=/lib/libthr.so.3 quake2 ...'' it starts normally. Do you have any ideas what might have broken it? Is this a problem with how the Quake2 binary is linked, or with jemalloc? To reproduce: $ cd /usr/ports/games/quake2lnx && make all install $ quake2 +set vid_ref glx (I'd appreciate if you could build/install `games/quake2lnx', it is straightforward and fast, and does not require any commercial data files. Thanks.) ./danfe From owner-svn-src-head@freebsd.org Sat Jan 13 17:25:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B77E8E74675; Sat, 13 Jan 2018 17:25:49 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 924056DEB2; Sat, 13 Jan 2018 17:25:49 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6C3D15F69; Sat, 13 Jan 2018 17:25:48 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DHPmWX055585; Sat, 13 Jan 2018 17:25:48 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DHPmY5055584; Sat, 13 Jan 2018 17:25:48 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201801131725.w0DHPmY5055584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 13 Jan 2018 17:25:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327928 - head/sys/powerpc/mpc85xx X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/mpc85xx X-SVN-Commit-Revision: 327928 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 17:25:49 -0000 Author: jhibbits Date: Sat Jan 13 17:25:48 2018 New Revision: 327928 URL: https://svnweb.freebsd.org/changeset/base/327928 Log: Add SPDX identifier to header Reported by: pfg Modified: head/sys/powerpc/mpc85xx/mpc85xx_cache.c Modified: head/sys/powerpc/mpc85xx/mpc85xx_cache.c ============================================================================== --- head/sys/powerpc/mpc85xx/mpc85xx_cache.c Sat Jan 13 17:21:45 2018 (r327927) +++ head/sys/powerpc/mpc85xx/mpc85xx_cache.c Sat Jan 13 17:25:48 2018 (r327928) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2018 Justin Hibbits * All rights reserved. * From owner-svn-src-head@freebsd.org Sat Jan 13 17:36:12 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77D56E7502C; Sat, 13 Jan 2018 17:36:12 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 517446E6B9; Sat, 13 Jan 2018 17:36:12 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C3AE1610B; Sat, 13 Jan 2018 17:36:11 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DHaB4o059599; Sat, 13 Jan 2018 17:36:11 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DHaBtm059598; Sat, 13 Jan 2018 17:36:11 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201801131736.w0DHaBtm059598@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sat, 13 Jan 2018 17:36:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327929 - head/sys/dev/mmc X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: head/sys/dev/mmc X-SVN-Commit-Revision: 327929 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 17:36:12 -0000 Author: marius Date: Sat Jan 13 17:36:11 2018 New Revision: 327929 URL: https://svnweb.freebsd.org/changeset/base/327929 Log: Use the correct revision specifier (EXT_CSD revision rather than system specification version) for deciding whether the EXT_CSD register includes the EXT_CSD_GEN_CMD6_TIME field. Submitted by: Masanobu SAITOH Modified: head/sys/dev/mmc/mmc.c Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Sat Jan 13 17:25:48 2018 (r327928) +++ head/sys/dev/mmc/mmc.c Sat Jan 13 17:36:11 2018 (r327929) @@ -1868,7 +1868,7 @@ mmc_discover_cards(struct mmc_softc *sc) * units of 10 ms), defaulting to 500 ms. */ ivar->cmd6_time = 500 * 1000; - if (ivar->csd.spec_vers >= 6) + if (ivar->raw_ext_csd[EXT_CSD_REV] >= 6) ivar->cmd6_time = 10 * ivar->raw_ext_csd[EXT_CSD_GEN_CMD6_TIME]; /* Handle HC erase sector size. */ From owner-svn-src-head@freebsd.org Sat Jan 13 17:47:35 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE6A8E75A7C; Sat, 13 Jan 2018 17:47:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B9BF66EF1E; Sat, 13 Jan 2018 17:47:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0594C162B6; Sat, 13 Jan 2018 17:47:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DHlY6P063671; Sat, 13 Jan 2018 17:47:34 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DHlYh8063668; Sat, 13 Jan 2018 17:47:34 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201801131747.w0DHlYh8063668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 13 Jan 2018 17:47:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327930 - in head/contrib/llvm/tools/clang: include/clang/AST lib/AST lib/Sema X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/contrib/llvm/tools/clang: include/clang/AST lib/AST lib/Sema X-SVN-Commit-Revision: 327930 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 17:47:36 -0000 Author: dim Date: Sat Jan 13 17:47:34 2018 New Revision: 327930 URL: https://svnweb.freebsd.org/changeset/base/327930 Log: Pull in r314499 from upstream clang trunk (by Daniel Marjamäki): [Sema] Suppress warnings for C's zero initializer Patch by S. Gilles! Differential Revision: https://reviews.llvm.org/D28148 Pull in r314838 from upstream clang trunk (by Richard Smith): Suppress -Wmissing-braces warning when aggregate-initializing a struct with a single field that is itself an aggregate. In C++, such initialization of std::array types is guaranteed to work by the standard, is completely idiomatic, and the "suggested" alternative from Clang was technically invalid. Together, these suppress unneeded "suggest braces around initialization of subobject" warnings for C++11 initializer lists. MFC after: 3 days Modified: head/contrib/llvm/tools/clang/include/clang/AST/Expr.h head/contrib/llvm/tools/clang/lib/AST/Expr.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp Modified: head/contrib/llvm/tools/clang/include/clang/AST/Expr.h ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/AST/Expr.h Sat Jan 13 17:36:11 2018 (r327929) +++ head/contrib/llvm/tools/clang/include/clang/AST/Expr.h Sat Jan 13 17:47:34 2018 (r327930) @@ -3986,6 +3986,10 @@ class InitListExpr : public Expr { (public) /// initializer)? bool isTransparent() const; + /// Is this the zero initializer {0} in a language which considers it + /// idiomatic? + bool isIdiomaticZeroInitializer(const LangOptions &LangOpts) const; + SourceLocation getLBraceLoc() const { return LBraceLoc; } void setLBraceLoc(SourceLocation Loc) { LBraceLoc = Loc; } SourceLocation getRBraceLoc() const { return RBraceLoc; } @@ -3994,6 +3998,9 @@ class InitListExpr : public Expr { (public) bool isSemanticForm() const { return AltForm.getInt(); } InitListExpr *getSemanticForm() const { return isSemanticForm() ? nullptr : AltForm.getPointer(); + } + bool isSyntacticForm() const { + return !AltForm.getInt() || !AltForm.getPointer(); } InitListExpr *getSyntacticForm() const { return isSemanticForm() ? AltForm.getPointer() : nullptr; Modified: head/contrib/llvm/tools/clang/lib/AST/Expr.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/AST/Expr.cpp Sat Jan 13 17:36:11 2018 (r327929) +++ head/contrib/llvm/tools/clang/lib/AST/Expr.cpp Sat Jan 13 17:47:34 2018 (r327930) @@ -1899,6 +1899,17 @@ bool InitListExpr::isTransparent() const { getInit(0)->getType().getCanonicalType(); } +bool InitListExpr::isIdiomaticZeroInitializer(const LangOptions &LangOpts) const { + assert(isSyntacticForm() && "only test syntactic form as zero initializer"); + + if (LangOpts.CPlusPlus || getNumInits() != 1) { + return false; + } + + const IntegerLiteral *Lit = dyn_cast(getInit(0)); + return Lit && Lit->getValue() == 0; +} + SourceLocation InitListExpr::getLocStart() const { if (InitListExpr *SyntacticForm = getSyntacticForm()) return SyntacticForm->getLocStart(); Modified: head/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp Sat Jan 13 17:36:11 2018 (r327929) +++ head/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp Sat Jan 13 17:47:34 2018 (r327930) @@ -826,6 +826,34 @@ int InitListChecker::numStructUnionElements(QualType D return InitializableMembers - structDecl->hasFlexibleArrayMember(); } +/// Determine whether Entity is an entity for which it is idiomatic to elide +/// the braces in aggregate initialization. +static bool isIdiomaticBraceElisionEntity(const InitializedEntity &Entity) { + // Recursive initialization of the one and only field within an aggregate + // class is considered idiomatic. This case arises in particular for + // initialization of std::array, where the C++ standard suggests the idiom of + // + // std::array arr = {1, 2, 3}; + // + // (where std::array is an aggregate struct containing a single array field. + + // FIXME: Should aggregate initialization of a struct with a single + // base class and no members also suppress the warning? + if (Entity.getKind() != InitializedEntity::EK_Member || !Entity.getParent()) + return false; + + auto *ParentRD = + Entity.getParent()->getType()->castAs()->getDecl(); + if (CXXRecordDecl *CXXRD = dyn_cast(ParentRD)) + if (CXXRD->getNumBases()) + return false; + + auto FieldIt = ParentRD->field_begin(); + assert(FieldIt != ParentRD->field_end() && + "no fields but have initializer for member?"); + return ++FieldIt == ParentRD->field_end(); +} + /// Check whether the range of the initializer \p ParentIList from element /// \p Index onwards can be used to initialize an object of type \p T. Update /// \p Index to indicate how many elements of the list were consumed. @@ -886,7 +914,9 @@ void InitListChecker::CheckImplicitInitList(const Init } // Complain about missing braces. - if (T->isArrayType() || T->isRecordType()) { + if ((T->isArrayType() || T->isRecordType()) && + !ParentIList->isIdiomaticZeroInitializer(SemaRef.getLangOpts()) && + !isIdiomaticBraceElisionEntity(Entity)) { SemaRef.Diag(StructuredSubobjectInitList->getLocStart(), diag::warn_missing_braces) << StructuredSubobjectInitList->getSourceRange() @@ -1833,7 +1863,9 @@ void InitListChecker::CheckStructUnionTypes( // worthwhile to skip over the rest of the initializer, though. RecordDecl *RD = DeclType->getAs()->getDecl(); RecordDecl::field_iterator FieldEnd = RD->field_end(); - bool CheckForMissingFields = true; + bool CheckForMissingFields = + !IList->isIdiomaticZeroInitializer(SemaRef.getLangOpts()); + while (Index < IList->getNumInits()) { Expr *Init = IList->getInit(Index); From owner-svn-src-head@freebsd.org Sat Jan 13 17:55:23 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EEC0FE761E1; Sat, 13 Jan 2018 17:55:23 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CA4DD6F6B8; Sat, 13 Jan 2018 17:55:23 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F24E216460; Sat, 13 Jan 2018 17:55:22 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DHtMaw068068; Sat, 13 Jan 2018 17:55:22 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DHtM2c068067; Sat, 13 Jan 2018 17:55:22 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201801131755.w0DHtM2c068067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 13 Jan 2018 17:55:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327932 - head/sys/x86/include X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/x86/include X-SVN-Commit-Revision: 327932 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 17:55:24 -0000 Author: cem Date: Sat Jan 13 17:55:22 2018 New Revision: 327932 URL: https://svnweb.freebsd.org/changeset/base/327932 Log: amd64: Add a 48-bit MAXADDR constant Some devices (e.g., ccp(4) -- to be committed) can only access the low 48 bits of physical memory. Reviewed by: markj Sponsored by: Dell EMC Isilon Modified: head/sys/x86/include/bus.h Modified: head/sys/x86/include/bus.h ============================================================================== --- head/sys/x86/include/bus.h Sat Jan 13 17:52:55 2018 (r327931) +++ head/sys/x86/include/bus.h Sat Jan 13 17:55:22 2018 (r327932) @@ -118,6 +118,7 @@ #define BUS_SPACE_MAXADDR_24BIT 0xFFFFFF #define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF #if defined(__amd64__) || defined(PAE) +#define BUS_SPACE_MAXADDR_48BIT 0xFFFFFFFFFFFFULL #define BUS_SPACE_MAXADDR 0xFFFFFFFFFFFFFFFFULL #else #define BUS_SPACE_MAXADDR 0xFFFFFFFF From owner-svn-src-head@freebsd.org Sat Jan 13 18:04:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EAD85E76B6F; Sat, 13 Jan 2018 18:04:37 +0000 (UTC) (envelope-from kevlo@ns.kevlo.org) Received: from ns.kevlo.org (220-135-115-6.HINET-IP.hinet.net [220.135.115.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "ns.kevlo.org", Issuer "ns.kevlo.org" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 9AEE46FF88; Sat, 13 Jan 2018 18:04:37 +0000 (UTC) (envelope-from kevlo@ns.kevlo.org) Received: from ns.kevlo.org (localhost [127.0.0.1]) by ns.kevlo.org (8.15.2/8.15.2) with ESMTPS id w0DI2UFw096871 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 14 Jan 2018 02:02:31 +0800 (CST) (envelope-from kevlo@ns.kevlo.org) Received: (from kevlo@localhost) by ns.kevlo.org (8.15.2/8.15.2/Submit) id w0DI2TMF096869; Sun, 14 Jan 2018 02:02:29 +0800 (CST) (envelope-from kevlo) Date: Sun, 14 Jan 2018 02:02:29 +0800 From: Kevin Lo To: Pedro Giffuni Cc: Justin Hibbits , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Subject: Re: svn commit: r327906 - in head/sys: conf powerpc/mpc85xx Message-ID: <20180113180229.GA96844@ns.kevlo.org> References: <201801130136.w0D1abhS054355@repo.freebsd.org> <40f39e41-f051-0758-fe15-55c1dab64c9c@FreeBSD.org> <3bd7260a-4bac-2718-9836-15bb25cbc793@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3bd7260a-4bac-2718-9836-15bb25cbc793@FreeBSD.org> User-Agent: Mutt/1.8.0 (2017-02-23) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 18:04:38 -0000 On Sat, Jan 13, 2018 at 10:38:43AM -0500, Pedro Giffuni wrote: > > ... > > > On 13/01/2018 10:33, Justin Hibbits wrote: > > > > > > On Jan 13, 2018 09:04, "Pedro Giffuni" > > wrote: > > > > > > > > On 12/01/2018 20:36, Justin Hibbits wrote: > > > > Author: jhibbits > > Date: Sat Jan 13 01:36:37 2018 > > New Revision: 327906 > > URL: https://svnweb.freebsd.org/changeset/base/327906 > > > > ... > > > > > > Added: head/sys/powerpc/mpc85xx/mpc85xx_cache.c > > ============================================================================== > > --- /dev/null   00:00:00 1970   (empty, because file is newly > > added) > > +++ head/sys/powerpc/mpc85xx/mpc85xx_cache.c Sat Jan 13 > > 01:36:37 2018        (r327906) > > @@ -0,0 +1,129 @@ > > +/*- > > + * Copyright (c) 2018 Justin Hibbits > > + * All rights reserved. > > + * > > + * Redistribution and use in source and binary forms, with or > > without > > + * modification, are permitted provided that the following > > conditions > > + * are met: > > + * 1. Redistributions of source code must retain the above > > copyright > > + *    notice, this list of conditions and the following > > disclaimer. > > + * 2. Redistributions in binary form must reproduce the above > > copyright > > + *    notice, this list of conditions and the following > > disclaimer in the > > + *    documentation and/or other materials provided with the > > distribution. > > + * > > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS > > ``AS IS'' AND > > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > > LIMITED TO, THE > > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A > > PARTICULAR PURPOSE > > + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR > > CONTRIBUTORS BE LIABLE > > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, > > OR CONSEQUENTIAL > > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF > > SUBSTITUTE GOODS > > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > > INTERRUPTION) > > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN > > CONTRACT, STRICT > > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) > > ARISING IN ANY WAY > > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE > > POSSIBILITY OF > > + * SUCH DAMAGE. > > + * > > + * $FreeBSD$ > > + */ > > + > > > > > > Can we please add SPDX ID tags, specially on new code? > > I had them added to the guidelines: > > > > https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/pref-license.html > > > > > > It is just not fun for me anymore to go hunting for untagged files > > and they keep appearing ;). > > > > Pedro. > > > > > > D'oh, sorry. I had used an existing boilerplate template I have lying > > around that didn't have the SPDX tags. I'll update and fix this. > > > It's OK, no hurry. The diff below adds SPDX tag to the example copyright. Index: share/examples/etc/bsd-style-copyright =================================================================== --- share/examples/etc/bsd-style-copyright (revision 327932) +++ share/examples/etc/bsd-style-copyright (working copy) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) [year] [your name] * All rights reserved. * From owner-svn-src-head@freebsd.org Sat Jan 13 18:09:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40F49E76DCE; Sat, 13 Jan 2018 18:09:11 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1CD1B7013B; Sat, 13 Jan 2018 18:09:11 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C587165F7; Sat, 13 Jan 2018 18:09:10 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DI9A88072647; Sat, 13 Jan 2018 18:09:10 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DI9AZw072646; Sat, 13 Jan 2018 18:09:10 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801131809.w0DI9AZw072646@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 13 Jan 2018 18:09:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327934 - head/sys/contrib/zstd/lib/freebsd X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/sys/contrib/zstd/lib/freebsd X-SVN-Commit-Revision: 327934 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 18:09:11 -0000 Author: pfg Date: Sat Jan 13 18:09:09 2018 New Revision: 327934 URL: https://svnweb.freebsd.org/changeset/base/327934 Log: zstd: Use memalloc(9) for calloc macro. This is in contrib code but since we only have memalloc(9) in current we will not upstream this. Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h ============================================================================== --- head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Sat Jan 13 17:56:46 2018 (r327933) +++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Sat Jan 13 18:09:09 2018 (r327934) @@ -46,7 +46,7 @@ MALLOC_DECLARE(M_ZSTD); #define malloc(x) (malloc)((x), M_ZSTD, M_WAITOK) #define free(x) (free)((x), M_ZSTD) /* in zstd's use of calloc, a is always 1 */ -#define calloc(a,b) (malloc)((a)*(b), M_ZSTD, M_WAITOK | M_ZERO) +#define calloc(a,b) (mallocarray)((a), (b), M_ZSTD, M_WAITOK | M_ZERO) #endif #ifdef __cplusplus From owner-svn-src-head@freebsd.org Sat Jan 13 18:26:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4CAD0E77FDC; Sat, 13 Jan 2018 18:26:58 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-it0-f47.google.com (mail-it0-f47.google.com [209.85.214.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E00070C41; Sat, 13 Jan 2018 18:26:57 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-it0-f47.google.com with SMTP id 68so12833732ite.4; Sat, 13 Jan 2018 10:26:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=zt5s977nAepjTiZDQcGf4z04Rqk/EvgLsQCj8i+eQts=; b=Lhf2RDDm+408sET2jzCdFDtshiTz+UKf3Oe2CwIXi+LlbasE9Y+p2tMCtZQSdmJJKC Yv6xjw5Pq7ivlEkvSLC/biYvIfUicVgiylZhBsdRr84n7bXlPgcaDxDSlG1+n++eM7nM 9HWW3+ccR7UsBZXCNdyt3nNiTNfecVm+/RSpAr+4wRUW3IMvWVzG7le5RStVcI+RJdjg Cas+eTD7VXsaYZzVT7D09MD+wMMhecF0Br4cE2wG4RzmtlTiDufmwACQzIwC8Dvjuaxx GznKnyrhuH7aNEW5H/8NsOG/rvkovOL0ssBuMjDOtVb152C5VOf73EWb2D2Vc6HtuojT M05g== X-Gm-Message-State: AKwxytd1Lc1T3IAplHybt7c2P5qacLKftzDNwRyH7YFS+JpCV40iXHAf urVM4ydXfyktd4flnR7B+IzwhAqp X-Google-Smtp-Source: ACJfBou0aBg6rQ7mo/06GezohhVrq2jaDpyfFfrGllBgG5/RiBeLgdRB4s+RA6GOad7J2FsrVIwLjg== X-Received: by 10.36.123.9 with SMTP id q9mr1803658itc.21.1515868010692; Sat, 13 Jan 2018 10:26:50 -0800 (PST) Received: from mail-io0-f181.google.com (mail-io0-f181.google.com. [209.85.223.181]) by smtp.gmail.com with ESMTPSA id p198sm3483169itp.11.2018.01.13.10.26.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Jan 2018 10:26:50 -0800 (PST) Received: by mail-io0-f181.google.com with SMTP id k18so9165544ioc.11; Sat, 13 Jan 2018 10:26:50 -0800 (PST) X-Received: by 10.107.21.65 with SMTP id 62mr28758068iov.148.1515868010019; Sat, 13 Jan 2018 10:26:50 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.149.147 with HTTP; Sat, 13 Jan 2018 10:26:29 -0800 (PST) In-Reply-To: <201801131725.w0DHPmY5055584@repo.freebsd.org> References: <201801131725.w0DHPmY5055584@repo.freebsd.org> From: Kyle Evans Date: Sat, 13 Jan 2018 12:26:29 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r327928 - head/sys/powerpc/mpc85xx To: Pedro Giffuni Cc: src-committers , Justin Hibbits , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 18:26:58 -0000 On Sat, Jan 13, 2018 at 11:25 AM, Justin Hibbits wrote: > Author: jhibbits > Date: Sat Jan 13 17:25:48 2018 > New Revision: 327928 > URL: https://svnweb.freebsd.org/changeset/base/327928 > > Log: > Add SPDX identifier to header > > Reported by: pfg > > Modified: > head/sys/powerpc/mpc85xx/mpc85xx_cache.c > > Modified: head/sys/powerpc/mpc85xx/mpc85xx_cache.c > ============================================================================== > --- head/sys/powerpc/mpc85xx/mpc85xx_cache.c Sat Jan 13 17:21:45 2018 (r327927) > +++ head/sys/powerpc/mpc85xx/mpc85xx_cache.c Sat Jan 13 17:25:48 2018 (r327928) > @@ -1,4 +1,6 @@ > /*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > * Copyright (c) 2018 Justin Hibbits > * All rights reserved. > * Doesn't BSD-2-Clause-FreeBSD imply that the license includes the following disclaimer? "The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project." That's what the SPDX license list seems to imply. I have some stuff I've recently added that I need to go back and tag. From owner-svn-src-head@freebsd.org Sat Jan 13 18:28:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F2B6E78100 for ; Sat, 13 Jan 2018 18:28:25 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic315-22.consmr.mail.gq1.yahoo.com (sonic315-22.consmr.mail.gq1.yahoo.com [98.137.65.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB38670DBC for ; Sat, 13 Jan 2018 18:28:24 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1515868098; bh=/CG693PVVVst0YaX96grwzO+LqX9xg/o5xXMpXCPUE4=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=NvL4TMtr7z6WAqnFoMDdkDvMl/mkSrhdxFfhnGUSV40iLQ1fRD8DONk9oUGiElaow++zDO6LVWizFvgVhegd3vGCLXKsCOMq9+MbgUs5gADwCZLgjyHnSEMdTEvPM3sowQdMHWnijc8dllS4VPBK3yRGn1k1YqG6oM2siHveaN8SEsfGQEq2GRsFj8UGfxKoeuQOPn2iaCgL4Pj5LX7noFpKNKEOY7mPvzl5tHyQlTu9haJ0BlKeQNNpUBuqCoQ62voaqMPWrXw8t1xG8UJOUzn/AThSC7UCEgYLpL8piHNHLJnUm0MJDhXd+dzbMj/V0nJykCmbPXDqF1cJEVmvqg== X-YMail-OSG: 8fsOZ2kVM1lMt24Jvy0re_ZYn4z32lVN0MzfynFFBX3QW.LYfoUWm6YmvyhmpPa K_VV1my.q_dJynEHxJpdwtOA4AGKzIuG5QRgY1dJeZeBpvSbFr2W9TGOV3BAZv0cHi1Lz7cx.1fb fCq5WzQYChZ2Nql0gVmIkzW4XHe8UDaJMo9uoaD5eXN1EER7KNr4Jj9q8Kpan4lyrlOA1q_m0iwO nH1AeWDp9pSduk8U9R77ot7.mbYDqLno3YROg4QbI8OPguegxV02mAOAkAAl6EyDPjn7F3eVExvp 1L3udzAnQL_nyvpL4d8t.tFnxkoU3AufFbGphocnHAfhs3_9uskmQngAXhQYGo.XDqon9phWsNy8 PmuAaa.n25LxJxkSD5dM2iyr0.c9xhQG6GPnI.N1n1xe3XLDGtiS1KOG7O_JkS3g63.1sZ_2m1RX z4z0ezz5neNktvJgT1Q29vkduoG8FmK6qfWYKZgMFl15Hh3fV3e6HG9Ueizq74_kRXyLhfW7g Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.gq1.yahoo.com with HTTP; Sat, 13 Jan 2018 18:28:18 +0000 Received: from smtp105.rhel.mail.gq1.yahoo.com (EHLO [192.168.0.8]) ([68.180.227.8]) by smtp408.mail.gq1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 2572581542d13f9dc796fb18cf7128fa; Sat, 13 Jan 2018 18:28:14 +0000 (UTC) Subject: Re: svn commit: r327906 - in head/sys: conf powerpc/mpc85xx To: Kevin Lo Cc: Justin Hibbits , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers References: <201801130136.w0D1abhS054355@repo.freebsd.org> <40f39e41-f051-0758-fe15-55c1dab64c9c@FreeBSD.org> <3bd7260a-4bac-2718-9836-15bb25cbc793@FreeBSD.org> <20180113180229.GA96844@ns.kevlo.org> From: Pedro Giffuni Message-ID: <60e0548a-107a-6618-f29e-81804eafea75@FreeBSD.org> Date: Sat, 13 Jan 2018 13:28:13 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180113180229.GA96844@ns.kevlo.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 18:28:25 -0000 On 01/13/18 13:02, Kevin Lo wrote: > On Sat, Jan 13, 2018 at 10:38:43AM -0500, Pedro Giffuni wrote: >> ... >> >> >> On 13/01/2018 10:33, Justin Hibbits wrote: >>> ... >>> >>> >>> Can we please add SPDX ID tags, specially on new code? >>> I had them added to the guidelines: >>> >>> https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/pref-license.html >>> >>> >>> It is just not fun for me anymore to go hunting for untagged files >>> and they keep appearing ;). >>> >>> Pedro. >>> >>> >>> D'oh, sorry. I had used an existing boilerplate template I have lying >>> around that didn't have the SPDX tags. I'll update and fix this. >>> >> It's OK, no hurry. > The diff below adds SPDX tag to the example copyright. > > Index: share/examples/etc/bsd-style-copyright > =================================================================== > --- share/examples/etc/bsd-style-copyright (revision 327932) > +++ share/examples/etc/bsd-style-copyright (working copy) > @@ -1,4 +1,6 @@ > /*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > * Copyright (c) [year] [your name] > * All rights reserved. > * Hmm ... and now I am in doubt if we should include the FreeBSD suffix in the identifier: the example could be used for non FreeBSD projects. I'll certainly update it though, Thanks! From owner-svn-src-head@freebsd.org Sat Jan 13 18:28:31 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1186E78137; Sat, 13 Jan 2018 18:28:31 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C6DB070DEE; Sat, 13 Jan 2018 18:28:31 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 10CC71692E; Sat, 13 Jan 2018 18:28:31 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DISURC080689; Sat, 13 Jan 2018 18:28:30 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DISUXE080688; Sat, 13 Jan 2018 18:28:30 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801131828.w0DISUXE080688@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 13 Jan 2018 18:28:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327935 - head/share/examples/etc X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/share/examples/etc X-SVN-Commit-Revision: 327935 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 18:28:32 -0000 Author: pfg Date: Sat Jan 13 18:28:30 2018 New Revision: 327935 URL: https://svnweb.freebsd.org/changeset/base/327935 Log: Add SPDX identifier for the example license. For project files we should use the -FreeBSD prefix but for this example assume it is going to be used for some general purpose. Submitted by: kevlo Modified: head/share/examples/etc/bsd-style-copyright Modified: head/share/examples/etc/bsd-style-copyright ============================================================================== --- head/share/examples/etc/bsd-style-copyright Sat Jan 13 18:09:09 2018 (r327934) +++ head/share/examples/etc/bsd-style-copyright Sat Jan 13 18:28:30 2018 (r327935) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) [year] [your name] * All rights reserved. * From owner-svn-src-head@freebsd.org Sat Jan 13 18:33:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFAC8E78664; Sat, 13 Jan 2018 18:33:54 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5085071492; Sat, 13 Jan 2018 18:33:53 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from thor.intern.walstatt.dynvpn.de ([85.182.8.155]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0Lmr1w-1f4GCU0RXo-00h6JP; Sat, 13 Jan 2018 19:33:46 +0100 Date: Sat, 13 Jan 2018 19:33:12 +0100 From: "O. Hartmann" To: "Pedro F. Giffuni" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r327934 - head/sys/contrib/zstd/lib/freebsd Message-ID: <20180113193339.549bf55a@thor.intern.walstatt.dynvpn.de> In-Reply-To: <201801131809.w0DI9AZw072646@repo.freebsd.org> References: <201801131809.w0DI9AZw072646@repo.freebsd.org> Organization: WALSTATT User-Agent: OutScare 3.1415926 X-Operating-System: ImNotAnOperatingSystem 3.141592527 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/zrACyMS6vy8QRQ5v5SB5uA5"; protocol="application/pgp-signature" X-Provags-ID: V03:K0:SgyQRpJHiSnkp+IGxS9pTi6xu6zyjnmBsVvyOcxMKl9xaXyrvS1 0lfksblaao+7OLp1jMTDaly3d87fAzu7YU0FsmaBJefAXvQZthIm1nMKYlX0Hl0kbd6qIZE X5PUR8bwyMNvNdaraE3+saaeDRbDuRKScj/J1E/5miTjHpAAe+NsgOdQpDFLOphj9lbzEKk 0pUStcwtvKVq1gkKs+Wiw== X-UI-Out-Filterresults: notjunk:1;V01:K0:9Gw05CFXG28=:Tlo2osxZsqdYnL7PZ79yYi XuY/gahXCEmwWcGdhhaopGAWW/cYUZHQWu7UbtgOCtuj5xkecQwWZUhNJiT9/qLmhPvAu+yzN bLGrWExqNrjue6S6OAgDDiZJ8WDEldomDJ0E+mOkbnKfrGa/aHWEGZHwHIc7xXG/h03LPe0Tn y35c++M7D6Ju9+1PJIq7hdkdloMK0X/v1pxgzUUBsM1GsgYARjvpi+1YqUyX4kzrsHcqNZmIm Dknv1wp8V+g8+R+Xa6aHC/Xvy7QJAzYI39ukwoaeO4C3XxLE1nG4JsVRIQgkN0RPU+bl951xo ZBpjwWI8lV19+9GQSsi87jTKibgWRNI7Bd0pRYfeKmLcD9EOSvNtFg/BRLJLS4lZu1tZ7IrwQ 1fbwqAQAnGbPOtAfFDw7TFPFd4hNbUbPstw/qHQ1xXTST0AUlLaXnlGB3HSNW409E3xLt6hnQ Xcwl5uE7igdIWEql6XH4P0YdJrHo4Eeag8w2mZeF2k28y31eWsNA9tySN7//oO9zmMtflpaYc 8zOeqvFbff9hMy1p/xWKCvmV6H/dayQ7Xp6QueBWmK/GzQ0hjIqcAevSWTsT4QkeOkde4BLZz IpEiy/3AcoyNq3svW0krLnTu6QZXONIOEBoEw14OCHYeqa668GlGInvG6b6h/awPE1lz8eROQ 57bANcO0pO2iV/+wP9hirteTyBUB8SCDMyF+b2BEP6fGGWxQ9HOGF8YPVTDynXqjI7dU4Whi/ 0X7lx6kVBSYZKYKV2pO9Y4G+x/1q6bMOM/ArUmm14wID7JO3Qwdp4F5N7SFUkhMnuATaaGb+Z b92xZmMWp/rDG1xH1n10uL08H2m5g== X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 18:33:55 -0000 --Sig_/zrACyMS6vy8QRQ5v5SB5uA5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Am Sat, 13 Jan 2018 18:09:10 +0000 (UTC) "Pedro F. Giffuni" schrieb: > Author: pfg > Date: Sat Jan 13 18:09:09 2018 > New Revision: 327934 > URL: https://svnweb.freebsd.org/changeset/base/327934 >=20 > Log: > zstd: Use memalloc(9) for calloc macro. > =20 > This is in contrib code but since we only have memalloc(9) in current we > will not upstream this. >=20 > Modified: > head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h >=20 > Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Sat Jan 13 17:56:46 > 2018 (r327933) +++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Sat > Jan 13 18:09:09 2018 (r327934) @@ -46,7 +46,7 @@ MALLOC_DECLARE(M_ZSTD); > #define malloc(x) (malloc)((x), M_ZSTD, M_WAITOK) > #define free(x) (free)((x), M_ZSTD) > /* in zstd's use of calloc, a is always 1 */ > -#define calloc(a,b) (malloc)((a)*(b), M_ZSTD, M_WAITOK | M_ZERO) > +#define calloc(a,b) (mallocarray)((a), (b), M_ZSTD, M_WAITOK | M_ZERO) > #endif > =20 > #ifdef __cplusplus > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" You reference "memalloc(9)" - but on recent CURRENT, there is no such manpa= ge available. regards, oh --=20 O. Hartmann Ich widerspreche der Nutzung oder =C3=9Cbermittlung meiner Daten f=C3=BCr Werbezwecke oder f=C3=BCr die Markt- oder Meinungsforschung (=C2=A7 28 Abs.= 4 BDSG). --Sig_/zrACyMS6vy8QRQ5v5SB5uA5 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iLUEARMKAB0WIQQZVZMzAtwC2T/86TrS528fyFhYlAUCWlpRAwAKCRDS528fyFhY lL3xAf4i6fhl2Bch0g8mGPTfUJpGpKWLwcI9SO3bHr3nDjNiwVpBneC2zNmeTLsd NdP/YbiyahDR09SyFhtlDtIXueMHAgCOL06LhqtT9jdCzo/OIwiGrmvOZhvJt749 Nf9W5YFU6j5LLLt5gb/vzKkTSz0fIHcWIkDmfSicojZSwwh0P8Cj =4Oux -----END PGP SIGNATURE----- --Sig_/zrACyMS6vy8QRQ5v5SB5uA5-- From owner-svn-src-head@freebsd.org Sat Jan 13 18:44:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B1A6E78D7E; Sat, 13 Jan 2018 18:44:29 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D230671A28; Sat, 13 Jan 2018 18:44:28 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from coleburn.home.andric.com (coleburn.home.andric.com [192.168.0.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 889E54722D; Sat, 13 Jan 2018 19:44:20 +0100 (CET) From: Dimitry Andric Message-Id: <65C751BF-FC03-4541-8D2A-A02C3A1B2A13@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_2E627374-C599-40D1-8129-6BFF3E93C96D"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r327934 - head/sys/contrib/zstd/lib/freebsd Date: Sat, 13 Jan 2018 19:44:14 +0100 In-Reply-To: <201801131809.w0DI9AZw072646@repo.freebsd.org> Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org To: "Pedro F. Giffuni" References: <201801131809.w0DI9AZw072646@repo.freebsd.org> X-Mailer: Apple Mail (2.3273) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 18:44:29 -0000 --Apple-Mail=_2E627374-C599-40D1-8129-6BFF3E93C96D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 13 Jan 2018, at 19:09, Pedro F. Giffuni wrote: >=20 > Author: pfg > Date: Sat Jan 13 18:09:09 2018 > New Revision: 327934 > URL: https://svnweb.freebsd.org/changeset/base/327934 >=20 > Log: > zstd: Use memalloc(9) for calloc macro. >=20 > This is in contrib code but since we only have memalloc(9) in current = we > will not upstream this. >=20 > Modified: > head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h >=20 > Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Sat Jan 13 = 17:56:46 2018 (r327933) > +++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Sat Jan 13 = 18:09:09 2018 (r327934) > @@ -46,7 +46,7 @@ MALLOC_DECLARE(M_ZSTD); > #define malloc(x) (malloc)((x), M_ZSTD, M_WAITOK) > #define free(x) (free)((x), M_ZSTD) > /* in zstd's use of calloc, a is always 1 */ > -#define calloc(a,b) (malloc)((a)*(b), M_ZSTD, M_WAITOK | M_ZERO) > +#define calloc(a,b) (mallocarray)((a), (b), M_ZSTD, M_WAITOK | = M_ZERO) > #endif >=20 > #ifdef __cplusplus s/memalloc/mallocarray/g, in the commit message? -Dimitry --Apple-Mail=_2E627374-C599-40D1-8129-6BFF3E93C96D Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCWlpTgwAKCRCwXqMKLiCW owI3AKC9VGFp4w/ejuRUF58BNgKNwRslAQCfTi1D71K4jmjbvLhjYIrBgNAM96w= =ufB6 -----END PGP SIGNATURE----- --Apple-Mail=_2E627374-C599-40D1-8129-6BFF3E93C96D-- From owner-svn-src-head@freebsd.org Sat Jan 13 18:46:33 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3EBEE78F30; Sat, 13 Jan 2018 18:46:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7D0F871BBA; Sat, 13 Jan 2018 18:46:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 989C416C51; Sat, 13 Jan 2018 18:46:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DIkWdo089011; Sat, 13 Jan 2018 18:46:32 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DIkVgS089005; Sat, 13 Jan 2018 18:46:31 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801131846.w0DIkVgS089005@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 13 Jan 2018 18:46:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327936 - in head: share/man/man4 sys/arm/allwinner sys/dev/extres/syscon X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: share/man/man4 sys/arm/allwinner sys/dev/extres/syscon X-SVN-Commit-Revision: 327936 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 18:46:33 -0000 Author: kevans Date: Sat Jan 13 18:46:31 2018 New Revision: 327936 URL: https://svnweb.freebsd.org/changeset/base/327936 Log: Introduce aw_syscon(4) for earlier attachment Attaching syscon_generic earlier than BUS_PASS_DEFAULT makes it more difficult for specific syscon drivers to attach to the syscon node and to get ordering right. Further discussion yielded the following set of decisions: - Move syscon_generic to BUS_PASS_DEFAULT - If a platform needs a syscon with different attach order or probe behavior, it should subclass syscon_generic and match on the SoC specific compat string - When we come across a need for a syscon that attaches earlier but only specifies compatible = "syscon", we should create a syscon_exclusive driver that provides generic access but probes earlier and only matches if "syscon" is the only compatible. Such fdt nodes do exist in the wild right now, but we don't really use them at the moment. Additionally: - Any syscon provider that has needs any more complex than a spinlock solely for syscon access and a single memory resource should subclass syscon directly rather than attempting to subclass syscon_generic or add complexity to it. syscon_generic's attach/detach methods may be made public should the need arise to subclass it with additional attach/detach behavior. We introduce aw_syscon(4) that just subclasses syscon_generic but probes earlier to meet our requirements for if_awg and implements #2 above for this specific situation. It currently only matches a64/a83t/h3 since these are the only platforms that really need it at the time being. Discussed with: ian Reviewed by: manu, andrew, bcr (manpages, content unchanged since review) Differential Revision: https://reviews.freebsd.org/D13793 Added: head/share/man/man4/aw_syscon.4 (contents, props changed) head/sys/arm/allwinner/aw_syscon.c (contents, props changed) head/sys/dev/extres/syscon/syscon_generic.h (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/arm/allwinner/files.allwinner head/sys/dev/extres/syscon/syscon_generic.c Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Sat Jan 13 18:28:30 2018 (r327935) +++ head/share/man/man4/Makefile Sat Jan 13 18:46:31 2018 (r327936) @@ -74,6 +74,7 @@ MAN= aac.4 \ ${_aw_mmc.4} \ ${_aw_rtc.4} \ ${_aw_sid.4} \ + ${_aw_syscon.4} \ axe.4 \ axge.4 \ bce.4 \ @@ -765,6 +766,7 @@ _aw_gpio.4= aw_gpio.4 _aw_mmc.4= aw_mmc.4 _aw_rtc.4= aw_rtc.4 _aw_sid.4= aw_sid.4 +_aw_syscon.4= aw_syscon.4 .endif .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" Added: head/share/man/man4/aw_syscon.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/aw_syscon.4 Sat Jan 13 18:46:31 2018 (r327936) @@ -0,0 +1,60 @@ +.\"- +.\" Copyright (c) 2018 Kyle Evans +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd January 7, 2018 +.Dt AW_SYSCON 4 +.Os +.Sh NAME +.Nm aw_syscon +.Nd driver for the system controller in Allwinner SoC +.Sh DESCRIPTION +The +.Nm +device driver provides support for the Allwinner system controller. +This controller provides registers for tying together related functionality in a +common space. +.Nm +is required for ethernet functionality on supported devices. +.Sh HARDWARE +The +.Nm +driver supports the system controller with one of the following compatible +strings: +.Pp +.Bl -bullet -compact +.It +allwinner,sun50i-a64-system-controller +.It +allwinner,sun8i-a83t-system-controller +.It +allwinner,sun8i-h3-system-controller +.El +.Sh AUTHORS +The +.Nm +device driver was written by +.An Kyle Evans Aq Mt kevans@FreeBSD.org . Added: head/sys/arm/allwinner/aw_syscon.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/aw_syscon.c Sat Jan 13 18:46:31 2018 (r327936) @@ -0,0 +1,82 @@ +/*- + * Copyright (c) 2018 Kyle Evans + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Allwinner syscon driver + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +static struct ofw_compat_data compat_data[] = { + {"allwinner,sun50i-a64-system-controller", 1}, + {"allwinner,sun8i-a83t-system-controller", 1}, + {"allwinner,sun8i-h3-system-controller", 1}, + {NULL, 0} +}; + +static int +aw_syscon_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Allwinner syscon"); + return (BUS_PROBE_DEFAULT); +} + +static device_method_t aw_syscon_methods[] = { + DEVMETHOD(device_probe, aw_syscon_probe), + + DEVMETHOD_END +}; + +DEFINE_CLASS_1(aw_syscon, aw_syscon_driver, aw_syscon_methods, + sizeof(struct syscon_generic_softc), syscon_generic_driver); + +static devclass_t aw_syscon_devclass; +/* aw_syscon needs to attach prior to if_awg */ +EARLY_DRIVER_MODULE(aw_syscon, simplebus, aw_syscon_driver, aw_syscon_devclass, + 0, 0, BUS_PASS_DEFAULT - 1000); +MODULE_VERSION(aw_syscon, 1); Modified: head/sys/arm/allwinner/files.allwinner ============================================================================== --- head/sys/arm/allwinner/files.allwinner Sat Jan 13 18:28:30 2018 (r327935) +++ head/sys/arm/allwinner/files.allwinner Sat Jan 13 18:46:31 2018 (r327936) @@ -15,6 +15,7 @@ arm/allwinner/aw_mp.c optional smp arm/allwinner/aw_nmi.c optional intrng arm/allwinner/aw_rsb.c optional rsb | p2wi arm/allwinner/aw_rtc.c standard +arm/allwinner/aw_syscon.c optional ext_resources syscon arm/allwinner/aw_ts.c standard arm/allwinner/aw_usbphy.c optional ehci | ohci arm/allwinner/aw_wdog.c standard Modified: head/sys/dev/extres/syscon/syscon_generic.c ============================================================================== --- head/sys/dev/extres/syscon/syscon_generic.c Sat Jan 13 18:28:30 2018 (r327935) +++ head/sys/dev/extres/syscon/syscon_generic.c Sat Jan 13 18:46:31 2018 (r327936) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include "syscon_if.h" #include "syscon.h" +#include "syscon_generic.h" MALLOC_DECLARE(M_SYSCON); @@ -60,22 +61,15 @@ static int syscon_generic_modify_4(struct syscon *sysc /* * Generic syscon driver (FDT) */ -struct syscon_generic_softc { - device_t dev; - struct syscon *syscon; - struct resource *mem_res; - struct mtx mtx; -}; - static struct ofw_compat_data compat_data[] = { {"syscon", 1}, {NULL, 0} }; -#define SYSCON_LOCK(_sc) mtx_lock(&(_sc)->mtx) -#define SYSCON_UNLOCK(_sc) mtx_unlock(&(_sc)->mtx) +#define SYSCON_LOCK(_sc) mtx_lock_spin(&(_sc)->mtx) +#define SYSCON_UNLOCK(_sc) mtx_unlock_spin(&(_sc)->mtx) #define SYSCON_LOCK_INIT(_sc) mtx_init(&(_sc)->mtx, \ - device_get_nameunit((_sc)->dev), "syscon", MTX_DEF) + device_get_nameunit((_sc)->dev), "syscon", MTX_SPIN) #define SYSCON_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->mtx); #define SYSCON_ASSERT_LOCKED(_sc) mtx_assert(&(_sc)->mtx, MA_OWNED); #define SYSCON_ASSERT_UNLOCKED(_sc) mtx_assert(&(_sc)->mtx, MA_NOTOWNED); @@ -156,8 +150,8 @@ syscon_generic_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; - rid = 0; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->mem_res == NULL) { @@ -181,7 +175,6 @@ syscon_generic_detach(device_t dev) struct syscon_generic_softc *sc; sc = device_get_softc(dev); - if (sc->syscon != NULL) { syscon_unregister(sc->syscon); free(sc->syscon, M_SYSCON); @@ -206,11 +199,7 @@ static device_method_t syscon_generic_dmethods[] = { DEFINE_CLASS_0(syscon_generic, syscon_generic_driver, syscon_generic_dmethods, sizeof(struct syscon_generic_softc)); static devclass_t syscon_generic_devclass; -/* - * syscon_generic needs to attach before other devices that may require it, such - * as if_awg, but later than others to give way for more specialized syscon - * implementations. - */ + EARLY_DRIVER_MODULE(syscon_generic, simplebus, syscon_generic_driver, - syscon_generic_devclass, 0, 0, BUS_PASS_DEFAULT - 1000); + syscon_generic_devclass, 0, 0, BUS_PASS_DEFAULT); MODULE_VERSION(syscon_generic, 1); Added: head/sys/dev/extres/syscon/syscon_generic.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/extres/syscon/syscon_generic.h Sat Jan 13 18:46:31 2018 (r327936) @@ -0,0 +1,40 @@ +/*- + * Copyright 2018 Kyle Evans + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef DEV_SYSCON_GENERIC_H +#define DEV_SYSCON_GENERIC_H + +struct syscon_generic_softc { + device_t dev; + struct syscon *syscon; + struct resource *mem_res; + struct mtx mtx; +}; + +DECLARE_CLASS(syscon_generic_driver); + +#endif /* DEV_SYSCON_GENERIC_H */ From owner-svn-src-head@freebsd.org Sat Jan 13 18:46:34 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1829AE78F34 for ; Sat, 13 Jan 2018 18:46:34 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic302-36.consmr.mail.gq1.yahoo.com (sonic302-36.consmr.mail.gq1.yahoo.com [98.137.68.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCEEE71BBB for ; Sat, 13 Jan 2018 18:46:33 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1515869187; bh=X+5YNohHpG+cHuOpbSes1C+aWwfxX6x/qAkNzatHLRE=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=l5dqU6wX6GtHsM8/XrzwH8iHlzA+RZ2HTcD1E+wDgOtPFBGLco89TC55eU86wzb0mTiZopm5EzZh2Dwe2SFU4CbFIEQV5EVOJvz/qQs8qvpp4obhCf4FMiK1KQKLRi5SXsK414clcrNpmhnqEmaBNLOmmZPkcjxtJ/xfw7d29ldWy7k+gPBioWAHSmfdicvszaTRfAh6l/f3RbEdkr/5jdWXpgjQmnd+breAumW0Lew6V7w0OO4bi1do/1pvKtew3ad7+CMUis5+blw4nPT6/cLME3Y+nb6EcwsoFiFMV0ejQ6gCAGneObhDOxPf0jP24SuMsijt+q4Oroxd/O7o/A== X-YMail-OSG: PTnuY3MVM1kY_EegpgCFueHxSmwY5nvuMF170QF7v6OLtmljzSIxFrF9sfBHWs9 pUxF23jEe9dUrKaryPX2k_lQE0BQLNPkrnZWNtM972b8_7obdqtWT1EcqiZVrcXATQYfatF5i37d xP8TllUbsAT4YURv1L8JcTKW0WUAo62FACxSXNC7O02I1v2xbH5Ow1bpzUX9qp2RUPdIiTcAOdjW qBYUJL6DngqH3_RHL74HroNAuEX8h7JmP3UihcFFlCriOxWzF5vEgFbYCvjfMunWzIQrd_mdnBwT u6u2nzFMT19lvGOQyR29UoQZWnltIDWqsFZB1ZCxFhx6J9NsaVkKYZlakyL5HYyr5IA.BEIzvP5S 5sQRvS1PGlfDHHEXf16EIXWL9XIRrStw_MWUtN.uql07XcC1oimIZL7P6Jp2s7ntzsCUszANhDkd eVX0o3qBJzlzOkEA7J_nFZ2dlNb96GxPSxKTaLvgnmz97F3YHicbsgdFKz20n9C7JYiNWGAIX Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.gq1.yahoo.com with HTTP; Sat, 13 Jan 2018 18:46:27 +0000 Received: from smtp107.rhel.mail.gq1.yahoo.com (EHLO [192.168.0.8]) ([10.211.35.149]) by smtp404.mail.gq1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 098556ea92db86deb3372d59b6ccc9e6; Sat, 13 Jan 2018 18:46:25 +0000 (UTC) Subject: Re: svn commit: r327934 - head/sys/contrib/zstd/lib/freebsd To: Dimitry Andric Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801131809.w0DI9AZw072646@repo.freebsd.org> <65C751BF-FC03-4541-8D2A-A02C3A1B2A13@FreeBSD.org> From: Pedro Giffuni Message-ID: Date: Sat, 13 Jan 2018 13:46:25 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <65C751BF-FC03-4541-8D2A-A02C3A1B2A13@FreeBSD.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 18:46:34 -0000 On 01/13/18 13:44, Dimitry Andric wrote: > On 13 Jan 2018, at 19:09, Pedro F. Giffuni wrote: >> Author: pfg >> Date: Sat Jan 13 18:09:09 2018 >> New Revision: 327934 >> URL: https://svnweb.freebsd.org/changeset/base/327934 >> >> Log: >> zstd: Use memalloc(9) for calloc macro. >> >> This is in contrib code but since we only have memalloc(9) in current we >> will not upstream this. >> >> Modified: >> head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h >> >> Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h >> ============================================================================== >> --- head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Sat Jan 13 17:56:46 2018 (r327933) >> +++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Sat Jan 13 18:09:09 2018 (r327934) >> @@ -46,7 +46,7 @@ MALLOC_DECLARE(M_ZSTD); >> #define malloc(x) (malloc)((x), M_ZSTD, M_WAITOK) >> #define free(x) (free)((x), M_ZSTD) >> /* in zstd's use of calloc, a is always 1 */ >> -#define calloc(a,b) (malloc)((a)*(b), M_ZSTD, M_WAITOK | M_ZERO) >> +#define calloc(a,b) (mallocarray)((a), (b), M_ZSTD, M_WAITOK | M_ZERO) >> #endif >> >> #ifdef __cplusplus > s/memalloc/mallocarray/g, in the commit message? Oops ..yeah.. mind glitch. Should I revert/fix it? Pedro. From owner-svn-src-head@freebsd.org Sat Jan 13 18:56:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5350FE7970B for ; Sat, 13 Jan 2018 18:56:05 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic302-36.consmr.mail.gq1.yahoo.com (sonic302-36.consmr.mail.gq1.yahoo.com [98.137.68.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2DE00723B1 for ; Sat, 13 Jan 2018 18:56:04 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1515869764; bh=q2qNcTASJIRmZ0orWgIdKPYRu37F07TmFr+LfRbHCEc=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=n6feKq0eRI/55OJlNdT2EQu9eWUARr5mv5y8IhHbIbZQkwpGIYShz4XrJtvSENo8iYqGnrD5I44SWa51jPQFwjY9pWk42hAEM5WYnBlUklBLtdXjB5ZWzYkOOZpYOrMmqFzGl/RrT4xLMB6xfFqdABjxnCpyGoRRaWxwNZE13hS4yJWuJP1VkHHltY9cF2tggTrZlNf8m78rzuIhCD/3wDQXpXE4VMQSKdSHVchdQmLUisO+BULPLucnGhIqSrEpMnhYS0KWo0eYpYwCHHLkB8skKAqQ32LUnCnAjnHmyjOw74iBQuuoDXLs3HJdcWuQGQLLCct7AtvbnoZWERemAw== X-YMail-OSG: M4_JIx0VM1mPmy.QqW2c35eNnuY26wNosWj1xe2JhZdY9WzqJe0JqKxUEnEF0Za Nh4WD.IrlvxJYj.fsCklrhnAJZzVEsghGGt_QURcf_dDE3ypmyiV4p3ekmkq1iq_OvnJl2wOYVU9 wpzUaN9E4pl1dH16itC5iUimhiOpKs4xEVp2ZqL8HrkG_QyIqRI.oK2wBrW9JRTNr.Bf1ts4OhjX 5HSaSijBrXccixJ8L1qxosJXxPT0wi.erlz1wqeHaT6J63tEh8Thz7Dm.4qA5.fmgLTFwUy4HKyf Bq38smRBKRcd8ON1dD1i09sIvjMbco2P.G14gSeNU_Bq8MGsSvnEMZ3JB28STJZMyTnl16AY_WhR 3_JpF9M4kj0r6guOwYE7ckUMt6YHEh.C6ofeazkHgOfb3XkV5mfwZSTML__FLnrUK5Bb9wUJW44k t6_zhRbnUk_NMkDQYvPhtk4GM_c3sSe3YoAd9vwyDlMwym7d.ZCQ8HRufM5dvsWKAK.BWSiRr Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.gq1.yahoo.com with HTTP; Sat, 13 Jan 2018 18:56:04 +0000 Received: from smtpgate102.mail.gq1.yahoo.com (EHLO [192.168.0.8]) ([10.214.153.45]) by smtp411.mail.gq1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID ec4a0d578193683c99ac631cd3d9b51e; Sat, 13 Jan 2018 18:55:59 +0000 (UTC) Subject: Re: svn commit: r327928 - head/sys/powerpc/mpc85xx To: Kyle Evans Cc: src-committers , Justin Hibbits , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801131725.w0DHPmY5055584@repo.freebsd.org> From: Pedro Giffuni Message-ID: Date: Sat, 13 Jan 2018 13:55:59 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 18:56:05 -0000 Hello; On 01/13/18 13:26, Kyle Evans wrote: > On Sat, Jan 13, 2018 at 11:25 AM, Justin Hibbits wrote: >> Author: jhibbits >> Date: Sat Jan 13 17:25:48 2018 >> New Revision: 327928 >> URL: https://svnweb.freebsd.org/changeset/base/327928 >> >> Log: >> Add SPDX identifier to header >> >> Reported by: pfg >> >> Modified: >> head/sys/powerpc/mpc85xx/mpc85xx_cache.c >> >> Modified: head/sys/powerpc/mpc85xx/mpc85xx_cache.c >> ============================================================================== >> --- head/sys/powerpc/mpc85xx/mpc85xx_cache.c Sat Jan 13 17:21:45 2018 (r327927) >> +++ head/sys/powerpc/mpc85xx/mpc85xx_cache.c Sat Jan 13 17:25:48 2018 (r327928) >> @@ -1,4 +1,6 @@ >> /*- >> + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD >> + * >> * Copyright (c) 2018 Justin Hibbits >> * All rights reserved. >> * > Doesn't BSD-2-Clause-FreeBSD imply that the license includes the > following disclaimer? > > "The views and conclusions contained in the software and documentation > are those of the authors and should not be interpreted as representing > official policies, either expressed or implied, of the FreeBSD > Project." > > That's what the SPDX license list seems to imply. I have some stuff > I've recently added that I need to go back and tag. No, the SPDX guys pointed to our website: https://www.freebsd.org/copyright/freebsd-license.html And by mistake they added the documentation project disclaimer, but that last paragraph is not part of the license. At some point I reported the issue but they haven't fixed it. Pedro. From owner-svn-src-head@freebsd.org Sat Jan 13 18:56:43 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF6E9E797CB; Sat, 13 Jan 2018 18:56:43 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CBA2472512; Sat, 13 Jan 2018 18:56:43 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0554E16DF3; Sat, 13 Jan 2018 18:56:43 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DIugE6093126; Sat, 13 Jan 2018 18:56:42 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DIugDH093125; Sat, 13 Jan 2018 18:56:42 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801131856.w0DIugDH093125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 13 Jan 2018 18:56:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327937 - head/sys/contrib/zstd/lib/freebsd X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/sys/contrib/zstd/lib/freebsd X-SVN-Commit-Revision: 327937 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 18:56:44 -0000 Author: pfg Date: Sat Jan 13 18:56:42 2018 New Revision: 327937 URL: https://svnweb.freebsd.org/changeset/base/327937 Log: Revert r327934 to fix the log message. Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h ============================================================================== --- head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Sat Jan 13 18:46:31 2018 (r327936) +++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Sat Jan 13 18:56:42 2018 (r327937) @@ -46,7 +46,7 @@ MALLOC_DECLARE(M_ZSTD); #define malloc(x) (malloc)((x), M_ZSTD, M_WAITOK) #define free(x) (free)((x), M_ZSTD) /* in zstd's use of calloc, a is always 1 */ -#define calloc(a,b) (mallocarray)((a), (b), M_ZSTD, M_WAITOK | M_ZERO) +#define calloc(a,b) (malloc)((a)*(b), M_ZSTD, M_WAITOK | M_ZERO) #endif #ifdef __cplusplus From owner-svn-src-head@freebsd.org Sat Jan 13 19:00:42 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC550E79A4B; Sat, 13 Jan 2018 19:00:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B68207272F; Sat, 13 Jan 2018 19:00:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD08F16E03; Sat, 13 Jan 2018 19:00:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DJ0fB0093359; Sat, 13 Jan 2018 19:00:41 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DJ0frR093354; Sat, 13 Jan 2018 19:00:41 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801131900.w0DJ0frR093354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 13 Jan 2018 19:00:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327938 - head/sys/dev/extres/syscon X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/dev/extres/syscon X-SVN-Commit-Revision: 327938 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 19:00:43 -0000 Author: kevans Date: Sat Jan 13 19:00:41 2018 New Revision: 327938 URL: https://svnweb.freebsd.org/changeset/base/327938 Log: Add SPDX tags to syscon bits, correct inconsistency in Copyright line. Modified: head/sys/dev/extres/syscon/syscon.c head/sys/dev/extres/syscon/syscon.h head/sys/dev/extres/syscon/syscon_generic.c head/sys/dev/extres/syscon/syscon_generic.h Modified: head/sys/dev/extres/syscon/syscon.c ============================================================================== --- head/sys/dev/extres/syscon/syscon.c Sat Jan 13 18:56:42 2018 (r327937) +++ head/sys/dev/extres/syscon/syscon.c Sat Jan 13 19:00:41 2018 (r327938) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2017 Kyle Evans * All rights reserved. * Modified: head/sys/dev/extres/syscon/syscon.h ============================================================================== --- head/sys/dev/extres/syscon/syscon.h Sat Jan 13 18:56:42 2018 (r327937) +++ head/sys/dev/extres/syscon/syscon.h Sat Jan 13 19:00:41 2018 (r327938) @@ -1,5 +1,7 @@ /*- - * Copyright 2017 Kyle Evans + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2017 Kyle Evans * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/extres/syscon/syscon_generic.c ============================================================================== --- head/sys/dev/extres/syscon/syscon_generic.c Sat Jan 13 18:56:42 2018 (r327937) +++ head/sys/dev/extres/syscon/syscon_generic.c Sat Jan 13 19:00:41 2018 (r327938) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2015 Michal Meloun * All rights reserved. * Modified: head/sys/dev/extres/syscon/syscon_generic.h ============================================================================== --- head/sys/dev/extres/syscon/syscon_generic.h Sat Jan 13 18:56:42 2018 (r327937) +++ head/sys/dev/extres/syscon/syscon_generic.h Sat Jan 13 19:00:41 2018 (r327938) @@ -1,5 +1,7 @@ /*- - * Copyright 2018 Kyle Evans + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Kyle Evans * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-head@freebsd.org Sat Jan 13 19:02:10 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B8F5E79CBB; Sat, 13 Jan 2018 19:02:10 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1C7F372AE4; Sat, 13 Jan 2018 19:02:10 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F3DE16F7B; Sat, 13 Jan 2018 19:02:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DJ290g095230; Sat, 13 Jan 2018 19:02:09 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DJ29R7095229; Sat, 13 Jan 2018 19:02:09 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801131902.w0DJ29R7095229@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 13 Jan 2018 19:02:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327939 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 327939 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 19:02:10 -0000 Author: kevans Date: Sat Jan 13 19:02:08 2018 New Revision: 327939 URL: https://svnweb.freebsd.org/changeset/base/327939 Log: Add SPDX tag to aw_syscon(4) Modified: head/sys/arm/allwinner/aw_syscon.c Modified: head/sys/arm/allwinner/aw_syscon.c ============================================================================== --- head/sys/arm/allwinner/aw_syscon.c Sat Jan 13 19:00:41 2018 (r327938) +++ head/sys/arm/allwinner/aw_syscon.c Sat Jan 13 19:02:08 2018 (r327939) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2018 Kyle Evans * All rights reserved. * From owner-svn-src-head@freebsd.org Sat Jan 13 19:02:52 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C100FE79D5D; Sat, 13 Jan 2018 19:02:52 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D73372CFC; Sat, 13 Jan 2018 19:02:52 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E635C16F9B; Sat, 13 Jan 2018 19:02:51 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DJ2pYo097643; Sat, 13 Jan 2018 19:02:51 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DJ2p5m097642; Sat, 13 Jan 2018 19:02:51 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801131902.w0DJ2p5m097642@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 13 Jan 2018 19:02:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327940 - head/sys/contrib/zstd/lib/freebsd X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/sys/contrib/zstd/lib/freebsd X-SVN-Commit-Revision: 327940 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 19:02:52 -0000 Author: pfg Date: Sat Jan 13 19:02:51 2018 New Revision: 327940 URL: https://svnweb.freebsd.org/changeset/base/327940 Log: zstd: Use mallocarray(9) for calloc macro. This is in contrib code but since we only have mallocarray(9) in current we will not upstream this. This effectively brings back r327934, which was reverted to correct the log message. Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h ============================================================================== --- head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Sat Jan 13 19:02:08 2018 (r327939) +++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Sat Jan 13 19:02:51 2018 (r327940) @@ -46,7 +46,7 @@ MALLOC_DECLARE(M_ZSTD); #define malloc(x) (malloc)((x), M_ZSTD, M_WAITOK) #define free(x) (free)((x), M_ZSTD) /* in zstd's use of calloc, a is always 1 */ -#define calloc(a,b) (malloc)((a)*(b), M_ZSTD, M_WAITOK | M_ZERO) +#define calloc(a,b) (mallocarray)((a), (b), M_ZSTD, M_WAITOK | M_ZERO) #endif #ifdef __cplusplus From owner-svn-src-head@freebsd.org Sat Jan 13 19:03:34 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E80C2E79E26; Sat, 13 Jan 2018 19:03:34 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-it0-f51.google.com (mail-it0-f51.google.com [209.85.214.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B847472E4E; Sat, 13 Jan 2018 19:03:34 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-it0-f51.google.com with SMTP id r6so12896561itr.3; Sat, 13 Jan 2018 11:03:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=4OWTl8FfCH9zaN1NHtTHfrRh3dGrOUS8fIv/8AINdM0=; b=fjBV8fvzfPK77bV5gNifmIELaime+Kqd/+OHJMja2QAeAkMuMuKuPis7xZJWKaIVRA 6Z8LlKvTOdexwYFyHnWuXnT/uem0P0QZE3l/FlqDtruGfZMBv4cAGv6UMrqAB9/Fe8ri hItKdUWVYh7vhc5WAukDuH96iK8QpCUeuLwdMdcKfk5fXM2m/3HDUCTtbyJcLkxdc5AY cLHdh35zDH0lljhPw/uCbORSFpPuSYvqzjEaR62KSmbRCCmoVS3d2CSA0B9f6q9EXYSV cXp/RCcSyxG/feGlJbHyHKec1IfNDyBFGW5MFXb4QggFYDgwBRBaTQBuJg5s5ojh7FQm SBwA== X-Gm-Message-State: AKwxytdCz/M0IY/+Qcm79JHsbBkaj0Rjw5J1wSv4pLuTQyN5fgeR3db0 QLfG/YJTFdQrWCD9M8UCuOVkogQq X-Google-Smtp-Source: ACJfBovlCWRcKvtwWBvIFIkZDHMzMtjGYtCk1k3/M0Tbd72a1FMPJ0F1OKGYJqzfUsIjCe8pB+PNrg== X-Received: by 10.36.222.66 with SMTP id d63mr8162788itg.99.1515870208384; Sat, 13 Jan 2018 11:03:28 -0800 (PST) Received: from mail-it0-f49.google.com (mail-it0-f49.google.com. [209.85.214.49]) by smtp.gmail.com with ESMTPSA id f63sm14584235ioj.43.2018.01.13.11.03.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Jan 2018 11:03:28 -0800 (PST) Received: by mail-it0-f49.google.com with SMTP id r6so12896519itr.3; Sat, 13 Jan 2018 11:03:27 -0800 (PST) X-Received: by 10.36.4.212 with SMTP id 203mr4097034itb.132.1515870207615; Sat, 13 Jan 2018 11:03:27 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.149.147 with HTTP; Sat, 13 Jan 2018 11:03:07 -0800 (PST) In-Reply-To: References: <201801131725.w0DHPmY5055584@repo.freebsd.org> From: Kyle Evans Date: Sat, 13 Jan 2018 13:03:07 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r327928 - head/sys/powerpc/mpc85xx To: Pedro Giffuni Cc: src-committers , Justin Hibbits , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 19:03:35 -0000 On Sat, Jan 13, 2018 at 12:55 PM, Pedro Giffuni wrote: > Hello; > > > > On 01/13/18 13:26, Kyle Evans wrote: >> >> On Sat, Jan 13, 2018 at 11:25 AM, Justin Hibbits >> wrote: >>> >>> Author: jhibbits >>> Date: Sat Jan 13 17:25:48 2018 >>> New Revision: 327928 >>> URL: https://svnweb.freebsd.org/changeset/base/327928 >>> >>> Log: >>> Add SPDX identifier to header >>> >>> Reported by: pfg >>> >>> Modified: >>> head/sys/powerpc/mpc85xx/mpc85xx_cache.c >>> >>> Modified: head/sys/powerpc/mpc85xx/mpc85xx_cache.c >>> >>> ============================================================================== >>> --- head/sys/powerpc/mpc85xx/mpc85xx_cache.c Sat Jan 13 17:21:45 2018 >>> (r327927) >>> +++ head/sys/powerpc/mpc85xx/mpc85xx_cache.c Sat Jan 13 17:25:48 2018 >>> (r327928) >>> @@ -1,4 +1,6 @@ >>> /*- >>> + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD >>> + * >>> * Copyright (c) 2018 Justin Hibbits >>> * All rights reserved. >>> * >> >> Doesn't BSD-2-Clause-FreeBSD imply that the license includes the >> following disclaimer? >> >> "The views and conclusions contained in the software and documentation >> are those of the authors and should not be interpreted as representing >> official policies, either expressed or implied, of the FreeBSD >> Project." >> >> That's what the SPDX license list seems to imply. I have some stuff >> I've recently added that I need to go back and tag. > > No, the SPDX guys pointed to our website: > > https://www.freebsd.org/copyright/freebsd-license.html > > And by mistake they added the documentation project disclaimer, but that > last paragraph is not part of the license. At some point I reported the > issue but they haven't fixed it. Thanks for the clarification! From owner-svn-src-head@freebsd.org Sat Jan 13 19:23:18 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6E78E7ACD7; Sat, 13 Jan 2018 19:23:18 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f43.google.com (mail-it0-f43.google.com [209.85.214.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AEFC07385D; Sat, 13 Jan 2018 19:23:18 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f43.google.com with SMTP id b77so12707684itd.0; Sat, 13 Jan 2018 11:23:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=iDQKLMPrAzRbtt3aQwemw36Is+O+xJ0hTxVC19RKEKw=; b=pEPPWxRD+qWdWsBgyzcSorncwdB7+xejLNrFZqZX+tUZNlWM4SDQZJN/MGo5dFwLaT lrgdRA+TpA/LgDoiTWxFSnEisOzQ6iOKt5uI3uACOvYPhT9L4L5fCp6uKqoHiNcCyh67 AHL9lY/GDlUvumtx+A7GpxEuckZwFCf2ydfxVfHyvScwQHdu47PCuLvADg72BXhcSE5w 1K3cXCDIbmihavNWtLXjG26vBM1cWCdq0WBHRJVseYcKc6qjVLMyMQGhW3J+bBNOJ2JY tIP816lpz1+MfeT/FavRyClTSLoLYqKSMAAtDKB0tfpC4ZfqxbxoUT6Bt0zoPF6WhHji dVOg== X-Gm-Message-State: AKwxytdTt8XPQu5HAHqd6OLoMG8zmyA9YxvbaHjh0gbdOJHIaUlzJwY/ ZKKsuIb9HCkUBDKkW19pYTIU+8cK X-Google-Smtp-Source: ACJfBosB9U67hjzUpy+NikfAg4e7WJAeHj0XwBKW7r8KTs/q5n4/AQfarzR08eVp0gTroh4etllqxw== X-Received: by 10.36.144.198 with SMTP id x189mr8786638itd.94.1515871392669; Sat, 13 Jan 2018 11:23:12 -0800 (PST) Received: from mail-io0-f178.google.com (mail-io0-f178.google.com. [209.85.223.178]) by smtp.gmail.com with ESMTPSA id e22sm1010513ioj.79.2018.01.13.11.23.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Jan 2018 11:23:12 -0800 (PST) Received: by mail-io0-f178.google.com with SMTP id f89so1219405ioj.4; Sat, 13 Jan 2018 11:23:12 -0800 (PST) X-Received: by 10.107.53.223 with SMTP id k92mr30719846ioo.38.1515871392339; Sat, 13 Jan 2018 11:23:12 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.74.80 with HTTP; Sat, 13 Jan 2018 11:23:11 -0800 (PST) In-Reply-To: <201801131809.w0DI9AZw072646@repo.freebsd.org> References: <201801131809.w0DI9AZw072646@repo.freebsd.org> From: Conrad Meyer Date: Sat, 13 Jan 2018 11:23:11 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r327934 - head/sys/contrib/zstd/lib/freebsd To: "Pedro F. Giffuni" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 19:23:19 -0000 On Sat, Jan 13, 2018 at 10:09 AM, Pedro F. Giffuni wrote: > Author: pfg > Date: Sat Jan 13 18:09:09 2018 > New Revision: 327934 > URL: https://svnweb.freebsd.org/changeset/base/327934 > > Log: > zstd: Use memalloc(9) for calloc macro. > > This is in contrib code but since we only have memalloc(9) in current we > will not upstream this. Fortunately, zstd_kfreebsd.h is not contrib code but local code. We don't have to worry about upstreaming this change. Please consider including review from Allan Jude, Warner, or myself on future zstd changes. We've tried to be very careful not to modify contrib code. For the record, though, I approve this change. Best, Conrad > Modified: > head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h From owner-svn-src-head@freebsd.org Sat Jan 13 19:24:20 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96E19E7B15F; Sat, 13 Jan 2018 19:24:20 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f51.google.com (mail-it0-f51.google.com [209.85.214.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 639D973B48; Sat, 13 Jan 2018 19:24:19 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f51.google.com with SMTP id q8so1202909itb.2; Sat, 13 Jan 2018 11:24:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=Iqgup9bJOMHioc9XQFBwna1j7Hy0+eX3mkVHM+0hWd0=; b=gxcG4wo5tVKgHOVDRKrY8RoSRZXljJ0D9DC9HKlR87R/e6up77ifKoZtf+mlTaI5os E5iWn6TLUfi88lzF+y+D3c0vggDW0TMTm2wb5bNR+nq6y5UbCuu+ebfdtvPN4NKg92vY 5nqvnIi8XRsot3lLEXWaKqFEr+mbnxMrta+o0WMJjdqkS94ctDky4weuPRrADHGx1zD6 5rhgAvLegnzo2pJaO9UMd44rL0TgGTYYmVZLGv51Hk271/fKyvydDJwxVul4Vt8LHwpt U7jbLhv7HNckueePyWoeqWnVPUkD8xouz4DkFc7wbTzsy0LFIYyAPz7UZdF3SCWm6Xsa SfwQ== X-Gm-Message-State: AKwxytei+uePzVVdo/UpjkyYnVu+LLBGyX1YxWVNdN+jaIXuy/8hiqth eL+iiM8KV2RmeDvZ6fFmmkBX9D0+ X-Google-Smtp-Source: ACJfBotx6XXf1vJNla/IL8S1CRPTWH/nKuPWIAp65IoXn4il93UqimMPA0lAx0r2gWcOWSz6XVlt8A== X-Received: by 10.36.1.66 with SMTP id 63mr9295502itk.104.1515871458642; Sat, 13 Jan 2018 11:24:18 -0800 (PST) Received: from mail-it0-f43.google.com (mail-it0-f43.google.com. [209.85.214.43]) by smtp.gmail.com with ESMTPSA id q2sm3440710ite.17.2018.01.13.11.24.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Jan 2018 11:24:18 -0800 (PST) Received: by mail-it0-f43.google.com with SMTP id q8so1202897itb.2; Sat, 13 Jan 2018 11:24:18 -0800 (PST) X-Received: by 10.36.114.193 with SMTP id x184mr8897496itc.71.1515871458231; Sat, 13 Jan 2018 11:24:18 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.74.80 with HTTP; Sat, 13 Jan 2018 11:24:17 -0800 (PST) In-Reply-To: <201801131902.w0DJ2p5m097642@repo.freebsd.org> References: <201801131902.w0DJ2p5m097642@repo.freebsd.org> From: Conrad Meyer Date: Sat, 13 Jan 2018 11:24:17 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r327940 - head/sys/contrib/zstd/lib/freebsd To: "Pedro F. Giffuni" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 19:24:20 -0000 This is not in contrib code -- https://lists.freebsd.org/pipermail/svn-src-all/2018-January/156505.html . On Sat, Jan 13, 2018 at 11:02 AM, Pedro F. Giffuni wrote: > Author: pfg > Date: Sat Jan 13 19:02:51 2018 > New Revision: 327940 > URL: https://svnweb.freebsd.org/changeset/base/327940 > > Log: > zstd: Use mallocarray(9) for calloc macro. > > This is in contrib code but since we only have mallocarray(9) in current > we will not upstream this. > > This effectively brings back r327934, which was reverted to correct the > log message. > > Modified: > head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h > > Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h > ============================================================================== > --- head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Sat Jan 13 19:02:08 2018 (r327939) > +++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Sat Jan 13 19:02:51 2018 (r327940) > @@ -46,7 +46,7 @@ MALLOC_DECLARE(M_ZSTD); > #define malloc(x) (malloc)((x), M_ZSTD, M_WAITOK) > #define free(x) (free)((x), M_ZSTD) > /* in zstd's use of calloc, a is always 1 */ > -#define calloc(a,b) (malloc)((a)*(b), M_ZSTD, M_WAITOK | M_ZERO) > +#define calloc(a,b) (mallocarray)((a), (b), M_ZSTD, M_WAITOK | M_ZERO) > #endif > > #ifdef __cplusplus > From owner-svn-src-head@freebsd.org Sat Jan 13 19:54:27 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC7CAE7C89E for ; Sat, 13 Jan 2018 19:54:27 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic303-37.consmr.mail.gq1.yahoo.com (sonic303-37.consmr.mail.gq1.yahoo.com [98.137.64.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A56CE74A93 for ; Sat, 13 Jan 2018 19:54:27 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1515873261; bh=Rbn9NZx+TOdpHW12SF7c+slwQghMF9MYUPNyp9mPNck=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=I500I6IABq/Nm79FZ0gqBVNddfzcIdcIyfLe749nuVki2+Lznicdx8TcUq0TG1rYkH9mbMSEIDngV/hAOXqhcU3aqcpVbhumr+vkDK3brrqTUI3mIaJaJV5fm+QmwRLKxM2QAOTehWv6tOvsEjUQpCx70Jmih3j/ZVs60IK1n92La8+V25K1ek8uHKKgxKtEIB7iA8PEfypTGB0WlXu8gNYElCZzqHJLQbjpdYGUZ5QKy4nCco5Xbiw/4NCSoP5bhFwQX4vhrogYjrgsSd1j1qEHq3mujApeeqsEmTTfR2Cb5Z2xBzafIRRF/35eda91CSwbfJORiIltCJembW2J8w== X-YMail-OSG: aWu9jm0VM1nPa1rfrUc0XpJWBu6AqUc0agvVK_rCejBRD2r1teMWwA0tL_q9LkJ T7tOH4a._C7A71OhV5yrmOpiRrqwqjnx4TB38xPkErI7bLDzVkc1AZFzNGZTmTXtCOz0y1oegDK5 w_9.nrIECHbj8WNjrMKv8j7Tk8Ho95dkh6.WCofcs54wLwR2IwAhduwdDe9oPibZ4AglCos3QHBS WNxnQI047BCNuQyiKQhLMrh1lGofbNc.sigMY5sWVcox2JFTG4LKldfmlUpuyCLY0A33zwGx.9pR 2nwaqzGNa09ovkRAnRCvmZsNZbHZL2BaoNWB.T03mMQCnzXh4lWGR9vyxaRJm9wdOURhk1l1N5Fz kjHbcgoereJ5T.DwHSyFGPkDzpFxJdevnQ9Nn4jfzHSiqkhJrEz1fTz1oD8yyNRHCBPoG_yzaKtU UPUEWUvSSnYnnY_gmej9855zFTgwcKB21c41YeBjgajSmuLdVMM80BsPWE_n1LALAs2k4YjwrhA- - Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.gq1.yahoo.com with HTTP; Sat, 13 Jan 2018 19:54:21 +0000 Received: from smtp108.rhel.mail.gq1.yahoo.com (EHLO [192.168.0.8]) ([216.39.57.224]) by smtp408.mail.gq1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 36f354086b769ddf992a87b591bd6e8e; Sat, 13 Jan 2018 19:54:19 +0000 (UTC) Subject: Re: svn commit: r327940 - head/sys/contrib/zstd/lib/freebsd To: cem@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801131902.w0DJ2p5m097642@repo.freebsd.org> From: Pedro Giffuni Message-ID: Date: Sat, 13 Jan 2018 14:54:19 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 19:54:27 -0000 Hmm ... On 01/13/18 14:24, Conrad Meyer wrote: > This is not in contrib code -- > https://lists.freebsd.org/pipermail/svn-src-all/2018-January/156505.html > . Thanks, I read it late... Shouldn't the local code be in usr.bin/zstd ? Pedro. > > On Sat, Jan 13, 2018 at 11:02 AM, Pedro F. Giffuni wrote: >> Author: pfg >> Date: Sat Jan 13 19:02:51 2018 >> New Revision: 327940 >> URL: https://svnweb.freebsd.org/changeset/base/327940 >> >> Log: >> zstd: Use mallocarray(9) for calloc macro. >> >> This is in contrib code but since we only have mallocarray(9) in current >> we will not upstream this. >> >> This effectively brings back r327934, which was reverted to correct the >> log message. >> >> Modified: >> head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h >> >> Modified: head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h >> ============================================================================== >> --- head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Sat Jan 13 19:02:08 2018 (r327939) >> +++ head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h Sat Jan 13 19:02:51 2018 (r327940) >> @@ -46,7 +46,7 @@ MALLOC_DECLARE(M_ZSTD); >> #define malloc(x) (malloc)((x), M_ZSTD, M_WAITOK) >> #define free(x) (free)((x), M_ZSTD) >> /* in zstd's use of calloc, a is always 1 */ >> -#define calloc(a,b) (malloc)((a)*(b), M_ZSTD, M_WAITOK | M_ZERO) >> +#define calloc(a,b) (mallocarray)((a), (b), M_ZSTD, M_WAITOK | M_ZERO) >> #endif >> >> #ifdef __cplusplus >> From owner-svn-src-head@freebsd.org Sat Jan 13 19:58:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07868E7CAFD; Sat, 13 Jan 2018 19:58:15 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from mx1.scaleengine.net (mx1.scaleengine.net [209.51.186.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DAB1274C80; Sat, 13 Jan 2018 19:58:14 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from [10.1.1.2] (Seawolf.HML3.ScaleEngine.net [209.51.186.28]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by mx1.scaleengine.net (Postfix) with ESMTPSA id 2CEE213771; Sat, 13 Jan 2018 19:58:07 +0000 (UTC) Subject: Re: svn commit: r327934 - head/sys/contrib/zstd/lib/freebsd To: "Pedro F. Giffuni" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801131809.w0DI9AZw072646@repo.freebsd.org> From: Allan Jude Message-ID: <63f8d491-edef-5b92-8b4c-04f64c15c847@freebsd.org> Date: Sat, 13 Jan 2018 14:58:06 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 19:58:15 -0000 On 2018-01-13 14:23, Conrad Meyer wrote: > On Sat, Jan 13, 2018 at 10:09 AM, Pedro F. Giffuni wrote: >> Author: pfg >> Date: Sat Jan 13 18:09:09 2018 >> New Revision: 327934 >> URL: https://svnweb.freebsd.org/changeset/base/327934 >> >> Log: >> zstd: Use memalloc(9) for calloc macro. >> >> This is in contrib code but since we only have memalloc(9) in current we >> will not upstream this. > > Fortunately, zstd_kfreebsd.h is not contrib code but local code. We > don't have to worry about upstreaming this change. Please consider > including review from Allan Jude, Warner, or myself on future zstd > changes. We've tried to be very careful not to modify contrib code. > > For the record, though, I approve this change. > > Best, > Conrad > >> Modified: >> head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h > Looks good to me too -- Allan Jude From owner-svn-src-head@freebsd.org Sat Jan 13 19:58:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DADC6E7CBE4; Sat, 13 Jan 2018 19:58:56 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from mx1.scaleengine.net (mx1.scaleengine.net [209.51.186.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6EF574DF1; Sat, 13 Jan 2018 19:58:56 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from [10.1.1.2] (Seawolf.HML3.ScaleEngine.net [209.51.186.28]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by mx1.scaleengine.net (Postfix) with ESMTPSA id 9D6B713777; Sat, 13 Jan 2018 19:58:55 +0000 (UTC) Subject: Re: svn commit: r327940 - head/sys/contrib/zstd/lib/freebsd To: Pedro Giffuni , cem@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801131902.w0DJ2p5m097642@repo.freebsd.org> From: Allan Jude Message-ID: Date: Sat, 13 Jan 2018 14:58:55 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 19:58:57 -0000 On 2018-01-13 14:54, Pedro Giffuni wrote: > Hmm ... > > > On 01/13/18 14:24, Conrad Meyer wrote: >> This is not in contrib code -- >> https://lists.freebsd.org/pipermail/svn-src-all/2018-January/156505.html >> . > > Thanks, I read it late... > > Shouldn't the local code be in usr.bin/zstd ? > > Pedro. > This .h file is only used for the kernel version of zstd, not the userland version. -- Allan Jude From owner-svn-src-head@freebsd.org Sat Jan 13 19:59:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8D1CE7CCA7; Sat, 13 Jan 2018 19:59:29 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f175.google.com (mail-io0-f175.google.com [209.85.223.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 882FA74F40; Sat, 13 Jan 2018 19:59:29 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f175.google.com with SMTP id c17so9344610iod.1; Sat, 13 Jan 2018 11:59:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=TfSx/SNfCrfC+PFVDHqWDV696oXuVu/Tdll2aTerVlY=; b=gL64YJhlRguXVVc3/rLecJUw8q/Jv5Gz4/FSXRkBrikSN/b4Zr6P8S7v3XUmD6R3I3 ZI835CrO7RROEpx/JRcScslr9AynLqYqdRMiqIZE7x4Arh1A5fTM7MjfDMETzTmyprpp kvipzODquWTkCzaQ5R90fZPi7Yp8uh8w5zbwAfM1U2y6GtM2peW5leMPNt2AY3GMOYhS 8IaofhX5+nm/lo9MaHSO7YZmi7zhFGoDvu/vg00XJjEfp+dfyski28Ho0g83/pXWzho7 ayi0gmGtAJryYD5Rzhs6NIBdCAU65E459tcs0wQXJVxIXIjRndv80c6usS/olTw25N/E weEQ== X-Gm-Message-State: AKwxytf3O/nkNg1Gk0QBzRbMxTbuKBVjR75snCpYE7DidCR95elcxeaA SmKxfi9s32GTF5dS7RbwV+G6FmnU X-Google-Smtp-Source: ACJfBotBrsPPz8yk7+Igt/DQ9oIHPhEz++z1WH1kpN99+e2Gq8g3MSiMa8lxGjqrBf5DHWXFy2KFTA== X-Received: by 10.107.205.203 with SMTP id d194mr27705731iog.42.1515873568269; Sat, 13 Jan 2018 11:59:28 -0800 (PST) Received: from mail-it0-f48.google.com (mail-it0-f48.google.com. [209.85.214.48]) by smtp.gmail.com with ESMTPSA id f202sm3460117itc.40.2018.01.13.11.59.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Jan 2018 11:59:28 -0800 (PST) Received: by mail-it0-f48.google.com with SMTP id q8so1255071itb.2; Sat, 13 Jan 2018 11:59:28 -0800 (PST) X-Received: by 10.36.249.67 with SMTP id l64mr9111687ith.119.1515873568031; Sat, 13 Jan 2018 11:59:28 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.74.80 with HTTP; Sat, 13 Jan 2018 11:59:27 -0800 (PST) In-Reply-To: References: <201801131902.w0DJ2p5m097642@repo.freebsd.org> From: Conrad Meyer Date: Sat, 13 Jan 2018 11:59:27 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r327940 - head/sys/contrib/zstd/lib/freebsd To: Pedro Giffuni Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 19:59:29 -0000 On Sat, Jan 13, 2018 at 11:54 AM, Pedro Giffuni wrote: > On 01/13/18 14:24, Conrad Meyer wrote: > > This is not in contrib code -- > https://lists.freebsd.org/pipermail/svn-src-all/2018-January/156505.html > . > Thanks, I read it late... > > Shouldn't the local code be in usr.bin/zstd ? No =E2=80=94 this code ports zstd to the kernel. It would not make sense i= n usr.bin. Conrad From owner-svn-src-head@freebsd.org Sat Jan 13 20:06:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAD80E7D35F for ; Sat, 13 Jan 2018 20:06:24 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic315-23.consmr.mail.gq1.yahoo.com (sonic315-23.consmr.mail.gq1.yahoo.com [98.137.65.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A422C755E3 for ; Sat, 13 Jan 2018 20:06:24 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1515873978; bh=8GtiqrVZjKyskH9EavZFIVGSuFXWoPoH1E3aY/JgTkQ=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=qMHmTj9K7RA9Apz0gCc9ewQ9OOlSMQdmS3/JNDehn4XSBk0hwAVvgdKECkX1Z3SJwRxKBh115D77Y7D0HdEkHVwCI9wVZpSHu5JZrTmjjQUwVOLONo8sFisuOMim7GjqRNkMe1CzMD/jExlWRSrHSZ+86d02epFNGfLf1busG4OtKnBDTcC9tsZdRWtvhQNz1hqN/Ck9RomAqoMSgxKhGHncwQieNEaaeVuXIP4H8vMX3b9aYaIZY6UEwNBjBEEllZr05Vh0fmN/CU1Q3LbpRqvbY6zc1sy9uQLLfw1vPZSS+B1BpPfhrhK7MBuB3qFpV44U2+D9pDGs0NLo8+BvkQ== X-YMail-OSG: ZzAfhXAVM1lIJDoWIwk2HiHomvzzu2Y6Jnb1aD4cPnP5UGGretgd7P7q1dzPffX imGXKd27mf0OIsnqTv8zUBLX62HdtjQ4VWPu36hNcegWDURjad14lZXnbqPndL0bWZtqyU_DaW4f 3Qq71dPIVFrWj6OXGLBpfSiyDDK3pGYBdg_qk_9WoxeSBMYFmJ2Z43.f9o8XmpksdpslNxvslkBj LBrLBuroPDntP_SsnDu28iK1f8W9tjJoemAcdYd22n2AFvki3A11aSNL.GNxLSW.t71FZwspvvZv YrYgCTVrgqmQ7AiVvlFVlqUv6SbCEMFUgcwtAaQhR_cHz0FkQHl8hcFJdK2eO9xYfauUbk6IKPf8 Pur2P545Kl2Q5wHNdVAn701kPAuZASmQI8fpekdEMqHhrWwH2phEX9h0W8cTgvALFMLU72FViyRE Rvp8ISy1pBN1z.BDG5Xbk_kJzP6kNxKu8R9VWwQxNz1zlNIWDLCsDCw2XXFz768DRoIasLdLK Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.gq1.yahoo.com with HTTP; Sat, 13 Jan 2018 20:06:18 +0000 Received: from smtp105.rhel.mail.gq1.yahoo.com (EHLO [192.168.0.8]) ([68.180.227.8]) by smtp411.mail.gq1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 76389664bd9a2b15e2c1394267129846; Sat, 13 Jan 2018 20:06:13 +0000 (UTC) Subject: Re: svn commit: r327940 - head/sys/contrib/zstd/lib/freebsd To: cem@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801131902.w0DJ2p5m097642@repo.freebsd.org> From: Pedro Giffuni Organization: FreeBSD Project Message-ID: <8b3461ef-0d7d-fc61-5f27-0639301683dd@FreeBSD.org> Date: Sat, 13 Jan 2018 15:06:12 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 20:06:24 -0000 On 13/01/2018 14:59, Conrad Meyer wrote: > On Sat, Jan 13, 2018 at 11:54 AM, Pedro Giffuni wrote: >> On 01/13/18 14:24, Conrad Meyer wrote: >> >> This is not in contrib code -- >> https://lists.freebsd.org/pipermail/svn-src-all/2018-January/156505.html >> . >> Thanks, I read it late... >> >> Shouldn't the local code be in usr.bin/zstd ? > No — this code ports zstd to the kernel. It would not make sense in usr.bin. Bah, yes, it should be somewhere else under sys but then if you use it for ZFS and somewhere else, it's not clear where it should go .. nevermind. I was just backtracing. Please add yourself to the MAINTAINERS file if you want pre-commit reviews. Pedro. From owner-svn-src-head@freebsd.org Sat Jan 13 20:35:34 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AC52E7EA17; Sat, 13 Jan 2018 20:35:34 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2C652766AA; Sat, 13 Jan 2018 20:35:34 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5EB4C17DDF; Sat, 13 Jan 2018 20:35:33 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DKZXkd035081; Sat, 13 Jan 2018 20:35:33 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DKZX8k035079; Sat, 13 Jan 2018 20:35:33 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801132035.w0DKZX8k035079@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 13 Jan 2018 20:35:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327941 - head/usr.sbin/timed/timed X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.sbin/timed/timed X-SVN-Commit-Revision: 327941 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 20:35:34 -0000 Author: eadler Date: Sat Jan 13 20:35:32 2018 New Revision: 327941 URL: https://svnweb.freebsd.org/changeset/base/327941 Log: timed: slave is an infinite loop, mark it as such Modified: head/usr.sbin/timed/timed/extern.h head/usr.sbin/timed/timed/slave.c Modified: head/usr.sbin/timed/timed/extern.h ============================================================================== --- head/usr.sbin/timed/timed/extern.h Sat Jan 13 19:02:51 2018 (r327940) +++ head/usr.sbin/timed/timed/extern.h Sat Jan 13 20:35:32 2018 (r327941) @@ -77,7 +77,7 @@ void print(struct tsp *, struct sockaddr_in *); void prthp(clock_t); void rmnetmachs(struct netinfo *); void setstatus(void); -int slave(void); +void slave(void) __dead2; void slaveack(void); void spreadtime(void); void suppress(struct sockaddr_in *, char *, struct netinfo *); Modified: head/usr.sbin/timed/timed/slave.c ============================================================================== --- head/usr.sbin/timed/timed/slave.c Sat Jan 13 19:02:51 2018 (r327940) +++ head/usr.sbin/timed/timed/slave.c Sat Jan 13 20:35:32 2018 (r327941) @@ -56,7 +56,7 @@ static void schgdate(struct tsp *, char *); static void setmaster(struct tsp *); static void answerdelay(void); -int +void slave(void) { int tries; From owner-svn-src-head@freebsd.org Sat Jan 13 21:10:43 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85840EA4657; Sat, 13 Jan 2018 21:10:43 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6004677C41; Sat, 13 Jan 2018 21:10:43 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9DD46182F8; Sat, 13 Jan 2018 21:10:42 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DLAgqY048066; Sat, 13 Jan 2018 21:10:42 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DLAgKt048065; Sat, 13 Jan 2018 21:10:42 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201801132110.w0DLAgKt048065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 13 Jan 2018 21:10:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327943 - head/sys/powerpc/mpc85xx X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/mpc85xx X-SVN-Commit-Revision: 327943 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 21:10:43 -0000 Author: jhibbits Date: Sat Jan 13 21:10:42 2018 New Revision: 327943 URL: https://svnweb.freebsd.org/changeset/base/327943 Log: Include only the headers needed The extra headers came through evolution of the file. Modified: head/sys/powerpc/mpc85xx/mpc85xx_cache.c Modified: head/sys/powerpc/mpc85xx/mpc85xx_cache.c ============================================================================== --- head/sys/powerpc/mpc85xx/mpc85xx_cache.c Sat Jan 13 21:08:38 2018 (r327942) +++ head/sys/powerpc/mpc85xx/mpc85xx_cache.c Sat Jan 13 21:10:42 2018 (r327943) @@ -32,21 +32,12 @@ __FBSDID("$FreeBSD$"); #include -#include -#include #include #include #include -#include -#include -#include -#include #include -#include -#include -#include #include #include From owner-svn-src-head@freebsd.org Sat Jan 13 21:36:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 125DAEA5D6A; Sat, 13 Jan 2018 21:36:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E1E7378DFD; Sat, 13 Jan 2018 21:36:40 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D38F187E4; Sat, 13 Jan 2018 21:36:40 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DLae7r060834; Sat, 13 Jan 2018 21:36:40 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DLaeDi060833; Sat, 13 Jan 2018 21:36:40 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801132136.w0DLaeDi060833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 13 Jan 2018 21:36:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327946 - head/usr.bin/limits X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/limits X-SVN-Commit-Revision: 327946 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 21:36:41 -0000 Author: eadler Date: Sat Jan 13 21:36:39 2018 New Revision: 327946 URL: https://svnweb.freebsd.org/changeset/base/327946 Log: limits(1): fix grammar Submitted by: yuri PR: 225147 MFC After: 1 week Modified: head/usr.bin/limits/limits.1 Modified: head/usr.bin/limits/limits.1 ============================================================================== --- head/usr.bin/limits/limits.1 Sat Jan 13 21:27:36 2018 (r327945) +++ head/usr.bin/limits/limits.1 Sat Jan 13 21:36:39 2018 (r327946) @@ -82,7 +82,7 @@ login capabilities database. .It Nm Fl e Op Ar limitflags This usage determines values of resource settings according to .Ar limitflags , -but does not set them itself. +but does not set them. Like the previous usage, it outputs these values to standard output, except that it will emit them in .Ic eval @@ -180,7 +180,7 @@ options. Select .Dq "eval mode" formatting for output. -This is valid only on display mode and cannot be used when running a +This is valid only in display mode and cannot be used when running a command. The exact syntax used for output depends upon the type of shell from which From owner-svn-src-head@freebsd.org Sat Jan 13 21:37:16 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34CDAEA5E52; Sat, 13 Jan 2018 21:37:16 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0FB9778F80; Sat, 13 Jan 2018 21:37:16 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F829187E6; Sat, 13 Jan 2018 21:37:15 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DLbFZU060909; Sat, 13 Jan 2018 21:37:15 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DLbF24060908; Sat, 13 Jan 2018 21:37:15 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801132137.w0DLbF24060908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 13 Jan 2018 21:37:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327947 - head/usr.bin/limits X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/limits X-SVN-Commit-Revision: 327947 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 21:37:16 -0000 Author: eadler Date: Sat Jan 13 21:37:14 2018 New Revision: 327947 URL: https://svnweb.freebsd.org/changeset/base/327947 Log: limits(1): also bump .Dd... PR: 225147 MFC After: 1 week Modified: head/usr.bin/limits/limits.1 Modified: head/usr.bin/limits/limits.1 ============================================================================== --- head/usr.bin/limits/limits.1 Sat Jan 13 21:36:39 2018 (r327946) +++ head/usr.bin/limits/limits.1 Sat Jan 13 21:37:14 2018 (r327947) @@ -19,7 +19,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2013 +.Dd January 13, 2018 .Dt LIMITS 1 .Os .Sh NAME From owner-svn-src-head@freebsd.org Sat Jan 13 21:39:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4B83EA60BB; Sat, 13 Jan 2018 21:39:47 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7686C7911F; Sat, 13 Jan 2018 21:39:47 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF324187E8; Sat, 13 Jan 2018 21:39:46 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DLdkcs061041; Sat, 13 Jan 2018 21:39:46 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DLdk9K061040; Sat, 13 Jan 2018 21:39:46 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201801132139.w0DLdk9K061040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Sat, 13 Jan 2018 21:39:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327948 - head/sys/dev/virtio/console X-SVN-Group: head X-SVN-Commit-Author: bryanv X-SVN-Commit-Paths: head/sys/dev/virtio/console X-SVN-Commit-Revision: 327948 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 21:39:47 -0000 Author: bryanv Date: Sat Jan 13 21:39:46 2018 New Revision: 327948 URL: https://svnweb.freebsd.org/changeset/base/327948 Log: Fix possible panic when creating VirtIO console dev aliases Since we have no control over the name, the MAKEDEV_CHECKNAME flag must be used to return an error on an invalid (to devfs) name instead of panicing. r305900 that originally added this feature also introduced a few other bugs: - Proper locking not performed - Theoretically broke the expectation that the control event buffer would not span more than one pages, but did not update the CTASSERT that was in place to prevent this. However, since the struct virtio_console_control and the bulk buffer together were quite small, this could not have happened. Also workaround an QEMU VirtIO spec violation in that it includes the NUL terminator in the buffer length when the spec says it is not included. PR: 223531 MFC after: 1 week Modified: head/sys/dev/virtio/console/virtio_console.c Modified: head/sys/dev/virtio/console/virtio_console.c ============================================================================== --- head/sys/dev/virtio/console/virtio_console.c Sat Jan 13 21:37:14 2018 (r327947) +++ head/sys/dev/virtio/console/virtio_console.c Sat Jan 13 21:39:46 2018 (r327948) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -58,14 +59,19 @@ __FBSDID("$FreeBSD$"); #define VTCON_MAX_PORTS 32 #define VTCON_TTY_PREFIX "V" +#define VTCON_TTY_ALIAS_PREFIX "vtcon" #define VTCON_BULK_BUFSZ 128 +#define VTCON_CTRL_BUFSZ 128 /* - * The buffer cannot cross more than one page boundary due to the + * The buffers cannot cross more than one page boundary due to the * size of the sglist segment array used. */ CTASSERT(VTCON_BULK_BUFSZ <= PAGE_SIZE); +CTASSERT(VTCON_CTRL_BUFSZ <= PAGE_SIZE); +CTASSERT(sizeof(struct virtio_console_config) <= VTCON_CTRL_BUFSZ); + struct vtcon_softc; struct vtcon_softc_port; @@ -80,6 +86,7 @@ struct vtcon_port { int vtcport_flags; #define VTCON_PORT_FLAG_GONE 0x01 #define VTCON_PORT_FLAG_CONSOLE 0x02 +#define VTCON_PORT_FLAG_ALIAS 0x04 #if defined(KDB) int vtcport_alt_break_state; @@ -193,6 +200,8 @@ static void vtcon_port_requeue_buf(struct vtcon_port static int vtcon_port_populate(struct vtcon_port *); static void vtcon_port_destroy(struct vtcon_port *); static int vtcon_port_create(struct vtcon_softc *, int); +static void vtcon_port_dev_alias(struct vtcon_port *, const char *, + size_t); static void vtcon_port_drain_bufs(struct virtqueue *); static void vtcon_port_drain(struct vtcon_port *); static void vtcon_port_teardown(struct vtcon_port *); @@ -599,8 +608,7 @@ vtcon_ctrl_event_enqueue(struct vtcon_softc *sc, vq = sc->vtcon_ctrl_rxvq; sglist_init(&sg, 2, segs); - error = sglist_append(&sg, control, - sizeof(struct virtio_console_control) + VTCON_BULK_BUFSZ); + error = sglist_append(&sg, control, VTCON_CTRL_BUFSZ); KASSERT(error == 0, ("%s: error %d adding control to sglist", __func__, error)); @@ -613,10 +621,7 @@ vtcon_ctrl_event_create(struct vtcon_softc *sc) struct virtio_console_control *control; int error; - control = malloc( - sizeof(struct virtio_console_control) + VTCON_BULK_BUFSZ, - M_DEVBUF, M_ZERO | M_NOWAIT); - + control = malloc(VTCON_CTRL_BUFSZ, M_DEVBUF, M_ZERO | M_NOWAIT); if (control == NULL) return (ENOMEM); @@ -633,8 +638,7 @@ vtcon_ctrl_event_requeue(struct vtcon_softc *sc, { int error; - bzero(control, sizeof(struct virtio_console_control) + - VTCON_BULK_BUFSZ); + bzero(control, VTCON_CTRL_BUFSZ); error = vtcon_ctrl_event_enqueue(sc, control); KASSERT(error == 0, @@ -811,19 +815,36 @@ vtcon_ctrl_port_name_event(struct vtcon_softc *sc, int dev = sc->vtcon_dev; scport = &sc->vtcon_ports[id]; + /* + * The VirtIO specification says the NUL terminator is not included in + * the length, but QEMU includes it. Adjust the length if needed. + */ + if (name == NULL || len == 0) + return; + if (name[len - 1] == '\0') { + len--; + if (len == 0) + return; + } + + VTCON_LOCK(sc); port = scport->vcsp_port; if (port == NULL) { + VTCON_UNLOCK(sc); device_printf(dev, "%s: name port %d, but does not exist\n", __func__, id); return; } - tty_makealias(port->vtcport_tty, "vtcon/%*s", (int)len, name); + VTCON_PORT_LOCK(port); + VTCON_UNLOCK(sc); + vtcon_port_dev_alias(port, name, len); + VTCON_PORT_UNLOCK(port); } static void vtcon_ctrl_process_event(struct vtcon_softc *sc, - struct virtio_console_control *control, void *payload, size_t plen) + struct virtio_console_control *control, void *data, size_t data_len) { device_t dev; int id; @@ -857,9 +878,7 @@ vtcon_ctrl_process_event(struct vtcon_softc *sc, break; case VIRTIO_CONSOLE_PORT_NAME: - if (payload != NULL && plen > 0) - vtcon_ctrl_port_name_event(sc, id, - (const char *)payload, plen); + vtcon_ctrl_port_name_event(sc, id, (const char *)data, data_len); break; } } @@ -870,10 +889,10 @@ vtcon_ctrl_task_cb(void *xsc, int pending) struct vtcon_softc *sc; struct virtqueue *vq; struct virtio_console_control *control; + void *data; + size_t data_len; int detached; uint32_t len; - size_t plen; - void *payload; sc = xsc; vq = sc->vtcon_ctrl_rxvq; @@ -882,19 +901,19 @@ vtcon_ctrl_task_cb(void *xsc, int pending) while ((detached = (sc->vtcon_flags & VTCON_FLAG_DETACHED)) == 0) { control = virtqueue_dequeue(vq, &len); - payload = NULL; - plen = 0; - if (control == NULL) break; - if (len > sizeof(*control)) { - payload = (void *)(control + 1); - plen = len - sizeof(*control); + if (len > sizeof(struct virtio_console_control)) { + data = (void *) &control[1]; + data_len = len - sizeof(struct virtio_console_control); + } else { + data = NULL; + data_len = 0; } VTCON_UNLOCK(sc); - vtcon_ctrl_process_event(sc, control, payload, plen); + vtcon_ctrl_process_event(sc, control, data, data_len); VTCON_LOCK(sc); vtcon_ctrl_event_requeue(sc, control); } @@ -1130,6 +1149,40 @@ vtcon_port_create(struct vtcon_softc *sc, int id) device_get_unit(dev), id); return (0); +} + +static void +vtcon_port_dev_alias(struct vtcon_port *port, const char *name, size_t len) +{ + struct vtcon_softc *sc; + struct cdev *pdev; + struct tty *tp; + int i, error; + + sc = port->vtcport_sc; + tp = port->vtcport_tty; + + if (port->vtcport_flags & VTCON_PORT_FLAG_ALIAS) + return; + + /* Port name is UTF-8, but we can only handle ASCII. */ + for (i = 0; i < len; i++) { + if (!isascii(name[i])) + return; + } + + /* + * Port name may not conform to the devfs requirements so we cannot use + * tty_makealias() because the MAKEDEV_CHECKNAME flag must be specified. + */ + error = make_dev_alias_p(MAKEDEV_NOWAIT | MAKEDEV_CHECKNAME, &pdev, + tp->t_dev, "%s/%*s", VTCON_TTY_ALIAS_PREFIX, (int)len, name); + if (error) { + device_printf(sc->vtcon_dev, + "%s: cannot make dev alias (%s/%*s) error %d\n", __func__, + VTCON_TTY_ALIAS_PREFIX, (int)len, name, error); + } else + port->vtcport_flags |= VTCON_PORT_FLAG_ALIAS; } static void From owner-svn-src-head@freebsd.org Sat Jan 13 22:30:36 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9912EB31C1; Sat, 13 Jan 2018 22:30:36 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5C42D7B2D2; Sat, 13 Jan 2018 22:30:36 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A5F018FD6; Sat, 13 Jan 2018 22:30:35 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DMUZv8082821; Sat, 13 Jan 2018 22:30:35 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DMUVmF081985; Sat, 13 Jan 2018 22:30:31 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801132230.w0DMUVmF081985@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 13 Jan 2018 22:30:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327949 - in head/sys/dev: aacraid advansys ath beri/virtio bnxt bwn ciss cxgbe/crypto esp fb gpio if_ndis iwi kbd liquidio liquidio/base mpr mps mpt mrsas mxge netmap nvme pst ral rp s... X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in head/sys/dev: aacraid advansys ath beri/virtio bnxt bwn ciss cxgbe/crypto esp fb gpio if_ndis iwi kbd liquidio liquidio/base mpr mps mpt mrsas mxge netmap nvme pst ral rp sound/midi sound/pci/hda s... X-SVN-Commit-Revision: 327949 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 22:30:36 -0000 Author: pfg Date: Sat Jan 13 22:30:30 2018 New Revision: 327949 URL: https://svnweb.freebsd.org/changeset/base/327949 Log: dev: make some use of mallocarray(9). Focus on code where we are doing multiplications within malloc(9). None of these is likely to overflow, however the change is still useful as some static checkers can benefit from the allocation attributes we use for mallocarray. This initial sweep only covers malloc(9) calls with M_NOWAIT. No good reason but I started doing the changes before r327796 and at that time it was convenient to make sure the sorrounding code could handle NULL values. Modified: head/sys/dev/aacraid/aacraid.c head/sys/dev/advansys/advansys.c head/sys/dev/ath/if_ath_rx_edma.c head/sys/dev/beri/virtio/virtio.c head/sys/dev/bnxt/if_bnxt.c head/sys/dev/bwn/if_bwn.c head/sys/dev/bwn/if_bwn_phy_lp.c head/sys/dev/ciss/ciss.c head/sys/dev/cxgbe/crypto/t4_crypto.c head/sys/dev/esp/ncr53c9x.c head/sys/dev/fb/splash.c head/sys/dev/gpio/gpiobus.c head/sys/dev/if_ndis/if_ndis.c head/sys/dev/iwi/if_iwi.c head/sys/dev/kbd/kbd.c head/sys/dev/liquidio/base/lio_request_manager.c head/sys/dev/liquidio/lio_main.c head/sys/dev/mpr/mpr.c head/sys/dev/mpr/mpr_mapping.c head/sys/dev/mps/mps.c head/sys/dev/mps/mps_mapping.c head/sys/dev/mpt/mpt_cam.c head/sys/dev/mrsas/mrsas.c head/sys/dev/mxge/if_mxge.c head/sys/dev/netmap/if_ptnet.c head/sys/dev/nvme/nvme_ns.c head/sys/dev/pst/pst-iop.c head/sys/dev/ral/rt2560.c head/sys/dev/ral/rt2661.c head/sys/dev/rp/rp.c head/sys/dev/rp/rp_isa.c head/sys/dev/rp/rp_pci.c head/sys/dev/sound/midi/midi.c head/sys/dev/sound/pci/hda/hdaa.c head/sys/dev/syscons/fire/fire_saver.c head/sys/dev/virtio/console/virtio_console.c head/sys/dev/virtio/mmio/virtio_mmio.c head/sys/dev/virtio/network/if_vtnet.c head/sys/dev/virtio/pci/virtio_pci.c head/sys/dev/vmware/vmxnet3/if_vmx.c head/sys/dev/vnic/nicvf_queues.c head/sys/dev/xen/blkback/blkback.c head/sys/dev/xen/blkfront/blkfront.c Modified: head/sys/dev/aacraid/aacraid.c ============================================================================== --- head/sys/dev/aacraid/aacraid.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/aacraid/aacraid.c Sat Jan 13 22:30:30 2018 (r327949) @@ -1458,7 +1458,7 @@ aac_convert_sgraw2(struct aac_softc *sc, struct aac_ra int i, j, pos; u_int32_t addr_low; - sge = malloc(nseg_new * sizeof(struct aac_sge_ieee1212), + sge = mallocarray(nseg_new, sizeof(struct aac_sge_ieee1212), M_AACRAIDBUF, M_NOWAIT|M_ZERO); if (sge == NULL) return nseg; Modified: head/sys/dev/advansys/advansys.c ============================================================================== --- head/sys/dev/advansys/advansys.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/advansys/advansys.c Sat Jan 13 22:30:30 2018 (r327949) @@ -1255,7 +1255,7 @@ adv_attach(adv) * a transaction and use it for mapping the queue to the * upper level SCSI transaction it represents. */ - adv->ccb_infos = malloc(sizeof(*adv->ccb_infos) * adv->max_openings, + adv->ccb_infos = mallocarray(adv->max_openings, sizeof(*adv->ccb_infos), M_DEVBUF, M_NOWAIT); if (adv->ccb_infos == NULL) Modified: head/sys/dev/ath/if_ath_rx_edma.c ============================================================================== --- head/sys/dev/ath/if_ath_rx_edma.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/ath/if_ath_rx_edma.c Sat Jan 13 22:30:30 2018 (r327949) @@ -901,9 +901,8 @@ ath_edma_setup_rxfifo(struct ath_softc *sc, HAL_RX_QUE re->m_fifolen); /* Allocate ath_buf FIFO array, pre-zero'ed */ - re->m_fifo = malloc(sizeof(struct ath_buf *) * re->m_fifolen, - M_ATHDEV, - M_NOWAIT | M_ZERO); + re->m_fifo = mallocarray(re->m_fifolen, sizeof(struct ath_buf *), + M_ATHDEV, M_NOWAIT | M_ZERO); if (re->m_fifo == NULL) { device_printf(sc->sc_dev, "%s: malloc failed\n", __func__); Modified: head/sys/dev/beri/virtio/virtio.c ============================================================================== --- head/sys/dev/beri/virtio/virtio.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/beri/virtio/virtio.c Sat Jan 13 22:30:30 2018 (r327949) @@ -250,7 +250,7 @@ getcopy(struct iovec *iov, int n) struct iovec *tiov; int i; - tiov = malloc(n * sizeof(struct iovec), M_DEVBUF, M_NOWAIT); + tiov = mallocarray(n, sizeof(struct iovec), M_DEVBUF, M_NOWAIT); for (i = 0; i < n; i++) { tiov[i].iov_base = iov[i].iov_base; tiov[i].iov_len = iov[i].iov_len; Modified: head/sys/dev/bnxt/if_bnxt.c ============================================================================== --- head/sys/dev/bnxt/if_bnxt.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/bnxt/if_bnxt.c Sat Jan 13 22:30:30 2018 (r327949) @@ -351,7 +351,7 @@ bnxt_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, softc = iflib_get_softc(ctx); - softc->tx_cp_rings = malloc(sizeof(struct bnxt_cp_ring) * ntxqsets, + softc->tx_cp_rings = mallocarray(ntxqsets, sizeof(struct bnxt_cp_ring), M_DEVBUF, M_NOWAIT | M_ZERO); if (!softc->tx_cp_rings) { device_printf(iflib_get_dev(ctx), @@ -359,7 +359,7 @@ bnxt_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, rc = ENOMEM; goto cp_alloc_fail; } - softc->tx_rings = malloc(sizeof(struct bnxt_ring) * ntxqsets, + softc->tx_rings = mallocarray(ntxqsets, sizeof(struct bnxt_ring), M_DEVBUF, M_NOWAIT | M_ZERO); if (!softc->tx_rings) { device_printf(iflib_get_dev(ctx), @@ -446,7 +446,7 @@ bnxt_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, softc = iflib_get_softc(ctx); - softc->rx_cp_rings = malloc(sizeof(struct bnxt_cp_ring) * nrxqsets, + softc->rx_cp_rings = mallocarray(nrxqsets, sizeof(struct bnxt_cp_ring), M_DEVBUF, M_NOWAIT | M_ZERO); if (!softc->rx_cp_rings) { device_printf(iflib_get_dev(ctx), @@ -454,7 +454,7 @@ bnxt_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, rc = ENOMEM; goto cp_alloc_fail; } - softc->rx_rings = malloc(sizeof(struct bnxt_ring) * nrxqsets, + softc->rx_rings = mallocarray(nrxqsets, sizeof(struct bnxt_ring), M_DEVBUF, M_NOWAIT | M_ZERO); if (!softc->rx_rings) { device_printf(iflib_get_dev(ctx), @@ -462,7 +462,7 @@ bnxt_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, rc = ENOMEM; goto ring_alloc_fail; } - softc->ag_rings = malloc(sizeof(struct bnxt_ring) * nrxqsets, + softc->ag_rings = mallocarray(nrxqsets, sizeof(struct bnxt_ring), M_DEVBUF, M_NOWAIT | M_ZERO); if (!softc->ag_rings) { device_printf(iflib_get_dev(ctx), @@ -470,7 +470,7 @@ bnxt_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, rc = ENOMEM; goto ag_alloc_fail; } - softc->grp_info = malloc(sizeof(struct bnxt_grp_info) * nrxqsets, + softc->grp_info = mallocarray(nrxqsets, sizeof(struct bnxt_grp_info), M_DEVBUF, M_NOWAIT | M_ZERO); if (!softc->grp_info) { device_printf(iflib_get_dev(ctx), @@ -540,9 +540,10 @@ bnxt_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, softc->rx_rings[i].paddr = paddrs[i * nrxqs + 1]; /* Allocate the TPA start buffer */ - softc->rx_rings[i].tpa_start = malloc(sizeof(struct bnxt_full_tpa_start) * - (RX_TPA_START_CMPL_AGG_ID_MASK >> RX_TPA_START_CMPL_AGG_ID_SFT), - M_DEVBUF, M_NOWAIT | M_ZERO); + softc->rx_rings[i].tpa_start = mallocarray( + RX_TPA_START_CMPL_AGG_ID_MASK >> RX_TPA_START_CMPL_AGG_ID_SFT, + sizeof(struct bnxt_full_tpa_start), M_DEVBUF, + M_NOWAIT | M_ZERO); if (softc->rx_rings[i].tpa_start == NULL) { rc = -ENOMEM; device_printf(softc->dev, Modified: head/sys/dev/bwn/if_bwn.c ============================================================================== --- head/sys/dev/bwn/if_bwn.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/bwn/if_bwn.c Sat Jan 13 22:30:30 2018 (r327949) @@ -2677,8 +2677,8 @@ bwn_dma_ringsetup(struct bwn_mac *mac, int controller_ if (for_tx) dr->dr_numslots = BWN_TXRING_SLOTS; - dr->dr_meta = malloc(dr->dr_numslots * sizeof(struct bwn_dmadesc_meta), - M_DEVBUF, M_NOWAIT | M_ZERO); + dr->dr_meta = mallocarray(dr->dr_numslots, + sizeof(struct bwn_dmadesc_meta), M_DEVBUF, M_NOWAIT | M_ZERO); if (dr->dr_meta == NULL) goto fail0; Modified: head/sys/dev/bwn/if_bwn_phy_lp.c ============================================================================== --- head/sys/dev/bwn/if_bwn_phy_lp.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/bwn/if_bwn_phy_lp.c Sat Jan 13 22:30:30 2018 (r327949) @@ -1127,7 +1127,7 @@ bwn_phy_lp_bugfix(struct bwn_mac *mac) uint8_t mode; int8_t txpwridx; - tabs = (uint32_t *)malloc(sizeof(uint32_t) * size, M_DEVBUF, + tabs = (uint32_t *)mallocarray(size, sizeof(uint32_t), M_DEVBUF, M_NOWAIT | M_ZERO); if (tabs == NULL) { device_printf(sc->sc_dev, "failed to allocate buffer.\n"); Modified: head/sys/dev/ciss/ciss.c ============================================================================== --- head/sys/dev/ciss/ciss.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/ciss/ciss.c Sat Jan 13 22:30:30 2018 (r327949) @@ -1427,7 +1427,7 @@ ciss_init_logical(struct ciss_softc *sc) } sc->ciss_logical = - malloc(sc->ciss_max_logical_bus * sizeof(struct ciss_ldrive *), + mallocarray(sc->ciss_max_logical_bus, sizeof(struct ciss_ldrive *), CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO); if (sc->ciss_logical == NULL) { error = ENXIO; @@ -1436,7 +1436,7 @@ ciss_init_logical(struct ciss_softc *sc) for (i = 0; i < sc->ciss_max_logical_bus; i++) { sc->ciss_logical[i] = - malloc(sc->ciss_cfg->max_logical_supported * + mallocarray(sc->ciss_cfg->max_logical_supported, sizeof(struct ciss_ldrive), CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO); if (sc->ciss_logical[i] == NULL) { @@ -1549,7 +1549,7 @@ ciss_init_physical(struct ciss_softc *sc) } sc->ciss_controllers = - malloc(sc->ciss_max_logical_bus * sizeof (union ciss_device_address), + mallocarray(sc->ciss_max_logical_bus, sizeof(union ciss_device_address), CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO); if (sc->ciss_controllers == NULL) { @@ -1566,7 +1566,7 @@ ciss_init_physical(struct ciss_softc *sc) } sc->ciss_physical = - malloc(sc->ciss_max_physical_bus * sizeof(struct ciss_pdrive *), + mallocarray(sc->ciss_max_physical_bus, sizeof(struct ciss_pdrive *), CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO); if (sc->ciss_physical == NULL) { ciss_printf(sc, "Could not allocate memory for physical device map\n"); @@ -2873,7 +2873,7 @@ ciss_cam_init(struct ciss_softc *sc) */ maxbus = max(sc->ciss_max_logical_bus, sc->ciss_max_physical_bus + CISS_PHYSICAL_BASE); - sc->ciss_cam_sim = malloc(maxbus * sizeof(struct cam_sim*), + sc->ciss_cam_sim = mallocarray(maxbus, sizeof(struct cam_sim*), CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO); if (sc->ciss_cam_sim == NULL) { ciss_printf(sc, "can't allocate memory for controller SIM\n"); Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c ============================================================================== --- head/sys/dev/cxgbe/crypto/t4_crypto.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/cxgbe/crypto/t4_crypto.c Sat Jan 13 22:30:30 2018 (r327949) @@ -1900,7 +1900,7 @@ ccr_newsession(device_t dev, uint32_t *sidp, struct cr } } if (sess == -1) { - s = malloc(sizeof(*s) * (sc->nsessions + 1), M_CCR, + s = mallocarray(sc->nsessions + 1, sizeof(*s), M_CCR, M_NOWAIT | M_ZERO); if (s == NULL) { mtx_unlock(&sc->lock); Modified: head/sys/dev/esp/ncr53c9x.c ============================================================================== --- head/sys/dev/esp/ncr53c9x.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/esp/ncr53c9x.c Sat Jan 13 22:30:30 2018 (r327949) @@ -292,7 +292,7 @@ ncr53c9x_attach(struct ncr53c9x_softc *sc) } else sc->sc_imess_self = 0; - sc->sc_tinfo = malloc(sc->sc_ntarg * sizeof(sc->sc_tinfo[0]), + sc->sc_tinfo = mallocarray(sc->sc_ntarg, sizeof(sc->sc_tinfo[0]), M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->sc_tinfo == NULL) { device_printf(sc->sc_dev, Modified: head/sys/dev/fb/splash.c ============================================================================== --- head/sys/dev/fb/splash.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/fb/splash.c Sat Jan 13 22:30:30 2018 (r327949) @@ -136,8 +136,8 @@ splash_register(splash_decoder_t *decoder) break; } if ((i >= decoders) && (decoders % DECODER_ARRAY_DELTA) == 0) { - p = malloc(sizeof(*p)*(decoders + DECODER_ARRAY_DELTA), - M_DEVBUF, M_NOWAIT); + p = mallocarray(decoders + DECODER_ARRAY_DELTA, + sizeof(*p), M_DEVBUF, M_NOWAIT); if (p == NULL) return ENOMEM; if (decoder_set != NULL) { Modified: head/sys/dev/gpio/gpiobus.c ============================================================================== --- head/sys/dev/gpio/gpiobus.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/gpio/gpiobus.c Sat Jan 13 22:30:30 2018 (r327949) @@ -235,7 +235,7 @@ gpiobus_init_softc(device_t dev) /* Pins = GPIO_PIN_MAX() + 1 */ sc->sc_npins++; - sc->sc_pins = malloc(sizeof(*sc->sc_pins) * sc->sc_npins, M_DEVBUF, + sc->sc_pins = mallocarray(sc->sc_npins, sizeof(*sc->sc_pins), M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->sc_pins == NULL) return (ENOMEM); @@ -251,11 +251,11 @@ gpiobus_alloc_ivars(struct gpiobus_ivar *devi) { /* Allocate pins and flags memory. */ - devi->pins = malloc(sizeof(uint32_t) * devi->npins, M_DEVBUF, + devi->pins = mallocarray(devi->npins, sizeof(uint32_t), M_DEVBUF, M_NOWAIT | M_ZERO); if (devi->pins == NULL) return (ENOMEM); - devi->flags = malloc(sizeof(uint32_t) * devi->npins, M_DEVBUF, + devi->flags = mallocarray(devi->npins, sizeof(uint32_t), M_DEVBUF, M_NOWAIT | M_ZERO); if (devi->flags == NULL) { free(devi->pins, M_DEVBUF); Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/if_ndis/if_ndis.c Sat Jan 13 22:30:30 2018 (r327949) @@ -665,8 +665,8 @@ ndis_attach(device_t dev) if (sc->ndis_maxpkts == 0) sc->ndis_maxpkts = 10; - sc->ndis_txarray = malloc(sizeof(ndis_packet *) * - sc->ndis_maxpkts, M_DEVBUF, M_NOWAIT|M_ZERO); + sc->ndis_txarray = mallocarray(sc->ndis_maxpkts, + sizeof(ndis_packet *), M_DEVBUF, M_NOWAIT|M_ZERO); /* Allocate a pool of ndis_packets for TX encapsulation. */ Modified: head/sys/dev/iwi/if_iwi.c ============================================================================== --- head/sys/dev/iwi/if_iwi.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/iwi/if_iwi.c Sat Jan 13 22:30:30 2018 (r327949) @@ -640,7 +640,7 @@ iwi_alloc_tx_ring(struct iwi_softc *sc, struct iwi_tx_ goto fail; } - ring->data = malloc(count * sizeof (struct iwi_tx_data), M_DEVBUF, + ring->data = mallocarray(count, sizeof(struct iwi_tx_data), M_DEVBUF, M_NOWAIT | M_ZERO); if (ring->data == NULL) { device_printf(sc->sc_dev, "could not allocate soft data\n"); @@ -748,7 +748,7 @@ iwi_alloc_rx_ring(struct iwi_softc *sc, struct iwi_rx_ ring->count = count; ring->cur = 0; - ring->data = malloc(count * sizeof (struct iwi_rx_data), M_DEVBUF, + ring->data = mallocarray(count, sizeof(struct iwi_rx_data), M_DEVBUF, M_NOWAIT | M_ZERO); if (ring->data == NULL) { device_printf(sc->sc_dev, "could not allocate soft data\n"); Modified: head/sys/dev/kbd/kbd.c ============================================================================== --- head/sys/dev/kbd/kbd.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/kbd/kbd.c Sat Jan 13 22:30:30 2018 (r327949) @@ -94,17 +94,18 @@ kbd_realloc_array(void) { keyboard_t **new_kbd; keyboard_switch_t **new_kbdsw; - int newsize; + u_int newsize; int s; s = spltty(); newsize = rounddown(keyboards + ARRAY_DELTA, ARRAY_DELTA); - new_kbd = malloc(sizeof(*new_kbd)*newsize, M_DEVBUF, M_NOWAIT|M_ZERO); + new_kbd = mallocarray(newsize, sizeof(*new_kbd), M_DEVBUF, + M_NOWAIT|M_ZERO); if (new_kbd == NULL) { splx(s); return (ENOMEM); } - new_kbdsw = malloc(sizeof(*new_kbdsw)*newsize, M_DEVBUF, + new_kbdsw = mallocarray(newsize, sizeof(*new_kbdsw), M_DEVBUF, M_NOWAIT|M_ZERO); if (new_kbdsw == NULL) { free(new_kbd, M_DEVBUF); Modified: head/sys/dev/liquidio/base/lio_request_manager.c ============================================================================== --- head/sys/dev/liquidio/base/lio_request_manager.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/liquidio/base/lio_request_manager.c Sat Jan 13 22:30:30 2018 (r327949) @@ -110,7 +110,7 @@ lio_init_instr_queue(struct octeon_device *oct, union * Initialize a list to holds requests that have been posted to * Octeon but has yet to be fetched by octeon */ - iq->request_list = malloc(sizeof(*iq->request_list) * num_descs, + iq->request_list = mallocarray(num_descs, sizeof(*iq->request_list), M_DEVBUF, M_NOWAIT | M_ZERO); if (iq->request_list == NULL) { lio_dev_err(oct, "Alloc failed for IQ[%d] nr free list\n", Modified: head/sys/dev/liquidio/lio_main.c ============================================================================== --- head/sys/dev/liquidio/lio_main.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/liquidio/lio_main.c Sat Jan 13 22:30:30 2018 (r327949) @@ -1724,12 +1724,12 @@ lio_setup_glists(struct octeon_device *oct, struct lio struct lio_gather *g; int i, j; - lio->glist_lock = malloc(num_iqs * sizeof(*lio->glist_lock), M_DEVBUF, - M_NOWAIT | M_ZERO); + lio->glist_lock = mallocarray(num_iqs, sizeof(*lio->glist_lock), + M_DEVBUF, M_NOWAIT | M_ZERO); if (lio->glist_lock == NULL) return (1); - lio->ghead = malloc(num_iqs * sizeof(*lio->ghead), M_DEVBUF, + lio->ghead = mallocarray(num_iqs, sizeof(*lio->ghead), M_DEVBUF, M_NOWAIT | M_ZERO); if (lio->ghead == NULL) { free((void *)lio->glist_lock, M_DEVBUF); @@ -1743,10 +1743,10 @@ lio_setup_glists(struct octeon_device *oct, struct lio * allocate memory to store virtual and dma base address of * per glist consistent memory */ - lio->glists_virt_base = malloc(num_iqs * sizeof(void *), M_DEVBUF, + lio->glists_virt_base = mallocarray(num_iqs, sizeof(void *), M_DEVBUF, M_NOWAIT | M_ZERO); - lio->glists_dma_base = malloc(num_iqs * sizeof(vm_paddr_t), M_DEVBUF, - M_NOWAIT | M_ZERO); + lio->glists_dma_base = mallocarray(num_iqs, sizeof(vm_paddr_t), + M_DEVBUF, M_NOWAIT | M_ZERO); if ((lio->glists_virt_base == NULL) || (lio->glists_dma_base == NULL)) { lio_delete_glists(oct, lio); return (1); Modified: head/sys/dev/mpr/mpr.c ============================================================================== --- head/sys/dev/mpr/mpr.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/mpr/mpr.c Sat Jan 13 22:30:30 2018 (r327949) @@ -1192,7 +1192,7 @@ mpr_alloc_queues(struct mpr_softc *sc) nq = sc->msi_msgs; mpr_dprint(sc, MPR_INIT|MPR_XINFO, "Allocating %d I/O queues\n", nq); - sc->queues = malloc(sizeof(struct mpr_queue) * nq, M_MPR, + sc->queues = mallocarray(nq, sizeof(struct mpr_queue), M_MPR, M_NOWAIT|M_ZERO); if (sc->queues == NULL) return (ENOMEM); Modified: head/sys/dev/mpr/mpr_mapping.c ============================================================================== --- head/sys/dev/mpr/mpr_mapping.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/mpr/mpr_mapping.c Sat Jan 13 22:30:30 2018 (r327949) @@ -2141,27 +2141,27 @@ mpr_mapping_allocate_memory(struct mpr_softc *sc) { uint32_t dpm_pg0_sz; - sc->mapping_table = malloc((sizeof(struct dev_mapping_table) * - sc->max_devices), M_MPR, M_ZERO|M_NOWAIT); + sc->mapping_table = mallocarray(sc->max_devices, + sizeof(struct dev_mapping_table), M_MPR, M_ZERO|M_NOWAIT); if (!sc->mapping_table) goto free_resources; - sc->removal_table = malloc((sizeof(struct map_removal_table) * - sc->max_devices), M_MPR, M_ZERO|M_NOWAIT); + sc->removal_table = mallocarray(sc->max_devices, + sizeof(struct map_removal_table), M_MPR, M_ZERO|M_NOWAIT); if (!sc->removal_table) goto free_resources; - sc->enclosure_table = malloc((sizeof(struct enc_mapping_table) * - sc->max_enclosures), M_MPR, M_ZERO|M_NOWAIT); + sc->enclosure_table = mallocarray(sc->max_enclosures, + sizeof(struct enc_mapping_table), M_MPR, M_ZERO|M_NOWAIT); if (!sc->enclosure_table) goto free_resources; - sc->dpm_entry_used = malloc((sizeof(u8) * sc->max_dpm_entries), + sc->dpm_entry_used = mallocarray(sc->max_dpm_entries, sizeof(u8), M_MPR, M_ZERO|M_NOWAIT); if (!sc->dpm_entry_used) goto free_resources; - sc->dpm_flush_entry = malloc((sizeof(u8) * sc->max_dpm_entries), + sc->dpm_flush_entry = mallocarray(sc->max_dpm_entries, sizeof(u8), M_MPR, M_ZERO|M_NOWAIT); if (!sc->dpm_flush_entry) goto free_resources; @@ -2912,7 +2912,7 @@ mpr_mapping_topology_change_event(struct mpr_softc *sc if (!num_entries) goto out; - phy_change = malloc(sizeof(struct _map_phy_change) * num_entries, + phy_change = mallocarray(num_entries, sizeof(struct _map_phy_change), M_MPR, M_NOWAIT|M_ZERO); topo_change.phy_details = phy_change; if (!phy_change) @@ -2963,7 +2963,7 @@ mpr_mapping_pcie_topology_change_event(struct mpr_soft if (!num_entries) goto out; - port_change = malloc(sizeof(struct _map_port_change) * num_entries, + port_change = mallocarray(num_entries, sizeof(struct _map_port_change), M_MPR, M_NOWAIT|M_ZERO); topo_change.port_details = port_change; if (!port_change) @@ -3003,7 +3003,7 @@ mpr_mapping_ir_config_change_event(struct mpr_softc *s struct dev_mapping_table *mt_entry; u16 element_flags; - wwid_table = malloc(sizeof(u64) * event_data->NumElements, M_MPR, + wwid_table = mallocarray(event_data->NumElements, sizeof(u64), M_MPR, M_NOWAIT | M_ZERO); if (!wwid_table) goto out; Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/mps/mps.c Sat Jan 13 22:30:30 2018 (r327949) @@ -1164,12 +1164,12 @@ static int mps_alloc_queues(struct mps_softc *sc) { struct mps_queue *q; - int nq, i; + u_int nq, i; nq = sc->msi_msgs; mps_dprint(sc, MPS_INIT|MPS_XINFO, "Allocating %d I/O queues\n", nq); - sc->queues = malloc(sizeof(struct mps_queue) * nq, M_MPT2, + sc->queues = mallocarray(nq, sizeof(struct mps_queue), M_MPT2, M_NOWAIT|M_ZERO); if (sc->queues == NULL) return (ENOMEM); Modified: head/sys/dev/mps/mps_mapping.c ============================================================================== --- head/sys/dev/mps/mps_mapping.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/mps/mps_mapping.c Sat Jan 13 22:30:30 2018 (r327949) @@ -1694,27 +1694,27 @@ mps_mapping_allocate_memory(struct mps_softc *sc) { uint32_t dpm_pg0_sz; - sc->mapping_table = malloc((sizeof(struct dev_mapping_table) * - sc->max_devices), M_MPT2, M_ZERO|M_NOWAIT); + sc->mapping_table = mallocarray(sc->max_devices, + sizeof(struct dev_mapping_table), M_MPT2, M_ZERO|M_NOWAIT); if (!sc->mapping_table) goto free_resources; - sc->removal_table = malloc((sizeof(struct map_removal_table) * - sc->max_devices), M_MPT2, M_ZERO|M_NOWAIT); + sc->removal_table = mallocarray(sc->max_devices, + sizeof(struct map_removal_table), M_MPT2, M_ZERO|M_NOWAIT); if (!sc->removal_table) goto free_resources; - sc->enclosure_table = malloc((sizeof(struct enc_mapping_table) * - sc->max_enclosures), M_MPT2, M_ZERO|M_NOWAIT); + sc->enclosure_table = mallocarray(sc->max_enclosures, + sizeof(struct enc_mapping_table), M_MPT2, M_ZERO|M_NOWAIT); if (!sc->enclosure_table) goto free_resources; - sc->dpm_entry_used = malloc((sizeof(u8) * sc->max_dpm_entries), + sc->dpm_entry_used = mallocarray(sc->max_dpm_entries, sizeof(u8), M_MPT2, M_ZERO|M_NOWAIT); if (!sc->dpm_entry_used) goto free_resources; - sc->dpm_flush_entry = malloc((sizeof(u8) * sc->max_dpm_entries), + sc->dpm_flush_entry = mallocarray(sc->max_dpm_entries, sizeof(u8), M_MPT2, M_ZERO|M_NOWAIT); if (!sc->dpm_flush_entry) goto free_resources; @@ -2451,7 +2451,7 @@ mps_mapping_topology_change_event(struct mps_softc *sc if (!num_entries) goto out; - phy_change = malloc(sizeof(struct _map_phy_change) * num_entries, + phy_change = mallocarray(num_entries, sizeof(struct _map_phy_change), M_MPT2, M_NOWAIT|M_ZERO); topo_change.phy_details = phy_change; if (!phy_change) @@ -2492,7 +2492,7 @@ mps_mapping_ir_config_change_event(struct mps_softc *s struct dev_mapping_table *mt_entry; u16 element_flags; - wwid_table = malloc(sizeof(u64) * event_data->NumElements, M_MPT2, + wwid_table = mallocarray(event_data->NumElements, sizeof(u64), M_MPT2, M_NOWAIT | M_ZERO); if (!wwid_table) goto out; Modified: head/sys/dev/mpt/mpt_cam.c ============================================================================== --- head/sys/dev/mpt/mpt_cam.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/mpt/mpt_cam.c Sat Jan 13 22:30:30 2018 (r327949) @@ -637,8 +637,8 @@ mptsas_sas_io_unit_pg0(struct mpt_softc *mpt, struct m } portinfo->num_phys = buffer->NumPhys; - portinfo->phy_info = malloc(sizeof(*portinfo->phy_info) * - portinfo->num_phys, M_DEVBUF, M_NOWAIT|M_ZERO); + portinfo->phy_info = mallocarray(portinfo->num_phys, + sizeof(*portinfo->phy_info), M_DEVBUF, M_NOWAIT|M_ZERO); if (portinfo->phy_info == NULL) { free(buffer, M_DEVBUF); error = ENOMEM; @@ -4234,7 +4234,7 @@ mpt_add_target_commands(struct mpt_softc *mpt) max = mpt->mpt_max_tgtcmds; } mpt->tgt_cmd_ptrs = - malloc(max * sizeof (request_t *), M_DEVBUF, M_NOWAIT | M_ZERO); + mallocarray(max, sizeof(request_t *), M_DEVBUF, M_NOWAIT | M_ZERO); if (mpt->tgt_cmd_ptrs == NULL) { mpt_prt(mpt, "mpt_add_target_commands: could not allocate cmd ptrs\n"); Modified: head/sys/dev/mrsas/mrsas.c ============================================================================== --- head/sys/dev/mrsas/mrsas.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/mrsas/mrsas.c Sat Jan 13 22:30:30 2018 (r327949) @@ -2566,7 +2566,8 @@ mrsas_alloc_mpt_cmds(struct mrsas_softc *sc) * Allocate the dynamic array first and then allocate individual * commands. */ - sc->mpt_cmd_list = malloc(sizeof(struct mrsas_mpt_cmd *) * max_cmd, M_MRSAS, M_NOWAIT); + sc->mpt_cmd_list = mallocarray(max_cmd, sizeof(struct mrsas_mpt_cmd *), + M_MRSAS, M_NOWAIT); if (!sc->mpt_cmd_list) { device_printf(sc->mrsas_dev, "Cannot alloc memory for mpt_cmd_list.\n"); return (ENOMEM); Modified: head/sys/dev/mxge/if_mxge.c ============================================================================== --- head/sys/dev/mxge/if_mxge.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/mxge/if_mxge.c Sat Jan 13 22:30:30 2018 (r327949) @@ -688,7 +688,7 @@ z_alloc(void *nil, u_int items, u_int size) { void *ptr; - ptr = malloc(items * size, M_TEMP, M_NOWAIT); + ptr = mallocarray(items, size, M_TEMP, M_NOWAIT); return ptr; } @@ -4390,8 +4390,8 @@ mxge_alloc_slices(mxge_softc_t *sc) sc->rx_ring_size = cmd.data0; max_intr_slots = 2 * (sc->rx_ring_size / sizeof (mcp_dma_addr_t)); - bytes = sizeof (*sc->ss) * sc->num_slices; - sc->ss = malloc(bytes, M_DEVBUF, M_NOWAIT | M_ZERO); + sc->ss = mallocarray(sc->num_slices, sizeof(*sc->ss), M_DEVBUF, + M_NOWAIT | M_ZERO); if (sc->ss == NULL) return (ENOMEM); for (i = 0; i < sc->num_slices; i++) { @@ -4563,8 +4563,8 @@ mxge_add_msix_irqs(mxge_softc_t *sc) err = ENOSPC; goto abort_with_msix; } - bytes = sizeof (*sc->msix_irq_res) * sc->num_slices; - sc->msix_irq_res = malloc(bytes, M_DEVBUF, M_NOWAIT|M_ZERO); + sc->msix_irq_res = mallocarray(sc->num_slices, + sizeof(*sc->msix_irq_res), M_DEVBUF, M_NOWAIT|M_ZERO); if (sc->msix_irq_res == NULL) { err = ENOMEM; goto abort_with_msix; @@ -4583,8 +4583,8 @@ mxge_add_msix_irqs(mxge_softc_t *sc) } } - bytes = sizeof (*sc->msix_ih) * sc->num_slices; - sc->msix_ih = malloc(bytes, M_DEVBUF, M_NOWAIT|M_ZERO); + sc->msix_ih = mallocarray(sc->num_slices, sizeof(*sc->msix_ih), + M_DEVBUF, M_NOWAIT|M_ZERO); for (i = 0; i < sc->num_slices; i++) { err = bus_setup_intr(sc->dev, sc->msix_irq_res[i], Modified: head/sys/dev/netmap/if_ptnet.c ============================================================================== --- head/sys/dev/netmap/if_ptnet.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/netmap/if_ptnet.c Sat Jan 13 22:30:30 2018 (r327949) @@ -351,7 +351,7 @@ ptnet_attach(device_t dev) sc->num_tx_rings = num_tx_rings; /* Allocate and initialize per-queue data structures. */ - sc->queues = malloc(sizeof(struct ptnet_queue) * sc->num_rings, + sc->queues = mallocarray(sc->num_rings, sizeof(struct ptnet_queue), M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->queues == NULL) { err = ENOMEM; Modified: head/sys/dev/nvme/nvme_ns.c ============================================================================== --- head/sys/dev/nvme/nvme_ns.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/nvme/nvme_ns.c Sat Jan 13 22:30:30 2018 (r327949) @@ -321,7 +321,8 @@ nvme_allocate_child_bios(int num_bios) struct bio **child_bios; int err = 0, i; - child_bios = malloc(num_bios * sizeof(struct bio *), M_NVME, M_NOWAIT); + child_bios = mallocarray(num_bios, sizeof(struct bio *), M_NVME, + M_NOWAIT); if (child_bios == NULL) return (NULL); Modified: head/sys/dev/pst/pst-iop.c ============================================================================== --- head/sys/dev/pst/pst-iop.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/pst/pst-iop.c Sat Jan 13 22:30:30 2018 (r327949) @@ -323,7 +323,7 @@ iop_get_lct(struct iop_softc *sc) contigfree(reply, ALLOCSIZE, M_PSTIOP); return 0; } - if (!(sc->lct = malloc(reply->table_size * sizeof(struct i2o_lct_entry), + if (!(sc->lct = mallocarray(reply->table_size, sizeof(struct i2o_lct_entry), M_PSTIOP, M_NOWAIT | M_ZERO))) { contigfree(reply, ALLOCSIZE, M_PSTIOP); return 0; Modified: head/sys/dev/ral/rt2560.c ============================================================================== --- head/sys/dev/ral/rt2560.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/ral/rt2560.c Sat Jan 13 22:30:30 2018 (r327949) @@ -488,7 +488,7 @@ rt2560_alloc_tx_ring(struct rt2560_softc *sc, struct r goto fail; } - ring->data = malloc(count * sizeof (struct rt2560_tx_data), M_DEVBUF, + ring->data = mallocarray(count, sizeof(struct rt2560_tx_data), M_DEVBUF, M_NOWAIT | M_ZERO); if (ring->data == NULL) { device_printf(sc->sc_dev, "could not allocate soft data\n"); @@ -632,8 +632,8 @@ rt2560_alloc_rx_ring(struct rt2560_softc *sc, struct r goto fail; } - ring->data = malloc(count * sizeof (struct rt2560_rx_data), M_DEVBUF, - M_NOWAIT | M_ZERO); + ring->data = mallocarray(count, sizeof (struct rt2560_rx_data), + M_DEVBUF, M_NOWAIT | M_ZERO); if (ring->data == NULL) { device_printf(sc->sc_dev, "could not allocate soft data\n"); error = ENOMEM; Modified: head/sys/dev/ral/rt2661.c ============================================================================== --- head/sys/dev/ral/rt2661.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/ral/rt2661.c Sat Jan 13 22:30:30 2018 (r327949) @@ -497,7 +497,7 @@ rt2661_alloc_tx_ring(struct rt2661_softc *sc, struct r goto fail; } - ring->data = malloc(count * sizeof (struct rt2661_tx_data), M_DEVBUF, + ring->data = mallocarray(count, sizeof(struct rt2661_tx_data), M_DEVBUF, M_NOWAIT | M_ZERO); if (ring->data == NULL) { device_printf(sc->sc_dev, "could not allocate soft data\n"); @@ -638,7 +638,7 @@ rt2661_alloc_rx_ring(struct rt2661_softc *sc, struct r goto fail; } - ring->data = malloc(count * sizeof (struct rt2661_rx_data), M_DEVBUF, + ring->data = mallocarray(count, sizeof(struct rt2661_rx_data), M_DEVBUF, M_NOWAIT | M_ZERO); if (ring->data == NULL) { device_printf(sc->sc_dev, "could not allocate soft data\n"); Modified: head/sys/dev/rp/rp.c ============================================================================== --- head/sys/dev/rp/rp.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/rp/rp.c Sat Jan 13 22:30:30 2018 (r327949) @@ -732,7 +732,8 @@ rp_attachcommon(CONTROLLER_T *ctlp, int num_aiops, int ctlp->num_ports = num_ports; ctlp->rp = rp = (struct rp_port *) - malloc(sizeof(struct rp_port) * num_ports, M_DEVBUF, M_NOWAIT | M_ZERO); + mallocarray(num_ports, sizeof(struct rp_port), M_DEVBUF, + M_NOWAIT | M_ZERO); if (rp == NULL) { device_printf(ctlp->dev, "rp_attachcommon: Could not malloc rp_ports structures.\n"); retval = ENOMEM; Modified: head/sys/dev/rp/rp_isa.c ============================================================================== --- head/sys/dev/rp/rp_isa.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/rp/rp_isa.c Sat Jan 13 22:30:30 2018 (r327949) @@ -178,8 +178,10 @@ rp_probe(device_t dev) /* The IO ports of AIOPs for an ISA controller are discrete. */ ctlp->io_num = 1; - ctlp->io_rid = malloc(sizeof(*(ctlp->io_rid)) * MAX_AIOPS_PER_BOARD, M_DEVBUF, M_NOWAIT | M_ZERO); - ctlp->io = malloc(sizeof(*(ctlp->io)) * MAX_AIOPS_PER_BOARD, M_DEVBUF, M_NOWAIT | M_ZERO); + ctlp->io_rid = mallocarray(MAX_AIOPS_PER_BOARD, sizeof(*(ctlp->io_rid)), + M_DEVBUF, M_NOWAIT | M_ZERO); + ctlp->io = mallocarray(MAX_AIOPS_PER_BOARD, sizeof(*(ctlp->io)), + M_DEVBUF, M_NOWAIT | M_ZERO); if (ctlp->io_rid == NULL || ctlp->io == NULL) { device_printf(dev, "rp_attach: Out of memory.\n"); retval = ENOMEM; Modified: head/sys/dev/rp/rp_pci.c ============================================================================== --- head/sys/dev/rp/rp_pci.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/rp/rp_pci.c Sat Jan 13 22:30:30 2018 (r327949) @@ -164,8 +164,10 @@ rp_pciattach(device_t dev) /* The IO ports of AIOPs for a PCI controller are continuous. */ ctlp->io_num = 1; - ctlp->io_rid = malloc(sizeof(*(ctlp->io_rid)) * ctlp->io_num, M_DEVBUF, M_NOWAIT | M_ZERO); - ctlp->io = malloc(sizeof(*(ctlp->io)) * ctlp->io_num, M_DEVBUF, M_NOWAIT | M_ZERO); + ctlp->io_rid = mallocarray(ctlp->io_num, sizeof(*(ctlp->io_rid)), + M_DEVBUF, M_NOWAIT | M_ZERO); + ctlp->io = mallocarray(ctlp->io_num, sizeof(*(ctlp->io)), M_DEVBUF, + M_NOWAIT | M_ZERO); if (ctlp->io_rid == NULL || ctlp->io == NULL) { device_printf(dev, "rp_pciattach: Out of memory.\n"); retval = ENOMEM; Modified: head/sys/dev/sound/midi/midi.c ============================================================================== --- head/sys/dev/sound/midi/midi.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/sound/midi/midi.c Sat Jan 13 22:30:30 2018 (r327949) @@ -340,14 +340,15 @@ midi_init(kobj_class_t cls, int unit, int channel, voi mtx_lock(&m->qlock); if (inqsize) - buf = malloc(sizeof(MIDI_TYPE) * inqsize, M_MIDI, M_NOWAIT); + buf = mallocarray(inqsize, sizeof(MIDI_TYPE), M_MIDI, M_NOWAIT); else buf = NULL; MIDIQ_INIT(m->inq, buf, inqsize); if (outqsize) - buf = malloc(sizeof(MIDI_TYPE) * outqsize, M_MIDI, M_NOWAIT); + buf = mallocarray(outqsize, sizeof(MIDI_TYPE), M_MIDI, + M_NOWAIT); else buf = NULL; m->hiwat = outqsize / 2; Modified: head/sys/dev/sound/pci/hda/hdaa.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdaa.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/sound/pci/hda/hdaa.c Sat Jan 13 22:30:30 2018 (r327949) @@ -3034,8 +3034,8 @@ hdaa_audio_ctl_parse(struct hdaa_devinfo *devinfo) if (max < 1) return; - ctls = (struct hdaa_audio_ctl *)malloc( - sizeof(*ctls) * max, M_HDAA, M_ZERO | M_NOWAIT); + ctls = (struct hdaa_audio_ctl *)mallocarray(max, + sizeof(*ctls), M_HDAA, M_ZERO | M_NOWAIT); if (ctls == NULL) { /* Blekh! */ @@ -3187,8 +3187,8 @@ hdaa_audio_as_parse(struct hdaa_devinfo *devinfo) if (max < 1) return; - as = (struct hdaa_audio_as *)malloc( - sizeof(*as) * max, M_HDAA, M_ZERO | M_NOWAIT); + as = (struct hdaa_audio_as *)mallocarray(max, + sizeof(*as), M_HDAA, M_ZERO | M_NOWAIT); if (as == NULL) { /* Blekh! */ @@ -4078,8 +4078,8 @@ hdaa_audio_bind_as(struct hdaa_devinfo *devinfo) cnt += as[j].num_chans; } if (devinfo->num_chans == 0) { - devinfo->chans = (struct hdaa_chan *)malloc( - sizeof(struct hdaa_chan) * cnt, + devinfo->chans = (struct hdaa_chan *)mallocarray(cnt, + sizeof(struct hdaa_chan), M_HDAA, M_ZERO | M_NOWAIT); if (devinfo->chans == NULL) { device_printf(devinfo->dev, @@ -5491,8 +5491,8 @@ hdaa_prepare_pcms(struct hdaa_devinfo *devinfo) devinfo->num_devs = max(ardev, apdev) + max(drdev, dpdev); devinfo->devs = - (struct hdaa_pcm_devinfo *)malloc( - devinfo->num_devs * sizeof(struct hdaa_pcm_devinfo), + (struct hdaa_pcm_devinfo *)mallocarray( + devinfo->num_devs, sizeof(struct hdaa_pcm_devinfo), M_HDAA, M_ZERO | M_NOWAIT); if (devinfo->devs == NULL) { device_printf(devinfo->dev, Modified: head/sys/dev/syscons/fire/fire_saver.c ============================================================================== --- head/sys/dev/syscons/fire/fire_saver.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/syscons/fire/fire_saver.c Sat Jan 13 22:30:30 2018 (r327949) @@ -155,7 +155,7 @@ fire_init(video_adapter_t *adp) scrw = info.vi_width; scrh = info.vi_height; - buf = (u_char *)malloc(scrw * (scrh + 1), M_DEVBUF, M_NOWAIT); + buf = (u_char *)mallocarray(scrw, scrh + 1, M_DEVBUF, M_NOWAIT); if (buf) { bzero(buf, scrw * (scrh + 1)); } else { Modified: head/sys/dev/virtio/console/virtio_console.c ============================================================================== --- head/sys/dev/virtio/console/virtio_console.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/virtio/console/virtio_console.c Sat Jan 13 22:30:30 2018 (r327949) @@ -474,11 +474,11 @@ static int vtcon_alloc_scports(struct vtcon_softc *sc) { struct vtcon_softc_port *scport; - int max, i; + u_int max, i; max = sc->vtcon_max_ports; - sc->vtcon_ports = malloc(sizeof(struct vtcon_softc_port) * max, + sc->vtcon_ports = mallocarray(max, sizeof(struct vtcon_softc_port), M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->vtcon_ports == NULL) return (ENOMEM); @@ -497,7 +497,8 @@ vtcon_alloc_virtqueues(struct vtcon_softc *sc) device_t dev; struct vq_alloc_info *info; struct vtcon_softc_port *scport; - int i, idx, portidx, nvqs, error; + u_int i, idx, portidx, nvqs; + int error; dev = sc->vtcon_dev; @@ -505,7 +506,8 @@ vtcon_alloc_virtqueues(struct vtcon_softc *sc) if (sc->vtcon_flags & VTCON_FLAG_MULTIPORT) nvqs += 2; - info = malloc(sizeof(struct vq_alloc_info) * nvqs, M_TEMP, M_NOWAIT); + info = mallocarray(nvqs, sizeof(struct vq_alloc_info), M_TEMP, + M_NOWAIT); if (info == NULL) return (ENOMEM); Modified: head/sys/dev/virtio/mmio/virtio_mmio.c ============================================================================== --- head/sys/dev/virtio/mmio/virtio_mmio.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/virtio/mmio/virtio_mmio.c Sat Jan 13 22:30:30 2018 (r327949) @@ -507,7 +507,7 @@ vtmmio_alloc_virtqueues(device_t dev, int flags, int n if (nvqs <= 0) return (EINVAL); - sc->vtmmio_vqs = malloc(nvqs * sizeof(struct vtmmio_virtqueue), + sc->vtmmio_vqs = mallocarray(nvqs, sizeof(struct vtmmio_virtqueue), M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->vtmmio_vqs == NULL) return (ENOMEM); Modified: head/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- head/sys/dev/virtio/network/if_vtnet.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/virtio/network/if_vtnet.c Sat Jan 13 22:30:30 2018 (r327949) @@ -755,9 +755,9 @@ vtnet_alloc_rxtx_queues(struct vtnet_softc *sc) npairs = sc->vtnet_max_vq_pairs; - sc->vtnet_rxqs = malloc(sizeof(struct vtnet_rxq) * npairs, M_DEVBUF, + sc->vtnet_rxqs = mallocarray(npairs, sizeof(struct vtnet_rxq), M_DEVBUF, M_NOWAIT | M_ZERO); - sc->vtnet_txqs = malloc(sizeof(struct vtnet_txq) * npairs, M_DEVBUF, + sc->vtnet_txqs = mallocarray(npairs, sizeof(struct vtnet_txq), M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->vtnet_rxqs == NULL || sc->vtnet_txqs == NULL) return (ENOMEM); @@ -887,7 +887,8 @@ vtnet_alloc_virtqueues(struct vtnet_softc *sc) if (sc->vtnet_flags & VTNET_FLAG_CTRL_VQ) nvqs++; - info = malloc(sizeof(struct vq_alloc_info) * nvqs, M_TEMP, M_NOWAIT); + info = mallocarray(nvqs, sizeof(struct vq_alloc_info), M_TEMP, + M_NOWAIT); if (info == NULL) return (ENOMEM); Modified: head/sys/dev/virtio/pci/virtio_pci.c ============================================================================== --- head/sys/dev/virtio/pci/virtio_pci.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/virtio/pci/virtio_pci.c Sat Jan 13 22:30:30 2018 (r327949) @@ -491,7 +491,7 @@ vtpci_alloc_virtqueues(device_t dev, int flags, int nv if (nvqs <= 0) return (EINVAL); - sc->vtpci_vqs = malloc(nvqs * sizeof(struct vtpci_virtqueue), + sc->vtpci_vqs = mallocarray(nvqs, sizeof(struct vtpci_virtqueue), M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->vtpci_vqs == NULL) return (ENOMEM); @@ -927,7 +927,7 @@ vtpci_alloc_intr_resources(struct vtpci_softc *sc) /* Subtract one for the configuration changed interrupt. */ nvq_intrs = sc->vtpci_nmsix_resources - 1; - intr = sc->vtpci_msix_vq_interrupts = malloc(nvq_intrs * + intr = sc->vtpci_msix_vq_interrupts = mallocarray(nvq_intrs, sizeof(struct vtpci_interrupt), M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->vtpci_msix_vq_interrupts == NULL) return (ENOMEM); Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c ============================================================================== --- head/sys/dev/vmware/vmxnet3/if_vmx.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/vmware/vmxnet3/if_vmx.c Sat Jan 13 22:30:30 2018 (r327949) @@ -959,7 +959,7 @@ vmxnet3_init_rxq(struct vmxnet3_softc *sc, int q) rxr = &rxq->vxrxq_cmd_ring[i]; rxr->vxrxr_rid = i; rxr->vxrxr_ndesc = sc->vmx_nrxdescs; - rxr->vxrxr_rxbuf = malloc(rxr->vxrxr_ndesc * + rxr->vxrxr_rxbuf = mallocarray(rxr->vxrxr_ndesc, sizeof(struct vmxnet3_rxbuf), M_DEVBUF, M_NOWAIT | M_ZERO); if (rxr->vxrxr_rxbuf == NULL) return (ENOMEM); @@ -987,7 +987,7 @@ vmxnet3_init_txq(struct vmxnet3_softc *sc, int q) txq->vxtxq_id = q; txr->vxtxr_ndesc = sc->vmx_ntxdescs; - txr->vxtxr_txbuf = malloc(txr->vxtxr_ndesc * + txr->vxtxr_txbuf = mallocarray(txr->vxtxr_ndesc, sizeof(struct vmxnet3_txbuf), M_DEVBUF, M_NOWAIT | M_ZERO); if (txr->vxtxr_txbuf == NULL) return (ENOMEM); @@ -1023,10 +1023,10 @@ vmxnet3_alloc_rxtx_queues(struct vmxnet3_softc *sc) sc->vmx_max_ntxqueues = 1; } - sc->vmx_rxq = malloc(sizeof(struct vmxnet3_rxqueue) * - sc->vmx_max_nrxqueues, M_DEVBUF, M_NOWAIT | M_ZERO); - sc->vmx_txq = malloc(sizeof(struct vmxnet3_txqueue) * - sc->vmx_max_ntxqueues, M_DEVBUF, M_NOWAIT | M_ZERO); + sc->vmx_rxq = mallocarray(sc->vmx_max_nrxqueues, + sizeof(struct vmxnet3_rxqueue), M_DEVBUF, M_NOWAIT | M_ZERO); + sc->vmx_txq = mallocarray(sc->vmx_max_ntxqueues, + sizeof(struct vmxnet3_txqueue), M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->vmx_rxq == NULL || sc->vmx_txq == NULL) return (ENOMEM); Modified: head/sys/dev/vnic/nicvf_queues.c ============================================================================== --- head/sys/dev/vnic/nicvf_queues.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/vnic/nicvf_queues.c Sat Jan 13 22:30:30 2018 (r327949) @@ -1104,7 +1104,7 @@ nicvf_init_snd_queue(struct nicvf *nic, struct snd_que } /* Allocate send buffers array */ - sq->snd_buff = malloc(sizeof(*sq->snd_buff) * q_len, M_NICVF, + sq->snd_buff = mallocarray(q_len, sizeof(*sq->snd_buff), M_NICVF, (M_NOWAIT | M_ZERO)); if (sq->snd_buff == NULL) { device_printf(nic->dev, Modified: head/sys/dev/xen/blkback/blkback.c ============================================================================== --- head/sys/dev/xen/blkback/blkback.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/xen/blkback/blkback.c Sat Jan 13 22:30:30 2018 (r327949) @@ -3166,7 +3166,7 @@ xbb_alloc_requests(struct xbb_softc *xbb) /* * Allocate request book keeping datastructures. */ - xbb->requests = malloc(xbb->max_requests * sizeof(*xbb->requests), + xbb->requests = mallocarray(xbb->max_requests, sizeof(*xbb->requests), M_XENBLOCKBACK, M_NOWAIT|M_ZERO); if (xbb->requests == NULL) { xenbus_dev_fatal(xbb->dev, ENOMEM, @@ -3194,7 +3194,7 @@ xbb_alloc_request_lists(struct xbb_softc *xbb) * If no requests can be merged, we need 1 request list per * in flight request. */ - xbb->request_lists = malloc(xbb->max_requests * + xbb->request_lists = mallocarray(xbb->max_requests, sizeof(*xbb->request_lists), M_XENBLOCKBACK, M_NOWAIT|M_ZERO); if (xbb->request_lists == NULL) { xenbus_dev_fatal(xbb->dev, ENOMEM, @@ -3222,7 +3222,7 @@ xbb_alloc_request_lists(struct xbb_softc *xbb) } #endif /* XBB_USE_BOUNCE_BUFFERS */ - reqlist->gnt_handles = malloc(xbb->max_reqlist_segments * + reqlist->gnt_handles = mallocarray(xbb->max_reqlist_segments, sizeof(*reqlist->gnt_handles), M_XENBLOCKBACK, M_NOWAIT|M_ZERO); if (reqlist->gnt_handles == NULL) { Modified: head/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- head/sys/dev/xen/blkfront/blkfront.c Sat Jan 13 21:39:46 2018 (r327948) +++ head/sys/dev/xen/blkfront/blkfront.c Sat Jan 13 22:30:30 2018 (r327949) @@ -1306,8 +1306,8 @@ xbd_connect(struct xbd_softc *sc) } /* Per-transaction data allocation. */ - sc->xbd_shadow = malloc(sizeof(*sc->xbd_shadow) * sc->xbd_max_requests, - M_XENBLOCKFRONT, M_NOWAIT|M_ZERO); + sc->xbd_shadow = mallocarray(sc->xbd_max_requests, + sizeof(*sc->xbd_shadow), M_XENBLOCKFRONT, M_NOWAIT|M_ZERO); if (sc->xbd_shadow == NULL) { bus_dma_tag_destroy(sc->xbd_io_dmat); xenbus_dev_fatal(sc->xbd_dev, ENOMEM, @@ -1320,9 +1320,8 @@ xbd_connect(struct xbd_softc *sc) void * indirectpages; cm = &sc->xbd_shadow[i]; - cm->cm_sg_refs = malloc( - sizeof(grant_ref_t) * sc->xbd_max_request_segments, - M_XENBLOCKFRONT, M_NOWAIT); + cm->cm_sg_refs = mallocarray(sc->xbd_max_request_segments, + sizeof(grant_ref_t), M_XENBLOCKFRONT, M_NOWAIT); if (cm->cm_sg_refs == NULL) break; cm->cm_id = i; From owner-svn-src-head@freebsd.org Sat Jan 13 22:34:36 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC802EB3688 for ; Sat, 13 Jan 2018 22:34:36 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic309-35.consmr.mail.ne1.yahoo.com (sonic309-35.consmr.mail.ne1.yahoo.com [66.163.184.161]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BFCBC7B72F for ; Sat, 13 Jan 2018 22:34:36 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1515882869; bh=i5NMKWD3wgmlpnuvUSTvvmgzyjgC24n1kJnLYnuXcrs=; h=Subject:From:To:References:Date:In-Reply-To:From:Subject; b=P1iCi3MOFGAL5V+XBzLdAqUZPddXK1KCqjD76022M05r/6HWQTIl4OOyLH5bgslbgW/ujqm1nU37H46jrb+3xrZe9ko+D7aZinzcZQNcqnLdhxciHBxgDgDszHXHc8Q+iu/g4IPPIBKI3tBmo56nuz91AJY2Px8ec5ebzP1ww10JJvJ9WeetIEaGno2R7HnJKiaHLL/UJCKyekURB+y36QpNtK5AYCuZve7/rCZuGyAYkYaDqNUsKVCmM/Zz0B9KxuTG3W7rzSuzW5Bpzv/BPJM5Qzikv86ORDpvp6GScIT56zpvA0G74/KBA4jmH9LQSCN0n9Fk72rc2EpMgdP+4g== X-YMail-OSG: PuK9uloVM1m8brSagtTWlHLlpb5TrA4DvpYATeesMTPuaAcwxeoYUZY881awH_I xVZ33ef8pXuiBnNenpwEIs1RE.POhXc2oDqHhAPSRmPN3QPfIEHUZZIGZt2fyvVEvFATUTYXEjDf YR8KHtnWnUMwGpJ0rDf2ZML9FqD.TSFbHj77wwsXYbtvYFj9FGVMhWMaWfUYo_k8Ntp0nps3TR_r ExeAjfJ79K0tKS.SjzH0xL7vtNox7Sumb7r6LZv3la8m64uvMjzrfp4VGue8TKiIPbgtZKAVoa19 1OBnUS19YyJ0SZmANOv0Lrqj6tXhBUW63st8YWjEjySqvG_8VkCAkkGiCxfIe2icqnL8yOovJxt0 tBT6xA8Kx3bUrpBFPwRCSE1x5.8iYmecbRwhC8xVpYRcIaQUfjN8FfWGdhzczOvMLPvHRJHOgKyE jheH_eaZqMAoo2W1R.oP8_9SwvHuKKioPrtpAtQtLhZU3ucCfBk4dLW5UHzGqzYB22OGWT046 Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.ne1.yahoo.com with HTTP; Sat, 13 Jan 2018 22:34:29 +0000 Received: from smtp235.mail.ne1.yahoo.com (EHLO [192.168.0.8]) ([10.218.253.206]) by smtp410.mail.ne1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID a8138e14407a32871ff47ab2d66e5170; Sat, 13 Jan 2018 22:34:25 +0000 (UTC) Subject: Re: svn commit: r327949 - in head/sys/dev: aacraid advansys ath beri/virtio bnxt bwn ciss cxgbe/crypto esp fb gpio if_ndis iwi kbd liquidio liquidio/base mpr mps mpt mrsas mxge netmap nvme pst ral rp s... From: Pedro Giffuni To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801132230.w0DMUVmF081985@repo.freebsd.org> Message-ID: <7fe2a0bb-8592-75bc-6f58-cb77e2d6044c@FreeBSD.org> Date: Sat, 13 Jan 2018 17:34:24 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <201801132230.w0DMUVmF081985@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 22:34:37 -0000 On 01/13/18 17:30, Pedro F. Giffuni wrote: > Author: pfg > Date: Sat Jan 13 22:30:30 2018 > New Revision: 327949 > URL: https://svnweb.freebsd.org/changeset/base/327949 > > Log: > dev: make some use of mallocarray(9). > > Focus on code where we are doing multiplications within malloc(9). None of > these is likely to overflow, however the change is still useful as some > static checkers can benefit from the allocation attributes we use for > mallocarray. > > This initial sweep only covers malloc(9) calls with M_NOWAIT. No good > reason but I started doing the changes before r327796 and at that time it > was convenient to make sure the sorrounding code could handle NULL values. > For the record, this was part of https://reviews.freebsd.org/D13837 I didn't mention it in the commit log because I am not ready to close the revision yet. Pedro. From owner-svn-src-head@freebsd.org Sat Jan 13 23:14:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7C91EB5893; Sat, 13 Jan 2018 23:14:54 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C1E7F7D1C0; Sat, 13 Jan 2018 23:14:54 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0360C19815; Sat, 13 Jan 2018 23:14:54 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DNErbf002698; Sat, 13 Jan 2018 23:14:53 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DNEra5002692; Sat, 13 Jan 2018 23:14:53 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201801132314.w0DNEra5002692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Sat, 13 Jan 2018 23:14:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327950 - in head/sys/powerpc: aim include powerpc ps3 X-SVN-Group: head X-SVN-Commit-Author: nwhitehorn X-SVN-Commit-Paths: in head/sys/powerpc: aim include powerpc ps3 X-SVN-Commit-Revision: 327950 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 23:14:55 -0000 Author: nwhitehorn Date: Sat Jan 13 23:14:53 2018 New Revision: 327950 URL: https://svnweb.freebsd.org/changeset/base/327950 Log: Document places we assume that physical memory is direct-mapped at zero by using a new macro PHYS_TO_DMAP, which deliberately has the same name as the equivalent macro on amd64. This also sets the stage for moving the direct map to another base address. Modified: head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/aim/slb.c head/sys/powerpc/include/vmparam.h head/sys/powerpc/powerpc/uma_machdep.c head/sys/powerpc/ps3/platform_ps3.c Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Sat Jan 13 22:30:30 2018 (r327949) +++ head/sys/powerpc/aim/mmu_oea64.c Sat Jan 13 23:14:53 2018 (r327950) @@ -540,7 +540,8 @@ moea64_add_ofw_mappings(mmu_t mmup, phandle_t mmu, siz DISABLE_TRANS(msr); for (off = 0; off < translations[i].om_len; off += PAGE_SIZE) { /* If this address is direct-mapped, skip remapping */ - if (hw_direct_map && translations[i].om_va == pa_base && + if (hw_direct_map && + translations[i].om_va == PHYS_TO_DMAP(pa_base) && moea64_calc_wimg(pa_base + off, VM_MEMATTR_DEFAULT) == LPTE_M) continue; @@ -633,7 +634,7 @@ moea64_setup_direct_map(mmu_t mmup, vm_offset_t kernel pvo = alloc_pvo_entry(1 /* bootstrap */); pvo->pvo_vaddr |= PVO_WIRED | PVO_LARGE; - init_pvo_entry(pvo, kernel_pmap, pa); + init_pvo_entry(pvo, kernel_pmap, PHYS_TO_DMAP(pa)); /* * Set memory access as guarded if prefetch within @@ -1111,7 +1112,8 @@ moea64_copy_page(mmu_t mmu, vm_page_t msrc, vm_page_t src = VM_PAGE_TO_PHYS(msrc); if (hw_direct_map) { - bcopy((void *)src, (void *)dst, PAGE_SIZE); + bcopy((void *)PHYS_TO_DMAP(src), (void *)PHYS_TO_DMAP(dst), + PAGE_SIZE); } else { mtx_lock(&moea64_scratchpage_mtx); @@ -1136,11 +1138,13 @@ moea64_copy_pages_dmap(mmu_t mmu, vm_page_t *ma, vm_of while (xfersize > 0) { a_pg_offset = a_offset & PAGE_MASK; cnt = min(xfersize, PAGE_SIZE - a_pg_offset); - a_cp = (char *)VM_PAGE_TO_PHYS(ma[a_offset >> PAGE_SHIFT]) + + a_cp = (char *)PHYS_TO_DMAP( + VM_PAGE_TO_PHYS(ma[a_offset >> PAGE_SHIFT])) + a_pg_offset; b_pg_offset = b_offset & PAGE_MASK; cnt = min(cnt, PAGE_SIZE - b_pg_offset); - b_cp = (char *)VM_PAGE_TO_PHYS(mb[b_offset >> PAGE_SHIFT]) + + b_cp = (char *)PHYS_TO_DMAP( + VM_PAGE_TO_PHYS(mb[b_offset >> PAGE_SHIFT])) + b_pg_offset; bcopy(a_cp, b_cp, cnt); a_offset += cnt; @@ -1200,7 +1204,7 @@ moea64_zero_page_area(mmu_t mmu, vm_page_t m, int off, panic("moea64_zero_page: size + off > PAGE_SIZE"); if (hw_direct_map) { - bzero((caddr_t)pa + off, size); + bzero((caddr_t)PHYS_TO_DMAP(pa) + off, size); } else { mtx_lock(&moea64_scratchpage_mtx); moea64_set_scratchpage_pa(mmu, 0, pa); @@ -1224,7 +1228,7 @@ moea64_zero_page(mmu_t mmu, vm_page_t m) moea64_set_scratchpage_pa(mmu, 0, pa); va = moea64_scratchpage_va[0]; } else { - va = pa; + va = PHYS_TO_DMAP(pa); } for (off = 0; off < PAGE_SIZE; off += cacheline_size) @@ -1241,7 +1245,7 @@ moea64_quick_enter_page(mmu_t mmu, vm_page_t m) vm_paddr_t pa = VM_PAGE_TO_PHYS(m); if (hw_direct_map) - return (pa); + return (PHYS_TO_DMAP(pa)); /* * MOEA64_PTE_REPLACE does some locking, so we can't just grab @@ -1402,7 +1406,7 @@ moea64_syncicache(mmu_t mmu, pmap_t pmap, vm_offset_t } else if (pmap == kernel_pmap) { __syncicache((void *)va, sz); } else if (hw_direct_map) { - __syncicache((void *)pa, sz); + __syncicache((void *)PHYS_TO_DMAP(pa), sz); } else { /* Use the scratch page to set up a temp mapping */ @@ -1565,7 +1569,7 @@ moea64_init(mmu_t mmu) if (!hw_direct_map) { installed_mmu = mmu; - uma_zone_set_allocf(moea64_pvo_zone,moea64_uma_page_alloc); + uma_zone_set_allocf(moea64_pvo_zone, moea64_uma_page_alloc); } #ifdef COMPAT_FREEBSD32 @@ -1855,7 +1859,7 @@ moea64_map(mmu_t mmu, vm_offset_t *virt, vm_paddr_t pa if (moea64_calc_wimg(va, VM_MEMATTR_DEFAULT) != LPTE_M) break; if (va == pa_end) - return (pa_start); + return (PHYS_TO_DMAP(pa_start)); } sva = *virt; va = sva; Modified: head/sys/powerpc/aim/slb.c ============================================================================== --- head/sys/powerpc/aim/slb.c Sat Jan 13 22:30:30 2018 (r327949) +++ head/sys/powerpc/aim/slb.c Sat Jan 13 23:14:53 2018 (r327950) @@ -497,7 +497,7 @@ slb_uma_real_alloc(uma_zone_t zone, vm_size_t bytes, i if (m == NULL) return (NULL); - va = (void *) VM_PAGE_TO_PHYS(m); + va = (void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); if (!hw_direct_map) pmap_kenter((vm_offset_t)va, VM_PAGE_TO_PHYS(m)); Modified: head/sys/powerpc/include/vmparam.h ============================================================================== --- head/sys/powerpc/include/vmparam.h Sat Jan 13 22:30:30 2018 (r327949) +++ head/sys/powerpc/include/vmparam.h Sat Jan 13 23:14:53 2018 (r327950) @@ -238,5 +238,15 @@ struct pmap_physseg { #define SFBUF_NOMD #define SFBUF_OPTIONAL_DIRECT_MAP hw_direct_map #define SFBUF_PHYS_DMAP(x) (x) + +/* + * We (usually) have a direct map of all physical memory. All + * uses of this macro must be gated by a check on hw_direct_map! + * The location of the direct map may not be 1:1 in future, so use + * of the macro is recommended; it may also grow an assert that hw_direct_map + * is set. + */ +#define PHYS_TO_DMAP(x) x +#define DMAP_TO_PHYS(x) x #endif /* _MACHINE_VMPARAM_H_ */ Modified: head/sys/powerpc/powerpc/uma_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/uma_machdep.c Sat Jan 13 22:30:30 2018 (r327949) +++ head/sys/powerpc/powerpc/uma_machdep.c Sat Jan 13 23:14:53 2018 (r327950) @@ -71,10 +71,12 @@ uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int if ((vm_offset_t)pa != pa) return (NULL); - va = (void *)(vm_offset_t)pa; - - if (!hw_direct_map) - pmap_kenter((vm_offset_t)va, VM_PAGE_TO_PHYS(m)); + if (!hw_direct_map) { + pmap_kenter(pa, pa); + va = (void *)(vm_offset_t)pa; + } else { + va = (void *)(vm_offset_t)PHYS_TO_DMAP(pa); + } if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) bzero(va, PAGE_SIZE); Modified: head/sys/powerpc/ps3/platform_ps3.c ============================================================================== --- head/sys/powerpc/ps3/platform_ps3.c Sat Jan 13 22:30:30 2018 (r327949) +++ head/sys/powerpc/ps3/platform_ps3.c Sat Jan 13 23:14:53 2018 (r327950) @@ -226,7 +226,7 @@ static int ps3_smp_start_cpu(platform_t plat, struct pcpu *pc) { /* kernel is spinning on 0x40 == -1 right now */ - volatile uint32_t *secondary_spin_sem = (uint32_t *)(0x40); + volatile uint32_t *secondary_spin_sem = (uint32_t *)PHYS_TO_DMAP(0x40); int remote_pir = pc->pc_hwref; int timeout; From owner-svn-src-head@freebsd.org Sat Jan 13 23:24:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8570E5C012; Sat, 13 Jan 2018 23:24:49 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E2DE7D8B8; Sat, 13 Jan 2018 23:24:49 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w0DNOfod099633 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 14 Jan 2018 01:24:45 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w0DNOfod099633 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w0DNOfJf099632; Sun, 14 Jan 2018 01:24:41 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 14 Jan 2018 01:24:41 +0200 From: Konstantin Belousov To: Nathan Whitehorn Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r327950 - in head/sys/powerpc: aim include powerpc ps3 Message-ID: <20180113232441.GV1684@kib.kiev.ua> References: <201801132314.w0DNEra5002692@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201801132314.w0DNEra5002692@repo.freebsd.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 23:24:49 -0000 On Sat, Jan 13, 2018 at 11:14:53PM +0000, Nathan Whitehorn wrote: > +/* > + * We (usually) have a direct map of all physical memory. All > + * uses of this macro must be gated by a check on hw_direct_map! > + * The location of the direct map may not be 1:1 in future, so use > + * of the macro is recommended; it may also grow an assert that hw_direct_map > + * is set. > + */ > +#define PHYS_TO_DMAP(x) x > +#define DMAP_TO_PHYS(x) x Take a look at the sys/vm/vm_page.c:vm_page_free_prep() function. From owner-svn-src-head@freebsd.org Sat Jan 13 23:29:03 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C888E5C404; Sat, 13 Jan 2018 23:29:03 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from d.mail.sonic.net (d.mail.sonic.net [64.142.111.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 174D67DC0A; Sat, 13 Jan 2018 23:29:02 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from comporellon.tachypleus.net (cpe-75-82-218-62.socal.res.rr.com [75.82.218.62]) (authenticated bits=0) by d.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id w0DNT0Z7026221 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Sat, 13 Jan 2018 15:29:01 -0800 Subject: Re: svn commit: r327950 - in head/sys/powerpc: aim include powerpc ps3 To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801132314.w0DNEra5002692@repo.freebsd.org> <20180113232441.GV1684@kib.kiev.ua> From: Nathan Whitehorn Message-ID: <010d0153-8931-a3c2-db21-dfcbaf848fc0@freebsd.org> Date: Sat, 13 Jan 2018 15:28:59 -0800 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180113232441.GV1684@kib.kiev.ua> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Sonic-CAuth: UmFuZG9tSVbXA+BLLZigOJRHWfOciRD1qWnBea3ivbeu37VDmTNKWd6NmXii/IMAku+B1kvN5NSbWIYwwAg5sW3o3SCH6Ar5dTfnp4UCecE= X-Sonic-ID: C;ai+XiLn45xGegeBQ9eIpJw== M;WBgaibn45xGegeBQ9eIpJw== X-Spam-Flag: No X-Sonic-Spam-Details: 0.0/5.0 by cerberusd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 23:29:03 -0000 On 01/13/18 15:24, Konstantin Belousov wrote: > On Sat, Jan 13, 2018 at 11:14:53PM +0000, Nathan Whitehorn wrote: >> +/* >> + * We (usually) have a direct map of all physical memory. All >> + * uses of this macro must be gated by a check on hw_direct_map! >> + * The location of the direct map may not be 1:1 in future, so use >> + * of the macro is recommended; it may also grow an assert that hw_direct_map >> + * is set. >> + */ >> +#define PHYS_TO_DMAP(x) x >> +#define DMAP_TO_PHYS(x) x > Take a look at the sys/vm/vm_page.c:vm_page_free_prep() function. > I think the checks in there should work as designed, unless I'm missing something. Am I? -Nathan From owner-svn-src-head@freebsd.org Sat Jan 13 23:31:22 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC1D6E5C794; Sat, 13 Jan 2018 23:31:22 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C234D7DF55; Sat, 13 Jan 2018 23:31:22 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 001EE19AD5; Sat, 13 Jan 2018 23:31:21 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0DNVLoQ007819; Sat, 13 Jan 2018 23:31:21 GMT (envelope-from n_hibma@FreeBSD.org) Received: (from n_hibma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0DNVLZl007817; Sat, 13 Jan 2018 23:31:21 GMT (envelope-from n_hibma@FreeBSD.org) Message-Id: <201801132331.w0DNVLZl007817@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: n_hibma set sender to n_hibma@FreeBSD.org using -f From: Nick Hibma Date: Sat, 13 Jan 2018 23:31:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327951 - in head/sys/dev/usb: . serial X-SVN-Group: head X-SVN-Commit-Author: n_hibma X-SVN-Commit-Paths: in head/sys/dev/usb: . serial X-SVN-Commit-Revision: 327951 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 23:31:23 -0000 Author: n_hibma Date: Sat Jan 13 23:31:21 2018 New Revision: 327951 URL: https://svnweb.freebsd.org/changeset/base/327951 Log: Add support for Quectel EC25. Submitted by: Samuel Crookes MFC after: 3 days Modified: head/sys/dev/usb/serial/u3g.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Sat Jan 13 23:14:53 2018 (r327950) +++ head/sys/dev/usb/serial/u3g.c Sat Jan 13 23:31:21 2018 (r327951) @@ -491,6 +491,7 @@ static const STRUCT_USB_HOST_ID u3g_devs[] = { U3G_DEV(QUANTA, GLX, 0), U3G_DEV(QUANTA, Q101, 0), U3G_DEV(QUANTA, Q111, 0), + U3G_DEV(QUECTEL, EC25, 0), U3G_DEV(SIERRA, AC402, 0), U3G_DEV(SIERRA, AC595U, 0), U3G_DEV(SIERRA, AC313U, 0), Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Sat Jan 13 23:14:53 2018 (r327950) +++ head/sys/dev/usb/usbdevs Sat Jan 13 23:31:21 2018 (r327951) @@ -751,6 +751,7 @@ vendor HIROSE 0x2631 Hirose Electric vendor NHJ 0x2770 NHJ vendor THINGM 0x27b8 ThingM vendor PLANEX 0x2c02 Planex Communications +vendor QUECTEL 0x2c7c Quectel Wireless Solutions vendor VIDZMEDIA 0x3275 VidzMedia Pte Ltd vendor LINKINSTRUMENTS 0x3195 Link Instruments Inc. vendor AEI 0x3334 AEI @@ -3812,11 +3813,14 @@ product QUANTA GKE 0xea05 HSDPA modem product QUANTA GLE 0xea06 HSDPA modem product QUANTA RW6815R 0xf003 HP iPAQ rw6815 RNDIS -/* Qtronix products */ -product QTRONIX 980N 0x2011 Scorpion-980N keyboard +/* Quectel products */ +product QUECTEL EC25 0x0125 LTE modem /* Quickshot products */ product QUICKSHOT STRIKEPAD 0x6238 USB StrikePad + +/* Qtronix products */ +product QTRONIX 980N 0x2011 Scorpion-980N keyboard /* Radio Shack */ product RADIOSHACK USBCABLE 0x4026 USB to Serial Cable From owner-svn-src-head@freebsd.org Sat Jan 13 23:54:18 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4552E60BA5 for ; Sat, 13 Jan 2018 23:54:18 +0000 (UTC) (envelope-from mw@semihalf.com) Received: from mail-io0-x235.google.com (mail-io0-x235.google.com [IPv6:2607:f8b0:4001:c06::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6BBCD7EA79 for ; Sat, 13 Jan 2018 23:54:18 +0000 (UTC) (envelope-from mw@semihalf.com) Received: by mail-io0-x235.google.com with SMTP id v30so9613332iov.7 for ; Sat, 13 Jan 2018 15:54:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=8q70L55Qnofs8yiwA2St2ejFBfUDxh+C35ITTLUAZIQ=; b=MjPDyXSpkN66cfhTK1iOZ0RAnR9zQOoPd/7TV0E4NY+5MR/TlHfR0nMUSSD184c6Xz mHKtLMGaNkzZg8b8BFnxlvGdDDcXKDkYF9l/SqzP6QUFfiyVF0nl0E2r+QCMkJ7J7fei hZ9ELD1g0WCWYFtlZhBlIIrsOMoZuTVYJHahjwGcbfc9uq5UxRbSChnK2vj0sjTek9VL Lvd0wk4FEUncTZEpwZsLcmVpww0oVfEyudpaxHx9SUpzit07wPKnDy34eaaO/pmQ7vV2 MX+m+nJh2eRbRytpn2up8lLZ9CGmL7s/EmbPXQOFpXRx/zaGwbKZoJACpw3ODnbWIEMa Pkeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=8q70L55Qnofs8yiwA2St2ejFBfUDxh+C35ITTLUAZIQ=; b=jQpSzYtiTf3dMjyQJpX4/WcttIkdUkHecGs0wL+dH/x/Jv1l51dERnvsdV1HYP4PMk IGsMCcqk6TiTyHb9uo5eE3jG155xtGT4njSJ0ntmtVNSO1K4w4nlYwwyHjJBgiRyjPbO Z7E+S2WYMeFr2SIChTpaGMsmbbe2SDk//juo4rrOMB/2UXcejJ1tzdgL9T0DKvd956uD 8OJUgtSSs+m7TIs7u0NNh78P3ap4QkKKy4+BwDRt7UfrRqO7Ekxnh04k42l0hwFnYkkT KQ/tTS085RJeOz+QFufeII4VU/f1RfIKZrPWyDuAnrmxuiIynR1nD30usJk7bXT7CN6k h3yQ== X-Gm-Message-State: AKwxytfHHmqL+5vN2JTSAdYqk11uV/C3LAENrRTMFFvyGApy4JmOpDmB QwQqulpdIY4grlaKQwJL0Iu2OnZOi1VcJEZTWXUWy6lyg5M= X-Google-Smtp-Source: ACJfBosS5JPIw/xIDFc7rE8cRsmcxWvCyFySD+iwqImACJx9X3yscFlLXvB0vYENmnSJ01xo6BQrH5whn+DHjhZCxtA= X-Received: by 10.107.112.7 with SMTP id l7mr3097736ioc.178.1515887657632; Sat, 13 Jan 2018 15:54:17 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.37.13 with HTTP; Sat, 13 Jan 2018 15:54:17 -0800 (PST) In-Reply-To: <187e75c7-343f-aea6-cb59-61c77fd64023@freebsd.org> References: <201801121401.w0CE1cW4058239@repo.freebsd.org> <187e75c7-343f-aea6-cb59-61c77fd64023@freebsd.org> From: Marcin Wojtas Date: Sun, 14 Jan 2018 00:54:17 +0100 Message-ID: Subject: Re: svn commit: r327876 - in head/sys/arm64: arm64 include To: mmel@freebsd.org Cc: Warner Losh , Andrew Turner , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 23:54:18 -0000 Hi Michal, 2018-01-12 18:15 GMT+01:00 Michal Meloun : > > > On 12.01.2018 15:54, Warner Losh wrote: >> >> >> >> On Fri, Jan 12, 2018 at 7:52 AM, Andrew Turner > > wrote: >> >> >> >>> On 12 Jan 2018, at 14:37, Warner Losh >> > wrote: >>> >>> >>> >>> On Fri, Jan 12, 2018 at 7:15 AM, Andrew Turner >> > wrote: >>> >>> >>> >>>> On 12 Jan 2018, at 14:10, Marcin Wojtas >>> > wrote: >>>> >>>> Hi Andrew, >>>> >>>> >>>> >>>> 2018-01-12 15:01 GMT+01:00 Andrew Turner >>> >: >>>> >>>>> Author: andrew >>>>> Date: Fri Jan 12 14:01:38 2018 >>>>> New Revision: 327876 >>>>> URL: https://svnweb.freebsd.org/changeset/base/327876 >>>>> >>>>> >>>>> Log: >>>>> Workaround Spectre Variant 2 on arm64. >>>>> >>>>> We need to handle two cases: >>>>> >>>>> 1. One process attacking another process. >>>>> 2. A process attacking the kernel. >>>>> >>>>> For the first case we clear the branch predictor state on >>>>> context switch >>>>> between different processes. For the second we do this when >>>>> taking an >>>>> instruction abort on a non-userspace address. >>>>> >>>>> To clear the branch predictor state a per-CPU function >>>>> pointer has been >>>>> added. This is set by the new cpu errata code based on if >>>>> the CPU is >>>>> known to be affected. >>>>> >>>>> On Cortex-A57, A72, A73, and A75 we call into the PSCI >>>>> firmware as newer >>>>> versions of this will clear the branch predictor state for us. >>>>> >>>>> It has been reported the ThunderX is unaffected, however >>>>> the ThunderX2 is >>>>> vulnerable. The Qualcomm Falkor core is also affected. As >>>>> FreeBSD doesn't >>>>> yet run on the ThunderX2 or Falkor no workaround is >>>>> included for these CPUs. >>>> >>>> >>>> Regardless ThunderX2 / Falkor work-arounds, do I understand >>>> correctly >>>> that pure CA72 machines, such as Marvell Armada 7k/8k are >>>> immune to >>>> Variant 2 now? >>> >>> >>> It is my understanding that the A72 will be immune with this >>> patch and an updated Arm Trusted Firmware as documented in [1]. >>> >>> Andrew >>> >>> [1] >>> >>> https://github.com/ARM-software/arm-trusted-firmware/wiki/ARM-Trusted-Firmware-Security-Advisory-TFV-6 >>> >>> >>> >>> >>> Are you also working on aarch32 mitigation? >> >> >> No. I think a similar technique could be used, however as aarch32 >> has instructions to invalidate the branch predictor these can be >> used directly. >> >> >> That's my reading as well. It looks fairly easy to do it always, but I've >> not researched it sufficiently. >> > > I work on patches for armv6/7. But for aarch32, there is, unfortunately, > much less information available about affective mitigation of variant 2. > BPIALL while switching pmap is clear and we have it in code for years > (well, BPIALL is effectively NOP for A15/A17, it must be explicitly > enabled). > But is not clear for me for which trap is branch predictor flush necessary. > As for armv7, I believe the brand new patches on top of this branch could be helpful: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/log/?h=kpti Best regards, Marcin