From owner-svn-src-head@freebsd.org Fri Jul 6 21:18:33 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A061102E2C5 for ; Fri, 6 Jul 2018 21:18:33 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-yb0-x243.google.com (mail-yb0-x243.google.com [IPv6:2607:f8b0:4002:c09::243]) (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 CF18C97B98 for ; Fri, 6 Jul 2018 21:18:32 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-yb0-x243.google.com with SMTP id r3-v6so5087783ybo.4 for ; Fri, 06 Jul 2018 14:18:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=+ErIytpWC9x+Z/Lk7y6cJc1uHpjTEXF2BUvtZHXAcw0=; b=WG65CSW6fVr7YoU+kL3ez9FOEJbW7yIhrgzZNO5JAjGD4LtHdy5X7vjlv31eHlKlud G9ZIgIismS6eoiTMmf4IxX8IH779p6jsMdtOmpuLwES0lvzB3/gODUVlIFadhewOKE2E ijWefsFFt6ghfdjmrajnSB4WipC2WqpfjyprZVMXJ1E211TJTwDk0Dy8fd+GBS51Z2qR pdElfZARmi/bvWybzLu/D4Q5QT5DB0KVWa0WX3LuGwZTPrTgX96ZSfhfkNzW5lEWkFFN qlp5EJirlVhdvK+iK7Hieq/q9abFkYiNUFIPIkwEqM2PJ1fzlzjazsvmo/FaEPfHUQ3Q PgBg== 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=+ErIytpWC9x+Z/Lk7y6cJc1uHpjTEXF2BUvtZHXAcw0=; b=iRsZds5OIXdJSY0lUp/h6LmFSRoEhD4SK518mGrqebEVNX/eVNoowXeAMCl5TOm8qg AqIrhdVE+DJpOLSDTOTY/IkhzL2KLYKZxtcpskJ666qEe4IuhG9elk0ZOU/5u8RLG/H0 CCp1mr5W9B3xBUF53bTs1lgPM+nmvbqI83CBOuJNXKVKNk7AhuZXhx1i7IttUxhPFRIa E5lDm9Zrf3TztJtNYpOOLT3dTi5kgaQT5YR1Cn5XBj/3K1D5kze9//fE/8CAXgoUC0mP tgMDYpd7f5gnQ2QwYjvbjf/8JG0w0o+PvkZLGkQxoGmnzbnVEYd5hiQf9kpL/YTVcg+m DPrQ== X-Gm-Message-State: APt69E3lLdzLcsH8DVMd2cVqGGX/asY5+1pdSVlBHX3vorSAqgRmQF7c gC2lzgw1cvmzHU+wI15zudcu5Y2OGcPoO0+qanvQqA== X-Google-Smtp-Source: AAOMgpet8Gzhksq/8+S/JhoE29xzgCN2jqwijJC1DspMLNl6RgQqLYrjZ9AyttQPf0TI4Pf5YI9+iATf3kt4GFh5l80= X-Received: by 2002:a25:6342:: with SMTP id x63-v6mr6057157ybb.371.1530911911962; Fri, 06 Jul 2018 14:18:31 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:b90:0:0:0:0:0 with HTTP; Fri, 6 Jul 2018 14:18:31 -0700 (PDT) In-Reply-To: <201807061532.w66FWPEN052842@pdx.rh.CN85.dnsmgr.net> References: <201807061013.w66ADgbJ087546@repo.freebsd.org> <201807061532.w66FWPEN052842@pdx.rh.CN85.dnsmgr.net> From: Oliver Pinter Date: Fri, 6 Jul 2018 23:18:31 +0200 Message-ID: Subject: Re: svn commit: r336025 - in head/sys: amd64/include i386/include To: "rgrimes@freebsd.org" Cc: Hans Petter Selasky , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: 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, 06 Jul 2018 21:18:33 -0000 On Friday, July 6, 2018, Rodney W. Grimes wrote: > > Author: hselasky > > Date: Fri Jul 6 10:13:42 2018 > > New Revision: 336025 > > URL: https://svnweb.freebsd.org/changeset/base/336025 > > > > Log: > > Make sure kernel modules built by default are portable between UP and > > SMP systems by extending defined(SMP) to include defined(KLD_MODULE). > > > > This is a regression issue after r335873 . > > > > Discussed with: mmacy@ > > Sponsored by: Mellanox Technologies > > Though this fixes the issue, it also means that now when > anyone intentionally builds a UP kernel with modules > they are getting SMP support in the modules and I am > not sure they would want that. I know I don't. > > On linux case the lock instructions are runtime patchable. They have so called altinstruction facility, which able to detect specific conditions - in this case up vs smp - and in up case the locks are replaced with simple nops or one multi word nop when the instruction longer than 1 byte. > > Modified: > > head/sys/amd64/include/atomic.h > > head/sys/i386/include/atomic.h > > > > Modified: head/sys/amd64/include/atomic.h > > ============================================================ > ================== > > --- head/sys/amd64/include/atomic.h Fri Jul 6 10:10:00 2018 > (r336024) > > +++ head/sys/amd64/include/atomic.h Fri Jul 6 10:13:42 2018 > (r336025) > > @@ -132,7 +132,7 @@ void atomic_store_rel_##TYPE(volatile > u_##TYPE *p, u_ > > * For userland, always use lock prefixes so that the binaries will run > > * on both SMP and !SMP systems. > > */ > > -#if defined(SMP) || !defined(_KERNEL) > > +#if defined(SMP) || !defined(_KERNEL) || defined(KLD_MODULE) > > #define MPLOCKED "lock ; " > > #else > > #define MPLOCKED > > @@ -354,7 +354,7 @@ atomic_testandclear_long(volatile u_long *p, u_int > v) > > */ > > #define OFFSETOF_MONITORBUF 0x100 > > > > -#if defined(SMP) > > +#if defined(SMP) || defined(KLD_MODULE) > > static __inline void > > __storeload_barrier(void) > > { > > > > Modified: head/sys/i386/include/atomic.h > > ============================================================ > ================== > > --- head/sys/i386/include/atomic.h Fri Jul 6 10:10:00 2018 > (r336024) > > +++ head/sys/i386/include/atomic.h Fri Jul 6 10:13:42 2018 > (r336025) > > @@ -143,7 +143,7 @@ void atomic_subtract_64(volatile > uint64_t *, uint64_t > > * For userland, always use lock prefixes so that the binaries will run > > * on both SMP and !SMP systems. > > */ > > -#if defined(SMP) || !defined(_KERNEL) > > +#if defined(SMP) || !defined(_KERNEL) || defined(KLD_MODULE) > > #define MPLOCKED "lock ; " > > #else > > #define MPLOCKED > > @@ -302,7 +302,7 @@ atomic_testandclear_int(volatile u_int *p, u_int v) > > */ > > > > #if defined(_KERNEL) > > -#if defined(SMP) > > +#if defined(SMP) || defined(KLD_MODULE) > > #define __storeload_barrier() __mbk() > > #else /* _KERNEL && UP */ > > #define __storeload_barrier() __compiler_membar() > > > > > > -- > Rod Grimes > rgrimes@freebsd.org > _______________________________________________ > 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" >