Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce reliance on C++ exceptions in the base framework #5245

Open
nfeske opened this issue Jun 11, 2024 · 8 comments
Open

Reduce reliance on C++ exceptions in the base framework #5245

nfeske opened this issue Jun 11, 2024 · 8 comments

Comments

@nfeske
Copy link
Member

nfeske commented Jun 11, 2024

Down the road, I'd like to clear the base framework from the use of C++ exceptions, using the attempt pattern for error handling instead (see https://genode.org/documentation/genode-foundations/24.05/api/Fundamental_types.html#Exception-less_error_handling). Let's move gradually to this direction.

nfeske added a commit that referenced this issue Jun 11, 2024
This exception got introduced as a mere convenience for implementers of
'Child_policy' but required a special case in the base library.
Following the goal of eliminating exceptions from the base system,
this patch removes it by making a server_id_space mandatory.

Issue #5245
nfeske added a commit to nfeske/genode that referenced this issue Jun 11, 2024
This patch removes the two 'Xml_node::attribute' accessors along with
the 'Nonexistent_attribute' exception.

Issue genodelabs#5245
nfeske added a commit to nfeske/genode that referenced this issue Jun 11, 2024
This patch removes the two 'Xml_node::attribute' accessors along with
the 'Nonexistent_attribute' exception.

Issue genodelabs#5245
nfeske added a commit to nfeske/genode that referenced this issue Jun 11, 2024
This patch removes the two 'Xml_node::attribute' accessors along with
the 'Nonexistent_attribute' exception.

Issue genodelabs#5245
nfeske added a commit to nfeske/genode that referenced this issue Jun 11, 2024
- Use attempt pattern for error handling
- Replace lookup of pointers by with_ pattern
- Remove virtual Trace::Session methods
- Merge client.h into connection.h

Issue genodelabs#5245
nfeske added a commit to nfeske/genode that referenced this issue Jun 12, 2024
- Use attempt pattern for error handling
- Replace lookup of pointers by with_ pattern
- Remove virtual Trace::Session methods
- Merge client.h into connection.h
- Update coding style of test/trace

Issue genodelabs#5245
nfeske added a commit that referenced this issue Jun 12, 2024
This patch removes the two 'Xml_node::attribute' accessors along with
the 'Nonexistent_attribute' exception.

Issue #5245
nfeske added a commit that referenced this issue Jun 12, 2024
- Use attempt pattern for error handling
- Replace lookup of pointers by with_ pattern
- Remove virtual Trace::Session methods
- Merge client.h into connection.h
- Update coding style of test/trace

Issue #5245
@nfeske
Copy link
Member Author

nfeske commented Jun 12, 2024

Commit a82a3e6 and fixup 6af5a3e remove C++ exceptions from core's TRACE session interface and adjust the components throughout Genode's source tree. The new version of the interface is tighter in several respects. Hence, this change requires the adaptation of trace clients (@alex-ab thinking of top_view).

  • The split between client.h and connection.h has been removed. Note that error types between the RPC functions and the corresponding Connection methods differ because the Connection handles the OUT_OF_CAPS and OUT_OF_RAM conditions.
  • Basic types have been replaced by structs
  • The notion of invalid policy IDs does not exist anymore. If a policy ID cannot be created, the alloc_policy operation reflects this condition explicitly via an Alloc_policy_error. At the clients, the former instances of Policy_id (which could be invalid) are now mapped to Trace::Connection::Alloc_policy_result now.

@jschlatow I have adapted the trace recorder to this change but admittedly haven't tested it. I'd appreciate you giving it a spin.

nfeske added a commit that referenced this issue Jun 12, 2024
This patch removes the two 'Xml_node::attribute' accessors along with
the 'Nonexistent_attribute' exception.

Issue #5245
Fixes #5246
nfeske added a commit that referenced this issue Jun 12, 2024
- Use attempt pattern for error handling
- Replace lookup of pointers by with_ pattern
- Remove virtual Trace::Session methods
- Merge client.h into connection.h
- Update coding style of test/trace

Issue #5245
nfeske added a commit that referenced this issue Jun 12, 2024
While changing 'Pd_session::alloc_context', this patch also tightens the
type of the imprint argument.

Issue #5245
nfeske added a commit that referenced this issue Jun 13, 2024
Remove exceptions, replace pointer lookup by with_ pattern,
use Xml_node::attribute_value, constness, naming of signal handlers

Issue #5245
nfeske added a commit that referenced this issue Jun 14, 2024
This patch replaces exceptions of the PD session RPC interface with
result types.
The change of the quota-transfer RPC functions required the adaptation
of base/quota_transfer.h and base/child.h.
The 'alloc_signal_source' method has been renamed to 'signal_source'
to avoid an exceedingly long name of the corresponding result type.
The Pd_session::map function takes a 'Virt_range' instead of basic-type
arguments.
The 'Signal_source_capability' alias for 'Capability<Signal_source>' has
been removed.

Issue #5245
@nfeske
Copy link
Member Author

nfeske commented Jun 14, 2024

Commit 7cac494 takes another step by revisiting the PD session interface.

@jschlatow
Copy link
Member

@jschlatow I have adapted the trace recorder to this change but admittedly haven't tested it. I'd appreciate you giving it a spin.

It's spinning happily.

nfeske added a commit that referenced this issue Jun 17, 2024
nfeske added a commit that referenced this issue Jun 17, 2024
This patch removes the exception formerly thrown by 'Cpu_thread::state'
and turns the 'Thread_state' structure into a plain compound type w/o a
constructor.

Issue #5245
Fixes #5250
m-stein pushed a commit to m-stein/genode that referenced this issue Jun 18, 2024
This patch removes the two 'Xml_node::attribute' accessors along with
the 'Nonexistent_attribute' exception.

Issue genodelabs#5245
Fixes genodelabs#5246
m-stein pushed a commit to m-stein/genode that referenced this issue Jun 18, 2024
- Use attempt pattern for error handling
- Replace lookup of pointers by with_ pattern
- Remove virtual Trace::Session methods
- Merge client.h into connection.h
- Update coding style of test/trace

Issue genodelabs#5245
m-stein pushed a commit to m-stein/genode that referenced this issue Jun 18, 2024
While changing 'Pd_session::alloc_context', this patch also tightens the
type of the imprint argument.

Issue genodelabs#5245
m-stein pushed a commit to m-stein/genode that referenced this issue Jun 18, 2024
Remove exceptions, replace pointer lookup by with_ pattern,
use Xml_node::attribute_value, constness, naming of signal handlers

Issue genodelabs#5245
m-stein pushed a commit to m-stein/genode that referenced this issue Jun 18, 2024
This patch replaces exceptions of the PD session RPC interface with
result types.
The change of the quota-transfer RPC functions required the adaptation
of base/quota_transfer.h and base/child.h.
The 'alloc_signal_source' method has been renamed to 'signal_source'
to avoid an exceedingly long name of the corresponding result type.
The Pd_session::map function takes a 'Virt_range' instead of basic-type
arguments.
The 'Signal_source_capability' alias for 'Capability<Signal_source>' has
been removed.

Issue genodelabs#5245
chelmuth pushed a commit that referenced this issue Jun 18, 2024
This patch removes the two 'Xml_node::attribute' accessors along with
the 'Nonexistent_attribute' exception.

Issue #5245
Fixes #5246
chelmuth pushed a commit that referenced this issue Jun 18, 2024
- Use attempt pattern for error handling
- Replace lookup of pointers by with_ pattern
- Remove virtual Trace::Session methods
- Merge client.h into connection.h
- Update coding style of test/trace

Issue #5245
nfeske added a commit to genodelabs/genode-world that referenced this issue Jun 24, 2024
m-stein pushed a commit to m-stein/genode that referenced this issue Jun 25, 2024
This patch removes the two 'Xml_node::attribute' accessors along with
the 'Nonexistent_attribute' exception.

Issue genodelabs#5245
Fixes genodelabs#5246
m-stein pushed a commit to m-stein/genode that referenced this issue Jun 25, 2024
- Use attempt pattern for error handling
- Replace lookup of pointers by with_ pattern
- Remove virtual Trace::Session methods
- Merge client.h into connection.h
- Update coding style of test/trace

Issue genodelabs#5245
m-stein pushed a commit to m-stein/genode that referenced this issue Jun 25, 2024
While changing 'Pd_session::alloc_context', this patch also tightens the
type of the imprint argument.

Issue genodelabs#5245
m-stein pushed a commit to m-stein/genode that referenced this issue Jun 25, 2024
Remove exceptions, replace pointer lookup by with_ pattern,
use Xml_node::attribute_value, constness, naming of signal handlers

Issue genodelabs#5245
m-stein pushed a commit to m-stein/genode that referenced this issue Jun 25, 2024
This patch replaces exceptions of the PD session RPC interface with
result types.
The change of the quota-transfer RPC functions required the adaptation
of base/quota_transfer.h and base/child.h.
The 'alloc_signal_source' method has been renamed to 'signal_source'
to avoid an exceedingly long name of the corresponding result type.
The Pd_session::map function takes a 'Virt_range' instead of basic-type
arguments.
The 'Signal_source_capability' alias for 'Capability<Signal_source>' has
been removed.

Issue genodelabs#5245
nfeske pushed a commit to genodelabs/genode-world that referenced this issue Jun 25, 2024
@nfeske
Copy link
Member Author

nfeske commented Jun 25, 2024

@cproc may you take care of adjusting qt5 to the latest Region_map change?

nfeske added a commit to genodelabs/genode-world that referenced this issue Jun 25, 2024
cproc added a commit to cproc/qt5-dev that referenced this issue Jun 25, 2024
cproc added a commit to cproc/genode that referenced this issue Jun 25, 2024
@cproc
Copy link
Member

cproc commented Jun 25, 2024

Commit f89482c adapts qt5.

nfeske pushed a commit that referenced this issue Jun 25, 2024
@nfeske
Copy link
Member Author

nfeske commented Jun 25, 2024

Fantastic! Thank you @cproc.

nfeske added a commit that referenced this issue Jul 1, 2024
nfeske added a commit that referenced this issue Jul 1, 2024
This patch replaces the former Child::Process and
Child::Process::Loaded_executable classes by static functions that
return failure conditions as return values.

Issue #5245
@nfeske
Copy link
Member Author

nfeske commented Jul 1, 2024

Commit 3c00a1b removes exceptions from the parent interface.
Commit 87952dc revisits the child creation (ELF loading, process starting) in this respect.

nfeske added a commit that referenced this issue Jul 2, 2024
The 'Thread_creation_failed' error is now reflected as
'Thread::Start_result' return value. This change also removes the
use of 'Invalid_thread' within core as this exception is an alias
of Cpu_session::Thread_creation_failed.

Issue #5245
nfeske added a commit that referenced this issue Jul 2, 2024
- Remove exceptions
- Use 'Attr' struct for attach arguments
- Let 'attach' return 'Range' instead of 'Local_addr'
- Renamed 'Region_map::State' to 'Region_map::Fault'

Issue #5245
Fixes #5070
nfeske pushed a commit that referenced this issue Jul 2, 2024
nfeske added a commit that referenced this issue Jul 2, 2024
nfeske added a commit that referenced this issue Jul 2, 2024
This patch replaces the former Child::Process and
Child::Process::Loaded_executable classes by static functions that
return failure conditions as return values.

Issue #5245
nfeske added a commit to nfeske/genode that referenced this issue Aug 6, 2024
To maintain ease of use at the client side, the OUT_OF_RAM and
OUT_OF_CAPS results are handled at the 'Gui::Connection' now.

Gui::Connection does not inherit the Gui::Session interface any longer,
which allows for the use of different result types.

Issue genodelabs#5242
Issue genodelabs#5245
nfeske added a commit to nfeske/genode that referenced this issue Aug 6, 2024
To maintain ease of use at the client side, the OUT_OF_RAM and
OUT_OF_CAPS results are handled at the 'Gui::Connection' now.

Gui::Connection does not inherit the Gui::Session interface any longer,
which allows for the use of different result types.

Issue genodelabs#5242
Issue genodelabs#5245
nfeske added a commit to nfeske/genode that referenced this issue Aug 8, 2024
To maintain ease of use at the client side, the OUT_OF_RAM and
OUT_OF_CAPS results are handled at the 'Gui::Connection' now.

Gui::Connection does not inherit the Gui::Session interface any longer,
which allows for the use of different result types.

Issue genodelabs#5242
Issue genodelabs#5245
nfeske added a commit to nfeske/genode that referenced this issue Aug 13, 2024
To maintain ease of use at the client side, the OUT_OF_RAM and
OUT_OF_CAPS results are handled at the 'Gui::Connection' now.

Gui::Connection does not inherit the Gui::Session interface any longer,
which allows for the use of different result types.

Issue genodelabs#5242
Issue genodelabs#5245
nfeske added a commit that referenced this issue Aug 14, 2024
To maintain ease of use at the client side, the OUT_OF_RAM and
OUT_OF_CAPS results are handled at the 'Gui::Connection' now.

Gui::Connection does not inherit the Gui::Session interface any longer,
which allows for the use of different result types.

Issue #5242
Issue #5245
chelmuth pushed a commit that referenced this issue Aug 27, 2024
To maintain ease of use at the client side, the OUT_OF_RAM and
OUT_OF_CAPS results are handled at the 'Gui::Connection' now.

Gui::Connection does not inherit the Gui::Session interface any longer,
which allows for the use of different result types.

Issue #5242
Issue #5245
nfeske added a commit that referenced this issue Nov 14, 2024
This patch removes the only residual C++ exception from the kernel part
of core, eliminating the risk of the kernel thread trying to enter the
kernel itself via the C++ exception-handling path. When throwing an
exception, __cxa_allocate_exception invokes the cxx_heap, which
synchronizes accesses via a Genode::Mutex. In the contention case,
the blocking of the mutex issues a syscall to pause the caller.
The patch fixes the problem by replacing the exception with a return
value.

Fixes #5382
Issue #5245
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants