[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [UNIKRAFT PATCH] include: Introduce uk/preemmpt.h
This commit adds an additional header with two new methods: - preempt_disable() - preempt_enable() These methods enable and disable preemption by calling a memory barrier only. Their names are derived from the Linux Kernel[1]. Whilst currently unimplemented, pre-emptive scheduling requires additional notarization when called. This means that future enhancements to Unikraft's pre-emptive scheduler will need to modify these methods to increase a counter within the thread to indicate whether the thread is pre-emptible or not. [0]: https://elixir.bootlin.com/linux/latest/source/include/linux/preempt.h#L169 Signed-off-by: Alexander Jung <alexander.jung@xxxxxxxxx> --- include/uk/preempt.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 include/uk/preempt.h diff --git a/include/uk/preempt.h b/include/uk/preempt.h new file mode 100644 index 0000000..d45623d --- /dev/null +++ b/include/uk/preempt.h @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* + * Authors: Alexander Jung <alexander.jung@xxxxxxxxx> + * + * Copyright (c) 2020, NEC Laboratories Europe GmbH, NEC Corporation. + * 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. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. + */ + +#ifndef __UK_PREEMPT_H__ +#define __UK_PREEMPT_H__ + +#define preempt_disable() barrier() +#define preempt_enable() barrier() + +#endif /* __UK_PREEMPT_H__ */ -- 2.11.0
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |