The NetBSD Project

CVS log for src/sys/kern/subr_copy.c

[BACK] Up to [cvs.NetBSD.org] / src / sys / kern

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.16 / (download) - annotate - [select for diffs], Sat Apr 9 23:51:09 2022 UTC (9 months, 3 weeks ago) by riastradh
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10, bouyer-sunxi-drm-base, bouyer-sunxi-drm, HEAD
Changes since 1.15: +4 -4 lines
Diff to previous 1.15 (colored)

ucas(9): Convert membar_exit to membar_release.

Revision 1.15 / (download) - annotate - [select for diffs], Fri Feb 11 17:53:28 2022 UTC (11 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.14: +49 -9 lines
Diff to previous 1.14 (colored)

ucas(9): Membar audit.

- Omit needless membar_enter before ipi_trigger_broadcast.  This was
  presumably intended to imply a happens-before relation for the
  following two CPUs:

	/* CPU doing ucas */
	ucas_critical_enter()
		ucas_critical_pausing_cpus = ncpu - 1	(A)
		ipi_trigger_broadcast()

	/* other CPU walking by whistling innocently */
	IPI handler
	ucas_critical_cpu_gate()
		load ucas_critical_pausing_cpus		(B)

  That is, this was presumably meant to ensure (A) happens-before (B).
  This relation is already guaranteed by ipi(9), so there is no need
  for any explicit memory barrier.

- Issue a store-release in ucas_critical_cpu_gate so we have the
  following happens-before relation which was otherwise not guaranteed
  except if __HAVE_ATOMIC_AS_MEMBAR:

	/* other CPU walking by whistling innocently */
	...other logic touching the target ucas word...	(A)
	IPI handler
	ucas_critical_cpu_gate()
		...
		atomic_dec_uint(&ucas_critical_pausing_cpus)

  happens-before

	/* CPU doing ucas */
	ucas_critical_enter() -> ucas_critical_wait();
	...touching the word with ufetch/ustore...	(B)

  We need to ensure the logic (A) on another CPU touching the target
  ucas word happens-before we actually do the ucas at (B).

  (a) This requires the other CPU to do a store-release on
      ucas_critical_pausing_cpus in ucas_critical_cpu_gate, and

  (b) this requires the ucas CPU to do a load-acquire on
      ucas_critical_pausing_cpus in ucas_critical_wait.

  Without _both_ sides -- store-release and then load-acquire -- there
  is no such happens-before guarantee; another CPU may have a buffered
  store, for instance, that clobbers the ucas.

  For now, do the store-release with membar_exit conditional on
  __HAVE_ATOMIC_AS_MEMBAR and then atomic_dec_uint -- later with the
  C11 API we can dispense with the #ifdef and just use
  atomic_fetch_add_explicit(..., memory_order_release).  The
  load-acquire we can do with atomic_load_acquire.

- Issue a load-acquire in ucas_critical_cpu_gate so we have the
  following happens-before relation which was otherwise not guaranteed:

	/* CPU doing ucas */
	...ufetch/ustore...				(A)
	ucas_critical_exit()
		ucas_critical_pausing_cpus = -1;

	/* other CPU walking by whistling innocently */
	IPI handler
	ucas_critical_cpu_gate()
		...
		while (ucas_critical_pausing_cpus != -1)
			spin;
	...other logic touching the target ucas word...	(B)

  We need to ensure the logic (A) to do the ucas happens-before logic
  that might use it on another CPU at (B).

  (a) This requires that the ucas CPU do a store-release on
      ucas_critical_pausing_cpus in ucas_critical_exit, and

  (b) this requires that the other CPU do a load-acquire on
      ucas_critical_pausing_cpus in ucas_critical_cpu_gate.

  Without _both_ sides -- store-release and then load-acquire -- there
  is no such happens-before guarantee; the other CPU might witness a
  cached stale value of the target location but a new value of some
  other location in the wrong order.

- Use atomic_load/store_* to avoid the appearance of races, e.g. for
  sanitizers.

- Document which barriers pair up with which barriers and what they're
  doing.

Revision 1.14 / (download) - annotate - [select for diffs], Sat May 23 23:42:43 2020 UTC (2 years, 8 months ago) by ad
Branch: MAIN
CVS Tags: thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-i2c-spi-conf-base, thorpej-i2c-spi-conf, thorpej-futex2-base, thorpej-futex2, thorpej-futex-base, thorpej-futex, thorpej-cfargs2-base, thorpej-cfargs2, thorpej-cfargs-base, thorpej-cfargs, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Changes since 1.13: +5 -5 lines
Diff to previous 1.13 (colored)

Move proc_lock into the data segment.  It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.

Revision 1.8.2.2 / (download) - annotate - [select for diffs], Wed Apr 8 14:08:52 2020 UTC (2 years, 9 months ago) by martin
Branch: phil-wifi
Changes since 1.8.2.1: +8 -9 lines
Diff to previous 1.8.2.1 (colored) to branchpoint 1.8 (colored) next main 1.9 (colored)

Merge changes from current as of 20200406

Revision 1.13 / (download) - annotate - [select for diffs], Sat Mar 14 18:08:39 2020 UTC (2 years, 10 months ago) by ad
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, bouyer-xenpvh-base2, bouyer-xenpvh-base1, bouyer-xenpvh-base, bouyer-xenpvh
Changes since 1.12: +3 -5 lines
Diff to previous 1.12 (colored)

- Hide the details of SPCF_SHOULDYIELD and related behind a couple of small
  functions: preempt_point() and preempt_needed().

- preempt(): if the LWP has exceeded its timeslice in kernel, strip it of
  any priority boost gained earlier from blocking.

Revision 1.11.6.1 / (download) - annotate - [select for diffs], Sat Feb 29 20:21:03 2020 UTC (2 years, 11 months ago) by ad
Branch: ad-namecache
Changes since 1.11: +7 -6 lines
Diff to previous 1.11 (colored) next main 1.12 (colored)

Sync with head.

Revision 1.12 / (download) - annotate - [select for diffs], Sat Feb 22 21:59:30 2020 UTC (2 years, 11 months ago) by chs
Branch: MAIN
CVS Tags: is-mlppp-base, is-mlppp, ad-namecache-base3
Changes since 1.11: +7 -6 lines
Diff to previous 1.11 (colored)

check for errors from proc_vmspace_getref().

Revision 1.8.2.1 / (download) - annotate - [select for diffs], Mon Jun 10 22:09:03 2019 UTC (3 years, 7 months ago) by christos
Branch: phil-wifi
Changes since 1.8: +324 -5 lines
Diff to previous 1.8 (colored)

Sync with HEAD

Revision 1.11 / (download) - annotate - [select for diffs], Sun Apr 7 16:27:41 2019 UTC (3 years, 9 months ago) by thorpej
Branch: MAIN
CVS Tags: phil-wifi-20191119, phil-wifi-20190609, netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, isaki-audio2-base, isaki-audio2, ad-namecache-base2, ad-namecache-base1, ad-namecache-base
Branch point for: ad-namecache
Changes since 1.10: +6 -4 lines
Diff to previous 1.10 (colored)

Exclude references to _ucas_{32,64}_mp() for _RUMPKERNEL.

Revision 1.10 / (download) - annotate - [select for diffs], Sat Apr 6 15:52:35 2019 UTC (3 years, 9 months ago) by thorpej
Branch: MAIN
Changes since 1.9: +12 -4 lines
Diff to previous 1.9 (colored)

Treat _RUMPKERNEL like a __HAVE_UCAS_FULL platform.  Add a comment
explaining what's going on.  Fixes librump build on sparc.

Revision 1.9 / (download) - annotate - [select for diffs], Sat Apr 6 03:06:28 2019 UTC (3 years, 9 months ago) by thorpej
Branch: MAIN
Changes since 1.8: +314 -5 lines
Diff to previous 1.8 (colored)

Overhaul the API used to fetch and store individual memory cells in
userspace.  The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms.  The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

Also augmement the ucas(9) API, making it consistently available on
all plaforms, supporting uniprocessor and multiprocessor systems, even
those that do not have CAS or LL/SC primitives.

Welcome to NetBSD 8.99.37.

Revision 1.7.16.1 / (download) - annotate - [select for diffs], Mon Jun 25 07:26:04 2018 UTC (4 years, 7 months ago) by pgoyette
Branch: pgoyette-compat
CVS Tags: pgoyette-compat-merge-20190127
Changes since 1.7: +29 -2 lines
Diff to previous 1.7 (colored) next main 1.8 (colored)

Sync with HEAD

Revision 1.8 / (download) - annotate - [select for diffs], Mon May 28 21:04:41 2018 UTC (4 years, 8 months ago) by chs
Branch: MAIN
CVS Tags: phil-wifi-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625
Branch point for: phil-wifi
Changes since 1.7: +29 -2 lines
Diff to previous 1.7 (colored)

add copyin_pid(), to copyin from a different user address space.

Revision 1.1.24.1 / (download) - annotate - [select for diffs], Sun Dec 3 11:38:45 2017 UTC (5 years, 1 month ago) by jdolecek
Branch: tls-maxphys
Changes since 1.1: +3 -6 lines
Diff to previous 1.1 (colored) next main 1.2 (colored)

update from HEAD

Revision 1.1.42.3 / (download) - annotate - [select for diffs], Sun May 29 08:44:37 2016 UTC (6 years, 8 months ago) by skrll
Branch: nick-nhusb
Changes since 1.1.42.2: +4 -4 lines
Diff to previous 1.1.42.2 (colored) to branchpoint 1.1 (colored) next main 1.2 (colored)

Sync with HEAD

Revision 1.7 / (download) - annotate - [select for diffs], Wed May 25 17:43:58 2016 UTC (6 years, 8 months ago) by christos
Branch: MAIN
CVS Tags: tls-maxphys-base-20171202, prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, pgoyette-compat-base, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, perseant-stdc-iso10646-base, perseant-stdc-iso10646, nick-nhusb-base-20170825, nick-nhusb-base-20170204, nick-nhusb-base-20161204, nick-nhusb-base-20161004, nick-nhusb-base-20160907, nick-nhusb-base-20160529, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, matt-nb8-mediatek-base, matt-nb8-mediatek, localcount-20160914, jdolecek-ncq-base, jdolecek-ncq, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan
Branch point for: pgoyette-compat
Changes since 1.6: +4 -4 lines
Diff to previous 1.6 (colored)

Introduce security.pax.mprotect.ptrace sysctl which can be used to bypass
mprotect settings so that debuggers can write to the text segment of traced
processes so that they can insert breakpoints. Turned off by default.
Ok: chuq (for now)

Revision 1.1.42.2 / (download) - annotate - [select for diffs], Sat Jun 6 14:40:22 2015 UTC (7 years, 7 months ago) by skrll
Branch: nick-nhusb
Changes since 1.1.42.1: +3 -6 lines
Diff to previous 1.1.42.1 (colored) to branchpoint 1.1 (colored)

Sync with HEAD

Revision 1.6 / (download) - annotate - [select for diffs], Tue Apr 21 13:17:25 2015 UTC (7 years, 9 months ago) by riastradh
Branch: MAIN
CVS Tags: nick-nhusb-base-20160422, nick-nhusb-base-20160319, nick-nhusb-base-20151226, nick-nhusb-base-20150921, nick-nhusb-base-20150606
Changes since 1.5: +3 -6 lines
Diff to previous 1.5 (colored)

#ifdef DIAGNOSTIC panic -> KASSERT

Revision 1.1.42.1 / (download) - annotate - [select for diffs], Mon Apr 6 15:18:20 2015 UTC (7 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.1: +2 -2 lines
Diff to previous 1.1 (colored)

Sync with HEAD

Revision 1.5 / (download) - annotate - [select for diffs], Sun Mar 29 17:38:31 2015 UTC (7 years, 10 months ago) by riastradh
Branch: MAIN
CVS Tags: nick-nhusb-base-20150406
Changes since 1.4: +2 -12 lines
Diff to previous 1.4 (colored)

Back this out, per pooka's request.

Revision 1.4 / (download) - annotate - [select for diffs], Sun Mar 29 15:08:03 2015 UTC (7 years, 10 months ago) by riastradh
Branch: MAIN
Changes since 1.3: +12 -2 lines
Diff to previous 1.3 (colored)

Use #ifdef _RUMPKERNEL for now to prefer copyout over kcopy in tests.

Gross -- please fix me if you have a better approach.

Revision 1.3 / (download) - annotate - [select for diffs], Sun Mar 29 15:05:34 2015 UTC (7 years, 10 months ago) by riastradh
Branch: MAIN
Changes since 1.2: +8 -8 lines
Diff to previous 1.2 (colored)

Back out previous.

It appears to be causing anita install to fail.  Evidently
VM_SPACE_IS_KERNEL_P(vm) is not mutually exclusive with `vm ==
curproc->p_vmspace' -- in particular, proc0's VM space is kernel.

Making this work in rump for tests will require another approach.

Revision 1.2 / (download) - annotate - [select for diffs], Sat Mar 28 16:13:38 2015 UTC (7 years, 10 months ago) by riastradh
Branch: MAIN
Changes since 1.1: +8 -8 lines
Diff to previous 1.1 (colored)

Swap kernel/curproc tests in copy*_vmspace so rump can catch EFAULT.

Revision 1.1.4.2 / (download) - annotate - [select for diffs], Thu Mar 11 15:04:18 2010 UTC (12 years, 10 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.1.4.1: +327 -0 lines
Diff to previous 1.1.4.1 (colored) to branchpoint 1.1 (colored) next main 1.2 (colored)

sync with head

Revision 1.1.4.1, Wed Nov 4 16:54:00 2009 UTC (13 years, 2 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.1: +0 -327 lines
FILE REMOVED

file subr_copy.c was added on branch yamt-nfs-mp on 2010-03-11 15:04:18 +0000

Revision 1.1 / (download) - annotate - [select for diffs], Wed Nov 4 16:54:00 2009 UTC (13 years, 2 months ago) by pooka
Branch: MAIN
CVS Tags: yamt-pagecache-tag8, yamt-pagecache-base9, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, yamt-pagecache, yamt-nfs-mp-base9, yamt-nfs-mp-base11, yamt-nfs-mp-base10, uebayasi-xip-base4, uebayasi-xip-base3, uebayasi-xip-base2, uebayasi-xip-base1, uebayasi-xip-base, uebayasi-xip, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, rmind-uvmplock-nbase, rmind-uvmplock-base, rmind-uvmplock, rmind-smpnet-nbase, rmind-smpnet-base, rmind-smpnet, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, nick-nhusb-base, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-premerge-20091211, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, matt-mips64-premerge-20101231, khorben-n900, jruoho-x86intr-base, jruoho-x86intr, jmcneill-usbmp-pre-base2, jmcneill-usbmp-base9, jmcneill-usbmp-base8, jmcneill-usbmp-base7, jmcneill-usbmp-base6, jmcneill-usbmp-base5, jmcneill-usbmp-base4, jmcneill-usbmp-base3, jmcneill-usbmp-base2, jmcneill-usbmp-base10, jmcneill-usbmp-base, jmcneill-usbmp, jmcneill-audiomp3-base, jmcneill-audiomp3, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2, agc-symver-base, agc-symver
Branch point for: yamt-nfs-mp, tls-maxphys, nick-nhusb

Split uiomove() and high-level copy routines out of the crowded
kern_subr and into their own cozy home in subr_copy.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>