From 397a3034c72f3a3b5ce778f2f9ccaf50a309c1ef Mon Sep 17 00:00:00 2001 From: lihuiba Date: Mon, 23 Sep 2024 16:44:25 +0800 Subject: [PATCH 1/5] fix ut naming --- .github/workflows/ci.linux.arm.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.linux.arm.yml b/.github/workflows/ci.linux.arm.yml index 81f2d92d..4808159c 100644 --- a/.github/workflows/ci.linux.arm.yml +++ b/.github/workflows/ci.linux.arm.yml @@ -7,7 +7,7 @@ on: branches: [ "main", "release/*" ] jobs: - centos8-gcc921-epoll-release: + gcc921: runs-on: [self-hosted, Linux, ARM64] container: @@ -40,7 +40,7 @@ jobs: cd build ctest -E test-lockfree --timeout 3600 -V - centos8-gcc921-epoll-debug: + gcc921-build-debug: runs-on: [self-hosted, Linux, ARM64] container: @@ -67,8 +67,3 @@ jobs: -D PHOTON_ENABLE_FUSE=ON \ -D PHOTON_ENABLE_EXTFS=ON cmake --build build -j $(nproc) -- VERBOSE=1 - - - name: Test - run: | - cd build - ctest -E test-lockfree --timeout 3600 -V From c733eb6cf28ee9c9648c7edc49fbb9a67180ae8a Mon Sep 17 00:00:00 2001 From: Bob Chen Date: Wed, 25 Sep 2024 13:39:18 +0800 Subject: [PATCH 2/5] Fix the -Wshadow warning in compile --- common/alog.h | 4 ++-- common/iovector.h | 24 ++++++++++++------------ common/retval.h | 2 +- photon.cpp | 3 +-- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/common/alog.h b/common/alog.h index 1bdf7949..4ed36ec1 100644 --- a/common/alog.h +++ b/common/alog.h @@ -595,8 +595,8 @@ struct __LogAppender : public Builder { using Builder::logger; using Builder::done; Append append; - explicit __LogAppender(Builder&& rhs, Append&& append) - : Builder(std::move(rhs)), append(std::move(append)) {} + explicit __LogAppender(Builder&& rhs, Append&& append_) + : Builder(std::move(rhs)), append(std::move(append_)) {} __LogAppender(__LogAppender&& rhs) : Builder(std::move(rhs)), append(std::move(rhs.append)) {} ~__LogAppender() { diff --git a/common/iovector.h b/common/iovector.h index cdab146f..5298e7d8 100644 --- a/common/iovector.h +++ b/common/iovector.h @@ -1008,24 +1008,24 @@ class IOVectorEntity : public iovector } }; -inline size_t iovector_view::memcpy_to(iovector_view* iov, size_t size) const { - IOVectorEntity<32, 0> co_iov(this->iov, iovcnt); - return co_iov.view().memcpy_to(iov, size); +inline size_t iovector_view::memcpy_to(iovector_view* iov_, size_t size) const { + IOVectorEntity<32, 0> co_iov(iov, iovcnt); + return co_iov.view().memcpy_to(iov_, size); } -inline size_t iovector_view::memcpy_from(iovector_view* iov, size_t size) const { - IOVectorEntity<32, 0> co_iov(this->iov, iovcnt); - return co_iov.view().memcpy_from(iov, size); +inline size_t iovector_view::memcpy_from(iovector_view* iov_, size_t size) const { + IOVectorEntity<32, 0> co_iov(iov, iovcnt); + return co_iov.view().memcpy_from(iov_, size); } -inline size_t iovector_view::memcpy_to(const iovector_view* iov, size_t size) const { - IOVectorEntity<32, 0> co_iov(this->iov, iovcnt); - return co_iov.view().memcpy_from(iov, size); +inline size_t iovector_view::memcpy_to(const iovector_view* iov_, size_t size) const { + IOVectorEntity<32, 0> co_iov(iov, iovcnt); + return co_iov.view().memcpy_from(iov_, size); } -inline size_t iovector_view::memcpy_from(const iovector_view* iov, size_t size) const { - IOVectorEntity<32, 0> co_iov(this->iov, iovcnt); - return co_iov.view().memcpy_from(iov, size); +inline size_t iovector_view::memcpy_from(const iovector_view* iov_, size_t size) const { + IOVectorEntity<32, 0> co_iov(iov, iovcnt); + return co_iov.view().memcpy_from(iov_, size); } diff --git a/common/retval.h b/common/retval.h index f35af9e4..d1eed7a8 100644 --- a/common/retval.h +++ b/common/retval.h @@ -71,7 +71,7 @@ struct retval : public retval_base { template<> struct retval : public retval_base { - retval(int _errno = 0) : retval_base{(uint64_t)_errno} { } + retval(int errno_ = 0) : retval_base{(uint64_t)errno_} { } retval(const retval_base& rvb) : retval_base(rvb) { } void get() const { } retval_base base() const { diff --git a/photon.cpp b/photon.cpp index c2ac2be3..8388bce5 100644 --- a/photon.cpp +++ b/photon.cpp @@ -73,8 +73,7 @@ int __photon_init(uint64_t event_engine, uint64_t io_engine, const PhotonOptions const uint64_t ALL_ENGINES = INIT_EVENT_EPOLL | INIT_EVENT_EPOLL_NG | INIT_EVENT_IOURING | INIT_EVENT_KQUEUE | - INIT_EVENT_SELECT | INIT_EVENT_IOCP | - INIT_EVENT_EPOLL_NG; + INIT_EVENT_SELECT | INIT_EVENT_IOCP; if (event_engine & ALL_ENGINES) { bool ok = false; for (auto x : recommended_order) { From a9e38cc17fa37988f144042cda018900be05313f Mon Sep 17 00:00:00 2001 From: Bob Chen Date: Thu, 26 Sep 2024 12:01:40 +0800 Subject: [PATCH 3/5] Fix photon_std::thread::id default constructor (#573) --- thread/std-compat.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/thread/std-compat.h b/thread/std-compat.h index 7841b20c..eb52de40 100644 --- a/thread/std-compat.h +++ b/thread/std-compat.h @@ -55,8 +55,6 @@ inline uint64_t __duration_to_microseconds(const ::std::chrono::duration& lhs, photon_std::unique_lock +struct hash { + size_t operator()(const photon_std::thread::id& x) const { + hash hasher; + return hasher(x.value()); + } +}; + } From 1842e768827c155c0f7b23d2214f82d18301e514 Mon Sep 17 00:00:00 2001 From: Coldwings Date: Thu, 26 Sep 2024 12:02:02 +0800 Subject: [PATCH 4/5] FIX: stupid kqueue typo in `cancel_wait` (#575) --- io/kqueue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io/kqueue.cpp b/io/kqueue.cpp index ff905609..19563549 100644 --- a/io/kqueue.cpp +++ b/io/kqueue.cpp @@ -138,7 +138,7 @@ class KQueue : public MasterEventEngine, public CascadingEventEngine, public Res struct kevent entry; EV_SET(&entry, _kq, EVFILT_USER, EV_ONESHOT, NOTE_TRIGGER, 0, nullptr); struct timespec tm{0, 0}; - return kevent(_kq, _events, _n, nullptr, 0, &tm); + return kevent(_kq, &entry, 1, nullptr, 0, &tm); } // This vector is used to filter invalid add/rm_interest requests which may affect kevent's From de6bf577fafabb2930ecc6b7a98eb8ad461bd49d Mon Sep 17 00:00:00 2001 From: Bob Chen Date: Wed, 25 Sep 2024 13:34:22 +0800 Subject: [PATCH 5/5] Fix getpagesize() when first used --- include/photon/thread/arch.h | 1 + thread/arch.cpp | 23 +++++++++++++++++++++++ thread/arch.h | 26 ++++++++++++++++++++++++++ thread/stack-allocator.cpp | 3 +-- thread/thread.cpp | 11 +++++++---- 5 files changed, 58 insertions(+), 6 deletions(-) create mode 120000 include/photon/thread/arch.h create mode 100644 thread/arch.cpp create mode 100644 thread/arch.h diff --git a/include/photon/thread/arch.h b/include/photon/thread/arch.h new file mode 120000 index 00000000..657ef9aa --- /dev/null +++ b/include/photon/thread/arch.h @@ -0,0 +1 @@ +../../../thread/arch.h \ No newline at end of file diff --git a/thread/arch.cpp b/thread/arch.cpp new file mode 100644 index 00000000..10c4faaf --- /dev/null +++ b/thread/arch.cpp @@ -0,0 +1,23 @@ +/* +Copyright 2022 The Photon Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#include "arch.h" + +namespace photon { + +uint32_t PAGE_SIZE = 0; + +} \ No newline at end of file diff --git a/thread/arch.h b/thread/arch.h new file mode 100644 index 00000000..67a8bb0d --- /dev/null +++ b/thread/arch.h @@ -0,0 +1,26 @@ +/* +Copyright 2022 The Photon Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#pragma once + +#include + +namespace photon { + +// Only available after photon::init() or photon::vcpu_init() +extern uint32_t PAGE_SIZE; + +} \ No newline at end of file diff --git a/thread/stack-allocator.cpp b/thread/stack-allocator.cpp index ccc07d5a..6992e97f 100644 --- a/thread/stack-allocator.cpp +++ b/thread/stack-allocator.cpp @@ -20,6 +20,7 @@ limitations under the License. #include #include #include +#include #include #include #include @@ -28,8 +29,6 @@ limitations under the License. namespace photon { -const static size_t PAGE_SIZE = getpagesize(); - template class PooledStackAllocator { diff --git a/thread/thread.cpp b/thread/thread.cpp index 67fd3e53..5541e496 100644 --- a/thread/thread.cpp +++ b/thread/thread.cpp @@ -51,6 +51,7 @@ inline int posix_memalign(void** memptr, size_t alignment, size_t size) { #include #include #include +#include /* notes on the scheduler: @@ -86,8 +87,6 @@ inline int posix_memalign(void** memptr, size_t alignment, size_t size) { #name": " #endif -static const size_t PAGE_SIZE = getpagesize(); - namespace photon { inline uint64_t min(uint64_t a, uint64_t b) { return (a